All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ethernet: cavium: octeon: Switch to using netdev_info().
@ 2017-10-23 16:43 Steven J. Hill
  2017-10-24  9:38 ` David Miller
  2017-10-25  6:41 ` kbuild test robot
  0 siblings, 2 replies; 4+ messages in thread
From: Steven J. Hill @ 2017-10-23 16:43 UTC (permalink / raw)
  To: netdev; +Cc: Steven J. Hill, David Daney

Signed-off-by: Steven J. Hill <Steven.Hill@cavium.com>
Signed-off-by: David Daney <david.daney@cavium.com>
---
 drivers/net/ethernet/cavium/octeon/octeon_mgmt.c | 25 +++++++++++-------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
index 2887bca..3bb8fbd 100644
--- a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
@@ -705,14 +705,15 @@ static int octeon_mgmt_ioctl_hwtstamp(struct net_device *netdev,
 			u64 clock_comp = (NSEC_PER_SEC << 32) /	octeon_get_io_clock_rate();
 			if (!ptp.s.ptp_en)
 				cvmx_write_csr(CVMX_MIO_PTP_CLOCK_COMP, clock_comp);
-			pr_info("PTP Clock: Using sclk reference at %lld Hz\n",
+			netdev_info(netdev,
+				"PTP Clock: Using sclk reference at %lld Hz\n",
 				(NSEC_PER_SEC << 32) / clock_comp);
 		} else {
 			/* The clock is already programmed to use a GPIO */
 			u64 clock_comp = cvmx_read_csr(CVMX_MIO_PTP_CLOCK_COMP);
-			pr_info("PTP Clock: Using GPIO %d at %lld Hz\n",
-				ptp.s.ext_clk_in,
-				(NSEC_PER_SEC << 32) / clock_comp);
+			netdev_info(netdev,
+				"PTP Clock: Using GPIO %d at %lld Hz\n",
+				ptp.s.ext_clk_in, (NSEC_PER_SEC << 32) / clock_comp);
 		}
 
 		/* Enable the clock if it wasn't done already */
@@ -925,16 +926,12 @@ static void octeon_mgmt_adjust_link(struct net_device *netdev)
 
 	spin_unlock_irqrestore(&p->lock, flags);
 
-	if (link_changed != 0) {
-		if (link_changed > 0) {
-			pr_info("%s: Link is up - %d/%s\n", netdev->name,
-				phydev->speed,
-				phydev->duplex == DUPLEX_FULL ?
-				"Full" : "Half");
-		} else {
-			pr_info("%s: Link is down\n", netdev->name);
-		}
-	}
+	if (link_changed != 0)
+		if (link_changed > 0)
+			netdev_info(netdev, "Link is up - %d/%s\n",
+				phydev->speed, phydev->duplex == DUPLEX_FULL ? "Full" : "Half");
+		else
+			netdev_info(netdev, "Link is down\n");
 }
 
 static int octeon_mgmt_init_phy(struct net_device *netdev)
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] ethernet: cavium: octeon: Switch to using netdev_info().
  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
  1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2017-10-24  9:38 UTC (permalink / raw)
  To: steven.hill; +Cc: netdev, david.daney

From: "Steven J. Hill" <steven.hill@cavium.com>
Date: Mon, 23 Oct 2017 11:43:25 -0500

> @@ -705,14 +705,15 @@ static int octeon_mgmt_ioctl_hwtstamp(struct net_device *netdev,
>  			u64 clock_comp = (NSEC_PER_SEC << 32) /	octeon_get_io_clock_rate();
>  			if (!ptp.s.ptp_en)
>  				cvmx_write_csr(CVMX_MIO_PTP_CLOCK_COMP, clock_comp);
> -			pr_info("PTP Clock: Using sclk reference at %lld Hz\n",
> +			netdev_info(netdev,
> +				"PTP Clock: Using sclk reference at %lld Hz\n",

Please get the argument alignment correct when you make changes like this.

For a function call, the arguments on the second and subsequent line of
arguments must start exactly at the first column after the openning
parenthesis of the call.

You must use the appropriate number of TAB then SPACE characters necessary
to achieve this.

Thank you.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ethernet: cavium: octeon: Switch to using netdev_info().
  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
  1 sibling, 1 reply; 4+ messages in thread
From: kbuild test robot @ 2017-10-25  6:41 UTC (permalink / raw)
  To: Steven J. Hill; +Cc: kbuild-all, netdev, Steven J. Hill, David Daney

[-- Attachment #1: Type: text/plain, Size: 2449 bytes --]

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	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 16794 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] ethernet: cavium: octeon: Switch to using netdev_info().
  2017-10-25  6:41 ` kbuild test robot
@ 2017-11-12  0:24   ` Joe Perches
  0 siblings, 0 replies; 4+ messages in thread
From: Joe Perches @ 2017-11-12  0:24 UTC (permalink / raw)
  To: kbuild test robot, Steven J. Hill; +Cc: kbuild-all, netdev, David Daney

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");

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-11-12  0:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.