* [PATCH] net: ch9200: use BIT macro for bitmask constants
@ 2025-06-06 16:07 Qasim Ijaz
2025-06-06 16:46 ` Andrew Lunn
0 siblings, 1 reply; 4+ messages in thread
From: Qasim Ijaz @ 2025-06-06 16:07 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni
Cc: linux-usb, netdev, linux-kernel
Use the BIT() macro for bitmask constants.
Signed-off-by: Qasim Ijaz <qasdev00@gmail.com>
---
drivers/net/usb/ch9200.c | 50 ++++++++++++++++++++--------------------
1 file changed, 25 insertions(+), 25 deletions(-)
diff --git a/drivers/net/usb/ch9200.c b/drivers/net/usb/ch9200.c
index a206ffa76f1b..bfe27a7dcbb4 100644
--- a/drivers/net/usb/ch9200.c
+++ b/drivers/net/usb/ch9200.c
@@ -59,42 +59,42 @@
*
* Note: bits 13 and 15 are reserved
*/
-#define LOOPBACK (0x01 << 14)
-#define BASE100X (0x01 << 12)
-#define MBPS_10 (0x01 << 11)
-#define DUPLEX_MODE (0x01 << 10)
-#define PAUSE_FRAME (0x01 << 9)
-#define PROMISCUOUS (0x01 << 8)
-#define MULTICAST (0x01 << 7)
-#define BROADCAST (0x01 << 6)
-#define HASH (0x01 << 5)
-#define APPEND_PAD (0x01 << 4)
-#define APPEND_CRC (0x01 << 3)
-#define TRANSMITTER_ACTION (0x01 << 2)
-#define RECEIVER_ACTION (0x01 << 1)
-#define DMA_ACTION (0x01 << 0)
+#define LOOPBACK BIT(14)
+#define BASE100X BIT(12)
+#define MBPS_10 BIT(11)
+#define DUPLEX_MODE BIT(10)
+#define PAUSE_FRAME BIT(9)
+#define PROMISCUOUS BIT(8)
+#define MULTICAST BIT(7)
+#define BROADCAST BIT(6)
+#define HASH BIT(5)
+#define APPEND_PAD BIT(4)
+#define APPEND_CRC BIT(3)
+#define TRANSMITTER_ACTION BIT(2)
+#define RECEIVER_ACTION BIT(1)
+#define DMA_ACTION BIT(0)
/* Status register bits
*
* Note: bits 7-15 are reserved
*/
-#define ALIGNMENT (0x01 << 6)
-#define FIFO_OVER_RUN (0x01 << 5)
-#define FIFO_UNDER_RUN (0x01 << 4)
-#define RX_ERROR (0x01 << 3)
-#define RX_COMPLETE (0x01 << 2)
-#define TX_ERROR (0x01 << 1)
-#define TX_COMPLETE (0x01 << 0)
+#define ALIGNMENT BIT(6)
+#define FIFO_OVER_RUN BIT(5)
+#define FIFO_UNDER_RUN BIT(4)
+#define RX_ERROR BIT(3)
+#define RX_COMPLETE BIT(2)
+#define TX_ERROR BIT(1)
+#define TX_COMPLETE BIT(0)
/* FIFO depth register bits
*
* Note: bits 6 and 14 are reserved
*/
-#define ETH_TXBD (0x01 << 15)
-#define ETN_TX_FIFO_DEPTH (0x01 << 8)
-#define ETH_RXBD (0x01 << 7)
-#define ETH_RX_FIFO_DEPTH (0x01 << 0)
+#define ETH_TXBD BIT(15)
+#define ETN_TX_FIFO_DEPTH BIT(8)
+#define ETH_RXBD BIT(7)
+#define ETH_RX_FIFO_DEPTH BIT(0)
static int control_read(struct usbnet *dev,
unsigned char request, unsigned short value,
--
2.39.5
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] net: ch9200: use BIT macro for bitmask constants
2025-06-06 16:07 [PATCH] net: ch9200: use BIT macro for bitmask constants Qasim Ijaz
@ 2025-06-06 16:46 ` Andrew Lunn
2025-06-06 17:19 ` Qasim Ijaz
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Lunn @ 2025-06-06 16:46 UTC (permalink / raw)
To: Qasim Ijaz
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, linux-usb, netdev,
linux-kernel
On Fri, Jun 06, 2025 at 05:07:23PM +0100, Qasim Ijaz wrote:
> Use the BIT() macro for bitmask constants.
What you fail to answer is the question 'Why?'.
This driver is old and stable. It has in fact had no feature
development work done on it since 2015. All the patches since then
have been tree wide sort of changes.
Most would consider your change just pointless churn. It does not fix
anything which is broken. So why make this change?
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html#clean-up-patches
Do you have the hardware? If you do, maybe consider porting it to
phylib?
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: ch9200: use BIT macro for bitmask constants
2025-06-06 16:46 ` Andrew Lunn
@ 2025-06-06 17:19 ` Qasim Ijaz
2025-06-06 19:00 ` Andrew Lunn
0 siblings, 1 reply; 4+ messages in thread
From: Qasim Ijaz @ 2025-06-06 17:19 UTC (permalink / raw)
To: Andrew Lunn
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, linux-usb, netdev,
linux-kernel
On Fri, Jun 06, 2025 at 06:46:25PM +0200, Andrew Lunn wrote:
> On Fri, Jun 06, 2025 at 05:07:23PM +0100, Qasim Ijaz wrote:
> > Use the BIT() macro for bitmask constants.
>
> What you fail to answer is the question 'Why?'.
I made this change mainly as a small clean-up, it makes the code a tad
bit easier to read.
>
> This driver is old and stable. It has in fact had no feature
> development work done on it since 2015. All the patches since then
> have been tree wide sort of changes.
>
> Most would consider your change just pointless churn. It does not fix
> anything which is broken. So why make this change?
Yea that makes sense.
>
> https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html#clean-up-patches
Ah i see thank you, I will keep this in mind next time.
>
> Do you have the hardware? If you do, maybe consider porting it to
> phylib?
>
I don't, I did try to buy it but after searching for it but I couldn't
find it anywhere. I do however have the hardware for the this:
https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/usb/dm9601.c
Would the phylib porting apply to this too? If so I would love to work
on it.
Thanks
Qasim
> Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] net: ch9200: use BIT macro for bitmask constants
2025-06-06 17:19 ` Qasim Ijaz
@ 2025-06-06 19:00 ` Andrew Lunn
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Lunn @ 2025-06-06 19:00 UTC (permalink / raw)
To: Qasim Ijaz
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, linux-usb, netdev,
linux-kernel
> I don't, I did try to buy it but after searching for it but I couldn't
> find it anywhere. I do however have the hardware for the this:
>
> https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/net/usb/dm9601.c
>
> Would the phylib porting apply to this too? If so I would love to work
> on it.
Yes, please do work on that. Having the hardware makes a big
difference. And you are likely to learn a lot more with hardware you
can test with.
Andrew
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-06-06 19:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-06 16:07 [PATCH] net: ch9200: use BIT macro for bitmask constants Qasim Ijaz
2025-06-06 16:46 ` Andrew Lunn
2025-06-06 17:19 ` Qasim Ijaz
2025-06-06 19:00 ` Andrew Lunn
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).