mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-21 19:53:59 +08:00
3317fad5e9
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>
18 lines
443 B
Bash
18 lines
443 B
Bash
#!/bin/sh
|
|
|
|
# Simple hotplug script sample:
|
|
#
|
|
# Both $DEVPATH and $FIRMWARE are already provided in the environment.
|
|
|
|
HOTPLUG_FW_DIR=/usr/lib/hotplug/firmware/
|
|
|
|
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
|