Skip to contentSkip to conversation

common.c:105 Variable 'gephy' is never used.

PATCH In review Ameen Ali 3 participants 5 messages Mar 13, 2015

Subsystems (3)
lore
Share & tools
lore

Ameen Ali

author
#0 lore raw

PATCH 7/7 common.c:105 Variable 'gephy' is never used.

Variable 'gephy' is assigned a value that is never used.

Signed-off-by <[email protected]>
---
 arch/arm/mach-dove/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-dove/common.c +1 -1
index 0d1a892..115a413 100644
@@ -113,7 +113,7 @@ static void __init dove_clk_init(void)
 	orion_clkdev_add(NULL, "orion_spi.1", tclk);
 	orion_clkdev_add(NULL, "orion_wdt", tclk);
 	orion_clkdev_add(NULL, "mv64xxx_i2c.0", tclk);
-
+        orion_clkdev_add(NULL,"mv643xx_eth_port.0",gephy);
 	orion_clkdev_add(NULL, "orion-ehci.0", usb0);
 	orion_clkdev_add(NULL, "orion-ehci.1", usb1);
 	orion_clkdev_add(NULL, "mv643xx_eth_port.0", ge);
Signature · 1 line
2.1.0
maintainer
#1 lore raw
Quoted 12 lines · Ameen Ali

Variable 'gephy' is assigned a value that is never used.

Signed-off-by <[email protected]>
---
 arch/arm/mach-dove/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-dove/common.c +0 -0
index 0d1a892..115a413 100644

arch/arm/mach-dove/common.c static void __init dove_clk_init(void) · line 116

Quoted 5 lines
arch/arm/mach-dove/common.c +1 -1
@@ -113,7 +113,7 @@ static void __init dove_clk_init(void)
 	orion_clkdev_add(NULL, "orion_spi.1", tclk);
 	orion_clkdev_add(NULL, "orion_wdt", tclk);
 	orion_clkdev_add(NULL, "mv64xxx_i2c.0", tclk);
-
+        orion_clkdev_add(NULL,"mv643xx_eth_port.0",gephy);

It looks like you have used spaces, not a tab?

Other than that, this looks sensible.

Andrew

Quoted 6 lines
arch/arm/mach-dove/common.c +0 -0
 	orion_clkdev_add(NULL, "orion-ehci.0", usb0);
 	orion_clkdev_add(NULL, "orion-ehci.1", usb1);
 	orion_clkdev_add(NULL, "mv643xx_eth_port.0", ge);
Signature · 1 line
2.1.0
#2 lore raw
In reply to Ameen Ali
Quoted 12 lines · Ameen Ali

Variable 'gephy' is assigned a value that is never used.

Signed-off-by <[email protected]>
---
 arch/arm/mach-dove/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-dove/common.c +0 -0
index 0d1a892..115a413 100644

arch/arm/mach-dove/common.c static void __init dove_clk_init(void) · line 116

Quoted 5 lines
arch/arm/mach-dove/common.c +1 -1
@@ -113,7 +113,7 @@ static void __init dove_clk_init(void)
 	orion_clkdev_add(NULL, "orion_spi.1", tclk);
 	orion_clkdev_add(NULL, "orion_wdt", tclk);
 	orion_clkdev_add(NULL, "mv64xxx_i2c.0", tclk);
-
+        orion_clkdev_add(NULL,"mv643xx_eth_port.0",gephy);

NAK. Just because some variable isn't read doesn't mean that you need to dream up some way to make it used.

In any case, this is wrong because it will duplicate this entry:

arch/arm/mach-dove/common.c static void __init dove_clk_init(void) · line 119

Quoted 1 line
arch/arm/mach-dove/common.c +0 -0
 	orion_clkdev_add(NULL, "mv643xx_eth_port.0", ge);

which means that 'gephy' will probably be returned instead of 'ge' for this device - and will cause the ethernet to stop working.

Please leave the code as it was and ignore this assigned-to-but-unused variable. Thanks.

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.
maintainer
#3 lore raw
Quoted 22 lines · Russell King - ARM Linux
Quoted 12 lines · Ameen Ali

Variable 'gephy' is assigned a value that is never used.

