Dan Williams <dan.j.williams@xxxxxxxxx> writes: > From: Xu Yilun <yilun.xu@xxxxxxxxxxxxxxx> > ..... > @@ -558,11 +675,11 @@ int pci_tsm_bind(struct pci_dev *pdev, struct kvm *kvm, u64 tdi_id) > if (!pdev->tsm) > return -EINVAL; > > - struct pci_dev *pf0_dev __free(pci_dev_put) = tsm_pf0_get(pdev); > - if (!pf0_dev) > + struct pci_dev *dsm_dev __free(pci_dev_put) = dsm_dev_get(pdev); > + if (!dsm_dev) > return -EINVAL; > Can we do the below? modified include/linux/pci-tsm.h @@ -38,7 +38,6 @@ enum pci_tsm_type { */ struct pci_tdi { struct pci_dev *pdev; - struct pci_dev *dsm_dev; struct kvm *kvm; }; @@ -56,6 +55,7 @@ struct pci_tdi { */ struct pci_tsm { struct pci_dev *pdev; + struct pci_dev *dsm_dev; enum pci_tsm_type type; struct pci_tdi *tdi; }; And update dsm_dev during ->probe(). That will avoid these get/put() operations in these functions. -aneesh