Skip to content

Commit

Permalink
firmware: Update hotplug script
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Magnus Damm authored and Greg Kroah-Hartman committed Aug 5, 2010
1 parent 737a3bb commit 3317fad
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions Documentation/firmware_class/hotplug-script
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 3317fad

Please sign in to comment.