mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Francois Romieu <romieu@fr.zoreil.com>
To: Pekka J Enberg <penberg@cs.Helsinki.FI>
Cc: David Vrabel <dvrabel@cantab.net>,
	linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	david@pleyades.net
Subject: [PATCH 1/2] ipg: sanitize the pci device table
Date: Tue, 2 May 2006 23:44:32 +0200	[thread overview]
Message-ID: <20060502214432.GB26357@electric-eye.fr.zoreil.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0605020945010.4066@sbz-30.cs.Helsinki.FI>

- vendor id belong to include/linux/pci_id.h ;
- the pci table does not include all the devices in nics_supported ;
- qualify the pci table as __devinitdata ;
- kill 50 LOC.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>

---

 drivers/net/ipg.c       |   46 ++++++--------------------------
 drivers/net/ipg.h       |   67 +++++++++++------------------------------------
 include/linux/pci_ids.h |    2 +
 3 files changed, 27 insertions(+), 88 deletions(-)

aa5b322a6f91ca12a580dfa7022fca1a088b4abd
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index 393b617..ea7c1f8 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -32,40 +32,14 @@ MODULE_DESCRIPTION("IC Plus IP1000 Gigab
 		   DrvVer);
 MODULE_LICENSE("GPL");
 
-static struct pci_device_id ipg_pci_tbl[] = {
-	{PCI_VENDOR_ID_ICPLUS,
-	 PCI_DEVICE_ID_IP1000,
-	 PCI_ANY_ID,
-	 PCI_ANY_ID,
-	 0x020000,
-	 0xFFFFFF,
-	 0},
-
-	{PCI_VENDOR_ID_SUNDANCE,
-	 PCI_DEVICE_ID_SUNDANCE_ST2021,
-	 PCI_ANY_ID,
-	 PCI_ANY_ID,
-	 0x020000,
-	 0xFFFFFF,
-	 1},
-
-	{PCI_VENDOR_ID_SUNDANCE,
-	 PCI_DEVICE_ID_TAMARACK_TC9020_9021,
-	 PCI_ANY_ID,
-	 PCI_ANY_ID,
-	 0x020000,
-	 0xFFFFFF,
-	 2},
-
-	{PCI_VENDOR_ID_DLINK,
-	 PCI_DEVICE_ID_DLINK_1002,
-	 PCI_ANY_ID,
-	 PCI_ANY_ID,
-	 0x020000,
-	 0xFFFFFF,
-	 3},
-
-	{0,}
+static struct pci_device_id ipg_pci_tbl[] __devinitdata = {
+	{ PCI_DEVICE(PCI_VENDOR_ID_SUNDANCE,	0x1023), 0, 0, 0 },
+	{ PCI_DEVICE(PCI_VENDOR_ID_SUNDANCE,	0x2021), 0, 0, 1 },
+	{ PCI_DEVICE(PCI_VENDOR_ID_SUNDANCE,	0x1021), 0, 0, 2 },
+	{ PCI_DEVICE(PCI_VENDOR_ID_DLINK,	0x9021), 0, 0, 3 },
+	{ PCI_DEVICE(PCI_VENDOR_ID_DLINK,	0x4000), 0, 0, 4 },
+	{ PCI_DEVICE(PCI_VENDOR_ID_DLINK,	0x4020), 0, 0, 5 },
+	{ 0, }
 };
 
 MODULE_DEVICE_TABLE(pci, ipg_pci_tbl);
@@ -2961,9 +2935,7 @@ static int __devinit ipg_probe(struct pc
 	if (rc < 0)
 		goto out;
 
-	printk(KERN_INFO "%s found.\n", nics_supported[i].NICname);
-	printk(KERN_INFO "Bus %x Slot %x\n",
-	       pdev->bus->number, PCI_SLOT(pdev->devfn));
+	printk(KERN_INFO "%s: %s\n", pci_name(pdev), nics_supported[i].name);
 
 	pci_set_master(pdev);
 
diff --git a/drivers/net/ipg.h b/drivers/net/ipg.h
index ae3424a..03bc6f1 100644
--- a/drivers/net/ipg.h
+++ b/drivers/net/ipg.h
@@ -589,34 +589,6 @@ #define IPG_RI_RXDMAWAIT_TIME           
  *	Tune
  */
 
-#ifndef PCI_VENDOR_ID_ICPLUS
-#  define       PCI_VENDOR_ID_ICPLUS            0x13F0
-#endif
-#ifndef PCI_DEVICE_ID_IP1000
-#  define       PCI_DEVICE_ID_IP1000		    0x1023
-#endif
-#ifndef PCI_VENDOR_ID_SUNDANCE
-#  define       PCI_VENDOR_ID_SUNDANCE          0x13F0
-#endif
-#ifndef PCI_DEVICE_ID_SUNDANCE_IPG
-#  define       PCI_DEVICE_ID_SUNDANCE_ST2021   0x2021
-#endif
-#ifndef PCI_DEVICE_ID_TAMARACK_TC9020_9021_ALT
-#  define       PCI_DEVICE_ID_TAMARACK_TC9020_9021_ALT 0x9021
-#endif
-#ifndef PCI_DEVICE_ID_TAMARACK_TC9020_9021
-#  define       PCI_DEVICE_ID_TAMARACK_TC9020_9021 0x1021
-#endif
-#ifndef PCI_VENDOR_ID_DLINK
-#  define       PCI_VENDOR_ID_DLINK             0x1186
-#endif
-#ifndef PCI_DEVICE_ID_DLINK_1002
-#  define       PCI_DEVICE_ID_DLINK_1002        0x4000
-#endif
-#ifndef PCI_DEVICE_ID_DLINK_IP1000A
-#  define PCI_DEVICE_ID_DLINK_IP1000A		0x4020
-#endif
-
 /* Miscellaneous Constants. */
 #define   TRUE  1
 #define   FALSE 0
@@ -990,32 +962,25 @@ #endif
 };
 
 struct nic_id {
-	char *NICname;
-	int vendorid;
-	int deviceid;
+	char *name;
+	u32 vendor;
+	u32 device;
 };
 
 struct nic_id nics_supported[] = {
-	{"IC PLUS IP1000 1000/100/10 based NIC",
-	 PCI_VENDOR_ID_ICPLUS,
-	 PCI_DEVICE_ID_IP1000},
-	{"Sundance Technology ST2021 based NIC",
-	 PCI_VENDOR_ID_SUNDANCE,
-	 PCI_DEVICE_ID_SUNDANCE_ST2021},
-	{"Tamarack Microelectronics TC9020/9021 based NIC",
-	 PCI_VENDOR_ID_SUNDANCE,
-	 PCI_DEVICE_ID_TAMARACK_TC9020_9021},
-	{"Tamarack Microelectronics TC9020/9021 based NIC",
-	 PCI_VENDOR_ID_SUNDANCE,
-	 PCI_DEVICE_ID_TAMARACK_TC9020_9021_ALT},
-	{"D-Link NIC",
-	 PCI_VENDOR_ID_DLINK,
-	 PCI_DEVICE_ID_DLINK_1002},
-	{"D-Link NIC IP1000A",
-	 PCI_VENDOR_ID_DLINK,
-	 PCI_DEVICE_ID_DLINK_IP1000A},
-
-	{"N/A", 0xFFFF, 0}
+	{ "IC PLUS IP1000 1000/100/10 based NIC",
+		PCI_VENDOR_ID_SUNDANCE,	0x1023 },
+	{ "Sundance Technology ST2021 based NIC",
+		PCI_VENDOR_ID_SUNDANCE,	0x2021 },
+	{ "Tamarack Microelectronics TC9020/9021 based NIC",
+		PCI_VENDOR_ID_SUNDANCE, 0x1021 },
+	{ "Tamarack Microelectronics TC9020/9021 based NIC",
+		PCI_VENDOR_ID_SUNDANCE, 0x9021 },
+	{ "D-Link NIC",
+		PCI_VENDOR_ID_DLINK,	0x4000 },
+	{ "D-Link NIC IP1000A",
+		PCI_VENDOR_ID_DLINK,	0x4020 },
+	{ NULL, 0xffff, 0 }
 };
 
 //variable record -- index by leading revision/length
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index d6fe048..b772f2b 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1788,6 +1788,8 @@ #define PCI_DEVICE_ID_IOMEGA_BUZ	0x4231
 #define PCI_VENDOR_ID_ABOCOM		0x13D1
 #define PCI_DEVICE_ID_ABOCOM_2BD1       0x2BD1
 
+#define PCI_VENDOR_ID_SUNDANCE		0x13f0
+
 #define PCI_VENDOR_ID_CMEDIA		0x13f6
 #define PCI_DEVICE_ID_CMEDIA_CM8338A	0x0100
 #define PCI_DEVICE_ID_CMEDIA_CM8338B	0x0101
-- 
1.3.1


  reply	other threads:[~2006-05-02 21:47 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-27 14:29 IP1000 gigabit nic driver David Gómez
2006-04-27 18:56 ` Francois Romieu
2006-04-27 22:26   ` David Vrabel
2006-04-28  7:57     ` David Gómez
2006-04-28 10:58       ` Pekka Enberg
2006-04-28 11:37         ` David Gómez
2006-04-28 11:51           ` Pekka J Enberg
2006-04-28 11:59           ` Pekka J Enberg
2006-04-28 15:30             ` David Gómez
2006-04-28 16:08               ` Stephen Hemminger
2006-04-28 21:58             ` David Gómez
     [not found]               ` <20060428154251.23fcfc41@localhost.localdomain>
2006-04-29  7:30                 ` David Gómez
2006-04-29 10:29             ` Pekka Enberg
2006-04-29 10:35               ` Arjan van de Ven
2006-04-29 12:21               ` David Gómez
2006-04-29 20:35                 ` Pekka Enberg
2006-04-30  9:26                   ` Pekka Enberg
2006-04-30 23:40                     ` David Vrabel
2006-05-01  9:31                       ` Pekka Enberg
2006-05-03 12:43                         ` Andrew Morton
2006-05-03 13:06                           ` Pekka J Enberg
2006-05-03 14:15                             ` David Vrabel
2006-05-01  9:43                       ` Pekka Enberg
2006-05-01 11:32                       ` David Vrabel
2006-05-01 18:08                         ` Pekka Enberg
2006-05-01 23:10                           ` [PATCH 1/3] ipg: removal of unreachable code Francois Romieu
2006-05-02  6:36                             ` Pekka J Enberg
2006-05-01 23:10                           ` [PATCH 2/3] ipg: leaks in ipg_probe Francois Romieu
2006-05-02  6:41                             ` Pekka J Enberg
2006-05-02 18:33                               ` Francois Romieu
2006-05-02 19:04                                 ` Pekka Enberg
2006-05-02 22:30                                   ` [PATCH] ipg: removing more dead code David Gómez
2006-05-03 13:12                                     ` Pekka J Enberg
2006-05-03 21:00                                   ` [PATCH 2/3] ipg: leaks in ipg_probe David Gómez
2006-05-01 23:12                           ` [PATCH 3/3] ipg: plug leaks in the error path of ipg_nic_open Francois Romieu
2006-05-02  6:45                             ` Pekka J Enberg
2006-05-02 21:44                               ` Francois Romieu [this message]
2006-05-02 21:45                               ` [PATCH 2/2] ipg: redundancy with mii.h Francois Romieu
2006-05-02 21:55                                 ` Francois Romieu
2006-05-03  6:16                                   ` Pekka J Enberg
2006-05-03 23:35                                     ` Francois Romieu
2006-05-04  6:52                                       ` David Vrabel
2006-05-05  0:24                                         ` Francois Romieu
2006-05-04 13:44                                       ` Pekka Enberg
2006-05-04 23:55                                         ` Francois Romieu
2006-05-20 21:03                                           ` David Vrabel
2006-05-21  7:23                                             ` Pekka Enberg
2006-05-21 10:16                                             ` Francois Romieu
2006-05-22  3:22                                               ` jesse\(建興\)
2006-05-23  6:50                                               ` jesse\(建興\)
2006-05-01 20:38                         ` IP1000 gigabit nic driver Francois Romieu
2006-05-01 20:41                           ` Lennert Buytenhek
2006-05-02  0:36                             ` David Vrabel
2006-05-01 19:39                   ` David Gómez
2006-04-29 12:58               ` David Vrabel
2006-04-28 11:59           ` Ingo Oeser
2006-04-28  7:54   ` David Gómez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060502214432.GB26357@electric-eye.fr.zoreil.com \
    --to=romieu@fr.zoreil.com \
    --cc=david@pleyades.net \
    --cc=dvrabel@cantab.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=penberg@cs.Helsinki.FI \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®