Signed-off-by <[email protected]>
---
 arch/arm/mach-dove/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-dove/common.c +0 -0
index 0d1a892..115a413 100644

arch/arm/mach-dove/common.c static void __init dove_clk_init(void) · line 116

Quoted 5 lines
arch/arm/mach-dove/common.c +1 -1
@@ -113,7 +113,7 @@ static void __init dove_clk_init(void)
 	orion_clkdev_add(NULL, "orion_spi.1", tclk);
 	orion_clkdev_add(NULL, "orion_wdt", tclk);
 	orion_clkdev_add(NULL, "mv64xxx_i2c.0", tclk);
-
+        orion_clkdev_add(NULL,"mv643xx_eth_port.0",gephy);

NAK. Just because some variable isn't read doesn't mean that you need to dream up some way to make it used.

Quoted 3 lines

In any case, this is wrong because it will duplicate this entry:

Quoted 1 line
arch/arm/mach-dove/common.c +0 -0
 	orion_clkdev_add(NULL, "mv643xx_eth_port.0", ge);

Hi Russell

Missed that. Sorry.

What happens in the DT world is that ge clock is a child of the gephy clock, so that when you enable the ge clock, it walks up towards the parent and enables the gephy clock.

I don't see anything like this in the legacy Dove world. Are you just relying on the bootloader turning on the phy and nothing turning it off?

Andrew

#4 lore raw
Quoted 31 lines · Andrew Lunn
Quoted 22 lines · Russell King - ARM Linux
Quoted 12 lines · Ameen Ali

Variable 'gephy' is assigned a value that is never used.

Signed-off-by <[email protected]>
---
 arch/arm/mach-dove/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-dove/common.c +0 -0
index 0d1a892..115a413 100644

arch/arm/mach-dove/common.c static void __init dove_clk_init(void) · line 116

Quoted 5 lines
arch/arm/mach-dove/common.c +1 -1
@@ -113,7 +113,7 @@ static void __init dove_clk_init(void)
 	orion_clkdev_add(NULL, "orion_spi.1", tclk);
 	orion_clkdev_add(NULL, "orion_wdt", tclk);
 	orion_clkdev_add(NULL, "mv64xxx_i2c.0", tclk);
-
+        orion_clkdev_add(NULL,"mv643xx_eth_port.0",gephy);

NAK. Just because some variable isn't read doesn't mean that you need to dream up some way to make it used.

Quoted 3 lines

In any case, this is wrong because it will duplicate this entry:

Quoted 1 line
arch/arm/mach-dove/common.c +0 -0
 	orion_clkdev_add(NULL, "mv643xx_eth_port.0", ge);

Hi Russell

Missed that. Sorry.

Quoted 7 lines

What happens in the DT world is that ge clock is a child of the gephy clock, so that when you enable the ge clock, it walks up towards the parent and enables the gephy clock.

I don't see anything like this in the legacy Dove world. Are you just relying on the bootloader turning on the phy and nothing turning it off?

See, this is why I hate these trivial patches - they waste people's time and create a load of unnecessary confusion where there's absolutely none needed.

Here's the legacy code:

        gephy = dove_register_gate("gephy", "tclk", CLOCK_GATING_BIT_GIGA_PHY);

Here, we have a gate controlled by the CLOCK_GATING_BIT_GIGA_PHY bit between the tclk, and gephy clock. This is immediately followed by:

        ge = dove_register_gate("ge", "gephy", CLOCK_GATING_BIT_GBE);

which is a gate controlled by the CLOCK_GATING_BIT_GBE bit between the gephy clock and the ge clock. This second clock is then registered for use by the ethernet device:

        orion_clkdev_add(NULL, "mv643xx_eth_port.0", ge);

If we look at clk_summary, we see:

 tclk                                    12           12   166666667          0 0
    gephy                                 1            1   166666667          0 0
       ge                                 1            1   166666667          0 0

which is the same relationship as in DT:

 tclk                                    13           13   166666667          0 0
    gephy                                 1            1   166666667          0 0
       ge                                 2            2   166666667          0 0

There is no problem here; this has been a complete waste of our time while we discuss this non-problem.

Signature · 2 lines
FTTC broadband for 0.8mile line: currently at 10.5Mbps down 400kbps up
according to speedtest.net.