diff mbox series

[v4,06/16] PCI: portdrv: Use PCI_IRQ_INTX

Message ID 20231122060406.14695-7-dlemoal@kernel.org (mailing list archive)
State Accepted
Delegated to: Lorenzo Pieralisi
Headers show
Series Cleanup IRQ type definitions | expand

Commit Message

Damien Le Moal Nov. 22, 2023, 6:03 a.m. UTC
In the PCI Express Port Bus Driver, use the macro PCI_IRQ_INTX instead
of the now deprecated PCI_IRQ_LEGACY macro.

Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
 drivers/pci/pcie/portdrv.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Christoph Hellwig Nov. 22, 2023, 6:17 a.m. UTC | #1
On Wed, Nov 22, 2023 at 03:03:56PM +0900, Damien Le Moal wrote:
> In the PCI Express Port Bus Driver, use the macro PCI_IRQ_INTX instead
> of the now deprecated PCI_IRQ_LEGACY macro.

I'd prefer to just script these cleanups in one big run to be honest..
Damien Le Moal Nov. 22, 2023, 6:22 a.m. UTC | #2
On 11/22/23 15:17, Christoph Hellwig wrote:
> On Wed, Nov 22, 2023 at 03:03:56PM +0900, Damien Le Moal wrote:
>> In the PCI Express Port Bus Driver, use the macro PCI_IRQ_INTX instead
>> of the now deprecated PCI_IRQ_LEGACY macro.
> 
> I'd prefer to just script these cleanups in one big run to be honest..

I did not want to go as far as changing all drivers everywhere and limited the
series to drivers/pci. We could do a coccinel script for everything else.
Christoph Hellwig Nov. 22, 2023, 6:23 a.m. UTC | #3
On Wed, Nov 22, 2023 at 03:22:54PM +0900, Damien Le Moal wrote:
> I did not want to go as far as changing all drivers everywhere and limited the
> series to drivers/pci. We could do a coccinel script for everything else.

Yes.  This is actually even trivial enough for sed :)
Damien Le Moal Nov. 22, 2023, 6:33 a.m. UTC | #4
On 11/22/23 15:23, Christoph Hellwig wrote:
> On Wed, Nov 22, 2023 at 03:22:54PM +0900, Damien Le Moal wrote:
>> I did not want to go as far as changing all drivers everywhere and limited the
>> series to drivers/pci. We could do a coccinel script for everything else.
> 
> Yes.  This is actually even trivial enough for sed :)

Surprisingly, only 44 files use PCI_IRQ_LEGACY. Let me see how a patch look
with the change.
Christoph Hellwig Nov. 22, 2023, 6:36 a.m. UTC | #5
On Wed, Nov 22, 2023 at 03:33:04PM +0900, Damien Le Moal wrote:
> On 11/22/23 15:23, Christoph Hellwig wrote:
> > On Wed, Nov 22, 2023 at 03:22:54PM +0900, Damien Le Moal wrote:
> >> I did not want to go as far as changing all drivers everywhere and limited the
> >> series to drivers/pci. We could do a coccinel script for everything else.
> > 
> > Yes.  This is actually even trivial enough for sed :)
> 
> Surprisingly, only 44 files use PCI_IRQ_LEGACY. Let me see how a patch look
> with the change.

As mentioned in reply 1 I think this is perfect for a scripted run
after -rc1.

I'm actually surprised PCI_IRQ_LEGACY is used even 44 times.  There is
really no point in using the APIs based on PCI_IRQ_ for legacy irqs,
and the case where it is just supposed as a fallback are covered by
PCI_IRQ_ALL_TYPES.
Damien Le Moal Nov. 22, 2023, 6:49 a.m. UTC | #6
On 11/22/23 15:36, Christoph Hellwig wrote:
> On Wed, Nov 22, 2023 at 03:33:04PM +0900, Damien Le Moal wrote:
>> On 11/22/23 15:23, Christoph Hellwig wrote:
>>> On Wed, Nov 22, 2023 at 03:22:54PM +0900, Damien Le Moal wrote:
>>>> I did not want to go as far as changing all drivers everywhere and limited the
>>>> series to drivers/pci. We could do a coccinel script for everything else.
>>>
>>> Yes.  This is actually even trivial enough for sed :)
>>
>> Surprisingly, only 44 files use PCI_IRQ_LEGACY. Let me see how a patch look
>> with the change.
> 
> As mentioned in reply 1 I think this is perfect for a scripted run
> after -rc1.

You mean 6.8-rc1 next cycle ?

