From mboxrd@z Thu Jan 1 00:00:00 1970 From: Hans Verkuil Subject: Re: [PATCH v8 02/21] v4l: async: Remove re-probing support Date: Wed, 6 Sep 2017 09:00:30 +0200 Message-ID: <255d6d56-e6b8-0919-4e22-a38255d15e3d@xs4all.nl> References: <20170905130553.1332-1-sakari.ailus@linux.intel.com> <20170905130553.1332-3-sakari.ailus@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20170905130553.1332-3-sakari.ailus@linux.intel.com> Content-Language: en-US Sender: linux-media-owner@vger.kernel.org To: Sakari Ailus , linux-media@vger.kernel.org Cc: niklas.soderlund@ragnatech.se, robh@kernel.org, laurent.pinchart@ideasonboard.com, devicetree@vger.kernel.org, pavel@ucw.cz, sre@kernel.org List-Id: devicetree@vger.kernel.org On 09/05/2017 03:05 PM, Sakari Ailus wrote: > 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 Acked-by: Hans Verkuil Regards, Hans > --- > drivers/media/v4l2-core/v4l2-async.c | 54 ------------------------------------ > 1 file changed, 54 deletions(-) > > diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c > index 851f128eba22..f50a82767863 100644 > --- a/drivers/media/v4l2-core/v4l2-async.c > +++ b/drivers/media/v4l2-core/v4l2-async.c > @@ -203,78 +203,24 @@ EXPORT_SYMBOL(v4l2_async_notifier_register); > void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier) > { > struct v4l2_subdev *sd, *tmp; > - unsigned int notif_n_subdev = notifier->num_subdevs; > - unsigned int n_subdev = min(notif_n_subdev, V4L2_MAX_SUBDEVS); > - struct device **dev; > - int i = 0; > > if (!notifier->v4l2_dev) > return; > > - dev = kvmalloc_array(n_subdev, sizeof(*dev), GFP_KERNEL); > - if (!dev) { > - dev_err(notifier->v4l2_dev->dev, > - "Failed to allocate device cache!\n"); > - } > - > mutex_lock(&list_lock); > > list_del(¬ifier->list); > > list_for_each_entry_safe(sd, tmp, ¬ifier->done, async_list) { > - struct device *d; > - > - d = get_device(sd->dev); > - > v4l2_async_cleanup(sd); > > - /* If we handled USB devices, we'd have to lock the parent too */ > - device_release_driver(d); > - > if (notifier->unbind) > notifier->unbind(notifier, sd, sd->asd); > - > - /* > - * Store device at the device cache, in order to call > - * put_device() on the final step > - */ > - if (dev) > - dev[i++] = d; > - else > - put_device(d); > } > > mutex_unlock(&list_lock); > > - /* > - * Call device_attach() to reprobe devices > - * > - * NOTE: If dev allocation fails, i is 0, and the whole loop won't be > - * executed. > - */ > - while (i--) { > - struct device *d = dev[i]; > - > - if (d && device_attach(d) < 0) { > - const char *name = "(none)"; > - int lock = device_trylock(d); > - > - if (lock && d->driver) > - name = d->driver->name; > - dev_err(d, "Failed to re-probe to %s\n", name); > - if (lock) > - device_unlock(d); > - } > - put_device(d); > - } > - kvfree(dev); > - > notifier->v4l2_dev = NULL; > - > - /* > - * Don't care about the waiting list, it is initialised and populated > - * upon notifier registration. > - */ > } > EXPORT_SYMBOL(v4l2_async_notifier_unregister); > >