diff mbox series

[2/2] wifi: purelifi: use module_usb_driver

Message ID 20230826200929.9756-2-rosenp@gmail.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series [1/2] wifi: ath9k_htc: use module_usb_driver | expand

Commit Message

Rosen Penev Aug. 26, 2023, 8:09 p.m. UTC
This follows the pattern with other USB Wifi drivers. There is nothing
special being done in the _init and _exit functions here. Simplifies and
saves some lines of code.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/net/wireless/purelifi/plfxlc/usb.c | 23 +---------------------
 1 file changed, 1 insertion(+), 22 deletions(-)

Comments

Kalle Valo Sept. 4, 2023, 5:31 p.m. UTC | #1
Rosen Penev <rosenp@gmail.com> wrote:

> This follows the pattern with other USB Wifi drivers. There is nothing
> special being done in the _init and _exit functions here. Simplifies and
> saves some lines of code.
> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>

Fails to compile:

In file included from ./include/linux/device.h:32,
                 from drivers/net/wireless/purelifi/plfxlc/usb.c:8:
drivers/net/wireless/purelifi/plfxlc/usb.c:871:19: error: conflicting types for 'driver_init'; have 'int(void)'
  871 | module_usb_driver(driver);
      |                   ^~~~~~
./include/linux/device/driver.h:258:19: note: in definition of macro 'module_driver'
  258 | static int __init __driver##_init(void) \
      |                   ^~~~~~~~
drivers/net/wireless/purelifi/plfxlc/usb.c:871:1: note: in expansion of macro 'module_usb_driver'
  871 | module_usb_driver(driver);
      | ^~~~~~~~~~~~~~~~~
./include/linux/device/driver.h:241:6: note: previous declaration of 'driver_init' with type 'void(void)'
  241 | void driver_init(void);
      |      ^~~~~~~~~~~
make[7]: *** [scripts/Makefile.build:243: drivers/net/wireless/purelifi/plfxlc/usb.o] Error 1
make[6]: *** [scripts/Makefile.build:480: drivers/net/wireless/purelifi/plfxlc] Error 2
make[5]: *** [scripts/Makefile.build:480: drivers/net/wireless/purelifi] Error 2
make[4]: *** [scripts/Makefile.build:480: drivers/net/wireless] Error 2
make[3]: *** [scripts/Makefile.build:480: drivers/net] Error 2
make[2]: *** [scripts/Makefile.build:480: drivers] Error 2
make[1]: *** [/home/kvalo/projects/personal/wireless-drivers/src/wireless-next/Makefile:2032: .] Error 2
make: *** [Makefile:234: __sub-make] Error 2

Patch set to Changes Requested.
diff mbox series

Patch

diff --git a/drivers/net/wireless/purelifi/plfxlc/usb.c b/drivers/net/wireless/purelifi/plfxlc/usb.c
index 76d0a778636a..b4bb32911d9f 100644
--- a/drivers/net/wireless/purelifi/plfxlc/usb.c
+++ b/drivers/net/wireless/purelifi/plfxlc/usb.c
@@ -861,26 +861,6 @@  static struct usb_driver driver = {
 	.disable_hub_initiated_lpm = 1,
 };
 
-static int __init usb_init(void)
-{
-	int r;
-
-	r = usb_register(&driver);
-	if (r) {
-		pr_err("%s usb_register() failed %d\n", driver.name, r);
-		return r;
-	}
-
-	pr_debug("Driver initialized :%s\n", driver.name);
-	return 0;
-}
-
-static void __exit usb_exit(void)
-{
-	usb_deregister(&driver);
-	pr_debug("%s %s\n", driver.name, __func__);
-}
-
 MODULE_LICENSE("GPL");
 MODULE_DESCRIPTION("USB driver for pureLiFi devices");
 MODULE_AUTHOR("pureLiFi");
@@ -888,5 +868,4 @@  MODULE_VERSION("1.0");
 MODULE_FIRMWARE("plfxlc/lifi-x.bin");
 MODULE_DEVICE_TABLE(usb, usb_ids);
 
-module_init(usb_init);
-module_exit(usb_exit);
+module_usb_driver(driver);