OpenCloudOS-Kernel/drivers/net/ethernet/ti
Clay McClure b6d49cab44 net: Make PTP-specific drivers depend on PTP_1588_CLOCK
Commit d1cbfd771c ("ptp_clock: Allow for it to be optional") changed
all PTP-capable Ethernet drivers from `select PTP_1588_CLOCK` to `imply
PTP_1588_CLOCK`, "in order to break the hard dependency between the PTP
clock subsystem and ethernet drivers capable of being clock providers."
As a result it is possible to build PTP-capable Ethernet drivers without
the PTP subsystem by deselecting PTP_1588_CLOCK. Drivers are required to
handle the missing dependency gracefully.

Some PTP-capable Ethernet drivers (e.g., TI_CPSW) factor their PTP code
out into separate drivers (e.g., TI_CPTS_MOD). The above commit also
changed these PTP-specific drivers to `imply PTP_1588_CLOCK`, making it
possible to build them without the PTP subsystem. But as Grygorii
Strashko noted in [1]:

On Wed, Apr 22, 2020 at 02:16:11PM +0300, Grygorii Strashko wrote:

> Another question is that CPTS completely nonfunctional in this case and
> it was never expected that somebody will even try to use/run such
> configuration (except for random build purposes).

In my view, enabling a PTP-specific driver without the PTP subsystem is
a configuration error made possible by the above commit. Kconfig should
not allow users to create a configuration with missing dependencies that
results in "completely nonfunctional" drivers.

I audited all network drivers that call ptp_clock_register() but merely
`imply PTP_1588_CLOCK` and found five PTP-specific drivers that are
likely nonfunctional without PTP_1588_CLOCK:

    NET_DSA_MV88E6XXX_PTP
    NET_DSA_SJA1105_PTP
    MACB_USE_HWSTAMP
    CAVIUM_PTP
    TI_CPTS_MOD

Note how these symbols all reference PTP or timestamping in their name;
this is a clue that they depend on PTP_1588_CLOCK.

Change them from `imply PTP_1588_CLOCK` [2] to `depends on PTP_1588_CLOCK`.
I'm not using `select PTP_1588_CLOCK` here because PTP_1588_CLOCK has
its own dependencies, which `select` would not transitively apply.

Additionally, remove the `select NET_PTP_CLASSIFY` from CPTS_TI_MOD;
PTP_1588_CLOCK already selects that.

[1]: https://lore.kernel.org/lkml/c04458ed-29ee-1797-3a11-7f3f560553e6@ti.com/

[2]: NET_DSA_SJA1105_PTP had never declared any type of dependency on
PTP_1588_CLOCK (`imply` or otherwise); adding a `depends on PTP_1588_CLOCK`
here seems appropriate.

Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Nicolas Pitre <nico@fluxnic.net>
Cc: Grygorii Strashko <grygorii.strashko@ti.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Fixes: d1cbfd771c ("ptp_clock: Allow for it to be optional")
Signed-off-by: Clay McClure <clay@daemons.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-05-01 15:27:51 -07:00
..
Kconfig net: Make PTP-specific drivers depend on PTP_1588_CLOCK 2020-05-01 15:27:51 -07:00
Makefile net: ethernet: ti: introduce am65x/j721e gigabit eth subsystem driver 2020-03-26 20:01:14 -07:00
am65-cpsw-ethtool.c net: ethernet: ti: introduce am65x/j721e gigabit eth subsystem driver 2020-03-26 20:01:14 -07:00
am65-cpsw-nuss.c net: ethernet: ti: Add missing '\n' in log messages 2020-04-12 11:44:39 -07:00
am65-cpsw-nuss.h net: ethernet: ti: introduce am65x/j721e gigabit eth subsystem driver 2020-03-26 20:01:14 -07:00
cpmac.c net: convert suitable drivers to use phy_do_ioctl_running 2020-01-23 10:49:30 +01:00
cpsw-common.c net: ethernet: ti: convert to SPDX license identifiers 2019-04-27 17:11:48 -04:00
cpsw-phy-sel.c bus_find_device: Unify the match callback with class_find_device 2019-06-24 05:22:31 +02:00
cpsw.c net: cpsw: reject unsupported coalescing params 2020-03-17 20:56:58 -07:00
cpsw.h net: ethernet: ti: convert to SPDX license identifiers 2019-04-27 17:11:48 -04:00
cpsw_ale.c net: ethernet: ti: ale: am65: add support for default thread cfg 2020-03-26 20:01:14 -07:00
cpsw_ale.h net: ethernet: ti: ale: am65: add support for default thread cfg 2020-03-26 20:01:14 -07:00
cpsw_ethtool.c treewide: Use sizeof_field() macro 2019-12-09 10:36:44 -08:00
cpsw_new.c net: cpsw: reject unsupported coalescing params 2020-03-17 20:56:58 -07:00
cpsw_priv.c netdev: pass the stuck queue to the timeout handler 2019-12-12 21:38:57 -08:00
cpsw_priv.h netdev: pass the stuck queue to the timeout handler 2019-12-12 21:38:57 -08:00
cpsw_sl.c net: ethernet: ti: cpsw: introduce mac sl module api 2019-04-27 17:11:49 -04:00
cpsw_sl.h net: ethernet: ti: cpsw: introduce mac sl module api 2019-04-27 17:11:49 -04:00
cpsw_switchdev.c net: ethernet: ti: introduce cpsw switchdev based driver part 2 - switch 2019-11-20 11:25:24 -08:00
cpsw_switchdev.h net: ethernet: ti: introduce cpsw switchdev based driver part 2 - switch 2019-11-20 11:25:24 -08:00
cpts.c ethernet: ti: cpts: use ktime_get_real_ns helper 2019-11-07 19:59:16 -08:00
cpts.h net: ethernet: ti: cpts: add support for ext rftclk selection 2019-06-09 12:53:06 -07:00
davinci_cpdma.c net: ethernet: ti: davinci_cpdma: fix warning "device driver frees DMA memory with different size" 2019-12-09 14:26:04 -08:00
davinci_cpdma.h net: ethernet: ti: davinci_cpdma: allow desc split while down 2019-07-08 14:58:04 -07:00
davinci_emac.c net: davinci_emac: reject unsupported coalescing params 2020-03-17 20:56:58 -07:00
davinci_mdio.c drivers: net: davinci_mdio: fix return value check in davinci_mdio_probe() 2019-05-05 10:17:28 -07:00
k3-cppi-desc-pool.c net: ethernet: ti: introduce am65x/j721e gigabit eth subsystem driver 2020-03-26 20:01:14 -07:00
k3-cppi-desc-pool.h net: ethernet: ti: introduce am65x/j721e gigabit eth subsystem driver 2020-03-26 20:01:14 -07:00
netcp.h net: ethernet: ti: convert to SPDX license identifiers 2019-04-27 17:11:48 -04:00
netcp_core.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next 2020-01-28 16:02:33 -08:00
netcp_ethss.c net: netcp_ethss: Use the PHY time stamping interface. 2019-12-25 19:51:33 -08:00
netcp_sgmii.c net: ethernet: ti: convert to SPDX license identifiers 2019-04-27 17:11:48 -04:00
netcp_xgbepcsr.c net: ethernet: ti: convert to SPDX license identifiers 2019-04-27 17:11:48 -04:00
tlan.c netdev: pass the stuck queue to the timeout handler 2019-12-12 21:38:57 -08:00
tlan.h