Staging: rts5208: Use module_pci_driver
PATCH v2 1/1 Staging: rts5208: Use module_pci_driver
Macro module_pci_driver is used for drivers whose init and exit paths does only register and unregister to pci API. So, here remove some boilerplate code by using module_pci_driver. Also, change driver->rtsx_driver to fix the build warnings.
---
Changes since v1:
- Change commit log
- Fix build warnings
drivers/staging/rts5208/rtsx.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)
drivers/staging/rts5208/rtsx.c +2 -19
@@ -1036,7 +1036,7 @@ static const struct pci_device_id rtsx_ids[] = {MODULE_DEVICE_TABLE (pci, rtsx_ids);/* pci_driver definition */ -static struct pci_driver driver = { +static struct pci_driver rtsx_driver = { .name =CR_DRIVER_NAME , .id_table = rtsx_ids, .probe = rtsx_probe,
@@ -1048,21 +1048,4 @@ static struct pci_driver driver = { .shutdown = rtsx_shutdown, }; -static int __init rtsx_init (void ) -{ -pr_info ("Initializing Realtek PCIE storage driver...\n" ); - -return pci_register_driver (&driver); -} - -static void __exit rtsx_exit(void) -{ -pr_info ("rtsx_exit() called\n" ); - -pci_unregister_driver (&driver); - -pr_info ("%s module exit\n" ,CR_DRIVER_NAME ); -} - -module_init (rtsx_init) -module_exit (rtsx_exit) +module_pci_driver (rtsx_driver)
Signature · 1 line
1.9.1
Quoted 4 lines · Vaishali Thakkar
Macro
module_pci_driveris used for drivers whose init and exit paths does only register and unregister to pci API. So, here remove some boilerplate code by usingmodule_pci_driver. Also, changedriver->rtsx_driverto
driver->rtsx_driver is confusing. It looks like a field reference. You could say "change driver to rtsx_driver, to fix...". The comma would help avoid "to ... to".
Quoted 1 line
fix the build warnings.
This part could be more clear. "to avoid implicitly redefining driver_init."
julia
Quoted 55 lines
Signed-off-by Vaishali Thakkar <[email protected]>---
Changes since v1:
- Change commit log
- Fix build warningsdrivers/staging/rts5208/rtsx.c | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-)drivers/staging/rts5208/rtsx.c +2
-19@@ -1036,7 +1036,7 @@ static const struct pci_device_id rtsx_ids[] = {MODULE_DEVICE_TABLE (pci, rtsx_ids);/* pci_driver definition */ -static struct pci_driver driver = { +static struct pci_driver rtsx_driver = { .name =CR_DRIVER_NAME , .id_table = rtsx_ids, .probe = rtsx_probe,@@ -1048,21 +1048,4 @@ static struct pci_driver driver = { .shutdown = rtsx_shutdown, }; -static int __init rtsx_init (void ) -{ -pr_info ("Initializing Realtek PCIE storage driver...\n" ); - -return pci_register_driver (&driver); -} - -static void __exit rtsx_exit(void) -{ -pr_info ("rtsx_exit() called\n" ); - -pci_unregister_driver (&driver); - -pr_info ("%s module exit\n" ,CR_DRIVER_NAME ); -} - -module_init (rtsx_init) -module_exit (rtsx_exit) +module_pci_driver (rtsx_driver)Signature · 8 lines
1.9.1 -- You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/20150312031505.GA4500%40vaishali-Ideapad-Z570. For more options, visit https://groups.google.com/d/optout.