* [PATCH v3 1/2] serial: 8250_pci: Replace custom pci_match_id() implementation
@ 2021-10-26 13:34 Andy Shevchenko
2021-10-26 13:34 ` [PATCH v3 2/2] serial: 8250_pci: Remove empty stub pci_quatech_exit() Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2021-10-26 13:34 UTC (permalink / raw)
To: Greg Kroah-Hartman, Andy Shevchenko, linux-serial, linux-kernel
Cc: Jiri Slaby
Replace pci_quatech_amcc() with generic pci_match_id().
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v3: fixed uninitialized boolean variable (lkp)
drivers/tty/serial/8250/8250_pci.c | 72 +++++++++++++-----------------
1 file changed, 31 insertions(+), 41 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
index aea12263a1ff..1c2eb44e9c33 100644
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -1063,13 +1063,6 @@ static int pci_asix_setup(struct serial_private *priv,
return pci_default_setup(priv, board, port, idx);
}
-/* Quatech devices have their own extra interface features */
-
-struct quatech_feature {
- u16 devid;
- bool amcc;
-};
-
#define QPCR_TEST_FOR1 0x3F
#define QPCR_TEST_GET1 0x00
#define QPCR_TEST_FOR2 0x40
@@ -1085,42 +1078,30 @@ struct quatech_feature {
#define QOPR_CLOCK_X8 0x0003
#define QOPR_CLOCK_RATE_MASK 0x0003
-
-static struct quatech_feature quatech_cards[] = {
- { PCI_DEVICE_ID_QUATECH_QSC100, 1 },
- { PCI_DEVICE_ID_QUATECH_DSC100, 1 },
- { PCI_DEVICE_ID_QUATECH_DSC100E, 0 },
- { PCI_DEVICE_ID_QUATECH_DSC200, 1 },
- { PCI_DEVICE_ID_QUATECH_DSC200E, 0 },
- { PCI_DEVICE_ID_QUATECH_ESC100D, 1 },
- { PCI_DEVICE_ID_QUATECH_ESC100M, 1 },
- { PCI_DEVICE_ID_QUATECH_QSCP100, 1 },
- { PCI_DEVICE_ID_QUATECH_DSCP100, 1 },
- { PCI_DEVICE_ID_QUATECH_QSCP200, 1 },
- { PCI_DEVICE_ID_QUATECH_DSCP200, 1 },
- { PCI_DEVICE_ID_QUATECH_ESCLP100, 0 },
- { PCI_DEVICE_ID_QUATECH_QSCLP100, 0 },
- { PCI_DEVICE_ID_QUATECH_DSCLP100, 0 },
- { PCI_DEVICE_ID_QUATECH_SSCLP100, 0 },
- { PCI_DEVICE_ID_QUATECH_QSCLP200, 0 },
- { PCI_DEVICE_ID_QUATECH_DSCLP200, 0 },
- { PCI_DEVICE_ID_QUATECH_SSCLP200, 0 },
- { PCI_DEVICE_ID_QUATECH_SPPXP_100, 0 },
+/* Quatech devices have their own extra interface features */
+static struct pci_device_id quatech_cards[] = {
+ { PCI_DEVICE_DATA(QUATECH, QSC100, 1) },
+ { PCI_DEVICE_DATA(QUATECH, DSC100, 1) },
+ { PCI_DEVICE_DATA(QUATECH, DSC100E, 0) },
+ { PCI_DEVICE_DATA(QUATECH, DSC200, 1) },
+ { PCI_DEVICE_DATA(QUATECH, DSC200E, 0) },
+ { PCI_DEVICE_DATA(QUATECH, ESC100D, 1) },
+ { PCI_DEVICE_DATA(QUATECH, ESC100M, 1) },
+ { PCI_DEVICE_DATA(QUATECH, QSCP100, 1) },
+ { PCI_DEVICE_DATA(QUATECH, DSCP100, 1) },
+ { PCI_DEVICE_DATA(QUATECH, QSCP200, 1) },
+ { PCI_DEVICE_DATA(QUATECH, DSCP200, 1) },
+ { PCI_DEVICE_DATA(QUATECH, ESCLP100, 0) },
+ { PCI_DEVICE_DATA(QUATECH, QSCLP100, 0) },
+ { PCI_DEVICE_DATA(QUATECH, DSCLP100, 0) },
+ { PCI_DEVICE_DATA(QUATECH, SSCLP100, 0) },
+ { PCI_DEVICE_DATA(QUATECH, QSCLP200, 0) },
+ { PCI_DEVICE_DATA(QUATECH, DSCLP200, 0) },
+ { PCI_DEVICE_DATA(QUATECH, SSCLP200, 0) },
+ { PCI_DEVICE_DATA(QUATECH, SPPXP_100, 0) },
{ 0, }
};
-static int pci_quatech_amcc(struct pci_dev *dev)
-{
- struct quatech_feature *qf = &quatech_cards[0];
- while (qf->devid) {
- if (qf->devid == dev->device)
- return qf->amcc;
- qf++;
- }
- pci_err(dev, "unknown port type '0x%04X'.\n", dev->device);
- return 0;
-};
-
static int pci_quatech_rqopr(struct uart_8250_port *port)
{
unsigned long base = port->port.iobase;
@@ -1280,7 +1261,16 @@ static int pci_quatech_rs422(struct uart_8250_port *port)
static int pci_quatech_init(struct pci_dev *dev)
{
- if (pci_quatech_amcc(dev)) {
+ const struct pci_device_id *match;
+ bool amcc = false;
+
+ match = pci_match_id(quatech_cards, dev);
+ if (match)
+ amcc = match->driver_data;
+ else
+ pci_err(dev, "unknown port type '0x%04X'.\n", dev->device);
+
+ if (amcc) {
unsigned long base = pci_resource_start(dev, 0);
if (base) {
u32 tmp;
--
2.33.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH v3 2/2] serial: 8250_pci: Remove empty stub pci_quatech_exit()
2021-10-26 13:34 [PATCH v3 1/2] serial: 8250_pci: Replace custom pci_match_id() implementation Andy Shevchenko
@ 2021-10-26 13:34 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2021-10-26 13:34 UTC (permalink / raw)
To: Greg Kroah-Hartman, Andy Shevchenko, linux-serial, linux-kernel
Cc: Jiri Slaby
The ->exit() callback is checked for presence anyway,
no need to have an empty stub.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v3: no changes
drivers/tty/serial/8250/8250_pci.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
index 1c2eb44e9c33..5d43de143f33 100644
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -1298,10 +1298,6 @@ static int pci_quatech_setup(struct serial_private *priv,
return pci_default_setup(priv, board, port, idx);
}
-static void pci_quatech_exit(struct pci_dev *dev)
-{
-}
-
static int pci_default_setup(struct serial_private *priv,
const struct pciserial_board *board,
struct uart_8250_port *port, int idx)
@@ -2176,7 +2172,6 @@ static struct pci_serial_quirk pci_serial_quirks[] = {
.subdevice = PCI_ANY_ID,
.init = pci_quatech_init,
.setup = pci_quatech_setup,
- .exit = pci_quatech_exit,
},
/*
* Panacom
--
2.33.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-26 13:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 13:34 [PATCH v3 1/2] serial: 8250_pci: Replace custom pci_match_id() implementation Andy Shevchenko
2021-10-26 13:34 ` [PATCH v3 2/2] serial: 8250_pci: Remove empty stub pci_quatech_exit() Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).