All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] serial: 8250_exar: derive nr_ports from ID for Acces I/O cards
@ 2021-12-22 19:44 Andy Shevchenko
  2021-12-22 23:25   ` kernel test robot
  2021-12-23 10:05 ` Ilpo Järvinen
  0 siblings, 2 replies; 5+ messages in thread
From: Andy Shevchenko @ 2021-12-22 19:44 UTC (permalink / raw)
  To: Andy Shevchenko, linux-serial, linux-kernel
  Cc: Greg Kroah-Hartman, Jiri Slaby

In the similar way how it's done in 8250_pericom, derive number of
UART ports from PCI ID for Acces I/O cards.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/tty/serial/8250/8250_exar.c | 37 ++++++++++-------------------
 1 file changed, 13 insertions(+), 24 deletions(-)

diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c
index a4508ac0cac9..cf16bd889abd 100644
--- a/drivers/tty/serial/8250/8250_exar.c
+++ b/drivers/tty/serial/8250/8250_exar.c
@@ -611,7 +611,12 @@ exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
 
 	maxnr = pci_resource_len(pcidev, bar) >> (board->reg_shift + 3);
 
-	nr_ports = board->num_ports ? board->num_ports : pcidev->device & 0x0f;
+	if (pcidev->vendor == PCI_VENDOR_ID_ACCESSIO)
+		nr = BIT(((pcidev->device & 0x38) >> 3) - 1);
+	else if (board->num_ports)
+		nr_ports = board->num_ports;
+	else
+		nr_ports = pcidev->device & 0x0f;
 
 	priv = devm_kzalloc(&pcidev->dev, struct_size(priv, line, nr_ports), GFP_KERNEL);
 	if (!priv)
@@ -710,22 +715,6 @@ static int __maybe_unused exar_resume(struct device *dev)
 
 static SIMPLE_DEV_PM_OPS(exar_pci_pm, exar_suspend, exar_resume);
 
