[PATCH] EDAC: PCI device to DEVICE cleanup
authorDoug Thompson <norsk5@xmission.com>
Fri, 30 Jun 2006 08:56:07 +0000 (01:56 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 30 Jun 2006 18:25:39 +0000 (11:25 -0700)
Change MC drivers from using CVS revision strings for their version number,
Now each driver has its own local string.

Remove some PCI dependencies from the core EDAC module.  Made the code 'struct
device' centric instead of 'struct pci_dev' Most of the code changes here are
from a patch by Dave Jiang.  It may be best to eventually move the
PCI-specific code into a separate source file.

Signed-off-by: Doug Thompson <norsk5@xmission.com>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/edac/amd76x_edac.c
drivers/edac/e752x_edac.c
drivers/edac/e7xxx_edac.c
drivers/edac/edac_mc.c
drivers/edac/edac_mc.h
drivers/edac/i82860_edac.c
drivers/edac/i82875p_edac.c
drivers/edac/r82600_edac.c

index 53423ad..7fd6283 100644 (file)
@@ -20,6 +20,9 @@
 #include <linux/slab.h>
 #include "edac_mc.h"
 
+#define AMD76X_REVISION        " Ver: 2.0.0 "  __DATE__
+
+
 #define amd76x_printk(level, fmt, arg...) \
        edac_printk(level, "amd76x", fmt, ##arg)
 
@@ -102,15 +105,18 @@ static const struct amd76x_dev_info amd76x_devs[] = {
 static void amd76x_get_error_info(struct mem_ctl_info *mci,
                struct amd76x_error_info *info)
 {
-       pci_read_config_dword(mci->pdev, AMD76X_ECC_MODE_STATUS,
+       struct pci_dev *pdev;
+
+       pdev = to_pci_dev(mci->dev);
+       pci_read_config_dword(pdev, AMD76X_ECC_MODE_STATUS,
                                &info->ecc_mode_status);
 
        if (info->ecc_mode_status & BIT(8))
-               pci_write_bits32(mci->pdev, AMD76X_ECC_MODE_STATUS,
+               pci_write_bits32(pdev, AMD76X_ECC_MODE_STATUS,
                                (u32) BIT(8), (u32) BIT(8));
 
        if (info->ecc_mode_status & BIT(9))
-               pci_write_bits32(mci->pdev, AMD76X_ECC_MODE_STATUS,
+               pci_write_bits32(pdev, AMD76X_ECC_MODE_STATUS,
                                (u32) BIT(9), (u32) BIT(9));
 }
 
@@ -211,13 +217,13 @@ static int amd76x_probe1(struct pci_dev *pdev, int dev_idx)
        }
 
        debugf0("%s(): mci = %p\n", __func__, mci);
-       mci->pdev = pdev;
+       mci->dev = &pdev->dev;
        mci->mtype_cap = MEM_FLAG_RDDR;
        mci->edac_ctl_cap = EDAC_FLAG_NONE | EDAC_FLAG_EC | EDAC_FLAG_SECDED;
        mci->edac_cap = ems_mode ?
                        (EDAC_FLAG_EC | EDAC_FLAG_SECDED) : EDAC_FLAG_NONE;
        mci->mod_name = EDAC_MOD_STR;
-       mci->mod_ver = "$Revision: 1.4.2.5 $";
+       mci->mod_ver = AMD76X_REVISION;
        mci->ctl_name = amd76x_devs[dev_idx].ctl_name;
        mci->edac_check = amd76x_check;
        mci->ctl_page_to_phys = NULL;
@@ -230,7 +236,7 @@ static int amd76x_probe1(struct pci_dev *pdev, int dev_idx)
                u32 dms;
 
                /* find the DRAM Chip Select Base address and mask */
-               pci_read_config_dword(mci->pdev,
+               pci_read_config_dword(pdev,
                                AMD76X_MEM_BASE_ADDR + (index * 4), &mba);
 
                if (!(mba & BIT(0)))
@@ -238,8 +244,7 @@ static int amd76x_probe1(struct pci_dev *pdev, int dev_idx)
 
                mba_base = mba & 0xff800000UL;
                mba_mask = ((mba & 0xff80) << 16) | 0x7fffffUL;
-               pci_read_config_dword(mci->pdev, AMD76X_DRAM_MODE_STATUS,
-                               &dms);
+               pci_read_config_dword(pdev, AMD76X_DRAM_MODE_STATUS, &dms);
                csrow->first_page = mba_base >> PAGE_SHIFT;
                csrow->nr_pages = (mba_mask + 1) >> PAGE_SHIFT;
                csrow->last_page = csrow->first_page + csrow->nr_pages - 1;
@@ -291,7 +296,7 @@ static void __devexit amd76x_remove_one(struct pci_dev *pdev)
 
        debugf0("%s()\n", __func__);
 
-       if ((mci = edac_mc_del_mc(pdev)) == NULL)
+       if ((mci = edac_mc_del_mc(&pdev->dev)) == NULL)
                return;
 
        edac_mc_free(mci);
index fce3193..de9f332 100644 (file)
@@ -25,6 +25,8 @@
 #include <linux/slab.h>
 #include "edac_mc.h"
 
+#define E752X_REVISION " Ver: 2.0.0 " __DATE__
+
 static int force_function_unhide;
 
 #define e752x_printk(level, fmt, arg...) \
@@ -819,8 +821,8 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
            EDAC_FLAG_S4ECD4ED;
        /* FIXME - what if different memory types are in different csrows? */
        mci->mod_name = EDAC_MOD_STR;
-       mci->mod_ver = "$Revision: 1.5.2.11 $";
-       mci->pdev = pdev;
+       mci->mod_ver = E752X_REVISION;
+       mci->dev = &pdev->dev;
 
        debugf3("%s(): init pvt\n", __func__);
        pvt = (struct e752x_pvt *) mci->pvt_info;
@@ -864,7 +866,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
                struct csrow_info *csrow = &mci->csrows[index];
 
                mem_dev = (mem_dev == 2);
-               pci_read_config_byte(mci->pdev, E752X_DRB + index, &value);
+               pci_read_config_byte(pdev, E752X_DRB + index, &value);
                /* convert a 128 or 64 MiB DRB to a page size. */
                cumul_size = value << (25 + drc_drbg - PAGE_SHIFT);
                debugf3("%s(): (%d) cumul_size 0x%x\n", __func__, index,
@@ -904,8 +906,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
                u8 row = 0;
 
                for (index = 0; index < 8; index += 2) {
-                       pci_read_config_byte(mci->pdev, E752X_DRB + index,
-                                       &value);
+                       pci_read_config_byte(pdev, E752X_DRB + index, &value);
 
                        /* test if there is a dimm in this slot */
                        if (value == last) {
@@ -918,7 +919,7 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
                                last = value;
                                /* test the next value to see if the dimm is
                                   double sided */
-                               pci_read_config_byte(mci->pdev,
+                               pci_read_config_byte(pdev,
                                                E752X_DRB + index + 1,
                                                &value);
                                pvt->map[index + 1] = (value == last) ?
@@ -935,18 +936,18 @@ static int e752x_probe1(struct pci_dev *pdev, int dev_idx)
        }
 
        /* set the map type.  1 = normal, 0 = reversed */
-       pci_read_config_byte(mci->pdev, E752X_DRM, &stat8);
+       pci_read_config_byte(pdev, E752X_DRM, &stat8);
        pvt->map_type = ((stat8 & 0x0f) > ((stat8 >> 4) & 0x0f));
 
        mci->edac_cap |= EDAC_FLAG_NONE;
        debugf3("%s(): tolm, remapbase, remaplimit\n", __func__);
 
        /* load the top of low memory, remap base, and remap limit vars */
-       pci_read_config_word(mci->pdev, E752X_TOLM, &pci_data);
+       pci_read_config_word(pdev, E752X_TOLM, &pci_data);
        pvt->tolm = ((u32) pci_data) << 4;
-       pci_read_config_word(mci->pdev, E752X_REMAPBASE, &pci_data);
+       pci_read_config_word(pdev, E752X_REMAPBASE, &pci_data);
        pvt->remapbase = ((u32) pci_data) << 14;
-       pci_read_config_word(mci->pdev, E752X_REMAPLIMIT, &pci_data);
+       pci_read_config_word(pdev, E752X_REMAPLIMIT, &pci_data);
        pvt->remaplimit = ((u32) pci_data) << 14;
        e752x_printk(KERN_INFO,
                "tolm = %x, remapbase = %x, remaplimit = %x\n", pvt->tolm,
@@ -1015,7 +1016,7 @@ static void __devexit e752x_remove_one(struct pci_dev *pdev)
 
        debugf0("%s()\n", __func__);
 
-       if ((mci = edac_mc_del_mc(pdev)) == NULL)
+       if ((mci = edac_mc_del_mc(&pdev->dev)) == NULL)
                return;
 
        pvt = (struct e752x_pvt *) mci->pvt_info;
index a9518d3..d601d53 100644 (file)
@@ -30,6 +30,8 @@
 #include <linux/slab.h>
 #include "edac_mc.h"
 
+#define        E7XXX_REVISION " Ver: 2.0.0 " __DATE__
+
 #define e7xxx_printk(level, fmt, arg...) \
        edac_printk(level, "e7xxx", fmt, ##arg)
 
@@ -373,8 +375,8 @@ static int e7xxx_probe1(struct pci_dev *pdev, int dev_idx)
                        EDAC_FLAG_S4ECD4ED;
        /* FIXME - what if different memory types are in different csrows? */
        mci->mod_name = EDAC_MOD_STR;
-       mci->mod_ver = "$Revision: 1.5.2.9 $";
-       mci->pdev = pdev;
+       mci->mod_ver = E7XXX_REVISION;
+       mci->dev = &pdev->dev;
 
        debugf3("%s(): init pvt\n", __func__);
        pvt = (struct e7xxx_pvt *) mci->pvt_info;
@@ -411,7 +413,7 @@ static int e7xxx_probe1(struct pci_dev *pdev, int dev_idx)
                int mem_dev = (dra >> (index * 4 + 3)) & 0x1;
                struct csrow_info *csrow = &mci->csrows[index];
 
-               pci_read_config_byte(mci->pdev, E7XXX_DRB + index, &value);
+               pci_read_config_byte(pdev, E7XXX_DRB + index, &value);
                /* convert a 64 or 32 MiB DRB to a page size. */
                cumul_size = value << (25 + drc_drbg - PAGE_SHIFT);
                debugf3("%s(): (%d) cumul_size 0x%x\n", __func__, index,
@@ -448,11 +450,11 @@ static int e7xxx_probe1(struct pci_dev *pdev, int dev_idx)
 
        debugf3("%s(): tolm, remapbase, remaplimit\n", __func__);
        /* load the top of low memory, remap base, and remap limit vars */
-       pci_read_config_word(mci->pdev, E7XXX_TOLM, &pci_data);
+       pci_read_config_word(pdev, E7XXX_TOLM, &pci_data);
        pvt->tolm = ((u32) pci_data) << 4;
-       pci_read_config_word(mci->pdev, E7XXX_REMAPBASE, &pci_data);
+       pci_read_config_word(pdev, E7XXX_REMAPBASE, &pci_data);
        pvt->remapbase = ((u32) pci_data) << 14;
-       pci_read_config_word(mci->pdev, E7XXX_REMAPLIMIT, &pci_data);
+       pci_read_config_word(pdev, E7XXX_REMAPLIMIT, &pci_data);
        pvt->remaplimit = ((u32) pci_data) << 14;
        e7xxx_printk(KERN_INFO,
                "tolm = %x, remapbase = %x, remaplimit = %x\n", pvt->tolm,
@@ -498,7 +500,7 @@ static void __devexit e7xxx_remove_one(struct pci_dev *pdev)
 
        debugf0("%s()\n", __func__);
 
-       if ((mci = edac_mc_del_mc(pdev)) == NULL)
+       if ((mci = edac_mc_del_mc(&pdev->dev)) == NULL)
                return;
 
        pvt = (struct e7xxx_pvt *) mci->pvt_info;
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge