mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: dev.dragon@bk.ru
To: gregkh@linuxfoundation.org, joe@perches.com,
	devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Cc: dev.dragon@bk.ru
Subject: [96e8740] [PATCH 2/2] Staging: wimax: i2400m: some readability improvements.
Date: Sun,  7 Feb 2021 22:11:24 +0300	[thread overview]
Message-ID: <96e87403e3d3d825ea8fad6108aef905b71439b3.1612722827.git.dev.dragon@bk.ru> (raw)
In-Reply-To: <fb815f4d3d75cdb10add70378de1271bc8d6297e.camel@perches.com>

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


  reply	other threads:[~2021-02-07 20:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-31 20:42 [PATCH] Staging: wimax: i2400m: fixing several coding style issues dev.dragon
2021-02-01  4:16 ` Joe Perches
2021-02-07 19:11   ` dev.dragon [this message]
2021-02-08  6:49     ` [96e8740] [PATCH 2/2] Staging: wimax: i2400m: some readability improvements Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=96e87403e3d3d825ea8fad6108aef905b71439b3.1612722827.git.dev.dragon@bk.ru \
    --to=dev.dragon@bk.ru \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®