Skip to content

Commit 3317fad

Browse files
Magnus Dammgregkh
Magnus Damm
authored andcommitted
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 <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 737a3bb commit 3317fad

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

Documentation/firmware_class/hotplug-script

+9-8
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66

77
HOTPLUG_FW_DIR=/usr/lib/hotplug/firmware/
88

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

0 commit comments

Comments
 (0)