From 06cf83e1692c92a743e9682a4a3d982184926c45 Mon Sep 17 00:00:00 2001 From: David Schleef Date: Tue, 15 Jan 2002 11:38:41 +0000 Subject: [PATCH] New checks. Wrap some old checks in check_all --- comedi/drivers/check_driver | 51 ++++++++++++++++++++++++++++++++----- 1 file changed, 45 insertions(+), 6 deletions(-) diff --git a/comedi/drivers/check_driver b/comedi/drivers/check_driver index c91ec74e..37a97141 100755 --- a/comedi/drivers/check_driver +++ b/comedi/drivers/check_driver @@ -5,6 +5,8 @@ # don't necessarily apply to every driver. # +check_all=no + if [ "$1" ];then driver=$1 else @@ -111,15 +113,17 @@ else echo "E: board_name not set" fi -# Do we use trig? -# trig[0] is going away. +# Do we use trig? trig[0] has been eliminated +if [ "$check_all" = yes ]; then if grep 'trig\[0\]' ${driver} &>/dev/null;then echo "E: uses trig[0]" else echo "doesn't use trig[0]" fi +fi -# trig[1234] is going away, but not as rapidly. +# trig[1234] has been eliminated +if [ "$check_all" = yes ]; then if grep 'trig\[[1234]\]' ${driver} &>/dev/null;then echo "E: uses trig[1234]" trig1234=yes @@ -127,6 +131,7 @@ else echo "doesn't use trig[1234]" trig1234=no fi +fi if grep 'comedi_cmd' ${driver} &>/dev/null;then echo "uses cmd" @@ -152,20 +157,25 @@ fi # which is basically everything except *_attach() and *_detach(). # However, since it works correctly in non-real-time code, just use # it everywhere. +if [ "$check_all" = yes ]; then if grep 'printk' ${driver} &>/dev/null;then if ! grep 'rt_printk' ${driver} &>/dev/null;then echo "W: doesn't use rt_printk" fi fi +fi # comedi_request_irq() handles real-time interrupts. if grep request_irq ${driver} &>/dev/null;then + irq=yes if ! grep 'comedi_request_irq' ${driver} &>/dev/null;then echo "E: doesn't use comedi_request_irq" fi - if ! grep 'free_irq' ${driver} &>/dev/null;then + if ! grep 'comedi_free_irq' ${driver} &>/dev/null;then echo "E: doesn't use comedi_free_irq" fi +else + irq=no fi if grep SA_INTERRUPT ${driver} &>/dev/null;then echo "E: uses SA_INTERRUPT" @@ -178,6 +188,7 @@ if grep 'request_region' ${driver} &>/dev/null;then fi if grep 'pci_dev' ${driver} &>/dev/null;then + pci=yes echo uses pci if ! grep 'pci_find_device' ${driver} &>/dev/null;then echo "W: doesn't use pci_find_device" @@ -191,28 +202,36 @@ if grep 'pci_dev' ${driver} &>/dev/null;then if grep 'pcibios_' ${driver} &>/dev/null;then echo "W: has pcibios_*() calls" fi +else + pci=no fi # Who doesn't use comments like this to indicate something needs # to be fixed? +if [ "$check_all" = yes ]; then if grep '\(XXX\)\|\(FIX\)' ${driver} &>/dev/null;then echo "W: has FIXME-like comments" fi +fi # COMEDI_INITCLEANUP isn't strictly necessary, but it's a one-stop # cleanup to get Comedi to compile as part of the kernel. It is # recommended to use it unless something else is necessary in module # init. +if [ "$check_all" = yes ]; then if grep 'int init_module' ${driver} &>/dev/null;then echo "W: suggest using COMEDI_INITCLEANUP" fi +fi # range_unknown _should_ be used if the driver can't determine # the I/O range. However, it's commonly used as a marker where # the author has not added more accurate range information. +if [ "$check_all" = yes ]; then if grep 'range_unknown' ${driver} &>/dev/null;then echo "W: uses range_unknown" fi +fi # cur_trig was removed around 0.7.56 if grep 'cur_trig' ${driver} &>/dev/null;then @@ -236,12 +255,12 @@ fi # remnants of trig[0] if grep 'di_unpack' ${driver} &>/dev/null;then - echo "W: di_unpack() going away soon, (not too soon)" + echo "E: di_unpack() is gone" fi # remnants of trig[0] if grep 'do_pack' ${driver} &>/dev/null;then - echo "W: do_pack() going away soon, (not too soon)" + echo "E: do_pack() is gone" fi # This is a bug that causes difficulty to unload a driver. Easy @@ -275,12 +294,14 @@ if grep 'comedi_\(\(done\)\|\(error_done\)\|\(bufcheck\)\|\(eos\)\|\(eobuf\)\)[[ fi # Drivers should have documentation in Documentation/comedi/drivers.txt +if false; then if grep "^Driver: ${basedriver}.o$" ../../Documentation/comedi/drivers.txt \ &>/dev/null;then echo "entry in drivers.txt" else echo "E: not documented in drivers.txt" fi +fi # Drivers should have documentation in the source if grep "^Driver: ${basedriver}.o$" $driver &>/dev/null;then @@ -317,3 +338,21 @@ if [ -f "${basedriver}.o" ];then fi fi +if [ $irq = yes ];then +if [ $pci = yes ];then + if ! grep SA_SHIRQ ${driver} &>/dev/null;then + echo "E: PCI drivers need to use SA_SHIRQ" + fi +else + if grep SA_SHIRQ ${driver} &>/dev/null;then + echo "E: non PCI device using SA_SHIRQ" + fi +fi +fi + +if [ $pci = yes ];then + if ! grep pci_device_id ${driver} &>/dev/null;then + echo "E: PCI drivers should have pci_device_id tables" + fi +fi + -- 2.26.2