All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] net: dsa: bcm_sf2: remove redundant variable off
@ 2018-07-04  6:54 ` Colin King
  0 siblings, 0 replies; 10+ messages in thread
From: Colin King @ 2018-07-04  6:54 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, David S . Miller, netdev
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Variable 'off' is being assigned but is never used hence it is
redundant and can be removed.

Cleans up clang warning:
warning: variable 'off' set but not used [-Wunused-but-set-variable]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/dsa/bcm_sf2.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 02e8982519ce..ac96ff40d37e 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -220,7 +220,7 @@ static void bcm_sf2_port_disable(struct dsa_switch *ds, int port,
 				 struct phy_device *phy)
 {
 	struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
-	u32 off, reg;
+	u32 reg;
 
 	if (priv->wol_ports_mask & (1 << port))
 		return;
@@ -231,11 +231,6 @@ static void bcm_sf2_port_disable(struct dsa_switch *ds, int port,
 	if (priv->int_phy_mask & 1 << port && priv->hw_params.num_gphy == 1)
 		bcm_sf2_gphy_enable_set(ds, false);
 
-	if (dsa_is_cpu_port(ds, port))
-		off = CORE_IMP_CTL;
-	else
-		off = CORE_G_PCTL_PORT(port);
-
 	b53_disable_port(ds, port, phy);
 
 	/* Power down the port memory */
-- 
2.17.1


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

* [PATCH] net: dsa: bcm_sf2: remove redundant variable off
@ 2018-07-04  6:54 ` Colin King
  0 siblings, 0 replies; 10+ messages in thread
From: Colin King @ 2018-07-04  6:54 UTC (permalink / raw)
  To: Andrew Lunn, Vivien Didelot, Florian Fainelli, David S . Miller, netdev
  Cc: kernel-janitors, linux-kernel

From: Colin Ian King <colin.king@canonical.com>

Variable 'off' is being assigned but is never used hence it is
redundant and can be removed.

