Re: [PATCH] Staging: wimax: i2400m: fixing several coding style issues.

2021-02-01 Thread Joe Perches
On Sun, 2021-01-31 at 23:42 +0300, dev.dra...@bk.ru wrote:

> diff --git a/drivers/staging/wimax/i2400m/rx.c 
> b/drivers/staging/wimax/i2400m/rx.c
[]
> @@ -764,9 +763,9 @@ unsigned __i2400m_roq_update_ws(struct i2400m *i2400m, 
> struct i2400m_roq *roq,
>    new_nws);
>   __skb_unlink(skb_itr, >queue);
>   i2400m_net_erx(i2400m, skb_itr, roq_data_itr->cs);
> - }
> - else
> + } else {
>   break;  /* rest of packets all nsn_itr > nws */
> + }
>   }

Rather than merely fixing what checkpatch complains about, it'd be
better to reverse the test above and break directly then unindent
the expected block.
---
 drivers/staging/wimax/i2400m/rx.c | 16 ++--
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/wimax/i2400m/rx.c 
b/drivers/staging/wimax/i2400m/rx.c
index c9fb619a9e01..caeba9694b4e 100644
--- a/drivers/staging/wimax/i2400m/rx.c
+++ b/drivers/staging/wimax/i2400m/rx.c
@@ -757,16 +757,12 @@ unsigned __i2400m_roq_update_ws(struct i2400m *i2400m, 
struct i2400m_roq *roq,
roq_data_itr = (struct i2400m_roq_data *) _itr->cb;
nsn_itr = __i2400m_roq_nsn(roq, roq_data_itr->sn);
/* NSN bounds assumed correct (checked when it was queued) */
-   if (nsn_itr < new_nws) {
-   d_printf(2, dev, "ERX: roq %p - release skb %p "
-"(nsn %u/%u new nws %u)\n",
-roq, skb_itr, nsn_itr, roq_data_itr->sn,
-new_nws);
-   __skb_unlink(skb_itr, >queue);
-   i2400m_net_erx(i2400m, skb_itr, roq_data_itr->cs);
-   }
-   else
-   break;  /* rest of packets all nsn_itr > nws */
+   if (nsn_itr >= new_nws)
+   break;
+   d_printf(2, dev, "ERX: roq %p - release skb %p (nsn %u/%u new 
nws %u)\n",
+roq, skb_itr, nsn_itr, roq_data_itr->sn, new_nws);
+   __skb_unlink(skb_itr, >queue);
+   i2400m_net_erx(i2400m, skb_itr, roq_data_itr->cs);
}
roq->ws = sn;
return new_nws;

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


[PATCH] Staging: wimax: i2400m: fixing several coding style issues.

2021-01-31 Thread dev . dragon
From: Dmitrii Wolf 

Fixed a coding style issues.

Signed-off-by: Dmitrii Wolf 
---
 drivers/staging/wimax/i2400m/debugfs.c |  2 +-
 drivers/staging/wimax/i2400m/netdev.c  |  2 +-
 drivers/staging/wimax/i2400m/rx.c  | 23 +++
 drivers/staging/wimax/i2400m/usb.c |  2 +-
 4 files changed, 14 insertions(+), 15 deletions(-)

