On Fri, Sep 16, 2016 at 10:57:58PM -0400, Nicolas Pitre wrote:
> Subject: [PATCH] ptp_clock: allow for it to be optional
> In order to break the hard dependency between the PTP clock subsystem and
> ethernet drivers capable of being clock providers, this patch provides
> simple PTP stub functions to allow linkage of those drivers into the
> kernel even when the PTP subsystem is configured out.
> And to make it possible for PTP to be configured out, the select statement
> in the Kconfig entry for those ethernet drivers is changed from selecting
> PTP_1588_CLOCK to PTP_1588_CLOCK_DEFAULT whose purpose is to indicate the
> default Kconfig value for the PTP subsystem.
> This way the PTP subsystem may have Kconfig dependencies of its own, such
> as POSIX_TIMERS, without making those ethernet drivers unavailable if
> POSIX timers are cconfigured out. And when support for POSIX timers is
> selected again then PTP clock support will also be selected accordingly.
> Drivers must be ready to accept NULL from ptp_clock_register().
> The pch_gbe driver is a bit special as it relies on extra code in
> drivers/ptp/ptp_pch.c. Therefore we let the make process descend into
> drivers/ptp/ even if PTP_1588_CLOCK is unselected.

Thanks for the detailed description.

> diff --git a/drivers/ptp/Kconfig b/drivers/ptp/Kconfig
> index 00e6098e9a..c36c018f0f 100644
> --- a/drivers/ptp/Kconfig
> +++ b/drivers/ptp/Kconfig
> @@ -4,8 +4,12 @@
>  menu "PTP clock support"
> +config PTP_1588_CLOCK_DEFAULT
> +     tristate

I see what this option is doing, but I wonder about the name
"DEFAULT".  In what sense is this a default?

> +/**
> + * ptp_clock_register() - register a PTP hardware clock driver
> + *
> + * @info:   Structure describing the new clock.
> + * @parent: Pointer to the parent device of the new clock.

Here we should finally explain the return value for authors of new
drivers.  Something like this:

 * Returns a valid pointer on success or PTR_ERR on failure.  If PHC
 * support is missing at the configuration level, this function
 * returns NULL, and drivers are expected to gracefully handle that
 * case separately.

> + */
> +
> +extern struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
> +                                         struct device *parent);


Reply via email to