linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* PATCH pci.rc with lspci instead of deprecated /proc/pci
@ 2004-02-04 19:46 mjl
  2004-02-04 20:41 ` Marco d'Itri
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: mjl @ 2004-02-04 19:46 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 113 bytes --]

greetings
this patch is for using lspci to generate pci semi coldplug events (ie 
load the modules...)
regards



[-- Attachment #2: hotplug.patch --]
[-- Type: text/plain, Size: 1198 bytes --]

diff -ru hotplug-2004_01_05/etc/hotplug/pci.rc hotplug-jlm/etc/hotplug/pci.rc
--- hotplug-2004_01_05/etc/hotplug/pci.rc	2003-06-28 02:13:10.000000000 +0200
+++ hotplug-jlm/etc/hotplug/pci.rc	2004-02-04 20:37:52.840130176 +0100
@@ -27,13 +27,9 @@
 
 pci_boot_events ()
 {
-    #
-    # FIXME on 2.5, /sys/bus/pci/devices gives some of this
-    # information, and more can be gotten with 'lspci'.
-    # don't expect pcimodules to exist!!
-    #
-    LISTER=`type -p pcimodules`
-    if [ "$LISTER" = "" -o ! -f /proc/bus/pci/devices -o ! -x pci.agent ]; then
+
+    LISTER=`type -p lspci`
+    if [ "$LISTER" = "" -o ! -x pci.agent ]; then
 	    echo $"** can't synthesize pci hotplug events"
 	    return
     fi
@@ -47,13 +43,11 @@
     export ACTION PCI_CLASS PCI_ID PCI_SLOT PCI_SUBSYS_ID
 
     # these notifications will be handled by pcimodules
-    for BUS in `cd /proc/bus/pci;find * -type d -print`; do
-	for SLOT_FUNC in `cd /proc/bus/pci/$BUS; echo *`; do
-	    PCI_SLOT=$BUS:$SLOT_FUNC
+    lspci -n | gawk -F ' ' '{printf"%s\n",toupper($4)}' |
+	 while read PCI_ID; do
 	    : hotplug pci for $PCI_SLOT
 	    /sbin/hotplug pci
-	done
-    done
+	 done
 }
 
 # See how we were called.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2004-02-05 17:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-04 19:46 PATCH pci.rc with lspci instead of deprecated /proc/pci mjl
2004-02-04 20:41 ` Marco d'Itri
2004-02-05 10:50 ` mjl
2004-02-05 16:39 ` Martin Mares
2004-02-05 17:14 ` Arnd Bergmann
2004-02-05 17:21 ` Marco d'Itri
2004-02-05 17:32 ` Måns Rullgård

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).