From: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
To: greg@kroah.com, akpm@osdl.org, bjorn.helgaas@hp.com,
linux-kernel@vger.kernel.org
Subject: [PATCH] missing pci_disable_device()
Date: Tue, 07 Sep 2004 10:26:38 +0900 [thread overview]
Message-ID: <413D0E4E.1000200@jp.fujitsu.com> (raw)
Hi,
As mentioned in Documentaion/pci.txt, pci device driver should call
pci_disable_device() to deallocate any IRQ resources, disable PCI
bus-mastering and etc. when it decides to stop using the device.
But there seems to be many drivers that don't use pci_disable_device()
properly so far.
The following patch changes pci_device_remove() to call
pci_disable_device() instead of the driver if the device has not been
disabled by the driver.
Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
---
linux-2.6.9-rc1-kanesige/drivers/pci/pci-driver.c | 7 +++++++
1 files changed, 7 insertions(+)
diff -puN drivers/pci/pci-driver.c~force_pci_disable_device drivers/pci/pci-driver.c
--- linux-2.6.9-rc1/drivers/pci/pci-driver.c~force_pci_disable_device 2004-09-01 17:42:40.000000000 +0900
+++ linux-2.6.9-rc1-kanesige/drivers/pci/pci-driver.c 2004-09-02 14:54:39.824783993 +0900
@@ -291,6 +291,13 @@ static int pci_device_remove(struct devi
drv->remove(pci_dev);
pci_dev->driver = NULL;
}
+ /*
+ * If the device has not been disabled, we call
+ * pci_disable_device() instead of the driver.
+ */
+ if (pci_dev->is_enabled)
+ pci_disable_device(pci_dev);
+
pci_dev_put(pci_dev);
return 0;
}
next reply other threads:[~2004-09-07 1:24 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-07 1:26 Kenji Kaneshige [this message]
2004-09-07 9:49 ` [PATCH] missing pci_disable_device() Alan Cox
2004-09-08 3:14 ` Kenji Kaneshige
2004-09-08 12:39 ` Alan Cox
2004-09-09 5:55 ` Kenji Kaneshige
2004-09-09 6:20 ` Greg KH
2004-09-09 10:29 ` Kenji Kaneshige
2004-09-09 13:11 ` Alan Cox
2004-09-10 7:58 ` Kenji Kaneshige
2004-09-09 17:33 ` Greg KH
2004-09-09 19:38 ` Jeff Garzik
2004-09-10 8:18 ` Kenji Kaneshige
2004-09-13 3:55 ` Kenji Kaneshige
2004-09-14 20:47 ` Greg KH
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=413D0E4E.1000200@jp.fujitsu.com \
--to=kaneshige.kenji@jp.fujitsu.com \
--cc=akpm@osdl.org \
--cc=bjorn.helgaas@hp.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
/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