linux/drivers/watchdog/ib700wdt.c
<<
val.22/spa v .22/form v .22a val.2 href="../linux+v3.7.5/drivers/watchdog/ib700wdt.c"> val.22img src="../.static/gfx/right.png" alt=">>"> v2/spa v v2spa class="lxr_search"> val ="+search" method="post" onsubmit="return do_search(this);"> val.22input typ hidden" nam navtarget" ion> "> val.22input typ text" nam search" id search"> val.22buttopttyp submit">Search val.2Prefsv .22/a> v2/spa val.2 22/div val.2 22form ac > ="ajax+*" method="post" onsubmit="return false;"> v2input typ hidden" nam ajax_lookup" id ajax_lookup" ion> "> al.2 22/form v al.2 22div class="headingbottom">
v 2div id file_contents"
2 212/a>2spa  class="comment">/*2/spa  v2 222/a>2spa  class="comment"> *al.2 2IB700 Single Board Computer WDT driver2/spa  v2 232/a>2spa  class="comment"> *2/spa  v2 242/a>2spa  class="comment"> *al.2 2(c) Copyright 2001 Charles Howes <chowes@vsol.net>2/spa  v2 252/a>2spa  class="comment"> *2/spa  v2 262/a>2spa  class="comment"> *al.2 2Based on advantechwdt.c which is based on acquirewdt.c which2/spa  v2 272/a>2spa  class="comment"> *al.2 2is based on wdt.c.2/spa  v2 282/a>2spa  class="comment"> *2/spa  v2 292/a>2spa  class="comment"> *al.2 2(c) Copyright 2000-2001 Marek Michalkiewicz <marekm@linux.org.pl>2/spa  v2 
	  a>2spa  class="comment"> *2/spa  v2 112/a>2spa  class="comment"> *al.2 2Based on acquirewdt.c which2is based on wdt.c.2/spa  v2 122/a>2spa  class="comment"> *al.2 2Original copyright messages:2/spa  v2 132/a>2spa  class="comment"> *2/spa  v2 142/a>2spa  class="comment"> *al.2 2(c) Copyright 1996 Ala  Cox <ala @lxorguk.ukuu.org.uk>,2/spa  v2 152/a>2spa  class="comment"> *                                              All Rights Reserved.2/spa  v2 162/a>2spa  class="comment"> *2/spa  v2 172/a>2spa  class="comment"> *al.2 2This program2is free software; you ca  redistribute it and/or2/spa  v2 182/a>2spa  class="comment"> *al.2 2modify it under the terms of the GNU General Public License2/spa  v2 192/a>2spa  class="comment"> *al.2 2as published by the Free Software Founda >
 ; either vers>
 2/spa  v2 2	  a>2spa  class="comment"> *al.2 22 of the License, or (at your 	  >
 ) any later vers>
 .2/spa  v2 212/a>2spa  class="comment"> *2/spa  v2 222/a>2spa  class="comment"> *al.2 2Neither Ala  Cox nor CymruNet Ltd. admit liability nor provide2/spa  v2 232/a>2spa  class="comment"> *al.2 2warranty for any of this software.2This material is provided2/spa  v2 242/a>2spa  class="comment"> *al.2 2"AS-IS" and at no charge.2/spa  v2 252/a>2spa  class="comment"> *2/spa  v2 262/a>2spa  class="comment"> *al.2 2(c) Copyright 1995    Ala  Cox <ala @lxorguk.ukuu.org.uk>2/spa  v2 272/a>2spa  class="comment"> *2/spa  v2 282/a>2spa  class="comment"> *al.2 214-Dec-2001 Matt Domsch2<Matt_Domsch@dell.com>2/spa  v2 292/a>2spa  class="comment"> *al.2 2     Added nowayout2module 	  >
  to override CONFIG_WATCHDOG_NOWAYOUT2/spa  v2 3	  a>2spa  class="comment"> *al.2 2     Added timeout2module 	  >
  to override default2/spa  v2 312/a>2spa  class="comment"> *2/spa  v2 322/a>2spa  class="comment"> */2/spa  v2 332/a>v2 342/a>#define22a href="+code=pr_fmt" class="sref">pr_fmt2/a>(2a href="+code=fmt" class="sref">fmt2/a>)22a href="+code=KBUILD_MODNAME" class="sref">KBUILD_MODNAME2/a> 2spa  class="string">":2"2/spa  22a href="+code=fmt" class="sref">fmt2/a>v2 352/a>v2 362/a>#include <linux/module.h2/a>>v2 372/a>#include <linux/typ
