media: v4l: async: Set correct owner for sensor subdevices
Subsystems (2)
PATCH 1/1 media: v4l: async: Set correct owner for sensor subdevices
Commit 8a718752f5c3 ("media: v4l: async: Set owner for async sub-devices") turned v4l2_async_register_subdev() into a macro that used THIS_MODULE to obtain the owner module for the subdevice.
v4l2_async_register_subdev_sensor(sd) calls v4l2_async_register_subdev(), and that will reset sd->owner to NULL for the sensor device, if V4L2 core is built-in while the sensor driver is built as a module.
sd->owner is reset this way even if the sensor driver has set it properly earlier.
This patch makes v4l2_async_register_subdev_sensor() a macro similar to v4l2_async_register_subdev() to pass the owner module to the latter.
Fixes 8a718752f5c3 ("media: v4l: async: Set owner for async sub-devices")
Signed-off-by Evgenii Shatokhin <[email protected]>
--- drivers/media/v4l2-core/v4l2-fwnode.c | 7 ++++--- include/media/v4l2-async.h | 4 +++- 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/media/v4l2-core/v4l2-fwnode.c +4 -3
@@ -1246,7 +1246,8 @@ v4l2_async_nf_parse_fwnode_sensor(struct device *dev,return 0 ; } -int v4l2_async_register_subdev_sensor (struct v4l2_subdev *sd) +int __v4l2_async_register_subdev_sensor (struct v4l2_subdev *sd, +struct module *module) {struct v4l2_async_notifier *notifier;int ret;
@@ -1272,7 +1273,7 @@ int v4l2_async_register_subdev_sensor(struct v4l2_subdev *sd)if (ret <0 ) goto out_cleanup; - ret =v4l2_async_register_subdev (sd); + ret =__v4l2_async_register_subdev (sd, module);if (ret <0 ) goto out_unregister;
@@ -1290,7 +1291,7 @@ int v4l2_async_register_subdev_sensor(struct v4l2_subdev *sd)return ret; } -EXPORT_SYMBOL_GPL (v4l2_async_register_subdev_sensor); +EXPORT_SYMBOL_GPL (__v4l2_async_register_subdev_sensor);MODULE_DESCRIPTION ("V4L2 fwnode binding parsing library" );MODULE_LICENSE ("GPL" );
include/media/v4l2-async.h +3 -1
@@ -333,8 +333,10 @@ int __v4l2_async_register_subdev(struct v4l2_subdev *sd, struct module *module);* An error is returned if the module is no longer loaded on any attempts * to register it. */ +#define v4l2_async_register_subdev_sensor (sd) \ + __v4l2_async_register_subdev_sensor(sd, THIS_MODULE)int __must_check -v4l2_async_register_subdev_sensor (struct v4l2_subdev *sd); +__v4l2_async_register_subdev_sensor (struct v4l2_subdev *sd,struct module *module);/** * v4l2_async_unregister_subdev - unregisters a sub-device to the asynchronous
Signature · 1 line
2.34.1