serial: 8250_mid: Use pci_irq_vector() to get IRQ
PATCH 1/1 serial: 8250_mid: Use pci_irq_vector() to get IRQ
Instead of a direct assignment, use pci_irq_vector() to get the Linux IRQ number.
--- drivers/tty/serial/8250/8250_mid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/8250/8250_mid.c +1 -1
@@ -299,7 +299,7 @@ static int mid8250_probe(struct pci_dev *pdev, const struct pci_device_id *id)memset (&uart,0 ,sizeof (struct uart_8250_port )); uart.port.dev = &pdev->dev; - uart.port.irq = pdev->irq; + uart.port.irq =pci_irq_vector (pdev,0 ); uart.port.private_data = mid; uart.port.type =PORT_16750 ; uart.port.iotype =UPIO_MEM ;
Signature · 1 line
2.17.1
Greg Kroah-Hartman
maintainerQuoted 2 lines · Utkarsh Verma
Instead of a direct assignment, use
pci_irq_vector()to get the Linux IRQ number.
Why is this needed?
Quoted 10 lines
Signed-off-by Utkarsh Verma <[email protected]>--- drivers/tty/serial/8250/8250_mid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/tty/serial/8250/8250_mid.c +0
-0
drivers/tty/serial/8250/8250_mid.c static int mid8250_probe(struct pci_dev *pdev, const struct pci_device_id *id) · line 302
Quoted 5 lines
drivers/tty/serial/8250/8250_mid.c +1
-1@@ -299,7 +299,7 @@ static int mid8250_probe(struct pci_dev *pdev, const struct pci_device_id *id)memset (&uart,0 ,sizeof (struct uart_8250_port )); uart.port.dev = &pdev->dev; - uart.port.irq = pdev->irq; + uart.port.irq =pci_irq_vector (pdev,0 );
What problem does this solve?
Do not describe what you are doing, but rather, _why_ you are doing it.
thanks,
greg k-h
Quoted 5 lines · Greg Kroah-Hartman
Quoted 2 lines · Utkarsh Verma
Instead of a direct assignment, use
pci_irq_vector()to get the Linux IRQ number.Why is this needed?
It's not.
Quoted 5 lines
Quoted 1 line
+ uart.port.irq =
pci_irq_vector(pdev, 0);What problem does this solve?
Do not describe what you are doing, but rather, _why_ you are doing it.
I think I know what was the motivation here, but actually there is no problem with current code. Indeed, when we enable MSI we have to update the vIRQ line, but this is done in the platform related ->setup() callbacks (for example, dnv_setup() does it). So we have two scenarios:
1) there is no MSI enabled and in this case pdev->irq is correct;
2) we have MSI enabled and we need to update previously saved pdev->irq.
What you, Utkarsh, are doing in the patch has no effect, because at that point MSI will never be enabled and pci_irq_vector(pdev, 0) will return the very same value as kept in pdev->irq.
Signature · 2 lines
With Best Regards, Andy Shevchenko