staging: gdm72xx: Minor cleanup
cover staging: gdm72xx: Minor cleanup
The following patches perform various cleanups on the gdm72xx driver.
PATCH 1/3 fixes some small coding style issues
PATCH 2/3 removes an already completed item from the TODO list PATCH 3/3 replaces some jiffies comparisons with wrap-safe functions
After all patches have been applied, the only remaining issue on the TODO list is to conform to the coding standards. The remaining issues reported by checkpatch.pl are probably pedantic, so if agreed, that task can be removed from the list too.
-Michalis
PATCH 1/3 staging: gdm72xx: Coding style fixes
Minor white-space fixes as suggested by checkpatch.pl.
--- drivers/staging/gdm72xx/gdm_qos.c | 2 +- drivers/staging/gdm72xx/gdm_wimax.c | 2 ++ drivers/staging/gdm72xx/usb_boot.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-)
drivers/staging/gdm72xx/gdm_qos.c +1 -1
@@ -377,7 +377,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) index =get_csr (qcb,SFID ,1 );if (index ==-1 ) {netdev_err (nic->netdev, -"QoS ERROR: csr Update Error / Wrong index (%d) \n" , +"QoS ERROR: csr Update Error / Wrong index (%d)\n" , index);return ; }
drivers/staging/gdm72xx/gdm_wimax.c +2 -0
@@ -199,6 +199,7 @@ static void gdm_wimax_event_rcv(struct net_device *dev, u16 type, void *msg,u8 *buf = (u8 *) msg;u16 hci_cmd = (buf[0 ]<<8 ) | buf[1 ];u16 hci_len = (buf[2 ]<<8 ) | buf[3 ]; +netdev_dbg (dev,"H=>D: 0x%04x(%d)\n" , hci_cmd, hci_len);gdm_wimax_send (nic, msg, len);
@@ -310,6 +311,7 @@ static int gdm_wimax_event_send(struct net_device *dev, char *buf, int size)u16 hci_cmd = ((u8 )buf[0 ]<<8 ) | (u8 )buf[1 ];u16 hci_len = ((u8 )buf[2 ]<<8 ) | (u8 )buf[3 ]; +netdev_dbg (dev,"D=>H: 0x%04x(%d)\n" , hci_cmd, hci_len);spin_lock_irqsave (&wm_event.evt_lock, flags);
drivers/staging/gdm72xx/usb_boot.c +1 -0
@@ -67,6 +67,7 @@ struct fw_info {static void array_le32_to_cpu (u32 *arr,int num) {int i; +for (i =0 ; i < num; i++, arr++) *arr =__le32_to_cpu (*arr); }
Signature · 1 line
1.7.12.1
PATCH 2/3 staging: gdm72xx: Removed task from TODO list
In reply to Michalis PappasRemoved task related to replacement of kernel_thread with kthread, as issue was fixed on ff5e4a1d2702582614996f6f6d005e9b5caadeb8.
--- drivers/staging/gdm72xx/TODO | 1 - 1 file changed, 1 deletion(-)
drivers/staging/gdm72xx/TODO +0 -1
@@ -1,3 +1,2 @@ TODO: -- Replace kernel_thread with kthread in gdm_usb.c - Clean up coding style to meet kernel standard.
Signature · 1 line
1.7.12.1
PATCH 3/3 staging: gdm72xx: Removed direct comparisons on jiffies
In reply to Michalis PappasReplaced comparisons on jiffies values with wrap-safe functions.
--- drivers/staging/gdm72xx/gdm_usb.c | 2 +- drivers/staging/gdm72xx/sdio_boot.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/gdm72xx/gdm_usb.c +1 -1
@@ -730,7 +730,7 @@ static int k_mode_thread(void *arg)spin_unlock_irqrestore (&k_lock, flags2); expire = jiffies +K_WAIT_TIME ; -while (jiffies < expire) +while (time_before (jiffies, expire))schedule_timeout (K_WAIT_TIME );spin_lock_irqsave (&rx->lock, flags);
drivers/staging/gdm72xx/sdio_boot.c +2 -1
@@ -41,11 +41,11 @@ static u8 *tx_buf;static int ack_ready (struct sdio_func *func) { -unsigned long start = jiffies; +unsigned long wait = jiffies +HZ ;u8 val;int ret; - while ((jiffies - start) < HZ) { +while (time_before (jiffies, wait)) { val =sdio_readb (func,0x13 , &ret);if (val &0x01 )return 1 ;
Signature · 1 line
1.7.12.1
Greg KH
maintainerQuoted 10 lines · Michalis Pappas
The following patches perform various cleanups on the gdm72xx driver.
PATCH 1/3 fixes some small coding style issues
PATCH 2/3 removes an already completed item from the TODO list PATCH 3/3 replaces some jiffies comparisons with wrap-safe functionsAfter all patches have been applied, the only remaining issue on the TODO list is to conform to the coding standards. The remaining issues reported by checkpatch.pl are probably pedantic, so if agreed, that task can be removed from the list too.
These patches were all oddly corrupted, can you try resending them after ensuring that you can still apply them on your end?
thanks,
greg k-h
v2 cover staging: gdm72xx: Minor cleanup
The following patches perform various cleanups on the gdm72xx driver.
PATCH 1/3 fixes some small coding style issues
PATCH 2/3 removes an already completed item from the TODO list PATCH 3/3 replaces some jiffies comparisons with wrap-safe functions
After all patches have been applied, the only remaining issue on the TODO list is to conform to the coding standards. The remaining issues reported by checkpatch.pl are probably pedantic, so if agreed, that task can be removed from the list too.
-Michalis
PATCH v2 1/3 staging: gdm72xx: Minor cleanup
Minor white-space fixes as suggested by checkpatch.pl.
--- drivers/staging/gdm72xx/gdm_qos.c | 2 +- drivers/staging/gdm72xx/gdm_wimax.c | 2 ++ drivers/staging/gdm72xx/usb_boot.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-)
drivers/staging/gdm72xx/gdm_qos.c +1 -1
@@ -377,7 +377,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) index =get_csr (qcb,SFID ,1 );if (index ==-1 ) {netdev_err (nic->netdev, -"QoS ERROR: csr Update Error / Wrong index (%d) \n" , +"QoS ERROR: csr Update Error / Wrong index (%d)\n" , index);return ; }
drivers/staging/gdm72xx/gdm_wimax.c +2 -0
@@ -199,6 +199,7 @@ static void gdm_wimax_event_rcv(struct net_device *dev, u16 type, void *msg,u8 *buf = (u8 *) msg;u16 hci_cmd = (buf[0 ]<<8 ) | buf[1 ];u16 hci_len = (buf[2 ]<<8 ) | buf[3 ]; +netdev_dbg (dev,"H=>D: 0x%04x(%d)\n" , hci_cmd, hci_len);gdm_wimax_send (nic, msg, len);
@@ -310,6 +311,7 @@ static int gdm_wimax_event_send(struct net_device *dev, char *buf, int size)u16 hci_cmd = ((u8 )buf[0 ]<<8 ) | (u8 )buf[1 ];u16 hci_len = ((u8 )buf[2 ]<<8 ) | (u8 )buf[3 ]; +netdev_dbg (dev,"D=>H: 0x%04x(%d)\n" , hci_cmd, hci_len);spin_lock_irqsave (&wm_event.evt_lock, flags);
drivers/staging/gdm72xx/usb_boot.c +1 -0
@@ -67,6 +67,7 @@ struct fw_info {static void array_le32_to_cpu (u32 *arr,int num) {int i; +for (i =0 ; i < num; i++, arr++) *arr =__le32_to_cpu (*arr); }
Signature · 1 line
1.7.12.1
PATCH v2 2/3 staging: gdm72xx: Minor cleanup
In reply to Michalis PappasRemoved line related to replacement of kernel_thread with kthread, as issue was fixed on ff5e4a1d2702582614996f6f6d005e9b5caadeb8.
--- drivers/staging/gdm72xx/TODO | 1 - 1 file changed, 1 deletion(-)
drivers/staging/gdm72xx/TODO +0 -1
@@ -1,3 +1,2 @@ TODO: -- Replace kernel_thread with kthread in gdm_usb.c - Clean up coding style to meet kernel standard.
Signature · 1 line
1.7.12.1
Quoted 4 lines · Michalis Pappas
Removed line related to replacement of
kernel_threadwith kthread, as issue was fixed onff5e4a1d2702582614996f6f6d005e9b5caadeb8.
In the future, the way to specify a commit is:ff5e4a1d2702 ('Staging: gdm72xx: gdm_usb: fix deprecated function kernel_thread')
It's hard to remember which git hash goes with which commit.
regards,
dan carpenter
PATCH v2 3/3 staging: gdm72xx: Minor cleanup
In reply to Michalis PappasReplaced comparisons on jiffies values with wrap-safe functions.
--- drivers/staging/gdm72xx/gdm_usb.c | 2 +- drivers/staging/gdm72xx/sdio_boot.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/gdm72xx/gdm_usb.c +1 -1
@@ -730,7 +730,7 @@ static int k_mode_thread(void *arg)spin_unlock_irqrestore (&k_lock, flags2); expire = jiffies +K_WAIT_TIME ; -while (jiffies < expire) +while (time_before (jiffies, expire))schedule_timeout (K_WAIT_TIME );spin_lock_irqsave (&rx->lock, flags);
drivers/staging/gdm72xx/sdio_boot.c +2 -2
@@ -41,11 +41,11 @@ static u8 *tx_buf;static int ack_ready (struct sdio_func *func) { -unsigned long start = jiffies; +unsigned long wait = jiffies +HZ ;u8 val;int ret; -while ((jiffies - start) <HZ ) { +while (time_before (jiffies, wait)) { val =sdio_readb (func,0x13 , &ret);if (val &0x01 )return 1 ;
Signature · 1 line
1.7.12.1
These patches are all good but the subjects for all three are the same and quite bad. Please fix this and resend.
regards,
dan carpenter
v3 cover staging: gdm72xx: Minor cleanup
The following patches perform various cleanups on the gdm72xx driver.
PATCH 1/3 fixes some small coding style issues
PATCH 2/3 removes an already completed item from the TODO list PATCH 3/3 replaces some jiffies comparisons with wrap-safe functions
After all patches have been applied, the only remaining issue on the TODO list is to conform to the coding standards. The remaining issues reported by checkpatch.pl are probably pedantic, so if agreed, that task can be removed from the list too.
-Michalis
Re: [PATCH v3 1/3] staging: gdm72xx: Coding style fixes
Minor white-space fixes as suggested by checkpatch.pl.
--- drivers/staging/gdm72xx/gdm_qos.c | 2 +- drivers/staging/gdm72xx/gdm_wimax.c | 2 ++ drivers/staging/gdm72xx/usb_boot.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-)
drivers/staging/gdm72xx/gdm_qos.c +1 -1
@@ -377,7 +377,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) index =get_csr (qcb,SFID ,1 );if (index ==-1 ) {netdev_err (nic->netdev, -"QoS ERROR: csr Update Error / Wrong index (%d) \n" , +"QoS ERROR: csr Update Error / Wrong index (%d)\n" , index);return ; }
drivers/staging/gdm72xx/gdm_wimax.c +2 -0
@@ -199,6 +199,7 @@ static void gdm_wimax_event_rcv(struct net_device *dev, u16 type, void *msg,u8 *buf = (u8 *) msg;u16 hci_cmd = (buf[0 ]<<8 ) | buf[1 ];u16 hci_len = (buf[2 ]<<8 ) | buf[3 ]; +netdev_dbg (dev,"H=>D: 0x%04x(%d)\n" , hci_cmd, hci_len);gdm_wimax_send (nic, msg, len);
@@ -310,6 +311,7 @@ static int gdm_wimax_event_send(struct net_device *dev, char *buf, int size)u16 hci_cmd = ((u8 )buf[0 ]<<8 ) | (u8 )buf[1 ];u16 hci_len = ((u8 )buf[2 ]<<8 ) | (u8 )buf[3 ]; +netdev_dbg (dev,"D=>H: 0x%04x(%d)\n" , hci_cmd, hci_len);spin_lock_irqsave (&wm_event.evt_lock, flags);
drivers/staging/gdm72xx/usb_boot.c +1 -0
@@ -67,6 +67,7 @@ struct fw_info {static void array_le32_to_cpu (u32 *arr,int num) {int i; +for (i =0 ; i < num; i++, arr++) *arr =__le32_to_cpu (*arr); }
Signature · 1 line
1.7.12.1
PATCH v3 2/3 staging: gdm72xx: Removed completed task from TODO list
In reply to Michalis PappasRemoved line related to replacement of kernel_thread with kthread, as issue was fixed on ff5e4a1d2702 ('Staging: gdm72xx: gdm_usb: fix deprecated function kernel_thread')
--- drivers/staging/gdm72xx/TODO | 1 - 1 file changed, 1 deletion(-)
drivers/staging/gdm72xx/TODO +0 -1
@@ -1,3 +1,2 @@ TODO: -- Replace kernel_thread with kthread in gdm_usb.c - Clean up coding style to meet kernel standard.
Signature · 1 line
1.7.12.1
PATCH v3 3/3 staging: gdm72xx: Removed direct comparisons on jiffies
In reply to Michalis PappasReplaced comparisons on jiffies values with wrap-safe functions.
--- drivers/staging/gdm72xx/gdm_usb.c | 2 +- drivers/staging/gdm72xx/sdio_boot.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/gdm72xx/gdm_usb.c +1 -1
@@ -730,7 +730,7 @@ static int k_mode_thread(void *arg)spin_unlock_irqrestore (&k_lock, flags2); expire = jiffies +K_WAIT_TIME ; -while (jiffies < expire) +while (time_before (jiffies, expire))schedule_timeout (K_WAIT_TIME );spin_lock_irqsave (&rx->lock, flags);
drivers/staging/gdm72xx/sdio_boot.c +2 -2
@@ -41,11 +41,11 @@ static u8 *tx_buf;static int ack_ready (struct sdio_func *func) { -unsigned long start = jiffies; +unsigned long wait = jiffies +HZ ;u8 val;int ret; -while ((jiffies - start) <HZ ) { +while (time_before (jiffies, wait)) { val =sdio_readb (func,0x13 , &ret);if (val &0x01 )return 1 ;
Signature · 1 line
1.7.12.1
Quoted 4 lines · Michalis Pappas
After all patches have been applied, the only remaining issue on the TODO list is to conform to the coding standards. The remaining issues reported by checkpatch.pl are probably pedantic, so if agreed, that task can be removed from the list too.
So I did a:
for i in $(find drivers/staging/gdm72xx/ -name \*.c) ; do ./scripts/checkpatch.pl --strict -f $i 2>&1 ; done | tee err-list
I didn't look through all the issues but the ones I looked at seemed valid. The "no space after a cast" rule is good because cast precedence used to be a common source of bugs.
The code in extract_qos_list() was badly mangled to get around the 80 character limit and checkpatch.pl finds that. That function is very ugly. Just reverse the if statements instead of jamming the code up
against the far right side of the screen. if (!qcb->csr[i].enabled) continue; if (qcb->csr[i].qos_buf_count >= qcb->qos_limit_size) continue; if (list_empty(&qcb->qos_list[i])) continue;
Also why is returning a u32? Kernel style is int. But this doesn't return errors and the callers don't check so it should be void. This driver suffers from prefering u32 over int in many places.
This was my only static checker warning (harmless):drivers/staging/gdm72xx/gdm_wimax.c:780 gdm_wimax_transmit_pkt()
warn: we tested 'len' before and it was 'true'
In gdm_usb_send(), the "BUG_ON(len > TX_BUF_SIZE - padding - 1);" should be proper error handling.
I didn't really do a proper review of this code when I saw all the checkpatch.pl complaints still.
regards,
dan carpenter
Quoted 9 lines · Dan Carpenter
Quoted 4 lines · Michalis Pappas
After all patches have been applied, the only remaining issue on the TODO list is to conform to the coding standards. The remaining issues reported by checkpatch.pl are probably pedantic, so if agreed, that task can be removed from the list too.
So I did a:
for i in $(finddrivers/staging/gdm72xx/-name \*.c) ; do./scripts/checkpatch.pl--strict -f $i 2>&1 ; done | tee err-list
Hi Dan, thanks for looking at this. From the above snippet I realize that I wasn't aware of the strict flag, so significantly less errors were produced.
The issues I was referring to as pedantic are:
WARNING: unchecked sscanf return value
#296: FILE: gdm_wimax.c:296:
+ sscanf(e->dev->name, "wm%d", &idx);
does this really need to be checked?
ERROR: Macros with complex values should be enclosed in parenthesis #34: FILE: usb_ids.h:34:
+#define USB_DEVICE_BOOTLOADER(vid, pid) \
+ {USB_DEVICE((vid), ((pid)&BL_PID_MASK)|B_DOWNLOAD)}, \
+ {USB_DEVICE((vid), ((pid)&BL_PID_MASK)|B_DOWNLOAD|B_DIFF_DL_DRV)}
these macros are only used for brevity in a subsequent array declaration, so it seems that the parenthesis are not really needed.
Moreover, due to recent commits on checkpatch.pl, a few more issues are now reported, even when not using the strict flag. In any case, I can re-run using strict and submit an additional set of patches for the remaining issues.
Regards,
Michalis
Quoted 11 lines · Michalis Pappas
Hi Dan, thanks for looking at this. From the above snippet I realize that I wasn't aware of the strict flag, so significantly less errors were produced.
The issues I was referring to as pedantic are:
WARNING: unchecked sscanf return value
#296: FILE: gdm_wimax.c:296:
+sscanf(e->dev->name, "wm%d", &idx);does this really need to be checked?
Just check it. The code as is looks like a information leak (security vulnerability) until you realize that e->dev->name is probably a known, trusted string.
Quoted 9 lines
ERROR: Macros with complex values should be enclosed in parenthesis #34: FILE: usb_ids.h:34:
(quoted diff) +3
-0+#define USB_DEVICE_BOOTLOADER(vid, pid) \ + {USB_DEVICE((vid), ((pid)&BL_PID_MASK)|B_DOWNLOAD)}, \ + {USB_DEVICE((vid), ((pid)&BL_PID_MASK)|B_DOWNLOAD|B_DIFF_DL_DRV)}these macros are only used for brevity in a subsequent array declaration, so it seems that the parenthesis are not really needed.
Yeah. You're right. Just ignore this one. Adding parenthis will break the build.
checkpatch doesn't totally need to be happy.
regards,
dan carpenter
Quoted 11 lines · Dan Carpenter
Quoted 10 lines · Michalis Pappas
Hi Dan, thanks for looking at this. From the above snippet I realize that I wasn't aware of the strict flag, so significantly less errors were produced.
The issues I was referring to as pedantic are:
WARNING: unchecked sscanf return value
#296: FILE: gdm_wimax.c:296:
+sscanf(e->dev->name, "wm%d", &idx);
Quoted 5 lines
Quoted 1 line
does this really need to be checked?
Just check it. The code as is looks like a information leak (security vulnerability) until you realize that
e->dev->nameis probably a known, trusted string.
Btw, we saw a "fix" for this earlier which just printed an error message. Don't do that. Assume that static checkers will soon start complaining about the info leak instead of just looking at sscanf().
regards,
dan carpenter
v4 cover staging: gdm72xx: Code cleanup
Ok, I generated a new patchset based on running checkpatch.pl with the --strict option, as well as any recommendations made earlier on this thread.
Quoted 1 line
From the following patches, both 8/10 and 9/10 involve whitespace fixes:
the former fixes issues reported by checkpatch.pl while the latter is mostly indentation stuff found by inspecting the code, stray tabs etc. I am sending them as separate patches in case one wants to keep only one of them.
After applying the patches, the following issues are still reported by checkpatch.pl. My comments follow:
ERROR: Macros with complex values should be enclosed in parenthesis #34: FILE: usb_ids.h:34:
+#define USB_DEVICE_BOOTLOADER(vid, pid) \
+ {USB_DEVICE((vid), ((pid)&BL_PID_MASK)|B_DOWNLOAD)}, \
+ {USB_DEVICE((vid), ((pid)&BL_PID_MASK)|B_DOWNLOAD|B_DIFF_DL_DRV)}
We agreed on that one already.
WARNING:LONG_LINE: line over 80 characters
This comes out in cases where I slightly bent the 80 chars rule to improve readability. Should anyone complain that it doesn't fit their terminal I promise I'll revert it back ;)
WARNING: unchecked sscanf return value
#295: FILE: gdm_wimax.c:295:
+ sscanf(e->dev->name, "wm%d", &idx);
Quoted 1 line
From my understanding this should be ok. The value stored in e->dev>name
is generated by __dev_alloc_name which does all the necessary checks for user supplied input etc, so it should be considered as a trusted value.
WARNING:SPACING: Missing a blank line after declarations
This is a false positive, as it refers to pointer-to-function declarations withing structures.
CHECK:BRACES: Blank lines aren't necessary after an open brace '{'
I found it to be more readable the way it was, so I didn't touch it.
CHECK:UNCOMMENTED_DEFINITION: spinlock_t definition without comment
I am not sure what the locks are used for so I am unable to write a comment on these.
Regards,
-Michalis
PATCH v4 1/10 staging: gdm72xx: Removed unnecessary extern declarations from header files
Removed unnecessary extern declarations from header files
--- drivers/staging/gdm72xx/gdm_wimax.h | 6 +++--- drivers/staging/gdm72xx/sdio_boot.h | 2 +- drivers/staging/gdm72xx/usb_boot.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/gdm72xx/gdm_wimax.h +3 -3
@@ -64,8 +64,8 @@ struct nic {/*#define LOOPBACK_TEST */ -extern int register_wimax_device (struct phy_dev *phy_dev,struct device *pdev); -extern int gdm_wimax_send_tx (struct sk_buff *skb,struct net_device *dev); -extern void unregister_wimax_device (struct phy_dev *phy_dev); +int register_wimax_device (struct phy_dev *phy_dev,struct device *pdev); +int gdm_wimax_send_tx (struct sk_buff *skb,struct net_device *dev); +void unregister_wimax_device (struct phy_dev *phy_dev);#endif
drivers/staging/gdm72xx/sdio_boot.h +1 -1
@@ -16,6 +16,6 @@struct sdio_func ; -extern int sdio_boot (struct sdio_func *func); +int sdio_boot (struct sdio_func *func);#endif /* __SDIO_BOOT_H__ */
drivers/staging/gdm72xx/usb_boot.h +2 -2
@@ -16,7 +16,7 @@struct usb_device ; -extern int usb_boot (struct usb_device *usbdev,u16 pid); -extern int usb_emergency (struct usb_device *usbdev); +int usb_boot (struct usb_device *usbdev,u16 pid); +int usb_emergency (struct usb_device *usbdev);#endif /* __USB_BOOT_H__ */
Signature · 1 line
1.8.4
PATCH v4 2/10 staging: gdm72xx: Replaced comparisons on jiffies values with wrap-safe functions
In reply to Michalis PappasReplaced comparisons on jiffies values with wrap-safe functions.
--- drivers/staging/gdm72xx/gdm_usb.c | 2 +- drivers/staging/gdm72xx/sdio_boot.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/gdm72xx/gdm_usb.c +1 -1
@@ -730,7 +730,7 @@ static int k_mode_thread(void *arg)spin_unlock_irqrestore (&k_lock, flags2); expire = jiffies +K_WAIT_TIME ; -while (jiffies < expire) +while (time_before (jiffies, expire))schedule_timeout (K_WAIT_TIME );spin_lock_irqsave (&rx->lock, flags);
drivers/staging/gdm72xx/sdio_boot.c +2 -2
@@ -41,11 +41,11 @@ static u8 *tx_buf;static int ack_ready (struct sdio_func *func) { -unsigned long start = jiffies; +unsigned long wait = jiffies +HZ ;u8 val;int ret; -while ((jiffies - start) <HZ ) { +while (time_before (jiffies, wait)) { val =sdio_readb (func,0x13 , &ret);if (val &0x01 )return 1 ;
Signature · 1 line
1.8.4
PATCH v4 3/10 staging: gdm72xx: Modified struct allocation to match coding standards
In reply to Michalis PappasModified struct allocation to match coding standards
--- drivers/staging/gdm72xx/gdm_qos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/gdm72xx/gdm_qos.c +1 -1
@@ -56,7 +56,7 @@ static void *alloc_qos_entry(void) }spin_unlock_irqrestore (&qos_free_list.lock, flags); - entry =kmalloc (sizeof (struct qos_entry_s ),GFP_ATOMIC ); + entry =kmalloc (sizeof (*entry),GFP_ATOMIC );return entry; }
Signature · 1 line
1.8.4
PATCH v4 4/10 staging: gdm72xx: Moved logical continuation to previous line to conform to coding style
In reply to Michalis PappasMoved logical continuation to previous line to conform to coding style
--- drivers/staging/gdm72xx/gdm_usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/gdm72xx/gdm_usb.c +2 -2
@@ -518,8 +518,8 @@ static void do_pm_control(struct work_struct *work)usb_autopm_put_interface (udev->intf);spin_lock_irqsave (&tx->lock, flags); -if (!(udev->usbdev->state &USB_STATE_SUSPENDED ) - && (!list_empty (&tx->hci_list) || !list_empty (&tx->sdu_list))) { +if (!(udev->usbdev->state &USB_STATE_SUSPENDED ) && + (!list_empty (&tx->hci_list) || !list_empty (&tx->sdu_list))) {struct usb_tx *t, *temp;list_for_each_entry_safe (t, temp, &tx->pending_list, p_list) {
Signature · 1 line
1.8.4
PATCH v4 5/10 staging: gdm72xx: Fixed some camelCase variables
In reply to Michalis PappasFixed some camelCase variables
--- drivers/staging/gdm72xx/gdm_qos.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-)
drivers/staging/gdm72xx/gdm_qos.c +15 -16
@@ -142,24 +142,24 @@ void gdm_qos_release_list(void *nic_ptr)free_qos_entry_list (&free_list); } -static u32 chk_ipv4_rule (struct gdm_wimax_csr_s *csr,u8 *Stream,u8 *port) +static u32 chk_ipv4_rule (struct gdm_wimax_csr_s *csr,u8 *stream,u8 *port) {int i;if (csr->classifier_rule_en&IPTYPEOFSERVICE ) { -if (((Stream[1 ] & csr->ip2s_mask) < csr->ip2s_lo) || - ((Stream[1 ] & csr->ip2s_mask) > csr->ip2s_hi)) +if (((stream[1 ] & csr->ip2s_mask) < csr->ip2s_lo) || + ((stream[1 ] & csr->ip2s_mask) > csr->ip2s_hi))return 1 ; }if (csr->classifier_rule_en&PROTOCOL ) { -if (Stream[9 ] != csr->protocol) +if (stream[9 ] != csr->protocol)return 1 ; }if (csr->classifier_rule_en&IPMASKEDSRCADDRESS ) {for (i =0 ; i <4 ; i++) { -if ((Stream[12 + i] & csr->ipsrc_addrmask[i]) != +if ((stream[12 + i] & csr->ipsrc_addrmask[i]) != (csr->ipsrc_addr[i] & csr->ipsrc_addrmask[i]))return 1 ; }
@@ -167,7 +167,7 @@ static u32 chk_ipv4_rule(struct gdm_wimax_csr_s *csr, u8 *Stream, u8 *port)if (csr->classifier_rule_en&IPMASKEDDSTADDRESS ) {for (i =0 ; i <4 ; i++) { -if ((Stream[16 + i] & csr->ipdst_addrmask[i]) != +if ((stream[16 + i] & csr->ipdst_addrmask[i]) != (csr->ipdst_addr[i] & csr->ipdst_addrmask[i]))return 1 ; }
@@ -190,16 +190,15 @@ static u32 chk_ipv4_rule(struct gdm_wimax_csr_s *csr, u8 *Stream, u8 *port)static u32 get_qos_index (struct nic *nic,u8 *iph,u8 *tcpudph) { -u32 IP_Ver, Header_Len, i; +u32 IP_ver, i;struct qos_cb_s *qcb = &nic->qos;if (iph ==NULL || tcpudph ==NULL )return -1 ; - IP_Ver = (iph[0 ]>>4 )&0xf ; - Header_Len = iph[0 ]&0xf ; + IP_ver = (iph[0 ]>>4 )&0xf ; -if (IP_Ver ==4 ) { +if (IP_ver ==4 ) {for (i =0 ; i <QOS_MAX ; i++) {if (qcb->csr[i].enabled) {if (qcb->csr[i].classifier_rule_en) {
@@ -336,16 +335,16 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) {struct nic *nic = nic_ptr;u32 i,SFID , index, pos; -u8 subCmdEvt; +u8 sub_cmd_evt;struct qos_cb_s *qcb = &nic->qos;struct qos_entry_s *entry, *n;struct list_head send_list;struct list_head free_list;unsigned long flags; - subCmdEvt = (u8 )buf[4 ]; + sub_cmd_evt = (u8 )buf[4 ]; -if (subCmdEvt ==QOS_REPORT ) { +if (sub_cmd_evt ==QOS_REPORT ) {spin_lock_irqsave (&qcb->qos_lock, flags);for (i =0 ; i < qcb->qos_list_cnt; i++) {SFID = ((buf[(i*5 )+6 ]<<24 )&0xff000000 );
@@ -367,7 +366,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size)return ; } -/* subCmdEvt == QOS_ADD || subCmdEvt == QOS_CHANG_DEL */ +/* sub_cmd_evt == QOS_ADD || sub_cmd_evt == QOS_CHANG_DEL */ pos =6 ;SFID = ((buf[pos++]<<24 )&0xff000000 );SFID += ((buf[pos++]<<16 )&0xff0000 );
@@ -382,7 +381,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size)return ; } -if (subCmdEvt ==QOS_ADD ) { +if (sub_cmd_evt ==QOS_ADD ) {netdev_dbg (nic->netdev,"QOS_ADD SFID = 0x%x, index=%d\n" ,SFID , index);
@@ -423,7 +422,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) qcb->qos_limit_size =254 /qcb->qos_list_cnt;spin_unlock_irqrestore (&qcb->qos_lock, flags); - }else if (subCmdEvt ==QOS_CHANGE_DEL ) { + }else if (sub_cmd_evt ==QOS_CHANGE_DEL ) {netdev_dbg (nic->netdev,"QOS_CHANGE_DEL SFID = 0x%x, index=%d\n" ,SFID , index);
Signature · 1 line
1.8.4
PATCH v4 6/10 staging: gdm72xx: Fixed some braces to conform with coding style
In reply to Michalis PappasFixed some braces to conform with coding style
--- drivers/staging/gdm72xx/gdm_wimax.c | 16 ++++++++-------- drivers/staging/gdm72xx/netlink_k.c | 7 ++++--- 2 files changed, 12 insertions(+), 11 deletions(-)
drivers/staging/gdm72xx/gdm_wimax.c +8 -8
@@ -263,9 +263,9 @@ static struct evt_entry *get_event_entry(void) {struct evt_entry *e; -if (list_empty (&wm_event.freeq)) +if (list_empty (&wm_event.freeq)) { e =alloc_event_entry (); -else { + }else { e = list_entry(wm_event.freeq.next, struct evt_entry, list);list_del (&e->list); }
@@ -379,9 +379,9 @@ static int gdm_wimax_tx(struct sk_buff *skb, struct net_device *dev) }#if !defined(LOOPBACK_TEST ) -if (!fsm) +if (!fsm) {netdev_err (dev,"ASSERTION ERROR: fsm is NULL!!\n" ); -else if (fsm->m_status !=M_CONNECTED ) { + }else if (fsm->m_status !=M_CONNECTED ) {netdev_emerg (dev,"ASSERTION ERROR: Device is NOT ready. status=%d\n" , fsm->m_status);kfree_skb (skb);
@@ -544,9 +544,9 @@ static void gdm_update_fsm(struct net_device *dev, struct fsm_s *new_fsm)if (cur_fsm->m_status != new_fsm->m_status || cur_fsm->c_status != new_fsm->c_status) { -if (new_fsm->m_status ==M_CONNECTED ) +if (new_fsm->m_status ==M_CONNECTED ) {netif_carrier_on (dev); -else if (cur_fsm->m_status ==M_CONNECTED ) { + }else if (cur_fsm->m_status ==M_CONNECTED ) {netif_carrier_off (dev);#if defined(CONFIG_WIMAX_GDM72XX_QOS )gdm_qos_release_list (nic);
@@ -855,9 +855,9 @@ static void prepare_rx_complete(void *arg, void *data, int len)int ret; ret =gdm_wimax_get_prepared_info (nic->netdev, data, len); -if (ret ==1 ) +if (ret ==1 ) {gdm_wimax_rcv_with_cb (nic, rx_complete, nic); -else { + }else {if (ret <0 )netdev_err (nic->netdev,"get_prepared_info failed(%d)\n" , ret);
drivers/staging/gdm72xx/netlink_k.c +4 -3
@@ -75,8 +75,9 @@ static void netlink_rcv_cb(struct sk_buff *skb)netdev_err (skb->dev,"dev_get_by_index(%d) is not found.\n" , ifindex); - }else + }else {netdev_err (skb->dev,"Unregistered Callback\n" ); + } } }
@@ -144,9 +145,9 @@ int netlink_send(struct sock *sock, int group, u16 type, void *msg, int len) ret =netlink_broadcast (sock, skb,0 , group+1 ,GFP_ATOMIC ); -if (!ret) +if (!ret) {return len; -else { + }else {if (ret != -ESRCH ) {pr_err ("netlink_broadcast g=%d, t=%d, l=%d, r=%d\n" , group, type, len, ret);
Signature · 1 line
1.8.4
PATCH v4 7/10 staging: gdm72xx: Removed commented-out code
In reply to Michalis PappasRemoved commented-out code
--- drivers/staging/gdm72xx/gdm_qos.h | 17 ----------------- drivers/staging/gdm72xx/gdm_wimax.c | 4 ---- drivers/staging/gdm72xx/gdm_wimax.h | 6 ------ drivers/staging/gdm72xx/usb_boot.c | 17 +---------------- 4 files changed, 1 insertion(+), 43 deletions(-)
drivers/staging/gdm72xx/gdm_qos.h +0 -17
@@ -34,23 +34,6 @@#define IEEE802_1QVLANID 0x10struct gdm_wimax_csr_s { -/* union{ -U16 all; -struct _CS_CLASSIFIER_RULE_ENABLE{ -IPTypeOfService:1, -Protocol:1, -IPMaskedSrcAddress:1, -IPMaskedDstAddress:1, -ProtocolSrcPortRange:1, -ProtocolDstPortRange:1, -DstMacAddr:1, -SrcMacAddr:1, -Ethertype:1, -IEEE802_1DUserPriority:1, -IEEE802_1QVLANID:1, -Reserved:5; -} fields; -} */ BOOLEAN enabled;u32 SFID;u8 qos_buf_count;
drivers/staging/gdm72xx/gdm_wimax.c +0 -4
@@ -862,10 +862,6 @@ static void prepare_rx_complete(void *arg, void *data, int len)netdev_err (nic->netdev,"get_prepared_info failed(%d)\n" , ret);gdm_wimax_rcv_with_cb (nic, prepare_rx_complete, nic); -#if 0 -/* Re-prepare WiMax device */ -gdm_wimax_prepare_device (nic->netdev); -#endif } }
drivers/staging/gdm72xx/gdm_wimax.h +0 -6
@@ -23,10 +23,6 @@#define DRIVER_VERSION "3.2.3" -/*#define ETH_P_IP 0x0800 */ -/*#define ETH_P_ARP 0x0806 */ -/*#define ETH_P_IPV6 0x86DD */ -#define H2L (x) __cpu_to_le16(x)#define L2H (x) __le16_to_cpu(x)#define DH2L (x) __cpu_to_le32(x)
@@ -62,8 +58,6 @@ struct nic { }; -/*#define LOOPBACK_TEST */ -int register_wimax_device (struct phy_dev *phy_dev,struct device *pdev);int gdm_wimax_send_tx (struct sk_buff *skb,struct net_device *dev);void unregister_wimax_device (struct phy_dev *phy_dev);
drivers/staging/gdm72xx/usb_boot.c +1 -16
@@ -169,14 +169,7 @@ int usb_boot(struct usb_device *usbdev, u16 pid)memcpy (&hdr, firm->data,sizeof (hdr));array_le32_to_cpu ((u32 *)&hdr,19 ); -#if 0 -if (hdr.magic_code !=0x10767fff ) { -dev_err (&usbdev->dev,"Invalid magic code 0x%08x\n" , - hdr.magic_code); - ret = -EINVAL ; - goto out; - } -#endif +if (hdr.count >MAX_IMG_CNT ) {dev_err (&usbdev->dev,"Too many images. %d\n" , hdr.count); ret = -EINVAL ;
@@ -201,14 +194,6 @@ int usb_boot(struct usb_device *usbdev, u16 pid)memcpy (&fw_info, firm->data + pos,sizeof (fw_info));array_le32_to_cpu ((u32 *)&fw_info,8 ); -#if 0 -if ((fw_info.id &0xfffff000 ) !=0x10767000 ) { -dev_err (&usbdev->dev,"Invalid FW id. 0x%08x\n" , - fw_info.id); - ret = -EIO ; - goto out; - } -#endif if ((fw_info.id &0xffff ) != pid)continue ;
Signature · 1 line
1.8.4
PATCH v4 8/10 staging: gdm72xx: Whitespace fixes to conform to coding standards
In reply to Michalis PappasWhitespace fixes to conform to coding standards
--- drivers/staging/gdm72xx/gdm_qos.c | 72 ++++++++++++++++++------------------- drivers/staging/gdm72xx/gdm_sdio.c | 15 ++++---- drivers/staging/gdm72xx/gdm_usb.c | 43 ++++++++-------------- drivers/staging/gdm72xx/gdm_wimax.c | 61 +++++++++++++++---------------- drivers/staging/gdm72xx/gdm_wimax.h | 6 ++-- drivers/staging/gdm72xx/netlink_k.c | 5 ++- drivers/staging/gdm72xx/netlink_k.h | 4 +-- drivers/staging/gdm72xx/usb_boot.c | 18 +++++----- 8 files changed, 101 insertions(+), 123 deletions(-)
drivers/staging/gdm72xx/gdm_qos.c +34 -38
@@ -47,8 +47,7 @@ static void *alloc_qos_entry(void)spin_lock_irqsave (&qos_free_list.lock, flags);if (qos_free_list.cnt) { - entry = list_entry(qos_free_list.head.prev, struct qos_entry_s, - list); + entry = list_entry(qos_free_list.head.prev, struct qos_entry_s, list);list_del (&entry->list); qos_free_list.cnt--;spin_unlock_irqrestore (&qos_free_list.lock, flags);
@@ -62,7 +61,7 @@ static void *alloc_qos_entry(void)static void free_qos_entry (void *entry) { -struct qos_entry_s *qentry = (struct qos_entry_s *) entry; +struct qos_entry_s *qentry = (struct qos_entry_s *)entry;unsigned long flags;spin_lock_irqsave (&qos_free_list.lock, flags);
@@ -148,7 +147,7 @@ static u32 chk_ipv4_rule(struct gdm_wimax_csr_s *csr, u8 *stream, u8 *port)if (csr->classifier_rule_en&IPTYPEOFSERVICE ) {if (((stream[1 ] & csr->ip2s_mask) < csr->ip2s_lo) || - ((stream[1 ] & csr->ip2s_mask) > csr->ip2s_hi)) + ((stream[1 ] & csr->ip2s_mask) > csr->ip2s_hi))return 1 ; }
@@ -190,7 +189,7 @@ static u32 chk_ipv4_rule(struct gdm_wimax_csr_s *csr, u8 *stream, u8 *port)static u32 get_qos_index (struct nic *nic,u8 *iph,u8 *tcpudph) { -u32 IP_ver, i; +u32 IP_ver, i;struct qos_cb_s *qcb = &nic->qos;if (iph ==NULL || tcpudph ==NULL )
@@ -198,16 +197,16 @@ static u32 get_qos_index(struct nic *nic, u8 *iph, u8 *tcpudph) IP_ver = (iph[0 ]>>4 )&0xf ; -if (IP_ver ==4 ) { -for (i =0 ; i <QOS_MAX ; i++) { -if (qcb->csr[i].enabled) { -if (qcb->csr[i].classifier_rule_en) { -if (chk_ipv4_rule (&qcb->csr[i], iph, - tcpudph) ==0 ) -return i; - } - } - } +if (IP_ver !=4 ) +return -1 ; + +for (i =0 ; i <QOS_MAX ; i++) { +if (!qcb->csr[i].enabled) +continue ; +if (!qcb->csr[i].classifier_rule_en) +continue ; +if (chk_ipv4_rule (&qcb->csr[i], iph, tcpudph) ==0 ) +return i; }return -1 ;
@@ -222,22 +221,20 @@ static u32 extract_qos_list(struct nic *nic, struct list_head *head)INIT_LIST_HEAD (head);for (i =0 ; i <QOS_MAX ; i++) { -if (qcb->csr[i].enabled) { -if (qcb->csr[i].qos_buf_count < qcb->qos_limit_size) { -if (!list_empty (&qcb->qos_list[i])) { - entry =list_entry ( - qcb->qos_list[i].prev, - struct qos_entry_s, list); -list_move_tail (&entry->list, head); - qcb->csr[i].qos_buf_count++; - -if (!list_empty (&qcb->qos_list[i])) -netdev_warn (nic->netdev, -"Index(%d) is piled!!\n" , - i); - } - } - } +if (!qcb->csr[i].enabled) +continue ; +if (qcb->csr[i].qos_buf_count >= qcb->qos_limit_size) +continue ; +if (list_empty (&qcb->qos_list[i])) +continue ; + + entry = list_entry(qcb->qos_list[i].prev, struct qos_entry_s, list); + +list_move_tail (&entry->list, head); + qcb->csr[i].qos_buf_count++; + +if (!list_empty (&qcb->qos_list[i])) +netdev_warn (nic->netdev,"Index(%d) is piled!!\n" , i); }return 0 ;
@@ -260,14 +257,14 @@ int gdm_qos_send_hci_pkt(struct sk_buff *skb, struct net_device *dev)int index;struct qos_cb_s *qcb = &nic->qos;unsigned long flags; -struct ethhdr *ethh = (struct ethhdr *) (skb->data +HCI_HEADER_SIZE ); -struct iphdr *iph = (struct iphdr *) ((char *) ethh +ETH_HLEN ); +struct ethhdr *ethh = (struct ethhdr *)(skb->data +HCI_HEADER_SIZE ); +struct iphdr *iph = (struct iphdr *)((char *)ethh +ETH_HLEN );struct tcphdr *tcph;struct qos_entry_s *entry =NULL ;struct list_head send_list;int ret =0 ; - tcph = (struct tcphdr *) iph + iph->ihl*4 ; + tcph = (struct tcphdr *)iph + iph->ihl*4 ;if (B2H (ethh->h_proto) ==ETH_P_IP ) {if (qcb->qos_list_cnt && !qos_free_list.cnt) {
@@ -280,7 +277,7 @@ int gdm_qos_send_hci_pkt(struct sk_buff *skb, struct net_device *dev)spin_lock_irqsave (&qcb->qos_lock, flags);if (qcb->qos_list_cnt) { - index =get_qos_index (nic, (u8 *)iph, (u8 *) tcph); + index =get_qos_index (nic, (u8 *)iph, (u8 *)tcph);if (index ==-1 ) index = qcb->qos_null_idx;
@@ -376,7 +373,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) index =get_csr (qcb,SFID ,1 );if (index ==-1 ) {netdev_err (nic->netdev, -"QoS ERROR: csr Update Error / Wrong index (%d) \n" , +"QoS ERROR: csr Update Error / Wrong index (%d)\n" , index);return ; }
@@ -433,8 +430,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) qcb->qos_list_cnt--; qcb->qos_limit_size =254 /qcb->qos_list_cnt; -list_for_each_entry_safe (entry, n, &qcb->qos_list[index], - list) { +list_for_each_entry_safe (entry, n, &qcb->qos_list[index], list) {list_move_tail (&entry->list, &free_list); }spin_unlock_irqrestore (&qcb->qos_lock, flags);
drivers/staging/gdm72xx/gdm_sdio.c +7 -8
@@ -312,8 +312,7 @@ static void send_sdu(struct sdio_func *func, struct tx_cxt *tx)spin_unlock_irqrestore (&tx->lock, flags); } -static void send_hci (struct sdio_func *func,struct tx_cxt *tx, -struct sdio_tx *t) +static void send_hci (struct sdio_func *func,struct tx_cxt *tx,struct sdio_tx *t) {unsigned long flags;
@@ -380,7 +379,7 @@ static void do_tx(struct work_struct *work) }static int gdm_sdio_send (void *priv_dev,void *data,int len, -void (*cb)(void *data),void *cb_data) +void (*cb)(void *data),void *cb_data) {struct sdiowm_dev *sdev = priv_dev;struct tx_cxt *tx = &sdev->tx;
@@ -510,6 +509,7 @@ static void gdm_sdio_irq(struct sdio_func *func)if (hdr[3 ] ==1 ) {/* Ack */ u32 *ack_seq = (u32 *)&hdr[4 ]; +spin_lock_irqsave (&tx->lock, flags); tx->can_send =1 ;
@@ -521,7 +521,7 @@ static void gdm_sdio_irq(struct sdio_func *func) }memcpy (rx->rx_buf, hdr +TYPE_A_HEADER_SIZE , -TYPE_A_LOOKAHEAD_SIZE -TYPE_A_HEADER_SIZE ); +TYPE_A_LOOKAHEAD_SIZE -TYPE_A_HEADER_SIZE ); buf = rx->rx_buf +TYPE_A_LOOKAHEAD_SIZE -TYPE_A_HEADER_SIZE ; remain = len -TYPE_A_LOOKAHEAD_SIZE +TYPE_A_HEADER_SIZE ;
@@ -577,8 +577,8 @@ done: }static int gdm_sdio_receive (void *priv_dev, -void (*cb)(void *cb_data,void *data,int len), -void *cb_data) +void (*cb)(void *cb_data,void *data,int len), +void *cb_data) {struct sdiowm_dev *sdev = priv_dev;struct rx_cxt *rx = &sdev->rx;
@@ -601,8 +601,7 @@ static int gdm_sdio_receive(void *priv_dev,return 0 ; } -static int sdio_wimax_probe (struct sdio_func *func, -const struct sdio_device_id *id) +static int sdio_wimax_probe (struct sdio_func *func,const struct sdio_device_id *id) {int ret;struct phy_dev *phy_dev =NULL ;
drivers/staging/gdm72xx/gdm_usb.c +15 -28
91 lines not on this page · raw message
drivers/staging/gdm72xx/gdm_wimax.c +29 -32
190 lines not on this page · raw message
drivers/staging/gdm72xx/gdm_wimax.h +3 -3
@@ -38,10 +38,10 @@ struct phy_dev {struct net_device *netdev;int (*send_func)(void *priv_dev,void *data,int len, -void (*cb)(void *cb_data),void *cb_data); +void (*cb)(void *cb_data),void *cb_data);int (*rcv_func)(void *priv_dev, -void (*cb)(void *cb_data,void *data,int len), -void *cb_data); +void (*cb)(void *cb_data,void *data,int len), +void *cb_data); };struct nic {
drivers/staging/gdm72xx/netlink_k.c +2 -3
@@ -55,8 +55,7 @@ static void netlink_rcv_cb(struct sk_buff *skb)if (skb->len >=NLMSG_HDRLEN ) { nlh = (struct nlmsghdr *)skb->data; -if (skb->len < nlh->nlmsg_len || - nlh->nlmsg_len >ND_MAX_MSG_LEN ) { +if (skb->len < nlh->nlmsg_len || nlh->nlmsg_len >ND_MAX_MSG_LEN ) {netdev_err (skb->dev,"Invalid length (%d,%d)\n" , skb->len, nlh->nlmsg_len);return ;
@@ -89,7 +88,7 @@ static void netlink_rcv(struct sk_buff *skb) }struct sock *netlink_init (int unit,void (*cb)(struct net_device *dev,u16 type, -void *msg,int len)) +void *msg,int len)) {struct sock *sock;struct netlink_kernel_cfg cfg = {
drivers/staging/gdm72xx/netlink_k.h +2 -2
@@ -16,8 +16,8 @@#include <linux/netdevice.h> #include <net/sock.h> -struct sock *netlink_init (int unit, -void (*cb)(struct net_device *dev,u16 type,void *msg,int len)); +struct sock *netlink_init (int unit,void (*cb)(struct net_device *dev,u16 type, +void *msg,int len));void netlink_exit (struct sock *sock);int netlink_send (struct sock *sock,int group,u16 type,void *msg,int len);
drivers/staging/gdm72xx/usb_boot.c +9 -9
@@ -67,6 +67,7 @@ struct fw_info {static void array_le32_to_cpu (u32 *arr,int num) {int i; +for (i =0 ; i < num; i++, arr++) *arr =__le32_to_cpu (*arr); }
@@ -79,7 +80,7 @@ static int gdm_wibro_send(struct usb_device *usbdev, void *data, int len)int actual; ret =usb_bulk_msg (usbdev,usb_sndbulkpipe (usbdev,1 ), data, len, - &actual,1000 ); + &actual,1000 );if (ret <0 ) { dev_err(&usbdev->dev, "Error : usb_bulk_msg ( result = %d )\n",
@@ -95,7 +96,7 @@ static int gdm_wibro_recv(struct usb_device *usbdev, void *data, int len)int actual; ret =usb_bulk_msg (usbdev,usb_rcvbulkpipe (usbdev,2 ), data, len, - &actual,5000 ); + &actual,5000 );if (ret <0 ) { dev_err(&usbdev->dev,
@@ -105,9 +106,8 @@ static int gdm_wibro_recv(struct usb_device *usbdev, void *data, int len)return 0 ; } -static int download_image (struct usb_device *usbdev, -const struct firmware *firm, -loff_t pos,u32 img_len,u32 magic_num) +static int download_image (struct usb_device *usbdev,const struct firmware *firm, +loff_t pos,u32 img_len,u32 magic_num) {struct dn_header h;int ret =0 ;
@@ -204,8 +204,8 @@ int usb_boot(struct usb_device *usbdev, u16 pid) goto out; } - ret =download_image (usbdev, firm, pos, - fw_info.kernel_len,DN_KERNEL_MAGIC_NUMBER ); + ret =download_image (usbdev, firm, pos, fw_info.kernel_len, +DN_KERNEL_MAGIC_NUMBER );if (ret <0 ) goto out;dev_info (&usbdev->dev,"GCT: Kernel download success.\n" );
@@ -216,7 +216,7 @@ int usb_boot(struct usb_device *usbdev, u16 pid) goto out; } ret =download_image (usbdev, firm, pos, fw_info.rootfs_len, -DN_ROOTFS_MAGIC_NUMBER ); +DN_ROOTFS_MAGIC_NUMBER );if (ret <0 ) goto out;dev_info (&usbdev->dev,"GCT: Filesystem download success.\n" );
@@ -261,7 +261,7 @@ out: }static int em_download_image (struct usb_device *usbdev,const char *img_name, -char *type_string) +char *type_string) {char *buf =NULL ;loff_t pos =0 ;
Signature · 1 line
1.8.4
PATCH v4 9/10 staging: gdm72xx: Indentation and other whitespace fixes.
In reply to Michalis PappasIndentation and other whitespace fixes.
--- drivers/staging/gdm72xx/gdm_qos.c | 2 +- drivers/staging/gdm72xx/gdm_sdio.c | 14 +++--- drivers/staging/gdm72xx/gdm_sdio.h | 29 +++++-------- drivers/staging/gdm72xx/gdm_usb.c | 17 ++++---- drivers/staging/gdm72xx/gdm_usb.h | 11 +---- drivers/staging/gdm72xx/gdm_wimax.c | 21 +++++---- drivers/staging/gdm72xx/gdm_wimax.h | 21 ++++----- drivers/staging/gdm72xx/hci.h | 87 +++++++++++++++++-------------------- drivers/staging/gdm72xx/usb_ids.h | 2 +- drivers/staging/gdm72xx/wm_ioctl.h | 22 +++++----- 10 files changed, 97 insertions(+), 129 deletions(-)
drivers/staging/gdm72xx/gdm_qos.c +1 -1
@@ -24,7 +24,7 @@#include "hci.h" #include "gdm_qos.h" -#define B2H (x) __be16_to_cpu(x) +#define B2H (x) __be16_to_cpu(x)#define MAX_FREE_LIST_CNT 32 static struct {
drivers/staging/gdm72xx/gdm_sdio.c +7 -7
@@ -31,11 +31,11 @@#define MAX_NR_RX_BUF 4#define SDU_TX_BUF_SIZE 2048 -#define TX_BUF_SIZE 2048 +#define TX_BUF_SIZE 2048#define TX_CHUNK_SIZE (2048 - TYPE_A_HEADER_SIZE) -#define RX_BUF_SIZE (25*1024) +#define RX_BUF_SIZE (25*1024) -#define TX_HZ 2000 +#define TX_HZ 2000#define TX_INTERVAL (1000000/TX_HZ)static int init_sdio (struct sdiowm_dev *sdev);
@@ -127,10 +127,10 @@ static void put_rx_struct(struct rx_cxt *rx, struct sdio_rx *r)static int init_sdio (struct sdiowm_dev *sdev) {int ret =0 , i; -struct tx_cxt *tx = &sdev->tx; -struct rx_cxt *rx = &sdev->rx; -struct sdio_tx *t; -struct sdio_rx *r; +struct tx_cxt *tx = &sdev->tx; +struct rx_cxt *rx = &sdev->rx; +struct sdio_tx *t; +struct sdio_rx *r;INIT_LIST_HEAD (&tx->free_list);INIT_LIST_HEAD (&tx->sdu_list);
drivers/staging/gdm72xx/gdm_sdio.h +10 -19
@@ -22,10 +22,8 @@struct sdio_tx {struct list_head list;struct tx_cxt *tx_cxt; - -u8 *buf; -int len; - +u8 *buf; +int len;void (*callback)(void *cb_data);void *cb_data; };
@@ -35,18 +33,15 @@ struct tx_cxt {struct list_head sdu_list;struct list_head hci_list;struct timeval sdu_stamp; - -u8 *sdu_buf; - -spinlock_t lock; -int can_send; -int stop_sdu_tx; +u8 *sdu_buf; +spinlock_t lock; +int can_send; +int stop_sdu_tx; };struct sdio_rx {struct list_head list;struct rx_cxt *rx_cxt; -void (*callback)(void *cb_data,void *data,int len);void *cb_data; };
@@ -54,18 +49,14 @@ struct sdio_rx {struct rx_cxt {struct list_head free_list;struct list_head req_list; - -u8 *rx_buf; - -spinlock_t lock; +u8 *rx_buf; +spinlock_t lock; };struct sdiowm_dev {struct sdio_func *func; - -struct tx_cxt tx; -struct rx_cxt rx; - +struct tx_cxt tx; +struct rx_cxt rx;struct work_struct ws; };
drivers/staging/gdm72xx/gdm_usb.c +9 -8
@@ -27,6 +27,7 @@MODULE_DEVICE_TABLE (usb, id_table);#define TX_BUF_SIZE 2048 +#if defined(CONFIG_WIMAX_GDM72XX_WIMAX2 )#define RX_BUF_SIZE (128*1024)/* For packet aggregation */ #else
@@ -166,10 +167,10 @@ static void put_rx_struct(struct rx_cxt *rx, struct usb_rx *r)static int init_usb (struct usbwm_dev *udev) {int ret =0 , i; -struct tx_cxt *tx = &udev->tx; -struct rx_cxt *rx = &udev->rx; -struct usb_tx *t; -struct usb_rx *r; +struct tx_cxt *tx = &udev->tx; +struct rx_cxt *rx = &udev->rx; +struct usb_tx *t; +struct usb_rx *r;unsigned long flags;INIT_LIST_HEAD (&tx->free_list);
@@ -215,10 +216,10 @@ fail:static void release_usb (struct usbwm_dev *udev) { -struct tx_cxt *tx = &udev->tx; -struct rx_cxt *rx = &udev->rx; -struct usb_tx *t, *t_next; -struct usb_rx *r, *r_next; +struct tx_cxt *tx = &udev->tx; +struct rx_cxt *rx = &udev->rx; +struct usb_tx *t, *t_next; +struct usb_rx *r, *r_next;unsigned long flags;spin_lock_irqsave (&tx->lock, flags);
drivers/staging/gdm72xx/gdm_usb.h +2 -9
@@ -28,12 +28,10 @@ struct usb_tx {struct list_head p_list;#endif struct tx_cxt *tx_cxt; -struct urb *urb;u8 *buf; -void (*callback)(void *cb_data); -void *cb_data; +void *cb_data; };struct tx_cxt {
@@ -43,17 +41,14 @@ struct tx_cxt {#if defined(CONFIG_WIMAX_GDM72XX_USB_PM ) || defined(CONFIG_WIMAX_GDM72XX_K_MODE )struct list_head pending_list;#endif -spinlock_t lock; };struct usb_rx {struct list_head list;struct rx_cxt *rx_cxt; -struct urb *urb;u8 *buf; -void (*callback)(void *cb_data,void *data,int len);void *cb_data; };
@@ -75,11 +70,9 @@ struct usbwm_dev {int bw_switch;struct list_head list;#endif -struct tx_cxt tx;struct rx_cxt rx; - - int padding; + int padding; };#endif /* __GDM_USB_H__ */
drivers/staging/gdm72xx/gdm_wimax.c +10 -11
@@ -35,10 +35,10 @@#define EVT_MAX_SIZE 2048struct evt_entry { -struct list_head list; -struct net_device *dev; -char evt_data[EVT_MAX_SIZE ]; -int size; +struct list_head list; +struct net_device *dev; +char evt_data[EVT_MAX_SIZE ]; +int size; };static void __gdm_wimax_event_send (struct work_struct *work);
@@ -52,7 +52,6 @@ static struct {struct sock *sock;struct list_head evtq;spinlock_t evt_lock; -struct list_head freeq;struct work_struct ws; } wm_event;
@@ -868,13 +867,13 @@ static void start_rx_proc(struct nic *nic) }static struct net_device_ops gdm_netdev_ops = { - .ndo_open = gdm_wimax_open, - .ndo_stop = gdm_wimax_close, - .ndo_set_config = gdm_wimax_set_config, - .ndo_start_xmit = gdm_wimax_tx, - .ndo_get_stats = gdm_wimax_stats, + .ndo_open = gdm_wimax_open, + .ndo_stop = gdm_wimax_close, + .ndo_set_config = gdm_wimax_set_config, + .ndo_start_xmit = gdm_wimax_tx, + .ndo_get_stats = gdm_wimax_stats, .ndo_set_mac_address = gdm_wimax_set_mac_addr, - .ndo_do_ioctl = gdm_wimax_ioctl, + .ndo_do_ioctl = gdm_wimax_ioctl, };int register_wimax_device (struct phy_dev *phy_dev,struct device *pdev)
drivers/staging/gdm72xx/gdm_wimax.h +8 -13
@@ -34,28 +34,23 @@#define DB2H (x) __be32_to_cpu(x)struct phy_dev { -void *priv_dev; +void *priv_dev;struct net_device *netdev; - -int (*send_func)(void *priv_dev,void *data,int len, -void (*cb)(void *cb_data),void *cb_data); -int (*rcv_func)(void *priv_dev, -void (*cb)(void *cb_data,void *data,int len), -void *cb_data); +int (*send_func)(void *priv_dev,void *data,int len, +void (*cb)(void *cb_data),void *cb_data); +int (*rcv_func)(void *priv_dev, +void (*cb)(void *cb_data,void *data,int len), +void *cb_data); };struct nic {struct net_device *netdev;struct phy_dev *phy_dev; -struct net_device_stats stats; - -struct data_s sdk_data[SIOC_DATA_MAX ]; - +struct data_s sdk_data[SIOC_DATA_MAX ];#if defined(CONFIG_WIMAX_GDM72XX_QOS ) -struct qos_cb_s qos; +struct qos_cb_s qos;#endif - };int register_wimax_device (struct phy_dev *phy_dev,struct device *pdev);
drivers/staging/gdm72xx/hci.h +39 -48
165 lines not on this page · raw message
drivers/staging/gdm72xx/usb_ids.h +1 -1
@@ -29,7 +29,7 @@ .idVendor = (vend), .idProduct = (prod), .bInterfaceClass = (intf)#define EMERGENCY_PID 0x720f -#define BL_PID_MASK 0xffc0 +#define BL_PID_MASK 0xffc0#define USB_DEVICE_BOOTLOADER (vid, pid) \ {USB_DEVICE((vid), ((pid)&BL_PID_MASK)|B_DOWNLOAD)}, \
drivers/staging/gdm72xx/wm_ioctl.h +10 -12
@@ -19,10 +19,10 @@#define NETLINK_WIMAX 31 -#define SIOCWMIOCTL SIOCDEVPRIVATE +#define SIOCWMIOCTL SIOCDEVPRIVATE -#define SIOCG_DATA 0x8D10 -#define SIOCS_DATA 0x8D11 +#define SIOCG_DATA 0x8D10 +#define SIOCS_DATA 0x8D11enum {SIOC_DATA_FSM ,
@@ -34,7 +34,7 @@ enum {SIOC_DATA_END }; -#define SIOC_DATA_MAX 16 +#define SIOC_DATA_MAX 16/* FSM */ enum {
@@ -67,23 +67,21 @@ enum { };struct fsm_s { -int m_status;/*main status*/ -int c_status;/*connection status*/ -int d_status;/*oma-dm status*/ +int m_status;/*main status*/ +int c_status;/*connection status*/ +int d_status;/*oma-dm status*/ };struct data_s { -int size; +int size;void *buf; };struct wm_req_s {union { -char ifrn_name[IFNAMSIZ ]; +char ifrn_name[IFNAMSIZ ]; } ifr_ifrn; -unsigned short cmd; -unsigned short data_id;struct data_s data;
@@ -91,7 +89,7 @@ struct wm_req_s { };#ifndef ifr_name -#define ifr_name ifr_ifrn.ifrn_name +#define ifr_name ifr_ifrn.ifrn_name#endif #endif
Signature · 1 line
1.8.4
PATCH v4 10/10 staging: gdm72xx: Removed task from TODO list
In reply to Michalis PappasRemoved line related to replacement of kernel_thread with kthread, as issue was fixed on ff5e4a1d2702 ('Staging: gdm72xx: gdm_usb:
fix deprecated function kernel_thread')
--- drivers/staging/gdm72xx/TODO | 1 - 1 file changed, 1 deletion(-)
drivers/staging/gdm72xx/TODO +0 -1
@@ -1,3 +1,2 @@ TODO: -- Replace kernel_thread with kthread in gdm_usb.c - Clean up coding style to meet kernel standard.
Signature · 1 line
1.8.4
v5 cover staging: gdm72xx: Code cleanup
In reply to Michalis PappasQuoted 48 lines · Michalis Pappas
Ok, I generated a new patchset based on running checkpatch.pl with the --strict option, as well as any recommendations made earlier on this thread.
From the following patches, both 8/10 and 9/10 involve whitespace fixes:
the former fixes issues reported by checkpatch.pl while the latter is mostly indentation stuff found by inspecting the code, stray tabs etc. I am sending them as separate patches in case one wants to keep only one of them.After applying the patches, the following issues are still reported by checkpatch.pl. My comments follow:
ERROR: Macros with complex values should be enclosed in parenthesis #34: FILE: usb_ids.h:34:
(quoted diff) +3
-0+#define USB_DEVICE_BOOTLOADER(vid, pid) \ + {USB_DEVICE((vid), ((pid)&BL_PID_MASK)|B_DOWNLOAD)}, \ + {USB_DEVICE((vid), ((pid)&BL_PID_MASK)|B_DOWNLOAD|B_DIFF_DL_DRV)}We agreed on that one already.
WARNING:LONG_LINE: line over 80 characters
This comes out in cases where I slightly bent the 80 chars rule to improve readability. Should anyone complain that it doesn't fit their terminal I promise I'll revert it back ;)
WARNING: unchecked sscanf return value
#295: FILE: gdm_wimax.c:295:(quoted diff) +1
-0+ sscanf(e->dev->name, "wm%d", &idx);From my understanding this should be ok. The value stored in e->dev>name is generated by
__dev_alloc_namewhich does all the necessary checks for user supplied input etc, so it should be considered as a trusted value.WARNING:SPACING: Missing a blank line after declarations
This is a false positive, as it refers to pointer-to-function declarations withing structures.
CHECK:BRACES: Blank lines aren't necessary after an open brace '{'
I found it to be more readable the way it was, so I didn't touch it.
CHECK:UNCOMMENTED_DEFINITION:
spinlock_tdefinition without commentI am not sure what the locks are used for so I am unable to write a comment on these.
Quoted 8 lines
Regards,
-Michalis
_______________________________________________
devel mailing list
[email protected]
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Updates from v4:
* Fixed message subjects
* Improved commit messages
* Added forgotten signed-of-by's
Thanks,
-Michalis
PATCH v5 1/10 staging: gdm72xx: Remove unnecessary extern declarations from header files
Fixes the following checkpatch.pl issue:
CHECK: extern prototypes should be avoided in .h files
--- drivers/staging/gdm72xx/gdm_wimax.h | 6 +++--- drivers/staging/gdm72xx/sdio_boot.h | 2 +- drivers/staging/gdm72xx/usb_boot.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/gdm72xx/gdm_wimax.h +3 -3
@@ -64,8 +64,8 @@ struct nic {/*#define LOOPBACK_TEST */ -extern int register_wimax_device (struct phy_dev *phy_dev,struct device *pdev); -extern int gdm_wimax_send_tx (struct sk_buff *skb,struct net_device *dev); -extern void unregister_wimax_device (struct phy_dev *phy_dev); +int register_wimax_device (struct phy_dev *phy_dev,struct device *pdev); +int gdm_wimax_send_tx (struct sk_buff *skb,struct net_device *dev); +void unregister_wimax_device (struct phy_dev *phy_dev);#endif
drivers/staging/gdm72xx/sdio_boot.h +1 -1
@@ -16,6 +16,6 @@struct sdio_func ; -extern int sdio_boot (struct sdio_func *func); +int sdio_boot (struct sdio_func *func);#endif /* __SDIO_BOOT_H__ */
drivers/staging/gdm72xx/usb_boot.h +2 -2
@@ -16,7 +16,7 @@struct usb_device ; -extern int usb_boot (struct usb_device *usbdev,u16 pid); -extern int usb_emergency (struct usb_device *usbdev); +int usb_boot (struct usb_device *usbdev,u16 pid); +int usb_emergency (struct usb_device *usbdev);#endif /* __USB_BOOT_H__ */
Signature · 1 line
1.8.4
PATCH v5 2/10 staging: gdm72xx: Replace comparisons on jiffies values with wrap-safe functions
In reply to Michalis PappasFixes the following checkpatch.pl issue:
WARNING: Comparing jiffies is almost always wrong; prefer time_after, time_before and friends
--- drivers/staging/gdm72xx/gdm_usb.c | 2 +- drivers/staging/gdm72xx/sdio_boot.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/gdm72xx/gdm_usb.c +1 -1
@@ -730,7 +730,7 @@ static int k_mode_thread(void *arg)spin_unlock_irqrestore (&k_lock, flags2); expire = jiffies +K_WAIT_TIME ; -while (jiffies < expire) +while (time_before (jiffies, expire))schedule_timeout (K_WAIT_TIME );spin_lock_irqsave (&rx->lock, flags);
drivers/staging/gdm72xx/sdio_boot.c +2 -2
@@ -41,11 +41,11 @@ static u8 *tx_buf;static int ack_ready (struct sdio_func *func) { -unsigned long start = jiffies; +unsigned long wait = jiffies +HZ ;u8 val;int ret; -while ((jiffies - start) <HZ ) { +while (time_before (jiffies, wait)) { val =sdio_readb (func,0x13 , &ret);if (val &0x01 )return 1 ;
Signature · 1 line
1.8.4
PATCH v5 3/10 staging: gdm72xx: Modify a struct allocation to match coding standards
In reply to Michalis PappasFixes the following checkpatch.pl issue:
CHECK: Prefer kmalloc(sizeof(*entry)...) over kmalloc(sizeof(struct qos_entry_s)...)
--- drivers/staging/gdm72xx/gdm_qos.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/gdm72xx/gdm_qos.c +1 -1
@@ -56,7 +56,7 @@ static void *alloc_qos_entry(void) }spin_unlock_irqrestore (&qos_free_list.lock, flags); - entry =kmalloc (sizeof (struct qos_entry_s ),GFP_ATOMIC ); + entry =kmalloc (sizeof (*entry),GFP_ATOMIC );return entry; }
Signature · 1 line
1.8.4
PATCH v5 4/10 staging: gdm72xx: Move logical continuation to previous line to conform to coding style
In reply to Michalis PappasFixes the following checkpatch.pl issue:
CHECK: Logical continuations should be on the previous line
--- drivers/staging/gdm72xx/gdm_usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/gdm72xx/gdm_usb.c +2 -2
@@ -518,8 +518,8 @@ static void do_pm_control(struct work_struct *work)usb_autopm_put_interface (udev->intf);spin_lock_irqsave (&tx->lock, flags); -if (!(udev->usbdev->state &USB_STATE_SUSPENDED ) - && (!list_empty (&tx->hci_list) || !list_empty (&tx->sdu_list))) { +if (!(udev->usbdev->state &USB_STATE_SUSPENDED ) && + (!list_empty (&tx->hci_list) || !list_empty (&tx->sdu_list))) {struct usb_tx *t, *temp;list_for_each_entry_safe (t, temp, &tx->pending_list, p_list) {
Signature · 1 line
1.8.4
PATCH v5 5/10 staging: gdm72xx: Fix some camel-case variables
In reply to Michalis PappasFixes the following checkpatch.pl issue:
CHECK: Avoid CamelCase:
--- drivers/staging/gdm72xx/gdm_qos.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-)
drivers/staging/gdm72xx/gdm_qos.c +15 -16
@@ -142,24 +142,24 @@ void gdm_qos_release_list(void *nic_ptr)free_qos_entry_list (&free_list); } -static u32 chk_ipv4_rule (struct gdm_wimax_csr_s *csr,u8 *Stream,u8 *port) +static u32 chk_ipv4_rule (struct gdm_wimax_csr_s *csr,u8 *stream,u8 *port) {int i;if (csr->classifier_rule_en&IPTYPEOFSERVICE ) { -if (((Stream[1 ] & csr->ip2s_mask) < csr->ip2s_lo) || - ((Stream[1 ] & csr->ip2s_mask) > csr->ip2s_hi)) +if (((stream[1 ] & csr->ip2s_mask) < csr->ip2s_lo) || + ((stream[1 ] & csr->ip2s_mask) > csr->ip2s_hi))return 1 ; }if (csr->classifier_rule_en&PROTOCOL ) { -if (Stream[9 ] != csr->protocol) +if (stream[9 ] != csr->protocol)return 1 ; }if (csr->classifier_rule_en&IPMASKEDSRCADDRESS ) {for (i =0 ; i <4 ; i++) { -if ((Stream[12 + i] & csr->ipsrc_addrmask[i]) != +if ((stream[12 + i] & csr->ipsrc_addrmask[i]) != (csr->ipsrc_addr[i] & csr->ipsrc_addrmask[i]))return 1 ; }
@@ -167,7 +167,7 @@ static u32 chk_ipv4_rule(struct gdm_wimax_csr_s *csr, u8 *Stream, u8 *port)if (csr->classifier_rule_en&IPMASKEDDSTADDRESS ) {for (i =0 ; i <4 ; i++) { -if ((Stream[16 + i] & csr->ipdst_addrmask[i]) != +if ((stream[16 + i] & csr->ipdst_addrmask[i]) != (csr->ipdst_addr[i] & csr->ipdst_addrmask[i]))return 1 ; }
@@ -190,16 +190,15 @@ static u32 chk_ipv4_rule(struct gdm_wimax_csr_s *csr, u8 *Stream, u8 *port)static u32 get_qos_index (struct nic *nic,u8 *iph,u8 *tcpudph) { -u32 IP_Ver, Header_Len, i; +u32 IP_ver, i;struct qos_cb_s *qcb = &nic->qos;if (iph ==NULL || tcpudph ==NULL )return -1 ; - IP_Ver = (iph[0 ]>>4 )&0xf ; - Header_Len = iph[0 ]&0xf ; + IP_ver = (iph[0 ]>>4 )&0xf ; -if (IP_Ver ==4 ) { +if (IP_ver ==4 ) {for (i =0 ; i <QOS_MAX ; i++) {if (qcb->csr[i].enabled) {if (qcb->csr[i].classifier_rule_en) {
@@ -336,16 +335,16 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) {struct nic *nic = nic_ptr;u32 i,SFID , index, pos; -u8 subCmdEvt; +u8 sub_cmd_evt;struct qos_cb_s *qcb = &nic->qos;struct qos_entry_s *entry, *n;struct list_head send_list;struct list_head free_list;unsigned long flags; - subCmdEvt = (u8 )buf[4 ]; + sub_cmd_evt = (u8 )buf[4 ]; -if (subCmdEvt ==QOS_REPORT ) { +if (sub_cmd_evt ==QOS_REPORT ) {spin_lock_irqsave (&qcb->qos_lock, flags);for (i =0 ; i < qcb->qos_list_cnt; i++) {SFID = ((buf[(i*5 )+6 ]<<24 )&0xff000000 );
@@ -367,7 +366,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size)return ; } -/* subCmdEvt == QOS_ADD || subCmdEvt == QOS_CHANG_DEL */ +/* sub_cmd_evt == QOS_ADD || sub_cmd_evt == QOS_CHANG_DEL */ pos =6 ;SFID = ((buf[pos++]<<24 )&0xff000000 );SFID += ((buf[pos++]<<16 )&0xff0000 );
@@ -382,7 +381,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size)return ; } -if (subCmdEvt ==QOS_ADD ) { +if (sub_cmd_evt ==QOS_ADD ) {netdev_dbg (nic->netdev,"QOS_ADD SFID = 0x%x, index=%d\n" ,SFID , index);
@@ -423,7 +422,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) qcb->qos_limit_size =254 /qcb->qos_list_cnt;spin_unlock_irqrestore (&qcb->qos_lock, flags); - }else if (subCmdEvt ==QOS_CHANGE_DEL ) { + }else if (sub_cmd_evt ==QOS_CHANGE_DEL ) {netdev_dbg (nic->netdev,"QOS_CHANGE_DEL SFID = 0x%x, index=%d\n" ,SFID , index);
Signature · 1 line
1.8.4
PATCH v5 6/10 staging: gdm72xx: Fix braces to conform with coding style
In reply to Michalis PappasFixes the following checkpatch.pl issue:
CHECK: braces {} should be used on all arms of this statement
--- drivers/staging/gdm72xx/gdm_wimax.c | 16 ++++++++-------- drivers/staging/gdm72xx/netlink_k.c | 7 ++++--- 2 files changed, 12 insertions(+), 11 deletions(-)
drivers/staging/gdm72xx/gdm_wimax.c +8 -8
@@ -263,9 +263,9 @@ static struct evt_entry *get_event_entry(void) {struct evt_entry *e; -if (list_empty (&wm_event.freeq)) +if (list_empty (&wm_event.freeq)) { e =alloc_event_entry (); -else { + }else { e = list_entry(wm_event.freeq.next, struct evt_entry, list);list_del (&e->list); }
@@ -379,9 +379,9 @@ static int gdm_wimax_tx(struct sk_buff *skb, struct net_device *dev) }#if !defined(LOOPBACK_TEST ) -if (!fsm) +if (!fsm) {netdev_err (dev,"ASSERTION ERROR: fsm is NULL!!\n" ); -else if (fsm->m_status !=M_CONNECTED ) { + }else if (fsm->m_status !=M_CONNECTED ) {netdev_emerg (dev,"ASSERTION ERROR: Device is NOT ready. status=%d\n" , fsm->m_status);kfree_skb (skb);
@@ -544,9 +544,9 @@ static void gdm_update_fsm(struct net_device *dev, struct fsm_s *new_fsm)if (cur_fsm->m_status != new_fsm->m_status || cur_fsm->c_status != new_fsm->c_status) { -if (new_fsm->m_status ==M_CONNECTED ) +if (new_fsm->m_status ==M_CONNECTED ) {netif_carrier_on (dev); -else if (cur_fsm->m_status ==M_CONNECTED ) { + }else if (cur_fsm->m_status ==M_CONNECTED ) {netif_carrier_off (dev);#if defined(CONFIG_WIMAX_GDM72XX_QOS )gdm_qos_release_list (nic);
@@ -855,9 +855,9 @@ static void prepare_rx_complete(void *arg, void *data, int len)int ret; ret =gdm_wimax_get_prepared_info (nic->netdev, data, len); -if (ret ==1 ) +if (ret ==1 ) {gdm_wimax_rcv_with_cb (nic, rx_complete, nic); -else { + }else {if (ret <0 )netdev_err (nic->netdev,"get_prepared_info failed(%d)\n" , ret);
drivers/staging/gdm72xx/netlink_k.c +4 -3
@@ -75,8 +75,9 @@ static void netlink_rcv_cb(struct sk_buff *skb)netdev_err (skb->dev,"dev_get_by_index(%d) is not found.\n" , ifindex); - }else + }else {netdev_err (skb->dev,"Unregistered Callback\n" ); + } } }
@@ -144,9 +145,9 @@ int netlink_send(struct sock *sock, int group, u16 type, void *msg, int len) ret =netlink_broadcast (sock, skb,0 , group+1 ,GFP_ATOMIC ); -if (!ret) +if (!ret) {return len; -else { + }else {if (ret != -ESRCH ) {pr_err ("netlink_broadcast g=%d, t=%d, l=%d, r=%d\n" , group, type, len, ret);
Signature · 1 line
1.8.4
PATCH v5 7/10 staging: gdm72xx: Removed commented-out code
In reply to Michalis Pappas--- drivers/staging/gdm72xx/gdm_qos.h | 17 ----------------- drivers/staging/gdm72xx/gdm_wimax.c | 4 ---- drivers/staging/gdm72xx/gdm_wimax.h | 6 ------ drivers/staging/gdm72xx/usb_boot.c | 17 +---------------- 4 files changed, 1 insertion(+), 43 deletions(-)
drivers/staging/gdm72xx/gdm_qos.h +0 -17
@@ -34,23 +34,6 @@#define IEEE802_1QVLANID 0x10struct gdm_wimax_csr_s { -/* union{ -U16 all; -struct _CS_CLASSIFIER_RULE_ENABLE{ -IPTypeOfService:1, -Protocol:1, -IPMaskedSrcAddress:1, -IPMaskedDstAddress:1, -ProtocolSrcPortRange:1, -ProtocolDstPortRange:1, -DstMacAddr:1, -SrcMacAddr:1, -Ethertype:1, -IEEE802_1DUserPriority:1, -IEEE802_1QVLANID:1, -Reserved:5; -} fields; -} */ BOOLEAN enabled;u32 SFID;u8 qos_buf_count;
drivers/staging/gdm72xx/gdm_wimax.c +0 -4
@@ -862,10 +862,6 @@ static void prepare_rx_complete(void *arg, void *data, int len)netdev_err (nic->netdev,"get_prepared_info failed(%d)\n" , ret);gdm_wimax_rcv_with_cb (nic, prepare_rx_complete, nic); -#if 0 -/* Re-prepare WiMax device */ -gdm_wimax_prepare_device (nic->netdev); -#endif } }
drivers/staging/gdm72xx/gdm_wimax.h +0 -6
@@ -23,10 +23,6 @@#define DRIVER_VERSION "3.2.3" -/*#define ETH_P_IP 0x0800 */ -/*#define ETH_P_ARP 0x0806 */ -/*#define ETH_P_IPV6 0x86DD */ -#define H2L (x) __cpu_to_le16(x)#define L2H (x) __le16_to_cpu(x)#define DH2L (x) __cpu_to_le32(x)
@@ -62,8 +58,6 @@ struct nic { }; -/*#define LOOPBACK_TEST */ -int register_wimax_device (struct phy_dev *phy_dev,struct device *pdev);int gdm_wimax_send_tx (struct sk_buff *skb,struct net_device *dev);void unregister_wimax_device (struct phy_dev *phy_dev);
drivers/staging/gdm72xx/usb_boot.c +1 -16
@@ -169,14 +169,7 @@ int usb_boot(struct usb_device *usbdev, u16 pid)memcpy (&hdr, firm->data,sizeof (hdr));array_le32_to_cpu ((u32 *)&hdr,19 ); -#if 0 -if (hdr.magic_code !=0x10767fff ) { -dev_err (&usbdev->dev,"Invalid magic code 0x%08x\n" , - hdr.magic_code); - ret = -EINVAL ; - goto out; - } -#endif +if (hdr.count >MAX_IMG_CNT ) {dev_err (&usbdev->dev,"Too many images. %d\n" , hdr.count); ret = -EINVAL ;
@@ -201,14 +194,6 @@ int usb_boot(struct usb_device *usbdev, u16 pid)memcpy (&fw_info, firm->data + pos,sizeof (fw_info));array_le32_to_cpu ((u32 *)&fw_info,8 ); -#if 0 -if ((fw_info.id &0xfffff000 ) !=0x10767000 ) { -dev_err (&usbdev->dev,"Invalid FW id. 0x%08x\n" , - fw_info.id); - ret = -EIO ; - goto out; - } -#endif if ((fw_info.id &0xffff ) != pid)continue ;
Signature · 1 line
1.8.4
PATCH v5 8/10 staging: gdm72xx: Whitespace fixes to conform to coding standards
In reply to Michalis PappasFixes the following checkpatch.pl issues:
WARNING: unnecessary whitespace before a quoted newline
CHECK: Alignment should match open parenthesis
CHECK: No space is necessary after a cast
Also some additional, whitespace related, readability issues.
--- drivers/staging/gdm72xx/gdm_qos.c | 72 ++++++++++++++++++------------------- drivers/staging/gdm72xx/gdm_sdio.c | 15 ++++---- drivers/staging/gdm72xx/gdm_usb.c | 43 ++++++++-------------- drivers/staging/gdm72xx/gdm_wimax.c | 61 +++++++++++++++---------------- drivers/staging/gdm72xx/gdm_wimax.h | 6 ++-- drivers/staging/gdm72xx/netlink_k.c | 5 ++- drivers/staging/gdm72xx/netlink_k.h | 4 +-- drivers/staging/gdm72xx/usb_boot.c | 18 +++++----- 8 files changed, 101 insertions(+), 123 deletions(-)
drivers/staging/gdm72xx/gdm_qos.c +34 -38
@@ -47,8 +47,7 @@ static void *alloc_qos_entry(void)spin_lock_irqsave (&qos_free_list.lock, flags);if (qos_free_list.cnt) { - entry = list_entry(qos_free_list.head.prev, struct qos_entry_s, - list); + entry = list_entry(qos_free_list.head.prev, struct qos_entry_s, list);list_del (&entry->list); qos_free_list.cnt--;spin_unlock_irqrestore (&qos_free_list.lock, flags);
@@ -62,7 +61,7 @@ static void *alloc_qos_entry(void)static void free_qos_entry (void *entry) { -struct qos_entry_s *qentry = (struct qos_entry_s *) entry; +struct qos_entry_s *qentry = (struct qos_entry_s *)entry;unsigned long flags;spin_lock_irqsave (&qos_free_list.lock, flags);
@@ -148,7 +147,7 @@ static u32 chk_ipv4_rule(struct gdm_wimax_csr_s *csr, u8 *stream, u8 *port)if (csr->classifier_rule_en&IPTYPEOFSERVICE ) {if (((stream[1 ] & csr->ip2s_mask) < csr->ip2s_lo) || - ((stream[1 ] & csr->ip2s_mask) > csr->ip2s_hi)) + ((stream[1 ] & csr->ip2s_mask) > csr->ip2s_hi))return 1 ; }
@@ -190,7 +189,7 @@ static u32 chk_ipv4_rule(struct gdm_wimax_csr_s *csr, u8 *stream, u8 *port)static u32 get_qos_index (struct nic *nic,u8 *iph,u8 *tcpudph) { -u32 IP_ver, i; +u32 IP_ver, i;struct qos_cb_s *qcb = &nic->qos;if (iph ==NULL || tcpudph ==NULL )
@@ -198,16 +197,16 @@ static u32 get_qos_index(struct nic *nic, u8 *iph, u8 *tcpudph) IP_ver = (iph[0 ]>>4 )&0xf ; -if (IP_ver ==4 ) { -for (i =0 ; i <QOS_MAX ; i++) { -if (qcb->csr[i].enabled) { -if (qcb->csr[i].classifier_rule_en) { -if (chk_ipv4_rule (&qcb->csr[i], iph, - tcpudph) ==0 ) -return i; - } - } - } +if (IP_ver !=4 ) +return -1 ; + +for (i =0 ; i <QOS_MAX ; i++) { +if (!qcb->csr[i].enabled) +continue ; +if (!qcb->csr[i].classifier_rule_en) +continue ; +if (chk_ipv4_rule (&qcb->csr[i], iph, tcpudph) ==0 ) +return i; }return -1 ;
@@ -222,22 +221,20 @@ static u32 extract_qos_list(struct nic *nic, struct list_head *head)INIT_LIST_HEAD (head);for (i =0 ; i <QOS_MAX ; i++) { -if (qcb->csr[i].enabled) { -if (qcb->csr[i].qos_buf_count < qcb->qos_limit_size) { -if (!list_empty (&qcb->qos_list[i])) { - entry =list_entry ( - qcb->qos_list[i].prev, - struct qos_entry_s, list); -list_move_tail (&entry->list, head); - qcb->csr[i].qos_buf_count++; - -if (!list_empty (&qcb->qos_list[i])) -netdev_warn (nic->netdev, -"Index(%d) is piled!!\n" , - i); - } - } - } +if (!qcb->csr[i].enabled) +continue ; +if (qcb->csr[i].qos_buf_count >= qcb->qos_limit_size) +continue ; +if (list_empty (&qcb->qos_list[i])) +continue ; + + entry = list_entry(qcb->qos_list[i].prev, struct qos_entry_s, list); + +list_move_tail (&entry->list, head); + qcb->csr[i].qos_buf_count++; + +if (!list_empty (&qcb->qos_list[i])) +netdev_warn (nic->netdev,"Index(%d) is piled!!\n" , i); }return 0 ;
@@ -260,14 +257,14 @@ int gdm_qos_send_hci_pkt(struct sk_buff *skb, struct net_device *dev)int index;struct qos_cb_s *qcb = &nic->qos;unsigned long flags; -struct ethhdr *ethh = (struct ethhdr *) (skb->data +HCI_HEADER_SIZE ); -struct iphdr *iph = (struct iphdr *) ((char *) ethh +ETH_HLEN ); +struct ethhdr *ethh = (struct ethhdr *)(skb->data +HCI_HEADER_SIZE ); +struct iphdr *iph = (struct iphdr *)((char *)ethh +ETH_HLEN );struct tcphdr *tcph;struct qos_entry_s *entry =NULL ;struct list_head send_list;int ret =0 ; - tcph = (struct tcphdr *) iph + iph->ihl*4 ; + tcph = (struct tcphdr *)iph + iph->ihl*4 ;if (B2H (ethh->h_proto) ==ETH_P_IP ) {if (qcb->qos_list_cnt && !qos_free_list.cnt) {
@@ -280,7 +277,7 @@ int gdm_qos_send_hci_pkt(struct sk_buff *skb, struct net_device *dev)spin_lock_irqsave (&qcb->qos_lock, flags);if (qcb->qos_list_cnt) { - index =get_qos_index (nic, (u8 *)iph, (u8 *) tcph); + index =get_qos_index (nic, (u8 *)iph, (u8 *)tcph);if (index ==-1 ) index = qcb->qos_null_idx;
@@ -376,7 +373,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) index =get_csr (qcb,SFID ,1 );if (index ==-1 ) {netdev_err (nic->netdev, -"QoS ERROR: csr Update Error / Wrong index (%d) \n" , +"QoS ERROR: csr Update Error / Wrong index (%d)\n" , index);return ; }
@@ -433,8 +430,7 @@ void gdm_recv_qos_hci_packet(void *nic_ptr, u8 *buf, int size) qcb->qos_list_cnt--; qcb->qos_limit_size =254 /qcb->qos_list_cnt; -list_for_each_entry_safe (entry, n, &qcb->qos_list[index], - list) { +list_for_each_entry_safe (entry, n, &qcb->qos_list[index], list) {list_move_tail (&entry->list, &free_list); }spin_unlock_irqrestore (&qcb->qos_lock, flags);
drivers/staging/gdm72xx/gdm_sdio.c +7 -8
@@ -312,8 +312,7 @@ static void send_sdu(struct sdio_func *func, struct tx_cxt *tx)spin_unlock_irqrestore (&tx->lock, flags); } -static void send_hci (struct sdio_func *func,struct tx_cxt *tx, -struct sdio_tx *t) +static void send_hci (struct sdio_func *func,struct tx_cxt *tx,struct sdio_tx *t) {unsigned long flags;
@@ -380,7 +379,7 @@ static void do_tx(struct work_struct *work) }static int gdm_sdio_send (void *priv_dev,void *data,int len, -void (*cb)(void *data),void *cb_data) +void (*cb)(void *data),void *cb_data) {struct sdiowm_dev *sdev = priv_dev;struct tx_cxt *tx = &sdev->tx;
@@ -510,6 +509,7 @@ static void gdm_sdio_irq(struct sdio_func *func)if (hdr[3 ] ==1 ) {/* Ack */ u32 *ack_seq = (u32 *)&hdr[4 ]; +spin_lock_irqsave (&tx->lock, flags); tx->can_send =1 ;
@@ -521,7 +521,7 @@ static void gdm_sdio_irq(struct sdio_func *func) }memcpy (rx->rx_buf, hdr +TYPE_A_HEADER_SIZE , -TYPE_A_LOOKAHEAD_SIZE -TYPE_A_HEADER_SIZE ); +TYPE_A_LOOKAHEAD_SIZE -TYPE_A_HEADER_SIZE ); buf = rx->rx_buf +TYPE_A_LOOKAHEAD_SIZE -TYPE_A_HEADER_SIZE ; remain = len -TYPE_A_LOOKAHEAD_SIZE +TYPE_A_HEADER_SIZE ;
@@ -577,8 +577,8 @@ done: }static int gdm_sdio_receive (void *priv_dev, -void (*cb)(void *cb_data,void *data,int len), -void *cb_data) +void (*cb)(void *cb_data,void *data,int len), +void *cb_data) {struct sdiowm_dev *sdev = priv_dev;struct rx_cxt *rx = &sdev->rx;
@@ -601,8 +601,7 @@ static int gdm_sdio_receive(void *priv_dev,return 0 ; } -static int sdio_wimax_probe (struct sdio_func *func, -const struct sdio_device_id *id) +static int sdio_wimax_probe (struct sdio_func *func,const struct sdio_device_id *id) {int ret;struct phy_dev *phy_dev =NULL ;
drivers/staging/gdm72xx/gdm_usb.c +15 -28
91 lines not on this page · raw message
drivers/staging/gdm72xx/gdm_wimax.c +29 -32
190 lines not on this page · raw message
drivers/staging/gdm72xx/gdm_wimax.h +3 -3
@@ -38,10 +38,10 @@ struct phy_dev {struct net_device *netdev;int (*send_func)(void *priv_dev,void *data,int len, -void (*cb)(void *cb_data),void *cb_data); +void (*cb)(void *cb_data),void *cb_data);int (*rcv_func)(void *priv_dev, -void (*cb)(void *cb_data,void *data,int len), -void *cb_data); +void (*cb)(void *cb_data,void *data,int len), +void *cb_data); };struct nic {
drivers/staging/gdm72xx/netlink_k.c +2 -3
@@ -55,8 +55,7 @@ static void netlink_rcv_cb(struct sk_buff *skb)if (skb->len >=NLMSG_HDRLEN ) { nlh = (struct nlmsghdr *)skb->data; -if (skb->len < nlh->nlmsg_len || - nlh->nlmsg_len >ND_MAX_MSG_LEN ) { +if (skb->len < nlh->nlmsg_len || nlh->nlmsg_len >ND_MAX_MSG_LEN ) {netdev_err (skb->dev,"Invalid length (%d,%d)\n" , skb->len, nlh->nlmsg_len);return ;
@@ -89,7 +88,7 @@ static void netlink_rcv(struct sk_buff *skb) }struct sock *netlink_init (int unit,void (*cb)(struct net_device *dev,u16 type, -void *msg,int len)) +void *msg,int len)) {struct sock *sock;struct netlink_kernel_cfg cfg = {
drivers/staging/gdm72xx/netlink_k.h +2 -2
@@ -16,8 +16,8 @@#include <linux/netdevice.h> #include <net/sock.h> -struct sock *netlink_init (int unit, -void (*cb)(struct net_device *dev,u16 type,void *msg,int len)); +struct sock *netlink_init (int unit,void (*cb)(struct net_device *dev,u16 type, +void *msg,int len));void netlink_exit (struct sock *sock);int netlink_send (struct sock *sock,int group,u16 type,void *msg,int len);
drivers/staging/gdm72xx/usb_boot.c +9 -9
@@ -67,6 +67,7 @@ struct fw_info {static void array_le32_to_cpu (u32 *arr,int num) {int i; +for (i =0 ; i < num; i++, arr++) *arr =__le32_to_cpu (*arr); }
@@ -79,7 +80,7 @@ static int gdm_wibro_send(struct usb_device *usbdev, void *data, int len)int actual; ret =usb_bulk_msg (usbdev,usb_sndbulkpipe (usbdev,1 ), data, len, - &actual,1000 ); + &actual,1000 );if (ret <0 ) { dev_err(&usbdev->dev, "Error : usb_bulk_msg ( result = %d )\n",
@@ -95,7 +96,7 @@ static int gdm_wibro_recv(struct usb_device *usbdev, void *data, int len)int actual; ret =usb_bulk_msg (usbdev,usb_rcvbulkpipe (usbdev,2 ), data, len, - &actual,5000 ); + &actual,5000 );if (ret <0 ) { dev_err(&usbdev->dev,
@@ -105,9 +106,8 @@ static int gdm_wibro_recv(struct usb_device *usbdev, void *data, int len)return 0 ; } -static int download_image (struct usb_device *usbdev, -const struct firmware *firm, -loff_t pos,u32 img_len,u32 magic_num) +static int download_image (struct usb_device *usbdev,const struct firmware *firm, +loff_t pos,u32 img_len,u32 magic_num) {struct dn_header h;int ret =0 ;
@@ -204,8 +204,8 @@ int usb_boot(struct usb_device *usbdev, u16 pid) goto out; } - ret =download_image (usbdev, firm, pos, - fw_info.kernel_len,DN_KERNEL_MAGIC_NUMBER ); + ret =download_image (usbdev, firm, pos, fw_info.kernel_len, +DN_KERNEL_MAGIC_NUMBER );if (ret <0 ) goto out;dev_info (&usbdev->dev,"GCT: Kernel download success.\n" );
@@ -216,7 +216,7 @@ int usb_boot(struct usb_device *usbdev, u16 pid) goto out; } ret =download_image (usbdev, firm, pos, fw_info.rootfs_len, -DN_ROOTFS_MAGIC_NUMBER ); +DN_ROOTFS_MAGIC_NUMBER );if (ret <0 ) goto out;dev_info (&usbdev->dev,"GCT: Filesystem download success.\n" );
@@ -261,7 +261,7 @@ out: }static int em_download_image (struct usb_device *usbdev,const char *img_name, -char *type_string) +char *type_string) {char *buf =NULL ;loff_t pos =0 ;
Signature · 1 line
1.8.4
PATCH v5 9/10 staging: gdm72xx: Indentation and other whitespace fixes
In reply to Michalis Pappas--- drivers/staging/gdm72xx/gdm_qos.c | 2 +- drivers/staging/gdm72xx/gdm_sdio.c | 14 +++--- drivers/staging/gdm72xx/gdm_sdio.h | 29 +++++-------- drivers/staging/gdm72xx/gdm_usb.c | 17 ++++---- drivers/staging/gdm72xx/gdm_usb.h | 11 +---- drivers/staging/gdm72xx/gdm_wimax.c | 21 +++++---- drivers/staging/gdm72xx/gdm_wimax.h | 21 ++++----- drivers/staging/gdm72xx/hci.h | 87 +++++++++++++++++-------------------- drivers/staging/gdm72xx/usb_ids.h | 2 +- drivers/staging/gdm72xx/wm_ioctl.h | 22 +++++----- 10 files changed, 97 insertions(+), 129 deletions(-)
drivers/staging/gdm72xx/gdm_qos.c +1 -1
@@ -24,7 +24,7 @@#include "hci.h" #include "gdm_qos.h" -#define B2H (x) __be16_to_cpu(x) +#define B2H (x) __be16_to_cpu(x)#define MAX_FREE_LIST_CNT 32 static struct {
drivers/staging/gdm72xx/gdm_sdio.c +7 -7
@@ -31,11 +31,11 @@#define MAX_NR_RX_BUF 4#define SDU_TX_BUF_SIZE 2048 -#define TX_BUF_SIZE 2048 +#define TX_BUF_SIZE 2048#define TX_CHUNK_SIZE (2048 - TYPE_A_HEADER_SIZE) -#define RX_BUF_SIZE (25*1024) +#define RX_BUF_SIZE (25*1024) -#define TX_HZ 2000 +#define TX_HZ 2000#define TX_INTERVAL (1000000/TX_HZ)static int init_sdio (struct sdiowm_dev *sdev);
@@ -127,10 +127,10 @@ static void put_rx_struct(struct rx_cxt *rx, struct sdio_rx *r)static int init_sdio (struct sdiowm_dev *sdev) {int ret =0 , i; -struct tx_cxt *tx = &sdev->tx; -struct rx_cxt *rx = &sdev->rx; -struct sdio_tx *t; -struct sdio_rx *r; +struct tx_cxt *tx = &sdev->tx; +struct rx_cxt *rx = &sdev->rx; +struct sdio_tx *t; +struct sdio_rx *r;INIT_LIST_HEAD (&tx->free_list);INIT_LIST_HEAD (&tx->sdu_list);
drivers/staging/gdm72xx/gdm_sdio.h +10 -19
@@ -22,10 +22,8 @@struct sdio_tx {struct list_head list;struct tx_cxt *tx_cxt; - -u8 *buf; -int len; - +u8 *buf; +int len;void (*callback)(void *cb_data);void *cb_data; };
@@ -35,18 +33,15 @@ struct tx_cxt {struct list_head sdu_list;struct list_head hci_list;struct timeval sdu_stamp; - -u8 *sdu_buf; - -spinlock_t lock; -int can_send; -int stop_sdu_tx; +u8 *sdu_buf; +spinlock_t lock; +int can_send; +int stop_sdu_tx; };struct sdio_rx {struct list_head list;struct rx_cxt *rx_cxt; -void (*callback)(void *cb_data,void *data,int len);void *cb_data; };
@@ -54,18 +49,14 @@ struct sdio_rx {struct rx_cxt {struct list_head free_list;struct list_head req_list; - -u8 *rx_buf; - -spinlock_t lock; +u8 *rx_buf; +spinlock_t lock; };struct sdiowm_dev {struct sdio_func *func; - -struct tx_cxt tx; -struct rx_cxt rx; - +struct tx_cxt tx; +struct rx_cxt rx;struct work_struct ws; };
drivers/staging/gdm72xx/gdm_usb.c +9 -8
@@ -27,6 +27,7 @@MODULE_DEVICE_TABLE (usb, id_table);#define TX_BUF_SIZE 2048 +#if defined(CONFIG_WIMAX_GDM72XX_WIMAX2 )#define RX_BUF_SIZE (128*1024)/* For packet aggregation */ #else
@@ -166,10 +167,10 @@ static void put_rx_struct(struct rx_cxt *rx, struct usb_rx *r)static int init_usb (struct usbwm_dev *udev) {int ret =0 , i; -struct tx_cxt *tx = &udev->tx; -struct rx_cxt *rx = &udev->rx; -struct usb_tx *t; -struct usb_rx *r; +struct tx_cxt *tx = &udev->tx; +struct rx_cxt *rx = &udev->rx; +struct usb_tx *t; +struct usb_rx *r;unsigned long flags;INIT_LIST_HEAD (&tx->free_list);
@@ -215,10 +216,10 @@ fail:static void release_usb (struct usbwm_dev *udev) { -struct tx_cxt *tx = &udev->tx; -struct rx_cxt *rx = &udev->rx; -struct usb_tx *t, *t_next; -struct usb_rx *r, *r_next; +struct tx_cxt *tx = &udev->tx; +struct rx_cxt *rx = &udev->rx; +struct usb_tx *t, *t_next; +struct usb_rx *r, *r_next;unsigned long flags;spin_lock_irqsave (&tx->lock, flags);
drivers/staging/gdm72xx/gdm_usb.h +2 -9
@@ -28,12 +28,10 @@ struct usb_tx {struct list_head p_list;#endif struct tx_cxt *tx_cxt; -struct urb *urb;u8 *buf; -void (*callback)(void *cb_data); -void *cb_data; +void *cb_data; };struct tx_cxt {
@@ -43,17 +41,14 @@ struct tx_cxt {#if defined(CONFIG_WIMAX_GDM72XX_USB_PM ) || defined(CONFIG_WIMAX_GDM72XX_K_MODE )struct list_head pending_list;#endif -spinlock_t lock; };struct usb_rx {struct list_head list;struct rx_cxt *rx_cxt; -struct urb *urb;u8 *buf; -void (*callback)(void *cb_data,void *data,int len);void *cb_data; };
@@ -75,11 +70,9 @@ struct usbwm_dev {int bw_switch;struct list_head list;#endif -struct tx_cxt tx;struct rx_cxt rx; - - int padding; + int padding; };#endif /* __GDM_USB_H__ */
drivers/staging/gdm72xx/gdm_wimax.c +10 -11
@@ -35,10 +35,10 @@#define EVT_MAX_SIZE 2048struct evt_entry { -struct list_head list; -struct net_device *dev; -char evt_data[EVT_MAX_SIZE ]; -int size; +struct list_head list; +struct net_device *dev; +char evt_data[EVT_MAX_SIZE ]; +int size; };static void __gdm_wimax_event_send (struct work_struct *work);
@@ -52,7 +52,6 @@ static struct {struct sock *sock;struct list_head evtq;spinlock_t evt_lock; -struct list_head freeq;struct work_struct ws; } wm_event;
@@ -868,13 +867,13 @@ static void start_rx_proc(struct nic *nic) }static struct net_device_ops gdm_netdev_ops = { - .ndo_open = gdm_wimax_open, - .ndo_stop = gdm_wimax_close, - .ndo_set_config = gdm_wimax_set_config, - .ndo_start_xmit = gdm_wimax_tx, - .ndo_get_stats = gdm_wimax_stats, + .ndo_open = gdm_wimax_open, + .ndo_stop = gdm_wimax_close, + .ndo_set_config = gdm_wimax_set_config, + .ndo_start_xmit = gdm_wimax_tx, + .ndo_get_stats = gdm_wimax_stats, .ndo_set_mac_address = gdm_wimax_set_mac_addr, - .ndo_do_ioctl = gdm_wimax_ioctl, + .ndo_do_ioctl = gdm_wimax_ioctl, };int register_wimax_device (struct phy_dev *phy_dev,struct device *pdev)
drivers/staging/gdm72xx/gdm_wimax.h +8 -13
@@ -34,28 +34,23 @@#define DB2H (x) __be32_to_cpu(x)struct phy_dev { -void *priv_dev; +void *priv_dev;struct net_device *netdev; - -int (*send_func)(void *priv_dev,void *data,int len, -void (*cb)(void *cb_data),void *cb_data); -int (*rcv_func)(void *priv_dev, -void (*cb)(void *cb_data,void *data,int len), -void *cb_data); +int (*send_func)(void *priv_dev,void *data,int len, +void (*cb)(void *cb_data),void *cb_data); +int (*rcv_func)(void *priv_dev, +void (*cb)(void *cb_data,void *data,int len), +void *cb_data); };struct nic {struct net_device *netdev;struct phy_dev *phy_dev; -struct net_device_stats stats; - -struct data_s sdk_data[SIOC_DATA_MAX ]; - +struct data_s sdk_data[SIOC_DATA_MAX ];#if defined(CONFIG_WIMAX_GDM72XX_QOS ) -struct qos_cb_s qos; +struct qos_cb_s qos;#endif - };int register_wimax_device (struct phy_dev *phy_dev,struct device *pdev);
drivers/staging/gdm72xx/hci.h +39 -48
165 lines not on this page · raw message
drivers/staging/gdm72xx/usb_ids.h +1 -1
@@ -29,7 +29,7 @@ .idVendor = (vend), .idProduct = (prod), .bInterfaceClass = (intf)#define EMERGENCY_PID 0x720f -#define BL_PID_MASK 0xffc0 +#define BL_PID_MASK 0xffc0#define USB_DEVICE_BOOTLOADER (vid, pid) \ {USB_DEVICE((vid), ((pid)&BL_PID_MASK)|B_DOWNLOAD)}, \
drivers/staging/gdm72xx/wm_ioctl.h +10 -12
@@ -19,10 +19,10 @@#define NETLINK_WIMAX 31 -#define SIOCWMIOCTL SIOCDEVPRIVATE +#define SIOCWMIOCTL SIOCDEVPRIVATE -#define SIOCG_DATA 0x8D10 -#define SIOCS_DATA 0x8D11 +#define SIOCG_DATA 0x8D10 +#define SIOCS_DATA 0x8D11enum {SIOC_DATA_FSM ,
@@ -34,7 +34,7 @@ enum {SIOC_DATA_END }; -#define SIOC_DATA_MAX 16 +#define SIOC_DATA_MAX 16/* FSM */ enum {
@@ -67,23 +67,21 @@ enum { };struct fsm_s { -int m_status;/*main status*/ -int c_status;/*connection status*/ -int d_status;/*oma-dm status*/ +int m_status;/*main status*/ +int c_status;/*connection status*/ +int d_status;/*oma-dm status*/ };struct data_s { -int size; +int size;void *buf; };struct wm_req_s {union { -char ifrn_name[IFNAMSIZ ]; +char ifrn_name[IFNAMSIZ ]; } ifr_ifrn; -unsigned short cmd; -unsigned short data_id;struct data_s data;
@@ -91,7 +89,7 @@ struct wm_req_s { };#ifndef ifr_name -#define ifr_name ifr_ifrn.ifrn_name +#define ifr_name ifr_ifrn.ifrn_name#endif #endif
Signature · 1 line
1.8.4
PATCH v5 10/10 staging: gdm72xx: Remove task from TODO list
In reply to Michalis PappasRemoved line related to replacement of kernel_thread with kthread, as issue was fixed on ff5e4a1d2702 ('Staging: gdm72xx: gdm_usb:
fix deprecated function kernel_thread')
--- drivers/staging/gdm72xx/TODO | 1 - 1 file changed, 1 deletion(-)
drivers/staging/gdm72xx/TODO +0 -1
@@ -1,3 +1,2 @@ TODO: -- Replace kernel_thread with kthread in gdm_usb.c - Clean up coding style to meet kernel standard.
Signature · 1 line
1.8.4