Re: [PATCH 08/10] pci: devres: give pci(m)_intx its own callback

From: andy . shevchenko
Date: Tue Jan 16 2024 - 17:30:18 EST


Mon, Jan 15, 2024 at 03:46:19PM +0100, Philipp Stanner kirjoitti:
> pci_intx() is one of the functions that have "hybrid mode" (i.e.,
> sometimes managed, sometimes not). Providing a separate pcim_intx()
> function with its own device resource and cleanup callback allows for
> removing further large parts of the legacy pci-devres implementation.
>
> As in the region-request-functions, pci_intx() has to call into its
> managed counterpart for backwards compatibility.
>
> Implement pcim_intx() with its own device resource.
> Make pci_intx() call pcim_intx() in the managed case.
> Remove the legacy devres struct from pci.h.

..

> + /*
> + * This is done for backwards compatibility, because the old pci-devres
> + * API had a mode in which this function became managed if the dev had
> + * been enabled with pcim_enable_device() instead of pci_enable_device().
> + */
> + if (pci_is_managed(pdev)) {
> + if (pcim_intx(pdev, enable) != 0)
> + WARN_ON_ONCE(1);

WARN_ON_ONCE(pcim_intx(pdev, enable));

?

> + return;
> + }

..

> + if (new != pci_command)

if (new == pci_command)
return;

?

> pci_write_config_word(pdev, PCI_COMMAND, new);

--
With Best Regards,
Andy Shevchenko