Aneesh Kumar K.V wrote: > Dan Williams <dan.j.williams@xxxxxxxxx> writes: > > > .... > > > + > > +static int pci_tsm_lock(struct pci_dev *pdev, struct tsm_dev *tsm_dev) > > +{ > > + const struct pci_tsm_ops *ops = tsm_pci_ops(tsm_dev); > > + struct pci_tsm *tsm; > > + int rc; > > + > > + ACQUIRE(device_intr, lock)(&pdev->dev); > > + if ((rc = ACQUIRE_ERR(device_intr, &lock))) > > + return rc; > > + > > + if (pdev->dev.driver) > > + return -EBUSY; > > + > > + tsm = ops->lock(pdev); > > + if (IS_ERR(tsm)) > > + return PTR_ERR(tsm); > > + > > + pdev->tsm = tsm; > > + return 0; > > +} > > > > This is slightly different from connect() callback in that we don't have > pdev->tsm initialized when calling ->lock() callback. Should we do > something like below? (I also included the arch changes to show how > destructor is being used.) Do you need to walk pdev->tsm when you are creating the tsm context? For example, pass @pdev and the lock context structure to rsi_device_lock()?