netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next 0/2] net/ncsi: Use str_up_down to simplify the code
@ 2024-08-23  6:52 Hongbo Li
  2024-08-23  6:52 ` [PATCH -next 1/2] " Hongbo Li
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Hongbo Li @ 2024-08-23  6:52 UTC (permalink / raw)
  To: sam, davem, edumazet, kuba, pabeni; +Cc: lihongbo22, netdev

In commit a98ae7f045b2, str_up_down() helper is introduced to
return "up" or "down" string literal, so we can use it to
simplify the code and fix the coccinelle warning.

Hongbo Li (2):
  net/ncsi: Use str_up_down to simplify the code
  net/ncsi: Use str_up_down to simplify the code

 net/ncsi/ncsi-aen.c    | 2 +-
 net/ncsi/ncsi-manage.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH -next 1/2] net/ncsi: Use str_up_down to simplify the code
  2024-08-23  6:52 [PATCH -next 0/2] net/ncsi: Use str_up_down to simplify the code Hongbo Li
@ 2024-08-23  6:52 ` Hongbo Li
  2024-08-23  6:52 ` [PATCH -next 2/2] " Hongbo Li
  2024-08-23 16:21 ` [PATCH -next 0/2] " Simon Horman
  2 siblings, 0 replies; 5+ messages in thread
From: Hongbo Li @ 2024-08-23  6:52 UTC (permalink / raw)
  To: sam, davem, edumazet, kuba, pabeni; +Cc: lihongbo22, netdev

As str_up_down is the common helper to reback "up/down"
string, we can replace the target with it to simplify
the code and fix the coccinelle warning.

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
---
 net/ncsi/ncsi-manage.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ncsi/ncsi-manage.c b/net/ncsi/ncsi-manage.c
index 5ecf611c8820..13b4d393fb2d 100644
--- a/net/ncsi/ncsi-manage.c
+++ b/net/ncsi/ncsi-manage.c
@@ -1281,7 +1281,7 @@ static int ncsi_choose_active_channel(struct ncsi_dev_priv *ndp)
 				netdev_dbg(ndp->ndev.dev,
 					   "NCSI: Channel %u added to queue (link %s)\n",
 					   nc->id,
-					   ncm->data[2] & 0x1 ? "up" : "down");
+					   str_up_down(ncm->data[2] & 0x1));
 			}
 
 			spin_unlock_irqrestore(&nc->lock, cflags);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH -next 2/2] net/ncsi: Use str_up_down to simplify the code
  2024-08-23  6:52 [PATCH -next 0/2] net/ncsi: Use str_up_down to simplify the code Hongbo Li
  2024-08-23  6:52 ` [PATCH -next 1/2] " Hongbo Li
@ 2024-08-23  6:52 ` Hongbo Li
  2024-08-23 16:21 ` [PATCH -next 0/2] " Simon Horman
  2 siblings, 0 replies; 5+ messages in thread
From: Hongbo Li @ 2024-08-23  6:52 UTC (permalink / raw)
  To: sam, davem, edumazet, kuba, pabeni; +Cc: lihongbo22, netdev

As str_up_down is the common helper to reback "up/down"
string, we can replace the target with it to simplify
the code and fix the coccinelle warning.

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
---
 net/ncsi/ncsi-aen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ncsi/ncsi-aen.c b/net/ncsi/ncsi-aen.c
index 62fb1031763d..25814f06d7da 100644
--- a/net/ncsi/ncsi-aen.c
+++ b/net/ncsi/ncsi-aen.c
@@ -75,7 +75,7 @@ static int ncsi_aen_handler_lsc(struct ncsi_dev_priv *ndp,
 	has_link = !!(data & 0x1);
 
 	netdev_dbg(ndp->ndev.dev, "NCSI: LSC AEN - channel %u state %s\n",
-		   nc->id, data & 0x1 ? "up" : "down");
+		   nc->id, str_up_down(data & 0x1));
 
 	chained = !list_empty(&nc->link);
 	state = nc->state;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH -next 0/2] net/ncsi: Use str_up_down to simplify the code
  2024-08-23  6:52 [PATCH -next 0/2] net/ncsi: Use str_up_down to simplify the code Hongbo Li
  2024-08-23  6:52 ` [PATCH -next 1/2] " Hongbo Li
  2024-08-23  6:52 ` [PATCH -next 2/2] " Hongbo Li
@ 2024-08-23 16:21 ` Simon Horman
  2024-08-27  2:11   ` Hongbo Li
  2 siblings, 1 reply; 5+ messages in thread
From: Simon Horman @ 2024-08-23 16:21 UTC (permalink / raw)
  To: Hongbo Li; +Cc: sam, davem, edumazet, kuba, pabeni, netdev

On Fri, Aug 23, 2024 at 02:52:57PM +0800, Hongbo Li wrote:
> In commit a98ae7f045b2, str_up_down() helper is introduced to
> return "up" or "down" string literal, so we can use it to
> simplify the code and fix the coccinelle warning.

Hi Hongbo Li,

That commit hasn't propagated into net-next.
I guess these patches need to wait for that to happen.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH -next 0/2] net/ncsi: Use str_up_down to simplify the code
  2024-08-23 16:21 ` [PATCH -next 0/2] " Simon Horman
@ 2024-08-27  2:11   ` Hongbo Li
  0 siblings, 0 replies; 5+ messages in thread
From: Hongbo Li @ 2024-08-27  2:11 UTC (permalink / raw)
  To: Simon Horman; +Cc: sam, davem, edumazet, kuba, pabeni, netdev



On 2024/8/24 0:21, Simon Horman wrote:
> On Fri, Aug 23, 2024 at 02:52:57PM +0800, Hongbo Li wrote:
>> In commit a98ae7f045b2, str_up_down() helper is introduced to
>> return "up" or "down" string literal, so we can use it to
>> simplify the code and fix the coccinelle warning.
> 
> Hi Hongbo Li,
> 
> That commit hasn't propagated into net-next.
> I guess these patches need to wait for that to happen.

Thank you for reminding, I will send the patch into net-next.

Thanks,
Hongbo

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-08-27  2:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-23  6:52 [PATCH -next 0/2] net/ncsi: Use str_up_down to simplify the code Hongbo Li
2024-08-23  6:52 ` [PATCH -next 1/2] " Hongbo Li
2024-08-23  6:52 ` [PATCH -next 2/2] " Hongbo Li
2024-08-23 16:21 ` [PATCH -next 0/2] " Simon Horman
2024-08-27  2:11   ` Hongbo Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).