[PATCH 2/3] EDAC: amd64_edac: clean up remove_one_instance()

From: Dmitry Torokhov
Date: Wed Mar 18 2015 - 20:49:36 EST


We can get much of data from driver-proivate structure so make use of
it.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
---
drivers/edac/amd64_edac.c | 17 ++++++-----------
1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index c0ebc06..d23dad9 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -2774,7 +2774,7 @@ static int init_one_instance(struct pci_dev *F2)
if (!pvt)
goto err_ret;

- pvt->mc_node_id = nid;
+ pvt->mc_node_id = nid;
pvt->F2 = F2;

ret = -EINVAL;
@@ -2849,6 +2849,8 @@ static int init_one_instance(struct pci_dev *F2)

amd_register_ecc_decoder(decode_bus_error);

+ pci_set_drvdata(F2, pvt);
+
atomic_inc(&drv_instances);

return 0;
@@ -2890,22 +2892,15 @@ static int probe_one_instance(struct pci_dev *pdev,

static void remove_one_instance(struct pci_dev *pdev)
{
+ struct amd64_pvt *pvt = pci_get_drvdata(pdev);
struct mem_ctl_info *mci;
- struct amd64_pvt *pvt;
- u16 nid = amd_get_node_id(pdev);
- struct pci_dev *F3 = node_to_amd_nb(nid)->misc;
-
- mci = find_mci_by_dev(&pdev->dev);
- WARN_ON(!mci);

/* Remove from EDAC CORE tracking list */
mci = edac_mc_del_mc(&pdev->dev);
- if (!mci)
+ if (WARN_ON(!mci))
return;

- pvt = mci->pvt_info;
-
- restore_ecc_error_reporting(&pvt->ecc, nid, F3);
+ restore_ecc_error_reporting(&pvt->ecc, pvt->mc_node_id, pvt->F3);

free_mc_sibling_devs(pvt);

--
2.2.0.rc0.207.ga3a616c

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/