public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Parker Newman <parker@finest.io>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Jiri Slaby <jirislaby@kernel.org>,
	linux-kernel@vger.kernel.org,  linux-serial@vger.kernel.org,
	Parker Newman <pnewman@connecttech.com>
Subject: Re: [PATCH v4 5/7] serial: exar: add CTI cards to exar_get_nr_ports
Date: Thu, 18 Apr 2024 14:43:32 +0300 (EEST)	[thread overview]
Message-ID: <60790bd3-d35a-026d-ef38-ae3b12160fbe@linux.intel.com> (raw)
In-Reply-To: <0c64bdf852f39aec966b38696695d951e485d7e6.1713382717.git.pnewman@connecttech.com>

On Wed, 17 Apr 2024, Parker Newman wrote:

> From: Parker Newman <pnewman@connecttech.com>
> 
> Add code for getting number of ports of CTI cards to
> exar_get_nr_ports().
> 
> Signed-off-by: Parker Newman <pnewman@connecttech.com>
> ---
> Changes in v3:
> - moved to separate patch
> - added spaces to single line comments
> 
>  drivers/tty/serial/8250/8250_exar.c | 22 +++++++++++++++++++---
>  1 file changed, 19 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c
> index e68029a59122..197f45e306ff 100644
> --- a/drivers/tty/serial/8250/8250_exar.c
> +++ b/drivers/tty/serial/8250/8250_exar.c
> @@ -711,12 +711,28 @@ static unsigned int exar_get_nr_ports(struct exar8250_board *board,
>  {
>  	unsigned int nr_ports = 0;
> 
> -	if (pcidev->vendor == PCI_VENDOR_ID_ACCESSIO)
> +	if (pcidev->vendor == PCI_VENDOR_ID_ACCESSIO) {

You can add the braces while you moved the code around so you don't need 
to play with them again here and this patch can be more to the point.

>  		nr_ports = BIT(((pcidev->device & 0x38) >> 3) - 1);
> -	else if (board->num_ports)
> +	} else if (board->num_ports > 0) {
> +		// Check if board struct overrides number of ports
>  		nr_ports = board->num_ports;

The comment just tells what the code does, IMO that comment doesn't add 
any value.

> -	else
> +	} else if (pcidev->vendor == PCI_VENDOR_ID_EXAR) {
> +		// Exar encodes # ports in last nibble of PCI Device ID ex. 0358

This comment you can also add while you moved the code around (or make 
another patch out of it after moving).

-- 
 i.

>  		nr_ports = pcidev->device & 0x0f;
> +	} else  if (pcidev->vendor == PCI_VENDOR_ID_CONNECT_TECH) {
> +		// Handle CTI FPGA cards
> +		switch (pcidev->device) {
> +		case PCI_DEVICE_ID_CONNECT_TECH_PCI_XR79X_12_XIG00X:
> +		case PCI_DEVICE_ID_CONNECT_TECH_PCI_XR79X_12_XIG01X:
> +			nr_ports = 12;
> +			break;
> +		case PCI_DEVICE_ID_CONNECT_TECH_PCI_XR79X_16:
> +			nr_ports = 16;
> +			break;
> +		default:
> +			break;
> +		}
> +	}
> 
>  	return nr_ports;
>  }
> --
> 2.43.2
> 
> 

  reply	other threads:[~2024-04-18 11:43 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-17 20:31 [PATCH v4 0/7] serial: exar: add Connect Tech serial cards to Exar driver Parker Newman
2024-04-17 20:31 ` [PATCH v4 1/7] serial: exar: remove old Connect Tech setup Parker Newman
2024-04-17 20:31 ` [PATCH v4 2/7] serial: exar: added a exar_get_nr_ports function Parker Newman
2024-04-18 11:32   ` Ilpo Järvinen
2024-04-17 20:31 ` [PATCH v4 3/7] serial: exar: add optional board_init function Parker Newman
2024-04-18 11:32   ` Ilpo Järvinen
2024-04-17 20:31 ` [PATCH v4 4/7] serial: exar: moved generic_rs485 further up in 8250_exar.c Parker Newman
2024-04-18 11:37   ` Ilpo Järvinen
2024-04-17 20:31 ` [PATCH v4 5/7] serial: exar: add CTI cards to exar_get_nr_ports Parker Newman
2024-04-18 11:43   ` Ilpo Järvinen [this message]
2024-04-17 20:31 ` [PATCH v4 6/7] serial: exar: add CTI specific setup code Parker Newman
2024-04-18  5:29   ` kernel test robot
2024-04-18  5:42     ` Greg Kroah-Hartman
2024-04-18 13:20   ` Ilpo Järvinen
2024-04-18 14:21     ` Parker Newman
2024-04-18 16:29       ` Ilpo Järvinen
2024-04-18 17:03         ` Parker Newman
2024-04-18 17:25           ` Ilpo Järvinen
2024-04-17 20:31 ` [PATCH v4 7/7] serial: exar: fix checkpach warnings Parker Newman
2024-04-18  6:25 ` [PATCH v4 0/7] serial: exar: add Connect Tech serial cards to Exar driver Greg Kroah-Hartman
2024-04-18 12:40   ` Parker Newman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=60790bd3-d35a-026d-ef38-ae3b12160fbe@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jirislaby@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=parker@finest.io \
    --cc=pnewman@connecttech.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox