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>,
LKML <linux-kernel@vger.kernel.org>,
linux-serial <linux-serial@vger.kernel.org>,
Parker Newman <pnewman@connecttech.com>
Subject: Re: [PATCH v4 2/7] serial: exar: added a exar_get_nr_ports function
Date: Thu, 18 Apr 2024 14:32:01 +0300 (EEST) [thread overview]
Message-ID: <e5ea43d8-90a1-c157-9932-99192fc5d138@linux.intel.com> (raw)
In-Reply-To: <33f2bf66bc334573c10cf670a299ecef0b7264bc.1713382717.git.pnewman@connecttech.com>
[-- Attachment #1: Type: text/plain, Size: 2271 bytes --]
On Wed, 17 Apr 2024, Parker Newman wrote:
> From: Parker Newman <pnewman@connecttech.com>
>
> Moved code for getting number of ports from exar_pci_probe() to a
> separate exar_get_nr_ports() function. CTI specific code will be added
> in another patch in this series.
>
> Signed-off-by: Parker Newman <pnewman@connecttech.com>
> ---
> Changes in v3:
> - Only moved existing code in this patch, will add CTI code in subsequent
> patch
>
> drivers/tty/serial/8250/8250_exar.c | 27 +++++++++++++++++++++------
> 1 file changed, 21 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_exar.c b/drivers/tty/serial/8250/8250_exar.c
> index 04ce5e8ddb24..72385c7d2eda 100644
> --- a/drivers/tty/serial/8250/8250_exar.c
> +++ b/drivers/tty/serial/8250/8250_exar.c
> @@ -704,6 +704,21 @@ static irqreturn_t exar_misc_handler(int irq, void *data)
> return IRQ_HANDLED;
> }
>
> +static unsigned int exar_get_nr_ports(struct exar8250_board *board,
> + struct pci_dev *pcidev)
> +{
> + unsigned int nr_ports = 0;
It's always set, so no need to initialize.
> + if (pcidev->vendor == PCI_VENDOR_ID_ACCESSIO)
> + nr_ports = BIT(((pcidev->device & 0x38) >> 3) - 1);
> + else if (board->num_ports)
> + nr_ports = board->num_ports;
> + else
> + nr_ports = pcidev->device & 0x0f;
> +
> + return nr_ports;
> +}
> +
> static int
> exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
> {
> @@ -723,12 +738,12 @@ exar_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *ent)
>
> maxnr = pci_resource_len(pcidev, bar) >> (board->reg_shift + 3);
>
> - if (pcidev->vendor == PCI_VENDOR_ID_ACCESSIO)
> - nr_ports = BIT(((pcidev->device & 0x38) >> 3) - 1);
> - else if (board->num_ports)
> - nr_ports = board->num_ports;
> - else
> - nr_ports = pcidev->device & 0x0f;
> + nr_ports = exar_get_nr_ports(board, pcidev);
> + if (nr_ports == 0) {
> + dev_err_probe(&pcidev->dev, -ENODEV,
> + "failed to get number of ports\n");
> + return -ENODEV;
return dev_err_probe(&pcidev->dev, -ENODEV,
"failed to get number of ports\n");
Other than those two small things,
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
--
i.
next prev parent reply other threads:[~2024-04-18 11:32 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 [this message]
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
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=e5ea43d8-90a1-c157-9932-99192fc5d138@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