All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v2 1/2] serial: 8250_pci: Replace custom pci_match_id() implementation
@ 2021-10-26 14:47 kernel test robot
  0 siblings, 0 replies; 8+ messages in thread
From: kernel test robot @ 2021-10-26 14:47 UTC (permalink / raw)
  To: kbuild

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

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20211025124533.29977-1-andriy.shevchenko@linux.intel.com>
References: <20211025124533.29977-1-andriy.shevchenko@linux.intel.com>
TO: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
TO: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
TO: linux-serial(a)vger.kernel.org
TO: linux-kernel(a)vger.kernel.org
CC: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
CC: Jiri Slaby <jirislaby@kernel.org>

Hi Andy,

I love your patch! Perhaps something to improve:

[auto build test WARNING on tty/tty-testing]
[cannot apply to v5.15-rc7 next-20211026]
[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_pci-Replace-custom-pci_match_id-implementation/20211025-204752
base:   https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
:::::: branch date: 26 hours ago
:::::: commit date: 26 hours ago
config: i386-randconfig-m021-20211025 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

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

smatch warnings:
drivers/tty/serial/8250/8250_pci.c:1273 pci_quatech_init() error: uninitialized symbol 'amcc'.

vim +/amcc +1273 drivers/tty/serial/8250/8250_pci.c

55c7c0fdc5aae4 Alan Cox        2012-11-29  1261  
55c7c0fdc5aae4 Alan Cox        2012-11-29  1262  static int pci_quatech_init(struct pci_dev *dev)
55c7c0fdc5aae4 Alan Cox        2012-11-29  1263  {
24a32531ba63f4 Andy Shevchenko 2021-10-25  1264  	const struct pci_device_id *match;
24a32531ba63f4 Andy Shevchenko 2021-10-25  1265  	bool amcc;
24a32531ba63f4 Andy Shevchenko 2021-10-25  1266  
24a32531ba63f4 Andy Shevchenko 2021-10-25  1267  	match = pci_match_id(quatech_cards, dev);
24a32531ba63f4 Andy Shevchenko 2021-10-25  1268  	if (match)
24a32531ba63f4 Andy Shevchenko 2021-10-25  1269  		amcc = match->driver_data;
24a32531ba63f4 Andy Shevchenko 2021-10-25  1270  	else
24a32531ba63f4 Andy Shevchenko 2021-10-25  1271  		pci_err(dev, "unknown port type '0x%04X'.\n", dev->device);
24a32531ba63f4 Andy Shevchenko 2021-10-25  1272  
24a32531ba63f4 Andy Shevchenko 2021-10-25 @1273  	if (amcc) {
55c7c0fdc5aae4 Alan Cox        2012-11-29  1274  		unsigned long base = pci_resource_start(dev, 0);
55c7c0fdc5aae4 Alan Cox        2012-11-29  1275  		if (base) {
55c7c0fdc5aae4 Alan Cox        2012-11-29  1276  			u32 tmp;
1a33e342cf35e5 Anton Wuerfel   2016-01-14  1277  
9c5320f8d7d9a2 Jonathan Woithe 2013-12-09  1278  			outl(inl(base + 0x38) | 0x00002000, base + 0x38);
55c7c0fdc5aae4 Alan Cox        2012-11-29  1279  			tmp = inl(base + 0x3c);
55c7c0fdc5aae4 Alan Cox        2012-11-29  1280  			outl(tmp | 0x01000000, base + 0x3c);
9c5320f8d7d9a2 Jonathan Woithe 2013-12-09  1281  			outl(tmp &= ~0x01000000, base + 0x3c);
55c7c0fdc5aae4 Alan Cox        2012-11-29  1282  		}
55c7c0fdc5aae4 Alan Cox        2012-11-29  1283  	}
55c7c0fdc5aae4 Alan Cox        2012-11-29  1284  	return 0;
55c7c0fdc5aae4 Alan Cox        2012-11-29  1285  }
55c7c0fdc5aae4 Alan Cox        2012-11-29  1286  

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

[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 39144 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread
* [PATCH v2 1/2] serial: 8250_pci: Replace custom pci_match_id() implementation
@ 2021-10-25 12:45 Andy Shevchenko
  2021-10-26 12:45   ` kernel test robot
  0 siblings, 1 reply; 8+ messages in thread
From: Andy Shevchenko @ 2021-10-25 12:45 UTC (permalink / raw)
  To: Andy Shevchenko, linux-serial, linux-kernel
  Cc: Greg Kroah-Hartman, Jiri Slaby

Replace pci_quatech_amcc() with generic pci_match_id().

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
v2: corrected set of patches, so this one is new
 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..1d5579143fc8 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;
+
+	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] 8+ messages in thread

end of thread, other threads:[~2021-10-26 14:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-26 14:47 [PATCH v2 1/2] serial: 8250_pci: Replace custom pci_match_id() implementation kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2021-10-25 12:45 Andy Shevchenko
2021-10-26 12:45 ` kernel test robot
2021-10-26 12:45   ` kernel test robot
2021-10-26 13:25   ` Andy Shevchenko
2021-10-26 13:25     ` Andy Shevchenko
2021-10-26 13:35     ` Andy Shevchenko
2021-10-26 13:35       ` 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.