diff options
author | Paul Gortmaker <paul.gortmaker@windriver.com> | 2011-05-27 09:02:11 -0400 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2011-10-31 19:32:32 -0400 |
commit | eb5589a8f0dab7e29021344228856339e6a1249c (patch) | |
tree | d83790e5ac7feacba5b1832fbe7f8d2a39d76f65 | |
parent | 7c926402a7e8c9b279968fd94efec8700ba3859e (diff) |
include: convert various register fcns to macros to avoid include chaining
The original implementations reference THIS_MODULE in an inline.
We could include <linux/export.h>, but it is better to avoid chaining.
Fortunately someone else already thought of this, and made a similar
inline into a #define in <linux/device.h> for device_schedule_callback(),
[see commit 523ded71de0] so follow that precedent here.
Also bubble up any __must_check that were used on the prev. wrapper inline
functions up one to the real __register functions, to preserve any prev.
sanity checks that were used in those instances.
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
-rw-r--r-- | include/linux/bcma/bcma.h | 7 | ||||
-rw-r--r-- | include/linux/device.h | 12 | ||||
-rw-r--r-- | include/linux/gameport.h | 17 | ||||
-rw-r--r-- | include/linux/hid.h | 9 | ||||
-rw-r--r-- | include/linux/i2c.h | 7 | ||||
-rw-r--r-- | include/linux/pci_hotplug.h | 10 | ||||
-rw-r--r-- | include/linux/serio.h | 20 | ||||
-rw-r--r-- | include/linux/ssb/ssb.h | 7 | ||||
-rw-r--r-- | include/linux/uio_driver.h | 10 | ||||
-rw-r--r-- | include/linux/usb.h | 9 | ||||
-rw-r--r-- | include/linux/uwb/umc.h | 7 |
11 files changed, 57 insertions, 58 deletions
diff --git a/include/linux/bcma/bcma.h b/include/linux/bcma/bcma.h index 5dbd7055cb86..4d4b59de9467 100644 --- a/include/linux/bcma/bcma.h +++ b/include/linux/bcma/bcma.h | |||
@@ -170,10 +170,9 @@ struct bcma_driver { | |||
170 | }; | 170 | }; |
171 | extern | 171 | extern |
172 | int __bcma_driver_register(struct bcma_driver *drv, struct module *owner); | 172 | int __bcma_driver_register(struct bcma_driver *drv, struct module *owner); |
173 | static inline int bcma_driver_register(struct bcma_driver *drv) | 173 | #define bcma_driver_register(drv) \ |
174 | { | 174 | __bcma_driver_register(drv, THIS_MODULE) |
175 | return __bcma_driver_register(drv, THIS_MODULE); | 175 | |
176 | } | ||
177 | extern void bcma_driver_unregister(struct bcma_driver *drv); | 176 | extern void bcma_driver_unregister(struct bcma_driver *drv); |
178 | 177 | ||
179 | struct bcma_bus { | 178 | struct bcma_bus { |
diff --git a/include/linux/device.h b/include/linux/device.h index 85e78fc7d7fd..61f29f6a403d 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -723,10 +723,14 @@ extern int dev_set_drvdata(struct device *dev, void *data); | |||
723 | */ | 723 | */ |
724 | extern struct device *__root_device_register(const char *name, | 724 | extern struct device *__root_device_register(const char *name, |
725 | struct module *owner); | 725 | struct module *owner); |
726 | static inline struct device *root_device_register(const char *name) | 726 | |
727 | { | 727 | /* |
728 | return __root_device_register(name, THIS_MODULE); | 728 | * This is a macro to avoid include problems with THIS_MODULE, |
729 | } | 729 | * just as per what is done for device_schedule_callback() above. |
730 | */ | ||
731 | #define root_device_register(name) \ | ||
732 | __root_device_register(name, THIS_MODULE) | ||
733 | |||
730 | extern void root_device_unregister(struct device *root); | 734 | extern void root_device_unregister(struct device *root); |
731 | 735 | ||
732 | static inline void *dev_get_platdata(const struct device *dev) | 736 | static inline void *dev_get_platdata(const struct device *dev) |
diff --git a/include/linux/gameport.h b/include/linux/gameport.h index b65a6f472775..e74073e9dd8d 100644 --- a/include/linux/gameport.h +++ b/include/linux/gameport.h | |||
@@ -71,10 +71,9 @@ void gameport_close(struct gameport *gameport); | |||
71 | #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) | 71 | #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) |
72 | 72 | ||
73 | void __gameport_register_port(struct gameport *gameport, struct module *owner); | 73 | void __gameport_register_port(struct gameport *gameport, struct module *owner); |
74 | static inline void gameport_register_port(struct gameport *gameport) | 74 | /* use a define to avoid include chaining to get THIS_MODULE */ |
75 | { | 75 | #define gameport_register_port(gameport) \ |
76 | __gameport_register_port(gameport, THIS_MODULE); | 76 | __gameport_register_port(gameport, THIS_MODULE) |
77 | } | ||
78 | 77 | ||
79 | void gameport_unregister_port(struct gameport *gameport); | 78 | void gameport_unregister_port(struct gameport *gameport); |
80 | 79 | ||
@@ -145,12 +144,12 @@ static inline void gameport_unpin_driver(struct gameport *gameport) | |||
145 | mutex_unlock(&gameport->drv_mutex); | 144 | mutex_unlock(&gameport->drv_mutex); |
146 | } | 145 | } |
147 | 146 | ||
148 | int __gameport_register_driver(struct gameport_driver *drv, | 147 | int __must_check __gameport_register_driver(struct gameport_driver *drv, |
149 | struct module *owner, const char *mod_name); | 148 | struct module *owner, const char *mod_name); |
150 | static inline int __must_check gameport_register_driver(struct gameport_driver *drv) | 149 | |
151 | { | 150 | /* use a define to avoid include chaining to get THIS_MODULE & friends */ |
152 | return __gameport_register_driver(drv, THIS_MODULE, KBUILD_MODNAME); | 151 | #define gameport_register_driver(drv) \ |
153 | } | 152 | __gameport_register_driver(drv, THIS_MODULE, KBUILD_MODNAME) |
154 | 153 | ||
155 | void gameport_unregister_driver(struct gameport_driver *drv); | 154 | void gameport_unregister_driver(struct gameport_driver *drv); |
156 | 155 | ||
diff --git a/include/linux/hid.h b/include/linux/hid.h index deed5f9a1e1c..c235e4e8767c 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h | |||
@@ -697,10 +697,11 @@ extern void hid_destroy_device(struct hid_device *); | |||
697 | 697 | ||
698 | extern int __must_check __hid_register_driver(struct hid_driver *, | 698 | extern int __must_check __hid_register_driver(struct hid_driver *, |
699 | struct module *, const char *mod_name); | 699 | struct module *, const char *mod_name); |
700 | static inline int __must_check hid_register_driver(struct hid_driver *driver) | 700 | |
701 | { | 701 | /* use a define to avoid include chaining to get THIS_MODULE & friends */ |
702 | return __hid_register_driver(driver, THIS_MODULE, KBUILD_MODNAME); | 702 | #define hid_register_driver(driver) \ |
703 | } | 703 | __hid_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) |
704 | |||
704 | extern void hid_unregister_driver(struct hid_driver *); | 705 | extern void hid_unregister_driver(struct hid_driver *); |
705 | 706 | ||
706 | extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); | 707 | extern void hidinput_hid_event(struct hid_device *, struct hid_field *, struct hid_usage *, __s32); |
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 38a21c3edd2c..1be303bfc254 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h | |||
@@ -451,10 +451,9 @@ extern int i2c_add_numbered_adapter(struct i2c_adapter *); | |||
451 | extern int i2c_register_driver(struct module *, struct i2c_driver *); | 451 | extern int i2c_register_driver(struct module *, struct i2c_driver *); |
452 | extern void i2c_del_driver(struct i2c_driver *); | 452 | extern void i2c_del_driver(struct i2c_driver *); |
453 | 453 | ||
454 | static inline int i2c_add_driver(struct i2c_driver *driver) | 454 | /* use a define to avoid include chaining to get THIS_MODULE */ |
455 | { | 455 | #define i2c_add_driver(driver) \ |
456 | return i2c_register_driver(THIS_MODULE, driver); | 456 | i2c_register_driver(THIS_MODULE, driver) |
457 | } | ||
458 | 457 | ||
459 | extern struct i2c_client *i2c_use_client(struct i2c_client *client); | 458 | extern struct i2c_client *i2c_use_client(struct i2c_client *client); |
460 | extern void i2c_release_client(struct i2c_client *client); | 459 | extern void i2c_release_client(struct i2c_client *client); |
diff --git a/include/linux/pci_hotplug.h b/include/linux/pci_hotplug.h index 5d09cbafa7db..45fc162cbdc0 100644 --- a/include/linux/pci_hotplug.h +++ b/include/linux/pci_hotplug.h | |||
@@ -132,13 +132,9 @@ extern int pci_hp_deregister(struct hotplug_slot *slot); | |||
132 | extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot, | 132 | extern int __must_check pci_hp_change_slot_info (struct hotplug_slot *slot, |
133 | struct hotplug_slot_info *info); | 133 | struct hotplug_slot_info *info); |
134 | 134 | ||
135 | static inline int pci_hp_register(struct hotplug_slot *slot, | 135 | /* use a define to avoid include chaining to get THIS_MODULE & friends */ |
136 | struct pci_bus *pbus, | 136 | #define pci_hp_register(slot, pbus, devnr, name) \ |
137 | int devnr, const char *name) | 137 | __pci_hp_register(slot, pbus, devnr, name, THIS_MODULE, KBUILD_MODNAME) |
138 | { | ||
139 | return __pci_hp_register(slot, pbus, devnr, name, | ||
140 | THIS_MODULE, KBUILD_MODNAME); | ||
141 | } | ||
142 | 138 | ||
143 | /* PCI Setting Record (Type 0) */ | 139 | /* PCI Setting Record (Type 0) */ |
144 | struct hpp_type0 { | 140 | struct hpp_type0 { |
diff --git a/include/linux/serio.h b/include/linux/serio.h index be7dfb0f12d0..ca82861b0e46 100644 --- a/include/linux/serio.h +++ b/include/linux/serio.h | |||
@@ -79,19 +79,21 @@ void serio_reconnect(struct serio *serio); | |||
79 | irqreturn_t serio_interrupt(struct serio *serio, unsigned char data, unsigned int flags); | 79 | irqreturn_t serio_interrupt(struct serio *serio, unsigned char data, unsigned int flags); |
80 | 80 | ||
81 | void __serio_register_port(struct serio *serio, struct module *owner); | 81 | void __serio_register_port(struct serio *serio, struct module *owner); |
82 | static inline void serio_register_port(struct serio *serio) | 82 | |
83 | { | 83 | /* use a define to avoid include chaining to get THIS_MODULE */ |
84 | __serio_register_port(serio, THIS_MODULE); | 84 | #define serio_register_port(serio) \ |
85 | } | 85 | __serio_register_port(serio, THIS_MODULE) |
86 | 86 | ||
87 | void serio_unregister_port(struct serio *serio); | 87 | void serio_unregister_port(struct serio *serio); |
88 | void serio_unregister_child_port(struct serio *serio); | 88 | void serio_unregister_child_port(struct serio *serio); |
89 | 89 | ||
90 | int __serio_register_driver(struct serio_driver *drv, struct module *owner, const char *mod_name); | 90 | int __must_check __serio_register_driver(struct serio_driver *drv, |
91 | static inline int __must_check serio_register_driver(struct serio_driver *drv) | 91 | struct module *owner, const char *mod_name); |
92 | { | 92 | |
93 | return __serio_register_driver(drv, THIS_MODULE, KBUILD_MODNAME); | 93 | /* use a define to avoid include chaining to get THIS_MODULE & friends */ |
94 | } | 94 | #define serio_register_driver(drv) \ |
95 | __serio_register_driver(drv, THIS_MODULE, KBUILD_MODNAME) | ||
96 | |||
95 | void serio_unregister_driver(struct serio_driver *drv); | 97 | void serio_unregister_driver(struct serio_driver *drv); |
96 | 98 | ||
97 | static inline int serio_write(struct serio *serio, unsigned char data) | 99 | static inline int serio_write(struct serio *serio, unsigned char data) |
diff --git a/include/linux/ssb/ssb.h b/include/linux/ssb/ssb.h index f10ed7b4a714..061e560251b4 100644 --- a/include/linux/ssb/ssb.h +++ b/include/linux/ssb/ssb.h | |||
@@ -231,10 +231,9 @@ struct ssb_driver { | |||
231 | #define drv_to_ssb_drv(_drv) container_of(_drv, struct ssb_driver, drv) | 231 | #define drv_to_ssb_drv(_drv) container_of(_drv, struct ssb_driver, drv) |
232 | 232 | ||
233 | extern int __ssb_driver_register(struct ssb_driver *drv, struct module *owner); | 233 | extern int __ssb_driver_register(struct ssb_driver *drv, struct module *owner); |
234 | static inline int ssb_driver_register(struct ssb_driver *drv) | 234 | #define ssb_driver_register(drv) \ |
235 | { | 235 | __ssb_driver_register(drv, THIS_MODULE) |
236 | return __ssb_driver_register(drv, THIS_MODULE); | 236 | |
237 | } | ||
238 | extern void ssb_driver_unregister(struct ssb_driver *drv); | 237 | extern void ssb_driver_unregister(struct ssb_driver *drv); |
239 | 238 | ||
240 | 239 | ||
diff --git a/include/linux/uio_driver.h b/include/linux/uio_driver.h index fd99ff9298c6..73898189a97c 100644 --- a/include/linux/uio_driver.h +++ b/include/linux/uio_driver.h | |||
@@ -101,11 +101,11 @@ extern int __must_check | |||
101 | __uio_register_device(struct module *owner, | 101 | __uio_register_device(struct module *owner, |
102 | struct device *parent, | 102 | struct device *parent, |
103 | struct uio_info *info); | 103 | struct uio_info *info); |
104 | static inline int __must_check | 104 | |
105 | uio_register_device(struct device *parent, struct uio_info *info) | 105 | /* use a define to avoid include chaining to get THIS_MODULE */ |
106 | { | 106 | #define uio_register_device(parent, info) \ |
107 | return __uio_register_device(THIS_MODULE, parent, info); | 107 | __uio_register_device(THIS_MODULE, parent, info) |
108 | } | 108 | |
109 | extern void uio_unregister_device(struct uio_info *info); | 109 | extern void uio_unregister_device(struct uio_info *info); |
110 | extern void uio_event_notify(struct uio_info *info); | 110 | extern void uio_event_notify(struct uio_info *info); |
111 | 111 | ||
diff --git a/include/linux/usb.h b/include/linux/usb.h index 6f49a1b39fa6..d3d0c1374334 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h | |||
@@ -946,10 +946,11 @@ struct usb_class_driver { | |||
946 | */ | 946 | */ |
947 | extern int usb_register_driver(struct usb_driver *, struct module *, | 947 | extern int usb_register_driver(struct usb_driver *, struct module *, |
948 | const char *); | 948 | const char *); |
949 | static inline int usb_register(struct usb_driver *driver) | 949 | |
950 | { | 950 | /* use a define to avoid include chaining to get THIS_MODULE & friends */ |
951 | return usb_register_driver(driver, THIS_MODULE, KBUILD_MODNAME); | 951 | #define usb_register(driver) \ |
952 | } | 952 | usb_register_driver(driver, THIS_MODULE, KBUILD_MODNAME) |
953 | |||
953 | extern void usb_deregister(struct usb_driver *); | 954 | extern void usb_deregister(struct usb_driver *); |
954 | 955 | ||
955 | extern int usb_register_device_driver(struct usb_device_driver *, | 956 | extern int usb_register_device_driver(struct usb_device_driver *, |
diff --git a/include/linux/uwb/umc.h b/include/linux/uwb/umc.h index 7b4842028ca7..891d1d5f3947 100644 --- a/include/linux/uwb/umc.h +++ b/include/linux/uwb/umc.h | |||
@@ -111,10 +111,9 @@ int __must_check __umc_driver_register(struct umc_driver *umc_drv, | |||
111 | * umc_driver_register - register a UMC capabiltity driver. | 111 | * umc_driver_register - register a UMC capabiltity driver. |
112 | * @umc_drv: pointer to the driver. | 112 | * @umc_drv: pointer to the driver. |
113 | */ | 113 | */ |
114 | static inline int __must_check umc_driver_register(struct umc_driver *umc_drv) | 114 | #define umc_driver_register(umc_drv) \ |
115 | { | 115 | __umc_driver_register(umc_drv, THIS_MODULE, KBUILD_MODNAME) |
116 | return __umc_driver_register(umc_drv, THIS_MODULE, KBUILD_MODNAME); | 116 | |
117 | } | ||
118 | void umc_driver_unregister(struct umc_driver *umc_drv); | 117 | void umc_driver_unregister(struct umc_driver *umc_drv); |
119 | 118 | ||
120 | /* | 119 | /* |