Skip to content

Commit 6653b82

Browse files
rddunlapgregkh
authored andcommitted
usb: gadget: eliminate anonymous module_init & module_exit
Eliminate anonymous module_init() and module_exit(), which can lead to confusion or ambiguity when reading System.map, crashes/oops/bugs, or an initcall_debug log. Give each of these init and exit functions unique driver-specific names to eliminate the anonymous names. Example 1: (System.map) ffffffff832fc78c t init ffffffff832fc79e t init ffffffff832fc8f8 t init Example 2: (initcall_debug log) calling init+0x0/0x12 @ 1 initcall init+0x0/0x12 returned 0 after 15 usecs calling init+0x0/0x60 @ 1 initcall init+0x0/0x60 returned 0 after 2 usecs calling init+0x0/0x9a @ 1 initcall init+0x0/0x9a returned 0 after 74 usecs Fixes: bd25a14 ("usb: gadget: legacy/serial: allow dynamic removal") Fixes: 7bb5ea5 ("usb gadget serial: use composite gadget framework") Fixes: 1da177e ("Linux-2.6.12-rc2") Signed-off-by: Randy Dunlap <[email protected]> Reviewed-by: Ira Weiny <[email protected]> Cc: Felipe Balbi <[email protected]> Cc: Michał Mirosław <[email protected]> Cc: Sebastian Andrzej Siewior <[email protected]> Cc: [email protected] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 393dcd1 commit 6653b82

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

drivers/usb/gadget/legacy/inode.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2101,7 +2101,7 @@ MODULE_ALIAS_FS("gadgetfs");
21012101

21022102
/*----------------------------------------------------------------------*/
21032103

2104-
static int __init init (void)
2104+
static int __init gadgetfs_init (void)
21052105
{
21062106
int status;
21072107

@@ -2111,12 +2111,12 @@ static int __init init (void)
21112111
shortname, driver_desc);
21122112
return status;
21132113
}
2114-
module_init (init);
2114+
module_init (gadgetfs_init);
21152115

2116-
static void __exit cleanup (void)
2116+
static void __exit gadgetfs_cleanup (void)
21172117
{
21182118
pr_debug ("unregister %s\n", shortname);
21192119
unregister_filesystem (&gadgetfs_type);
21202120
}
2121-
module_exit (cleanup);
2121+
module_exit (gadgetfs_cleanup);
21222122

drivers/usb/gadget/legacy/serial.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ static struct usb_composite_driver gserial_driver = {
273273
static int switch_gserial_enable(bool do_enable)
274274
{
275275
if (!serial_config_driver.label)
276-
/* init() was not called, yet */
276+
/* gserial_init() was not called, yet */
277277
return 0;
278278

279279
if (do_enable)
@@ -283,7 +283,7 @@ static int switch_gserial_enable(bool do_enable)
283283
return 0;
284284
}
285285

286-
static int __init init(void)
286+
static int __init gserial_init(void)
287287
{
288288
/* We *could* export two configs; that'd be much cleaner...
289289
* but neither of these product IDs was defined that way.
@@ -314,11 +314,11 @@ static int __init init(void)
314314

315315
return usb_composite_probe(&gserial_driver);
316316
}
317-
module_init(init);
317+
module_init(gserial_init);
318318

319-
static void __exit cleanup(void)
319+
static void __exit gserial_cleanup(void)
320320
{
321321
if (enable)
322322
usb_composite_unregister(&gserial_driver);
323323
}
324-
module_exit(cleanup);
324+
module_exit(gserial_cleanup);

drivers/usb/gadget/udc/dummy_hcd.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2766,7 +2766,7 @@ static struct platform_driver dummy_hcd_driver = {
27662766
static struct platform_device *the_udc_pdev[MAX_NUM_UDC];
27672767
static struct platform_device *the_hcd_pdev[MAX_NUM_UDC];
27682768

2769-
static int __init init(void)
2769+
static int __init dummy_hcd_init(void)
27702770
{
27712771
int retval = -ENOMEM;
27722772
int i;
@@ -2888,9 +2888,9 @@ static int __init init(void)
28882888
platform_device_put(the_hcd_pdev[i]);
28892889
return retval;
28902890
}
2891-
module_init(init);
2891+
module_init(dummy_hcd_init);
28922892

2893-
static void __exit cleanup(void)
2893+
static void __exit dummy_hcd_cleanup(void)
28942894
{
28952895
int i;
28962896

@@ -2906,4 +2906,4 @@ static void __exit cleanup(void)
29062906
platform_driver_unregister(&dummy_udc_driver);
29072907
platform_driver_unregister(&dummy_hcd_driver);
29082908
}
2909-
module_exit(cleanup);
2909+
module_exit(dummy_hcd_cleanup);

0 commit comments

Comments
 (0)