Greg KH <[EMAIL PROTECTED]> writes:

> This release is recommended for _anyone_ using the 2.6.0 and beyond
> kernels who is still using hotplug scripts older than 2003_08_05, as a
> number of changes have been made in order to support the 2.6 kernel
> properly.

This patch makes things work better on my laptop running linux
2.6.1-rc1.  Most likely it can be done in a better way.

Index: etc/hotplug/hotplug.functions
===================================================================
RCS file: /cvsroot/linux-hotplug/admin/etc/hotplug/hotplug.functions,v
retrieving revision 1.22
diff -u -r1.22 hotplug.functions
--- etc/hotplug/hotplug.functions	7 Oct 2003 21:15:38 -0000	1.22
+++ etc/hotplug/hotplug.functions	5 Jan 2004 18:33:33 -0000
@@ -139,7 +139,7 @@
     do
 	# maybe driver modules need loading
         LOADED=false
-	if ! lsmod | grep -q "^$MODULE " > /dev/null 2>&1; then
+	if ! lsmod | grep -q "^${MODULE//-/_} " > /dev/null 2>&1; then
 	    if grep -q "^$MODULE\$" $HOTPLUG_DIR/blacklist \
 		    >/dev/null 2>&1; then
 		debug_mesg "... blacklisted module:  $MODULE"
Index: etc/hotplug/pci.agent
===================================================================
RCS file: /cvsroot/linux-hotplug/admin/etc/hotplug/pci.agent,v
retrieving revision 1.13
diff -u -r1.13 pci.agent
--- etc/hotplug/pci.agent	16 Sep 2003 19:42:17 -0000	1.13
+++ etc/hotplug/pci.agent	5 Jan 2004 18:33:33 -0000
@@ -147,7 +147,7 @@
 add)
     pci_convert_vars
 
-    LABEL="PCI slot $PCI_SLOT_NAME"
+    LABEL="PCI slot $PCI_SLOT"
 
     # on 2.4 systems, modutils maintains MAP_CURRENT
     if [ -r $MAP_CURRENT ]; then
Index: etc/hotplug/pci.rc
===================================================================
RCS file: /cvsroot/linux-hotplug/admin/etc/hotplug/pci.rc,v
retrieving revision 1.7
diff -u -r1.7 pci.rc
--- etc/hotplug/pci.rc	6 Jun 2003 18:27:23 -0000	1.7
+++ etc/hotplug/pci.rc	5 Jan 2004 18:33:33 -0000
@@ -25,6 +25,11 @@
 #     . /etc/sysconfig/pci
 # fi
 
+sys_file ()
+{
+    cut -f2 -dx $DEVICE/$1
+}
+
 pci_boot_events ()
 {
     #
@@ -46,14 +51,27 @@
     PCI_SUBSYS_ID=0:0
     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
-	    : hotplug pci for $PCI_SLOT
-	    /sbin/hotplug pci
+    case $KERNEL in
+	2.5*|2.6*)
+	    for DEVICE in /sys/bus/pci/devices/*; do
+		PCI_CLASS=`sys_file class`
+		PCI_ID=`sys_file vendor`:`sys_file device`
+		PCI_SLOT=`echo $DEVICE | cut -d: -f2-`
+		PCI_SUBSYS_ID=`sys_file subsystem_vendor`:`sys_file subsystem_device`
+		/sbin/hotplug pci
+	    done
+	    ;;
+	2.4*)
+	# 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
+		: hotplug pci for $PCI_SLOT
+		/sbin/hotplug pci
+	    done
 	done
-    done
+	;;
+    esac
 }
 
 # See how we were called.
-- 
M�ns Rullg�rd
[EMAIL PROTECTED]

Reply via email to