Fix deblobbing of sb_common.c for good.
[releases.git] / deblob-check
index bf3414c16c3716f434d3d066263ed9e7ab073e7e..58af8535174620256fc689c8f83214cb8603c3fe 100755 (executable)
@@ -1,6 +1,6 @@
 #! /bin/sh
 
-# deblob-check version 2009-03-19
+# deblob-check version 2009-03-24
 # Inspired in gNewSense's find-firmware script.
 # Written by Alexandre Oliva <lxoliva@fsfla.org>
 
 case ${LANG+set} in set) LANG=C; export LANG;; esac
 
 rm="rm -f"
+
+for echo in 'echo' 'printf %s\n'; do
+  case `$echo '\nx'` in 
+  '\nx') break;;
+  esac
+done
+case `$echo '\nx'` in 
+'\nx') ;; *) echo Cannot find out what echo to use >&2; exit 1;;
+esac
+
+for echo_n in "echo -n" "printf %s"; do
+  case `$echo_n '\na'; $echo_n '\nb'` in 
+  '\na\nb') break;;
+  esac
+done
+case `$echo_n a; $echo_n b` in 
+'ab') ;; *) echo Cannot find out an echo -n equivalent to use >&2; exit 1;;
+esac
+
 case $1 in
 --save-scripts | -S)
   shift
