summaryrefslogtreecommitdiff
path: root/Documentation/firmware_class/hotplug-script
diff options
context:
space:
mode:
authorMagnus Damm <damm@opensource.se>2010-06-25 12:55:11 +0400
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-06 00:53:34 +0400
commit3317fad5e9c741e758707879c68e20de2cb08f87 (patch)
treebce11a9de7926e21c38dd4e3e477ca5cbecf6325 /Documentation/firmware_class/hotplug-script
parent737a3bb9416ce2a7c7a4170852473a4fcc9c67e8 (diff)
downloadlinux-3317fad5e9c741e758707879c68e20de2cb08f87.tar.xz
firmware: Update hotplug script
Update the in-kernel hotplug example script to work properly with recent kernels. Without this fix the script may load the firmware twice - both at "add" and "remove" time. The second load only triggers in the case when multiple firmware images are used. A good example is the b43 driver which does not work properly without this fix. Signed-off-by: Magnus Damm <damm@opensource.se> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'Documentation/firmware_class/hotplug-script')
-rw-r--r--Documentation/firmware_class/hotplug-script17
1 files changed, 9 insertions, 8 deletions
diff --git a/Documentation/firmware_class/hotplug-script b/Documentation/firmware_class/hotplug-script
index 1990130f2ab1..8143a950b607 100644
--- a/Documentation/firmware_class/hotplug-script
+++ b/Documentation/firmware_class/hotplug-script
@@ -6,11 +6,12 @@
HOTPLUG_FW_DIR=/usr/lib/hotplug/firmware/
-echo 1 > /sys/$DEVPATH/loading
-cat $HOTPLUG_FW_DIR/$FIRMWARE > /sys/$DEVPATH/data
-echo 0 > /sys/$DEVPATH/loading
-
-# To cancel the load in case of error:
-#
-# echo -1 > /sys/$DEVPATH/loading
-#
+if [ "$SUBSYSTEM" == "firmware" -a "$ACTION" == "add" ]; then
+ if [ -f $HOTPLUG_FW_DIR/$FIRMWARE ]; then
+ echo 1 > /sys/$DEVPATH/loading
+ cat $HOTPLUG_FW_DIR/$FIRMWARE > /sys/$DEVPATH/data
+ echo 0 > /sys/$DEVPATH/loading
+ else
+ echo -1 > /sys/$DEVPATH/loading
+ fi
+fi