--- hotplug-2004_09_23.orig/etc/hotplug/acpi.rc 2006-05-16 22:10:19 +0300 +++ hotplug-2004_09_23.orig/etc/hotplug/acpi.rc 2006-05-16 21:19:05 +0300 @@ -18,15 +18,16 @@ # start this script only for 2.6 kernel and if acpi namespace enabled [ -d $SYSFS/firmware/acpi/namespace/ACPI ] || exit 0 - start() { - MODULES=`/usr/bin/acpiscan -r 2>/dev/null|sort -u` - for i in $MODULES - do - /sbin/modprobe $i >/dev/null + MODULES=`/usr/bin/acpiscan -r 2>/dev/null|sort -u && echo "ac"` + for i in $MODULES ; do + if ! loaded $i ; then + if ! blacklisted $i ; then + /sbin/modprobe $i >/dev/null + fi + fi done - modprobe ac >/dev/null } stop() @@ -36,7 +37,6 @@ do /sbin/modprobe -r $i >/dev/null done - modprobe -r ac >/dev/null } status() --- hotplug-2004_09_23.orig/etc/hotplug/block.rc 2006-05-16 22:10:19 +0300 +++ hotplug-2004_09_23.orig/etc/hotplug/block.rc 2006-05-16 22:18:48 +0300 @@ -19,8 +19,13 @@ start() { - for i in `storagescan -r 2>/dev/null|uniq`;do - modprobe $i + MODULES=`storagescan -r 2>/dev/null|uniq` + for i in $MODULES ; do + if ! loaded $i ; then + if ! blacklisted $i ; then + /sbin/modprobe $i >/dev/null + fi + fi done } --- hotplug-2004_09_23.orig/etc/hotplug/cpu.rc 2006-05-16 22:10:19 +0300 +++ hotplug-2004_09_23.orig/etc/hotplug/cpu.rc 2006-05-16 21:37:26 +0300 @@ -16,11 +16,14 @@ start() { - MODULES=`/usr/bin/cpuscan -r 2>/dev/null|sort -u` - for i in $MODULES - do - /sbin/modprobe $i >/dev/null - done + MODULES=`/usr/bin/cpuscan -r 2>/dev/null|sort -u` + for i in $MODULES ; do + if ! loaded $i ; then + if ! blacklisted $i ; then + /sbin/modprobe $i >/dev/null + fi + fi + done } stop() --- hotplug-2004_09_23.orig/etc/hotplug/hotplug.functions 2006-05-16 22:10:19 +0300 +++ hotplug-2004_09_23.orig/etc/hotplug/hotplug.functions 2006-05-16 21:45:39 +0300 @@ -83,6 +83,39 @@ mesg "$@" } +# check if module's already loaded +# if it's present return 1 +# else return 0 + +loaded() +{ + local MODULE=$1 + if lsmod | grep -q "^$(echo $MODULE|sed -e 's/-/_/g') " > /dev/null 2>&1; then + return 0; + fi + return 1; +} + +# check if module is in blacklist +# if it's true return 1 +# else return 0 + +blacklisted() +{ + if [ ! -f $HOTPLUG_DIR/blacklist.d/`uname -r`/blacklist ] ; then + mkdir -p $HOTPLUG_DIR/blacklist.d/`uname -r` + touch $HOTPLUG_DIR/blacklist.d/`uname -r`/blacklist + fi + local MODULE=$1 + if grep -q "^$(echo $MODULE|sed -e 's/[-_]/[-_]/g')\$" $HOTPLUG_DIR/blacklist \ + $HOTPLUG_DIR/blacklist.d/* \ + $HOTPLUG_DIR/blacklist.d/`uname -r`/blacklist \ + >/dev/null 2>&1; then + debug_mesg "blacklisted module ... $MODULE" + return 0 + fi + return 1 +} # # Not "modprobe --autoclean" ... one driver module can handle many @@ -149,11 +182,8 @@ do # maybe driver modules need loading LOADED=false - if ! lsmod | grep -q "^$(echo $MODULE|sed -e 's/-/_/g') " > /dev/null 2>&1; then - if grep -q "^$(echo $MODULE|sed -e 's/[-_]/[-_]/g')\$" $HOTPLUG_DIR/blacklist \ - $HOTPLUG_DIR/blacklist.d/* \ - >/dev/null 2>&1; then - debug_mesg "... blacklisted module: $MODULE" + if ! loaded $MODULE ; then + if blacklisted $MODULE ; then continue fi --- hotplug-2004_09_23.orig/etc/hotplug/scsi.agent 2006-05-16 22:10:19 +0300 +++ hotplug-2004_09_23.orig/etc/hotplug/scsi.agent 2006-05-16 22:18:28 +0300 @@ -61,7 +61,9 @@ esac if [ "$MODULE" != "" ]; then mesg "$TYPE at $DEVPATH" - modprobe $MODULE + if ! blacklisted $MODULE ; then + modprobe $MODULE + fi else debug_mesg "how to add device type=$TYPE at $DEVPATH ??" fi --- hotplug-2004_09_23.orig/etc/hotplug/usb.rc 2006-05-16 22:10:19 +0300 +++ hotplug-2004_09_23.orig/etc/hotplug/usb.rc 2006-05-16 22:24:35 +0300 @@ -141,7 +141,9 @@ # if distro hasn't already done part of this ... load core, # and mount usbfs before the first hotplug agent fires # (so it'll be available to the agents). - modprobe -q usbcore >/dev/null 2>&1 + if ! blacklisted usbcore ; then + modprobe -q usbcore >/dev/null 2>&1 + fi if [ -d /proc/bus/usb ]; then # if it's not mounted, try to mount it if [ -z "`grep " /proc/bus/usb " /proc/mounts`" ]; then @@ -163,7 +165,13 @@ # is enabled on this system, initting a root hub will cause hotplug # events to fire for every device on the tree at that root. - for i in `/usr/bin/pciscan -r -c 00c:03 2>/dev/null|sort -u`;do modprobe $i;done >/dev/null 2>&1 + for i in `/usr/bin/pciscan -r -c 00c:03 2>/dev/null|sort -u`; do + if ! loaded $i ; then + if ! blacklisted $i ; then + modprobe $i >/dev/null + fi + fi + done # ... add any non-PCI HCDS here. Examples include the # CRIS usb-host, Philips ISP-1161, Symlogic 811HS, and so on. @@ -201,7 +209,11 @@ # Some modules are statically loaded, perhaps because they are # needed to activate filesystem device nodes. for MODULE in $STATIC_MODULE_LIST; do - modprobe $MODULE + if ! loaded $MODULE ; then + if ! blacklisted $MODULE ; then + modprobe $MODULE + fi + fi done # we did everything we could ...