Re: [PATCH v4 1/8] misc: Add support for LAN966x PCI device
From: Andy Shevchenko
Date: Thu Aug 08 2024 - 08:32:58 EST
On Wed, Aug 7, 2024 at 1:10 PM Herve Codina <herve.codina@xxxxxxxxxxx> wrote:
> On Mon, 5 Aug 2024 22:13:38 +0200
> Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote:
> > On Mon, Aug 5, 2024 at 12:19 PM Herve Codina <herve.codina@xxxxxxxxxxx> wrote:
...
> > > + if (!pdev->irq)
> > > + return ERR_PTR(-EOPNOTSUPP);
> >
> > Before even trying to get it via APIs? (see below as well)
> > Also, when is it possible to have 0 here?
>
> pdev->irq can be 0 if the PCI device did not request any IRQ
> (i.e. PCI_INTERRUPT_PIN in PCI config header is 0).
> I use that to check whether or not INTx is supported.
But why do you need that? What happens if you get a new device that
supports let's say MSI?
> Even if this code is present in the LAN966x PCI driver, it can be use as a
> starting point for other drivers and may be moved to a common part in the
> future.
>
> Do you think I should remove it ?
I think pci_alloc_vectors() should be enough. Make it to be the first
call, if you think it's better.
> If keeping it is fine, I will add a comment.
--
With Best Regards,
Andy Shevchenko