diff --git a/drivers/staging/wimax/i2400m/debugfs.c 
b/drivers/staging/wimax/i2400m/debugfs.c
index 1c640b41ea4c..4e6e1e3f015e 100644
--- a/drivers/staging/wimax/i2400m/debugfs.c
+++ b/drivers/staging/wimax/i2400m/debugfs.c
@@ -170,7 +170,7 @@ int debugfs_i2400m_reset_set(void *data, u64 val)
int result;
struct i2400m *i2400m = data;
enum i2400m_reset_type rt = val;
-   switch(rt) {
+   switch (rt) {
case I2400M_RT_WARM:
case I2400M_RT_COLD:
case I2400M_RT_BUS:
diff --git a/drivers/staging/wimax/i2400m/netdev.c 
b/drivers/staging/wimax/i2400m/netdev.c
index 8339d600e77b..0895a2e441d3 100644
--- a/drivers/staging/wimax/i2400m/netdev.c
+++ b/drivers/staging/wimax/i2400m/netdev.c
@@ -523,7 +523,7 @@ void i2400m_net_erx(struct i2400m *i2400m, struct sk_buff 
*skb,
 
d_fnstart(2, dev, "(i2400m %p skb %p [%u] cs %d)\n",
  i2400m, skb, skb->len, cs);
-   switch(cs) {
+   switch (cs) {
case I2400M_CS_IPV4_0:
case I2400M_CS_IPV4:
i2400m_rx_fake_eth_header(i2400m->wimax_dev.net_dev,
diff --git a/drivers/staging/wimax/i2400m/rx.c 
b/drivers/staging/wimax/i2400m/rx.c
index c9fb619a9e01..807bd3db69e9 100644
--- a/drivers/staging/wimax/i2400m/rx.c
+++ b/drivers/staging/wimax/i2400m/rx.c
@@ -485,8 +485,7 @@ struct i2400m_roq_data {
  * store the sequence number (sn) and the cs (packet type) coming from
  * the RX payload header from the device.
  */
-struct i2400m_roq
-{
+struct i2400m_roq {
unsigned ws;
struct sk_buff_head queue;
struct i2400m_roq_log *log;
@@ -556,7 +555,7 @@ void i2400m_roq_log_entry_print(struct i2400m *i2400m, 
unsigned index,
 {
struct device *dev = i2400m_dev(i2400m);
 
-   switch(e->type) {
+   switch (e->type) {
case I2400M_RO_TYPE_RESET:
dev_err(dev, "q#%d reset   ws %u cnt %u sn %u/%u"
" - new nws %u\n",
@@ -764,9 +763,9 @@ unsigned __i2400m_roq_update_ws(struct i2400m *i2400m, 
struct i2400m_roq *roq,
 new_nws);
__skb_unlink(skb_itr, >queue);
i2400m_net_erx(i2400m, skb_itr, roq_data_itr->cs);
-   }
-   else
+   } else {
break;  /* rest of packets all nsn_itr > nws */
+   }
}
roq->ws = sn;
return new_nws;
@@ -819,7 +818,7 @@ void i2400m_roq_reset(struct i2400m *i2400m, struct 
i2400m_roq *roq)
  */
 static
 void i2400m_roq_queue(struct i2400m *i2400m, struct i2400m_roq *roq,
- struct sk_buff * skb, unsigned lbn)
+   struct sk_buff *skb, unsigned lbn)
 {
struct device *dev = i2400m_dev(i2400m);
unsigned nsn, len;
@@ -882,7 +881,7 @@ void i2400m_roq_update_ws(struct i2400m *i2400m, struct 
i2400m_roq *roq,
  */
 static
 void i2400m_roq_queue_update_ws(struct i2400m *i2400m, struct i2400m_roq *roq,
-   struct sk_buff * skb, unsigned sn)
+   struct sk_buff *skb, unsigned sn)
 {
struct device *dev = i2400m_dev(i2400m);
unsigned nsn, old_ws, len;
@@ -1046,7 +1045,7 @@ void i2400m_rx_edata(struct i2400m *i2400m, struct 
sk_buff *skb_rx,
 ro_type, ro_cin, roq->ws, ro_sn,
 __i2400m_roq_nsn(roq, ro_sn), size);
d_dump(2, dev, payload, size);
-   switch(ro_type) {
+   switch (ro_type) {
case I2400M_RO_TYPE_RESET:
i2400m_roq_reset(i2400m, roq);
kfree_skb(skb); /* no data here */
@@ -1068,9 +1067,9 @@ void i2400m_rx_edata(struct i2400m *i2400m, struct 
sk_buff *skb_rx,
spin_lock_irqsave(>rx_lock, flags);
kref_put(>rx_roq_refcount, i2400m_rx_roq_destroy);
spin_unlock_irqrestore(>rx_lock, flags);
-   }
-   else
+   } else {
i2400m_net_erx(i2400m, skb, cs);
+   }
 error_skb_clone:
 error:
d_fnend(2, dev, "(i2400m %p skb_rx %p single %u payload %p "
@@ -1346,7 +1345,7 @@ int i2400m_rx_setup(struct i2400m *i2400m)
 {
int result = 0;
 
-   i2400m->rx_reorder = i2400m_rx_reorder_disabled? 0 : 1;
+   i2400m->rx_reorder = i2400m_rx_reorder_disabled ? 0 : 1;
if (i2400m->rx_reorder) {
unsigned itr;
struct i2400m_roq_log *rd;
@@ -1365,7 +1364,7 @@ int i2400m_rx_setup(struct i2400m *i2400m)
goto error_roq_log_alloc;
}
 
-   for(itr = 0; itr <