[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1509718281.15520.11.camel@perches.com>
Date: Fri, 03 Nov 2017 07:11:21 -0700
From: Joe Perches <joe@...ches.com>
To: Egil Hjelmeland <privat@...l-hjelmeland.no>, andrew@...n.ch,
vivien.didelot@...oirfairelinux.com, f.fainelli@...il.com,
netdev@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH net-next 4/5] net: dsa: lan9303: Remove unnecessary
parentheses
On Fri, 2017-11-03 at 11:55 +0100, Egil Hjelmeland wrote:
> Remove scripts/checkpatch.pl CHECKs by remove unnecessary parentheses
[]
> diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c
[]
> @@ -483,7 +483,7 @@ static int lan9303_detect_phy_setup(struct lan9303 *chip)
> return reg;
> }
>
> - if ((reg != 0) && (reg != 0xffff))
> + if (reg != 0 && reg != 0xffff)
> chip->phy_addr_sel_strap = 1;
> else
> chip->phy_addr_sel_strap = 0;
phy_addr_sel_strap is currently bool.
If this is to be changed, it should be set
true or false.
My preference would be:
chip->phy_addr_sel_strap = (reg != 0 && reg != 0xffff);
But perhaps its bool type should be converted
to int as this phy_addr_sel_strap is used as
int several times.
$ git grep phy_addr_sel_strap
drivers/net/dsa/lan9303-core.c: /* depending on the 'phy_addr_sel_strap' setting, the three phys are
drivers/net/dsa/lan9303-core.c: * 'phy_addr_sel_strap' setting directly, so we need a test, which
drivers/net/dsa/lan9303-core.c: * Special reg 18 of phy 3 reads as 0x0000, if 'phy_addr_sel_strap' is 0
drivers/net/dsa/lan9303-core.c: * 0x0000, which means 'phy_addr_sel_strap' is 1 and the IDs are 1-2-3.
drivers/net/dsa/lan9303-core.c: chip->phy_addr_sel_strap = 1;
drivers/net/dsa/lan9303-core.c: chip->phy_addr_sel_strap = 0;
drivers/net/dsa/lan9303-core.c: chip->phy_addr_sel_strap ? "1-2-3" : "0-1-2");
drivers/net/dsa/lan9303-core.c: int phy_base = chip->phy_addr_sel_strap;
drivers/net/dsa/lan9303-core.c: int phy_base = chip->phy_addr_sel_strap;
drivers/net/dsa/lan9303-core.c: if (port == chip->phy_addr_sel_strap) {
drivers/net/dsa/lan9303-core.c: lan9303_phy_write(ds, chip->phy_addr_sel_strap + port,
drivers/net/dsa/lan9303-core.c: chip->ds->phys_mii_mask = chip->phy_addr_sel_strap ? 0xe : 0x7;
include/linux/dsa/lan9303.h: bool phy_addr_sel_strap;
Powered by blists - more mailing lists