Skip to content

Commit 54b2f30

Browse files
Heikki Krogerusgregkh
authored andcommitted
serial: 8250_pci: Replace custom code with pci_match_id()
serial_pci_is_blacklisted() is very similar to pci_match_id() implementation. Replace it with the latter. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c744ca3 commit 54b2f30

File tree

1 file changed

+7
-22
lines changed

1 file changed

+7
-22
lines changed

drivers/tty/serial/8250/8250_pci.c

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3375,6 +3375,9 @@ static const struct pci_device_id blacklist[] = {
33753375
/* Exar devices */
33763376
{ PCI_VDEVICE(EXAR, PCI_ANY_ID), },
33773377
{ PCI_VDEVICE(COMMTECH, PCI_ANY_ID), },
3378+
3379+
/* End of the black list */
3380+
{ }
33783381
};
33793382

33803383
static int serial_pci_is_class_communication(struct pci_dev *dev)
@@ -3392,25 +3395,6 @@ static int serial_pci_is_class_communication(struct pci_dev *dev)
33923395
return 0;
33933396
}
33943397

3395-
static int serial_pci_is_blacklisted(struct pci_dev *dev)
3396-
{
3397-
const struct pci_device_id *bldev;
3398-
3399-
/*
3400-
* Do not access blacklisted devices that are known not to
3401-
* feature serial ports or are handled by other modules.
3402-
*/
3403-
for (bldev = blacklist;
3404-
bldev < blacklist + ARRAY_SIZE(blacklist);
3405-
bldev++) {
3406-
if (dev->vendor == bldev->vendor &&
3407-
dev->device == bldev->device)
3408-
return -ENODEV;
3409-
}
3410-
3411-
return 0;
3412-
}
3413-
34143398
/*
34153399
* Given a complete unknown PCI device, try to use some heuristics to
34163400
* guess what the configuration might be, based on the pitiful PCI
@@ -3634,6 +3618,7 @@ pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent)
36343618
struct pci_serial_quirk *quirk;
36353619
struct serial_private *priv;
36363620
const struct pciserial_board *board;
3621+
const struct pci_device_id *exclude;
36373622
struct pciserial_board tmp;
36383623
int rc;
36393624

@@ -3652,9 +3637,9 @@ pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent)
36523637

36533638
board = &pci_boards[ent->driver_data];
36543639

3655-
rc = serial_pci_is_blacklisted(dev);
3656-
if (rc)
3657-
return rc;
3640+
exclude = pci_match_id(blacklist, dev);
3641+
if (exclude)
3642+
return -ENODEV;
36583643

36593644
rc = pcim_enable_device(dev);
36603645
pci_save_state(dev);

0 commit comments

Comments
 (0)