2013-05-17 21:47:04

by Peter Huewe

[permalink] [raw]
Subject: [PATCH 1/2] staging/btmtk_usb: use module_usb_driver to register driver

Removing some boilerplate by using module_usb_driver instead of calling
register and unregister in the otherwise empty init/exit functions

Signed-off-by: Peter Huewe <[email protected]>
---
drivers/staging/btmtk_usb/btmtk_usb.c | 15 +--------------
1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/drivers/staging/btmtk_usb/btmtk_usb.c b/drivers/staging/btmtk_usb/btmtk_usb.c
index 6b01f61..772c49e 100644
--- a/drivers/staging/btmtk_usb/btmtk_usb.c
+++ b/drivers/staging/btmtk_usb/btmtk_usb.c
@@ -1771,20 +1771,7 @@ static struct usb_driver btmtk_usb_driver = {
.disable_hub_initiated_lpm = 1,
};

-static int __init btmtk_usb_init(void)
-{
- BT_INFO("btmtk usb driver ver %s", VERSION);
-
- return usb_register(&btmtk_usb_driver);
-}
-
-static void __exit btmtk_usb_exit(void)
-{
- usb_deregister(&btmtk_usb_driver);
-}
-
-module_init(btmtk_usb_init);
-module_exit(btmtk_usb_exit);
+module_usb_driver(btmtk_usb_driver);

MODULE_DESCRIPTION("Mediatek Bluetooth USB driver ver " VERSION);
MODULE_VERSION(VERSION);
--
1.8.1.5


2013-05-17 21:47:33

by Peter Huewe

[permalink] [raw]
Subject: [PATCH 2/2] staging/btmtk_usb: Mark local functions as static

sparse complains about some local functions not being static:
drivers/staging/btmtk_usb/btmtk_usb.c:50:6:
warning: symbol 'hex_dump' was not declared. Should it be static?
drivers/staging/btmtk_usb/btmtk_usb.c:227:5:
warning: symbol 'checksume16' was not declared. Should it be static?

-> add the static keyword

Signed-off-by: Peter Huewe <[email protected]>
---
drivers/staging/btmtk_usb/btmtk_usb.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/btmtk_usb/btmtk_usb.c b/drivers/staging/btmtk_usb/btmtk_usb.c
index 772c49e..a7539df 100644
--- a/drivers/staging/btmtk_usb/btmtk_usb.c
+++ b/drivers/staging/btmtk_usb/btmtk_usb.c
@@ -47,7 +47,7 @@ static struct usb_driver btmtk_usb_driver;
static int btmtk_usb_load_rom_patch(struct btmtk_usb_data *);
static int btmtk_usb_load_fw(struct btmtk_usb_data *);

-void hex_dump(char *str, u8 *src_buf, u32 src_buf_len)
+static void hex_dump(char *str, u8 *src_buf, u32 src_buf_len)
{
unsigned char *pt;
int x;
@@ -224,7 +224,7 @@ static void btmtk_usb_cap_init(struct btmtk_usb_data *data)
}
}

-u16 checksume16(u8 *pData, int len)
+static u16 checksume16(u8 *pData, int len)
{
int sum = 0;

--
1.8.1.5