Skip to content

Commit f22da32

Browse files
Sakari Ailusrkhuangtao
authored andcommitted
FROMLIST: v4l: async: Remove re-probing support
Remove V4L2 async re-probing support. The re-probing support has been there to support cases where the sub-devices require resources provided by the main driver's hardware to function, such as clocks. Reprobing has allowed unbinding and again binding the main driver without explicilty unbinding the sub-device drivers. This is certainly not a common need, and the responsibility will be the user's going forward. An alternative could have been to introduce notifier specific locks. Considering the complexity of the re-probing and that it isn't really a solution to a problem but a workaround, remove re-probing instead. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Acked-by: Hans Verkuil <hans.verkuil@cisco.com> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> (cherry picked from commit 382da6accc6808123971e0f257eae2a2110d8486) https://git.linuxtv.org/sailus/media_tree.git/log/?h=010f7f4393fd http://www.spinics.net/lists/linux-media/msg122688.html Signed-off-by: Marc Herbert <marc.herbert@intel.com> BUG=b:64133998 TEST=media device topology shows subdevs registered successfully TEST=no camera regression Change-Id: Ic19af101230e335cb00c575d59a17040629aa72b Reviewed-on: https://chromium-review.googlesource.com/693685 Commit-Ready: Tomasz Figa <tfiga@chromium.org> Tested-by: Hyungwoo Yang <hyungwoo.yang@intel.com> Reviewed-by: Tomasz Figa <tfiga@chromium.org> Signed-off-by: Jacob Chen <jacob2.chen@rock-chips.com>
1 parent b5fb952 commit f22da32

1 file changed

Lines changed: 1 addition & 53 deletions

File tree

drivers/media/v4l2-core/v4l2-async.c

Lines changed: 1 addition & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -202,78 +202,26 @@ EXPORT_SYMBOL(v4l2_async_notifier_register);
202202
void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier)
203203
{
204204
struct v4l2_subdev *sd, *tmp;
205-
unsigned int notif_n_subdev = notifier->num_subdevs;
206-
unsigned int n_subdev = min(notif_n_subdev, V4L2_MAX_SUBDEVS);
207-
struct device **dev;
208-
int i = 0;
209205

210206
if (!notifier->v4l2_dev)
211207
return;
212208

213-
dev = kmalloc_array(n_subdev, sizeof(*dev), GFP_KERNEL);
214-
if (!dev) {
215-
dev_err(notifier->v4l2_dev->dev,
216-
"Failed to allocate device cache!\n");
217-
}
218-
219209
mutex_lock(&list_lock);
220210

221211
list_del(&notifier->list);
222212

223213
list_for_each_entry_safe(sd, tmp, &notifier->done, async_list) {
224-
struct device *d;
225-
226-
d = get_device(sd->dev);
227-
228214
v4l2_async_cleanup(sd);
229215

230-
/* If we handled USB devices, we'd have to lock the parent too */
231-
device_release_driver(d);
232-
233216
if (notifier->unbind)
234217
notifier->unbind(notifier, sd, sd->asd);
235218

236-
/*
237-
* Store device at the device cache, in order to call
238-
* put_device() on the final step
239-
*/
240-
if (dev)
241-
dev[i++] = d;
242-
else
243-
put_device(d);
219+
list_move(&sd->async_list, &subdev_list);
244220
}
245221

246222
mutex_unlock(&list_lock);
247223

248-
/*
249-
* Call device_attach() to reprobe devices
250-
*
251-
* NOTE: If dev allocation fails, i is 0, and the whole loop won't be
252-
* executed.
253-
*/
254-
while (i--) {
255-
struct device *d = dev[i];
256-
257-
if (d && device_attach(d) < 0) {
258-
const char *name = "(none)";
259-
int lock = device_trylock(d);
260-
261-
if (lock && d->driver)
262-
name = d->driver->name;
263-
dev_err(d, "Failed to re-probe to %s\n", name);
264-
if (lock)
265-
device_unlock(d);
266-
}
267-
put_device(d);
268-
}
269-
kfree(dev);
270-
271224
notifier->v4l2_dev = NULL;
272-
273-
/*
274-
* Don't care about the waiting list, it is initialised and populated
275-
* upon notifier registration.
276-
*/
277225
}
278226
EXPORT_SYMBOL(v4l2_async_notifier_unregister);
279227

0 commit comments

Comments
 (0)