linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: 8250_mid: Use pci_irq_vector() to get IRQ
@ 2021-08-17  8:14 Utkarsh Verma
  2021-08-17 12:59 ` Greg Kroah-Hartman
  0 siblings, 1 reply; 3+ messages in thread
From: Utkarsh Verma @ 2021-08-17  8:14 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel-mentees, Jiri Slaby, linux-kernel, linux-serial

Instead of a direct assignment, use pci_irq_vector() to get the
Linux IRQ number.

Signed-off-by: Utkarsh Verma <utkarshverma294@gmail.com>
---
 drivers/tty/serial/8250/8250_mid.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/tty/serial/8250/8250_mid.c b/drivers/tty/serial/8250/8250_mid.c
index efa0515139f8..3a279ce0e904 100644
--- a/drivers/tty/serial/8250/8250_mid.c
+++ b/drivers/tty/serial/8250/8250_mid.c
@@ -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;
-- 
2.17.1

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] serial: 8250_mid: Use pci_irq_vector() to get IRQ
  2021-08-17  8:14 [PATCH] serial: 8250_mid: Use pci_irq_vector() to get IRQ Utkarsh Verma
@ 2021-08-17 12:59 ` Greg Kroah-Hartman
  2021-08-26 14:08   ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2021-08-17 12:59 UTC (permalink / raw)
  To: Utkarsh Verma
  Cc: linux-kernel-mentees, Jiri Slaby, linux-kernel, linux-serial

On Tue, Aug 17, 2021 at 01:44:01PM +0530, Utkarsh Verma wrote:
> Instead of a direct assignment, use pci_irq_vector() to get the
> Linux IRQ number.

Why is this needed?

> Signed-off-by: Utkarsh Verma <utkarshverma294@gmail.com>
> ---
>  drivers/tty/serial/8250/8250_mid.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_mid.c b/drivers/tty/serial/8250/8250_mid.c
> index efa0515139f8..3a279ce0e904 100644
> --- a/drivers/tty/serial/8250/8250_mid.c
> +++ b/drivers/tty/serial/8250/8250_mid.c
> @@ -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
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] serial: 8250_mid: Use pci_irq_vector() to get IRQ
  2021-08-17 12:59 ` Greg Kroah-Hartman
@ 2021-08-26 14:08   ` Andy Shevchenko
  0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2021-08-26 14:08 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: linux-kernel-mentees, Jiri Slaby, open list:SERIAL DRIVERS,
	Linux Kernel Mailing List

On Tue, Aug 17, 2021 at 3:59 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> On Tue, Aug 17, 2021 at 01:44:01PM +0530, Utkarsh Verma wrote:
> > Instead of a direct assignment, use pci_irq_vector() to get the
> > Linux IRQ number.
>
> Why is this needed?

It's not.

> > +     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.

-- 
With Best Regards,
Andy Shevchenko
_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-26 14:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-17  8:14 [PATCH] serial: 8250_mid: Use pci_irq_vector() to get IRQ Utkarsh Verma
2021-08-17 12:59 ` Greg Kroah-Hartman
2021-08-26 14:08   ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).