> 
> I'm actually surprised PCI_IRQ_LEGACY is used even 44 times.  There is
> really no point in using the APIs based on PCI_IRQ_ for legacy irqs,
> and the case where it is just supposed as a fallback are covered by
> PCI_IRQ_ALL_TYPES.

I had a closer look and if we want to do this correctly, there is more to do
than just the rename of PCI_IRQ_LEGACY to PCI_IRQ_INTX. There is also
NR_IRQS_LEGACY, some Kconfig options, functions that use "legacy_irq" in there
name, etc. A big chunk is just the rename, but some drivers will need finer
handling as otherwise we'll endup mixing up intx and legacy in the same code,
which is not pretty/confusing.
Christoph Hellwig Nov. 22, 2023, 6:54 a.m. UTC | #7
On Wed, Nov 22, 2023 at 03:49:28PM +0900, Damien Le Moal wrote:
> > As mentioned in reply 1 I think this is perfect for a scripted run
> > after -rc1.
> 
> You mean 6.8-rc1 next cycle ?

Yes.  6.7-rc1 is over :)
Damien Le Moal Nov. 22, 2023, 6:59 a.m. UTC | #8
On 11/22/23 15:54, Christoph Hellwig wrote:
> On Wed, Nov 22, 2023 at 03:49:28PM +0900, Damien Le Moal wrote:
>>> As mentioned in reply 1 I think this is perfect for a scripted run
>>> after -rc1.
>>
>> You mean 6.8-rc1 next cycle ?
> 
> Yes.  6.7-rc1 is over :)

OK.

Bjorn,

I can resend without this patch, or maybe you can drop it when applying. Let me
know what you prefer.
Lorenzo Pieralisi Dec. 19, 2023, 10:07 a.m. UTC | #9
On Wed, Nov 22, 2023 at 03:59:47PM +0900, Damien Le Moal wrote:
> On 11/22/23 15:54, Christoph Hellwig wrote:
> > On Wed, Nov 22, 2023 at 03:49:28PM +0900, Damien Le Moal wrote:
> >>> As mentioned in reply 1 I think this is perfect for a scripted run
> >>> after -rc1.
> >>
> >> You mean 6.8-rc1 next cycle ?
> > 
> > Yes.  6.7-rc1 is over :)
> 
> OK.
> 
> Bjorn,
> 
> I can resend without this patch, or maybe you can drop it when applying. Let me
> know what you prefer.

Krzysztof diligently made me notice, thanks.

I have now dropped it and repushed out the resulting irq-clean-up
branch.

Lorenzo
Damien Le Moal Dec. 20, 2023, 4:41 a.m. UTC | #10
On 12/19/23 19:07, Lorenzo Pieralisi wrote:
> On Wed, Nov 22, 2023 at 03:59:47PM +0900, Damien Le Moal wrote:
>> On 11/22/23 15:54, Christoph Hellwig wrote:
>>> On Wed, Nov 22, 2023 at 03:49:28PM +0900, Damien Le Moal wrote:
>>>>> As mentioned in reply 1 I think this is perfect for a scripted run
>>>>> after -rc1.
>>>>
>>>> You mean 6.8-rc1 next cycle ?
>>>
>>> Yes.  6.7-rc1 is over :)
>>
>> OK.
>>
>> Bjorn,
>>
>> I can resend without this patch, or maybe you can drop it when applying. Let me
>> know what you prefer.
> 
> Krzysztof diligently made me notice, thanks.
> 
> I have now dropped it and repushed out the resulting irq-clean-up
> branch.

OK. Thanks. I will work on removing what remains of "legacy" naming once
everything is in linux next.
diff mbox series

Patch

diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c
index 14a4b89a3b83..bb65dfe43409 100644
--- a/drivers/pci/pcie/portdrv.c
+++ b/drivers/pci/pcie/portdrv.c
@@ -187,15 +187,15 @@  static int pcie_init_service_irqs(struct pci_dev *dev, int *irqs, int mask)
 	 * interrupt.
 	 */
 	if ((mask & PCIE_PORT_SERVICE_PME) && pcie_pme_no_msi())
-		goto legacy_irq;
+		goto intx_irq;
 
 	/* Try to use MSI-X or MSI if supported */
 	if (pcie_port_enable_irq_vec(dev, irqs, mask) == 0)
 		return 0;
 
-legacy_irq:
-	/* fall back to legacy IRQ */
-	ret = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_LEGACY);
+intx_irq:
+	/* fall back to INTX IRQ */
+	ret = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_INTX);
 	if (ret < 0)
 		return -ENODEV;