From magnus.damm@gmail.com Fri Jun 25 11:20:37 2010 From: Magnus Damm Date: Fri, 25 Jun 2010 17:55:11 +0900 Subject: firmware: Update hotplug script To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , Randy Dunlap , linux-doc@vger.kernel.org, Johannes Berg , Dmitry Torokhov , Marcel Holtmann , Magnus Damm , Ming Lei Message-ID: <20100625085511.30949.41045.sendpatchset@t400s> From: Magnus Damm 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 Signed-off-by: Greg Kroah-Hartman --- Documentation/firmware_class/hotplug-script | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) --- 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