linux/drivers/watchdog/sbc7240_wdt.c
<<
> < href="../linux+v3.7.4/drivers/watchdog/sbc7240_wdt.c"> > o/spa> ospa> class="lxr_search"> >="+search" method="post" onsubmit="return do_search(this);"> > > > Search ospa> class="lxr_prefs" < onclick="return ajax_prefs();"> > o/spa> > < < ="ajax+*" method="post" onsubmit="return false;"> oinput typ="vhidden" nam="vajax_lookup" id"vajax_lookup" alue="v"> > < <
<
< < < odiv id"vfile_contents"
< <1o/a>ospa> class="comment">/*o/spa>
 < <2o/a>ospa> class="comment"> * > < 
 < <3o/a>ospa> class="comment"> *o/spa>
 < <4o/a>ospa> class="comment"> * > < 
 < <5o/a>ospa> class="comment"> *o/spa>
 < <6o/a>ospa> class="comment"> * > <  redistribute it and/or modifyo/spa>
 < <7o/a>ospa> class="comment"> * > < 
 < <8o/a>ospa> class="comment"> * > < ;o/spa>
 < <9o/a>ospa> class="comment"> *o/spa>
 < 0ospa> class="comment"> * > <  "AS IS"o/spa>
 < 11o/a>ospa> class="comment"> * > < 
 < 12o/a>ospa> class="comment"> * > < 
 < 13o/a>ospa> class="comment"> * > < s under the License.o/spa>
 < 14o/a>ospa> class="comment"> *o/spa>
 < 15o/a>ospa> class="comment"> * > < <(c) Copyright 2007  Gilles GIGAN <gilles.gigan@jcu.edu.au>o/spa>
 < 16o/a>ospa> class="comment"> *o/spa>
 < 17o/a>ospa> class="comment"> */o/spa>
 < 18o/a> < 19o/a>#definepr_fmto/a>(oa href="+code=fmt" class="sref">fmto/a>)KBUILD_MODNAMEo/a> ospa> class="string">": "o/spa>
