linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: <yanjiang.jin@windriver.com>
To: <morbidrsa@gmail.com>, <bp@alien8.de>, <mchehab@kernel.org>,
	<york.sun@nxp.com>
Cc: <linux-edac@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<jinyanjing@gmail.com>, <yanjiang.jin@windriver.com>
Subject: [PATCH] edac: mpc85xx: implement "remove" for mpc85xx_pci_err_driver
Date: Thu, 17 Nov 2016 10:56:20 +0800	[thread overview]
Message-ID: <1479351380-17109-2-git-send-email-yanjiang.jin@windriver.com> (raw)
In-Reply-To: <1479351380-17109-1-git-send-email-yanjiang.jin@windriver.com>

From: Yanjiang Jin <yanjiang.jin@windriver.com>

Tested on a T4240QDS board.

If we execute the below steps without this patch:

1. modprobe mpc85xx_edac [The first insmod, everything is well.]
2. modprobe -r mpc85xx_edac
3. modprobe mpc85xx_edac [insmod again, error happens.]

We would get the error messages as below:

BUG: recent printk recursion!
Oops: Kernel access of bad area, sig: 11 [#48]
Modules linked in: mpc85xx_edac edac_core softdog [last unloaded: mpc85xx_edac]
CPU: 5 PID: 14773 Comm: modprobe Tainted: G D C 4.8.3-rt2

 .vsnprintf
 .vscnprintf
 .vprintk_emit
 .printk
 .edac_pci_add_device
 .mpc85xx_pci_err_probe
 .platform_drv_probe
 .driver_probe_device
 .__driver_attach
 .bus_for_each_dev
 .driver_attach
 .bus_add_driver
 .driver_register
 .__platform_register_drivers
 .mpc85xx_mc_init
 .do_one_initcall
 .do_init_module
 .load_module
 .SyS_finit_module
 system_call

Signed-off-by: Yanjiang Jin <yanjiang.jin@windriver.com>
---
 drivers/edac/mpc85xx_edac.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/edac/mpc85xx_edac.c b/drivers/edac/mpc85xx_edac.c
index ff05675..c626021 100644
--- a/drivers/edac/mpc85xx_edac.c
+++ b/drivers/edac/mpc85xx_edac.c
@@ -300,6 +300,22 @@ static int mpc85xx_pci_err_probe(struct platform_device *op)
 	return res;
 }
 
+static int mpc85xx_pci_err_remove(struct platform_device *op)
+{
+	struct edac_pci_ctl_info *pci = dev_get_drvdata(&op->dev);
+	struct mpc85xx_pci_pdata *pdata = pci->pvt_info;
+
+	edac_dbg(0, "\n");
+
+	out_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_ADDR, orig_pci_err_cap_dr);
+	out_be32(pdata->pci_vbase + MPC85XX_PCI_ERR_EN, orig_pci_err_en);
+
+	edac_pci_del_device(&op->dev);
+	edac_pci_free_ctl_info(pci);
+
+	return 0;
+}
+
 static const struct platform_device_id mpc85xx_pci_err_match[] = {
 	{
 		.name = "mpc85xx-pci-edac"
@@ -309,6 +325,7 @@ static int mpc85xx_pci_err_probe(struct platform_device *op)
 
 static struct platform_driver mpc85xx_pci_err_driver = {
 	.probe = mpc85xx_pci_err_probe,
+	.remove = mpc85xx_pci_err_remove,
 	.id_table = mpc85xx_pci_err_match,
 	.driver = {
 		.name = "mpc85xx_pci_err",
-- 
1.9.1

  reply	other threads:[~2016-11-17  2:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-17  2:56 [V2 PATCH] edac: mpc85xx: implement "remove" for mpc85xx_pci_err_driver yanjiang.jin
2016-11-17  2:56 ` yanjiang.jin [this message]
2016-11-17 10:22   ` [PATCH] " Borislav Petkov
  -- strict thread matches above, loose matches on Subject: below --
2016-11-16  6:26 yanjiang.jin
2016-11-16 10:08 ` Borislav Petkov
2016-11-16 16:55 ` york sun
2016-11-17 10:00 ` Johannes Thumshirn

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=1479351380-17109-2-git-send-email-yanjiang.jin@windriver.com \
    --to=yanjiang.jin@windriver.com \
    --cc=bp@alien8.de \
    --cc=jinyanjing@gmail.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=morbidrsa@gmail.com \
    --cc=york.sun@nxp.com \
    /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;
as well as URLs for NNTP newsgroup(s).