Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Sakari Ailus and committed by
Mauro Carvalho Chehab
8a718752 aa7b1488

+9 -3
+6 -2
drivers/media/v4l2-core/v4l2-async.c
··· 783 783 } 784 784 EXPORT_SYMBOL_GPL(v4l2_async_connection_unique); 785 785 786 - int v4l2_async_register_subdev(struct v4l2_subdev *sd) 786 + int __v4l2_async_register_subdev(struct v4l2_subdev *sd, struct module *module) 787 787 { 788 788 struct v4l2_async_notifier *subdev_notifier; 789 789 struct v4l2_async_notifier *notifier; ··· 806 806 dev_warn(sd->dev, "sub-device fwnode is an endpoint!\n"); 807 807 return -EINVAL; 808 808 } 809 + 810 + sd->owner = module; 809 811 810 812 mutex_lock(&list_lock); 811 813 ··· 851 849 852 850 mutex_unlock(&list_lock); 853 851 852 + sd->owner = NULL; 853 + 854 854 return ret; 855 855 } 856 - EXPORT_SYMBOL(v4l2_async_register_subdev); 856 + EXPORT_SYMBOL(__v4l2_async_register_subdev); 857 857 858 858 void v4l2_async_unregister_subdev(struct v4l2_subdev *sd) 859 859 {
+3 -1
include/media/v4l2-async.h
··· 310 310 * 311 311 * @sd: pointer to &struct v4l2_subdev 312 312 */ 313 - int v4l2_async_register_subdev(struct v4l2_subdev *sd); 313 + #define v4l2_async_register_subdev(sd) \ 314 + __v4l2_async_register_subdev(sd, THIS_MODULE) 315 + int __v4l2_async_register_subdev(struct v4l2_subdev *sd, struct module *module); 314 316 315 317 /** 316 318 * v4l2_async_register_subdev_sensor - registers a sensor sub-device to the