Generalize the expression to match CIS request_firmware all the way
[releases.git] / deblob-check
index 681f47144fea74d09ba6dc7dba7fca4ae8c87e5b..e8f9028b9f0ad2105486e631b2eed64d27ae3341 100755 (executable)
@@ -1,13 +1,13 @@
 #! /bin/sh
 
-# deblob-check version 2010-12-29
+# deblob-check version 2011-01-07
 # Inspired in gNewSense's find-firmware script.
 # Written by Alexandre Oliva <lxoliva@fsfla.org>
 
 # Check http://www.fsfla.org/svn/fsfla/software/linux-libre for newer
 # versions.
 
-# Copyright 2008, 2009, 2010 Alexandre Oliva <lxoliva@fsfla.org>
+# Copyright 2008, 2009, 2010, 2011 Alexandre Oliva <lxoliva@fsfla.org>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -885,7 +885,13 @@ set_except () {
   blobna 'DEFAULT_FIRMWARE'
   blobna '\([.]\|->\)firmware[         \n]*=[^=]'
   blobna 'mod_firmware_load' # sound/
-  blobname '[.]\(fw\|bin[0-9]*\|hex\|frm\|co[dx]\|cis\|dat\|elf\|xlx\|rfb\|ucode\|img\|sbcf\|ctx\(prog\|vals\)\|z77\)["]'
+  blobname '[.]\(fw\|bin[0-9]*\|hex\|frm\|co[dx]\|dat\|elf\|xlx\|rfb\|ucode\|img\|sbcf\|ctx\(prog\|vals\)\|z77\)["]'
+  # Ideally we'd whitelist URLs that don't recommend non-Free
+  # Software, but there are just too many URLs in Linux, and most are
+  # fine, so we just blacklist when we find undesirable URLs.
+  # Please report if you find any inappropriate URL in Linux-libre
+  # deblobbed documentation, sources or run-time log messages.
+  # blobna '\(f\|ht\)tp:[/]\([/]\+[^/ \n ]\+\)\+'
 
   case $prefix$1 in
   */*linux*.tar* | */*kernel*.tar* | */*linux-*.*.*/*)
