linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] net: ksz884x: use time_before in netdev_open for compatibility and remove static variable
@ 2022-02-28 16:29 wudaemon
  2022-02-28 20:46 ` Jakub Kicinski
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: wudaemon @ 2022-02-28 16:29 UTC (permalink / raw)
  To: davem, kuba, m.grzeschik, chenhao288, arnd
  Cc: wudaemon, shenyang39, netdev, linux-kernel

use time_before instead of direct compare for compatibility and remove the static next_jiffies variable

Signed-off-by: wudaemon <wudaemon@163.com>
---
 drivers/net/ethernet/micrel/ksz884x.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c
index d024983815da..9d445f27abb8 100644
--- a/drivers/net/ethernet/micrel/ksz884x.c
+++ b/drivers/net/ethernet/micrel/ksz884x.c
@@ -5225,7 +5225,6 @@ static irqreturn_t netdev_intr(int irq, void *dev_id)
  * Linux network device functions
  */
 
-static unsigned long next_jiffies;
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
 static void netdev_netpoll(struct net_device *dev)
@@ -5361,7 +5360,7 @@ static int prepare_hardware(struct net_device *dev)
 	struct dev_info *hw_priv = priv->adapter;
 	struct ksz_hw *hw = &hw_priv->hw;
 	int rc = 0;
-
+	unsigned long next_jiffies = 0;
 	/* Remember the network device that requests interrupts. */
 	hw_priv->dev = dev;
 	rc = request_irq(dev->irq, netdev_intr, IRQF_SHARED, dev->name, dev);
@@ -5428,7 +5427,7 @@ static int netdev_open(struct net_device *dev)
 		if (rc)
 			return rc;
 		for (i = 0; i < hw->mib_port_cnt; i++) {
-			if (next_jiffies < jiffies)
+			if (time_before(next_jiffies, jiffies))
 				next_jiffies = jiffies + HZ * 2;
 			else
 				next_jiffies += HZ * 1;
@@ -6566,7 +6565,7 @@ static void mib_read_work(struct work_struct *work)
 	struct ksz_port_mib *mib;
 	int i;
 
-	next_jiffies = jiffies;
+	unsigned long next_jiffies = jiffies;
 	for (i = 0; i < hw->mib_port_cnt; i++) {
 		mib = &hw->port_mib[i];
 
-- 
2.25.1


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

* Re: [PATCH v2] net: ksz884x: use time_before in netdev_open for compatibility and remove static variable
  2022-02-28 16:29 [PATCH v2] net: ksz884x: use time_before in netdev_open for compatibility and remove static variable wudaemon
@ 2022-02-28 20:46 ` Jakub Kicinski
  2022-02-28 21:00 ` kernel test robot
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2022-02-28 20:46 UTC (permalink / raw)
  To: wudaemon
  Cc: davem, m.grzeschik, chenhao288, arnd, shenyang39, netdev, linux-kernel

On Mon, 28 Feb 2022 16:29:55 +0000 wudaemon wrote:
> use time_before instead of direct compare for compatibility and remove the static next_jiffies variable
> 
> Signed-off-by: wudaemon <wudaemon@163.com>

This does not build.

> diff --git a/drivers/net/ethernet/micrel/ksz884x.c b/drivers/net/ethernet/micrel/ksz884x.c
> index d024983815da..9d445f27abb8 100644
> --- a/drivers/net/ethernet/micrel/ksz884x.c
> +++ b/drivers/net/ethernet/micrel/ksz884x.c
> @@ -5225,7 +5225,6 @@ static irqreturn_t netdev_intr(int irq, void *dev_id)
>   * Linux network device functions
>   */
>  
> -static unsigned long next_jiffies;
>  
>  #ifdef CONFIG_NET_POLL_CONTROLLER
>  static void netdev_netpoll(struct net_device *dev)
> @@ -5361,7 +5360,7 @@ static int prepare_hardware(struct net_device *dev)
>  	struct dev_info *hw_priv = priv->adapter;
>  	struct ksz_hw *hw = &hw_priv->hw;
>  	int rc = 0;
> -
> +	unsigned long next_jiffies = 0;

Please keep an empty line between variables and code.
The variable declaration lines should be ordered longest to shortest.
next_jiffies can be initialized to jiffies.

>  	/* Remember the network device that requests interrupts. */
>  	hw_priv->dev = dev;
>  	rc = request_irq(dev->irq, netdev_intr, IRQF_SHARED, dev->name, dev);
> @@ -5428,7 +5427,7 @@ static int netdev_open(struct net_device *dev)
>  		if (rc)
>  			return rc;
>  		for (i = 0; i < hw->mib_port_cnt; i++) {
> -			if (next_jiffies < jiffies)
> +			if (time_before(next_jiffies, jiffies))
>  				next_jiffies = jiffies + HZ * 2;
>  			else
>  				next_jiffies += HZ * 1;
> @@ -6566,7 +6565,7 @@ static void mib_read_work(struct work_struct *work)
>  	struct ksz_port_mib *mib;
>  	int i;
>  
> -	next_jiffies = jiffies;
> +	unsigned long next_jiffies = jiffies;
>  	for (i = 0; i < hw->mib_port_cnt; i++) {
>  		mib = &hw->port_mib[i];
>  


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

* Re: [PATCH v2] net: ksz884x: use time_before in netdev_open for compatibility and remove static variable
  2022-02-28 16:29 [PATCH v2] net: ksz884x: use time_before in netdev_open for compatibility and remove static variable wudaemon
  2022-02-28 20:46 ` Jakub Kicinski
