> > +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.
> 

Which level of indirection? The usage of ptp->ops->() functions?

That's part of the driver structuring - qed is responsible for accessing HW
so it implements api functions for accessing PTP-related configuration,
while qede is responsible for the network interface and thus is the one to
register the clock and implements its API.

The operations ptp->ops->() originate from qed, so we can't refactor qede
state-logic there and use it directly.

Reply via email to