linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: aoe: replace use of __constant_htons to htons
@ 2020-12-20 16:46 Amey Narkhede
  2020-12-20 19:35 ` David Laight
  0 siblings, 1 reply; 4+ messages in thread
From: Amey Narkhede @ 2020-12-20 16:46 UTC (permalink / raw)
  To: justin; +Cc: axboe, linux-block, linux-kernel, Amey Narkhede

The macro htons expands to __swab16 which has special
case for constants in little endian case. In big
endian case both __constant_htons and htons macros
expand to the same code. So, replace __constant_htons
with htons to get rid of the definition of __constant_htons
completely.

Signed-off-by: Amey Narkhede <ameynarkhede03@gmail.com>
---
 drivers/block/aoe/aoecmd.c | 2 +-
 drivers/block/aoe/aoenet.c | 3 +--
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c
index 313f0b946fe2..7a5374a57b55 100644
--- a/drivers/block/aoe/aoecmd.c
+++ b/drivers/block/aoe/aoecmd.c
@@ -69,7 +69,7 @@ new_skb(ulong len)
 		skb_reserve(skb, MAX_HEADER);
 		skb_reset_mac_header(skb);
 		skb_reset_network_header(skb);
-		skb->protocol = __constant_htons(ETH_P_AOE);
+		skb->protocol = htons(ETH_P_AOE);
 		skb_checksum_none_assert(skb);
 	}
 	return skb;
diff --git a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c
index 63773a90581d..2532e35774e0 100644
--- a/drivers/block/aoe/aoenet.c
+++ b/drivers/block/aoe/aoenet.c
@@ -192,7 +192,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt,
 }

 static struct packet_type aoe_pt __read_mostly = {
-	.type = __constant_htons(ETH_P_AOE),
+	.type = htons(ETH_P_AOE),
 	.func = aoenet_rcv,
 };

@@ -220,4 +220,3 @@ aoenet_exit(void)
 	skb_queue_purge(&skbtxq);
 	dev_remove_pack(&aoe_pt);
 }
-
--
2.29.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread
* Re: [PATCH] block: aoe: replace use of __constant_htons to htons
@ 2020-12-20 20:56 'Amey Narkhede'
  0 siblings, 0 replies; 4+ messages in thread
From: 'Amey Narkhede' @ 2020-12-20 20:56 UTC (permalink / raw)
  Cc: linux-block, linux-kernel


[-- Attachment #0: Type: message/rfc822, Size: 1547 bytes --]

From: 'Amey Narkhede' <ameynarkhede03@gmail.com>
To: David Laight <David.Laight@aculab.com>
Subject: Re: [PATCH] block: aoe: replace use of __constant_htons to htons
Date: Mon, 21 Dec 2020 01:50:23 +0530
Message-ID: <20201220202019.j7x64yahapgilr7u@archlinux>

On 20/12/20 07:35PM, David Laight wrote:
> From: Amey Narkhede
> > Sent: 20 December 2020 16:46
> >
> > The macro htons expands to __swab16 which has special
> > case for constants in little endian case. In big
> > endian case both __constant_htons and htons macros
> > expand to the same code. So, replace __constant_htons
> > with htons to get rid of the definition of __constant_htons
> > completely.
> >
> ...
> >  static struct packet_type aoe_pt __read_mostly = {
> > -	.type = __constant_htons(ETH_P_AOE),
> > +	.type = htons(ETH_P_AOE),
> >  	.func = aoenet_rcv,
>
> Does this cause grief if someone is doing a COMPILE_TEST on LE?
>
> 	David
>
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> Registration No: 1397386 (Wales)
>
I did COMPILE_TEST on my x86_64 machine and it compiled
without any problems.
I assume that was the point or am I missing
something? I'm a beginner contributor so please
let me know if there any mistakes.

Amey

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

end of thread, other threads:[~2020-12-21 11:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-20 16:46 [PATCH] block: aoe: replace use of __constant_htons to htons Amey Narkhede
2020-12-20 19:35 ` David Laight
     [not found]   ` <20201220202019.j7x64yahapgilr7u@archlinux>
     [not found]     ` <c5df63bdc5a94ebdac9505a64f2cece5@AcuMS.aculab.com>
2020-12-21 11:03       ` 'Amey Narkhede'
2020-12-20 20:56 'Amey Narkhede'

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).