Re: Re: [PATCH V4 net-bugfixs] net/ethernet: Update ret when ptp_clock is ERROR

From: Arnd Bergmann
Date: Sat Nov 14 2020 - 16:17:12 EST


On Sat, Nov 14, 2020 at 4:14 PM Richard Cochran
<richardcochran@xxxxxxxxx> wrote:
>
> On Fri, Nov 13, 2020 at 05:21:43PM +0100, Arnd Bergmann wrote:
> > I've prototyped a patch that I think makes this more sensible
> > again: https://pastebin.com/AQ5nWS9e
>
> I like the behavior described in the text.
>
> Instead of this ...
>
> - if a built-in driver calls PTP interface functions but fails
> to select HAVE_PTP_1588_CLOCK or depend on PTP_1588_CLOCK,
> and PTP support is a loadable module, we get a link error
> instead of having an unusable clock.
>
> how about simply deleting the #else clause of
>
> --- a/include/linux/ptp_clock_kernel.h
> +++ b/include/linux/ptp_clock_kernel.h
> @@ -173,7 +173,7 @@ struct ptp_clock_event {
> };
> };
>
> -#if IS_REACHABLE(CONFIG_PTP_1588_CLOCK)
> +#if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
>
> so that invalid configurations throw a compile time error instead?

I was trying to still allow PTP clocks to be disabled, either when
building a kernel that doesn't need it, or when posix timers are
disabled. Leaving out the #else path would break all drivers that
have PTP support in the main ethernet driver file rather than
conditionally compiling it based on a Kconfig symbol that depends
on CONFIG_PTP_1588_CLOCK.

Arnd