s.h2/a>>v2 382/a>#include <linux/miscdevice.h2/a>>v2 392/a>#include <linux/watchdog.h2/a>>v2 402/a>#include <linux/ioport.h2/a>>v2 412/a>#include <linux/fs.h2/a>>v2 422/a>#include <linux/init.h2/a>>v2 432/a>#include <linux/spinlock.h2/a>>v2 442/a>#include <linux/moduleparam.h2/a>>v2 452/a>#include <linux/platform_device.h2/a>>v2 462/a>#include <linux/io.h2/a>>v2 472/a>#include <linux/uaccess.h2/a>>v2 482/a>v2 492/a>v2 502/a>static struct22a href="+code=platform_device" class="sref">platform_device2/a> *2a href="+code=ibwdt_platform_device" class="sref">ibwdt_platform_device2/a>;v2 512/a>static unsigned long22a href="+code=ibwdt_is_open" class="sref">ibwdt_is_open2/a>;v2 522/a>static 2a href="+code=DEFINE_SPINLOCK" class="sref">DEFINE_SPINLOCK2/a>(2a href="+code=ibwdt_lock" class="sref">ibwdt_lock2/a>);v2 532/a>static char 2a href="+code=expect_close" class="sref">expect_close2/a>;v2 542/a>v2 552/a>2spa  class="comment">/* Module informa >
  */2/spa  v2 562/a>#define22a href="+code=DRV_NAME" class="sref">DRV_NAME2/a> 2spa  class="string">"ib700wdt"2/spa  v2 572/a>v2 582/a>2spa  class="comment">/*2/spa  v2 592/a>2spa  class="comment"> *2/spa  v2 6	  a>2spa  class="comment"> *aWatchdog Timer Configura >
 2/spa  v2 612/a>2spa  class="comment"> *2/spa  v2 622/a>2spa  class="comment"> *aThe func >
  of the watchdog timer is to reset the system2/spa  v2 632/a>2spa  class="comment"> *aautoma >cally and is defined at I/O port 0443H.  To enable the2/spa  v2 642/a>2spa  class="comment"> *awatchdog timer and allow the system to reset, write I/O port 0443H.2/spa  v2 652/a>2spa  class="comment"> * To disable the timer, write I/O port 0441H for the system to stop the2/spa  v2 662/a>2spa  class="comment"> *awatchdog func >
 .  The timer has a tolerance of 20% for its2/spa  v2 672/a>2spa  class="comment"> *aintervals.2/spa  v2 682/a>2spa  class="comment"> *2/spa  v2 692/a>2spa  class="comment"> *aThe following describes how the timer should be programmed.2/spa  v2 7	  a>2spa  class="comment"> *2/spa  v2 712/a>2spa  class="comment"> *aEnabling Watchdog:2/spa  v2 722/a>2spa  class="comment"> *aMOV AX,000FH (Choose the ion>
s from 0 to F)2/spa  v2 732/a>2spa  class="comment"> *aMOV DX,0443H2/spa  v2 742/a>2spa  class="comment"> *aOUT DX,AX2/spa  v2 752/a>2spa  class="comment"> *2/spa  v2 762/a>2spa  class="comment"> *aDisabling Watchdog:2/spa  v2 772/a>2spa  class="comment"> *aMOV AX,000FH (Any ion>
2is fine.)2/spa  v2 782/a>2spa  class="comment"> *aMOV DX,0441H2/spa  v2 792/a>2spa  class="comment"> *aOUT DX,AX2/spa  v2 8	  a>2spa  class="comment"> *2/spa  v2 812/a>2spa  class="comment"> *aWatchdog timer control table:2/spa  v2 822/a>2spa  class="comment"> *aLevel   Von>
2 Time/sec |aLevel Von>
2Time/sec2/spa  v2 832/a>2spa  class="comment"> *al.1 2     F 2     0     |   9     7al.2 2162/spa  v2 842/a>2spa  class="comment"> *al.2 2     E al.2 22     |   10    6al.2 2182/spa  v2 852/a>2spa  class="comment"> *   3 al.2 2D al.2 24     |   11 2  5al.2 2202/spa  v2 862/a>2spa  class="comment"> *al.4 al.2 2C al.2 26     |   12.2 24      222/spa  v2 872/a>2spa  class="comment"> *al.5al.2 2 Bal.2 2 8     |   13 al.3 al.2 242/spa  v2 882/a>2spa  class="comment"> *al.6 2     A 2     10    |   14.2 22      262/spa  v2 892/a>2spa  class="comment"> *al.7al.2 2 9       12.2 2|   15al.21 2    282/spa  v2 9	  a>2spa  class="comment"> *al.8al.2 2 8       14.2 2|   16 2  0      302/spa  v2 912/a>2spa  class="comment"> *2/spa  v2 922/a>2spa  class="comment"> */2/spa  v2 932/a>v2 942/a>#define22a href="+code=WDT_STOP" class="sref">WDT_STOP2/a> 0x441v2 952/a>#define22a href="+code=WDT_START" class="sref">WDT_START2/a> 0x443v2 962/a>v2 972/a>2spa  class="comment">/*aDefault timeout2*/2/spa  v2 982/a>#define22a href="+code=WATCHDOG_TIMEOUT" class="sref">WATCHDOG_TIMEOUT2/a> 30             2spa  class="comment">/*a30 seconds +/- 20% */2/spa  v2 992/a>static int22a href="+code=timeout" class="sref">timeout2/a> =22a href="+code=WATCHDOG_TIMEOUT" class="sref">WATCHDOG_TIMEOUT2/a>;  2spa  class="comment">/*ain seconds */2/spa  v21002/a>2a href="+code=module_param" class="sref">module_param2/a>(2a href="+code=timeout" class="sref">timeout2/a>, int, 0);v21012/a>2a href="+code=MODULE_PARM_DESC" class="sref">MODULE_PARM_DESC2/a>(2a href="+code=timeout" class="sref">timeout2/a>,v21022/a>        2spa  class="string">"Watchdog timeout2in seconds. 0<= timeout2<=30, default="2/spa  v21032/a>                2a href="+code=__MODULE_STRING" class="sref">__MODULE_STRING2/a>(2a href="+code=WATCHDOG_TIMEOUT" class="sref">WATCHDOG_TIMEOUT2/a>) 2spa  class="string">"."2/spa  );v21042/a>v21052/a>static 2a href="+code=bool" class="sref">bool2/a> 2a href="+code=nowayout" class="sref">nowayout2/a> =22a href="+code=WATCHDOG_NOWAYOUT" class="sref">WATCHDOG_NOWAYOUT2/a>;v21062/a>2a href="+code=module_param" class="sref">module_param2/a>(2a href="+code=nowayout" class="sref">nowayout2/a>, 2a href="+code=bool" class="sref">bool2/a>, 0);v21072/a>2a href="+code=MODULE_PARM_DESC" class="sref">MODULE_PARM_DESC2/a>(2a href="+code=nowayout" class="sref">nowayout2/a>,v21082/a>                2spa  class="string">"Watchdog cannot be stopped once started (default="2/spa  v21092/a>                                2a href="+code=__MODULE_STRING" class="sref">__MODULE_STRING2/a>(2a href="+code=WATCHDOG_NOWAYOUT" class="sref">WATCHDOG_NOWAYOUT2/a>) 2spa  class="string">")"2/spa  );v21
	  a>v21112/a>v21122/a>2spa  class="comment">/*2/spa  v21132/a>2spa  class="comment"> *      Watchdog Opera >
 s2/spa  v21142/a>2spa  class="comment"> */2/spa  v21152/a>v21162/a>static void22a href="+code=ibwdt_ping" class="sref">ibwdt_ping2/a>(void)v21172/a>{v21182/a>        int22a href="+code=wd_margin" class="sref">wd_margin2/a> =215 - ((2a href="+code=timeout" class="sref">timeout2/a> + 1) / 2);v21192/a>v212	  a>        2a href="+code=spin_lock" class="sref">spin_lock2/a>(&2a href="+code=ibwdt_lock" class="sref">ibwdt_lock2/a>);v21212/a>v21222/a>        2spa  class="comment">/*aWrite aawatchdog ion>
2*/2/spa  v2123  a>        2a href="+code=outb_p" class="sref">outb_p2/a>(2a href="+code=wd_margin" class="sref">wd_margin2/a>, 2a href="+code=WDT_START" class="sref">WDT_START2/a>);v21242/a>v21252/a>        2a href="+code=spin_unlock" class="sref">spin_unlock2/a>(&2a href="+code=ibwdt_lock" class="sref">ibwdt_lock2/a>);v21262/a>}v21272/a>v21282/a>static void22a href="+code=ibwdt_disable" class="sref">ibwdt_disable2/a>(void)v21292/a>{v213	  a>        2a href="+code=spin_lock" class="sref">spin_lock2/a>(&2a href="+code=ibwdt_lock" class="sref">ibwdt_lock2/a>);v21312/a>        2a href="+code=outb_p" class="sref">outb_p2/a>(0, 2a href="+code=WDT_STOP" class="sref">WDT_STOP2/a>);v21322/a>        2a href="+code=spin_unlock" class="sref">spin_unlock2/a>(&2a href="+code=ibwdt_lock" class="sref">ibwdt_lock2/a>);v21332/a>}v21342/a>v21352/a>static int22a href="+code=ibwdt_set_heartbeat" class="sref">ibwdt_set_heartbeat2/a>(int22a href="+code=t" class="sref">t2/a>)v21362/a>{v21372/a>        if (2a href="+code=t" class="sref">t2/a>2< 0 ||22a href="+code=t" class="sref">t2/a> > 30)v21382/a>                return -2a href="+code=EINVAL" class="sref">EINVAL2/a>;v21392/a>v214	  a>        2a href="+code=timeout" class="sref">timeout2/a> =22a href="+code=t" class="sref">t2/a>;v21412/a>        return 0;v21422/a>}v21432/a>v21442/a>2spa  class="comment">/*2/spa  v21452/a>2spa  class="comment"> *      /dev/watchdog handling2/spa  v21462/a>2spa  class="comment"> */2/spa  v21472/a>v21482/a>static 2a href="+code=ssize_t" class="sref">ssize_t2/a> 2a href="+code=ibwdt_write" class="sref">ibwdt_write2/a>(struct22a href="+code=file" class="sref">file2/a> *2a href="+code=file" class="sref">file2/a>, const char 2a href="+code=__user" class="sref">__user2/a> *2a href="+code=buf" class="sref">buf2/a>,v21492/a>                                                2a href="+code=size_t" class="sref">size_t2/a> 2a href="+code=count" class="sref">count2/a>, 2a href="+code=loff_t" class="sref">loff_t2/a> *2a href="+code=ppos" class="sref">ppos2/a>)v21502/a>{v21512/a>        if (2a href="+code=count" class="sref">count2/a>) {v21522/a>                if (!2a href="+code=nowayout" class="sref">nowayout2/a>) {v21532/a>                        2a href="+code=size_t" class="sref">size_t2/a> 2a href="+code=i" class="sref">i2/a>;v21542/a>v21552/a>                        2spa  class="comment">/*aI  case it was set long2ago */2/spa  v21562/a>                        2a href="+code=expect_close" class="sref">expect_close2/a> =20;v21572/a>v21582/a>                        for (2a href="+code=i" class="sref">i2/a> =20; 2a href="+code=i" class="sref">i2/a> !=22a href="+code=count" class="sref">count2/a>; 2a href="+code=i" class="sref">i2/a>++) {v21592/a>                                char 2a href="+code=c" class="sref">c2/a>;v21602/a>                                if (2a href="+code=get_user" class="sref">get_user2/a>(2a href="+code=c" class="sref">c2/a>, 2a href="+code=buf" class="sref">buf2/a> + 2a href="+code=i" class="sref">i2/a>))v21612/a>                                        return -2a href="+code=EFAULT" class="sref">EFAULT2/a>;v21622/a>                                if (2a href="+code=c" class="sref">c2/a> == 2spa  class="string">'V'2/spa  )v21632/a>                                        2a href="+code=expect_close" class="sref">expect_close2/a> =242;v21642/a>                        }v21652/a>                }v21662/a>                2a href="+code=ibwdt_ping" class="sref">ibwdt_ping2/a>();v21672/a>        }v21682/a>        return 2a href="+code=count" class="sref">count2/a>;v21692/a>}v217	  a>v21712/a>static long22a href="+code=ibwdt_ioctl" class="sref">ibwdt_ioctl2/a>(struct22a href="+code=file" class="sref">file2/a> *2a href="+code=file" class="sref">file2/a>, unsigned int22a href="+code=cmd" class="sref">cmd2/a>, unsigned long22a href="+code=arg" class="sref">arg2/a>)v21722/a>{v21732/a>        int22a href="+code=new_margin" class="sref">new_margin2/a>;v21742/a>        void22a href="+code=__user" class="sref">__user2/a> *2a href="+code=argp" class="sref">argp2/a> =2(void22a href="+code=__user" class="sref">__user2/a> *)2a href="+code=arg" class="sref">arg2/a>;v21752/a>        int22a href="+code=__user" class="sref">__user2/a> *2a href="+code=p" class="sref">p2/a> =22a href="+code=argp" class="sref">argp2/a>;v21762/a>v21772/a>        static const struct22a href="+code=watchdog_info" class="sref">watchdog_info2/a> 2a href="+code=ident" class="sref">ident2/a> =2{v21782/a>                .2a href="+code=o  >
 s" class="sref">o  >
 s2/a> =22a href="+code=WDIOF_KEEPALIVEPING" class="sref">WDIOF_KEEPALIVEPING2/a> |22a href="+code=WDIOF_SETTIMEOUT" class="sref">WDIOF_SETTIMEOUT2/a>v21792/a>                                                        |22a href="+code=WDIOF_MAGICCLOSE" class="sref">WDIOF_MAGICCLOSE2/a>,v21802/a>                .2a href="+code=firmware_vers>
 " class="sref">firmware_vers>
 2/a> =21,v21812/a>                .2a href="+code=identity" class="sref">identity2/a> =22spa  class="string">"IB700 WDT"2/spa  ,v21822/a>        };v21832/a>v21842/a>        switch (2a href="+code=cmd" class="sref">cmd2/a>) {v21852/a>        case 2a href="+code=WDIOC_GETSUPPORT" class="sref">WDIOC_GETSUPPORT2/a>:v21862/a>                if (2a href="+code=copy_to_user" class="sref">copy_to_user2/a>(2a href="+code=argp" class="sref">argp2/a>, &2a href="+code=ident" class="sref">ident2/a>, sizeof(2a href="+code=ident" class="sref">ident2/a>)))v21872/a>                        return -2a href="+code=EFAULT" class="sref">EFAULT2/a>;v21882/a>                break;v21892/a>v21902/a>        case 2a href="+code=WDIOC_GETSTATUS" class="sref">WDIOC_GETSTATUS2/a>:v21912/a>        case 2a href="+code=WDIOC_GETBOOTSTATUS" class="sref">WDIOC_GETBOOTSTATUS2/a>:v21922/a>                return 2a href="+code=put_user" class="sref">put_user2/a>(0, 2a href="+code=p" class="sref">p2/a>);v21932/a>v21942/a>        case 2a href="+code=WDIOC_SETOPTIONS" class="sref">WDIOC_SETOPTIONS2/a>:v21952/a>        {v21962/a>                int22a href="+code=o  >
 s" class="sref">o  >
 s2/a>, 2a href="+code=retval" class="sref">retval2/a> =2-2a href="+code=EINVAL" class="sref">EINVAL2/a>;v21972/a>v21982/a>                if (2a href="+code=get_user" class="sref">get_user2/a>(2a href="+code=o  >
 s" class="sref">o  >
 s2/a>, 2a href="+code=p" class="sref">p2/a>))v21992/a>                        return -2a href="+code=EFAULT" class="sref">EFAULT2/a>;v220	  a>v22012/a>                if (2a href="+code=o  >
 s" class="sref">o  >
 s2/a> & 2a href="+code=WDIOS_DISABLECARD" class="sref">WDIOS_DISABLECARD2/a>) {v22022/a>                        2a href="+code=ibwdt_disable" class="sref">ibwdt_disable2/a>();v22032/a>                        2a href="+code=retval" class="sref">retval2/a> =20;v22042/a>                }v22052/a>                if (2a href="+code=o  >
 s" class="sref">o  >
 s2/a> & 2a href="+code=WDIOS_ENABLECARD" class="sref">WDIOS_ENABLECARD2/a>) {v22062/a>                        2a href="+code=ibwdt_ping" class="sref">ibwdt_ping2/a>();v22072/a>                        2a href="+code=retval" class="sref">retval2/a> =20;v22082/a>                }v22092/a>                return 2a href="+code=retval" class="sref">retval2/a>;v22102/a>        }v22112/a>        case 2a href="+code=WDIOC_KEEPALIVE" class="sref">WDIOC_KEEPALIVE2/a>:v22122/a>                2a href="+code=ibwdt_ping" class="sref">ibwdt_ping2/a>();v22132/a>                break;v22142/a>v22152/a>        case 2a href="+code=WDIOC_SETTIMEOUT" class="sref">WDIOC_SETTIMEOUT2/a>:v22162/a>                if (2a href="+code=get_user" class="sref">get_user2/a>(2a href="+code=new_margin" class="sref">new_margin2/a>, 2a href="+code=p" class="sref">p2/a>))v22172/a>                        return -2a href="+code=EFAULT" class="sref">EFAULT2/a>;v22182/a>                if (2a href="+code=ibwdt_set_heartbeat" class="sref">ibwdt_set_heartbeat2/a>(2a href="+code=new_margin" class="sref">new_margin2/a>))v22192/a>                        return -2a href="+code=EINVAL" class="sref">EINVAL2/a>;v22202/a>                2a href="+code=ibwdt_ping" class="sref">ibwdt_ping2/a>();v22212/a>                2spa  class="comment">/*aFall */2/spa  v22222/a>v2223  a>        case 2a href="+code=WDIOC_GETTIMEOUT" class="sref">WDIOC_GETTIMEOUT2/a>:v22242/a>                return 2a href="+code=put_user" class="sref">put_user2/a>(2a href="+code=timeout" class="sref">timeout2/a>, 2a href="+code=p" class="sref">p2/a>);v22252/a>v22262/a>        default:v22272/a>                return -2a href="+code=ENOTTY" class="sref">ENOTTY2/a>;v22282/a>        }v22292/a>        return 0;v223	  a>}v22312/a>v22322/a>static int22a href="+code=ibwdt_open" class="sref">ibwdt_open2/a>(struct22a href="+code=inode" class="sref">inode2/a> *2a href="+code=inode" class="sref">inode2/a>, struct22a href="+code=file" class="sref">file2/a> *2a href="+code=file" class="sref">file2/a>)v22332/a>{v22342/a>        if (2a href="+code=test_and_set_bit" class="sref">test_and_set_bit2/a>(0, &2a href="+code=ibwdt_is_open" class="sref">ibwdt_is_open2/a>))v22352/a>                return -2a href="+code=EBUSY" class="sref">EBUSY2/a>;v22362/a>        if (2a href="+code=nowayout" class="sref">nowayout2/a>)v22372/a>                2a href="+code=__module_get" class="sref">__module_get2/a>(2a href="+code=THIS_MODULE" class="sref">THIS_MODULE2/a>);v22382/a>v22392/a>        2spa  class="comment">/*aActivat
2*/2/spa  v224	  a>        2a href="+code=ibwdt_ping" class="sref">ibwdt_ping2/a>();v22412/a>        return 2a href="+code=nonseekable_open" class="sref">nonseekable_open2/a>(2a href="+code=inode" class="sref">inode2/a>, 2a href="+code=file" class="sref">file2/a>);v22422/a>}v22432/a>v22442/a>static int22a href="+code=ibwdt_close" class="sref">ibwdt_close2/a>(struct22a href="+code=inode" class="sref">inode2/a> *2a href="+code=inode" class="sref">inode2/a>, struct22a href="+code=file" class="sref">file2/a> *2a href="+code=file" class="sref">file2/a>)v22452/a>{v22462/a>        if (2a href="+code=expect_close" class="sref">expect_close2/a> ==242) {v22472/a>                2a href="+code=ibwdt_disable" class="sref">ibwdt_disable2/a>();v22482/a>        } else {v22492/a>                2a href="+code=pr_crit" class="sref">pr_crit2/a>(2spa  class="string">"WDT device closed unexpectedly.  WDT will not stop!\n"2/spa  );v22502/a>                2a href="+code=ibwdt_ping" class="sref">ibwdt_ping2/a>();v22512/a>        }v22522/a>        2a href="+code=clear_bit" class="sref">clear_bit2/a>(0, &2a href="+code=ibwdt_is_open" class="sref">ibwdt_is_open2/a>);v2253  a>        2a href="+code=expect_close" class="sref">expect_close2/a> =20;v22542/a>        return 0;v22552/a>}v22562/a>v22572/a>2spa  class="comment">/*2/spa  v22582/a>2spa  class="comment"> *      Kernel Interfaces2/spa  v22592/a>2spa  class="comment"> */2/spa  v226	  a>v22612/a>static const struct22a href="+code=file_opera >
 s" class="sref">file_opera >
 s2/a> 2a href="+code=ibwdt_fops" class="sref">ibwdt_fops2/a> =2{v22622/a>        .2a href="+code=owner" class="sref">owner2/a>          =22a href="+code=THIS_MODULE" class="sref">THIS_MODULE2/a>,v22632/a>        .2a href="+code=llseek" class="sref">llseek2/a>         =22a href="+code=no_llseek" class="sref">no_llseek2/a>,v22642/a>        .2a href="+code=write" class="sref">write2/a>          =22a href="+code=ibwdt_write" class="sref">ibwdt_write2/a>,v22652/a>        .2a href="+code=unlocked_ioctl" class="sref">unlocked_ioctl2/a> =22a href="+code=ibwdt_ioctl" class="sref">ibwdt_ioctl2/a>,v22662/a>        .2a href="+code=o en" class="sref">open2/a>           =22a href="+code=ibwdt_open" class="sref">ibwdt_open2/a>,v22672/a>        .2a href="+code=release" class="sref">release2/a>        =22a href="+code=ibwdt_close" class="sref">ibwdt_close2/a>,v22682/a>};v22692/a>v227	  a>static struct22a href="+code=miscdevice" class="sref">miscdevice2/a> 2a href="+code=ibwdt_miscdev" class="sref">ibwdt_miscdev2/a> =2{v22712/a>        .2a href="+code=minor" class="sref">minor2/a> =22a href="+code=WATCHDOG_MINOR" class="sref">WATCHDOG_MINOR2/a>,v22722/a>        .2a href="+code=nam
" class="sref">nam
2/a> =22spa  class="string">"watchdog"2/spa  ,v22732/a>        .2a href="+code=fops" class="sref">fops2/a> =2&2a href="+code=ibwdt_fops" class="sref">ibwdt_fops2/a>,v22742/a>};v22752/a>v22762/a>2spa  class="comment">/*2/spa  v22772/a>2spa  class="comment"> *aaaaaaInit & exit routines2/spa  v22782/a>2spa  class="comment"> */2/spa  v22792/a>v228	  a>static int22a href="+code=__devinit" class="sref">__devinit2/a> 2a href="+code=ibwdt_probe" class="sref">ibwdt_probe2/a>(struct22a href="+code=platform_device" class="sref">platform_device2/a> *2a href="+code=dev" class="sref">dev2/a>)v22812/a>{v22822/a>        int22a href="+code=res" class="sref">res2/a>;v22832/a>v22842/a>#if22a href="+code=WDT_START" class="sref">WDT_START2/a> !=22a href="+code=WDT_STOP" class="sref">WDT_STOP2/a>v22852/a>        if (!2a href="+code=request_reg>
 " class="sref">request_reg>
 2/a>(2a href="+code=WDT_STOP" class="sref">WDT_STOP2/a>, 1,22spa  class="string">"IB700 WDT"2/spa  )) {v22862/a>                2a href="+code=pr_err" class="sref">pr_err2/a>(2spa  class="string">"STOP method I/O %X is not available\n"2/spa  , 2a href="+code=WDT_STOP" class="sref">WDT_STOP2/a>);v22872/a>                2a href="+code=res" class="sref">res2/a> =2-2a href="+code=EIO" class="sref">EIO2/a>;v22882/a>                goto 2a href="+code=out_nostopreg" class="sref">out_nostopreg2/a>;v22892/a>        }v22902/a>#endifv22912/a>v22922/a>        if (!2a href="+code=request_reg>
 " class="sref">request_reg>
 2/a>(2a href="+code=WDT_START" class="sref">WDT_START2/a>, 1,22spa  class="string">"IB700 WDT"2/spa  )) {v22932/a>                2a href="+code=pr_err" class="sref">pr_err2/a>(2spa  class="string">"START method I/O %X is not available\n"2/spa  , 2a href="+code=WDT_START" class="sref">WDT_START2/a>);v22942/a>                2a href="+code=res" class="sref">res2/a> =2-2a href="+code=EIO" class="sref">EIO2/a>;v22952/a>                goto 2a href="+code=out_nostartreg" class="sref">out_nostartreg2/a>;v22962/a>        }v22972/a>v22982/a>        2spa  class="comment">/*aCheck that the heartbeat ion>
2is within it's range ;2/spa  v22992/a>2spa  class="comment">         * if not reset to the default */2/spa  v23002/a>        if (2a href="+code=ibwdt_set_heartbeat" class="sref">ibwdt_set_heartbeat2/a>(2a href="+code=timeout" class="sref">timeout2/a>)) {v23012/a>                2a href="+code=ibwdt_set_heartbeat" class="sref">ibwdt_set_heartbeat2/a>(2a href="+code=WATCHDOG_TIMEOUT" class="sref">WATCHDOG_TIMEOUT2/a>);v23022/a>                2a href="+code=pr_info" class="sref">pr_info2/a>(2spa  class="string">"timeout2ion>
2must be 0<=x<=30, using %d\n"2/spa  , 2a href="+code=timeout" class="sref">timeout2/a>);v23032/a>        }v23042/a>v23052/a>        2a href="+code=res" class="sref">res2/a> =22a href="+code=misc_reg>ster" class="sref">misc_reg>ster2/a>(&2a href="+code=ibwdt_miscdev" class="sref">ibwdt_miscdev2/a>);v23062/a>        if (2a href="+code=res" class="sref">res2/a>) {v23072/a>                2a href="+code=pr_err" class="sref">pr_err2/a>(2spa  class="string">"failed to reg>ster misc device\n"2/spa  );v23082/a>                goto 2a href="+code=out_nomisc" class="sref">out_nomisc2/a>;v23092/a>        }v23102/a>        return 0;v23112/a>v23122/a>2a href="+code=out_nomisc" class="sref">out_nomisc2/a>:v2313  a>        2a href="+code=release_reg>
 " class="sref">release_reg>
 2/a>(2a href="+code=WDT_START" class="sref">WDT_START2/a>, 1);v23142/a>2a href="+code=out_nostartreg" class="sref">out_nostartreg2/a>:v23152/a>#if22a href="+code=WDT_START" class="sref">WDT_START2/a> !=22a href="+code=WDT_STOP" class="sref">WDT_STOP2/a>v23162/a>        2a href="+code=release_reg>
 " class="sref">release_reg>
 2/a>(2a href="+code=WDT_STOP" class="sref">WDT_STOP2/a>, 1);v23172/a>#endifv23182/a>2a href="+code=out_nostopreg" class="sref">out_nostopreg2/a>:v23192/a>        return 2a href="+code=res" class="sref">res2/a>;v232	  a>}v23212/a>v23222/a>static int22a href="+code=__devexit" class="sref">__devexit2/a> 2a href="+code=ibwdt_remove" class="sref">ibwdt_remove2/a>(struct22a href="+code=platform_device" class="sref">platform_device2/a> *2a href="+code=dev" class="sref">dev2/a>)v23232/a>{v23242/a>        2a href="+code=misc_dereg>ster" class="sref">misc_dereg>ster2/a>(&2a href="+code=ibwdt_miscdev" class="sref">ibwdt_miscdev2/a>);v23252/a>        2a href="+code=release_reg>
 " class="sref">release_reg>
 2/a>(2a href="+code=WDT_START" class="sref">WDT_START2/a>, 1);v23262/a>#if22a href="+code=WDT_START" class="sref">WDT_START2/a> !=22a href="+code=WDT_STOP" class="sref">WDT_STOP2/a>v23272/a>        2a href="+code=release_reg>
 " class="sref">release_reg>
 2/a>(2a href="+code=WDT_STOP" class="sref">WDT_STOP2/a>, 1);v23282/a>#endifv23292/a>        return 0;v233	  a>}v23312/a>v23322/a>static void22a href="+code=ibwdt_shutdown" class="sref">ibwdt_shutdown2/a>(struct22a href="+code=platform_device" class="sref">platform_device2/a> *2a href="+code=dev" class="sref">dev2/a>)v23332/a>{v23342/a>        2spa  class="comment">/*aTurn the WDT off if we have a soft shutdown */2/spa  v23352/a>        2a href="+code=ibwdt_disable" class="sref">ibwdt_disable2/a>();v23362/a>}v23372/a>v23382/a>static struct22a href="+code=platform_driver" class="sref">platform_driver2/a> 2a href="+code=ibwdt_driver" class="sref">ibwdt_driver2/a> =2{v23392/a>        .2a href="+code=probe" class="sref">probe2/a>          =22a href="+code=ibwdt_probe" class="sref">ibwdt_probe2/a>,v234	  a>        .2a href="+code=remove" class="sref">remove2/a>         =22a href="+code=__devexit_p" class="sref">__devexit_p2/a>(2a href="+code=ibwdt_remove" class="sref">ibwdt_remove2/a>),v23412/a>        .2a href="+code=shutdown" class="sref">shutdown2/a>       =22a href="+code=ibwdt_shutdown" class="sref">ibwdt_shutdown2/a>,v23422/a>        .2a href="+code=driver" class="sref">driver2/a>         =2{v23432/a>                .2a href="+code=owner" class="sref">owner2/a>  =22a href="+code=THIS_MODULE" class="sref">THIS_MODULE2/a>,v23442/a>                .2a href="+code=nam
" class="sref">nam
2/a>   =22a href="+code=DRV_NAME" class="sref">DRV_NAME2/a>,v23452/a>        },v23462/a>};v23472/a>v23482/a>static int22a href="+code=__init" class="sref">__init2/a> 2a href="+code=ibwdt_init" class="sref">ibwdt_init2/a>(void)v23492/a>{v23502/a>        int22a href="+code=err" class="sref">err2/a>;v23512/a>v23522/a>        2a href="+code=pr_info" class="sref">pr_info2/a>(2spa  class="string">"WDT driver for IB700 single board computer initialising\n"2/spa  );v23532/a>v23542/a>        2a href="+code=err" class="sref">err2/a> =22a href="+code=platform_driver_reg>ster" class="sref">platform_driver_reg>ster2/a>(&2a href="+code=ibwdt_driver" class="sref">ibwdt_driver2/a>);v23552/a>        if (2a href="+code=err" class="sref">err2/a>)v23562/a>                return 2a href="+code=err" class="sref">err2/a>;v23572/a>v23582/a>        2a href="+code=ibwdt_platform_device" class="sref">ibwdt_platform_device2/a> =22a href="+code=platform_device_reg>ster_simple" class="sref">platform_device_reg>ster_simple2/a>(2a href="+code=DRV_NAME" class="sref">DRV_NAME2/a>,v23592/a>                                                                -1, 2a href="+code=NULL" class="sref">NULL2/a>, 0);v23602/a>        if (2a href="+code=IS_ERR" class="sref">IS_ERR2/a>(2a href="+code=ibwdt_platform_device" class="sref">ibwdt_platform_device2/a>)) {v23612/a>                2a href="+code=err" class="sref">err2/a> =22a href="+code=PTR_ERR" class="sref">PTR_ERR2/a>(2a href="+code=ibwdt_platform_device" class="sref">ibwdt_platform_device2/a>);v23622/a>                goto 2a href="+code=unreg_platform_driver" class="sref">unreg_platform_driver2/a>;v23632/a>        }v23642/a>v23652/a>        return 0;v23662/a>v23672/a>2a href="+code=unreg_platform_driver" class="sref">unreg_platform_driver2/a>:v23682/a>        2a href="+code=platform_driver_unreg>ster" class="sref">platform_driver_unreg>ster2/a>(&2a href="+code=ibwdt_driver" class="sref">ibwdt_driver2/a>);v23692/a>        return 2a href="+code=err" class="sref">err2/a>;v237	  a>}v23712/a>v23722/a>static void22a href="+code=__exit" class="sref">__exit2/a> 2a href="+code=ibwdt_exit" class="sref">ibwdt_exit2/a>(void)v23732/a>{v23742/a>        2a href="+code=platform_device_unreg>ster" class="sref">platform_device_unreg>ster2/a>(2a href="+code=ibwdt_platform_device" class="sref">ibwdt_platform_device2/a>);v23752/a>        2a href="+code=platform_driver_unreg>ster" class="sref">platform_driver_unreg>ster2/a>(&2a href="+code=ibwdt_driver" class="sref">ibwdt_driver2/a>);v23762/a>        2a href="+code=pr_info" class="sref">pr_info2/a>(2spa  class="string">"Watchdog Module Unloaded\n"2/spa  );v23772/a>}v23782/a>v23792/a>2a href="+code=module_init" class="sref">module_init2/a>(2a href="+code=ibwdt_init" class="sref">ibwdt_init2/a>);v238	  a>2a href="+code=module_exit" class="sref">module_exit2/a>(2a href="+code=ibwdt_exit" class="sref">ibwdt_exit2/a>);v23812/a>v23822/a>2a href="+code=MODULE_AUTHOR" class="sref">MODULE_AUTHOR2/a>(2spa  class="string">"Charles Howes <chowes@vsol.net>"2/spa  );v23832/a>2a href="+code=MODULE_DESCRIPTION" class="sref">MODULE_DESCRIPTION2/a>(2spa  class="string">"IB700 SBC watchdog driver"2/spa  );v23842/a>2a href="+code=MODULE_LICENSE" class="sref">MODULE_LICENSE2/a>(2spa  class="string">"GPL"2/spa  );v23852/a>2a href="+code=MODULE_ALIAS_MISCDEV" class="sref">MODULE_ALIAS_MISCDEV2/a>(2a href="+code=WATCHDOG_MINOR" class="sref">WATCHDOG_MINOR2/a>);v23862/a>v23872/a>2spa  class="comment">/* end of ib700wdt.c */2/spa  v23882/a>
lxr.linux.no kindly hosted by Redpill Linpro AS2/a>, provider of Linux consulting and opera > s services since21995.