linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Egil Hjelmeland <privat@egil-hjelmeland.no>,
	andrew@lunn.ch, vivien.didelot@savoirfairelinux.com,
	f.fainelli@gmail.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 4/5] net: dsa: lan9303: Remove unnecessary parentheses
Date: Fri, 03 Nov 2017 07:11:21 -0700	[thread overview]
Message-ID: <1509718281.15520.11.camel@perches.com> (raw)
In-Reply-To: <20171103105553.16859-5-privat@egil-hjelmeland.no>

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;

  reply	other threads:[~2017-11-03 14:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-03 10:55 [PATCH net-next 0/5] net: dsa: lan9303: Linting Egil Hjelmeland
2017-11-03 10:55 ` [PATCH net-next 1/5] net: dsa: lan9303: Correct register names in comments Egil Hjelmeland
2017-11-03 10:55 ` [PATCH net-next 2/5] net: dsa: lan9303: Fix syntax errors in device tree examples Egil Hjelmeland
2017-11-03 10:55 ` [PATCH net-next 3/5] net: dsa: lan9303: Replace msleep(1) with usleep_range() Egil Hjelmeland
2017-11-03 10:55 ` [PATCH net-next 4/5] net: dsa: lan9303: Remove unnecessary parentheses Egil Hjelmeland
2017-11-03 14:11   ` Joe Perches [this message]
2017-11-03 14:35     ` Egil Hjelmeland
2017-11-03 14:54       ` Vivien Didelot
2017-11-06 12:35         ` Egil Hjelmeland
2017-11-06  9:46       ` Egil Hjelmeland
2017-11-03 10:55 ` [PATCH net-next 5/5] net: dsa: lan9303: Adjust indenting Egil Hjelmeland
2017-11-03 13:55 ` [PATCH net-next 0/5] net: dsa: lan9303: Linting Vivien Didelot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1509718281.15520.11.camel@perches.com \
    --to=joe@perches.com \
    --cc=andrew@lunn.ch \
    --cc=f.fainelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=privat@egil-hjelmeland.no \
    --cc=vivien.didelot@savoirfairelinux.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).