On Tue, May 05, 2020 at 10:41:26AM +0300, Grygorii Strashko wrote: > It's better if you send v2 not as reply to v1. Noted, thank you, and thank you for taking the time to review my patch. > just to clarify. After these two patches > - the PTP_1588_CLOCK can still be set to "M" > - which will cause TI_CPTS to be "M", > - but TI_CPSW will still be "Y". > > and all above will build and produce built-in CPSW without CPTS support > and cpts.ko which is loadable, but not functional. > > Sorry, I'm a little bit lost regarding the target you'are trying to achieve. > At least previously "imply PTP_1588_CLOCK" allowed to select properly PTP_1588_CLOCK > without modifying every defconfig. Well, I just wanted to squelch a WARN_ON(). As Arnd pointed out in [1], code that uses the stubbed cpts functions is supposed to gracefully handle receiving a null pointer. Splatting a warning is not graceful, and that's what I was trying to fix. But your question in [2] prompted me to consider whether it should be possible to build TI_CPTS without PTP_1588_CLOCK at all. I think the answer is no, so I tried to fix it, but you're right, it's still possible to end up with a nonfunctional module after my patch. If you prefer to revert, that's fine with me. Should I post a patch, or just ask David to revert? -- Clay [1]: https://lore.kernel.org/lkml/CAK8P3a22aSbpcVK-cZ6rhnPgbYEGU3z__G9xk1EexOPZd5Hmzw@xxxxxxxxxxxxxx/ [2]: https://lore.kernel.org/lkml/6fef3a00-6c18-b775-d1b4-dfd692261bd3@xxxxxx/ > > > Reported-by: kbuild test robot <lkp@xxxxxxxxx> > > Signed-off-by: Clay McClure <clay@xxxxxxxxxxx> > > --- > > Changes in v2: > > > > - Don't regenerate the defconfigs, just add PTP_1588_CLOCK. > > > > arch/arm/configs/keystone_defconfig | 1 + > > arch/arm/configs/omap2plus_defconfig | 1 + > > drivers/net/ethernet/ti/Kconfig | 13 ++++--------- > > drivers/net/ethernet/ti/Makefile | 2 +- > > drivers/net/ethernet/ti/cpsw_ethtool.c | 2 +- > > drivers/net/ethernet/ti/cpts.h | 3 +-- > > drivers/net/ethernet/ti/netcp_ethss.c | 10 +++++----- > > 7 files changed, 14 insertions(+), 18 deletions(-) > > > > diff --git a/arch/arm/configs/keystone_defconfig b/arch/arm/configs/keystone_defconfig > > index 11e2211f9007..84a3b055f253 100644 > > --- a/arch/arm/configs/keystone_defconfig > > +++ b/arch/arm/configs/keystone_defconfig > > @@ -147,6 +147,7 @@ CONFIG_I2C_DAVINCI=y > > CONFIG_SPI=y > > CONFIG_SPI_DAVINCI=y > > CONFIG_SPI_SPIDEV=y > > +CONFIG_PTP_1588_CLOCK=y > > CONFIG_PINCTRL_SINGLE=y > > CONFIG_GPIOLIB=y > > CONFIG_GPIO_SYSFS=y > > diff --git a/arch/arm/configs/omap2plus_defconfig b/arch/arm/configs/omap2plus_defconfig > > index 3cc3ca5fa027..8b83d4a5d309 100644 > > --- a/arch/arm/configs/omap2plus_defconfig > > +++ b/arch/arm/configs/omap2plus_defconfig > > @@ -274,6 +274,7 @@ CONFIG_SPI_TI_QSPI=m > > CONFIG_HSI=m > > CONFIG_OMAP_SSI=m > > CONFIG_SSI_PROTOCOL=m > > +CONFIG_PTP_1588_CLOCK=y > > CONFIG_PINCTRL_SINGLE=y > > CONFIG_DEBUG_GPIO=y > > CONFIG_GPIO_SYSFS=y > > diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig > > index 8e348780efb6..f3f8bb724294 100644 > > --- a/drivers/net/ethernet/ti/Kconfig > > +++ b/drivers/net/ethernet/ti/Kconfig > > @@ -77,23 +77,18 @@ config TI_CPSW_SWITCHDEV > > will be called cpsw_new. > > config TI_CPTS > > - bool "TI Common Platform Time Sync (CPTS) Support" > > + tristate "TI Common Platform Time Sync (CPTS) Support" > > depends on TI_CPSW || TI_KEYSTONE_NETCP || TI_CPSW_SWITCHDEV || COMPILE_TEST > > depends on COMMON_CLK > > - depends on POSIX_TIMERS > > + depends on PTP_1588_CLOCK > > > + default y if TI_CPSW=y || TI_KEYSTONE_NETCP=y || TI_CPSW_SWITCHDEV=y > > even with above statement it's possible to force TI_CPTS="M" while CPSW/NETCP="Y" > > > + default m > > I could be mistaken by above 2 lines seems can be 'imply TI_CPTS' > in TI_CPSW, TI_KEYSTONE_NETCP, TI_CPSW_SWITCHDEV > > > ---help--- > > This driver supports the Common Platform Time Sync unit of > > the CPSW Ethernet Switch and Keystone 2 1g/10g Switch Subsystem. > > The unit can time stamp PTP UDP/IPv4 and Layer 2 packets, and the > > driver offers a PTP Hardware Clock. > > -config TI_CPTS_MOD > > - tristate > > - depends on TI_CPTS > > - depends on PTP_1588_CLOCK > > - default y if TI_CPSW=y || TI_KEYSTONE_NETCP=y || TI_CPSW_SWITCHDEV=y > > - default m > > and this prevented user from forcing TI_CPTS="M" while CPSW/NETCP="Y" > > > - > > config TI_K3_AM65_CPSW_NUSS > > tristate "TI K3 AM654x/J721E CPSW Ethernet driver" > > depends on ARCH_K3 && OF && TI_K3_UDMA_GLUE_LAYER > > diff --git a/drivers/net/ethernet/ti/Makefile b/drivers/net/ethernet/ti/Makefile > > index 53792190e9c2..cb26a9d21869 100644 > > Below small diff should fix build fail: > diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig > index 8e348780efb6..eeaee47598aa 100644 > --- a/drivers/net/ethernet/ti/Kconfig > +++ b/drivers/net/ethernet/ti/Kconfig > @@ -81,6 +81,7 @@ config TI_CPTS > depends on TI_CPSW || TI_KEYSTONE_NETCP || TI_CPSW_SWITCHDEV || COMPILE_TEST > depends on COMMON_CLK > depends on POSIX_TIMERS > + depends on PTP_1588_CLOCK > ---help--- > This driver supports the Common Platform Time Sync unit of > the CPSW Ethernet Switch and Keystone 2 1g/10g Switch Subsystem. > @@ -90,7 +91,6 @@ config TI_CPTS > config TI_CPTS_MOD > tristate > depends on TI_CPTS > - depends on PTP_1588_CLOCK > default y if TI_CPSW=y || TI_KEYSTONE_NETCP=y || TI_CPSW_SWITCHDEV=y > default m > > Then separate patch can be used to enable PTP_1588_CLOCK in defconfigs. > > My personal opinion - it might be better to revert TI CPTS part from > b6d49cab44b5 ("net: Make PTP-specific drivers depend on PTP_1588_CLOCK") > at all. > > -- > Best regards, > grygorii