Skip to content

Commit b6d49ca

Browse files
claymationdavem330
authored andcommitted
net: Make PTP-specific drivers depend on PTP_1588_CLOCK
Commit d1cbfd7 ("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/[email protected]/ [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 <[email protected]> Cc: Richard Cochran <[email protected]> Cc: Nicolas Pitre <[email protected]> Cc: Grygorii Strashko <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Fixes: d1cbfd7 ("ptp_clock: Allow for it to be optional") Signed-off-by: Clay McClure <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 610a934 commit b6d49ca

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

drivers/net/dsa/mv88e6xxx/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ config NET_DSA_MV88E6XXX_PTP
2424
bool "PTP support for Marvell 88E6xxx"
2525
default n
2626
depends on NET_DSA_MV88E6XXX_GLOBAL2
27+
depends on PTP_1588_CLOCK
2728
imply NETWORK_PHY_TIMESTAMPING
28-
imply PTP_1588_CLOCK
2929
help
3030
Say Y to enable PTP hardware timestamping on Marvell 88E6xxx switch
3131
chips that support it.

drivers/net/dsa/sja1105/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ tristate "NXP SJA1105 Ethernet switch family support"
2020
config NET_DSA_SJA1105_PTP
2121
bool "Support for the PTP clock on the NXP SJA1105 Ethernet switch"
2222
depends on NET_DSA_SJA1105
23+
depends on PTP_1588_CLOCK
2324
help
2425
This enables support for timestamping and PTP clock manipulations in
2526
the SJA1105 DSA driver.

drivers/net/ethernet/cadence/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ config MACB
3535
config MACB_USE_HWSTAMP
3636
bool "Use IEEE 1588 hwstamp"
3737
depends on MACB
38+
depends on PTP_1588_CLOCK
3839
default y
39-
imply PTP_1588_CLOCK
4040
---help---
4141
Enable IEEE 1588 Precision Time Protocol (PTP) support for MACB.
4242

drivers/net/ethernet/cavium/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ config THUNDER_NIC_RGX
5454
config CAVIUM_PTP
5555
tristate "Cavium PTP coprocessor as PTP clock"
5656
depends on 64BIT && PCI
57-
imply PTP_1588_CLOCK
57+
depends on PTP_1588_CLOCK
5858
---help---
5959
This driver adds support for the Precision Time Protocol Clocks and
6060
Timestamping coprocessor (PTP) found on Cavium processors.

drivers/net/ethernet/ti/Kconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,8 @@ config TI_CPTS
9090
config TI_CPTS_MOD
9191
tristate
9292
depends on TI_CPTS
93+
depends on PTP_1588_CLOCK
9394
default y if TI_CPSW=y || TI_KEYSTONE_NETCP=y || TI_CPSW_SWITCHDEV=y
94-
select NET_PTP_CLASSIFY
95-
imply PTP_1588_CLOCK
9695
default m
9796

9897
config TI_K3_AM65_CPSW_NUSS

0 commit comments

Comments
 (0)