Subject: Re: [PATCH net-next v2 2/2] qede: Add driver support for PTP.

From: Richard Cochran <[email-masked]>
Date: Sun, 29 Jan 2017 16:35:36 +0100

On Sat, Jan 28, 2017 at 11:28:23PM -0800, Sudarsana Kalluru wrote:
> +/**
> + * qede_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 qede_ptp_adjfreq(struct ptp_clock_info *info, s32 ppb)
> +{
> +	struct qede_ptp *ptp = container_of(info, struct qede_ptp, clock_info);
> +	struct qede_dev *edev = ptp->edev;
> +	int rc;
> +
> +	__qede_lock(edev);
> +	if (edev->state == QEDE_STATE_OPEN) {
> +		spin_lock_bh(&ptp->lock);
> +		rc = ptp->ops->adjfreq(edev->cdev, ppb);

Why add this extra layer of indirection?

You could put these this test into qed_ptp_hw_adjfreq() and register
that function directly.

> +		spin_unlock_bh(&ptp->lock);
> +	} else {
> +		DP_ERR(edev, "PTP adjfreq called while interface is down\n");
> +		return -EFAULT;
> +	}
> +	__qede_unlock(edev);
> +
> +	return rc;
> +}

Thanks,
Richard