Commit 3317fad5e9c741e758707879c68e20de2cb08f87
Committed by
Greg Kroah-Hartman
1 parent
737a3bb941
Exists in
master
and in
7 other branches
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>
Showing 1 changed file with 9 additions and 8 deletions Side-by-side Diff
Documentation/firmware_class/hotplug-script
... | ... | @@ -6,12 +6,13 @@ |
6 | 6 | |
7 | 7 | HOTPLUG_FW_DIR=/usr/lib/hotplug/firmware/ |
8 | 8 | |
9 | -echo 1 > /sys/$DEVPATH/loading | |
10 | -cat $HOTPLUG_FW_DIR/$FIRMWARE > /sys/$DEVPATH/data | |
11 | -echo 0 > /sys/$DEVPATH/loading | |
12 | - | |
13 | -# To cancel the load in case of error: | |
14 | -# | |
15 | -# echo -1 > /sys/$DEVPATH/loading | |
16 | -# | |
9 | +if [ "$SUBSYSTEM" == "firmware" -a "$ACTION" == "add" ]; then | |
10 | + if [ -f $HOTPLUG_FW_DIR/$FIRMWARE ]; then | |
11 | + echo 1 > /sys/$DEVPATH/loading | |
12 | + cat $HOTPLUG_FW_DIR/$FIRMWARE > /sys/$DEVPATH/data | |
13 | + echo 0 > /sys/$DEVPATH/loading | |
14 | + else | |
15 | + echo -1 > /sys/$DEVPATH/loading | |
16 | + fi | |
17 | +fi |