On Tue, Oct 08, 2019 at 10:56:40AM +0000, Igor Russkikh wrote:

> diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c 
> b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
> index d5a28904f708..ba1597bb6eab 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/aq_ptp.c
> @@ -16,15 +16,107 @@
>  struct aq_ptp_s {
>       struct aq_nic_s *aq_nic;
>  
> +     spinlock_t ptp_lock;
>       struct ptp_clock *ptp_clock;
>       struct ptp_clock_info ptp_info;
>  };
>  
> +/* aq_ptp_adjfreq
> + * @ptp: the ptp clock structure
> + * @ppb: parts per billion adjustment from base
> + *
> + * adjust the frequency of the ptp cycle counter by the
> + * indicated ppb from the base frequency.
> + */
> +static int aq_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb)

The adjfreq() callback is deprecated.  Please implement adjfine() instead.

> +{
> +     struct aq_ptp_s *aq_ptp = container_of(ptp, struct aq_ptp_s, ptp_info);
> +     struct aq_nic_s *aq_nic = aq_ptp->aq_nic;
> +
> +     mutex_lock(&aq_nic->fwreq_mutex);

Here you use a different lock than...

> +     aq_nic->aq_hw_ops->hw_adj_clock_freq(aq_nic->aq_hw, ppb);
> +     mutex_unlock(&aq_nic->fwreq_mutex);
> +
> +     return 0;
> +}
> +
> +/* aq_ptp_adjtime
> + * @ptp: the ptp clock structure
> + * @delta: offset to adjust the cycle counter by
> + *
> + * adjust the timer by resetting the timecounter structure.
> + */
> +static int aq_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
> +{
> +     struct aq_ptp_s *aq_ptp = container_of(ptp, struct aq_ptp_s, ptp_info);
> +     struct aq_nic_s *aq_nic = aq_ptp->aq_nic;
> +     unsigned long flags;
> +
> +     spin_lock_irqsave(&aq_ptp->ptp_lock, flags);

... here.  Is it safe to concurrently set the time and the frequency?

> +     aq_nic->aq_hw_ops->hw_adj_sys_clock(aq_nic->aq_hw, delta);
> +     spin_unlock_irqrestore(&aq_ptp->ptp_lock, flags);
> +
> +     return 0;
> +}

Thanks,
Richard

Reply via email to