@ 2022-02-28 21:00 ` kernel test robot
  2022-02-28 21:21 ` kernel test robot
  2022-02-28 21:31 ` kernel test robot
  3 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2022-02-28 21:00 UTC (permalink / raw)
  To: wudaemon, davem, kuba, m.grzeschik, chenhao288, arnd
  Cc: llvm, kbuild-all, wudaemon, shenyang39, netdev, linux-kernel

Hi wudaemon,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]
[also build test ERROR on net/master soc/for-next linus/master v5.17-rc6 next-20220228]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/wudaemon/net-ksz884x-use-time_before-in-netdev_open-for-compatibility-and-remove-static-variable/20220301-003151
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git b42a738e409b62f38a15ce7530e8290b00f823a4
config: i386-randconfig-a013 (https://download.01.org/0day-ci/archive/20220301/202203010451.ORtLeJ28-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/5db9da911f33045f8dd202d40c20530211b48af0
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review wudaemon/net-ksz884x-use-time_before-in-netdev_open-for-compatibility-and-remove-static-variable/20220301-003151
        git checkout 5db9da911f33045f8dd202d40c20530211b48af0
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=i386 SHELL=/bin/bash drivers/net/ethernet/micrel/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/net/ethernet/micrel/ksz884x.c:3216:6: warning: variable 'change' set but not used [-Wunused-but-set-variable]
           int change = 0;
               ^
   drivers/net/ethernet/micrel/ksz884x.c:5363:16: warning: unused variable 'next_jiffies' [-Wunused-variable]
           unsigned long next_jiffies = 0;
                         ^
>> drivers/net/ethernet/micrel/ksz884x.c:5430:20: error: use of undeclared identifier 'next_jiffies'
                           if (time_before(next_jiffies, jiffies))
                                           ^
>> drivers/net/ethernet/micrel/ksz884x.c:5430:20: error: use of undeclared identifier 'next_jiffies'
   drivers/net/ethernet/micrel/ksz884x.c:5431:5: error: use of undeclared identifier 'next_jiffies'
                                   next_jiffies = jiffies + HZ * 2;
                                   ^
   drivers/net/ethernet/micrel/ksz884x.c:5433:5: error: use of undeclared identifier 'next_jiffies'
                                   next_jiffies += HZ * 1;
                                   ^
   drivers/net/ethernet/micrel/ksz884x.c:5434:31: error: use of undeclared identifier 'next_jiffies'
                           hw_priv->counter[i].time = next_jiffies;
                                                      ^
   2 warnings and 5 errors generated.


vim +/next_jiffies +5430 drivers/net/ethernet/micrel/ksz884x.c

  5397	
  5398	/**
  5399	 * netdev_open - open network device
  5400	 * @dev:	Network device.
  5401	 *
  5402	 * This function process the open operation of network device.  This is caused
  5403	 * by the user command "ifconfig ethX up."
  5404	 *
  5405	 * Return 0 if successful; otherwise an error code indicating failure.
  5406	 */
  5407	static int netdev_open(struct net_device *dev)
  5408	{
  5409		struct dev_priv *priv = netdev_priv(dev);
  5410		struct dev_info *hw_priv = priv->adapter;
  5411		struct ksz_hw *hw = &hw_priv->hw;
  5412		struct ksz_port *port = &priv->port;
  5413		int i;
  5414		int p;
  5415		int rc = 0;
  5416	
  5417		priv->multicast = 0;
  5418		priv->promiscuous = 0;
  5419	
  5420		/* Reset device statistics. */
  5421		memset(&dev->stats, 0, sizeof(struct net_device_stats));
  5422		memset((void *) port->counter, 0,
  5423			(sizeof(u64) * OID_COUNTER_LAST));
  5424	
  5425		if (!(hw_priv->opened)) {
  5426			rc = prepare_hardware(dev);
  5427			if (rc)
  5428				return rc;
  5429			for (i = 0; i < hw->mib_port_cnt; i++) {
> 5430				if (time_before(next_jiffies, jiffies))
  5431					next_jiffies = jiffies + HZ * 2;
  5432				else
  5433					next_jiffies += HZ * 1;
  5434				hw_priv->counter[i].time = next_jiffies;
  5435				hw->port_mib[i].state = media_disconnected;
  5436				port_init_cnt(hw, i);
  5437			}
  5438			if (hw->ksz_switch)
  5439				hw->port_mib[HOST_PORT].state = media_connected;
  5440			else {
  5441				hw_add_wol_bcast(hw);
  5442				hw_cfg_wol_pme(hw, 0);
  5443				hw_clr_wol_pme_status(&hw_priv->hw);
  5444			}
  5445		}
  5446		port_set_power_saving(port, false);
  5447	
  5448		for (i = 0, p = port->first_port; i < port->port_cnt; i++, p++) {
  5449			/*
  5450			 * Initialize to invalid value so that link detection
  5451			 * is done.
  5452			 */
  5453			hw->port_info[p].partner = 0xFF;
  5454			hw->port_info[p].state = media_disconnected;
  5455		}
  5456	
  5457		/* Need to open the port in multiple device interfaces mode. */
  5458		if (hw->dev_count > 1) {
  5459			port_set_stp_state(hw, port->first_port, STP_STATE_SIMPLE);
  5460			if (port->first_port > 0)
  5461				hw_add_addr(hw, dev->dev_addr);
  5462		}
  5463	
  5464		port_get_link_speed(port);
  5465		if (port->force_link)
  5466			port_force_link_speed(port);
  5467		else
  5468			port_set_link_speed(port);
  5469	
  5470		if (!(hw_priv->opened)) {
  5471			hw_setup_intr(hw);
  5472			hw_enable(hw);
  5473			hw_ena_intr(hw);
  5474	
  5475			if (hw->mib_port_cnt)
  5476				ksz_start_timer(&hw_priv->mib_timer_info,
  5477					hw_priv->mib_timer_info.period);
  5478		}
  5479	
  5480		hw_priv->opened++;
  5481	
  5482		ksz_start_timer(&priv->monitor_timer_info,
  5483			priv->monitor_timer_info.period);
  5484	
  5485		priv->media_state = port->linked->state;
  5486	
  5487		set_media_state(dev, media_connected);
  5488		netif_start_queue(dev);
  5489	
  5490		return 0;
  5491	}
  5492	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

* Re: [PATCH v2] net: ksz884x: use time_before in netdev_open for compatibility and remove static variable
  2022-02-28 16:29 [PATCH v2] net: ksz884x: use time_before in netdev_open for compatibility and remove static variable wudaemon
  2022-02-28 20:46 ` Jakub Kicinski
  2022-02-28 21:00 ` kernel test robot
@ 2022-02-28 21:21 ` kernel test robot
  2022-02-28 21:31 ` kernel test robot
  3 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2022-02-28 21:21 UTC (permalink / raw)
  To: wudaemon, davem, kuba, m.grzeschik, chenhao288, arnd
  Cc: kbuild-all, wudaemon, shenyang39, netdev, linux-kernel

Hi wudaemon,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]
[also build test ERROR on net/master soc/for-next linus/master v5.17-rc6 next-20220228]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/wudaemon/net-ksz884x-use-time_before-in-netdev_open-for-compatibility-and-remove-static-variable/20220301-003151
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git b42a738e409b62f38a15ce7530e8290b00f823a4
config: alpha-allyesconfig (https://download.01.org/0day-ci/archive/20220301/202203010501.zwejOIJA-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/5db9da911f33045f8dd202d40c20530211b48af0
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review wudaemon/net-ksz884x-use-time_before-in-netdev_open-for-compatibility-and-remove-static-variable/20220301-003151
        git checkout 5db9da911f33045f8dd202d40c20530211b48af0
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=alpha SHELL=/bin/bash

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/net/ethernet/micrel/ksz884x.c: In function 'prepare_hardware':
   drivers/net/ethernet/micrel/ksz884x.c:5363:23: warning: unused variable 'next_jiffies' [-Wunused-variable]
    5363 |         unsigned long next_jiffies = 0;
         |                       ^~~~~~~~~~~~
   In file included from include/linux/bitops.h:7,
                    from include/linux/kernel.h:22,
                    from include/linux/interrupt.h:6,
                    from drivers/net/ethernet/micrel/ksz884x.c:12:
   drivers/net/ethernet/micrel/ksz884x.c: In function 'netdev_open':
>> drivers/net/ethernet/micrel/ksz884x.c:5430:41: error: 'next_jiffies' undeclared (first use in this function)
    5430 |                         if (time_before(next_jiffies, jiffies))
         |                                         ^~~~~~~~~~~~
   include/linux/typecheck.h:11:16: note: in definition of macro 'typecheck'
      11 |         typeof(x) __dummy2; \
         |                ^
   include/linux/jiffies.h:108:33: note: in expansion of macro 'time_after'
     108 | #define time_before(a,b)        time_after(b,a)
         |                                 ^~~~~~~~~~
   drivers/net/ethernet/micrel/ksz884x.c:5430:29: note: in expansion of macro 'time_before'
    5430 |                         if (time_before(next_jiffies, jiffies))
         |                             ^~~~~~~~~~~
   drivers/net/ethernet/micrel/ksz884x.c:5430:41: note: each undeclared identifier is reported only once for each function it appears in
    5430 |                         if (time_before(next_jiffies, jiffies))
         |                                         ^~~~~~~~~~~~
   include/linux/typecheck.h:11:16: note: in definition of macro 'typecheck'
      11 |         typeof(x) __dummy2; \
         |                ^
   include/linux/jiffies.h:108:33: note: in expansion of macro 'time_after'
     108 | #define time_before(a,b)        time_after(b,a)
         |                                 ^~~~~~~~~~
   drivers/net/ethernet/micrel/ksz884x.c:5430:29: note: in expansion of macro 'time_before'
    5430 |                         if (time_before(next_jiffies, jiffies))
         |                             ^~~~~~~~~~~
   include/linux/typecheck.h:12:25: warning: comparison of distinct pointer types lacks a cast
      12 |         (void)(&__dummy == &__dummy2); \
         |                         ^~
   include/linux/jiffies.h:106:10: note: in expansion of macro 'typecheck'
     106 |          typecheck(unsigned long, b) && \
         |          ^~~~~~~~~
   include/linux/jiffies.h:108:33: note: in expansion of macro 'time_after'
     108 | #define time_before(a,b)        time_after(b,a)
         |                                 ^~~~~~~~~~
   drivers/net/ethernet/micrel/ksz884x.c:5430:29: note: in expansion of macro 'time_before'
    5430 |                         if (time_before(next_jiffies, jiffies))
         |                             ^~~~~~~~~~~


vim +/next_jiffies +5430 drivers/net/ethernet/micrel/ksz884x.c

  5397	
  5398	/**
  5399	 * netdev_open - open network device
  5400	 * @dev:	Network device.
  5401	 *
  5402	 * This function process the open operation of network device.  This is caused
  5403	 * by the user command "ifconfig ethX up."
  5404	 *
  5405	 * Return 0 if successful; otherwise an error code indicating failure.
  5406	 */
  5407	static int netdev_open(struct net_device *dev)
  5408	{
  5409		struct dev_priv *priv = netdev_priv(dev);
  5410		struct dev_info *hw_priv = priv->adapter;
  5411		struct ksz_hw *hw = &hw_priv->hw;
  5412		struct ksz_port *port = &priv->port;
  5413		int i;
  5414		int p;
  5415		int rc = 0;
  5416	
  5417		priv->multicast = 0;
  5418		priv->promiscuous = 0;
  5419	
  5420		/* Reset device statistics. */
  5421		memset(&dev->stats, 0, sizeof(struct net_device_stats));
  5422		memset((void *) port->counter, 0,
  5423			(sizeof(u64) * OID_COUNTER_LAST));
  5424	
  5425		if (!(hw_priv->opened)) {
  5426			rc = prepare_hardware(dev);
  5427			if (rc)
  5428				return rc;
  5429			for (i = 0; i < hw->mib_port_cnt; i++) {
> 5430				if (time_before(next_jiffies, jiffies))
  5431					next_jiffies = jiffies + HZ * 2;
  5432				else
  5433					next_jiffies += HZ * 1;
  5434				hw_priv->counter[i].time = next_jiffies;
  5435				hw->port_mib[i].state = media_disconnected;
  5436				port_init_cnt(hw, i);
  5437			}
  5438			if (hw->ksz_switch)
  5439				hw->port_mib[HOST_PORT].state = media_connected;
  5440			else {
  5441				hw_add_wol_bcast(hw);
  5442				hw_cfg_wol_pme(hw, 0);
  5443				hw_clr_wol_pme_status(&hw_priv->hw);
  5444			}
  5445		}
  5446		port_set_power_saving(port, false);
  5447	
  5448		for (i = 0, p = port->first_port; i < port->port_cnt; i++, p++) {
  5449			/*
  5450			 * Initialize to invalid value so that link detection
  5451			 * is done.
  5452			 */
  5453			hw->port_info[p].partner = 0xFF;
  5454			hw->port_info[p].state = media_disconnected;
  5455		}
  5456	
  5457		/* Need to open the port in multiple device interfaces mode. */
  5458		if (hw->dev_count > 1) {
  5459			port_set_stp_state(hw, port->first_port, STP_STATE_SIMPLE);
  5460			if (port->first_port > 0)
  5461				hw_add_addr(hw, dev->dev_addr);
  5462		}
  5463	
  5464		port_get_link_speed(port);
  5465		if (port->force_link)
  5466			port_force_link_speed(port);
  5467		else
  5468			port_set_link_speed(port);
  5469	
  5470		if (!(hw_priv->opened)) {
  5471			hw_setup_intr(hw);
  5472			hw_enable(hw);
  5473			hw_ena_intr(hw);
  5474	
  5475			if (hw->mib_port_cnt)
  5476				ksz_start_timer(&hw_priv->mib_timer_info,
  5477					hw_priv->mib_timer_info.period);
  5478		}
  5479	
  5480		hw_priv->opened++;
  5481	
  5482		ksz_start_timer(&priv->monitor_timer_info,
  5483			priv->monitor_timer_info.period);
  5484	
  5485		priv->media_state = port->linked->state;
  5486	
  5487		set_media_state(dev, media_connected);
  5488		netif_start_queue(dev);
  5489	
  5490		return 0;
  5491	}
  5492	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

* Re: [PATCH v2] net: ksz884x: use time_before in netdev_open for compatibility and remove static variable
  2022-02-28 16:29 [PATCH v2] net: ksz884x: use time_before in netdev_open for compatibility and remove static variable wudaemon
                   ` (2 preceding siblings ...)
  2022-02-28 21:21 ` kernel test robot
@ 2022-02-28 21:31 ` kernel test robot
  3 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2022-02-28 21:31 UTC (permalink / raw)
  To: wudaemon, davem, kuba, m.grzeschik, chenhao288, arnd
  Cc: kbuild-all, wudaemon, shenyang39, netdev, linux-kernel

