Sophie

Sophie

distrib > Scientific%20Linux > 5x > x86_64 > by-pkgid > 27922b4260f65d317aabda37e42bbbff > files > 799

kernel-2.6.18-238.el5.src.rpm

From: Mauro Carvalho Chehab <mchehab@redhat.com>
Date: Tue, 23 Nov 2010 17:33:51 -0500
Subject: [edac] i7core_edac: reduce args of i7core_get_onedevice
Message-id: <20101123153351.6a45b4c6@pedra>
Patchwork-id: 29567
O-Subject: [PATCH RHEL5 11/29] BZ#:651869 i7core_edac: Reduce args of
	i7core_get_onedevice
Bugzilla: 651869
RH-Acked-by: Aristeu Rozanski <aris@redhat.com>

Changeset: b197cba071ec8a171fbaaaf82d119315a6f6cb0b

Since we need to pass the index of the entry, pass the table itself
instead of passing individual members of the table.

While here make it static.

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: Jarod Wilson <jarod@redhat.com>

diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
index 4d19883..fd717fd 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -1301,12 +1301,13 @@ static unsigned i7core_pci_lastbus(void)
  *
  *			Need to 'get' device 16 func 1 and func 2
  */
-int i7core_get_onedevice(struct pci_dev **prev, const int devno,
-			 const struct pci_id_descr *dev_descr,
-			 const unsigned n_devs,
-			 const unsigned last_bus)
+static int i7core_get_onedevice(struct pci_dev **prev,
+				const struct pci_id_table *table,
+				const unsigned devno,
+				const unsigned last_bus)
 {
 	struct i7core_dev *i7core_dev;
+	const struct pci_id_descr *dev_descr = &table->descr[devno];
 
 	struct pci_dev *pdev = NULL;
 	u8 bus = 0;
@@ -1358,14 +1359,14 @@ int i7core_get_onedevice(struct pci_dev **prev, const int devno,
 		i7core_dev = kzalloc(sizeof(*i7core_dev), GFP_KERNEL);
 		if (!i7core_dev)
 			return -ENOMEM;
-		i7core_dev->pdev = kzalloc(sizeof(*i7core_dev->pdev) * n_devs,
-					   GFP_KERNEL);
+		i7core_dev->pdev = kzalloc(sizeof(*i7core_dev->pdev) 
+						* table->n_devs, GFP_KERNEL);
 		if (!i7core_dev->pdev) {
 			kfree(i7core_dev);
 			return -ENOMEM;
 		}
 		i7core_dev->socket = socket;
-		i7core_dev->n_devs = n_devs;
+		i7core_dev->n_devs = table->n_devs;
 		list_add_tail(&i7core_dev->list, &i7core_edac_list);
 	}
 
@@ -1417,18 +1418,14 @@ static int i7core_get_devices(const struct pci_id_table *table)
 {
 	int i, rc, last_bus;
 	struct pci_dev *pdev = NULL;
-	const struct pci_id_descr *dev_descr;
 
 	last_bus = i7core_pci_lastbus();
 
 	while (table && table->descr) {
-		dev_descr = table->descr;
 		for (i = 0; i < table->n_devs; i++) {
 			pdev = NULL;
 			do {
-				rc = i7core_get_onedevice(&pdev, i,
-							  &dev_descr[i],
-							  table->n_devs,
+				rc = i7core_get_onedevice(&pdev, table, i,
 							  last_bus);
 				if (rc < 0) {
 					if (i == 0) {