[Xenomai-git] Wolfgang Grandegger : rtcan: ixxat-pci: fix problems with device probing

2009-05-28 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: c8a6467245590c4d4813e105707822381804b6b7
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=c8a6467245590c4d4813e105707822381804b6b7

Author: Wolfgang Grandegger 
Date:   Mon May 25 09:39:43 2009 +0200

rtcan: ixxat-pci: fix problems with device probing

This patch fixes problems with probing and registration of the
RTCAN IXXAT PCI driver as reported by Stefan Kisdaroczi and
Sebastian Smolorz. The PCI device id table entry now specifies
the PCI sub-system id avoiding the driver's probe function to
be call unnecessarily (a PLX9050 is used for many other non-can
PCI devices). This also makes the checking of the sub-system id
obsolete.

Signed-off-by: Wolfgang Grandegger 

---

 ksrc/drivers/can/sja1000/rtcan_ixxat_pci.c |   13 -
 1 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/ksrc/drivers/can/sja1000/rtcan_ixxat_pci.c 
b/ksrc/drivers/can/sja1000/rtcan_ixxat_pci.c
index cd809b4..5faa763 100644
--- a/ksrc/drivers/can/sja1000/rtcan_ixxat_pci.c
+++ b/ksrc/drivers/can/sja1000/rtcan_ixxat_pci.c
@@ -73,7 +73,8 @@ struct rtcan_ixxat_pci
 #define IXXAT_BASE_PORT_SIZE 0x0400
 
 static struct pci_device_id ixxat_pci_tbl[] = {
-   {IXXAT_PCI_VENDOR_ID, IXXAT_PCI_DEVICE_ID, IXXAT_PCI_VENDOR_ID, 
IXXAT_PCI_SUB_SYS_ID, 0, 0, 0},
+   {IXXAT_PCI_VENDOR_ID, IXXAT_PCI_DEVICE_ID,
+IXXAT_PCI_VENDOR_ID, IXXAT_PCI_SUB_SYS_ID, 0, 0, 0},
{ }
 };
 MODULE_DEVICE_TABLE (pci, ixxat_pci_tbl);
@@ -206,7 +207,6 @@ static int __devinit ixxat_pci_init_one (struct pci_dev 
*pdev,
 const struct pci_device_id *ent)
 {
 int ret, channel, conf_addr;
-u16 sub_sys_id;
 unsigned long addr;
 void __iomem *base_addr;
 struct rtcan_device *master_dev = NULL;
@@ -217,14 +217,9 @@ static int __devinit ixxat_pci_init_one (struct pci_dev 
*pdev,
 if ((ret = pci_request_regions(pdev, RTCAN_DRV_NAME)))
goto failure;
 
-if ((ret = pci_read_config_word(pdev, 0x2e, &sub_sys_id)))
-   goto failure_release_pci;
-
 RTCAN_DBG("%s: Initializing device %04x:%04x:%04x\n",
- RTCAN_DRV_NAME, pdev->vendor, pdev->device, sub_sys_id);
-
-if (sub_sys_id != IXXAT_PCI_SUB_SYS_ID)
-   return -ENODEV;
+ RTCAN_DRV_NAME, pdev->vendor, pdev->device,
+ pdev->subsystem_device);
 
 /* Enable memory and I/O space */
 if ((ret = pci_write_config_word(pdev, 0x04, 0x3)))


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git


[Xenomai-git] Wolfgang Grandegger : rtcan: ixxat-pci: fix problems with device probing

2009-05-28 Thread GIT version control
Module: xenomai-2.4
Branch: master
Commit: aaf28d286689de3e45998738d400a7c5b80fcc82
URL:
http://git.xenomai.org/?p=xenomai-2.4.git;a=commit;h=aaf28d286689de3e45998738d400a7c5b80fcc82

Author: Wolfgang Grandegger 
Date:   Mon May 25 09:39:43 2009 +0200

rtcan: ixxat-pci: fix problems with device probing

This patch fixes problems with probing and registration of the
RTCAN IXXAT PCI driver as reported by Stefan Kisdaroczi and
Sebastian Smolorz. The PCI device id table entry now specifies
the PCI sub-system id avoiding the driver's probe function to
be call unnecessarily (a PLX9050 is used for many other non-can
PCI devices). This also makes the checking of the sub-system id
obsolete.

Signed-off-by: Wolfgang Grandegger 

---

 ksrc/drivers/can/sja1000/rtcan_ixxat_pci.c |   13 -
 1 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/ksrc/drivers/can/sja1000/rtcan_ixxat_pci.c 
b/ksrc/drivers/can/sja1000/rtcan_ixxat_pci.c
index cd809b4..5faa763 100644
--- a/ksrc/drivers/can/sja1000/rtcan_ixxat_pci.c
+++ b/ksrc/drivers/can/sja1000/rtcan_ixxat_pci.c
@@ -73,7 +73,8 @@ struct rtcan_ixxat_pci
 #define IXXAT_BASE_PORT_SIZE 0x0400
 
 static struct pci_device_id ixxat_pci_tbl[] = {
-   {IXXAT_PCI_VENDOR_ID, IXXAT_PCI_DEVICE_ID, IXXAT_PCI_VENDOR_ID, 
IXXAT_PCI_SUB_SYS_ID, 0, 0, 0},
+   {IXXAT_PCI_VENDOR_ID, IXXAT_PCI_DEVICE_ID,
+IXXAT_PCI_VENDOR_ID, IXXAT_PCI_SUB_SYS_ID, 0, 0, 0},
{ }
 };
 MODULE_DEVICE_TABLE (pci, ixxat_pci_tbl);
@@ -206,7 +207,6 @@ static int __devinit ixxat_pci_init_one (struct pci_dev 
*pdev,
 const struct pci_device_id *ent)
 {
 int ret, channel, conf_addr;
-u16 sub_sys_id;
 unsigned long addr;
 void __iomem *base_addr;
 struct rtcan_device *master_dev = NULL;
@@ -217,14 +217,9 @@ static int __devinit ixxat_pci_init_one (struct pci_dev 
*pdev,
 if ((ret = pci_request_regions(pdev, RTCAN_DRV_NAME)))
goto failure;
 
-if ((ret = pci_read_config_word(pdev, 0x2e, &sub_sys_id)))
-   goto failure_release_pci;
-
 RTCAN_DBG("%s: Initializing device %04x:%04x:%04x\n",
- RTCAN_DRV_NAME, pdev->vendor, pdev->device, sub_sys_id);
-
-if (sub_sys_id != IXXAT_PCI_SUB_SYS_ID)
-   return -ENODEV;
+ RTCAN_DRV_NAME, pdev->vendor, pdev->device,
+ pdev->subsystem_device);
 
 /* Enable memory and I/O space */
 if ((ret = pci_write_config_word(pdev, 0x04, 0x3)))


___
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git