From 9447057eaff871dd7c63c808de761b8732407169 Mon Sep 17 00:00:00 2001 From: Libo Chen Date: Sat, 25 May 2013 12:40:50 +0800 Subject: platform_device: use a macro instead of platform_driver_register I found a lot of mistakes using struct platform_driver without owner so I make a macro instead of the function platform_driver_register. It can set owner in it, then guys don`t care about module owner again. Signed-off-by: Libo Chen Signed-off-by: Greg Kroah-Hartman --- include/linux/platform_device.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'include/linux/platform_device.h') diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h index 9abf1db6aea..cd46ee58b9d 100644 --- a/include/linux/platform_device.h +++ b/include/linux/platform_device.h @@ -180,7 +180,13 @@ struct platform_driver { const struct platform_device_id *id_table; }; -extern int platform_driver_register(struct platform_driver *); +/* + * use a macro to avoid include chaining to get THIS_MODULE + */ +#define platform_driver_register(drv) \ + __platform_driver_register(drv, THIS_MODULE) +extern int __platform_driver_register(struct platform_driver *, + struct module *); extern void platform_driver_unregister(struct platform_driver *); /* non-hotpluggable platform devices may use this so that probe() and -- cgit v1.2.3-70-g09d2