aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/edac
diff options
context:
space:
mode:
authorHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>2010-08-20 03:25:18 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-10-24 09:20:39 -0400
commita3aa0a4ab56e825e2ec236974d478d1dcebf41a9 (patch)
treef97c1bcc76966890741c571247e17c94bc196f53 /drivers/edac
parent2aa9be448dab7433c685b634a4049289cb1913d3 (diff)
i7core_edac: Introduce i7core_pci_ctl_create/release
Have a couple of method. while here sort out lines in the i7core_register_mci() a bit. Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/edac')
-rw-r--r--drivers/edac/i7core_edac.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/drivers/edac/i7core_edac.c b/drivers/edac/i7core_edac.c
index e1cbbbad466e..a5cbea5abd62 100644
--- a/drivers/edac/i7core_edac.c
+++ b/drivers/edac/i7core_edac.c
@@ -1895,6 +1895,26 @@ static int i7core_mce_check_error(void *priv, struct mce *mce)
1895 return 1; 1895 return 1;
1896} 1896}
1897 1897
1898static void i7core_pci_ctl_create(struct i7core_pvt *pvt)
1899{
1900 pvt->i7core_pci = edac_pci_create_generic_ctl(
1901 &pvt->i7core_dev->pdev[0]->dev,
1902 EDAC_MOD_STR);
1903 if (unlikely(!pvt->i7core_pci))
1904 pr_warn("Unable to setup PCI error report via EDAC\n");
1905}
1906
1907static void i7core_pci_ctl_release(struct i7core_pvt *pvt)
1908{
1909 if (likely(pvt->i7core_pci))
1910 edac_pci_release_generic_ctl(pvt->i7core_pci);
1911 else
1912 i7core_printk(KERN_ERR,
1913 "Couldn't find mem_ctl_info for socket %d\n",
1914 pvt->i7core_dev->socket);
1915 pvt->i7core_pci = NULL;
1916}
1917
1898static int i7core_register_mci(struct i7core_dev *i7core_dev, 1918static int i7core_register_mci(struct i7core_dev *i7core_dev,
1899 const int num_channels, const int num_csrows) 1919 const int num_channels, const int num_csrows)
1900{ 1920{
@@ -1969,22 +1989,12 @@ static int i7core_register_mci(struct i7core_dev *i7core_dev,
1969 pvt->inject.page = -1; 1989 pvt->inject.page = -1;
1970 pvt->inject.col = -1; 1990 pvt->inject.col = -1;
1971 1991
1992 /* allocating generic PCI control info */
1993 i7core_pci_ctl_create(pvt);
1994
1972 /* Registers on edac_mce in order to receive memory errors */ 1995 /* Registers on edac_mce in order to receive memory errors */
1973 pvt->edac_mce.priv = mci; 1996 pvt->edac_mce.priv = mci;
1974 pvt->edac_mce.check_error = i7core_mce_check_error; 1997 pvt->edac_mce.check_error = i7core_mce_check_error;
1975
1976 /* allocating generic PCI control info */
1977 pvt->i7core_pci = edac_pci_create_generic_ctl(&i7core_dev->pdev[0]->dev,
1978 EDAC_MOD_STR);
1979 if (unlikely(!pvt->i7core_pci)) {
1980 printk(KERN_WARNING
1981 "%s(): Unable to create PCI control\n",
1982 __func__);
1983 printk(KERN_WARNING
1984 "%s(): PCI error report via EDAC not setup\n",
1985 __func__);
1986 }
1987
1988 rc = edac_mce_register(&pvt->edac_mce); 1998 rc = edac_mce_register(&pvt->edac_mce);
1989 if (unlikely(rc < 0)) { 1999 if (unlikely(rc < 0)) {
1990 debugf0("MC: " __FILE__ 2000 debugf0("MC: " __FILE__
@@ -2094,13 +2104,7 @@ static void __devexit i7core_remove(struct pci_dev *pdev)
2094 edac_mce_unregister(&pvt->edac_mce); 2104 edac_mce_unregister(&pvt->edac_mce);
2095 2105
2096 /* Disable EDAC polling */ 2106 /* Disable EDAC polling */
2097 if (likely(pvt->i7core_pci)) 2107 i7core_pci_ctl_release(pvt);
2098 edac_pci_release_generic_ctl(pvt->i7core_pci);
2099 else
2100 i7core_printk(KERN_ERR,
2101 "Couldn't find mem_ctl_info for socket %d\n",
2102 i7core_dev->socket);
2103 pvt->i7core_pci = NULL;
2104 2108
2105 /* Remove MC sysfs nodes */ 2109 /* Remove MC sysfs nodes */
2106 edac_mc_del_mc(&i7core_dev->pdev[0]->dev); 2110 edac_mc_del_mc(&i7core_dev->pdev[0]->dev);