Hi wudaemon,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on net-next/master]
[also build test ERROR on net/master soc/for-next linus/master v5.17-rc6 next-20220228]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/wudaemon/net-ksz884x-use-time_before-in-netdev_open-for-compatibility-and-remove-static-variable/20220301-003151
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git b42a738e409b62f38a15ce7530e8290b00f823a4
config: ia64-randconfig-r012-20220227 (https://download.01.org/0day-ci/archive/20220301/202203010549.CYZcqRXa-lkp@intel.com/config)
compiler: ia64-linux-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/5db9da911f33045f8dd202d40c20530211b48af0
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review wudaemon/net-ksz884x-use-time_before-in-netdev_open-for-compatibility-and-remove-static-variable/20220301-003151
        git checkout 5db9da911f33045f8dd202d40c20530211b48af0
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=ia64 SHELL=/bin/bash drivers/net/ethernet/micrel/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All error/warnings (new ones prefixed by >>):

   In file included from arch/ia64/include/asm/pgtable.h:153,
                    from include/linux/pgtable.h:6,
                    from arch/ia64/include/asm/uaccess.h:40,
                    from include/linux/uaccess.h:11,
                    from arch/ia64/include/asm/sections.h:11,
                    from include/linux/interrupt.h:21,
                    from drivers/net/ethernet/micrel/ksz884x.c:12:
   arch/ia64/include/asm/mmu_context.h: In function 'reload_context':
   arch/ia64/include/asm/mmu_context.h:127:48: warning: variable 'old_rr4' set but not used [-Wunused-but-set-variable]
     127 |         unsigned long rr0, rr1, rr2, rr3, rr4, old_rr4;
         |                                                ^~~~~~~
   drivers/net/ethernet/micrel/ksz884x.c: In function 'prepare_hardware':
   drivers/net/ethernet/micrel/ksz884x.c:5363:23: warning: unused variable 'next_jiffies' [-Wunused-variable]
    5363 |         unsigned long next_jiffies = 0;
         |                       ^~~~~~~~~~~~
   In file included from include/linux/bitops.h:7,
                    from include/linux/kernel.h:22,
                    from include/linux/interrupt.h:6,
                    from drivers/net/ethernet/micrel/ksz884x.c:12:
   drivers/net/ethernet/micrel/ksz884x.c: In function 'netdev_open':
>> drivers/net/ethernet/micrel/ksz884x.c:5430:41: error: 'next_jiffies' undeclared (first use in this function)
    5430 |                         if (time_before(next_jiffies, jiffies))
         |                                         ^~~~~~~~~~~~
   include/linux/typecheck.h:11:16: note: in definition of macro 'typecheck'
      11 |         typeof(x) __dummy2; \
         |                ^
   include/linux/jiffies.h:108:33: note: in expansion of macro 'time_after'
     108 | #define time_before(a,b)        time_after(b,a)
         |                                 ^~~~~~~~~~
   drivers/net/ethernet/micrel/ksz884x.c:5430:29: note: in expansion of macro 'time_before'
    5430 |                         if (time_before(next_jiffies, jiffies))
         |                             ^~~~~~~~~~~
   drivers/net/ethernet/micrel/ksz884x.c:5430:41: note: each undeclared identifier is reported only once for each function it appears in
    5430 |                         if (time_before(next_jiffies, jiffies))
         |                                         ^~~~~~~~~~~~
   include/linux/typecheck.h:11:16: note: in definition of macro 'typecheck'
      11 |         typeof(x) __dummy2; \
         |                ^
   include/linux/jiffies.h:108:33: note: in expansion of macro 'time_after'
     108 | #define time_before(a,b)        time_after(b,a)
         |                                 ^~~~~~~~~~
   drivers/net/ethernet/micrel/ksz884x.c:5430:29: note: in expansion of macro 'time_before'
    5430 |                         if (time_before(next_jiffies, jiffies))
         |                             ^~~~~~~~~~~
>> include/linux/typecheck.h:12:25: warning: comparison of distinct pointer types lacks a cast
      12 |         (void)(&__dummy == &__dummy2); \
         |                         ^~
   include/linux/jiffies.h:106:10: note: in expansion of macro 'typecheck'
     106 |          typecheck(unsigned long, b) && \
         |          ^~~~~~~~~
   include/linux/jiffies.h:108:33: note: in expansion of macro 'time_after'
     108 | #define time_before(a,b)        time_after(b,a)
         |                                 ^~~~~~~~~~
   drivers/net/ethernet/micrel/ksz884x.c:5430:29: note: in expansion of macro 'time_before'
    5430 |                         if (time_before(next_jiffies, jiffies))
         |                             ^~~~~~~~~~~


vim +/next_jiffies +5430 drivers/net/ethernet/micrel/ksz884x.c

  5397	
  5398	/**
  5399	 * netdev_open - open network device
  5400	 * @dev:	Network device.
  5401	 *
  5402	 * This function process the open operation of network device.  This is caused
  5403	 * by the user command "ifconfig ethX up."
  5404	 *
  5405	 * Return 0 if successful; otherwise an error code indicating failure.
  5406	 */
  5407	static int netdev_open(struct net_device *dev)
  5408	{
  5409		struct dev_priv *priv = netdev_priv(dev);
  5410		struct dev_info *hw_priv = priv->adapter;
  5411		struct ksz_hw *hw = &hw_priv->hw;
  5412		struct ksz_port *port = &priv->port;
  5413		int i;
  5414		int p;
  5415		int rc = 0;
  5416	
  5417		priv->multicast = 0;
  5418		priv->promiscuous = 0;
  5419	
  5420		/* Reset device statistics. */
  5421		memset(&dev->stats, 0, sizeof(struct net_device_stats));
  5422		memset((void *) port->counter, 0,
  5423			(sizeof(u64) * OID_COUNTER_LAST));
  5424	
  5425		if (!(hw_priv->opened)) {
  5426			rc = prepare_hardware(dev);
  5427			if (rc)
  5428				return rc;
  5429			for (i = 0; i < hw->mib_port_cnt; i++) {
> 5430				if (time_before(next_jiffies, jiffies))
  5431					next_jiffies = jiffies + HZ * 2;
  5432				else
  5433					next_jiffies += HZ * 1;
  5434				hw_priv->counter[i].time = next_jiffies;
  5435				hw->port_mib[i].state = media_disconnected;
  5436				port_init_cnt(hw, i);
  5437			}
  5438			if (hw->ksz_switch)
  5439				hw->port_mib[HOST_PORT].state = media_connected;
  5440			else {
  5441				hw_add_wol_bcast(hw);
  5442				hw_cfg_wol_pme(hw, 0);
  5443				hw_clr_wol_pme_status(&hw_priv->hw);
  5444			}
  5445		}
  5446		port_set_power_saving(port, false);
  5447	
  5448		for (i = 0, p = port->first_port; i < port->port_cnt; i++, p++) {
  5449			/*
  5450			 * Initialize to invalid value so that link detection
  5451			 * is done.
  5452			 */
  5453			hw->port_info[p].partner = 0xFF;
  5454			hw->port_info[p].state = media_disconnected;
  5455		}
  5456	
  5457		/* Need to open the port in multiple device interfaces mode. */
  5458		if (hw->dev_count > 1) {
  5459			port_set_stp_state(hw, port->first_port, STP_STATE_SIMPLE);
  5460			if (port->first_port > 0)
  5461				hw_add_addr(hw, dev->dev_addr);
  5462		}
  5463	
  5464		port_get_link_speed(port);
  5465		if (port->force_link)
  5466			port_force_link_speed(port);
  5467		else
  5468			port_set_link_speed(port);
  5469	
  5470		if (!(hw_priv->opened)) {
  5471			hw_setup_intr(hw);
  5472			hw_enable(hw);
  5473			hw_ena_intr(hw);
  5474	
  5475			if (hw->mib_port_cnt)
  5476				ksz_start_timer(&hw_priv->mib_timer_info,
  5477					hw_priv->mib_timer_info.period);
  5478		}
  5479	
  5480		hw_priv->opened++;
  5481	
  5482		ksz_start_timer(&priv->monitor_timer_info,
  5483			priv->monitor_timer_info.period);
  5484	
  5485		priv->media_state = port->linked->state;
  5486	
  5487		set_media_state(dev, media_connected);
  5488		netif_start_queue(dev);
  5489	
  5490		return 0;
  5491	}
  5492	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

end of thread, other threads:[~2022-02-28 21:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-28 16:29 [PATCH v2] net: ksz884x: use time_before in netdev_open for compatibility and remove static variable wudaemon
2022-02-28 20:46 ` Jakub Kicinski
2022-02-28 21:00 ` kernel test robot
2022-02-28 21:21 ` kernel test robot
2022-02-28 21:31 ` kernel test robot

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).