Re: [PATCH v6 2/9] PCI: endpoint: Pass EPF device ID to the probe function

From: Manivannan Sadhasivam
Date: Mon Jun 05 2023 - 09:55:37 EST


On Mon, Jun 05, 2023 at 03:08:33PM +0200, Lorenzo Pieralisi wrote:
> On Fri, Jun 02, 2023 at 09:13:25PM +0900, Damien Le Moal wrote:
> > On 6/2/23 20:47, Manivannan Sadhasivam wrote:
> > > Currently, the EPF probe function doesn't get the device ID argument needed
> > > to correctly identify the device table ID of the EPF device.
> > >
> > > When multiple entries are added to the "struct pci_epf_device_id" table,
> > > the probe function needs to identify the correct one. This is achieved by
> > > modifying the pci_epf_match_id() function to return the match ID pointer
> > > and passing it to the driver's probe function.
> > >
> > > pci_epf_device_match() function can return bool based on the return value
> > > of pci_epf_match_id().
> > >
> > > Reviewed-by: Kishon Vijay Abraham I <kishon@xxxxxxxxxx>
> > > Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@xxxxxxxxxx>
> >
> > [...]
> >
> > > static int pci_epf_device_match(struct device *dev, struct device_driver *drv)
> > > @@ -510,8 +510,12 @@ static int pci_epf_device_match(struct device *dev, struct device_driver *drv)
> > > struct pci_epf *epf = to_pci_epf(dev);
> > > struct pci_epf_driver *driver = to_pci_epf_driver(drv);
> > >
> > > - if (driver->id_table)
> > > - return pci_epf_match_id(driver->id_table, epf);
> > > + if (driver->id_table) {
> > > + if (pci_epf_match_id(driver->id_table, epf))
> > > + return true;
> > > + else
> > > + return false;
> >
> > You prefer keeping this pattern ?
> >
> > return pci_epf_match_id(driver->id_table, epf) != NULL;
> >
> > is no much nicer !
>
> s/no/so
>
> Yes it is, I can change it myself to spare Mani few cycles.
>

Please do!

- Mani

> Lorenzo
>
> >
> > Anyway:
> >
> > Reviewed-by: Damien Le Moal <dlemoal@xxxxxxxxxx>
> >
> > --
> > Damien Le Moal
> > Western Digital Research
> >

--
மணிவண்ணன் சதாசிவம்