[PATCH] staging/wlan-ng fix small coding style issue

2014-03-31 Thread Denis Pithon
Signed-off-by: Denis Pithon 
---
 drivers/staging/wlan-ng/prism2usb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/staging/wlan-ng/prism2usb.c 
b/drivers/staging/wlan-ng/prism2usb.c
index 4739c14..ccb2c2e 100644
--- a/drivers/staging/wlan-ng/prism2usb.c
+++ b/drivers/staging/wlan-ng/prism2usb.c
@@ -293,6 +293,7 @@ static int prism2sta_suspend(struct usb_interface 
*interface,
hfa384x_t *hw = NULL;
wlandevice_t *wlandev;
wlandev = (wlandevice_t *) usb_get_intfdata(interface);
+
if (!wlandev)
return -ENODEV;
 
@@ -315,6 +316,7 @@ static int prism2sta_resume(struct usb_interface *interface)
hfa384x_t *hw = NULL;
wlandevice_t *wlandev;
wlandev = (wlandevice_t *) usb_get_intfdata(interface);
+
if (!wlandev)
return -ENODEV;
 
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH v2] staging/wlan-ng fix small coding style issues

2014-03-31 Thread Denis Pithon
* improve readability of usb_prism_tbl[]
* remove obsolete comments for prism2sta_probe_usb() and
  prism2sta_disconnect_usb()
* delete some unneeded blank lines and add few ones to make
  checkpatch.pl happy.

Signed-off-by: Denis Pithon 
---
 drivers/staging/wlan-ng/prism2usb.c | 163 +++-
 1 file changed, 51 insertions(+), 112 deletions(-)

diff --git a/drivers/staging/wlan-ng/prism2usb.c 
b/drivers/staging/wlan-ng/prism2usb.c
index 4739c14..bbe004a 100644
--- a/drivers/staging/wlan-ng/prism2usb.c
+++ b/drivers/staging/wlan-ng/prism2usb.c
@@ -4,103 +4,59 @@
 #include "prism2sta.c"
 #include "prism2fw.c"
 
