diff options
author | David Brownell <david-b@pacbell.net> | 2006-07-06 18:48:53 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-07-12 19:03:24 -0400 |
commit | a353678d3136306c1d00f0d2319de1dac8a6b1db (patch) | |
tree | ee68e60ab3611053ba91aedd74e673337601760d | |
parent | 5501a48c15d4a3b81bee1358eb195e26c798d78f (diff) |
[PATCH] USB: gadget section fixups
Recent section changes broke gadget builds on some platforms. This patch
is the best fix that's available until better section markings exist:
- There's a lot of cleanup code that gets used in both init and exit paths;
stop marking it as "__exit".
(Best fix for this would be an "__init_or_exit" section marking, putting
the cleanup in __init when __exit sections get discarded else in __exit.)
- Stop marking the use-once probe routines as "__init" since references
to those routines are not allowed from driver structures. They're now
marked "__devinit", which in practice is a net lose.
(Best fix for this is likely to separate such use-once probe routines
from the driver structure ... but in general, all busses that aren't
hotpluggable will be forced to waste memory for all probe-only code.)
In general these broken section rules waste an average of two to four kBytes
per driver of code bloat ... because none of the relevant code can ever be
reused after module initialization.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/gadget/epautoconf.c | 16 | ||||
-rw-r--r-- | drivers/usb/gadget/ether.c | 8 | ||||
-rw-r--r-- | drivers/usb/gadget/file_storage.c | 2 | ||||
-rw-r--r-- | drivers/usb/gadget/rndis.c | 2 | ||||
-rw-r--r-- | drivers/usb/gadget/rndis.h | 2 | ||||
-rw-r--r-- | drivers/usb/gadget/serial.c | 2 | ||||
-rw-r--r-- | drivers/usb/gadget/zero.c | 2 | ||||
-rw-r--r-- | include/linux/usb_gadget.h | 4 |
8 files changed, 19 insertions, 19 deletions
diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index f7c6d758e1b0..53d584589c26 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c | |||
@@ -34,12 +34,12 @@ | |||
34 | 34 | ||
35 | 35 | ||
36 | /* we must assign addresses for configurable endpoints (like net2280) */ | 36 | /* we must assign addresses for configurable endpoints (like net2280) */ |
37 | static __initdata unsigned epnum; | 37 | static __devinitdata unsigned epnum; |
38 | 38 | ||
39 | // #define MANY_ENDPOINTS | 39 | // #define MANY_ENDPOINTS |
40 | #ifdef MANY_ENDPOINTS | 40 | #ifdef MANY_ENDPOINTS |
41 | /* more than 15 configurable endpoints */ | 41 | /* more than 15 configurable endpoints */ |
42 | static __initdata unsigned in_epnum; | 42 | static __devinitdata unsigned in_epnum; |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | 45 | ||
@@ -59,7 +59,7 @@ static __initdata unsigned in_epnum; | |||
59 | * NOTE: each endpoint is unidirectional, as specified by its USB | 59 | * NOTE: each endpoint is unidirectional, as specified by its USB |
60 | * descriptor; and isn't specific to a configuration or altsetting. | 60 | * descriptor; and isn't specific to a configuration or altsetting. |
61 | */ | 61 | */ |
62 | static int __init | 62 | static int __devinit |
63 | ep_matches ( | 63 | ep_matches ( |
64 | struct usb_gadget *gadget, | 64 | struct usb_gadget *gadget, |
65 | struct usb_ep *ep, | 65 | struct usb_ep *ep, |
@@ -73,7 +73,7 @@ ep_matches ( | |||
73 | /* endpoint already claimed? */ | 73 | /* endpoint already claimed? */ |
74 | if (0 != ep->driver_data) | 74 | if (0 != ep->driver_data) |
75 | return 0; | 75 | return 0; |
76 | 76 | ||
77 | /* only support ep0 for portable CONTROL traffic */ | 77 | /* only support ep0 for portable CONTROL traffic */ |
78 | type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; | 78 | type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; |
79 | if (USB_ENDPOINT_XFER_CONTROL == type) | 79 | if (USB_ENDPOINT_XFER_CONTROL == type) |
@@ -186,7 +186,7 @@ ep_matches ( | |||
186 | return 1; | 186 | return 1; |
187 | } | 187 | } |
188 | 188 | ||
189 | static struct usb_ep * __init | 189 | static struct usb_ep * __devinit |
190 | find_ep (struct usb_gadget *gadget, const char *name) | 190 | find_ep (struct usb_gadget *gadget, const char *name) |
191 | { | 191 | { |
192 | struct usb_ep *ep; | 192 | struct usb_ep *ep; |
@@ -228,7 +228,7 @@ find_ep (struct usb_gadget *gadget, const char *name) | |||
228 | * | 228 | * |
229 | * On failure, this returns a null endpoint descriptor. | 229 | * On failure, this returns a null endpoint descriptor. |
230 | */ | 230 | */ |
231 | struct usb_ep * __init usb_ep_autoconfig ( | 231 | struct usb_ep * __devinit usb_ep_autoconfig ( |
232 | struct usb_gadget *gadget, | 232 | struct usb_gadget *gadget, |
233 | struct usb_endpoint_descriptor *desc | 233 | struct usb_endpoint_descriptor *desc |
234 | ) | 234 | ) |
@@ -276,7 +276,7 @@ struct usb_ep * __init usb_ep_autoconfig ( | |||
276 | return ep; | 276 | return ep; |
277 | } | 277 | } |
278 | 278 | ||
279 | /* Second, look at endpoints until an unclaimed one looks usable */ | 279 | /* Second, look at endpoints until an unclaimed one looks usable */ |
280 | list_for_each_entry (ep, &gadget->ep_list, ep_list) { | 280 | list_for_each_entry (ep, &gadget->ep_list, ep_list) { |
281 | if (ep_matches (gadget, ep, desc)) | 281 | if (ep_matches (gadget, ep, desc)) |
282 | return ep; | 282 | return ep; |
@@ -295,7 +295,7 @@ struct usb_ep * __init usb_ep_autoconfig ( | |||
295 | * state such as ep->driver_data and the record of assigned endpoints | 295 | * state such as ep->driver_data and the record of assigned endpoints |
296 | * used by usb_ep_autoconfig(). | 296 | * used by usb_ep_autoconfig(). |
297 | */ | 297 | */ |
298 | void __init usb_ep_autoconfig_reset (struct usb_gadget *gadget) | 298 | void __devinit usb_ep_autoconfig_reset (struct usb_gadget *gadget) |
299 | { | 299 | { |
300 | struct usb_ep *ep; | 300 | struct usb_ep *ep; |
301 | 301 | ||
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c index 8320fcef0425..4fe1bec1c255 100644 --- a/drivers/usb/gadget/ether.c +++ b/drivers/usb/gadget/ether.c | |||
@@ -2131,7 +2131,7 @@ eth_req_free (struct usb_ep *ep, struct usb_request *req) | |||
2131 | } | 2131 | } |
2132 | 2132 | ||
2133 | 2133 | ||
2134 | static void __exit | 2134 | static void /* __init_or_exit */ |
2135 | eth_unbind (struct usb_gadget *gadget) | 2135 | eth_unbind (struct usb_gadget *gadget) |
2136 | { | 2136 | { |
2137 | struct eth_dev *dev = get_gadget_data (gadget); | 2137 | struct eth_dev *dev = get_gadget_data (gadget); |
@@ -2158,7 +2158,7 @@ eth_unbind (struct usb_gadget *gadget) | |||
2158 | set_gadget_data (gadget, NULL); | 2158 | set_gadget_data (gadget, NULL); |
2159 | } | 2159 | } |
2160 | 2160 | ||
2161 | static u8 __init nibble (unsigned char c) | 2161 | static u8 __devinit nibble (unsigned char c) |
2162 | { | 2162 | { |
2163 | if (likely (isdigit (c))) | 2163 | if (likely (isdigit (c))) |
2164 | return c - '0'; | 2164 | return c - '0'; |
@@ -2168,7 +2168,7 @@ static u8 __init nibble (unsigned char c) | |||
2168 | return 0; | 2168 | return 0; |
2169 | } | 2169 | } |
2170 | 2170 | ||
2171 | static int __init get_ether_addr(const char *str, u8 *dev_addr) | 2171 | static int __devinit get_ether_addr(const char *str, u8 *dev_addr) |
2172 | { | 2172 | { |
2173 | if (str) { | 2173 | if (str) { |
2174 | unsigned i; | 2174 | unsigned i; |
@@ -2189,7 +2189,7 @@ static int __init get_ether_addr(const char *str, u8 *dev_addr) | |||
2189 | return 1; | 2189 | return 1; |
2190 | } | 2190 | } |
2191 | 2191 | ||
2192 | static int __init | 2192 | static int __devinit |
2193 | eth_bind (struct usb_gadget *gadget) | 2193 | eth_bind (struct usb_gadget *gadget) |
2194 | { | 2194 | { |
2195 | struct eth_dev *dev; | 2195 | struct eth_dev *dev; |
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index b1a9cf06f3e6..8d7f1e84cd7b 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c | |||
@@ -3691,7 +3691,7 @@ static void lun_release(struct device *dev) | |||
3691 | kref_put(&fsg->ref, fsg_release); | 3691 | kref_put(&fsg->ref, fsg_release); |
3692 | } | 3692 | } |
3693 | 3693 | ||
3694 | static void __exit fsg_unbind(struct usb_gadget *gadget) | 3694 | static void /* __init_or_exit */ fsg_unbind(struct usb_gadget *gadget) |
3695 | { | 3695 | { |
3696 | struct fsg_dev *fsg = get_gadget_data(gadget); | 3696 | struct fsg_dev *fsg = get_gadget_data(gadget); |
3697 | int i; | 3697 | int i; |
diff --git a/drivers/usb/gadget/rndis.c b/drivers/usb/gadget/rndis.c index 354670d12308..408c3380d602 100644 --- a/drivers/usb/gadget/rndis.c +++ b/drivers/usb/gadget/rndis.c | |||
@@ -1398,7 +1398,7 @@ static struct proc_dir_entry *rndis_connect_state [RNDIS_MAX_CONFIGS]; | |||
1398 | #endif /* CONFIG_USB_GADGET_DEBUG_FILES */ | 1398 | #endif /* CONFIG_USB_GADGET_DEBUG_FILES */ |
1399 | 1399 | ||
1400 | 1400 | ||
1401 | int __init rndis_init (void) | 1401 | int __devinit rndis_init (void) |
1402 | { | 1402 | { |
1403 | u8 i; | 1403 | u8 i; |
1404 | 1404 | ||
diff --git a/drivers/usb/gadget/rndis.h b/drivers/usb/gadget/rndis.h index 2956608be751..4c3c7259f019 100644 --- a/drivers/usb/gadget/rndis.h +++ b/drivers/usb/gadget/rndis.h | |||
@@ -264,7 +264,7 @@ int rndis_signal_disconnect (int configNr); | |||
264 | int rndis_state (int configNr); | 264 | int rndis_state (int configNr); |
265 | extern void rndis_set_host_mac (int configNr, const u8 *addr); | 265 | extern void rndis_set_host_mac (int configNr, const u8 *addr); |
266 | 266 | ||
267 | int __init rndis_init (void); | 267 | int __devinit rndis_init (void); |
268 | void rndis_exit (void); | 268 | void rndis_exit (void); |
269 | 269 | ||
270 | #endif /* _LINUX_RNDIS_H */ | 270 | #endif /* _LINUX_RNDIS_H */ |
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c index 30d7664d449d..e762aa19ab0a 100644 --- a/drivers/usb/gadget/serial.c +++ b/drivers/usb/gadget/serial.c | |||
@@ -1473,7 +1473,7 @@ autoconf_fail: | |||
1473 | * Called on module unload. Frees the control request and device | 1473 | * Called on module unload. Frees the control request and device |
1474 | * structure. | 1474 | * structure. |
1475 | */ | 1475 | */ |
1476 | static void __exit gs_unbind(struct usb_gadget *gadget) | 1476 | static void /* __init_or_exit */ gs_unbind(struct usb_gadget *gadget) |
1477 | { | 1477 | { |
1478 | struct gs_dev *dev = get_gadget_data(gadget); | 1478 | struct gs_dev *dev = get_gadget_data(gadget); |
1479 | 1479 | ||
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c index 3a08a7ab4ce0..b7018ee487ea 100644 --- a/drivers/usb/gadget/zero.c +++ b/drivers/usb/gadget/zero.c | |||
@@ -1121,7 +1121,7 @@ zero_autoresume (unsigned long _dev) | |||
1121 | 1121 | ||
1122 | /*-------------------------------------------------------------------------*/ | 1122 | /*-------------------------------------------------------------------------*/ |
1123 | 1123 | ||
1124 | static void __exit | 1124 | static void /* __init_or_exit */ |
1125 | zero_unbind (struct usb_gadget *gadget) | 1125 | zero_unbind (struct usb_gadget *gadget) |
1126 | { | 1126 | { |
1127 | struct zero_dev *dev = get_gadget_data (gadget); | 1127 | struct zero_dev *dev = get_gadget_data (gadget); |
diff --git a/include/linux/usb_gadget.h b/include/linux/usb_gadget.h index 1d78870ed8af..e17186dbcdca 100644 --- a/include/linux/usb_gadget.h +++ b/include/linux/usb_gadget.h | |||
@@ -872,9 +872,9 @@ int usb_gadget_config_buf(const struct usb_config_descriptor *config, | |||
872 | /* utility wrapping a simple endpoint selection policy */ | 872 | /* utility wrapping a simple endpoint selection policy */ |
873 | 873 | ||
874 | extern struct usb_ep *usb_ep_autoconfig (struct usb_gadget *, | 874 | extern struct usb_ep *usb_ep_autoconfig (struct usb_gadget *, |
875 | struct usb_endpoint_descriptor *) __init; | 875 | struct usb_endpoint_descriptor *) __devinit; |
876 | 876 | ||
877 | extern void usb_ep_autoconfig_reset (struct usb_gadget *) __init; | 877 | extern void usb_ep_autoconfig_reset (struct usb_gadget *) __devinit; |
878 | 878 | ||
879 | #endif /* __KERNEL__ */ | 879 | #endif /* __KERNEL__ */ |
880 | 880 | ||