fmto/a> < 20o/a> < 21o/a>#include <linux/fs.ho/a>> < 22o/a>#include <linux/init.ho/a>> < 23o/a>#include <linux/ioport.ho/a>> < 24o/a>#include <linux/jiffies.ho/a>> < 25o/a>#include <linux/module.ho/a>> < 26o/a>#include <linux/moduleparam.ho/a>> < 27o/a>#include <linux/miscdevice.ho/a>> < 28o/a>#include <linux/notifier.ho/a>> < 29o/a>#include <linux/reboot.ho/a>> < 30o/a>#include <linux/typ=s.ho/a>> < 31o/a>#include <linux/watchdog.ho/a>> < 32o/a>#include <linux/io.ho/a>> < 33o/a>#include <linux/uaccess.ho/a>> < 34o/a>#include <linux/atomic.ho/a>> < 35o/a> < 36o/a>#defineSBC7240_ENABLE_PORTo/a>             0x443 < 37o/a>#defineSBC7240_DISABLE_PORTo/a>            0x043 < 38o/a>#defineSBC7240_SET_TIMEOUT_PORTo/a>        oa href="+code=SBC7240_ENABLE_PORT" class="sref">SBC7240_ENABLE_PORTo/a> < 39o/a>#defineSBC7240_MAGIC_CHARo/a>              ospa> class="string">'V'o/spa>
 < 40o/a> < 41o/a>#defineSBC7240_TIMEOUTo/a>         30 < 42o/a>#defineSBC7240_MAX_TIMEOUTo/a>             255 < 43o/a>static inttimeouto/a> =SBC7240_TIMEOUTo/a>;   ospa> class="comment">/* in seconds */o/spa>
 < 44o/a>oa href="+code=module_param" class="sref">module_paramo/a>(oa href="+code=timeout" class="sref">timeouto/a>, int, 0); < 45o/a>oa href="+code=MODULE_PARM_DESC" class="sref">MODULE_PARM_DESCo/a>(oa href="+code=timeout" class="sref">timeouto/a>, ospa> class="string">"Watchdog timeout in seconds. (1<=timeout<="o/spa>
 < 46o/a>                 oa href="+code=__MODULE_STRING" class="sref">__MODULE_STRINGo/a>(oa href="+code=SBC7240_MAX_TIMEOUT" class="sref">SBC7240_MAX_TIMEOUTo/a>) ospa> class="string">", default="o/spa>
 < 47o/a>                 oa href="+code=__MODULE_STRING" class="sref">__MODULE_STRINGo/a>(oa href="+code=SBC7240_TIMEOUT" class="sref">SBC7240_TIMEOUTo/a>) ospa> class="string">")"o/spa>
); < 48o/a> < 49o/a>static oa href="+code=bool" class="sref">boolo/a> oa href="+code=nowayout" class="sref">nowayouto/a> =WATCHDOG_NOWAYOUTo/a>; < 50o/a>oa href="+code=module_param" class="sref">module_paramo/a>(oa href="+code=nowayout" class="sref">nowayouto/a>, oa href="+code=bool" class="sref">boolo/a>, 0); < 51o/a>oa href="+code=MODULE_PARM_DESC" class="sref">MODULE_PARM_DESCo/a>(oa href="+code=nowayout" class="sref">nowayouto/a>, ospa> class="string">"Disable watchdog whe> closing device file"o/spa>
); < 52o/a> < 53o/a>#defineSBC7240_OPEN_STATUS_BITo/a>         0 < 54o/a>#defineSBC7240_ENABLED_STATUS_BITo/a>      1 < 55o/a>#defineSBC7240_EXPECT_CLOSE_STATUS_BITo/a> 2 < 56o/a>static unsigned long oa href="+code=wdt_status" class="sref">wdt_statuso/a>; < 57o/a> < 58o/a>ospa> class="comment">/*o/spa>
 < 59o/a>ospa> class="comment"> * Utility routineso/spa>
 < 6ospa> class="comment"> */o/spa>
 < 61o/a> < 62o/a>static void oa href="+code=wdt_disable" class="sref">wdt_disableo/a>(void) < 63o/a>{ < 64o/a>        ospa> class="comment">/* disable the watchdog */o/spa>
 < 65o/a>        if (oa href="+code=test_and_clear_bit" class="sref">test_and_clear_bito/a>(oa href="+code=SBC7240_ENABLED_STATUS_BIT" class="sref">SBC7240_ENABLED_STATUS_BITo/a>, &oa href="+code=wdt_status" class="sref">wdt_statuso/a>)) { < 66o/a>                oa href="+code=inb_p" class="sref">inb_po/a>(oa href="+code=SBC7240_DISABLE_PORT" class="sref">SBC7240_DISABLE_PORTo/a>); < 67o/a>                oa href="+code=pr_info" class="sref">pr_infoo/a>(ospa> class="string">"Watchdog timer is now disabled\n"o/spa>
); < 68o/a>        } < 69o/a>} < 70o/a> < 71o/a>static void oa href="+code=wdt_enable" class="sref">wdt_enableo/a>(void) < 72o/a>{ < 73o/a>        ospa> class="comment">/* enable the watchdog */o/spa>
 < 74o/a>        if (!oa href="+code=test_and_set_bit" class="sref">test_and_set_bito/a>(oa href="+code=SBC7240_ENABLED_STATUS_BIT" class="sref">SBC7240_ENABLED_STATUS_BITo/a>, &oa href="+code=wdt_status" class="sref">wdt_statuso/a>)) { < 75o/a>                oa href="+code=inb_p" class="sref">inb_po/a>(oa href="+code=SBC7240_ENABLE_PORT" class="sref">SBC7240_ENABLE_PORTo/a>); < 76o/a>                oa href="+code=pr_info" class="sref">pr_infoo/a>(ospa> class="string">"Watchdog timer is now enabled\n"o/spa>
); < 77o/a>        } < 78o/a>} < 79o/a> < 80o/a>static intwdt_set_timeouto/a>(intto/a>) < 81o/a>{ < 82o/a>        if (oa href="+code=t" class="sref">to/a> < 1 ||to/a> >SBC7240_MAX_TIMEOUTo/a>) { < 83o/a>                oa href="+code=pr_err" class="sref">pr_erro/a>(ospa> class="string">"timeout alue= must be 1<=x<=%d\n"o/spa>
, oa href="+code=SBC7240_MAX_TIMEOUT" class="sref">SBC7240_MAX_TIMEOUTo/a>); < 84o/a>                return -1; < 85o/a>        } < 86o/a>        ospa> class="comment">/* set the timeout */o/spa>
 < 87o/a>        oa href="+code=outb_p" class="sref">outb_po/a>((unsigned)oa href="+code=t" class="sref">to/a>, oa href="+code=SBC7240_SET_TIMEOUT_PORT" class="sref">SBC7240_SET_TIMEOUT_PORTo/a>); < 88o/a>        oa href="+code=timeout" class="sref">timeouto/a> =to/a>; < 89o/a>        oa href="+code=pr_info" class="sref">pr_infoo/a>(ospa> class="string">"timeout set to %d seconds\n"o/spa>
, oa href="+code=t" class="sref">to/a>); < 90o/a>        return 0; < 91o/a>} < 92o/a> < 93o/a>ospa> class="comment">/* Whack the dog */o/spa>
 < 94o/a>static oa href="+code=inline" class="sref">inlineo/a> void oa href="+code=wdt_keepalive" class="sref">wdt_keepaliveo/a>(void) < 95o/a>{ < 96o/a>        if (oa href="+code=test_bit" class="sref">test_bito/a>(oa href="+code=SBC7240_ENABLED_STATUS_BIT" class="sref">SBC7240_ENABLED_STATUS_BITo/a>, &oa href="+code=wdt_status" class="sref">wdt_statuso/a>)) < 97o/a>                oa href="+code=inb_p" class="sref">inb_po/a>(oa href="+code=SBC7240_ENABLE_PORT" class="sref">SBC7240_ENABLE_PORTo/a>); < 98o/a>} < 99o/a> <100o/a>ospa> class="comment">/*o/spa>
 <101o/a>ospa> class="comment"> * /dev/watchdog handlingo/spa>
 <102o/a>ospa> class="comment"> */o/spa>
 <103o/a>static oa href="+code=ssize_t" class="sref">ssize_to/a> oa href="+code=fop_write" class="sref">fop_writeo/a>(structfileo/a> *oa href="+code=file" class="sref">fileo/a>, const char oa href="+code=__user" class="sref">__usero/a> *oa href="+code=buf" class="sref">bufo/a>, <104o/a>                         oa href="+code=size_t" class="sref">size_to/a> oa href="+code=count" class="sref">counto/a>, oa href="+code=loff_t" class="sref">loff_to/a> *oa href="+code=ppos" class="sref">pposo/a>) <105o/a>{ <106o/a>        oa href="+code=size_t" class="sref">size_to/a> oa href="+code=i" class="sref">io/a>; <107o/a>        char oa href="+code=c" class="sref">co/a>; <108o/a> <109o/a>        if (oa href="+code=count" class="sref">counto/a>) { <110o/a>                if (!oa href="+code=nowayout" class="sref">nowayouto/a>) { <111o/a>                        oa href="+code=clear_bit" class="sref">clear_bito/a>(oa href="+code=SBC7240_EXPECT_CLOSE_STATUS_BIT" class="sref">SBC7240_EXPECT_CLOSE_STATUS_BITo/a>, <112o/a>                                &oa href="+code=wdt_status" class="sref">wdt_statuso/a>); <113o/a> <114o/a>                        ospa> class="comment">/* is there a magic char ? */o/spa>
 <115o/a>                        for (oa href="+code=i" class="sref">io/a> = 0; oa href="+code=i" class="sref">io/a> !=counto/a>; oa href="+code=i" class="sref">io/a>++) { <116o/a>                                if (oa href="+code=get_user" class="sref">get_usero/a>(oa href="+code=c" class="sref">co/a>, oa href="+code=buf" class="sref">bufo/a> + oa href="+code=i" class="sref">io/a>)) <117o/a>                                        return -oa href="+code=EFAULT" class="sref">EFAULTo/a>; <118o/a>                                if (oa href="+code=c" class="sref">co/a> ==SBC7240_MAGIC_CHARo/a>) { <119o/a>                                        oa href="+code=set_bit" class="sref">set_bito/a>(oa href="+code=SBC7240_EXPECT_CLOSE_STATUS_BIT" class="sref">SBC7240_EXPECT_CLOSE_STATUS_BITo/a>, <120o/a>                                                &oa href="+code=wdt_status" class="sref">wdt_statuso/a>); <121o/a>                                        break; <122o/a>                                } <123o/a>                        } <124o/a>                } <125o/a> <126o/a>                oa href="+code=wdt_keepalive" class="sref">wdt_keepaliveo/a>(); <127o/a>        } <128o/a> <129o/a>        return oa href="+code=count" class="sref">counto/a>; <130o/a>} <131o/a> <132o/a>static intfop_openo/a>(structinodeo/a> *oa href="+code=inode" class="sref">inodeo/a>, structfileo/a> *oa href="+code=file" class="sref">fileo/a>) <133o/a>{ <134o/a>        if (oa href="+code=test_and_set_bit" class="sref">test_and_set_bito/a>(oa href="+code=SBC7240_OPEN_STATUS_BIT" class="sref">SBC7240_OPEN_STATUS_BITo/a>, &oa href="+code=wdt_status" class="sref">wdt_statuso/a>)) <135o/a>                return -oa href="+code=EBUSY" class="sref">EBUSYo/a>; <136o/a> <137o/a>        oa href="+code=wdt_enable" class="sref">wdt_enableo/a>(); <138o/a> <139o/a>        return oa href="+code=nonseekable_open" class="sref">nonseekable_openo/a>(oa href="+code=inode" class="sref">inodeo/a>, oa href="+code=file" class="sref">fileo/a>); <140o/a>} <141o/a> <142o/a>static intfop_closeo/a>(structinodeo/a> *oa href="+code=inode" class="sref">inodeo/a>, structfileo/a> *oa href="+code=file" class="sref">fileo/a>) <143o/a>{ <144o/a>        if (oa href="+code=test_and_clear_bit" class="sref">test_and_clear_bito/a>(oa href="+code=SBC7240_EXPECT_CLOSE_STATUS_BIT" class="sref">SBC7240_EXPECT_CLOSE_STATUS_BITo/a>, &oa href="+code=wdt_status" class="sref">wdt_statuso/a>) <145o/a>            || !oa href="+code=nowayout" class="sref">nowayouto/a>) { <146o/a>                oa href="+code=wdt_disable" class="sref">wdt_disableo/a>(); <147o/a>        } else { <148o/a>                oa href="+code=pr_crit" class="sref">pr_crito/a>(ospa> class="string">"Unexpected close, not stopping watchdog!\n"o/spa>
); <149o/a>                oa href="+code=wdt_keepalive" class="sref">wdt_keepaliveo/a>(); <150o/a>        } <151o/a> <152o/a>        oa href="+code=clear_bit" class="sref">clear_bito/a>(oa href="+code=SBC7240_OPEN_STATUS_BIT" class="sref">SBC7240_OPEN_STATUS_BITo/a>, &oa href="+code=wdt_status" class="sref">wdt_statuso/a>); <153o/a>        return 0; <154o/a>} <155o/a> <156o/a>static const structwatchdog_infoo/a> oa href="+code=ident" class="sref">idento/a> = { <157o/a>        .oa href="+code=ption>s" class="sref">ption>so/a> = oa href="+code=WDIOF_KEEPALIVEPING" class="sref">WDIOF_KEEPALIVEPINGo/a>| <158o/a>                   oa href="+code=WDIOF_SETTIMEOUT" class="sref">WDIOF_SETTIMEOUTo/a>| <159o/a>                   oa href="+code=WDIOF_MAGICCLOSE" class="sref">WDIOF_MAGICCLOSEo/a>, <160o/a>        .oa href="+code=firmware_verson>" class="sref">firmware_verson>o/a> = 1, <161o/a>        .oa href="+code=identity" class="sref">identityo/a> = ospa> class="string">"SBC7240"o/spa>
, <162o/a>}; <163o/a> <164o/a> <165o/a>static long oa href="+code=fop_ioctl" class="sref">fop_ioctlo/a>(structfileo/a> *oa href="+code=file" class="sref">fileo/a>, unsigned intcmdo/a>, unsigned long oa href="+code=arg" class="sref">argo/a>) <166o/a>{ <167o/a>        switch (oa href="+code=cmd" class="sref">cmdo/a>) { <168o/a>        caseWDIOC_GETSUPPORTo/a>: <169o/a>                return oa href="+code=copy_to_user" class="sref">copy_to_usero/a>((void oa href="+code=__user" class="sref">__usero/a> *)oa href="+code=arg" class="sref">argo/a>, &oa href="+code=ident" class="sref">idento/a>, sizeof(oa href="+code=ident" class="sref">idento/a>)) <170o/a>                                                 ? -oa href="+code=EFAULT" class="sref">EFAULTo/a> : 0; <171o/a>        caseWDIOC_GETSTATUSo/a>: <172o/a>        caseWDIOC_GETBOOTSTATUSo/a>: <173o/a>                return oa href="+code=put_user" class="sref">put_usero/a>(0, (int__usero/a> *)oa href="+code=arg" class="sref">argo/a>); <174o/a>        caseWDIOC_SETOPTIONSo/a>: <175o/a>        { <176o/a>                intption>so/a>; <177o/a>                intretvalo/a> = -oa href="+code=EINVAL" class="sref">EINVALo/a>; <178o/a> <179o/a>                if (oa href="+code=get_user" class="sref">get_usero/a>(oa href="+code=ption>s" class="sref">ption>so/a>, (int__usero/a> *)oa href="+code=arg" class="sref">argo/a>)) <180o/a>                        return -oa href="+code=EFAULT" class="sref">EFAULTo/a>; <181o/a> <182o/a>                if (oa href="+code=ption>s" class="sref">ption>so/a> &WDIOS_DISABLECARDo/a>) { <183o/a>                        oa href="+code=wdt_disable" class="sref">wdt_disableo/a>(); <184o/a>                        oa href="+code=retval" class="sref">retvalo/a> = 0; <185o/a>                } <186o/a> <187o/a>                if (oa href="+code=ption>s" class="sref">ption>so/a> &WDIOS_ENABLECARDo/a>) { <188o/a>                        oa href="+code=wdt_enable" class="sref">wdt_enableo/a>(); <189o/a>                        oa href="+code=retval" class="sref">retvalo/a> = 0; <190o/a>                } <191o/a> <192o/a>                return oa href="+code=retval" class="sref">retvalo/a>; <193o/a>        } <194o/a>        caseWDIOC_KEEPALIVEo/a>: <195o/a>                oa href="+code=wdt_keepalive" class="sref">wdt_keepaliveo/a>(); <196o/a>                return 0; <197o/a>        caseWDIOC_SETTIMEOUTo/a>: <198o/a>        { <199o/a>                intnew_timeouto/a>; <200o/a> <201o/a>                if (oa href="+code=get_user" class="sref">get_usero/a>(oa href="+code=new_timeout" class="sref">new_timeouto/a>, (int__usero/a> *)oa href="+code=arg" class="sref">argo/a>)) <202o/a>                        return -oa href="+code=EFAULT" class="sref">EFAULTo/a>; <203o/a> <204o/a>                if (oa href="+code=wdt_set_timeout" class="sref">wdt_set_timeouto/a>(oa href="+code=new_timeout" class="sref">new_timeouto/a>)) <205o/a>                        return -oa href="+code=EINVAL" class="sref">EINVALo/a>; <206o/a> <207o/a>                ospa> class="comment">/* Fall through */o/spa>
 <208o/a>        } <209o/a>        caseWDIOC_GETTIMEOUTo/a>: <210o/a>                return oa href="+code=put_user" class="sref">put_usero/a>(oa href="+code=timeout" class="sref">timeouto/a>, (int__usero/a> *)oa href="+code=arg" class="sref">argo/a>); <211o/a>        default: <212o/a>                return -oa href="+code=ENOTTY" class="sref">ENOTTYo/a>; <213o/a>        } <214o/a>} <215o/a> <216o/a>static const structfile_operaion>so/a> oa href="+code=wdt_fops" class="sref">wdt_fopso/a> = { <217o/a>        .oa href="+code=pwner" class="sref">pwnero/a> = oa href="+code=THIS_MODULE" class="sref">THIS_MODULEo/a>, <218o/a>        .oa href="+code=llseek" class="sref">llseeko/a> = oa href="+code=no_llseek" class="sref">no_llseeko/a>, <219o/a>        .oa href="+code=write" class="sref">writeo/a> = oa href="+code=fop_write" class="sref">fop_writeo/a>, <220o/a>        .oa href="+code=open" class="sref">openo/a> = oa href="+code=fop_open" class="sref">fop_openo/a>, <221o/a>        .oa href="+code=release" class="sref">releaseo/a> = oa href="+code=fop_close" class="sref">fop_closeo/a>, <222o/a>        .oa href="+code=unlocked_ioctl" class="sref">unlocked_ioctlo/a> = oa href="+code=fop_ioctl" class="sref">fop_ioctlo/a>, <223o/a>}; <224o/a> <225o/a>static structmiscdeviceo/a> oa href="+code=wdt_miscdev" class="sref">wdt_miscdevo/a> = { <226o/a>        .oa href="+code=minor" class="sref">minoro/a> = oa href="+code=WATCHDOG_MINOR" class="sref">WATCHDOG_MINORo/a>, <227o/a>        .oa href="+code=nam=" class="sref">nam=o/a> = ospa> class="string">"watchdog"o/spa>
, <228o/a>        .oa href="+code=fops" class="sref">fopso/a> = &oa href="+code=wdt_fops" class="sref">wdt_fopso/a>, <229o/a>}; <230o/a> <231o/a>ospa> class="comment">/*o/spa>
 <232o/a>ospa> class="comment"> *      Notifier for system dpwno/spa>
 <233o/a>ospa> class="comment"> */o/spa>
 <234o/a> <235o/a>static intwdt_notify_syso/a>(structnotifier_blocko/a> *oa href="+code=this" class="sref">thiso/a>, unsigned long oa href="+code=code" class="sref">codeo/a>, <236o/a>                          void *oa href="+code=unused" class="sref">unusedo/a>) <237o/a>{ <238o/a>        if (oa href="+code=code" class="sref">codeo/a> ==SYS_DOWNo/a> ||codeo/a> ==SYS_HALTo/a>) <239o/a>                oa href="+code=wdt_disable" class="sref">wdt_disableo/a>(); <240o/a>        return oa href="+code=NOTIFY_DONE" class="sref">NOTIFY_DONEo/a>; <241o/a>} <242o/a> <243o/a>static structnotifier_blocko/a> oa href="+code=wdt_notifier" class="sref">wdt_notifiero/a> = { <244o/a>        .oa href="+code=notifier_call" class="sref">notifier_callo/a> = oa href="+code=wdt_notify_sys" class="sref">wdt_notify_syso/a>, <245o/a>}; <246o/a> <247o/a>static void oa href="+code=__exit" class="sref">__exito/a> oa href="+code=sbc7240_wdt_unload" class="sref">sbc7240_wdt_unloado/a>(void) <248o/a>{ <249o/a>        oa href="+code=pr_info" class="sref">pr_infoo/a>(ospa> class="string">"Removing watchdog\n"o/spa>
); <250o/a>        oa href="+code=misc_deregister" class="sref">misc_deregistero/a>(&oa href="+code=wdt_miscdev" class="sref">wdt_miscdevo/a>); <251o/a> <252o/a>        oa href="+code=unregister_reboot_notifier" class="sref">unregister_reboot_notifiero/a>(&oa href="+code=wdt_notifier" class="sref">wdt_notifiero/a>); <253o/a>        oa href="+code=release_regin>" class="sref">release_regin>o/a>(oa href="+code=SBC7240_ENABLE_PORT" class="sref">SBC7240_ENABLE_PORTo/a>, 1); <254o/a>} <255o/a> <256o/a>static int__inito/a> oa href="+code=sbc7240_wdt_init" class="sref">sbc7240_wdt_inito/a>(void) <257o/a>{ <258o/a>        intrco/a> = -oa href="+code=EBUSY" class="sref">EBUSYo/a>; <259o/a> <260o/a>        if (!oa href="+code=request_regin>" class="sref">request_regin>o/a>(oa href="+code=SBC7240_ENABLE_PORT" class="sref">SBC7240_ENABLE_PORTo/a>, 1, ospa> class="string">"SBC7240 WDT"o/spa>
)) { <261o/a>                oa href="+code=pr_err" class="sref">pr_erro/a>(ospa> class="string">"I/O address 0x%04x already in use\n"o/spa>
, <262o/a>                       oa href="+code=SBC7240_ENABLE_PORT" class="sref">SBC7240_ENABLE_PORTo/a>); <263o/a>                oa href="+code=rc" class="sref">rco/a> = -oa href="+code=EIO" class="sref">EIOo/a>; <264o/a>                goto oa href="+code=err_out" class="sref">err_outo/a>; <265o/a>        } <266o/a> <267o/a>        ospa> class="comment">/* The IO port 0x043 used to disable the watchdogo/spa>
 <268o/a>ospa> class="comment">         * is already claimed by the system timer, so weo/spa>
 <269o/a>ospa> class="comment">         * can't request_regin>() it ...*/o/spa>
 <270o/a> <271o/a>        if (oa href="+code=timeout" class="sref">timeouto/a> < 1 ||timeouto/a> >SBC7240_MAX_TIMEOUTo/a>) { <272o/a>                oa href="+code=timeout" class="sref">timeouto/a> =SBC7240_TIMEOUTo/a>; <273o/a>                oa href="+code=pr_info" class="sref">pr_infoo/a>(ospa> class="string">"timeout alue= must be 1<=x<=%d, using %d\n"o/spa>
, <274o/a>                        oa href="+code=SBC7240_MAX_TIMEOUT" class="sref">SBC7240_MAX_TIMEOUTo/a>, oa href="+code=timeout" class="sref">timeouto/a>); <275o/a>        } <276o/a>        oa href="+code=wdt_set_timeout" class="sref">wdt_set_timeouto/a>(oa href="+code=timeout" class="sref">timeouto/a>); <277o/a>        oa href="+code=wdt_disable" class="sref">wdt_disableo/a>(); <278o/a> <279o/a>        oa href="+code=rc" class="sref">rco/a> = oa href="+code=register_reboot_notifier" class="sref">register_reboot_notifiero/a>(&oa href="+code=wdt_notifier" class="sref">wdt_notifiero/a>); <280o/a>        if (oa href="+code=rc" class="sref">rco/a>) { <281o/a>                oa href="+code=pr_err" class="sref">pr_erro/a>(ospa> class="string">"cannot register reboot notifier (err=%d)\n"o/spa>
, oa href="+code=rc" class="sref">rco/a>); <282o/a>                goto oa href="+code=err_out_regin>" class="sref">err_out_regin>o/a>; <283o/a>        } <284o/a> <285o/a>        oa href="+code=rc" class="sref">rco/a> = oa href="+code=misc_register" class="sref">misc_registero/a>(&oa href="+code=wdt_miscdev" class="sref">wdt_miscdevo/a>); <286o/a>        if (oa href="+code=rc" class="sref">rco/a>) { <287o/a>                oa href="+code=pr_err" class="sref">pr_erro/a>(ospa> class="string">"cannot register miscdev on minor=%d (err=%d)\n"o/spa>
, <288o/a>                       oa href="+code=wdt_miscdev" class="sref">wdt_miscdevo/a>.oa href="+code=minor" class="sref">minoro/a>, oa href="+code=rc" class="sref">rco/a>); <289o/a>                goto oa href="+code=err_out_reboot_notifier" class="sref">err_out_reboot_notifiero/a>; <290o/a>        } <291o/a> <292o/a>        oa href="+code=pr_info" class="sref">pr_infoo/a>(ospa> class="string">"Watchdog driver for SBC7240 initialised (nowayout=%d)\n"o/spa>
, <293o/a>                oa href="+code=nowayout" class="sref">nowayouto/a>); <294o/a> <295o/a>        return 0; <296o/a> <297o/a>oa href="+code=err_out_reboot_notifier" class="sref">err_out_reboot_notifiero/a>: <298o/a>        oa href="+code=unregister_reboot_notifier" class="sref">unregister_reboot_notifiero/a>(&oa href="+code=wdt_notifier" class="sref">wdt_notifiero/a>); <299o/a>oa href="+code=err_out_regin>" class="sref">err_out_regin>o/a>: <300o/a>        oa href="+code=release_regin>" class="sref">release_regin>o/a>(oa href="+code=SBC7240_ENABLE_PORT" class="sref">SBC7240_ENABLE_PORTo/a>, 1); <301o/a>oa href="+code=err_out" class="sref">err_outo/a>: <302o/a>        return oa href="+code=rc" class="sref">rco/a>; <303o/a>} <304o/a> <305o/a>oa href="+code=module_init" class="sref">module_inito/a>(oa href="+code=sbc7240_wdt_init" class="sref">sbc7240_wdt_inito/a>); <306o/a>oa href="+code=module_exit" class="sref">module_exito/a>(oa href="+code=sbc7240_wdt_unload" class="sref">sbc7240_wdt_unloado/a>); <307o/a> <308o/a>oa href="+code=MODULE_AUTHOR" class="sref">MODULE_AUTHORo/a>(ospa> class="string">"Gilles Gigan"o/spa>
); <309o/a>oa href="+code=MODULE_DESCRIPTION" class="sref">MODULE_DESCRIPTIONo/a>(ospa> class="string">"Watchdog device driver for single board"o/spa>
 <310o/a>                   ospa> class="string">" computers EPIC Nano 7240 from iEi"o/spa>
); <311o/a>oa href="+code=MODULE_LICENSE" class="sref">MODULE_LICENSEo/a>(ospa> class="string">"GPL"o/spa>
); <312o/a>oa href="+code=MODULE_ALIAS_MISCDEV" class="sref">MODULE_ALIAS_MISCDEVo/a>(oa href="+code=WATCHDOG_MINOR" class="sref">WATCHDOG_MINORo/a>); <313o/a> <314o/a>