@@ -1432,7 +1438,10 @@ set_except () {
     accept '[  ]*priv->firmware[ ]=[ ]\(NULL\|new_firmware\)[;]' drivers/net/wireless/atmel.c
 
     blobname 'b43\(legacy\)\?\(%s\)\?[/]\(%s\|ucode\([2459]\|1[1345]\)\|pcm5\|[abn]0g[01]initvals\(5\|1[13]\)\)\.fw' 'drivers/net/wireless/b43\(legacy\)\?/main.c'
+    blobname 'pcm5\.fw' drivers/net/wireless/b43/main.c
     blobna 'b43legacyerr[(][^;]*must[ ]go[ ]to[ ]http[^;]*b43#devicefirmware[^;]*[)][;]' drivers/net/wireless/b43legacy/main.c
+    blobna 'You[ ]must[ ]go[ ]to[^;]*b43#devicefirmware[^;]*[^";)]' drivers/net/wireless/b43/main.c
+    blobna 'http:[/][/]wireless[^ ";)]*b43#devicefirmware' drivers/net/wireless/b43/main.c
 
     blob '#define[ ]IPW2100_FW_\(\(\(MAJOR\|MINOR\)_VERSION\|\(MAJOR\|MINOR\)[(]x[)]\)\|VERSION\)\([^\n]*\\[\n]\)*[^\n]*\([\n][\n]*#define[ ]IPW2100_FW_\(\(\(MAJOR\|MINOR\)_VERSION\|\(MAJOR\|MINOR\)[(]x[)]\)\|VERSION\)\([^\n]*\\[\n]\)*[^\n]*\)*' 'drivers/net/wireless/\(ipw2x00/\)\?ipw2100\.c'
     blobname 'ipw2100-\(["]\([^"\n]\|[\\][\n]\)*["]\([^"]\|[\\]["]\)*\)\+' 'drivers/net/wireless/\(ipw2x00/\)\?ipw2100\.c'
@@ -1492,13 +1501,19 @@ set_except () {
     # accept '[        ]    PCMCIA_\([PM]FC_\)\?DEVICE_CIS_\(MANF_CARD\|PROD_ID[1-4]*\)[(][^)]*, ["][/][*][(]DEBLOBBED[)][*][/]["][)]'
     # accept '#define PCMCIA_\([PM]FC_\)\?DEVICE_CIS_\(MANF_CARD\|PROD_ID[1-4]*\)[(]' include/pcmcia/device_id.h
 
-    blobname '\(cis[/]\)\?3CCFEM556\.cis' drivers/net/pcmcia/3c574_cs.c
+    # These are not software; they're Free, but GPLed without in-tree sources.
+    # blobname '\(cis[/]\)\?3CCFEM556\.cis' drivers/net/pcmcia/3c574_cs.c
+    # blobname '\(cis[/]\)\?3CXEM556\.cis' drivers/net/pcmcia/3c589_cs.c
+    # blobname '\(cis[/]\)\?\(PCMLM28\|DP83903\|LA-PCM\|PE520\|NE2K\|PE-200\|tamarack\)\.cis' drivers/net/pcmcia/pcnet_cs.c
+    # blobname '\(cis[/]\)\?\(PCMLM28\|DP83903\|3C\(CF\|X\)EM556\|MT5634ZLX\|COMpad[24]\|RS-COM-2P\|GLOBETROTTER\)\.cis' drivers/serial/serial_cs.c
+    # These are not software; they're Free, but GPLed without textual sources.
+    # It is safe to assume that these binaries *are* sources, since they
+    # can be trivially converted back to a textual form, without loss.
+    # blobname '\(cis[/]\)\?SW_\([78]xx\|555\)_SER\.cis' drivers/serial/serial_cs.c
 
-    blobname '\(cis[/]\)\?3CXEM556\.cis' drivers/net/pcmcia/3c589_cs.c
-
-    blobname '\(cis[/]\)\?\(PCMLM28\|DP83903\|LA-PCM\|PE520\|NE2K\|PE-200\|tamarack\)\.cis' drivers/net/pcmcia/pcnet_cs.c
-
-    blobname '\(cis[/]\)\?\(PCMLM28\|DP83903\|3C\(CF\|X\)EM556\|SW_\([78]xx\|555\)_SER\|MT5634ZLX\|COMpad[24]\|RS-COM-2P\|GLOBETROTTER\)\.cis' drivers/serial/serial_cs.c
+    accept '[  ]\(ds_\)\?\(dev_\)\?dbg[(]\(1[,][ ]\)\?\([&]dev->dev,[ ]\)\?["]trying[ ]to[ ]load[ ]\(CIS[ ]file\|firmware\)[ ]%s[\\]n["],[ ]filename[)][;][\n]*[       ]if[ ][(]\(strlen[(]filename[)][^\n]*\([{][^}]*[        ][}]\|[)][\n][  ]*return[^\n]*[;]\)[\n]*[       ]snprintf[(]path,[ ]\(20\|sizeof[(]path[)]\),[^\n]*,[ ]filename[)][;][\n]*[     ]if[ ][(]request_firmware[(][&]fw,[ ]path\|request_firmware[(][&]fw,[ ]filename\),[ ][&]dev->dev[)][^\n]*[)][ ][{][\n][ ]*if[ ][(]fw->size[ ]>=[ ]CISTPL_MAX_CIS_SIZE[)]' drivers/pcmcia/ds.c
+    accept 'MODULE_FIRMWARE[(]["]\(cis[/]\)\?\(PCMLM28\|DP83903\|3C\(CF\|X\)EM556\|MT5634ZLX\|COMpad[24]\|RS-COM-2P\|GLOBETROTTER\|SW_\([78]xx\|555\)_SER\)\.cis["][)][;]\([\n]MODULE_FIRMWARE[(]["]\(cis[/]\)\?\(PCMLM28\|DP83903\|3C\(CF\|X\)EM556\|MT5634ZLX\|COMpad[24]\|RS-COM-2P\|GLOBETROTTER\|SW_\([78]xx\|555\)_SER\)\.cis["][)][;]\)*' drivers/serial/serial_cs.c
+    accept 'MODULE_FIRMWARE[(]["]\(cis[/]\)\?\(PCMLM28\|DP83903\|LA-PCM\|PE520\|NE2K\|PE-200\|tamarack\)\.cis["][)][;]\([\n]MODULE_FIRMWARE[(]["]\(cis[/]\)\?\(PCMLM28\|DP83903\|LA-PCM\|PE520\|NE2K\|PE-200\|tamarack\)\.cis["][)][;]\)*' drivers/net/pcnet_cs.c
 
     # This enables but does not encourage firmware updates.
     accept '[  ]err[ ]=[ ]request_firmware[(][&]asd_ha->bios_image,[\n         ]*filename_ptr,[\n      ]*[&]asd_ha->pcidev->dev[)][;]' drivers/scsi/aic94xx/aic94xx_init.c
@@ -1975,7 +1990,7 @@ set_except () {
     initnc 'static[ ]const[ ]u16[ ]rtl8225z2_rxgain\[\][ ]='
     defsnc 'static[ ]const[ ]u16[ ]stufftab\[5[ ][*][ ]256\][ ]=' drivers/isdn/gigaset/isocdata.c
     initnc 'static[ ]const[ ]u16[ ]tkip_sbox\[256\][ ]='
-    initnc 'static[ ]const[ ]u16[ ]wm8753_reg\[\][ ]='
+    defsnc 'static[ ]const[ ]u16[ ]wm8753_reg\[\][ ]=' sound/soc/codecs/wm8753.c
     initnc 'static[ ]const[ ]u32[ ]SS[0-3]\[256\][ ]='
     initnc 'static[ ]const[ ]u32[ ]S[1-8]\[64\][ ]='
     initnc 'static[ ]const[ ]u32[ ]T[0-5]\[256\][ ]='
@@ -2242,7 +2257,7 @@ set_except () {
     blobna 'linux-firmware\.git' firmware/README.AddingFirmware
     blobname '\(ea[/]\)\?\(loader\|indigo_djx\)_dsp\.fw' sound/pci/echoaudio/indigodjx.c
     blobname '\(ea[/]\)\?\(loader\|indigo_iox\)_dsp\.fw' sound/pci/echoaudio/indigoiox.c
-    blobname 'cis[/]LA-PCM\.cis' drivers/net/pcmcia/pcnet_cs.c
+    blobname 'cis[/]LA-PCM\.cis' drivers/net/pcmcia/pcnet_cs.c
     blobname 'ositech[/]Xilinx7OD\.bin' drivers/net/pcmcia/smc91c92_cs.c
     blobname 'tehuti[/]\(firmware\|bdx\)\.bin' drivers/net/tehuti.c
     accept '[  ]*["]b43-open%s[/]%s\.fw["]' drivers/net/wireless/b43/main.c
@@ -2695,7 +2710,7 @@ set_except () {
     defsnc 'static[ ]u8[ ]sa2400_rf_rssi_map\[\][ ]=' drivers/net/wireless/rtl818x/rtl8180_sa2400.c
     ;;
 
-  */patch*-2.6.37-rc*) # up to -rc5
+  */patch*-2.6.37-rc*) # up to -rc8-git3
     defsnc 'static[ ]u32[ ]epll_div\[\]\[6\][ ]=' arch/arm/mach-s5pv210/clock.c
     defsnc 'static[ ]struct[ ]titan_gpio_cfg[ ]titan_gpio_table\[\][ ]=' arch/mips/ar7/gpio.c
     blobname 'sdma-%s-to%d\.bin' drivers/dma/imx-sdma.c
@@ -2869,6 +2884,7 @@ set_except () {
     initnc '\([;][/][*]@@[ ]-[0-9]*,[0-9]*[ ][+][0-9]*,[0-9]*[ ]@@[ ]\)\?static[ ]const[ ]u8[ ]\(gc0307\|po2030n\)_sensor_\(init\|param1\)\[\]\[8\][ ]\(=[ ][{]\)\?\([*][/][;]\)\?' drivers/media/video/gspca/sonixj.c
     accept '[*][ ]drivers[/]staging[/]ft1000[/]ft1000-\(pcmcia\|usb\)[/]ft[13]000\.img:[ ]Removed\.' 'patch-libre.*'
     initc '\([;][/][*]@@[ ]-[0-9]*,[0-9]*[ ][+][0-9]*,[0-9]*[ ]@@[ ]\)\?static[ ]const[ ]struct[ ]ar9300_eeprom[ ]ar9300_default[ ]=\([ ][{][*][/][;]\)\?' drivers/net/wireless/ath/ath9k/ar9003_eeprom.c
+    defsnc 'static[ ]const[ ]u16[ ]wm8753_reg\[\][ ]=' sound/soc/codecs/wm8753.c
     ;;
 
   */patch*-2.6.36.*)