* Re: [PATCH v3] ethernet: tlan: Convert to use jiffies macro
2025-08-27 7:54 [PATCH v3] ethernet: tlan: Convert to use jiffies macro zhang.enpei
@ 2025-08-27 22:22 ` Jacob Keller
2025-08-28 17:27 ` Simon Horman
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Jacob Keller @ 2025-08-27 22:22 UTC (permalink / raw)
To: zhang.enpei, chessman
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
linux-kernel
[-- Attachment #1.1: Type: text/plain, Size: 1365 bytes --]
On 8/27/2025 12:54 AM, zhang.enpei@zte.com.cn wrote:
> From: Zhang Enpei <zhang.enpei@zte.com.cn>
>
> Use time_is_before_eq_jiffies macro instead of using jiffies directly to
> handle wraparound.
>
> Signed-off-by: Zhang Enpei <zhang.enpei@zte.com.cn>
> ---
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
> drivers/net/ethernet/ti/tlan.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/ti/tlan.c b/drivers/net/ethernet/ti/tlan.c
> index a55b0f951181..7c5e51284942 100644
> --- a/drivers/net/ethernet/ti/tlan.c
> +++ b/drivers/net/ethernet/ti/tlan.c
> @@ -1817,7 +1817,6 @@ static void tlan_timer(struct timer_list *t)
> {
> struct tlan_priv *priv = timer_container_of(priv, t, timer);
> struct net_device *dev = priv->dev;
> - u32 elapsed;
> unsigned long flags = 0;
>
> priv->timer.function = NULL;
> @@ -1844,8 +1843,7 @@ static void tlan_timer(struct timer_list *t)
> case TLAN_TIMER_ACTIVITY:
> spin_lock_irqsave(&priv->lock, flags);
> if (priv->timer.function == NULL) {
> - elapsed = jiffies - priv->timer_set_at;
> - if (elapsed >= TLAN_TIMER_ACT_DELAY) {
> + if (time_is_before_eq_jiffies(priv->timer_set_at + TLAN_TIMER_ACT_DELAY)) {
> tlan_dio_write8(dev->base_addr,
> TLAN_LED_REG, TLAN_LED_LINK);
> } else {
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v3] ethernet: tlan: Convert to use jiffies macro
2025-08-27 7:54 [PATCH v3] ethernet: tlan: Convert to use jiffies macro zhang.enpei
2025-08-27 22:22 ` Jacob Keller
@ 2025-08-28 17:27 ` Simon Horman
2026-08-16 0:35 ` kernel test robot
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Simon Horman @ 2025-08-28 17:27 UTC (permalink / raw)
To: zhang.enpei
Cc: chessman, andrew+netdev, davem, edumazet, kuba, pabeni, netdev,
linux-kernel
On Wed, Aug 27, 2025 at 03:54:55PM +0800, zhang.enpei@zte.com.cn wrote:
> From: Zhang Enpei <zhang.enpei@zte.com.cn>
>
> Use time_is_before_eq_jiffies macro instead of using jiffies directly to
> handle wraparound.
>
> Signed-off-by: Zhang Enpei <zhang.enpei@zte.com.cn>
Unfortunately W=1 builds fail with this patch.
GCC 15.1.o says:
In file included from ./include/linux/bitops.h:7,
from ./include/linux/kernel.h:23,
from ./include/linux/cpumask.h:11,
from ./include/linux/alloc_tag.h:13,
from ./include/linux/percpu.h:5,
from ./include/linux/context_tracking_state.h:5,
from ./include/linux/hardirq.h:5,
from drivers/net/ethernet/ti/tlan.c:32:
drivers/net/ethernet/ti/tlan.c: In function 'tlan_timer':
./include/linux/typecheck.h:12:25: warning: comparison of distinct pointer types lacks a cast [-Wcompare-distinct-pointer-types]
12 | (void)(&__dummy == &__dummy2); \
| ^~
./include/linux/jiffies.h:149:10: note: in expansion of macro 'typecheck'
149 | typecheck(unsigned long, b) && \
| ^~~~~~~~~
./include/linux/jiffies.h:292:38: note: in expansion of macro 'time_after_eq'
292 | #define time_is_before_eq_jiffies(a) time_after_eq(jiffies, a)
| ^~~~~~~~~~~~~
drivers/net/ethernet/ti/tlan.c:1846:29: note: in expansion of macro 'time_is_before_eq_jiffies'
1846 | if (time_is_before_eq_jiffies(priv->timer_set_at + TLAN_TIMER_ACT_DELAY)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~
--
pw-bot: changes-requested
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v3] ethernet: tlan: Convert to use jiffies macro
2025-08-27 7:54 [PATCH v3] ethernet: tlan: Convert to use jiffies macro zhang.enpei
2025-08-27 22:22 ` Jacob Keller
2025-08-28 17:27 ` Simon Horman
@ 2026-08-16 0:35 ` kernel test robot
2026-08-16 3:56 ` kernel test robot
2026-08-16 11:13 ` kernel test robot
4 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2026-08-16 0:35 UTC (permalink / raw)
To: zhang.enpei, chessman
Cc: llvm, oe-kbuild-all, andrew+netdev, davem, edumazet, kuba, pabeni,
netdev, linux-kernel
Hi,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net-next/main]
[also build test WARNING on net/main linus/master v7.2-rc7 next-20260721]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/zhang-enpei-zte-com-cn/ethernet-tlan-Convert-to-use-jiffies-macro/20260813-185229
base: net-next/main
patch link: https://lore.kernel.org/r/20250827155455583-PdvmDYA9SD3J37_XRza5%40zte.com.cn
patch subject: [PATCH v3] ethernet: tlan: Convert to use jiffies macro
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260816/202608160257.LKzb3DiV-lkp@intel.com/config)
compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260816/202608160257.LKzb3DiV-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202608160257.LKzb3DiV-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/net/ethernet/ti/tlan.c:1833:8: warning: comparison of distinct pointer types ('unsigned long *' and 'typeof (priv->timer_set_at + (250 / 10)) *' (aka 'unsigned int *')) [-Wcompare-distinct-pointer-types]
1833 | if (time_is_before_eq_jiffies(priv->timer_set_at + TLAN_TIMER_ACT_DELAY)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/jiffies.h:288:38: note: expanded from macro 'time_is_before_eq_jiffies'
288 | #define time_is_before_eq_jiffies(a) time_after_eq(jiffies, a)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/jiffies.h:145:3: note: expanded from macro 'time_after_eq'
145 | typecheck(unsigned long, b) && \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/typecheck.h:12:18: note: expanded from macro 'typecheck'
12 | (void)(&__dummy == &__dummy2); \
| ~~~~~~~~ ^ ~~~~~~~~~
drivers/net/ethernet/ti/tlan.c:2057:7: warning: variable 'def_tx' set but not used [-Wunused-but-set-variable]
2057 | u32 def_tx, crc, code;
| ^
2 warnings generated.
vim +1833 drivers/net/ethernet/ti/tlan.c
1771
1772
1773 /***************************************************************
1774 * tlan_timer
1775 *
1776 * Returns:
1777 * Nothing
1778 * Parms:
1779 * data A value given to add timer when
1780 * add_timer was called.
1781 *
1782 * This function handles timed functionality for the
1783 * TLAN driver. The two current timer uses are for
1784 * delaying for autonegotionation and driving the ACT LED.
1785 * - Autonegotiation requires being allowed about
1786 * 2 1/2 seconds before attempting to transmit a
1787 * packet. It would be a very bad thing to hang
1788 * the kernel this long, so the driver doesn't
1789 * allow transmission 'til after this time, for
1790 * certain PHYs. It would be much nicer if all
1791 * PHYs were interrupt-capable like the internal
1792 * PHY.
1793 * - The ACT LED, which shows adapter activity, is
1794 * driven by the driver, and so must be left on
1795 * for a short period to power up the LED so it
1796 * can be seen. This delay can be changed by
1797 * changing the TLAN_TIMER_ACT_DELAY in tlan.h,
1798 * if desired. 100 ms produces a slightly
1799 * sluggish response.
1800 *
1801 **************************************************************/
1802
1803 static void tlan_timer(struct timer_list *t)
1804 {
1805 struct tlan_priv *priv = timer_container_of(priv, t, timer);
1806 struct net_device *dev = priv->dev;
1807 unsigned long flags = 0;
1808
1809 priv->timer.function = NULL;
1810
1811 switch (priv->timer_type) {
1812 case TLAN_TIMER_PHY_PDOWN:
1813 tlan_phy_power_down(dev);
1814 break;
1815 case TLAN_TIMER_PHY_PUP:
1816 tlan_phy_power_up(dev);
1817 break;
1818 case TLAN_TIMER_PHY_RESET:
1819 tlan_phy_reset(dev);
1820 break;
1821 case TLAN_TIMER_PHY_START_LINK:
1822 tlan_phy_start_link(dev);
1823 break;
1824 case TLAN_TIMER_PHY_FINISH_AN:
1825 tlan_phy_finish_auto_neg(dev);
1826 break;
1827 case TLAN_TIMER_FINISH_RESET:
1828 tlan_finish_reset(dev);
1829 break;
1830 case TLAN_TIMER_ACTIVITY:
1831 spin_lock_irqsave(&priv->lock, flags);
1832 if (priv->timer.function == NULL) {
> 1833 if (time_is_before_eq_jiffies(priv->timer_set_at + TLAN_TIMER_ACT_DELAY)) {
1834 tlan_dio_write8(dev->base_addr,
1835 TLAN_LED_REG, TLAN_LED_LINK);
1836 } else {
1837 priv->timer.expires = priv->timer_set_at
1838 + TLAN_TIMER_ACT_DELAY;
1839 spin_unlock_irqrestore(&priv->lock, flags);
1840 add_timer(&priv->timer);
1841 break;
1842 }
1843 }
1844 spin_unlock_irqrestore(&priv->lock, flags);
1845 break;
1846 default:
1847 break;
1848 }
1849
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v3] ethernet: tlan: Convert to use jiffies macro
2025-08-27 7:54 [PATCH v3] ethernet: tlan: Convert to use jiffies macro zhang.enpei
` (2 preceding siblings ...)
2026-08-16 0:35 ` kernel test robot
@ 2026-08-16 3:56 ` kernel test robot
2026-08-16 11:13 ` kernel test robot
4 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2026-08-16 3:56 UTC (permalink / raw)
To: zhang.enpei, chessman
Cc: llvm, oe-kbuild-all, andrew+netdev, davem, edumazet, kuba, pabeni,
netdev, linux-kernel
Hi,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net-next/main]
[also build test WARNING on net/main linus/master v7.2-rc7 next-20260814]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/zhang-enpei-zte-com-cn/ethernet-tlan-Convert-to-use-jiffies-macro/20260813-185229
base: net-next/main
patch link: https://lore.kernel.org/r/20250827155455583-PdvmDYA9SD3J37_XRza5%40zte.com.cn
patch subject: [PATCH v3] ethernet: tlan: Convert to use jiffies macro
config: x86_64-kexec (https://download.01.org/0day-ci/archive/20260816/202608161140.4HTNVNNa-lkp@intel.com/config)
compiler: clang version 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260816/202608161140.4HTNVNNa-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202608161140.4HTNVNNa-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/net/ethernet/ti/tlan.c:1833:8: warning: comparison of distinct pointer types ('unsigned long *' and 'typeof (priv->timer_set_at + (250 / 10)) *' (aka 'unsigned int *')) [-Wcompare-distinct-pointer-types]
1833 | if (time_is_before_eq_jiffies(priv->timer_set_at + TLAN_TIMER_ACT_DELAY)) {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/jiffies.h:288:38: note: expanded from macro 'time_is_before_eq_jiffies'
288 | #define time_is_before_eq_jiffies(a) time_after_eq(jiffies, a)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/jiffies.h:145:3: note: expanded from macro 'time_after_eq'
145 | typecheck(unsigned long, b) && \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/typecheck.h:12:18: note: expanded from macro 'typecheck'
12 | (void)(&__dummy == &__dummy2); \
| ~~~~~~~~ ^ ~~~~~~~~~
drivers/net/ethernet/ti/tlan.c:2057:7: warning: variable 'def_tx' set but not used [-Wunused-but-set-variable]
2057 | u32 def_tx, crc, code;
| ^
2 warnings generated.
vim +1833 drivers/net/ethernet/ti/tlan.c
1771
1772
1773 /***************************************************************
1774 * tlan_timer
1775 *
1776 * Returns:
1777 * Nothing
1778 * Parms:
1779 * data A value given to add timer when
1780 * add_timer was called.
1781 *
1782 * This function handles timed functionality for the
1783 * TLAN driver. The two current timer uses are for
1784 * delaying for autonegotionation and driving the ACT LED.
1785 * - Autonegotiation requires being allowed about
1786 * 2 1/2 seconds before attempting to transmit a
1787 * packet. It would be a very bad thing to hang
1788 * the kernel this long, so the driver doesn't
1789 * allow transmission 'til after this time, for
1790 * certain PHYs. It would be much nicer if all
1791 * PHYs were interrupt-capable like the internal
1792 * PHY.
1793 * - The ACT LED, which shows adapter activity, is
1794 * driven by the driver, and so must be left on
1795 * for a short period to power up the LED so it
1796 * can be seen. This delay can be changed by
1797 * changing the TLAN_TIMER_ACT_DELAY in tlan.h,
1798 * if desired. 100 ms produces a slightly
1799 * sluggish response.
1800 *
1801 **************************************************************/
1802
1803 static void tlan_timer(struct timer_list *t)
1804 {
1805 struct tlan_priv *priv = timer_container_of(priv, t, timer);
1806 struct net_device *dev = priv->dev;
1807 unsigned long flags = 0;
1808
1809 priv->timer.function = NULL;
1810
1811 switch (priv->timer_type) {
1812 case TLAN_TIMER_PHY_PDOWN:
1813 tlan_phy_power_down(dev);
1814 break;
1815 case TLAN_TIMER_PHY_PUP:
1816 tlan_phy_power_up(dev);
1817 break;
1818 case TLAN_TIMER_PHY_RESET:
1819 tlan_phy_reset(dev);
1820 break;
1821 case TLAN_TIMER_PHY_START_LINK:
1822 tlan_phy_start_link(dev);
1823 break;
1824 case TLAN_TIMER_PHY_FINISH_AN:
1825 tlan_phy_finish_auto_neg(dev);
1826 break;
1827 case TLAN_TIMER_FINISH_RESET:
1828 tlan_finish_reset(dev);
1829 break;
1830 case TLAN_TIMER_ACTIVITY:
1831 spin_lock_irqsave(&priv->lock, flags);
1832 if (priv->timer.function == NULL) {
> 1833 if (time_is_before_eq_jiffies(priv->timer_set_at + TLAN_TIMER_ACT_DELAY)) {
1834 tlan_dio_write8(dev->base_addr,
1835 TLAN_LED_REG, TLAN_LED_LINK);
1836 } else {
1837 priv->timer.expires = priv->timer_set_at
1838 + TLAN_TIMER_ACT_DELAY;
1839 spin_unlock_irqrestore(&priv->lock, flags);
1840 add_timer(&priv->timer);
1841 break;
1842 }
1843 }
1844 spin_unlock_irqrestore(&priv->lock, flags);
1845 break;
1846 default:
1847 break;
1848 }
1849
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH v3] ethernet: tlan: Convert to use jiffies macro
2025-08-27 7:54 [PATCH v3] ethernet: tlan: Convert to use jiffies macro zhang.enpei
` (3 preceding siblings ...)
2026-08-16 3:56 ` kernel test robot
@ 2026-08-16 11:13 ` kernel test robot
4 siblings, 0 replies; 6+ messages in thread
From: kernel test robot @ 2026-08-16 11:13 UTC (permalink / raw)
To: zhang.enpei, chessman
Cc: oe-kbuild-all, andrew+netdev, davem, edumazet, kuba, pabeni,
netdev, linux-kernel
Hi,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net-next/main]
[also build test WARNING on net/main linus/master v7.2-rc7 next-20260814]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/zhang-enpei-zte-com-cn/ethernet-tlan-Convert-to-use-jiffies-macro/20260813-185229
base: net-next/main
patch link: https://lore.kernel.org/r/20250827155455583-PdvmDYA9SD3J37_XRza5%40zte.com.cn
patch subject: [PATCH v3] ethernet: tlan: Convert to use jiffies macro
config: i386-randconfig-063-20260816 (https://download.01.org/0day-ci/archive/20260816/202608161916.ywuToiQt-lkp@intel.com/config)
compiler: clang version 22.1.3 (https://github.com/llvm/llvm-project e9846648fd6183ee6d8cbdb4502213fcf902a211)
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260816/202608161916.ywuToiQt-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202608161916.ywuToiQt-lkp@intel.com/
sparse warnings: (new ones prefixed by >>)
>> drivers/net/ethernet/ti/tlan.c:1833:29: sparse: sparse: incompatible types in comparison expression (different type sizes):
drivers/net/ethernet/ti/tlan.c:1833:29: sparse: unsigned long *
drivers/net/ethernet/ti/tlan.c:1833:29: sparse: unsigned int *
vim +1833 drivers/net/ethernet/ti/tlan.c
1771
1772
1773 /***************************************************************
1774 * tlan_timer
1775 *
1776 * Returns:
1777 * Nothing
1778 * Parms:
1779 * data A value given to add timer when
1780 * add_timer was called.
1781 *
1782 * This function handles timed functionality for the
1783 * TLAN driver. The two current timer uses are for
1784 * delaying for autonegotionation and driving the ACT LED.
1785 * - Autonegotiation requires being allowed about
1786 * 2 1/2 seconds before attempting to transmit a
1787 * packet. It would be a very bad thing to hang
1788 * the kernel this long, so the driver doesn't
1789 * allow transmission 'til after this time, for
1790 * certain PHYs. It would be much nicer if all
1791 * PHYs were interrupt-capable like the internal
1792 * PHY.
1793 * - The ACT LED, which shows adapter activity, is
1794 * driven by the driver, and so must be left on
1795 * for a short period to power up the LED so it
1796 * can be seen. This delay can be changed by
1797 * changing the TLAN_TIMER_ACT_DELAY in tlan.h,
1798 * if desired. 100 ms produces a slightly
1799 * sluggish response.
1800 *
1801 **************************************************************/
1802
1803 static void tlan_timer(struct timer_list *t)
1804 {
1805 struct tlan_priv *priv = timer_container_of(priv, t, timer);
1806 struct net_device *dev = priv->dev;
1807 unsigned long flags = 0;
1808
1809 priv->timer.function = NULL;
1810
1811 switch (priv->timer_type) {
1812 case TLAN_TIMER_PHY_PDOWN:
1813 tlan_phy_power_down(dev);
1814 break;
1815 case TLAN_TIMER_PHY_PUP:
1816 tlan_phy_power_up(dev);
1817 break;
1818 case TLAN_TIMER_PHY_RESET:
1819 tlan_phy_reset(dev);
1820 break;
1821 case TLAN_TIMER_PHY_START_LINK:
1822 tlan_phy_start_link(dev);
1823 break;
1824 case TLAN_TIMER_PHY_FINISH_AN:
1825 tlan_phy_finish_auto_neg(dev);
1826 break;
1827 case TLAN_TIMER_FINISH_RESET:
1828 tlan_finish_reset(dev);
1829 break;
1830 case TLAN_TIMER_ACTIVITY:
1831 spin_lock_irqsave(&priv->lock, flags);
1832 if (priv->timer.function == NULL) {
> 1833 if (time_is_before_eq_jiffies(priv->timer_set_at + TLAN_TIMER_ACT_DELAY)) {
1834 tlan_dio_write8(dev->base_addr,
1835 TLAN_LED_REG, TLAN_LED_LINK);
1836 } else {
1837 priv->timer.expires = priv->timer_set_at
1838 + TLAN_TIMER_ACT_DELAY;
1839 spin_unlock_irqrestore(&priv->lock, flags);
1840 add_timer(&priv->timer);
1841 break;
1842 }
1843 }
1844 spin_unlock_irqrestore(&priv->lock, flags);
1845 break;
1846 default:
1847 break;
1848 }
1849
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
^ permalink raw reply [flat|nested] 6+ messages in thread