-#define PRISM_USB_DEVICE(vid, pid, name)   \
-   USB_DEVICE(vid, pid),   \
-   .driver_info = (unsigned long) name
+#define PRISM_DEV(vid, pid, name)  \
+   { USB_DEVICE(vid, pid), \
+   .driver_info = (unsigned long) name }
 
 static struct usb_device_id usb_prism_tbl[] = {
-   {PRISM_USB_DEVICE(0x04bb, 0x0922, "IOData AirPort WN-B11/USBS")},
-   {PRISM_USB_DEVICE(0x07aa, 0x0012, "Corega Wireless LAN USB Stick-11")},
-   {PRISM_USB_DEVICE(0x09aa, 0x3642, "Prism2.x 11Mbps WLAN USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x1668, 0x0408, "Actiontec Prism2.5 11Mbps WLAN USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x1668, 0x0421, "Actiontec Prism2.5 11Mbps WLAN USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x1915, 0x2236, "Linksys WUSB11v3.0 11Mbps WLAN USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x066b, 0x2212, "Linksys WUSB11v2.5 11Mbps WLAN USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x066b, 0x2213, "Linksys WUSB12v1.1 11Mbps WLAN USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x067c, 0x1022, "Siemens SpeedStream 1022 11Mbps WLAN USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x049f, 0x0033,
-"Compaq/Intel W100 PRO/Wireless 11Mbps multiport WLAN Adapter")},
-   {PRISM_USB_DEVICE
-(0x0411, 0x0016, "Melco WLI-USB-S11 11Mbps WLAN Adapter")},
-   {PRISM_USB_DEVICE
-(0x08de, 0x7a01, "PRISM25 IEEE 802.11 Mini USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x8086, 0x, "Intel PRO/Wireless 2011B LAN USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x0d8e, 0x7a01, "PRISM25 IEEE 802.11 Mini USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x045e, 0x006e, "Microsoft MN510 Wireless USB Adapter")},
-   {PRISM_USB_DEVICE(0x0967, 0x0204, "Acer Warplink USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x0cde, 0x0002, "Z-Com 725/726 Prism2.5 USB/USB Integrated")},
-   {PRISM_USB_DEVICE
-(0x0cde, 0x0005, "Z-Com Xl735 Wireless 802.11b USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x413c, 0x8100, "Dell TrueMobile 1180 Wireless USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x0b3b, 0x1601, "ALLNET 0193 11Mbps WLAN USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x0b3b, 0x1602, "ZyXEL ZyAIR B200 Wireless USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x0baf, 0x00eb, "USRobotics USR1120 Wireless USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x0411, 0x0027, "Melco WLI-USB-KS11G 11Mbps WLAN Adapter")},
-   {PRISM_USB_DEVICE
-(0x04f1, 0x3009, "JVC MP-XP7250 Builtin USB WLAN Adapter")},
-   {PRISM_USB_DEVICE(0x0846, 0x4110, "NetGear MA111")},
-   {PRISM_USB_DEVICE(0x03f3, 0x0020, "Adaptec AWN-8020 USB WLAN Adapter")},
-   {PRISM_USB_DEVICE(0x2821, 0x3300, "ASUS-WL140 Wireless USB Adapter")},
-   {PRISM_USB_DEVICE(0x2001, 0x3700, "DWL-122 Wireless USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x2001, 0x3702, "DWL-120 Rev F Wireless USB Adapter")},
-   {PRISM_USB_DEVICE(0x50c2, 0x4013, "Averatec USB WLAN Adapter")},
-   {PRISM_USB_DEVICE(0x2c02, 0x14ea, "Planex GW-US11H WLAN USB Adapter")},
-   {PRISM_USB_DEVICE(0x124a, 0x168b, "Airvast PRISM3 WLAN USB Adapter")},
-   {PRISM_USB_DEVICE(0x083a, 0x3503, "T-Sinus 111 USB WLAN Adapter")},
-   {PRISM_USB_DEVICE(0x2821, 0x3300, "Hawking HighDB USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x0411, 0x0044, "Melco WLI-USB-KB11 11Mbps WLAN Adapter")},
-   {PRISM_USB_DEVICE(0x1668, 0x6106, "ROPEX FreeLan 802.11b USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x124a, 0x4017, "Pheenet WL-503IA 802.11b USB Adapter")},
-   {PRISM_USB_DEVICE(0x0bb2, 0x0302, "Ambit Microsystems Corp.")},
-   {PRISM_USB_DEVICE
-(0x9016, 0x182d, "Sitecom WL-022 802.11b USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x0543, 0x0f01, "ViewSonic Airsync USB Adapter 1

[PATCHv3 2/3] staging/wlan-ng: remove obsolete comments

2014-04-01 Thread Denis Pithon
prism2sta_probe_usb() and prism2sta_disconnect_usb() header comments are
erroneous and useless. Removed.

Signed-off-by: Denis Pithon 
---
 drivers/staging/wlan-ng/prism2usb.c | 40 -
 1 file changed, 40 deletions(-)

diff --git a/drivers/staging/wlan-ng/prism2usb.c 
b/drivers/staging/wlan-ng/prism2usb.c
index 9f2427c..613c312 100644
--- a/drivers/staging/wlan-ng/prism2usb.c
+++ b/drivers/staging/wlan-ng/prism2usb.c
@@ -56,27 +56,6 @@ static struct usb_device_id usb_prism_tbl[] = {
 };
 MODULE_DEVICE_TABLE(usb, usb_prism_tbl);
 
-/*
-* prism2sta_probe_usb
-*
-* Probe routine called by the USB subsystem.
-*
-* Arguments:
-*  dev ptr to the usb_device struct
-*  ifnum   interface number being offered
-*
-* Returns:
-*  NULL- we're not claiming the device+interface
-*  non-NULL- we are claiming the device+interface and
-*this is a ptr to the data we want back
-*when disconnect is called.
-*
-* Side effects:
-*
-* Call context:
-*  I'm not sure, assume it's interrupt.
-*
-*/
 static int prism2sta_probe_usb(struct usb_interface *interface,
   const struct usb_device_id *id)
 {
@@ -152,25 +131,6 @@ done:
return result;
 }
 
-/*
-* prism2sta_disconnect_usb
-*
-* Called when a device previously claimed by probe is removed
-* from the USB.
-*
-* Arguments:
-*  dev ptr to the usb_device struct
-*  ptr ptr returned by probe() when the device
-*   was claimed.
-*
-* Returns:
-*  Nothing
-*
-* Side effects:
-*
-* Call context:
-*  process
-*/
 static void prism2sta_disconnect_usb(struct usb_interface *interface)
 {
wlandevice_t *wlandev;
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCHv3 1/3] staging/wlan-ng: improve readability of usb_prism_tbl[]

2014-04-01 Thread Denis Pithon
Minor changes to nicely line up device entries.

Signed-off-by: Denis Pithon 
---
 drivers/staging/wlan-ng/prism2usb.c | 118 ++--
 1 file changed, 47 insertions(+), 71 deletions(-)

diff --git a/drivers/staging/wlan-ng/prism2usb.c 
b/drivers/staging/wlan-ng/prism2usb.c
index 4739c14..9f2427c 100644
--- a/drivers/staging/wlan-ng/prism2usb.c
+++ b/drivers/staging/wlan-ng/prism2usb.c
@@ -4,80 +4,56 @@
 #include "prism2sta.c"
 #include "prism2fw.c"
 
-#define PRISM_USB_DEVICE(vid, pid, name)   \
-   USB_DEVICE(vid, pid),   \
-   .driver_info = (unsigned long) name
+#define PRISM_DEV(vid, pid, name)  \
+   { USB_DEVICE(vid, pid), \
+   .driver_info = (unsigned long) name }
 
 static struct usb_device_id usb_prism_tbl[] = {
-   {PRISM_USB_DEVICE(0x04bb, 0x0922, "IOData AirPort WN-B11/USBS")},
-   {PRISM_USB_DEVICE(0x07aa, 0x0012, "Corega Wireless LAN USB Stick-11")},
-   {PRISM_USB_DEVICE(0x09aa, 0x3642, "Prism2.x 11Mbps WLAN USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x1668, 0x0408, "Actiontec Prism2.5 11Mbps WLAN USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x1668, 0x0421, "Actiontec Prism2.5 11Mbps WLAN USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x1915, 0x2236, "Linksys WUSB11v3.0 11Mbps WLAN USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x066b, 0x2212, "Linksys WUSB11v2.5 11Mbps WLAN USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x066b, 0x2213, "Linksys WUSB12v1.1 11Mbps WLAN USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x067c, 0x1022, "Siemens SpeedStream 1022 11Mbps WLAN USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x049f, 0x0033,
-"Compaq/Intel W100 PRO/Wireless 11Mbps multiport WLAN Adapter")},
-   {PRISM_USB_DEVICE
-(0x0411, 0x0016, "Melco WLI-USB-S11 11Mbps WLAN Adapter")},
-   {PRISM_USB_DEVICE
-(0x08de, 0x7a01, "PRISM25 IEEE 802.11 Mini USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x8086, 0x, "Intel PRO/Wireless 2011B LAN USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x0d8e, 0x7a01, "PRISM25 IEEE 802.11 Mini USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x045e, 0x006e, "Microsoft MN510 Wireless USB Adapter")},
-   {PRISM_USB_DEVICE(0x0967, 0x0204, "Acer Warplink USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x0cde, 0x0002, "Z-Com 725/726 Prism2.5 USB/USB Integrated")},
-   {PRISM_USB_DEVICE
-(0x0cde, 0x0005, "Z-Com Xl735 Wireless 802.11b USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x413c, 0x8100, "Dell TrueMobile 1180 Wireless USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x0b3b, 0x1601, "ALLNET 0193 11Mbps WLAN USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x0b3b, 0x1602, "ZyXEL ZyAIR B200 Wireless USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x0baf, 0x00eb, "USRobotics USR1120 Wireless USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x0411, 0x0027, "Melco WLI-USB-KS11G 11Mbps WLAN Adapter")},
-   {PRISM_USB_DEVICE
-(0x04f1, 0x3009, "JVC MP-XP7250 Builtin USB WLAN Adapter")},
-   {PRISM_USB_DEVICE(0x0846, 0x4110, "NetGear MA111")},
-   {PRISM_USB_DEVICE(0x03f3, 0x0020, "Adaptec AWN-8020 USB WLAN Adapter")},
-   {PRISM_USB_DEVICE(0x2821, 0x3300, "ASUS-WL140 Wireless USB Adapter")},
-   {PRISM_USB_DEVICE(0x2001, 0x3700, "DWL-122 Wireless USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x2001, 0x3702, "DWL-120 Rev F Wireless USB Adapter")},
-   {PRISM_USB_DEVICE(0x50c2, 0x4013, "Averatec USB WLAN Adapter")},
-   {PRISM_USB_DEVICE(0x2c02, 0x14ea, "Planex GW-US11H WLAN USB Adapter")},
-   {PRISM_USB_DEVICE(0x124a, 0x168b, "Airvast PRISM3 WLAN USB Adapter")},
-   {PRISM_USB_DEVICE(0x083a, 0x3503, "T-Sinus 111 USB WLAN Adapter")},
-   {PRISM_USB_DEVICE(0x2821, 0x3300, "Hawking HighDB USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x0411, 0x0044, "Melco WLI-USB-KB11 11Mbps WLAN Adapter")},
-   {PRISM_USB_DEVICE(0x1668, 0x6106, "ROPEX FreeLan 802.11b USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x124a, 0x4017, "Pheenet WL-503IA 802.11b USB Adapter")},
-   {PRISM_USB_DEVICE(0x0bb2, 0x0302, "Ambit Microsystems Corp.")},
-   {PRISM_USB_DEVICE
-(0x9016, 0x182d, "Sitecom WL-022 802.11b USB Adapter")},
-   {PRISM_USB_DEVICE
-(0x0543, 0x0f01, "ViewSonic Airsync USB Adapter 11Mbps (Prism2.5)")},
-   { /* terminator */ }
+   PRISM_DEV(0x04bb, 0x0922, "IOData AirPort WN-B11/USBS"),
+   PRISM_DEV(0x07aa, 0x0012

[PATCHv3 3/3] staging/wlan-ng: fix small coding style issues

2014-04-01 Thread Denis Pithon
Delete some unneeded blank lines and add few ones to make checkpatch.pl
happy.

Signed-off-by: Denis Pithon 
---
 drivers/staging/wlan-ng/prism2usb.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/wlan-ng/prism2usb.c 
b/drivers/staging/wlan-ng/prism2usb.c
index 613c312..e92bbc1 100644
--- a/drivers/staging/wlan-ng/prism2usb.c
+++ b/drivers/staging/wlan-ng/prism2usb.c
@@ -96,7 +96,8 @@ static int prism2sta_probe_usb(struct usb_interface 
*interface,
   prism2_reset_settletime, 0);
if (result != 0) {
result = -EIO;
-   dev_err(&interface->dev, "hfa384x_corereset() 
failed.\n");
+   dev_err(&interface->dev,
+   "hfa384x_corereset() failed.\n");
goto failed_reset;
}
}
@@ -136,7 +137,6 @@ static void prism2sta_disconnect_usb(struct usb_interface 
*interface)
wlandevice_t *wlandev;
 
wlandev = (wlandevice_t *) usb_get_intfdata(interface);
-
if (wlandev != NULL) {
LIST_HEAD(cleanlist);
struct list_head *entry;
@@ -228,6 +228,7 @@ static int prism2sta_suspend(struct usb_interface 
*interface,
 {
hfa384x_t *hw = NULL;
wlandevice_t *wlandev;
+
wlandev = (wlandevice_t *) usb_get_intfdata(interface);
if (!wlandev)
return -ENODEV;
@@ -250,6 +251,7 @@ static int prism2sta_resume(struct usb_interface *interface)
int result = 0;
hfa384x_t *hw = NULL;
wlandevice_t *wlandev;
+
wlandev = (wlandevice_t *) usb_get_intfdata(interface);
if (!wlandev)
return -ENODEV;
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging/lustre: fix sparse warning

2014-04-14 Thread Denis Pithon
Fix sparse complaint: "Using plain integer as NULL pointer"

Signed-off-by: Denis Pithon 
---
 drivers/staging/lustre/lustre/ptlrpc/sec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c 
b/drivers/staging/lustre/lustre/ptlrpc/sec.c
index d8041805..b0a1c5a 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/sec.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c
@@ -354,7 +354,7 @@ static int import_sec_check_expire(struct obd_import *imp)
return 0;
 
CDEBUG(D_SEC, "found delayed sec adapt expired, do it now\n");
-   return sptlrpc_import_sec_adapt(imp, NULL, 0);
+   return sptlrpc_import_sec_adapt(imp, NULL, NULL);
 }
 
 static int import_sec_validate_get(struct obd_import *imp,
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/4] staging/wlan-ng: code refactoring

2014-05-12 Thread Denis Pithon
Extract new static function from p80211netdev_rx_bh() to fix coding
style issue (too many leading tabs).

Signed-off-by: Denis Pithon 
---
 drivers/staging/wlan-ng/p80211netdev.c | 74 --
 1 file changed, 43 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/wlan-ng/p80211netdev.c 
b/drivers/staging/wlan-ng/p80211netdev.c
index 2da3cbb..61a3092 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -240,6 +240,48 @@ void p80211netdev_rx(wlandevice_t *wlandev, struct sk_buff 
*skb)
tasklet_schedule(&wlandev->rx_bh);
 }
 
+#define CONV_TO_ETHER_SKIPPED  0x01
+#define CONV_TO_ETHER_FAILED   0x02
+
+/**
+ * convert_frame_to_ether - conversion from 802.11 frame to ethernet frame
+ * @wlandev: pointer to WLAN device
+ * @skb: pointer to socket buffer
+ *
+ * Returns: 0 if conversion succeeded
+ * CONV_TO_ETHER_FAILED if conversion failed
+ * CONV_TO_ETHER_SKIPPED if frame is ignored
+ */
+static int convert_frame_to_ether(wlandevice_t *wlandev, struct sk_buff *skb)
+{
+   struct p80211_hdr_a3 *hdr;
+
+   hdr = (struct p80211_hdr_a3 *) skb->data;
+   if (p80211_rx_typedrop(wlandev, hdr->fc))
+   return CONV_TO_ETHER_SKIPPED;
+
+   /* perform mcast filtering */
+   if (wlandev->netdev->flags & IFF_ALLMULTI) {
+   /* allow my local address through */
+   if (memcmp(hdr->a1, wlandev->netdev->dev_addr, ETH_ALEN) != 0) {
+   /* but reject anything else that isn't multicast */
+   if (!(hdr->a1[0] & 0x01))
+   return CONV_TO_ETHER_SKIPPED;
+   }
+   }
+
+   if (skb_p80211_to_ether(wlandev, wlandev->ethconv, skb) == 0) {
+   skb->dev->last_rx = jiffies;
+   wlandev->linux_stats.rx_packets++;
+   wlandev->linux_stats.rx_bytes += skb->len;
+   netif_rx_ni(skb);
+   return 0;
+   }
+
+   pr_debug("p80211_to_ether failed.\n");
+   return CONV_TO_ETHER_FAILED;
+}
+
 /**
  * p80211netdev_rx_bh - deferred processing of all received frames
  *
@@ -250,7 +292,6 @@ static void p80211netdev_rx_bh(unsigned long arg)
wlandevice_t *wlandev = (wlandevice_t *) arg;
struct sk_buff *skb = NULL;
netdevice_t *dev = wlandev->netdev;
-   struct p80211_hdr_a3 *hdr;
 
/* Let's empty our our queue */
while ((skb = skb_dequeue(&wlandev->nsd_rxq))) {
@@ -273,37 +314,8 @@ static void p80211netdev_rx_bh(unsigned long arg)
netif_rx_ni(skb);
continue;
} else {
-   hdr = (struct p80211_hdr_a3 *) skb->data;
-   if (p80211_rx_typedrop(wlandev, hdr->fc)) {
-   dev_kfree_skb(skb);
-   continue;
-   }
-
-   /* perform mcast filtering */
-   if (wlandev->netdev->flags & IFF_ALLMULTI) {
-   /* allow my local address through */
-   if (memcmp
-   (hdr->a1, wlandev->netdev->dev_addr,
-ETH_ALEN) != 0) {
-   /* but reject anything else that
-  isn't multicast */
-   if (!(hdr->a1[0] & 0x01)) {
-   dev_kfree_skb(skb);
-   continue;
-   }
-   }
-   }
-
-   if (skb_p80211_to_ether
-   (wlandev, wlandev->ethconv, skb) == 0) {
-   skb->dev->last_rx = jiffies;
-   wlandev->linux_stats.rx_packets++;
-   wlandev->linux_stats.rx_bytes +=
-   skb->len;
-   netif_rx_ni(skb);
+   if (!convert_frame_to_ether(wlandev, skb))
continue;
-   }
-   pr_debug("p80211_to_ether failed.\n");
}
}
dev_kfree_skb(skb);
-- 
1.8.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/4] staging/wlan-ng: remove function declaration

2014-05-12 Thread Denis Pithon
Removed useless function prototype: static function p80211netdev_rx_bh()
is defined before being used.

Signed-off-by: Denis Pithon 
---
 drivers/staging/wlan-ng/p80211netdev.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/staging/wlan-ng/p80211netdev.c 
b/drivers/staging/wlan-ng/p80211netdev.c
index e350e1c..2da3cbb 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -90,9 +90,6 @@
 
 #include "cfg80211.c"
 
-/* Support functions */
-static void p80211netdev_rx_bh(unsigned long arg);
-
 /* netdevice method functions */
 static int p80211knetdev_init(netdevice_t *netdev);
 static struct net_device_stats *p80211knetdev_get_stats(netdevice_t *netdev);
-- 
1.8.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 4/4] staging/wlan-ng: replace printk() with pr_xxx()

2014-05-12 Thread Denis Pithon
Fix some coding style issues concerning printk() usage.

Signed-off-by: Denis Pithon 
---
 drivers/staging/wlan-ng/p80211netdev.c | 17 +
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/wlan-ng/p80211netdev.c 
b/drivers/staging/wlan-ng/p80211netdev.c
index 61a3092..3577d20 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -384,8 +384,9 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff 
*skb,
 */
if (skb->protocol != ETH_P_80211_RAW) {
netif_start_queue(wlandev->netdev);
-   printk(KERN_NOTICE
-  "Tx attempt prior to association, frame 
dropped.\n");
+   pr_notice(
+  "Tx attempt prior to association, frame dropped\n"
+   );
wlandev->linux_stats.tx_dropped++;
result = 0;
goto failed;
@@ -684,8 +685,9 @@ static int p80211knetdev_set_mac_address(netdevice_t *dev, 
void *addr)
 * change the netdev address
 */
if (result != 0 || resultcode->data != P80211ENUM_resultcode_success) {
-   printk(KERN_ERR
-  "Low-level driver failed 
dot11req_mibset(dot11MACAddress).\n");
+   pr_err(
+ "Low-level driver failed dot11req_mibset(dot11MACAddress)\n"
+   );
result = -EADDRNOTAVAIL;
} else {
/* everything's ok, change the addr in netdev */
@@ -764,7 +766,7 @@ int wlan_setup(wlandevice_t *wlandev, struct device 
*physdev)
/* Allocate and initialize the wiphy struct */
wiphy = wlan_create_wiphy(physdev, wlandev);
if (wiphy == NULL) {
-   printk(KERN_ERR "Failed to alloc wiphy.\n");
+   pr_err("Failed to alloc wiphy.\n");
return 1;
}
 
@@ -772,7 +774,7 @@ int wlan_setup(wlandevice_t *wlandev, struct device 
*physdev)
netdev = alloc_netdev(sizeof(struct wireless_dev), "wlan%d",
ether_setup);
if (netdev == NULL) {
-   printk(KERN_ERR "Failed to alloc netdev.\n");
+   pr_err("Failed to alloc netdev.\n");
wlan_free_wiphy(wiphy);
result = 1;
} else {
@@ -1104,8 +1106,7 @@ static void p80211knetdev_tx_timeout(netdevice_t *netdev)
if (wlandev->tx_timeout) {
wlandev->tx_timeout(wlandev);
} else {
-   printk(KERN_WARNING "Implement tx_timeout for %s\n",
-  wlandev->nsdname);
+   pr_warn("Implement tx_timeout for %s\n", wlandev->nsdname);
netif_wake_queue(wlandev->netdev);
}
 }
-- 
1.8.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/4] staging/wlan-ng: update function header comment

2014-05-12 Thread Denis Pithon
Header comment of p80211netdev_rx_bh() does not match function
prototype. Fixed.

Signed-off-by: Denis Pithon 
---
 drivers/staging/wlan-ng/p80211netdev.c | 18 +-
 1 file changed, 5 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/wlan-ng/p80211netdev.c 
b/drivers/staging/wlan-ng/p80211netdev.c
index e3ae802..e350e1c 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -243,19 +243,11 @@ void p80211netdev_rx(wlandevice_t *wlandev, struct 
sk_buff *skb)
tasklet_schedule(&wlandev->rx_bh);
 }
 
-/*
-* p80211netdev_rx_bh
-*
-* Deferred processing of all received frames.
-*
-* Arguments:
-*  wlandev WLAN network device structure
-*  skb skbuff containing a full 802.11 frame.
-* Returns:
-*  nothing
-* Side effects:
-*
-*/
+/**
+ * p80211netdev_rx_bh - deferred processing of all received frames
+ *
+ * @arg: pointer to WLAN network device structure (cast to unsigned long)
+ */
 static void p80211netdev_rx_bh(unsigned long arg)
 {
wlandevice_t *wlandev = (wlandevice_t *) arg;
-- 
1.8.1.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/4] staging/wlan-ng: multicast address checking

2014-05-16 Thread Denis Pithon
Used is_multicast_ether_addr() to perform the checking.

Signed-off-by: Denis Pithon 
---
 drivers/staging/wlan-ng/p80211netdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/wlan-ng/p80211netdev.c 
b/drivers/staging/wlan-ng/p80211netdev.c
index 13fe068..63edc83 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -266,7 +266,7 @@ static int p80211_convert_to_ether(wlandevice_t *wlandev, 
struct sk_buff *skb)
if (!ether_addr_equal_unaligned(wlandev->netdev->dev_addr,
hdr->a1)) {
/* but reject anything else that isn't multicast */
-   if (!(hdr->a1[0] & 0x01))
+   if (!is_multicast_ether_addr(hdr->a1))
return CONV_TO_ETHER_SKIPPED;
}
}
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 4/4] staging/wlan-ng: rearrange comments

2014-05-16 Thread Denis Pithon
Gathered together comments in front of multicast filtering block.

Signed-off-by: Denis Pithon 
---
 drivers/staging/wlan-ng/p80211netdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wlan-ng/p80211netdev.c 
b/drivers/staging/wlan-ng/p80211netdev.c
index 63edc83..21ca17e 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -260,12 +260,12 @@ static int p80211_convert_to_ether(wlandevice_t *wlandev, 
struct sk_buff *skb)
if (p80211_rx_typedrop(wlandev, hdr->fc))
return CONV_TO_ETHER_SKIPPED;
 
-   /* perform mcast filtering */
+   /* perform mcast filtering: allow my local address through but reject
+* anything else that isn't multicast
+*/
if (wlandev->netdev->flags & IFF_ALLMULTI) {
-   /* allow my local address through */
if (!ether_addr_equal_unaligned(wlandev->netdev->dev_addr,
hdr->a1)) {
-   /* but reject anything else that isn't multicast */
if (!is_multicast_ether_addr(hdr->a1))
return CONV_TO_ETHER_SKIPPED;
}
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/4] staging/wlan-ng: compare using ether_addr_equal_unaligned

2014-05-16 Thread Denis Pithon
Replaced generic memcmp() with dedicated ether_addr_equal_unaligned()
call. I did not find any clue of u16 alignment for both addresses.

Signed-off-by: Denis Pithon 
---
 drivers/staging/wlan-ng/p80211netdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/wlan-ng/p80211netdev.c 
b/drivers/staging/wlan-ng/p80211netdev.c
index 64dd935..13fe068 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -263,7 +263,8 @@ static int p80211_convert_to_ether(wlandevice_t *wlandev, 
struct sk_buff *skb)
/* perform mcast filtering */
if (wlandev->netdev->flags & IFF_ALLMULTI) {
/* allow my local address through */
-   if (memcmp(hdr->a1, wlandev->netdev->dev_addr, ETH_ALEN) != 0) {
+   if (!ether_addr_equal_unaligned(wlandev->netdev->dev_addr,
+   hdr->a1)) {
/* but reject anything else that isn't multicast */
if (!(hdr->a1[0] & 0x01))
return CONV_TO_ETHER_SKIPPED;
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging/wlan-ng: log with netdev_xxx and dev_xxx

2014-05-16 Thread Denis Pithon
Wherever possible, replaced printk() and pr_xxx() calls with
netdev_xxx() / dev_xxx() calls; used pr_xxx() otherwise.

Signed-off-by: Denis Pithon 
---
 drivers/staging/wlan-ng/p80211netdev.c | 45 +-
 1 file changed, 22 insertions(+), 23 deletions(-)

diff --git a/drivers/staging/wlan-ng/p80211netdev.c 
b/drivers/staging/wlan-ng/p80211netdev.c
index 21ca17e..00b186c 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -279,7 +279,7 @@ static int p80211_convert_to_ether(wlandevice_t *wlandev, 
struct sk_buff *skb)
return 0;
}
 
-   pr_debug("p80211_to_ether failed.\n");
+   netdev_dbg(wlandev->netdev, "p80211_convert_to_ether failed.\n");
return CONV_TO_ETHER_FAILED;
 }
 
@@ -365,7 +365,7 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff 
*skb,
memset(&p80211_wep, 0, sizeof(struct p80211_metawep));
 
if (netif_queue_stopped(netdev)) {
-   pr_debug("called when queue stopped.\n");
+   netdev_dbg(netdev, "called when queue stopped.\n");
result = 1;
goto failed;
}
@@ -385,8 +385,7 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff 
*skb,
 */
if (skb->protocol != ETH_P_80211_RAW) {
netif_start_queue(wlandev->netdev);
-   printk(KERN_NOTICE
-  "Tx attempt prior to association, frame 
dropped.\n");
+   netdev_notice(netdev, "Tx attempt prior to association, 
frame dropped.\n");
wlandev->linux_stats.tx_dropped++;
result = 0;
goto failed;
@@ -408,8 +407,8 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff 
*skb,
(wlandev, wlandev->ethconv, skb, &p80211_hdr,
 &p80211_wep) != 0) {
/* convert failed */
-   pr_debug("ether_to_80211(%d) failed.\n",
-wlandev->ethconv);
+   netdev_dbg(netdev, "ether_to_80211(%d) failed.\n",
+  wlandev->ethconv);
result = 1;
goto failed;
}
@@ -434,17 +433,17 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff 
*skb,
result = NETDEV_TX_OK;
} else if (txresult == 1) {
/* success, no more avail */
-   pr_debug("txframe success, no more bufs\n");
+   netdev_dbg(netdev, "txframe success, no more bufs\n");
/* netdev->tbusy = 1;  don't set here, irqhdlr */
/*   may have already cleared it */
result = NETDEV_TX_OK;
} else if (txresult == 2) {
/* alloc failure, drop frame */
-   pr_debug("txframe returned alloc_fail\n");
+   netdev_dbg(netdev, "txframe returned alloc_fail\n");
result = NETDEV_TX_BUSY;
} else {
/* buffer full or queue busy, drop frame. */
-   pr_debug("txframe returned full or busy\n");
+   netdev_dbg(netdev, "txframe returned full or busy\n");
result = NETDEV_TX_BUSY;
}
 
@@ -564,7 +563,7 @@ static int p80211knetdev_do_ioctl(netdevice_t *dev, struct 
ifreq *ifr, int cmd)
wlandevice_t *wlandev = dev->ml_priv;
u8 *msgbuf;
 
-   pr_debug("rx'd ioctl, cmd=%d, len=%d\n", cmd, req->len);
+   netdev_dbg(dev, "rx'd ioctl, cmd=%d, len=%d\n", cmd, req->len);
 
 #ifdef SIOCETHTOOL
if (cmd == SIOCETHTOOL) {
@@ -685,8 +684,7 @@ static int p80211knetdev_set_mac_address(netdevice_t *dev, 
void *addr)
 * change the netdev address
 */
if (result != 0 || resultcode->data != P80211ENUM_resultcode_success) {
-   printk(KERN_ERR
-  "Low-level driver failed 
dot11req_mibset(dot11MACAddress).\n");
+   netdev_err(dev, "Low-level driver failed 
dot11req_mibset(dot11MACAddress).\n");
result = -EADDRNOTAVAIL;
} else {
/* everything's ok, change the addr in netdev */
@@ -765,7 +763,7 @@ int wlan_setup(wlandevice_t *wlandev, struct device 
*physdev)
/* Allocate and initialize the wiphy struct */
wiphy = wlan_create_wiphy(physdev, wlandev);
if (wiphy == NULL) {
-   printk(KERN_ERR "Failed to alloc wiphy.\n");
+   dev_err(physdev, "Failed to alloc wiphy.\n");
return 1;
}
 
@@ -773,7 +771,7 @@ int wlan_setup(wlandevice_t *wlandev, struct device 
*phys

[PATCH 1/4] staging/wlan-ng: add prefix to function name

2014-05-16 Thread Denis Pithon
Renamed convert_frame_to_ether() to p80211_convert_to_ether().

Signed-off-by: Denis Pithon 
---
 drivers/staging/wlan-ng/p80211netdev.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/wlan-ng/p80211netdev.c 
b/drivers/staging/wlan-ng/p80211netdev.c
index 61a3092..64dd935 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -244,7 +244,7 @@ void p80211netdev_rx(wlandevice_t *wlandev, struct sk_buff 
*skb)
 #define CONV_TO_ETHER_FAILED   0x02
 
 /**
- * convert_frame_to_ether - conversion from 802.11 frame to ethernet frame
+ * p80211_convert_to_ether - conversion from 802.11 frame to ethernet frame
  * @wlandev: pointer to WLAN device
  * @skb: pointer to socket buffer
  *
@@ -252,7 +252,7 @@ void p80211netdev_rx(wlandevice_t *wlandev, struct sk_buff 
*skb)
  * CONV_TO_ETHER_FAILED if conversion failed
  * CONV_TO_ETHER_SKIPPED if frame is ignored
  */
-static int convert_frame_to_ether(wlandevice_t *wlandev, struct sk_buff *skb)
+static int p80211_convert_to_ether(wlandevice_t *wlandev, struct sk_buff *skb)
 {
struct p80211_hdr_a3 *hdr;
 
@@ -314,7 +314,7 @@ static void p80211netdev_rx_bh(unsigned long arg)
netif_rx_ni(skb);
continue;
} else {
-   if (!convert_frame_to_ether(wlandev, skb))
+   if (!p80211_convert_to_ether(wlandev, skb))
continue;
}
}
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging/wlan-ng: use ether_addr_equal_unaligned

2014-06-01 Thread Denis Pithon
This patch get rid of all memcmp() on ethernet addresses in wlan-ng.
Replaced with ether_addr_equal_unaligned().

Signed-off-by: Denis Pithon 
---
 drivers/staging/wlan-ng/p80211conv.c |  6 +++---
 drivers/staging/wlan-ng/prism2sta.c  | 16 +---
 2 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wlan-ng/p80211conv.c 
b/drivers/staging/wlan-ng/p80211conv.c
index 913676e..fb8a628 100644
--- a/drivers/staging/wlan-ng/p80211conv.c
+++ b/drivers/staging/wlan-ng/p80211conv.c
@@ -241,7 +241,7 @@ static void orinoco_spy_gather(wlandevice_t *wlandev, char 
*mac,
 
for (i = 0; i < wlandev->spy_number; i++) {
 
-   if (!memcmp(wlandev->spy_address[i], mac, ETH_ALEN)) {
+   if (ether_addr_equal_unaligned(wlandev->spy_address[i], mac)) {
memcpy(wlandev->spy_address[i], mac, ETH_ALEN);
wlandev->spy_stat[i].level = rxmeta->signal;
wlandev->spy_stat[i].noise = rxmeta->noise;
@@ -359,8 +359,8 @@ int skb_p80211_to_ether(wlandevice_t *wlandev, u32 ethconv,
/* Test for the various encodings */
if ((payload_length >= sizeof(struct wlan_ethhdr)) &&
(e_llc->dsap != 0xaa || e_llc->ssap != 0xaa) &&
-   ((memcmp(daddr, e_hdr->daddr, WLAN_ETHADDR_LEN) == 0) ||
-(memcmp(saddr, e_hdr->saddr, WLAN_ETHADDR_LEN) == 0))) {
+   (ether_addr_equal_unaligned(daddr, e_hdr->daddr) ||
+ether_addr_equal_unaligned(saddr, e_hdr->saddr))) {
pr_debug("802.3 ENCAP len: %d\n", payload_length);
/* 802.3 Encapsulated */
/* Test for an overlength frame */
diff --git a/drivers/staging/wlan-ng/prism2sta.c 
b/drivers/staging/wlan-ng/prism2sta.c
index 278b6a1..d2e492c 100644
--- a/drivers/staging/wlan-ng/prism2sta.c
+++ b/drivers/staging/wlan-ng/prism2sta.c
@@ -56,6 +56,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1505,7 +1506,8 @@ static void prism2sta_inf_assocstatus(wlandevice_t 
*wlandev,
 */
 
for (i = 0; i < hw->authlist.cnt; i++)
-   if (memcmp(rec.sta_addr, hw->authlist.addr[i], ETH_ALEN) == 0)
+   if (ether_addr_equal_unaligned(rec.sta_addr,
+  hw->authlist.addr[i]))
break;
 
if (i >= hw->authlist.cnt) {
@@ -1587,8 +1589,8 @@ static void prism2sta_inf_authreq_defer(wlandevice_t 
*wlandev,
 */
 
for (i = 0; i < hw->authlist.cnt; i++)
-   if (memcmp(rec.address, hw->authlist.addr[i],
-  ETH_ALEN) == 0) {
+   if (ether_addr_equal_unaligned(rec.address,
+  hw->authlist.addr[i])) {
rec.status = P80211ENUM_status_successful;
break;
}
@@ -1625,7 +1627,7 @@ static void prism2sta_inf_authreq_defer(wlandevice_t 
*wlandev,
}
 
for (i = 0; i < cnt; i++, addr += ETH_ALEN)
-   if (memcmp(rec.address, addr, ETH_ALEN) == 0) {
+   if (ether_addr_equal_unaligned(rec.address, addr)) {
rec.status = P80211ENUM_status_successful;
break;
}
@@ -1655,7 +1657,7 @@ static void prism2sta_inf_authreq_defer(wlandevice_t 
*wlandev,
rec.status = P80211ENUM_status_successful;
 
for (i = 0; i < cnt; i++, addr += ETH_ALEN)
-   if (memcmp(rec.address, addr, ETH_ALEN) == 0) {
+   if (ether_addr_equal_unaligned(rec.address, addr)) {
rec.status = P80211ENUM_status_unspec_failure;
break;
}
@@ -1676,8 +1678,8 @@ static void prism2sta_inf_authreq_defer(wlandevice_t 
*wlandev,
 
if (rec.status == P80211ENUM_status_successful) {
for (i = 0; i < hw->authlist.cnt; i++)
-   if (memcmp(rec.address, hw->authlist.addr[i], ETH_ALEN)
-   == 0)
+   if (ether_addr_equal_unaligned(rec.address,
+  hw->authlist.addr[i]))
break;
 
if (i >= hw->authlist.cnt) {
-- 
1.9.0

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel