Message ID | 1513189580-32202-4-git-send-email-jacopo+renesas@jmondi.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Jacopo, On Wed, Dec 13, 2017 at 07:26:18PM +0100, Jacopo Mondi wrote: > Notifiers can be registered as root notifiers (identified by a 'struct > v4l2_device *') or subdevice notifiers (identified by a 'struct > v4l2_subdev *'). In order to identify a notifier no matter if it is root > or not, add a 'struct fwnode_handle *owner' field, whose name can be > printed out for debug purposes. > > Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org> You'll have struct device either through the v4l2_device or v4l2_subdev. Do you need an additional field for this?
Hello, On Friday, 15 December 2017 16:38:16 EET Sakari Ailus wrote: > Hi Jacopo, > > On Wed, Dec 13, 2017 at 07:26:18PM +0100, Jacopo Mondi wrote: > > Notifiers can be registered as root notifiers (identified by a 'struct > > v4l2_device *') or subdevice notifiers (identified by a 'struct > > v4l2_subdev *'). In order to identify a notifier no matter if it is root > > or not, add a 'struct fwnode_handle *owner' field, whose name can be > > printed out for debug purposes. > > > > Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org> > > You'll have struct device either through the v4l2_device or v4l2_subdev. Do > you need an additional field for this? I agree with this comment. If there's a reason to add a new field, its life time constraints should be documented. The fwnodes are refcounted and you're not increasing the refcount here, you should explain why you don't need to.
diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c index a6bddff..0a1bf1d 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -447,6 +447,7 @@ int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev, return -EINVAL; notifier->v4l2_dev = v4l2_dev; + notifier->owner = dev_fwnode(v4l2_dev->dev); ret = __v4l2_async_notifier_register(notifier); if (ret) @@ -465,6 +466,7 @@ int v4l2_async_subdev_notifier_register(struct v4l2_subdev *sd, return -EINVAL; notifier->sd = sd; + notifier->owner = dev_fwnode(sd->dev); ret = __v4l2_async_notifier_register(notifier); if (ret) diff --git a/include/media/v4l2-async.h b/include/media/v4l2-async.h index 6152434..a15c01d 100644 --- a/include/media/v4l2-async.h +++ b/include/media/v4l2-async.h @@ -106,6 +106,7 @@ struct v4l2_async_notifier_operations { * @v4l2_dev: v4l2_device of the root notifier, NULL otherwise * @sd: sub-device that registered the notifier, NULL otherwise * @parent: parent notifier + * @owner: reference to notifier fwnode_handle, mostly useful for debug * @waiting: list of struct v4l2_async_subdev, waiting for their drivers * @done: list of struct v4l2_subdev, already probed * @list: member in a global list of notifiers @@ -118,6 +119,7 @@ struct v4l2_async_notifier { struct v4l2_device *v4l2_dev; struct v4l2_subdev *sd; struct v4l2_async_notifier *parent; + struct fwnode_handle *owner; struct list_head waiting; struct list_head done; struct list_head list;
Notifiers can be registered as root notifiers (identified by a 'struct v4l2_device *') or subdevice notifiers (identified by a 'struct v4l2_subdev *'). In order to identify a notifier no matter if it is root or not, add a 'struct fwnode_handle *owner' field, whose name can be printed out for debug purposes. Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org> --- drivers/media/v4l2-core/v4l2-async.c | 2 ++ include/media/v4l2-async.h | 2 ++ 2 files changed, 4 insertions(+)