-static const struct exar8250_board acces_com_2x = {
-	.num_ports	= 2,
-	.setup		= pci_xr17c154_setup,
-};
-
-static const struct exar8250_board acces_com_4x = {
-	.num_ports	= 4,
-	.setup		= pci_xr17c154_setup,
-};
-
-static const struct exar8250_board acces_com_8x = {
-	.num_ports	= 8,
-	.setup		= pci_xr17c154_setup,
-};
-
-
 static const struct exar8250_board pbn_fastcom335_2 = {
 	.num_ports	= 2,
 	.setup		= pci_fastcom335_setup,
@@ -810,13 +799,13 @@ static const struct exar8250_board pbn_exar_XR17V8358 = {
 	}
 
 static const struct pci_device_id exar_pci_tbl[] = {
-	EXAR_DEVICE(ACCESSIO, COM_2S, acces_com_2x),
-	EXAR_DEVICE(ACCESSIO, COM_4S, acces_com_4x),
-	EXAR_DEVICE(ACCESSIO, COM_8S, acces_com_8x),
-	EXAR_DEVICE(ACCESSIO, COM232_8, acces_com_8x),
-	EXAR_DEVICE(ACCESSIO, COM_2SM, acces_com_2x),
-	EXAR_DEVICE(ACCESSIO, COM_4SM, acces_com_4x),
-	EXAR_DEVICE(ACCESSIO, COM_8SM, acces_com_8x),
+	EXAR_DEVICE(ACCESSIO, COM_2S, pbn_exar_XR17C15x),
+	EXAR_DEVICE(ACCESSIO, COM_4S, pbn_exar_XR17C15x),
+	EXAR_DEVICE(ACCESSIO, COM_8S, pbn_exar_XR17C15x),
+	EXAR_DEVICE(ACCESSIO, COM232_8, pbn_exar_XR17C15x),
+	EXAR_DEVICE(ACCESSIO, COM_2SM, pbn_exar_XR17C15x),
+	EXAR_DEVICE(ACCESSIO, COM_4SM, pbn_exar_XR17C15x),
+	EXAR_DEVICE(ACCESSIO, COM_8SM, pbn_exar_XR17C15x),
 
 	CONNECT_DEVICE(XR17C152, UART_2_232, pbn_connect),
 	CONNECT_DEVICE(XR17C154, UART_4_232, pbn_connect),
-- 
2.34.1


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

* Re: [PATCH v1 1/1] serial: 8250_exar: derive nr_ports from ID for Acces I/O cards
  2021-12-22 19:44 [PATCH v1 1/1] serial: 8250_exar: derive nr_ports from ID for Acces I/O cards Andy Shevchenko
@ 2021-12-22 23:25   ` kernel test robot
  2021-12-23 10:05 ` Ilpo Järvinen
  1 sibling, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-12-22 23:25 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: llvm, kbuild-all

Hi Andy,

I love your patch! Yet something to improve:

[auto build test ERROR on tty/tty-testing]
[also build test ERROR on v5.16-rc6 next-20211222]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Andy-Shevchenko/serial-8250_exar-derive-nr_ports-from-ID-for-Acces-I-O-cards/20211223-034500
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
config: riscv-randconfig-r042-20211222 (https://download.01.org/0day-ci/archive/20211223/202112230724.7vFjZf3K-lkp@intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project de4e0195ae1c39f1c3b07834b8e32c113f4f20eb)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/533949cbef2191c3b9dd62584b56648987bc1e5b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Andy-Shevchenko/serial-8250_exar-derive-nr_ports-from-ID-for-Acces-I-O-cards/20211223-034500
        git checkout 533949cbef2191c3b9dd62584b56648987bc1e5b
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/tty/serial/8250/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/tty/serial/8250/8250_exar.c:627:3: error: use of undeclared identifier 'nr'
                   nr = BIT(((pcidev->device & 0x38) >> 3) - 1);
                   ^
   1 error generated.


vim +/nr +627 drivers/tty/serial/8250/8250_exar.c

   606	
   607	static int
   608	exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
   609	{
   610		unsigned int nr_ports, i, bar = 0, maxnr;
   611		struct exar8250_board *board;
   612		struct uart_8250_port uart;
   613		struct exar8250 *priv;
   614		int rc;
   615	
   616		board = (struct exar8250_board *)ent->driver_data;
   617		if (!board)
   618			return -EINVAL;
   619	
   620		rc = pcim_enable_device(pcidev);
   621		if (rc)
   622			return rc;
   623	
   624		maxnr = pci_resource_len(pcidev, bar) >> (board->reg_shift + 3);
   625	
   626		if (pcidev->vendor == PCI_VENDOR_ID_ACCESSIO)
 > 627			nr = BIT(((pcidev->device & 0x38) >> 3) - 1);
   628		else if (board->num_ports)
   629			nr_ports = board->num_ports;
   630		else
   631			nr_ports = pcidev->device & 0x0f;
   632	
   633		priv = devm_kzalloc(&pcidev->dev, struct_size(priv, line, nr_ports), GFP_KERNEL);
   634		if (!priv)
   635			return -ENOMEM;
   636	
   637		priv->board = board;
   638		priv->virt = pcim_iomap(pcidev, bar, 0);
   639		if (!priv->virt)
   640			return -ENOMEM;
   641	
   642		pci_set_master(pcidev);
   643	
   644		rc = pci_alloc_irq_vectors(pcidev, 1, 1, PCI_IRQ_ALL_TYPES);
   645		if (rc < 0)
   646			return rc;
   647	
   648		memset(&uart, 0, sizeof(uart));
   649		uart.port.flags = UPF_SHARE_IRQ | UPF_EXAR_EFR | UPF_FIXED_TYPE | UPF_FIXED_PORT;
   650		uart.port.irq = pci_irq_vector(pcidev, 0);
   651		uart.port.dev = &pcidev->dev;
   652	
   653		rc = devm_request_irq(&pcidev->dev, uart.port.irq, exar_misc_handler,
   654				 IRQF_SHARED, "exar_uart", priv);
   655		if (rc)
   656			return rc;
   657	
   658		/* Clear interrupts */
   659		exar_misc_clear(priv);
   660	
   661		for (i = 0; i < nr_ports && i < maxnr; i++) {
   662			rc = board->setup(priv, pcidev, &uart, i);
   663			if (rc) {
   664				dev_err(&pcidev->dev, "Failed to setup port %u\n", i);
   665				break;
   666			}
   667	
   668			dev_dbg(&pcidev->dev, "Setup PCI port: port %lx, irq %d, type %d\n",
   669				uart.port.iobase, uart.port.irq, uart.port.iotype);
   670	
   671			priv->line[i] = serial8250_register_8250_port(&uart);
   672			if (priv->line[i] < 0) {
   673				dev_err(&pcidev->dev,
   674					"Couldn't register serial port %lx, irq %d, type %d, error %d\n",
   675					uart.port.iobase, uart.port.irq,
   676					uart.port.iotype, priv->line[i]);
   677				break;
   678			}
   679		}
   680		priv->nr = i;
   681		pci_set_drvdata(pcidev, priv);
   682		return 0;
   683	}
   684	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

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

* Re: [PATCH v1 1/1] serial: 8250_exar: derive nr_ports from ID for Acces I/O cards
@ 2021-12-22 23:25   ` kernel test robot
  0 siblings, 0 replies; 5+ messages in thread
From: kernel test robot @ 2021-12-22 23:25 UTC (permalink / raw)
  To: kbuild-all

[-- Attachment #1: Type: text/plain, Size: 4814 bytes --]

Hi Andy,

I love your patch! Yet something to improve:

[auto build test ERROR on tty/tty-testing]
[also build test ERROR on v5.16-rc6 next-20211222]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Andy-Shevchenko/serial-8250_exar-derive-nr_ports-from-ID-for-Acces-I-O-cards/20211223-034500
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
config: riscv-randconfig-r042-20211222 (https://download.01.org/0day-ci/archive/20211223/202112230724.7vFjZf3K-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project de4e0195ae1c39f1c3b07834b8e32c113f4f20eb)
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # install riscv cross compiling tool for clang build
        # apt-get install binutils-riscv64-linux-gnu
        # https://github.com/0day-ci/linux/commit/533949cbef2191c3b9dd62584b56648987bc1e5b
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Andy-Shevchenko/serial-8250_exar-derive-nr_ports-from-ID-for-Acces-I-O-cards/20211223-034500
        git checkout 533949cbef2191c3b9dd62584b56648987bc1e5b
        # save the config file to linux build tree
        mkdir build_dir
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/tty/serial/8250/

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

>> drivers/tty/serial/8250/8250_exar.c:627:3: error: use of undeclared identifier 'nr'
                   nr = BIT(((pcidev->device & 0x38) >> 3) - 1);
                   ^
   1 error generated.


vim +/nr +627 drivers/tty/serial/8250/8250_exar.c

   606	
   607	static int
   608	exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
   609	{
   610		unsigned int nr_ports, i, bar = 0, maxnr;
   611		struct exar8250_board *board;
   612		struct uart_8250_port uart;
   613		struct exar8250 *priv;
   614		int rc;
   615	
   616		board = (struct exar8250_board *)ent->driver_data;
   617		if (!board)
   618			return -EINVAL;
   619	
   620		rc = pcim_enable_device(pcidev);
   621		if (rc)
   622			return rc;
   623	
   624		maxnr = pci_resource_len(pcidev, bar) >> (board->reg_shift + 3);
   625	
   626		if (pcidev->vendor == PCI_VENDOR_ID_ACCESSIO)
 > 627			nr = BIT(((pcidev->device & 0x38) >> 3) - 1);
   628		else if (board->num_ports)
   629			nr_ports = board->num_ports;
   630		else
   631			nr_ports = pcidev->device & 0x0f;
   632	
   633		priv = devm_kzalloc(&pcidev->dev, struct_size(priv, line, nr_ports), GFP_KERNEL);
   634		if (!priv)
   635			return -ENOMEM;
   636	
   637		priv->board = board;
   638		priv->virt = pcim_iomap(pcidev, bar, 0);
   639		if (!priv->virt)
   640			return -ENOMEM;
   641	
   642		pci_set_master(pcidev);
   643	
   644		rc = pci_alloc_irq_vectors(pcidev, 1, 1, PCI_IRQ_ALL_TYPES);
   645		if (rc < 0)
   646			return rc;
   647	
   648		memset(&uart, 0, sizeof(uart));
   649		uart.port.flags = UPF_SHARE_IRQ | UPF_EXAR_EFR | UPF_FIXED_TYPE | UPF_FIXED_PORT;
   650		uart.port.irq = pci_irq_vector(pcidev, 0);
   651		uart.port.dev = &pcidev->dev;
   652	
   653		rc = devm_request_irq(&pcidev->dev, uart.port.irq, exar_misc_handler,
   654				 IRQF_SHARED, "exar_uart", priv);
   655		if (rc)
   656			return rc;
   657	
   658		/* Clear interrupts */
   659		exar_misc_clear(priv);
   660	
   661		for (i = 0; i < nr_ports && i < maxnr; i++) {
   662			rc = board->setup(priv, pcidev, &uart, i);
   663			if (rc) {
   664				dev_err(&pcidev->dev, "Failed to setup port %u\n", i);
   665				break;
   666			}
   667	
   668			dev_dbg(&pcidev->dev, "Setup PCI port: port %lx, irq %d, type %d\n",
   669				uart.port.iobase, uart.port.irq, uart.port.iotype);
   670	
   671			priv->line[i] = serial8250_register_8250_port(&uart);
   672			if (priv->line[i] < 0) {
   673				dev_err(&pcidev->dev,
   674					"Couldn't register serial port %lx, irq %d, type %d, error %d\n",
   675					uart.port.iobase, uart.port.irq,
   676					uart.port.iotype, priv->line[i]);
   677				break;
   678			}
   679		}
   680		priv->nr = i;
   681		pci_set_drvdata(pcidev, priv);
   682		return 0;
   683	}
   684	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

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

* Re: [PATCH v1 1/1] serial: 8250_exar: derive nr_ports from ID for Acces I/O cards
  2021-12-22 19:44 [PATCH v1 1/1] serial: 8250_exar: derive nr_ports from ID for Acces I/O cards Andy Shevchenko
  2021-12-22 23:25   ` kernel test robot
@ 2021-12-23 10:05 ` Ilpo Järvinen
  2021-12-23 10:18   ` Andy Shevchenko
  1 sibling, 1 reply; 5+ messages in thread
From: Ilpo Järvinen @ 2021-12-23 10:05 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-serial, LKML, Greg Kroah-Hartman, Jiri Slaby

On Wed, 22 Dec 2021, Andy Shevchenko wrote:

> In the similar way how it's done in 8250_pericom, derive number of
> UART ports from PCI ID for Acces I/O cards.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  drivers/tty/serial/8250/8250_exar.c | 37 ++++++++++-------------------
>  1 file changed, 13 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c
> index a4508ac0cac9..cf16bd889abd 100644
> --- a/drivers/tty/serial/8250/8250_exar.c
> +++ b/drivers/tty/serial/8250/8250_exar.c
> @@ -611,7 +611,12 @@ exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
>  
>  	maxnr = pci_resource_len(pcidev, bar) >> (board->reg_shift + 3);
>  
> -	nr_ports = board->num_ports ? board->num_ports : pcidev->device & 0x0f;
> +	if (pcidev->vendor == PCI_VENDOR_ID_ACCESSIO)
> +		nr = BIT(((pcidev->device & 0x38) >> 3) - 1);

Shouldn't this be nr_ports = ...

-- 
 i.


> +	else if (board->num_ports)
> +		nr_ports = board->num_ports;
> +	else
> +		nr_ports = pcidev->device & 0x0f;
>  
>  	priv = devm_kzalloc(&pcidev->dev, struct_size(priv, line, nr_ports), GFP_KERNEL);
>  	if (!priv)
> @@ -710,22 +715,6 @@ static int __maybe_unused exar_resume(struct device *dev)
>  
>  static SIMPLE_DEV_PM_OPS(exar_pci_pm, exar_suspend, exar_resume);
>  
> -static const struct exar8250_board acces_com_2x = {
> -	.num_ports	= 2,
> -	.setup		= pci_xr17c154_setup,
> -};
> -
> -static const struct exar8250_board acces_com_4x = {
> -	.num_ports	= 4,
> -	.setup		= pci_xr17c154_setup,
> -};
> -
> -static const struct exar8250_board acces_com_8x = {
> -	.num_ports	= 8,
> -	.setup		= pci_xr17c154_setup,
> -};
> -
> -
>  static const struct exar8250_board pbn_fastcom335_2 = {
>  	.num_ports	= 2,
>  	.setup		= pci_fastcom335_setup,
> @@ -810,13 +799,13 @@ static const struct exar8250_board pbn_exar_XR17V8358 = {
>  	}
>  
>  static const struct pci_device_id exar_pci_tbl[] = {
> -	EXAR_DEVICE(ACCESSIO, COM_2S, acces_com_2x),
> -	EXAR_DEVICE(ACCESSIO, COM_4S, acces_com_4x),
> -	EXAR_DEVICE(ACCESSIO, COM_8S, acces_com_8x),
> -	EXAR_DEVICE(ACCESSIO, COM232_8, acces_com_8x),
> -	EXAR_DEVICE(ACCESSIO, COM_2SM, acces_com_2x),
> -	EXAR_DEVICE(ACCESSIO, COM_4SM, acces_com_4x),
> -	EXAR_DEVICE(ACCESSIO, COM_8SM, acces_com_8x),
> +	EXAR_DEVICE(ACCESSIO, COM_2S, pbn_exar_XR17C15x),
> +	EXAR_DEVICE(ACCESSIO, COM_4S, pbn_exar_XR17C15x),
> +	EXAR_DEVICE(ACCESSIO, COM_8S, pbn_exar_XR17C15x),
> +	EXAR_DEVICE(ACCESSIO, COM232_8, pbn_exar_XR17C15x),
> +	EXAR_DEVICE(ACCESSIO, COM_2SM, pbn_exar_XR17C15x),
> +	EXAR_DEVICE(ACCESSIO, COM_4SM, pbn_exar_XR17C15x),
> +	EXAR_DEVICE(ACCESSIO, COM_8SM, pbn_exar_XR17C15x),
>  
>  	CONNECT_DEVICE(XR17C152, UART_2_232, pbn_connect),
>  	CONNECT_DEVICE(XR17C154, UART_4_232, pbn_connect),
> 


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

* Re: [PATCH v1 1/1] serial: 8250_exar: derive nr_ports from ID for Acces I/O cards
  2021-12-23 10:05 ` Ilpo Järvinen
@ 2021-12-23 10:18   ` Andy Shevchenko
  0 siblings, 0 replies; 5+ messages in thread
From: Andy Shevchenko @ 2021-12-23 10:18 UTC (permalink / raw)
  To: Ilpo Järvinen; +Cc: linux-serial, LKML, Greg Kroah-Hartman, Jiri Slaby

On Thu, Dec 23, 2021 at 12:05:11PM +0200, Ilpo Järvinen wrote:
> On Wed, 22 Dec 2021, Andy Shevchenko wrote:

...

> > -	nr_ports = board->num_ports ? board->num_ports : pcidev->device & 0x0f;
> > +	if (pcidev->vendor == PCI_VENDOR_ID_ACCESSIO)
> > +		nr = BIT(((pcidev->device & 0x38) >> 3) - 1);
> 
> Shouldn't this be nr_ports = ...

Yeah, sorry for that. By some reason I have no such config option enabled and
my builds haven't failed.

-- 
With Best Regards,
Andy Shevchenko



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

end of thread, other threads:[~2021-12-23 10:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-22 19:44 [PATCH v1 1/1] serial: 8250_exar: derive nr_ports from ID for Acces I/O cards Andy Shevchenko
2021-12-22 23:25 ` kernel test robot
2021-12-22 23:25   ` kernel test robot
2021-12-23 10:05 ` Ilpo Järvinen
2021-12-23 10:18   ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.