summaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorLibo Chen <clbchenlibo.chen@huawei.com>2013-05-25 12:40:50 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-06-03 13:59:03 -0700
commit9447057eaff871dd7c63c808de761b8732407169 (patch)
tree6284b1e6653b14ceb6a9193002eec6303a509a66 /include/linux
parentf494513ff1b3f6bee2df329d8bbe864febf05a27 (diff)
downloadop-kernel-dev-9447057eaff871dd7c63c808de761b8732407169.zip
op-kernel-dev-9447057eaff871dd7c63c808de761b8732407169.tar.gz
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 <libo.chen@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/platform_device.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 9abf1db..cd46ee5 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
OpenPOWER on IntegriCloud