Cleans up clang warning:
warning: variable 'off' set but not used [-Wunused-but-set-variable]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/dsa/bcm_sf2.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c
index 02e8982519ce..ac96ff40d37e 100644
--- a/drivers/net/dsa/bcm_sf2.c
+++ b/drivers/net/dsa/bcm_sf2.c
@@ -220,7 +220,7 @@ static void bcm_sf2_port_disable(struct dsa_switch *ds, int port,
 				 struct phy_device *phy)
 {
 	struct bcm_sf2_priv *priv = bcm_sf2_to_priv(ds);
-	u32 off, reg;
+	u32 reg;
 
 	if (priv->wol_ports_mask & (1 << port))
 		return;
@@ -231,11 +231,6 @@ static void bcm_sf2_port_disable(struct dsa_switch *ds, int port,
 	if (priv->int_phy_mask & 1 << port && priv->hw_params.num_gphy = 1)
 		bcm_sf2_gphy_enable_set(ds, false);
 
-	if (dsa_is_cpu_port(ds, port))
-		off = CORE_IMP_CTL;
-	else
-		off = CORE_G_PCTL_PORT(port);
-
 	b53_disable_port(ds, port, phy);
 
 	/* Power down the port memory */
-- 
2.17.1


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

* Re: [PATCH] net: dsa: bcm_sf2: remove redundant variable off
  2018-07-04  6:54 ` Colin King
@ 2018-07-04 13:40   ` David Miller
  -1 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2018-07-04 13:40 UTC (permalink / raw)
  To: colin.king
  Cc: andrew, vivien.didelot, f.fainelli, netdev, kernel-janitors,
	linux-kernel

From: Colin King <colin.king@canonical.com>
Date: Wed,  4 Jul 2018 07:54:36 +0100

> From: Colin Ian King <colin.king@canonical.com>
> 
> Variable 'off' is being assigned but is never used hence it is
> redundant and can be removed.
> 
> Cleans up clang warning:
> warning: variable 'off' set but not used [-Wunused-but-set-variable]
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied.

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

* Re: [PATCH] net: dsa: bcm_sf2: remove redundant variable off
@ 2018-07-04 13:40   ` David Miller
  0 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2018-07-04 13:40 UTC (permalink / raw)
  To: colin.king
  Cc: andrew, vivien.didelot, f.fainelli, netdev, kernel-janitors,
	linux-kernel

From: Colin King <colin.king@canonical.com>
Date: Wed,  4 Jul 2018 07:54:36 +0100

> From: Colin Ian King <colin.king@canonical.com>
> 
> Variable 'off' is being assigned but is never used hence it is
> redundant and can be removed.
> 
> Cleans up clang warning:
> warning: variable 'off' set but not used [-Wunused-but-set-variable]
> 
> Signed-off-by: Colin Ian King <colin.king@canonical.com>

Applied.

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

* Re: [PATCH] net: dsa: bcm_sf2: remove redundant variable off
  2018-07-04  6:54 ` Colin King
@ 2018-07-04 14:25   ` Andrew Lunn
  -1 siblings, 0 replies; 10+ messages in thread
From: Andrew Lunn @ 2018-07-04 14:25 UTC (permalink / raw)
  To: Colin King
  Cc: Vivien Didelot, Florian Fainelli, David S . Miller, netdev,
	kernel-janitors, linux-kernel

Hi Florian

I this a bug? It seems to be a result of moving to
b53_disable_port() in f86ad77faf.

Before you would handle the CPU port differently than a normal
port. After this change, there is no difference?

      Andrew

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

* Re: [PATCH] net: dsa: bcm_sf2: remove redundant variable off
@ 2018-07-04 14:25   ` Andrew Lunn
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Lunn @ 2018-07-04 14:25 UTC (permalink / raw)
  To: Colin King
  Cc: Vivien Didelot, Florian Fainelli, David S . Miller, netdev,
	kernel-janitors, linux-kernel

Hi Florian

I this a bug? It seems to be a result of moving to
b53_disable_port() in f86ad77faf.

Before you would handle the CPU port differently than a normal
port. After this change, there is no difference?

      Andrew

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

* Re: [PATCH] net: dsa: bcm_sf2: remove redundant variable off
  2018-07-04 14:25   ` Andrew Lunn
@ 2018-07-04 19:55     ` Florian Fainelli
  -1 siblings, 0 replies; 10+ messages in thread
From: Florian Fainelli @ 2018-07-04 19:55 UTC (permalink / raw)
  To: Andrew Lunn, Colin King
  Cc: Vivien Didelot, David S . Miller, netdev, kernel-janitors, linux-kernel

On July 4, 2018 4:25:20 PM GMT+02:00, Andrew Lunn <andrew@lunn.ch> wrote:
>Hi Florian
>
>I this a bug? It seems to be a result of moving to
>b53_disable_port() in f86ad77faf.
>
>Before you would handle the CPU port differently than a normal
>port. After this change, there is no difference?

This looks like a big indeed, I will check that next week.

-- 
Florian

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

* Re: [PATCH] net: dsa: bcm_sf2: remove redundant variable off
@ 2018-07-04 19:55     ` Florian Fainelli
  0 siblings, 0 replies; 10+ messages in thread
From: Florian Fainelli @ 2018-07-04 19:55 UTC (permalink / raw)
  To: Andrew Lunn, Colin King
  Cc: Vivien Didelot, David S . Miller, netdev, kernel-janitors, linux-kernel

On July 4, 2018 4:25:20 PM GMT+02:00, Andrew Lunn <andrew@lunn.ch> wrote:
>Hi Florian
>
>I this a bug? It seems to be a result of moving to
>b53_disable_port() in f86ad77faf.
>
>Before you would handle the CPU port differently than a normal
>port. After this change, there is no difference?

This looks like a big indeed, I will check that next week.

-- 
Florian

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

* Re: [PATCH] net: dsa: bcm_sf2: remove redundant variable off
  2018-07-04 14:25   ` Andrew Lunn
@ 2018-07-09 16:10     ` Florian Fainelli
  -1 siblings, 0 replies; 10+ messages in thread
From: Florian Fainelli @ 2018-07-09 16:10 UTC (permalink / raw)
  To: Andrew Lunn, Colin King
  Cc: Vivien Didelot, David S . Miller, netdev, kernel-janitors, linux-kernel

Hi Andrew,

On 07/04/2018 07:25 AM, Andrew Lunn wrote:
> Hi Florian
> 
> I this a bug? It seems to be a result of moving to
> b53_disable_port() in f86ad77faf.
> 
> Before you would handle the CPU port differently than a normal
> port. After this change, there is no difference?

This is not a bug actually but it is not obvious because there was a
separate definition added in bcm_sf2_regs.h for port 8 named
CORE_IMP_CTL. The logic in b53_regs.h is:

#define B53_PORT_CTRL(i)                (0x00 + (i))

and due to the memory map used in bcm_sf2, that would translate into:

8 << 2 = 0x20 which is correct here and matches the definition of
CORE_IMP_CTL.

in fact, the new code is more correct because any port could be a DSA
CPU port, whereas before we assumed that port 8 == CPU port, which is
not necessarily true.

Thanks!
-- 
Florian

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

* Re: [PATCH] net: dsa: bcm_sf2: remove redundant variable off
@ 2018-07-09 16:10     ` Florian Fainelli
  0 siblings, 0 replies; 10+ messages in thread
From: Florian Fainelli @ 2018-07-09 16:10 UTC (permalink / raw)
  To: Andrew Lunn, Colin King
  Cc: Vivien Didelot, David S . Miller, netdev, kernel-janitors, linux-kernel

Hi Andrew,

On 07/04/2018 07:25 AM, Andrew Lunn wrote:
> Hi Florian
> 
> I this a bug? It seems to be a result of moving to
> b53_disable_port() in f86ad77faf.
> 
> Before you would handle the CPU port differently than a normal
> port. After this change, there is no difference?

This is not a bug actually but it is not obvious because there was a
separate definition added in bcm_sf2_regs.h for port 8 named
CORE_IMP_CTL. The logic in b53_regs.h is:

#define B53_PORT_CTRL(i)                (0x00 + (i))

and due to the memory map used in bcm_sf2, that would translate into:

8 << 2 = 0x20 which is correct here and matches the definition of
CORE_IMP_CTL.

in fact, the new code is more correct because any port could be a DSA
CPU port, whereas before we assumed that port 8 = CPU port, which is
not necessarily true.

Thanks!
-- 
Florian

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

end of thread, other threads:[~2018-07-09 16:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-04  6:54 [PATCH] net: dsa: bcm_sf2: remove redundant variable off Colin King
2018-07-04  6:54 ` Colin King
2018-07-04 13:40 ` David Miller
2018-07-04 13:40   ` David Miller
2018-07-04 14:25 ` Andrew Lunn
2018-07-04 14:25   ` Andrew Lunn
2018-07-04 19:55   ` Florian Fainelli
2018-07-04 19:55     ` Florian Fainelli
2018-07-09 16:10   ` Florian Fainelli
2018-07-09 16:10     ` Florian Fainelli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.