1

media: v4l: async: Set owner for async sub-devices

Set the owner field of the async sub-devices by making
v4l2_async_register_subdev() a macro and obtaining THIS_MODULE that way.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
Sakari Ailus 2024-03-13 13:57:50 +00:00 committed by Mauro Carvalho Chehab
parent aa7b148855
commit 8a718752f5
2 changed files with 9 additions and 3 deletions

View File

@ -783,7 +783,7 @@ v4l2_async_connection_unique(struct v4l2_subdev *sd)
}
EXPORT_SYMBOL_GPL(v4l2_async_connection_unique);
int v4l2_async_register_subdev(struct v4l2_subdev *sd)
int __v4l2_async_register_subdev(struct v4l2_subdev *sd, struct module *module)
{
struct v4l2_async_notifier *subdev_notifier;
struct v4l2_async_notifier *notifier;
@ -807,6 +807,8 @@ int v4l2_async_register_subdev(struct v4l2_subdev *sd)
return -EINVAL;
}
sd->owner = module;
mutex_lock(&list_lock);
list_for_each_entry(notifier, &notifier_list, notifier_entry) {
@ -849,9 +851,11 @@ err_unbind:
mutex_unlock(&list_lock);
sd->owner = NULL;
return ret;
}
EXPORT_SYMBOL(v4l2_async_register_subdev);
EXPORT_SYMBOL(__v4l2_async_register_subdev);
void v4l2_async_unregister_subdev(struct v4l2_subdev *sd)
{

View File

@ -310,7 +310,9 @@ void v4l2_async_nf_cleanup(struct v4l2_async_notifier *notifier);
*
* @sd: pointer to &struct v4l2_subdev
*/
int v4l2_async_register_subdev(struct v4l2_subdev *sd);
#define v4l2_async_register_subdev(sd) \
__v4l2_async_register_subdev(sd, THIS_MODULE)
int __v4l2_async_register_subdev(struct v4l2_subdev *sd, struct module *module);
/**
* v4l2_async_register_subdev_sensor - registers a sensor sub-device to the