* [PATCH 1/2] [media] tvp5150: use sd internal ops .registered instead .registered_async
2016-08-11 16:28 [PATCH 0/2] [media] tvp5150: use .registered callback to register entity and links Javier Martinez Canillas
@ 2016-08-11 16:28 ` Javier Martinez Canillas
2016-08-11 16:28 ` [PATCH 2/2] [media] v4l2-async: remove unneeded .registered_async callback Javier Martinez Canillas
2016-08-11 19:31 ` [PATCH 0/2] [media] tvp5150: use .registered callback to register entity and links Sakari Ailus
2 siblings, 0 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2016-08-11 16:28 UTC (permalink / raw)
To: linux-kernel
Cc: Mauro Carvalho Chehab, Javier Martinez Canillas, Sakari Ailus,
Laurent Pinchart, linux-media
The driver is using the struct v4l2_subdev_core_ops .registered_async
callback to register the connector entities and create the pad links
after the subdev entity has been registered with the media device.
But the .registered_async callback isn't needed since the v4l2 core
already calls the struct v4l2_subdev_internal_ops .registered callback
in v4l2_device_register_subdev(), after media_device_register_entity().
So, use the .registered() callback instead of the .registered_async()
that is going to be removed in a following patch since isn't needed.
Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---
drivers/media/i2c/tvp5150.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index 0b6d46c453bf..52e340c988a0 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -1173,7 +1173,7 @@ static int tvp5150_g_tuner(struct v4l2_subdev *sd, struct v4l2_tuner *vt)
return 0;
}
-static int tvp5150_registered_async(struct v4l2_subdev *sd)
+static int tvp5150_registered(struct v4l2_subdev *sd)
{
#ifdef CONFIG_MEDIA_CONTROLLER
struct tvp5150 *decoder = to_tvp5150(sd);
@@ -1222,7 +1222,6 @@ static const struct v4l2_subdev_core_ops tvp5150_core_ops = {
.g_register = tvp5150_g_register,
.s_register = tvp5150_s_register,
#endif
- .registered_async = tvp5150_registered_async,
};
static const struct v4l2_subdev_tuner_ops tvp5150_tuner_ops = {
@@ -1261,6 +1260,10 @@ static const struct v4l2_subdev_ops tvp5150_ops = {
.pad = &tvp5150_pad_ops,
};
+static const struct v4l2_subdev_internal_ops tvp5150_internal_ops = {
+ .registered = tvp5150_registered,
+};
+
/****************************************************************************
I2C Client & Driver
@@ -1474,6 +1477,7 @@ static int tvp5150_probe(struct i2c_client *c,
}
v4l2_i2c_subdev_init(sd, c, &tvp5150_ops);
+ sd->internal_ops = &tvp5150_internal_ops;
sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
#if defined(CONFIG_MEDIA_CONTROLLER)
--
2.5.5
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/2] [media] v4l2-async: remove unneeded .registered_async callback
2016-08-11 16:28 [PATCH 0/2] [media] tvp5150: use .registered callback to register entity and links Javier Martinez Canillas
2016-08-11 16:28 ` [PATCH 1/2] [media] tvp5150: use sd internal ops .registered instead .registered_async Javier Martinez Canillas
@ 2016-08-11 16:28 ` Javier Martinez Canillas
2016-08-11 19:31 ` [PATCH 0/2] [media] tvp5150: use .registered callback to register entity and links Sakari Ailus
2 siblings, 0 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2016-08-11 16:28 UTC (permalink / raw)
To: linux-kernel
Cc: Mauro Carvalho Chehab, Javier Martinez Canillas, Sakari Ailus,
Laurent Pinchart, linux-media
The v4l2_subdev_core_ops .registered_async callback was added to notify
a subdev when its entity has been registered with the media device, to
allow for example to modify the media graph (i.e: adding entities/links).
But that's not needed since there is already a .registered callback in
struct v4l2_subdev_internal_ops that's called after the entity has been
registered with the media device in v4l2_device_register_subdev().
Suggested-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---
drivers/media/v4l2-core/v4l2-async.c | 7 -------
include/media/v4l2-subdev.h | 3 ---
2 files changed, 10 deletions(-)
diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
index a4b224d92572..5bada202b2d3 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -119,13 +119,6 @@ static int v4l2_async_test_notify(struct v4l2_async_notifier *notifier,
return ret;
}
- ret = v4l2_subdev_call(sd, core, registered_async);
- if (ret < 0 && ret != -ENOIOCTLCMD) {
- if (notifier->unbind)
- notifier->unbind(notifier, sd, asd);
- return ret;
- }
-
if (list_empty(¬ifier->waiting) && notifier->complete)
return notifier->complete(notifier);
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 2a2240c99b30..6baad1387203 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -184,8 +184,6 @@ struct v4l2_subdev_io_pin_config {
* for it to be warned when the value of a control changes.
*
* @unsubscribe_event: remove event subscription from the control framework.
- *
- * @registered_async: the subdevice has been registered async.
*/
struct v4l2_subdev_core_ops {
int (*log_status)(struct v4l2_subdev *sd);
@@ -211,7 +209,6 @@ struct v4l2_subdev_core_ops {
struct v4l2_event_subscription *sub);
int (*unsubscribe_event)(struct v4l2_subdev *sd, struct v4l2_fh *fh,
struct v4l2_event_subscription *sub);
- int (*registered_async)(struct v4l2_subdev *sd);
};
/**
--
2.5.5
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 0/2] [media] tvp5150: use .registered callback to register entity and links
2016-08-11 16:28 [PATCH 0/2] [media] tvp5150: use .registered callback to register entity and links Javier Martinez Canillas
2016-08-11 16:28 ` [PATCH 1/2] [media] tvp5150: use sd internal ops .registered instead .registered_async Javier Martinez Canillas
2016-08-11 16:28 ` [PATCH 2/2] [media] v4l2-async: remove unneeded .registered_async callback Javier Martinez Canillas
@ 2016-08-11 19:31 ` Sakari Ailus
2016-08-11 19:33 ` Javier Martinez Canillas
2 siblings, 1 reply; 5+ messages in thread
From: Sakari Ailus @ 2016-08-11 19:31 UTC (permalink / raw)
To: Javier Martinez Canillas, linux-kernel
Cc: Mauro Carvalho Chehab, Laurent Pinchart, linux-media
Javier Martinez Canillas wrote:
> Hello,
>
> Sakari pointed out in "[PATCH 2/8] [media] v4l2-async: call registered_async
> after subdev registration" [0] that the added .registered_async callback isn't
> needed since the v4l2 core already has an internal_ops .registered callback.
>
> I missed that there was already this when added the .registered_async callback,
> sorry about that.
>
> This small series convert the tvp5150 driver to use the proper .registered and
> remove .registered_async since isn't needed.
Thanks!
For both:
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
--
Kind regards,
Sakari Ailus
sakari.ailus@linux.intel.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] [media] tvp5150: use .registered callback to register entity and links
2016-08-11 19:31 ` [PATCH 0/2] [media] tvp5150: use .registered callback to register entity and links Sakari Ailus
@ 2016-08-11 19:33 ` Javier Martinez Canillas
0 siblings, 0 replies; 5+ messages in thread
From: Javier Martinez Canillas @ 2016-08-11 19:33 UTC (permalink / raw)
To: Sakari Ailus, linux-kernel
Cc: Mauro Carvalho Chehab, Laurent Pinchart, linux-media
Hello Sakari,
On 08/11/2016 03:31 PM, Sakari Ailus wrote:
> Javier Martinez Canillas wrote:
>> Hello,
>>
>> Sakari pointed out in "[PATCH 2/8] [media] v4l2-async: call registered_async
>> after subdev registration" [0] that the added .registered_async callback isn't
>> needed since the v4l2 core already has an internal_ops .registered callback.
>>
>> I missed that there was already this when added the .registered_async callback,
>> sorry about that.
>>
>> This small series convert the tvp5150 driver to use the proper .registered and
>> remove .registered_async since isn't needed.
>
> Thanks!
>
> For both:
>
> Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
>
Thanks to you for pointing out my silly mistake.
Best regards,
--
Javier Martinez Canillas
Open Source Group
Samsung Research America
^ permalink raw reply [flat|nested] 5+ messages in thread