Skip to contentSkip to conversation

minor cleanups for various staging drivers

PATCH In review Simon Horman 2 participants 12 messages Dec 23, 2009 – Dec 24, 2009 1 message not in the archive Staging

lore
Share & tools
lore
#0 lore raw

cover minor cleanups for various staging drivers

Some minor cleanups for various staging drivers.

#1 lore raw

PATCH 1/7 DT3155: Use pci_get_device

The use of pci_find_device() is deprecated.

---

Compile tested only.

Alternatively, if pci_find_device() really needs to be used then this code needs to depend on PCI_LEGACY.

drivers/staging/dt3155/dt3155_drv.c +1 -1
Index: gregkh-2.6/drivers/staging/dt3155/dt3155_drv.c
===================================================================
@@ -963,7 +963,7 @@ static int find_PCI (void)
   unsigned long base;
   unsigned char irq;
 
-  while ((pci_dev = pci_find_device
+  while ((pci_dev = pci_get_device
 	  (DT3155_VENDORID, DT3155_DEVICEID, pci_dev)) != NULL)
     {
       pci_index ++;
#2 lore raw

Re: [patch 1/7] [patch] DT3155: Use pci_get_device

Quoted 16 lines · Simon Horman

The use of pci_find_device() is deprecated.

---

Compile tested only.

Alternatively, if pci_find_device() really needs to be used then this code needs to depend on PCI_LEGACY.

Index: gregkh-2.6/drivers/staging/dt3155/dt3155_drv.c
===================================================================

drivers/staging/dt3155/dt3155_drv.c static int find_PCI (void) · line 966

Quoted 5 lines
drivers/staging/dt3155/dt3155_drv.c +1 -1
@@ -963,7 +963,7 @@ static int find_PCI (void)
   unsigned long base;
   unsigned char irq;
 
-  while ((pci_dev = pci_find_device
+  while ((pci_dev = pci_get_device

You can't just replace these two functions, they operate differently with regard to the reference counting logic. Otherwise it wouldn't make sense to have 2 different functions :)

So I can't apply this.

thanks,

greg k-h

#3 lore raw

Re: [patch 1/7] [patch] DT3155: Use pci_get_device

Quoted 20 lines · Greg KH
Quoted 19 lines · Simon Horman

The use of pci_find_device() is deprecated.

---

Compile tested only.

Alternatively, if pci_find_device() really needs to be used then this code needs to depend on PCI_LEGACY.

Index: gregkh-2.6/drivers/staging/dt3155/dt3155_drv.c
===================================================================

drivers/staging/dt3155/dt3155_drv.c +0 -0
@@ -963,7 +963,7 @@ static int find_PCI (void)
   unsigned long base;
   unsigned char irq;
 
Quoted 8 lines

drivers/staging/dt3155/dt3155_drv.c static int find_PCI (void) · line 966

Quoted 2 lines
drivers/staging/dt3155/dt3155_drv.c +1 -1
-  while ((pci_dev = pci_find_device
+  while ((pci_dev = pci_get_device

You can't just replace these two functions, they operate differently with regard to the reference counting logic. Otherwise it wouldn't make sense to have 2 different functions :)

So I can't apply this.

Sorry about that.

#4 lore raw

Re: [patch 1/7] [patch] DT3155: Use pci_get_device

Quoted 28 lines · Simon Horman
Quoted 27 lines · Greg KH
Quoted 16 lines · Simon Horman

The use of pci_find_device() is deprecated.

---

Compile tested only.

Alternatively, if pci_find_device() really needs to be used then this code needs to depend on PCI_LEGACY.

Index: gregkh-2.6/drivers/staging/dt3155/dt3155_drv.c
===================================================================

drivers/staging/dt3155/dt3155_drv.c static int find_PCI (void) · line 966

Quoted 5 lines
drivers/staging/dt3155/dt3155_drv.c +1 -1
@@ -963,7 +963,7 @@ static int find_PCI (void)
   unsigned long base;
   unsigned char irq;
 
-  while ((pci_dev = pci_find_device
+  while ((pci_dev = pci_get_device

You can't just replace these two functions, they operate differently with regard to the reference counting logic. Otherwise it wouldn't make sense to have 2 different functions :)

Quoted 3 lines
Quoted 1 line

So I can't apply this.

Sorry about that.

No problem, care to fix it up properly?

thanks,

greg k-h

#5 lore raw

Re: [patch 1/7] [patch] DT3155: Use pci_get_device

Quoted 29 lines · Greg KH
Quoted 28 lines · Simon Horman
Quoted 27 lines · Greg KH
Quoted 16 lines · Simon Horman

The use of pci_find_device() is deprecated.

---

Compile tested only.

Alternatively, if pci_find_device() really needs to be used then this code needs to depend on PCI_LEGACY.

Index: gregkh-2.6/drivers/staging/dt3155/dt3155_drv.c
===================================================================

drivers/staging/dt3155/dt3155_drv.c static int find_PCI (void) · line 966

Quoted 5 lines
drivers/staging/dt3155/dt3155_drv.c +1 -1
@@ -963,7 +963,7 @@ static int find_PCI (void)
   unsigned long base;
   unsigned char irq;
 
-  while ((pci_dev = pci_find_device
+  while ((pci_dev = pci_get_device

You can't just replace these two functions, they operate differently with regard to the reference counting logic. Otherwise it wouldn't make sense to have 2 different functions :)

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

So I can't apply this.

Sorry about that.

No problem, care to fix it up properly?

Sure, I'll see what I can do.

#6 lore raw

PATCH 2/7 rt2870: rtusb_probe() should be in section __devinit

In reply to Simon Horman
$ make CONFIG_DEBUG_SECTION_MISMATCH=y
WARNING: drivers/staging/rt2870/rt2870sta.o(.text+0x2f4c5): Section
mismatch in reference from the function rtusb_probe() to the function .devinit.text:rt2870_probe()
The function rtusb_probe() references
the function __devinit rt2870_probe().
This is often because rtusb_probe lacks a __devinit 
annotation or the annotation of rt2870_probe is wrong.
drivers/staging/rt2860/usb_main_dev.c +1 -1
Index: gregkh-2.6/drivers/staging/rt2860/usb_main_dev.c
===================================================================
@@ -296,7 +296,7 @@ static BOOLEAN USBDevConfigInit(IN struc
 
 }
 
-static int rtusb_probe(struct usb_interface *intf,
+static int __devinit rtusb_probe(struct usb_interface *intf,
 		       const struct usb_device_id *id)
 {
 	struct rt_rtmp_adapter *pAd;
#7 lore raw

PATCH 3/7 rt2870: Remove unnecessary forward declarations

In reply to Simon Horman

Remove unnecessary forward declaration of rtusb_probe() and rtusb_disconnect()

drivers/staging/rt2860/usb_main_dev.c +0 -4
Index: linux-2.6/drivers/staging/rt2860/usb_main_dev.c
===================================================================
@@ -216,10 +216,6 @@ static int rt2870_suspend(struct usb_int
 static int rt2870_resume(struct usb_interface *intf);
 #endif /* CONFIG_PM // */
 
-static int rtusb_probe(struct usb_interface *intf,
-		       const struct usb_device_id *id);
-static void rtusb_disconnect(struct usb_interface *intf);
-
 static BOOLEAN USBDevConfigInit(IN struct usb_device *dev,
 				IN struct usb_interface *intf,
 				struct rt_rtmp_adapter *pAd)
#8 lore raw

PATCH 4/7 rtl8192e: print the elements of tx_pn and rx_pn not the arrays themselves

In reply to Simon Horman

---

Compile tested only

$ gcc --versino
gcc (Debian 4.4.2-6) 4.4.2
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ make
...
drivers/staging/rtl8192e/ieee80211/ieee80211_crypt_ccmp.c: In function ‘ieee80211_ccmp_print_stats’:
drivers/staging/rtl8192e/ieee80211/ieee80211_crypt_ccmp.c:486: warning: format ‘%02x’ expects type ‘unsigned int’, but argument 5 has type ‘u8 *’
drivers/staging/rtl8192e/ieee80211/ieee80211_crypt_ccmp.c:486: warning: format ‘%02x’ expects type ‘unsigned int’, but argument 6 has type ‘u8 *’
drivers/staging/rtl8192e/ieee80211/ieee80211_crypt_ccmp.c:486: warning: too few arguments for format
drivers/staging/rtl8192e/ieee80211/ieee80211_crypt_ccmp.c +13 -6
Index: gregkh-2.6/drivers/staging/rtl8192e/ieee80211/ieee80211_crypt_ccmp.c
===================================================================
@@ -475,12 +475,19 @@ static int ieee80211_ccmp_get_key(void *
 static char * ieee80211_ccmp_print_stats(char *p, void *priv)
 {
 	struct ieee80211_ccmp_data *ccmp = priv;
-	p += sprintf(p, "key[%d] alg=CCMP key_set=%d "
-		     "tx_pn=%02x%02x%02x%02x%02x%02x "
-		     "rx_pn=%02x%02x%02x%02x%02x%02x "
-		     "format_errors=%d replays=%d decrypt_errors=%d\n",
-		     ccmp->key_idx, ccmp->key_set,
-		     ccmp->tx_pn, ccmp->rx_pn,
+	int i;
+
+	p += sprintf(p, "key[%d] alg=CCMP key_set=%d tx_pn=",
+		     ccmp->key_idx, ccmp->key_set);
+
+	for (i = 0; i < ARRAY_SIZE(ccmp->tx_pn); i++)
+		p += sprintf(p, "%02x", ccmp->tx_pn[i]);
+
+	sprintf(p, " rx_pn=");
+	for (i = 0; i < ARRAY_SIZE(ccmp->rx_pn); i++)
+		p += sprintf(p, "%02x", ccmp->tx_pn[i]);
+
+	p += sprintf(p, " format_errors=%d replays=%d decrypt_errors=%d\n",
 		     ccmp->dot11RSNAStatsCCMPFormatErrors,
 		     ccmp->dot11RSNAStatsCCMPReplays,
 		     ccmp->dot11RSNAStatsCCMPDecryptErrors);
#9 lore raw

PATCH 5/7 rtl8192e: remove some functions from the __exit section

In reply to Simon Horman

ieee80211_crypto_tkip_exit(), ieee80211_crypto_deinit() and ieee80211_crypto_ccmp_exit() are called by ieee80211_rtl_init() which are in section __init, so they can't be in section __exit.

---

WARNING: drivers/staging/rtl8192e/r8192e_pci.o(.init.text+0xda): Section mismatch in reference from the function ieee80211_rtl_init() to the function .exit.text:ieee80211_crypto_tkip_exit() The function __init ieee80211_rtl_init() references
a function __exit ieee80211_crypto_tkip_exit().
This is often seen when error handling in the init function
uses functionality in the exit path.
The fix is often to remove the __exit annotation of
ieee80211_crypto_tkip_exit() so it may be used outside an exit section.

WARNING: drivers/staging/rtl8192e/r8192e_pci.o(.init.text+0xdf): Section mismatch in reference from the function ieee80211_rtl_init() to the function .exit.text:ieee80211_crypto_deinit() The function __init ieee80211_rtl_init() references
a function __exit ieee80211_crypto_deinit().
This is often seen when error handling in the init function
uses functionality in the exit path.
The fix is often to remove the __exit annotation of
ieee80211_crypto_deinit() so it may be used outside an exit section.

WARNING: drivers/staging/rtl8192e/r8192e_pci.o(.init.text+0xf4): Section mismatch in reference from the function ieee80211_rtl_init() to the function .exit.text:ieee80211_crypto_ccmp_exit() The function __init ieee80211_rtl_init() references
a function __exit ieee80211_crypto_ccmp_exit().
This is often seen when error handling in the init function
uses functionality in the exit path.
The fix is often to remove the __exit annotation of
ieee80211_crypto_ccmp_exit() so it may be used outside an exit section.

WARNING: drivers/staging/rtl8192e/r8192e_pci.o(.init.text+0xf9): Section mismatch in reference from the function ieee80211_rtl_init() to the function .exit.text:ieee80211_crypto_tkip_exit() The function __init ieee80211_rtl_init() references
a function __exit ieee80211_crypto_tkip_exit().
This is often seen when error handling in the init function
uses functionality in the exit path.
The fix is often to remove the __exit annotation of
ieee80211_crypto_tkip_exit() so it may be used outside an exit section.

WARNING: drivers/staging/rtl8192e/r8192e_pci.o(.init.text+0xfe): Section mismatch in reference from the function ieee80211_rtl_init() to the function .exit.text:ieee80211_crypto_deinit() The function __init ieee80211_rtl_init() references
a function __exit ieee80211_crypto_deinit().
This is often seen when error handling in the init function
uses functionality in the exit path.
The fix is often to remove the __exit annotation of
ieee80211_crypto_deinit() so it may be used outside an exit section.

drivers/staging/rtl8192e/ieee80211/ieee80211_crypt.c +1 -1
Index: gregkh-2.6/drivers/staging/rtl8192e/ieee80211/ieee80211_crypt.c
===================================================================
@@ -225,7 +225,7 @@ out:
 }
 
 
-void __exit ieee80211_crypto_deinit(void)
+void ieee80211_crypto_deinit(void)
 {
 	struct list_head *ptr, *n;
 
drivers/staging/rtl8192e/ieee80211/ieee80211_crypt_ccmp.c +1 -1
Index: gregkh-2.6/drivers/staging/rtl8192e/ieee80211/ieee80211_crypt_ccmp.c
===================================================================
@@ -524,7 +524,7 @@ int __init ieee80211_crypto_ccmp_init(vo
 }
 
 
-void __exit ieee80211_crypto_ccmp_exit(void)
+void ieee80211_crypto_ccmp_exit(void)
 {
 	ieee80211_unregister_crypto_ops(&ieee80211_crypt_ccmp);
 }
drivers/staging/rtl8192e/ieee80211/ieee80211_crypt_tkip.c +1 -1
Index: gregkh-2.6/drivers/staging/rtl8192e/ieee80211/ieee80211_crypt_tkip.c
===================================================================
@@ -1012,7 +1012,7 @@ int __init ieee80211_crypto_tkip_init(vo
 }
 
 
-void __exit ieee80211_crypto_tkip_exit(void)
+void ieee80211_crypto_tkip_exit(void)
 {
 	ieee80211_unregister_crypto_ops(&ieee80211_crypt_tkip);
 }
#10 lore raw

PATCH 6/7 rtl8192su, rtl8192u: use min_t() in store_debug_level()

In reply to Simon Horman

sizeof() returns a size_t but the other types involved are unsigned long, so using min() results in a warning.

As sizeof() is called on an 11 character buffer defined immediately above unsigned long is obviously wide enough for the result.

---

Compile tested only.

$ gcc --version
gcc (Debian 4.4.2-6) 4.4.2
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ make CONFIG_DEBUG_SECTION_MISMATCH=y
...
drivers/staging/rtl8192su/ieee80211/ieee80211_module.c: In function ‘store_debug_level’:
drivers/staging/rtl8192su/ieee80211/ieee80211_module.c:265: warning: comparison of distinct pointer types lacks a cast
...
drivers/staging/rtl8192su/ieee80211/ieee80211_module.c +1 -1
Index: gregkh-2.6/drivers/staging/rtl8192su/ieee80211/ieee80211_module.c
===================================================================
@@ -262,7 +262,7 @@ static int store_debug_level(struct file
 			     unsigned long count, void *data)
 {
 	char buf[] = "0x00000000";
-	unsigned long len = min(sizeof(buf) - 1, count);
+	unsigned long len = min_t(unsigned long, sizeof(buf) - 1, count);
 	char *p = (char *)buf;
 	unsigned long val;
 
drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +1 -1
Index: gregkh-2.6/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c
===================================================================
@@ -260,7 +260,7 @@ static int store_debug_level(struct file
 			     unsigned long count, void *data)
 {
 	char buf[] = "0x00000000";
-	unsigned long len = min(sizeof(buf) - 1, count);
+	unsigned long len = min_t(unsigned long, sizeof(buf) - 1, count);
 	char *p = (char *)buf;
 	unsigned long val;
 

A message that is not in the archive (sent off-list or not yet received): [email protected]

#12 lore raw

Re: [patch 7/7] [patch] rtl8192u: Clarify logic in‘ieee80211_wx_get_encode_ext_rsl()

---

I think this is what is meant.

Compile tested only.

$ gcc --version
gcc (Debian 4.4.2-6) 4.4.2
Copyright (C) 2009 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ make CONFIG_DEBUG_SECTION_MISMATCH=y
...
drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c: In function ‘ieee80211_wx_get_encode_ext_rsl’:
drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c:721: warning: suggest parentheses around operand of ‘!’ or change ‘&’ to ‘&&’ or ‘!’ to ‘~’
...

[ Trying again as vger didn't like the headers the first time around ]

drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c +1 -1
Index: gregkh-2.6/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c
===================================================================
@@ -718,7 +718,7 @@ int ieee80211_wx_get_encode_ext(struct i
 	} else
 		idx = ieee->tx_keyidx;
 
-	if (!ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY &&
+	if (!(ext->ext_flags & IW_ENCODE_EXT_GROUP_KEY) &&
 	    ext->alg != IW_ENCODE_ALG_WEP)
 		if (idx != 0 || ieee->iw_mode != IW_MODE_INFRA)
 			return -EINVAL;