Re: [PATCH] drivers/serial/8250_pci.c (add support for '8-port RS-232 MIC-3620 from advantech'

From: Michael Bramer
Date: Thu Jan 22 2009 - 06:00:29 EST


On Thu, Jan 22, 2009 at 10:03:53AM +0100, Niels de Vos wrote:
> Tosoni wrote:
> >> On Wed, Jan 21, 2009 at 12:32:15PM +0000, Alan Cox wrote:
> >>>>>> static struct pci_device_id serial_pci_tbl[] = {
> >>>>>> + { PCI_VENDOR_ID_ADVANTECH,
> >> PCI_DEVICE_ID_ADVANTECH_PCI3620,
> >>>>>> + 0x3620, PCI_ANY_ID, 0, 0,
> >>>> Why not use PCI_VENDOR_ID_ADVANTECH as PCI_SUBVENDOR_ID too?
> >>> The Advantech vendor id is not 0x3620. This confused me as
> >> well which is
> >>> why I asked for an lspci. Advantech has stuck the device id in the
> >>> subvendor bits and '1' in the subdevice (so it should be 1 not
> >>> PCI_ANY_ID).
> >> is this better?
> >>
> >> + { PCI_VENDOR_ID_ADVANTECH,
> >> PCI_DEVICE_ID_ADVANTECH_PCI3620,
> >> + PCI_DEVICE_ID_ADVANTECH_PCI3620, 1, 0, 0,
> >
> > Since the name describes a device id where it should be a (sub)vendor id,
> > I would suggest that you add a line of comment to explain the case.
> > So that no one will be tempted to change it back to PCI_VENDOR_ID_ADVANTECH
> > in the future.
>
> Definitely!

Is the patch now ok?

----
This Patch add the device information for the
MIC-3620 8-port RS-232 cPCI card from Advantech Co. Ltd.

Signed-off-by: Michael Bramer <grisu@xxxxxxxxxxxxxx>
--- a/drivers/serial/8250_pci.c 2008-07-13 23:51:29.000000000 +0200
+++ b/drivers/serial/8250_pci.c 2009-01-17 21:37:37.000000000 +0100
@@ -769,6 +768,8 @@
#define PCI_SUBDEVICE_ID_OCTPRO422 0x0208
#define PCI_SUBDEVICE_ID_POCTAL232 0x0308
#define PCI_SUBDEVICE_ID_POCTAL422 0x0408
+#define PCI_VENDOR_ID_ADVANTECH 0x13fe
+#define PCI_DEVICE_ID_ADVANTECH_PCI3620 0x3620

/*
* Master list of serial port init/setup/exit quirks.
@@ -2054,6 +2041,10 @@
#endif

static struct pci_device_id serial_pci_tbl[] = {
+ // Advantech use PCI_DEVICE_ID_ADVANTECH_PCI3620 (0x3620) as 'PCI_SUBVENDOR_ID'
+ { PCI_VENDOR_ID_ADVANTECH, PCI_DEVICE_ID_ADVANTECH_PCI3620,
+ PCI_DEVICE_ID_ADVANTECH_PCI3620, 1, 0, 0,
+ pbn_b2_8_921600 },
{ PCI_VENDOR_ID_V3, PCI_DEVICE_ID_V3_V960,
PCI_SUBVENDOR_ID_CONNECT_TECH,
PCI_SUBDEVICE_ID_CONNECT_TECH_BH8_232, 0, 0,
----


Gruss
Grisu
--
Michael Bramer -- http://www.feuerwehr.kreuzau.de/wiki/
PGP: finger grisu@xxxxxxxxxxxxx -- Linux Sysadmin -- Use Debian Linux
"Wenn ich die Folgen geahnt hätte, wäre ich Uhrmacher geworden!"
--- Albert Einstein
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/