lkml.org 
[lkml]   [2004]   [Oct]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] PCI fixes for 2.6.9
Date
From
ChangeSet 1.1997.37.29, 2004/10/06 12:50:32-07:00, kaneshige.kenji@jp.fujitsu.com

[PATCH] PCI: warn of missing pci_disable_device()

As mentioned in Documentaion/pci.txt, pci device driver should call
pci_disable_device() when it decides to stop using the device. But
there are some drivers that don't use pci_disable_device() so far.

This patch adds warning messages that are displayed if the device is
removed without properly calling pci_disable_device().

'WARN_ON(1)' is commented out for now because I guess many people
(including some distros) enables 'CONFIG_DEBUG_KERNEL'. People might
be surprised if many stack dumps are displayed on their console.

Signed-off-by: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


drivers/pci/pci-driver.c | 13 +++++++++++++
1 files changed, 13 insertions(+)

diff -Nru a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
--- a/drivers/pci/pci-driver.c 2004-10-19 15:25:09 -07:00
+++ b/drivers/pci/pci-driver.c 2004-10-19 15:25:09 -07:00
@@ -291,6 +291,19 @@
drv->remove(pci_dev);
pci_dev->driver = NULL;
}
+
+#ifdef CONFIG_DEBUG_KERNEL
+ /*
+ * If the driver decides to stop using the device, it should
+ * call pci_disable_device().
+ */
+ if (pci_dev->is_enabled) {
+ dev_warn(&pci_dev->dev, "Device was removed without properly "
+ "calling pci_disable_device(). This may need fixing.\n");
+ /* WARN_ON(1); */
+ }
+#endif /* CONFIG_DEBUG_KERNEL */
+
pci_dev_put(pci_dev);
return 0;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:07    [from the cache]
©2003-2014 Jasper Spaans. hosted at Digital Ocean