netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: kbuild test robot <lkp@intel.com>,
	"Steven J. Hill" <steven.hill@cavium.com>
Cc: kbuild-all@01.org, netdev@vger.kernel.org,
	David Daney <david.daney@cavium.com>
Subject: Re: [PATCH] ethernet: cavium: octeon: Switch to using netdev_info().
Date: Sat, 11 Nov 2017 16:24:22 -0800	[thread overview]
Message-ID: <1510446262.10883.54.camel@perches.com> (raw)
In-Reply-To: <201710251451.Vm3szNVP%fengguang.wu@intel.com>

On Wed, 2017-10-25 at 14:41 +0800, kbuild test robot wrote:
> Hi Steven,
> 
> [auto build test WARNING on net-next/master]
> [also build test WARNING on v4.14-rc6]
> [if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
> 
> url:    https://github.com/0day-ci/linux/commits/Steven-J-Hill/ethernet-cavium-octeon-Switch-to-using-netdev_info/20171024-071910
> config: mips-cavium_octeon_defconfig (attached as .config)
> compiler: mips64-linux-gnuabi64-gcc (Debian 6.1.1-9) 6.1.1 20160705
> reproduce:
>         wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>         chmod +x ~/bin/make.cross
>         # save the attached .config to linux build tree
>         make.cross ARCH=mips 
> 
> All warnings (new ones prefixed by >>):
> 
>    drivers/net/ethernet/cavium/octeon/octeon_mgmt.c: In function 'octeon_mgmt_adjust_link':
> > > drivers/net/ethernet/cavium/octeon/octeon_mgmt.c:929:5: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses]
> 
>      if (link_changed != 0)
>         ^
> 
> vim +/else +929 drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
> 
>    896	
>    897	static void octeon_mgmt_adjust_link(struct net_device *netdev)
>    898	{
>    899		struct octeon_mgmt *p = netdev_priv(netdev);
>    900		struct phy_device *phydev = netdev->phydev;
>    901		unsigned long flags;
>    902		int link_changed = 0;
>    903	
>    904		if (!phydev)
>    905			return;
>    906	
>    907		spin_lock_irqsave(&p->lock, flags);
>    908	
>    909	
>    910		if (!phydev->link && p->last_link)
>    911			link_changed = -1;
>    912	
>    913		if (phydev->link &&
>    914		    (p->last_duplex != phydev->duplex ||
>    915		     p->last_link != phydev->link ||
>    916		     p->last_speed != phydev->speed)) {
>    917			octeon_mgmt_disable_link(p);
>    918			link_changed = 1;
>    919			octeon_mgmt_update_link(p);
>    920			octeon_mgmt_enable_link(p);
>    921		}
>    922	
>    923		p->last_link = phydev->link;
>    924		p->last_speed = phydev->speed;
>    925		p->last_duplex = phydev->duplex;
>    926	
>    927		spin_unlock_irqrestore(&p->lock, flags);
>    928	
>  > 929		if (link_changed != 0)
>    930			if (link_changed > 0)
>    931				netdev_info(netdev, "Link is up - %d/%s\n",
>    932					phydev->speed, phydev->duplex == DUPLEX_FULL ? "Full" : "Half");
>    933			else
>    934				netdev_info(netdev, "Link is down\n");
>    935	}
>    936	

I think this would be better as

	if (!phydev_link) {
		if (p->last_link)
			link_changed = -1;
	} else if (p->last_duplex != phydev->duplex ||
		   p->last_link != phydev->link ||
		   p->last_speed != phydev->speed) {
		link_changed = 1;
		octeon_mgnt_disable_link(p);
		octeon_mgnt_update_link(p);
		octeon_mgnt_enable_link(p);
	}

	...

	if (link_changed > 0)
		netdev_info(netdev, "Link is up - %d/%s\n",
			    phydev->speed,
			    phydev->duplex == DUPLEX_FULL ? "Full" : "Half");
	else if (link_changed < 0)
		netdev_info(netdev, "Link is down\n");

      reply	other threads:[~2017-11-12  0:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-23 16:43 [PATCH] ethernet: cavium: octeon: Switch to using netdev_info() Steven J. Hill
2017-10-24  9:38 ` David Miller
2017-10-25  6:41 ` kbuild test robot
2017-11-12  0:24   ` Joe Perches [this message]

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=1510446262.10883.54.camel@perches.com \
    --to=joe@perches.com \
    --cc=david.daney@cavium.com \
    --cc=kbuild-all@01.org \
    --cc=lkp@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=steven.hill@cavium.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).