lkml.org 
[lkml]   [2021]   [Feb]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[96e8740] [PATCH 2/2] Staging: wimax: i2400m: some readability improvements.
Date
From: Dmitrii Wolf <dev.dragon@bk.ru>

Hello, developers!
Sorry for the late answer. As you know - i am a newbie and it is my first kernel patch.
After reading kernelnewbies.or, ./Documentation/process/ files and viewing FOSDEM's videpo
"Write and Submit your first Linux kernel Patch", i took a decision to send you some
changes. I understand that it is annoying to get this "style fixing" patches. So, the
Joe Perches's idea to improve code readability was implemented in second patch. Also,
some new readability improvements added to it.
Thanks in advance!

Signed-off-by: Dmitrii Wolf <dev.dragon@bk.ru>
---
drivers/staging/wimax/i2400m/netdev.c | 8 ++++----
drivers/staging/wimax/i2400m/rx.c | 25 +++++++++++++------------
2 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/drivers/staging/wimax/i2400m/netdev.c b/drivers/staging/wimax/i2400m/netdev.c
index 0895a2e441d3..5f79ccc87656 100644
--- a/drivers/staging/wimax/i2400m/netdev.c
+++ b/drivers/staging/wimax/i2400m/netdev.c
@@ -366,13 +366,13 @@ netdev_tx_t i2400m_hard_start_xmit(struct sk_buff *skb,
result = i2400m_net_wake_tx(i2400m, net_dev, skb);
else
result = i2400m_net_tx(i2400m, net_dev, skb);
- if (result < 0) {
-drop:
- net_dev->stats.tx_dropped++;
- } else {
+ if (result >= 0) {
net_dev->stats.tx_packets++;
net_dev->stats.tx_bytes += skb->len;
}
+drop:
+ net_dev->stats.tx_dropped++;
+
dev_kfree_skb(skb);
d_fnend(3, dev, "(skb %p net_dev %p) = %d\n", skb, net_dev, result);
return NETDEV_TX_OK;
diff --git a/drivers/staging/wimax/i2400m/rx.c b/drivers/staging/wimax/i2400m/rx.c
index 807bd3db69e9..fdc5da409683 100644
--- a/drivers/staging/wimax/i2400m/rx.c
+++ b/drivers/staging/wimax/i2400m/rx.c
@@ -194,8 +194,8 @@ void i2400m_report_hook_work(struct work_struct *ws)
spin_unlock_irqrestore(&i2400m->rx_lock, flags);
if (list_empty(&list))
break;
- else
- d_printf(1, dev, "processing queued reports\n");
+
+ d_printf(1, dev, "processing queued reports\n");
list_for_each_entry_safe(args, args_next, &list, list_node) {
d_printf(2, dev, "processing queued report %p\n", args);
i2400m_report_hook(i2400m, args->l3l4_hdr, args->size);
@@ -756,16 +756,15 @@ unsigned __i2400m_roq_update_ws(struct i2400m *i2400m, struct i2400m_roq *roq,
roq_data_itr = (struct i2400m_roq_data *) &skb_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, &roq->queue);
- i2400m_net_erx(i2400m, skb_itr, roq_data_itr->cs);
- } else {
+ if (nsn_itr >= new_nws) {
break; /* rest of packets all nsn_itr > 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, &roq->queue);
+ i2400m_net_erx(i2400m, skb_itr, roq_data_itr->cs);
}
roq->ws = sn;
return new_nws;
@@ -904,8 +903,9 @@ void i2400m_roq_queue_update_ws(struct i2400m *i2400m, struct i2400m_roq *roq,
struct i2400m_roq_data *roq_data;
roq_data = (struct i2400m_roq_data *) &skb->cb;
i2400m_net_erx(i2400m, skb, roq_data->cs);
- } else
+ } else {
__i2400m_roq_queue(i2400m, roq, skb, sn, nsn);
+ }

__i2400m_roq_update_ws(i2400m, roq, sn + 1);
i2400m_roq_log_add(i2400m, roq, I2400M_RO_TYPE_PACKET_WS,
@@ -1321,9 +1321,10 @@ void i2400m_unknown_barker(struct i2400m *i2400m,
8, 4, buf, 64, 0);
printk(KERN_ERR "%s... (only first 64 bytes "
"dumped)\n", prefix);
- } else
+ } else {
print_hex_dump(KERN_ERR, prefix, DUMP_PREFIX_OFFSET,
8, 4, buf, size, 0);
+ }
}
EXPORT_SYMBOL(i2400m_unknown_barker);

--
2.25.1
\
 
 \ /
  Last update: 2021-02-07 21:35    [W:0.049 / U:2.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site