@@ -847,6 +866,7 @@ set_except () {
     accept 'There is an USB interface for downloading[/]uploading.*request_firmware interface\.' Documentation/video4linux/si470x.txt
     accept '[\t]- move firmware loading to request_firmware()' drivers/staging/slicoss/README
     accept 'config FIRMWARE_IN_KERNEL.*let firmware be loaded from userspace\.' drivers/base/Kconfig
+    accept '[   ]*and request_firmware() in the source' drivers/base/Kconfig
     accept 'static int[\n]_request_firmware(const struct firmware \*\*firmware_p, const char \*name,[^{]*[\n]{[\n]\([^}]\|[^\n}]}*\)*[\n]}[\n]' drivers/base/firmware_class.c
     accept 'static int[\n]request_firmware_work_func(void \*arg)[\n]{[\n]\([^}]\|[^\n}]}*\)*ret = _request_firmware(\([^}]\|[^\n}]}*\)*[\n]}[\n]' drivers/base/firmware_class.c
     accept '[/][*][*][\n] [*] request_firmware: - send firmware [^{]*[\n]{[\n]\([^}]\|[^\n}]}*\)*[\n]}[\n]' drivers/base/firmware_class.c
@@ -1257,18 +1277,23 @@ set_except () {
     blobname '\([/]etc[/]sound[/]\)\?msnd\(init\|perm\)\.bin' sound/oss/msnd_classic.h
     blobna '\(Important Notes - Read Before Using\|Obtaining and Creating Firmware Files\)[\n]#  ~*\([^\n]\|[\n]# *\([\n]# *\([\n]# *For the[^\n]*[\n]# *~*[\n]\)\?\)\?[^\n ]\)*\.' Documentation/sound/oss/MultiSound
 
-    accept '   len = mod_firmware_load(fn, [&]data);[\n]       if [^{]* {[\n]          printk(KERN_ERR "sscape:' sound/oss/sscape.c
+    accept '   len = mod_firmware_load(fn, [&]data);[\n]       if [^{]* {[\n]  [        ]*printk(KERN_ERR "sscape:' sound/oss/sscape.c
     blobname '[/]sndscape[/]scope\.co[dx]' sound/oss/sscape.c
 
     accept '           trix_boot_len = mod_firmware_load(' sound/oss/trix.c
     blobname '\([/]etc[/]sound[/]\)\?trxpro\.bin' sound/oss/trix.c
 
-    accept '           smw_ucodeLen = mod_firwmare_load(' sound/oss/sb_common.c
-    blobname '\([/]etc[/]sound[/]\)\?msnd\(init\|perm\)\.bin' sound/oss/sb_common.c
+    accept '           smw_ucodeLen = mod_firmware_load(' sound/oss/sb_common.c
+    blobname '\([/]etc[/]sound[/]\)\?midi0001\.bin' sound/oss/sb_common.c
+    blobname '\([/]etc[/]sound[/]\)\?msnd\(init\|perm\)\.bin' sound/oss/Kconfig
 
     blob 'When the module is loaded\([^\n]\|[\n][^\n]\)*[/]pss_synth\([^\n]\|[\n][^\n]\)*' Documentation/sound/oss/PSS
     blob 'pss_firmware[ \n     ]*This parameter\([^\n]\|[\n][^\n]\)*[/]pss_synth\([^\n]\|[\n][^\n]\)*' Documentation/sound/oss/PSS-updates
-    accept '           pss_synthLen = mod_firmware_load(pss_firmware' sound/oss/pss.c
+    accept '           pss_synthLen = mod_firmware_load(pss_firmware, (void [*]) [&]pss_synth);' sound/oss/pss.c
+    accept '   *if \?(\(!\|fw_load [&][&] \)\?pss_synth' sound/oss/pss.c
+    accept '   *if (!pss_download_boot(devc, pss_synth, pss_synthLen,' sound/oss/pss.c
+    accept '   *vfree(pss_synth);' sound/oss/pss.c
+    blob 'to allow the user \([^/"]\|[^*"][/]*\)*fir[em]ware file\([^/"]\|[^*"][/]*\)*"[^"]*"' sound/oss/pss.c
     blobname '\([/]etc[/]sound[/]\)\?pss_synth' sound/oss/pss.c
     accept '   \$(obj)[/]bin2hex pss_synth' sound/oss/Makefile
     accept '    *echo '"'"'static \(unsigned char [*] *\|int \)pss_synth\(Len\)\? = \(NULL\|0\);' sound/oss/Makefile
@@ -2183,7 +2208,7 @@ g;
 
   sedmain="
 /^$/N;
-/^[\n]\?;[/][*]\\(end .*\\)\\?[*][/];$/{
+/^[\\n]\\?;[/][*]\\(end .*\\)\\?[*][/];$/{
   $4;
   d;
 }
@@ -2211,7 +2236,7 @@ H;
 g;
 $4
 $v:read all
-s/^\\(;[/][*]begin [^\n]*[\\n]\\)*//;
+s/^\\(;[/][*]begin [^\\n]*[\\n]\\)*//;
 s/\\($bol[\n]\?;[/][*]\\(end [^\\n]*\\)\\?[*][/];\\)*$//;
 $v:???!blobfast
 /$blobfast/!b clean;
@@ -2742,7 +2767,7 @@ check () {
   # falsepos matches to files that match it.
   addx () {
     if test -n "$1"; then
-      echo -n "\\|$1" >> $falsepos_name
+      $echo_n "\\|$1" >> $falsepos_name
     fi
   }
 
@@ -2751,7 +2776,7 @@ check () {
   # the falseneg matches to files that match it.
   badx () {
     if test -n "$1"; then
-      echo -n "\\|$1" >> $falseneg_name
+      $echo_n "\\|$1" >> $falseneg_name
     fi
   }
 
@@ -2819,10 +2844,10 @@ check () {
   esac
 
   # Then run through the selected action.
-  if test "$rm" != "rm -f" || test ! `echo "$sedmain" | wc -c` -lt 1024; then
+  if test "$rm" != "rm -f" || test ! `$echo "$sedmain" | wc -c` -lt 1024; then
     scriptname=`mktemp -t deblob-check-sedmain-XXXXXX`
     tempfiles="$tempfiles $scriptname"
-    echo "$sedmain" > $scriptname
+    $echo "$sedmain" > $scriptname
     cmd="sed -n -f \"$scriptname\""
   else
     cmd='sed -n "$sedmain"'