summaryrefslogtreecommitdiff
path: root/drivers/net
diff options
context:
space:
mode:
authorClaudiu Beznea <claudiu.beznea@microchip.com>2020-07-02 12:05:59 +0300
committerDavid S. Miller <davem@davemloft.net>2020-07-03 00:22:00 +0300
commitb7ab39b35935982d8306e3a97c57d8a232968f86 (patch)
treeaa63a8bf536de51e65fb169544d62fef4fc3a94f /drivers/net
parentfec371f624632bfa6ae4374fdb6f885f9961c42d (diff)
downloadlinux-b7ab39b35935982d8306e3a97c57d8a232968f86.tar.xz
net: macb: use hweight32() to count set bits in queue_mask
Use hweight32() to count set bits in queue_mask. Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/cadence/macb_main.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 1bc2810f3dc4..7668b6ae8822 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -3482,8 +3482,6 @@ static void macb_probe_queues(void __iomem *mem,
unsigned int *queue_mask,
unsigned int *num_queues)
{
- unsigned int hw_q;
-
*queue_mask = 0x1;
*num_queues = 1;
@@ -3498,10 +3496,7 @@ static void macb_probe_queues(void __iomem *mem,
/* bit 0 is never set but queue 0 always exists */
*queue_mask |= readl_relaxed(mem + GEM_DCFG6) & 0xff;
-
- for (hw_q = 1; hw_q < MACB_MAX_QUEUES; ++hw_q)
- if (*queue_mask & (1 << hw_q))
- (*num_queues)++;
+ *num_queues = hweight32(*queue_mask);
}
static int macb_clk_init(struct platform_device *pdev, struct clk **pclk,