Re: [PATCH] ptp_clock: future-proofing drivers against PTP subsystem becoming optional

2016-09-22 Thread David Miller
From: Nicolas Pitre 
Date: Tue, 20 Sep 2016 19:25:58 -0400 (EDT)

> 
> Drivers must be ready to accept NULL from ptp_clock_register() if the
> PTP clock subsystem is configured out.
> 
> This patch documents that and ensures that all drivers cope well
> with a NULL return.
> 
> Signed-off-by: Nicolas Pitre 
> Reviewed-by: Eugenia Emantayev 
> 
> ---
> 
> Let's have the basics merged now and work out the actual Kconfig issue 
> separately. Richard, if you agree with this patch, I think this could go 
> via the netdev tree.

Applied to net-next, thanks.


Re: [PATCH] ptp_clock: future-proofing drivers against PTP subsystem becoming optional

2016-09-21 Thread Edward Cree
On 21/09/16 00:25, Nicolas Pitre wrote:
> Drivers must be ready to accept NULL from ptp_clock_register() if the
> PTP clock subsystem is configured out.
>
> This patch documents that and ensures that all drivers cope well
> with a NULL return.
>
> Signed-off-by: Nicolas Pitre 
> Reviewed-by: Eugenia Emantayev 
[...]
> diff --git a/drivers/net/ethernet/sfc/ptp.c b/drivers/net/ethernet/sfc/ptp.c
> index c771e0af4e..f105a170b4 100644
> --- a/drivers/net/ethernet/sfc/ptp.c
> +++ b/drivers/net/ethernet/sfc/ptp.c
> @@ -1269,13 +1269,13 @@ int efx_ptp_probe(struct efx_nic *efx, struct 
> efx_channel *channel)
>   if (IS_ERR(ptp->phc_clock)) {
>   rc = PTR_ERR(ptp->phc_clock);
>   goto fail3;
> - }
> -
> - INIT_WORK(>pps_work, efx_ptp_pps_worker);
> - ptp->pps_workwq = create_singlethread_workqueue("sfc_pps");
> - if (!ptp->pps_workwq) {
> - rc = -ENOMEM;
> - goto fail4;
> + } else if (ptp->phc_clock) {
> + INIT_WORK(>pps_work, efx_ptp_pps_worker);
> + ptp->pps_workwq = 
> create_singlethread_workqueue("sfc_pps");
> + if (!ptp->pps_workwq) {
> + rc = -ENOMEM;
> + goto fail4;
> + }
>   }
>   }
>   ptp->nic_ts_enabled = false;
For the sfc change:
Acked-by: Edward Cree 


Re: [PATCH] ptp_clock: future-proofing drivers against PTP subsystem becoming optional

2016-09-21 Thread Richard Cochran
On Tue, Sep 20, 2016 at 07:25:58PM -0400, Nicolas Pitre wrote:
> 
> Drivers must be ready to accept NULL from ptp_clock_register() if the
> PTP clock subsystem is configured out.
> 
> This patch documents that and ensures that all drivers cope well
> with a NULL return.
> 
> Signed-off-by: Nicolas Pitre 
> Reviewed-by: Eugenia Emantayev 
> 
> ---
> 
> Let's have the basics merged now and work out the actual Kconfig issue 
> separately. Richard, if you agree with this patch, I think this could go 
> via the netdev tree.

It looks ok to me.

Acked-by: Richard Cochran