From: Colin King <hidden> Date: 2018-07-05 09:37:41
From: Colin Ian King <redacted>
Variables adv and lpa are being assigned but are never used hence they
are redundant and can be removed.
Cleans up clang warnings:
warning: variable 'lpa' set but not used [-Wunused-but-set-variable]
warning: variable 'adv' set but not used [-Wunused-but-set-variable]
Signed-off-by: Colin Ian King <redacted>
---
drivers/net/ethernet/sun/niu.c | 4 ----
1 file changed, 4 deletions(-)
@@ -1225,17 +1225,13 @@ static int link_status_1g_rgmii(struct niu *np, int *link_up_p)bmsr=err;if(bmsr&BMSR_LSTATUS){-u16adv,lpa;-err=mii_read(np,np->phy_addr,MII_ADVERTISE);if(err<0)gotoout;-adv=err;err=mii_read(np,np->phy_addr,MII_LPA);if(err<0)gotoout;-lpa=err;
I'm fairly sure we could get rid of the mii_read() calls as well.
I'm always concerned that removing the reads of H/W registers can affect
the behavior, so I left those in.
Colin
regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
@@ -1225,17 +1225,13 @@ static int link_status_1g_rgmii(struct niu *np, int *link_up_p)bmsr=err;if(bmsr&BMSR_LSTATUS){-u16adv,lpa;-err=mii_read(np,np->phy_addr,MII_ADVERTISE);if(err<0)gotoout;-adv=err;err=mii_read(np,np->phy_addr,MII_LPA);if(err<0)gotoout;-lpa=err;
I'm fairly sure we could get rid of the mii_read() calls as well.
I'm always concerned that removing the reads of H/W registers can affect
the behavior, so I left those in.
Yeah... That's true sometimes. Hence my "fairly sure" equivocation. I
looked to see if any of the original devs are around and it's been a
while since anyone worked on this driver.
When we remove these warnings it means that there is no chance that
someone will look at the code again and remove the unneeded mii_read()
calls. I'm 90% sure the reads are unnecessary.
regards,
dan carpenter
From: David Miller <davem@davemloft.net> Date: 2018-07-05 10:33:24
From: Colin King <redacted>
Date: Thu, 5 Jul 2018 10:37:32 +0100
From: Colin Ian King <redacted>
Variables adv and lpa are being assigned but are never used hence they
are redundant and can be removed.
Cleans up clang warnings:
warning: variable 'lpa' set but not used [-Wunused-but-set-variable]
warning: variable 'adv' set but not used [-Wunused-but-set-variable]
Signed-off-by: Colin Ian King <redacted>
I think you can safely remove the register reads too, so please
do so.
Thanks.
From: Colin Ian King <hidden> Date: 2018-07-05 10:50:09
On 05/07/18 11:33, David Miller wrote:
From: Colin King <redacted>
Date: Thu, 5 Jul 2018 10:37:32 +0100
quoted
From: Colin Ian King <redacted>
Variables adv and lpa are being assigned but are never used hence they
are redundant and can be removed.
Cleans up clang warnings:
warning: variable 'lpa' set but not used [-Wunused-but-set-variable]
warning: variable 'adv' set but not used [-Wunused-but-set-variable]
Signed-off-by: Colin Ian King <redacted>
I think you can safely remove the register reads too, so please
do so.
Just to clarify, just the MII_ADVERTISE and MII_LPA, or both these AND
also MII_ESTATUS too?
From: Andrew Lunn <andrew@lunn.ch> Date: 2018-07-05 13:54:09
On Thu, Jul 05, 2018 at 10:37:32AM +0100, Colin King wrote:
quoted hunk
From: Colin Ian King <redacted>
Variables adv and lpa are being assigned but are never used hence they
are redundant and can be removed.
Cleans up clang warnings:
warning: variable 'lpa' set but not used [-Wunused-but-set-variable]
warning: variable 'adv' set but not used [-Wunused-but-set-variable]
Signed-off-by: Colin Ian King <redacted>
---
drivers/net/ethernet/sun/niu.c | 4 ----
1 file changed, 4 deletions(-)
@@ -1225,17 +1225,13 @@ static int link_status_1g_rgmii(struct niu *np, int *link_up_p)bmsr=err;if(bmsr&BMSR_LSTATUS){-u16adv,lpa;-err=mii_read(np,np->phy_addr,MII_ADVERTISE);if(err<0)gotoout;-adv=err;err=mii_read(np,np->phy_addr,MII_LPA);if(err<0)gotoout;-lpa=err;err=mii_read(np,np->phy_addr,MII_ESTATUS);if(err<0)
What should really happen is something like:
common_adv = lpa & adv;
lp->active_speed = SPEED_10;
lp->active_duplex = DUPLEX_HALF;
if (common_adv_gb & (LPA_1000FULL | LPA_1000HALF)) {
lp->active_speed = SPEED_1000;
if (common_adv_gb & LPA_1000FULL)
lp->active_duplex = DUPLEX_FULL;
} else if (common_adv & (LPA_100FULL | LPA_100HALF)) {
lp->active_speed = SPEED_100;
if (common_adv & LPA_100FULL)
lp->active_duplex = DUPLEX_FULL;
} else
if (common_adv & LPA_10FULL)
lp->active_duplex = DUPLEX_FULL;
i.e. making use of the results of the autoneg to determine the link
speed and duplex, rather than just assuming it is 1G.
If i turn this into a real patch, does anybody have the hardware to
test it?
Andrew