Re: [PATCH v2] serial: 8250_lpss: Switch over to MSI interrupts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Oct 01, 2019 at 02:58:25PM +0300, Felipe Balbi wrote:
> Some devices support MSI interrupts. Let's at least try to use them in
> platforms that provide MSI capability.
> 
> While at that, remove the now duplicated code from qrp_serial_setup().

Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

> Signed-off-by: Felipe Balbi <felipe.balbi@xxxxxxxxxxxxxxx>
> ---
> 
> Changes since v1:
> 	- Remove duplicated code from qrk_serial_setup()
> 
>  drivers/tty/serial/8250/8250_lpss.c | 21 +++++++++------------
>  1 file changed, 9 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_lpss.c b/drivers/tty/serial/8250/8250_lpss.c
> index 5f72ef3ea574..60eff3240c8a 100644
> --- a/drivers/tty/serial/8250/8250_lpss.c
> +++ b/drivers/tty/serial/8250/8250_lpss.c
> @@ -221,17 +221,6 @@ static void qrk_serial_exit_dma(struct lpss8250 *lpss) {}
>  
>  static int qrk_serial_setup(struct lpss8250 *lpss, struct uart_port *port)
>  {
> -	struct pci_dev *pdev = to_pci_dev(port->dev);
> -	int ret;
> -
> -	pci_set_master(pdev);
> -
> -	ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
> -	if (ret < 0)
> -		return ret;
> -
> -	port->irq = pci_irq_vector(pdev, 0);
> -
>  	qrk_serial_setup_dma(lpss, port);
>  	return 0;
>  }
> @@ -293,16 +282,22 @@ static int lpss8250_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  	if (ret)
>  		return ret;
>  
> +	pci_set_master(pdev);
> +
>  	lpss = devm_kzalloc(&pdev->dev, sizeof(*lpss), GFP_KERNEL);
>  	if (!lpss)
>  		return -ENOMEM;
>  
> +	ret = pci_alloc_irq_vectors(pdev, 1, 1, PCI_IRQ_ALL_TYPES);
> +	if (ret < 0)
> +		return ret;
> +
>  	lpss->board = (struct lpss8250_board *)id->driver_data;
>  
>  	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 = &lpss->data;
>  	uart.port.type = PORT_16550A;
>  	uart.port.iotype = UPIO_MEM;
> @@ -337,6 +332,7 @@ static int lpss8250_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>  err_exit:
>  	if (lpss->board->exit)
>  		lpss->board->exit(lpss);
> +	pci_free_irq_vectors(pdev);
>  	return ret;
>  }
>  
> @@ -348,6 +344,7 @@ static void lpss8250_remove(struct pci_dev *pdev)
>  
>  	if (lpss->board->exit)
>  		lpss->board->exit(lpss);
> +	pci_free_irq_vectors(pdev);
>  }
>  
>  static const struct lpss8250_board byt_board = {
> -- 
> 2.23.0
> 

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux PPP]     [Linux FS]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Linmodem]     [Device Mapper]     [Linux Kernel for ARM]

  Powered by Linux