[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <68d533d5-dbc8-4be3-a1fc-b3dd28b8f9df@kernel.org>
Date: Mon, 2 Oct 2023 08:51:03 +0200
From: Jiri Slaby <jirislaby@...nel.org>
To: Crescent CY Hsieh <crescentcy.hsieh@...a.com>,
gregkh@...uxfoundation.org
Cc: linux-kernel@...r.kernel.org, linux-serial@...r.kernel.org
Subject: Re: [PATCH 1/4] tty: serial: 8250: Cleanup MOXA configurations in
8250_pci.c
Hi,
On 02. 10. 23, 3:56, Crescent CY Hsieh wrote:
> To enhance the maintainability of MOXA configurations in 8250_pci.c,
> clean up the code to achieve simplicity, clarity and consistency.
>
> Signed-off-by: Crescent CY Hsieh <crescentcy.hsieh@...a.com>
> ---
> drivers/tty/serial/8250/8250_pci.c | 73 +++++++++++-------------------
> 1 file changed, 26 insertions(+), 47 deletions(-)
>
> diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
> index 62a9bd30b4db..a010790ccfcd 100644
> --- a/drivers/tty/serial/8250/8250_pci.c
> +++ b/drivers/tty/serial/8250/8250_pci.c
> @@ -1887,10 +1887,10 @@ pci_sunix_setup(struct serial_private *priv,
> return setup_port(priv, port, bar, offset, 0);
> }
>
> -static int
> -pci_moxa_setup(struct serial_private *priv,
> - const struct pciserial_board *board,
> - struct uart_8250_port *port, int idx)
> +static int pci_moxa_setup(struct serial_private *priv,
> + const struct pciserial_board *board,
> + struct uart_8250_port *port,
> + int idx)
You should either change all or none.
> {
> unsigned int bar = FL_GET_BASE(board->flags);
> int offset;
> @@ -1958,6 +1958,9 @@ pci_moxa_setup(struct serial_private *priv,
> #define PCIE_DEVICE_ID_WCH_CH384_8S 0x3853
> #define PCIE_DEVICE_ID_WCH_CH382_2S 0x3253
>
> +/* MOXA */
> +#define PCI_VENDOR_ID_MOXA 0x1393
Isn't this a redefinition of the pci-ids.h one?
> +/* MOXA PCIe */
> #define PCI_DEVICE_ID_MOXA_CP102E 0x1024
> #define PCI_DEVICE_ID_MOXA_CP102EL 0x1025
> #define PCI_DEVICE_ID_MOXA_CP104EL_A 0x1045
> @@ -2854,9 +2857,9 @@ enum pci_board_num_t {
> pbn_titan_2_4000000,
> pbn_titan_4_4000000,
> pbn_titan_8_4000000,
> - pbn_moxa8250_2p,
> - pbn_moxa8250_4p,
> - pbn_moxa8250_8p,
> + pbn_moxa_2,
> + pbn_moxa_4,
> + pbn_moxa_8,
This should be in a separate patch.
> };
>
> /*
> @@ -3628,19 +3631,19 @@ static struct pciserial_board pci_boards[] = {
> .uart_offset = 0x200,
> .first_offset = 0x1000,
> },
> - [pbn_moxa8250_2p] = {
> + [pbn_moxa_2] = {
> .flags = FL_BASE1,
> .num_ports = 2,
> .base_baud = 921600,
> .uart_offset = 0x200,
> },
> - [pbn_moxa8250_4p] = {
> + [pbn_moxa_4] = {
> .flags = FL_BASE1,
> .num_ports = 4,
> .base_baud = 921600,
> .uart_offset = 0x200,
> },
> - [pbn_moxa8250_8p] = {
> + [pbn_moxa_8] = {
> .flags = FL_BASE1,
> .num_ports = 8,
> .base_baud = 921600,
> @@ -5347,44 +5350,20 @@ static const struct pci_device_id serial_pci_tbl[] = {
> pbn_ni8430_4 },
>
> /*
> - * MOXA
> + * MOXA PCIe
> */
> - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP102E,
> - PCI_ANY_ID, PCI_ANY_ID, 0, 0,
> - pbn_moxa8250_2p },
> - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP102EL,
> - PCI_ANY_ID, PCI_ANY_ID, 0, 0,
> - pbn_moxa8250_2p },
> - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP104EL_A,
> - PCI_ANY_ID, PCI_ANY_ID, 0, 0,
> - pbn_moxa8250_4p },
> - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP114EL,
> - PCI_ANY_ID, PCI_ANY_ID, 0, 0,
> - pbn_moxa8250_4p },
> - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP116E_A_A,
> - PCI_ANY_ID, PCI_ANY_ID, 0, 0,
> - pbn_moxa8250_8p },
> - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP116E_A_B,
> - PCI_ANY_ID, PCI_ANY_ID, 0, 0,
> - pbn_moxa8250_8p },
> - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP118EL_A,
> - PCI_ANY_ID, PCI_ANY_ID, 0, 0,
> - pbn_moxa8250_8p },
> - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP118E_A_I,
> - PCI_ANY_ID, PCI_ANY_ID, 0, 0,
> - pbn_moxa8250_8p },
> - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP132EL,
> - PCI_ANY_ID, PCI_ANY_ID, 0, 0,
> - pbn_moxa8250_2p },
> - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP134EL_A,
> - PCI_ANY_ID, PCI_ANY_ID, 0, 0,
> - pbn_moxa8250_4p },
> - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP138E_A,
> - PCI_ANY_ID, PCI_ANY_ID, 0, 0,
> - pbn_moxa8250_8p },
> - { PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP168EL_A,
> - PCI_ANY_ID, PCI_ANY_ID, 0, 0,
> - pbn_moxa8250_8p },
> + { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP102E), 0, 0, pbn_moxa_2 },
> + { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP102EL), 0, 0, pbn_moxa_2 },
> + { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP104EL_A), 0, 0, pbn_moxa_4 },
> + { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP114EL), 0, 0, pbn_moxa_4 },
> + { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP116E_A_A), 0, 0, pbn_moxa_8 },
> + { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP116E_A_B), 0, 0, pbn_moxa_8 },
> + { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP118EL_A), 0, 0, pbn_moxa_8 },
> + { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP118E_A_I), 0, 0, pbn_moxa_8 },
> + { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP132EL), 0, 0, pbn_moxa_2 },
> + { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP134EL_A), 0, 0, pbn_moxa_4 },
> + { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP138E_A), 0, 0, pbn_moxa_8 },
> + { PCI_DEVICE(PCI_VENDOR_ID_MOXA, PCI_DEVICE_ID_MOXA_CP168EL_A), 0, 0, pbn_moxa_8 },
Use PCI_VDEVICE()?
thanks,
--
js
suse labs
Powered by blists - more mailing lists