diff mbox series

net: ch9200: use BIT macro for bitmask constants

Message ID 20250606160723.12679-1-qasdev00@gmail.com
State New
Headers show
Series net: ch9200: use BIT macro for bitmask constants | expand

Commit Message

Qasim Ijaz June 6, 2025, 4:07 p.m. UTC
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(-)

Comments

Qasim Ijaz June 6, 2025, 5:19 p.m. UTC | #1
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
Andrew Lunn June 6, 2025, 7 p.m. UTC | #2
> 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
diff mbox series

Patch

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,