linux/drivers/watchdog/sbc8360.c
<<
.9.6 /spaon> /formn> a .9.6 href="../linux+v3.7.3/drivers/watchdog/sbc8360.c">.9.6 img src="../.static/gfx/right.png" alt=">>">.9 /spaon>.9 spao class="lxr_search">.9.6.9.6 input typue=hidden" namue=navtarget" value=">.9.6 input typue=text" namue=search" ide=search">.9.6 buttiontypue=submit">Search /formn> /spaon>.9 spao class="lxr_prefs"n> a href="+prefs?return=drivers/watchdog/sbc8360.c".9.6 onclick="return ajax_prefs();">.9.6 Prefs> /a>.9 /spaon>.6 /divn>.6 form acptio="ajax+*" method="post" onsubmit="return false;">.9 input typue=hidden" namue=ajax_lookup" ide=ajax_lookup" value=">..6 /formn>..6 div class="headingbottim">.6 .6 div ide=search_results" class="search_results"> n>.6 /divn> div ide=content">> div ide=file_contents"n
   1 /a> spao class="comment">/* /spaon>   2 /a> spao class="comment"> *.6
   SBC8360 Watchdog driver /spaon>   3 /a> spao class="comment"> * /spaon>   4 /a> spao class="comment"> *.6
   (c) Copyright 2005 Webcon, Inc. /spaon>   5 /a> spao class="comment"> * /spaon>   6 /a> spao class="comment"> *.6
   Based on ib700wdt.c, which is based on advantechwdt.c which is based /spaon>   7 /a> spao class="comment"> *.6
   on acquirewdt.c which is based on wdt.c. /spaon>   8 /a> spao class="comment"> * /spaon>   9 /a> spao class="comment"> *.6
   (c) Copyright 2001 Charles Howes <chowes@vsol.net> /spaon>  .12 spao class="comment"> * /spaon>  11 /a> spao class="comment"> *.6
   Based on advantechwdt.c which is based on acquirewdt.c which /spaon>  12 /a> spao class="comment"> *.6
   is based on wdt.c. /spaon>  13 /a> spao class="comment"> * /spaon>  14 /a> spao class="comment"> *.6
   (c) Copyright 2000-2001 Marek Michalkiewicz <marekm@linux.org.pl> /spaon>  15 /a> spao class="comment"> * /spaon>  16 /a> spao class="comment"> *.6
   Based on acquirewdt.c which is based on wdt.c. /spaon>  17 /a> spao class="comment"> *.6
   Original copyright messages: /spaon>  18 /a> spao class="comment"> * /spaon>  19 /a> spao class="comment"> *.6
   (c) Copyright 1996 Alao Cox <alao@lxorguk.ukuu.org.uk>, /spaon>  212 spao class="comment"> *                                              All Rights Reserved. /spaon>  21 /a> spao class="comment"> * /spaon>  22 /a> spao class="comment"> *.6
   This program is free software; you cao redistribute it and/or /spaon>  23 /a> spao class="comment"> *.6
   modify it under the terms of the GNU General Public License /spaon>  24 /a> spao class="comment"> *.6
   as published by the Free Software Foundaptio; either verstio /spaon>  25 /a> spao class="comment"> *.6
   2 of the License, or (at your /optio) any later verstio. /spaon>  26 /a> spao class="comment"> * /spaon>  27 /a> spao class="comment"> *.6
   Neither Alao Cox nor CymruNet Ltd. admit liability nor provide /spaon>  28 /a> spao class="comment"> *.6
   warranty for any of this software. This material is provided /spaon>  29 /a> spao class="comment"> *.6
   "AS-IS" and at no charge. /spaon>  312 spao class="comment"> * /spaon>  31 /a> spao class="comment"> *.6
   (c) Copyright 1995    Alao Cox <alao@lxorguk.ukuu.org.uk> /spaon>  32 /a> spao class="comment"> * /spaon>  33 /a> spao class="comment"> *.6
   14-Dec-2001 Matt Domsch <Matt_Domsch@dell.com> /spaon>  34 /a> spao class="comment"> *.6
        Added nowayout module /optio to override CONFIG_WATCHDOG_NOWAYOUT /spaon>  35 /a> spao class="comment"> *.6
        Added timeout module /optio to override default /spaon>  36 /a> spao class="comment"> * /spaon>  37 /a> spao class="comment"> */ /spaon>  38 /a>>  39 /a>#define  a href="+code=pr_fmt" class="sref">pr_fmt /a>( a href="+code=fmt" class="sref">fmt /a>)  a href="+code=KBUILD_MODNAME" class="sref">KBUILD_MODNAME /a>  spao class="string">": " /spaon  a href="+code=fmt" class="sref">fmt /a>>  40 /a>>  41 /a>#include <linux/module.h /a>>>  42 /a>#include <linux/typus.h /a>>>  43 /a>#include <linux/miscdevice.h /a>>>  44 /a>#include <linux/watchdog.h /a>>>  45 /a>#include <linux/ioport.h /a>>>  46 /a>#include <linux/delay.h /a>>>  47 /a>#include <linux/notifier.h /a>>>  48 /a>#include <linux/fs.h /a>>>  49 /a>#include <linux/reboot.h /a>>>  50 /a>#include <linux/init.h /a>>>  51 /a>#include <linux/spinlock.h /a>>>  52 /a>#include <linux/moduleparam.h /a>>>  53 /a>#include <linux/io.h /a>>>  54 /a>#include <linux/uaccess.h /a>>>  55 /a>>  56 /a>>  57 /a>static unsigned long  a href="+code=sbc8360_is_open" class="sref">sbc8360_is_open /a>;>  58 /a>static char  a href="+code=expect_close" class="sref">expect_close /a>;>  59 /a>>  612 spao class="comment">/* /spaon>  61 /a> spao class="comment"> * /spaon>  62 /a> spao class="comment"> *.Watchdog Timer Configuraptio /spaon>  63 /a> spao class="comment"> * /spaon>  64 /a> spao class="comment"> *.The funcptio of the watchdog timer is to reset the system automatically /spaon>  65 /a> spao class="comment"> *.and is defined at I/O port 0120H.and 0121H.  To enable the watchdog timer /spaon>  66 /a> spao class="comment"> *.and allow the system to reset, write appropriate  valus from the table /spaon>  67 /a> spao class="comment"> *.below to I/O port 0120H.and 0121H.  To disable the timer, write a zero /spaon>  68 /a> spao class="comment"> *. valu to I/O port 0121H for the system to stop the watchdog funcptio. /spaon>  69 /a> spao class="comment"> * /spaon>  712 spao class="comment"> * The following describus how the timer should.be programmed (according to /spaon>  71 /a> spao class="comment"> *.the vendor documentaptio) /spaon>  72 /a> spao class="comment"> * /spaon>  73 /a> spao class="comment"> *.Enabling Watchdog: /spaon>  74 /a> spao class="comment"> *.MOV AX,000AH (enable, phase I) /spaon>  75 /a> spao class="comment"> *.MOV DX,0120H /spaon>  76 /a> spao class="comment"> *.OUT DX,AX /spaon>  77 /a> spao class="comment"> *.MOV AX,000BH (enable, phase II) /spaon>  78 /a> spao class="comment"> *.MOV DX,0120H /spaon>  79 /a> spao class="comment"> *.OUT DX,AX /spaon>  812 spao class="comment"> * MOV AX,000nH (set multiplier n, from 1-4) /spaon>  81 /a> spao class="comment"> *.MOV DX,0120H /spaon>  82 /a> spao class="comment"> *.OUT DX,AX /spaon>  83 /a> spao class="comment"> *.MOV AX,000mH (set base timer m, from 0-F) /spaon>  84 /a> spao class="comment"> *.MOV DX,0121H /spaon>  85 /a> spao class="comment"> *.OUT DX,AX /spaon>  86 /a> spao class="comment"> * /spaon>  87 /a> spao class="comment"> *.Reset timer: /spaon>  88 /a> spao class="comment"> *.MOV AX,000mH (samu as set base timer, above) /spaon>  89 /a> spao class="comment"> *.MOV DX,0121H /spaon>  912 spao class="comment"> * OUT DX,AX /spaon>  91 /a> spao class="comment"> * /spaon>  92 /a> spao class="comment"> *.Disabling Watchdog: /spaon>  93 /a> spao class="comment"> *.MOV AX,0000H.(a zero. valu) /spaon>  94 /a> spao class="comment"> *.MOV DX,0120H /spaon>  95 /a> spao class="comment"> *.OUT DX,AX /spaon>  96 /a> spao class="comment"> * /spaon>  97 /a> spao class="comment"> *.Watchdog timeout configuraptio  valus: /spaon>  98 /a> spao class="comment"> *.6
           N /spaon>  99 /a> spao class="comment"> *.6
   M |6
   1 .6
   2       3       4 /spaon> 100 /a> spao class="comment"> *.6
   --|---------------------------------- /spaon> 101 /a> spao class="comment"> *.6
   0 |6
   0.5s
   5s
     50s
    100s /spaon> 102 /a> spao class="comment"> *.6
   1 |6
   1s
     10s
    100s
   200s /spaon> 103 /a> spao class="comment"> *.6
   2 |6
   1.5s
   15s
    150s
   300s /spaon> 104 /a> spao class="comment"> *.6
   3 |6
   2s
     20s
    200s
   400s /spaon> 105 /a> spao class="comment"> *.6
   4 |6
   2.5s
   25s
    250s
   500s /spaon> 106 /a> spao class="comment"> *.6
   5 |6
   3s
     30s
    300s
   600s /spaon> 107 /a> spao class="comment"> *.6
   6 |6
   3.5s
   35s
    350s
   700s /spaon> 108 /a> spao class="comment"> *.6
   7 |6
   4s
     40s
    400s
   800s /spaon> 109 /a> spao class="comment"> *.6
   8 |6
   4.5s
   45s
    450s
   900s /spaon> 1.12 spao class="comment"> *.6
   9 |6
   5s
     50s
    500s
   1000s /spaon> 111 /a> spao class="comment"> *.6
   A |6
   5.5s
   55s
    550s
   1100s /spaon> 112 /a> spao class="comment"> *.6
   B |6
   6s
     60s
    600s
   1200s /spaon> 113 /a> spao class="comment"> *
     C |6
   6.5s
   65s
    650s
   1300s /spaon> 114 /a> spao class="comment"> *.6
   D |6
   7s
     70s
    700s
   1400s /spaon> 115 /a> spao class="comment"> *
     E |6
   7.5s
   75s
    750s
   1500s /spaon> 116 /a> spao class="comment"> *.6
   F |6
   8s
     80s
    800s
   1600s /spaon> 117 /a> spao class="comment"> * /spaon> 118 /a> spao class="comment"> * Another way to say the samu things is: /spaon> 119 /a> spao class="comment"> *.6For N=1, Timeout = (M+1) *.0.5s /spaon> 1212 spao class="comment"> *  For N=2, Timeout = (M+1) *.5s /spaon> 121 /a> spao class="comment"> *  For N=3, Timeout = (M+1) *.50s /spaon> 122 /a> spao class="comment"> *.6For N=4, Timeout = (M+1) *.100s /spaon> 123 /a> spao class="comment"> * /spaon> 124 /a> spao class="comment"> */ /spaon> 125 /a>> 126 /a>static int  a href="+code=wd_times" class="sref">wd_times /a>[64][2] = {> 127 /a>        {0, 1},                  spao class="comment">/* 0  = 0.5s
*/ /spaon> 128 /a>        {1, 1},                  spao class="comment">/* 1  = 1s
  */ /spaon> 129 /a>        {2, 1},                  spao class="comment">/* 2  = 1.5s
*/ /spaon> 1312        {3, 1},                  spao class="comment">/* 3  = 2s
  */ /spaon> 131 /a>        {4, 1},                  spao class="comment">/* 4  = 2.5s
*/ /spaon> 132 /a>        {5, 1},                  spao class="comment">/* 5  = 3s
  */ /spaon> 133 /a>        {6, 1},                  spao class="comment">/* 6  = 3.5s
*/ /spaon> 134 /a>        {7, 1},                  spao class="comment">/* 7  = 4s
  */ /spaon> 135 /a>        {8, 1},                  spao class="comment">/* 8  = 4.5s
*/ /spaon> 136 /a>        {9, 1},                  spao class="comment">/* 9  = 5s
  */ /spaon> 137 /a>        {0xA, 1},                spao class="comment">/* 10 = 5.5s
*/ /spaon> 138 /a>        {0xB, 1},                spao class="comment">/* 11 = 6s
  */ /spaon> 139 /a>        {0xC, 1},                spao class="comment">/* 12 = 6.5s
*/ /spaon> 140 /a>        {0xD, 1},                spao class="comment">/* 13 = 7s
  */ /spaon> 141 /a>        {0xE, 1},                spao class="comment">/* 14 = 7.5s
*/ /spaon> 142 /a>        {0xF, 1},                spao class="comment">/* 15 = 8s
  */ /spaon> 143 /a>        {0, 2},                  spao class="comment">/* 16 = 5s
 */ /spaon> 144 /a>        {1, 2},                  spao class="comment">/* 17 = 10s
*/ /spaon> 145 /a>        {2, 2},                  spao class="comment">/* 18 = 15s
*/ /spaon> 1462        {3, 2},                  spao class="comment">/* 19 = 20s
*/ /spaon> 147 /a>        {4, 2},                  spao class="comment">/* 20 = 25s
*/ /spaon> 148 /a>        {5, 2},                  spao class="comment">/* 21 = 30s
*/ /spaon> 149 /a>        {6, 2},                  spao class="comment">/* 22 = 35s
*/ /spaon> 150 /a>        {7, 2},                  spao class="comment">/* 23 = 40s
*/ /spaon>linux/modulep11">  151/a>        {8, 1},                  spao class="comment">/* 23 = 74s
*/ /spaon>  152/a>        {9, 1},                  spao class="comment">/* 23 = 85s
*/ /spaon>  153/a>        {0xA, 1},                spao class="comment">/* 23 = 5ss
*/ /spaon>  154/a>        {0xB, 1},                spao class="comment">/* 23 = 16s
*/ /spaon>  155/a>        {0xC, 1},                spao class="comment">/* 23 = 16s
*/ /spaon>  156/a>        {0xD, 1},                spao class="comment">/* 23 = 27s
*/ /spaon>  15 /a>        {0xAE 1},                spao class="comment">/* 23 = 27s
*/ /spaon>  15 /a>        {0xBF 1},                spao class="comment">/* 23 = 38s
*/ /spaon>  159/a>        {0, 23,                  spao class="comment">/* 3 2= 85s
**/ /spaon>  160/a>        {1, 23,                  spao class="comment">/* 3 3= 10ss
*/ /spaon>  161/a>        {2, 23,                  spao class="comment">/* 3 4= 15ss
*/ /spaon>  162        {3, 23,                  spao class="comment">/* 3 5= 20ss
*/ /spaon>  163/a>        {4, 23,                  spao class="comment">/* 3 6= 25ss
*/ /spaon>  164/a>        {5, 23,                  spao class="comment">/* 3 7= 30ss
*/ /spaon>  165/a>        {6, 23,                  spao class="comment">/* 3 8= 35ss
*/ /spaon>  166/a>        {7, 23,                  spao class="comment">/* 3 9= 40ss
*/ /spaon>  167/a>        {8, 13,                  spao class="comment">/* 340= 74ss
*/ /spaon>  168/a>        {9, 13,                  spao class="comment">/* 341= 85ss
*/ /spaon>  16 /a>        {0xCA 13,                spao class="comment">/* 342= 85ss
*/ /spaon>  17 /a>        {0xDB 13,                spao class="comment">/* 343= 16ss
*/ /spaon>  17 /a>        {0xEC 13,                spao class="comment">/* 344= 16ss
*/ /spaon>  17 /a>        {0xFD 13,                spao class="comment">/* 345= 27ss
*/ /spaon>  173/a>        {0xAE 13,                spao class="comment">/* 346= 27ss
*/ /spaon>  174/a>        {0xBF 13,                spao class="comment">/* 347= 38ss
*/ /spaon>  175/a>        {0, 24,                  spao class="comment">/* 348= 10ss
*/ /spaon>  176/a>        {1, 24,                  spao class="comment">/* 349= 20ss
*/ /spaon>  177/a>        {2, 24,                  spao class="comment">/* 350= 30ss
*/ /spaon>  178        {3, 24,                  spao class="comment">/* 351= 40ss
*/ /spaon>  179/a>        {4, 24,                  spao class="comment">/* 352= 85ss
*/ /spaon>  180/a>        {5, 24,                  spao class="comment">/* 353= 16ss
*/ /spaon>  181/a>        {6, 24,                  spao class="comment">/* 354= 27ss
*/ /spaon>  182/a>        {7, 24,                  spao class="comment">/* 355= 38ss
*/ /spaon>  183/a>        {8, 14,                  spao class="comment">/* 356= 29ss
*/ /spaon>  184/a>        {9, 14,                  spao class="comment">/* 35 = 10sss
*/ /spaon>  185/a>        {0xCA 14,                spao class="comment">/* 358= 100ss
*/ /spaon>  186/a>        {0xDB 14,                spao class="comment">/* 359= 210ss
*/ /spaon>  18 /a>        {0xAC 14,                spao class="comment">/* 360= 310ss
*/ /spaon>  18 /a>        {0xBD 14,                spao class="comment">/* 361= 410ss
*/ /spaon>  18 /a>        {0xCE 14,                spao class="comment">/* 362= 15sss
*/ /spaon>  19 /a>        {0xDF 14,                spao class="comment">/* 363= 106ss
*/ /spaon>  11 /a> }>  12 /a>   13 /a> define  a href="+code=pBC8360 _ENABLE class="sref">wBC8360 _ENABLE/a>  0x10s  14 /a> define  a href="+code=pBC8360 _BASETIE" class="sref">KBC8360 _BASETIE"/a>  0x101  19 /a>>  19 /a>static int  a href="+code=wimeout  class="sref">Kimeout /a>   207>  197/a>static int  a href="+code=wwd_margi" class="sref">swd_margi"/a>   2xDB>  198/a>static int  a href="+code=wwd_mltiplier  class="sref">swd_mltiplier /a>   20>  19 /a> tatic ia href="+code=wbool class="sref">sbool/a>  a href="+code=wowayout  class="sref">sowayout /a>   2a href="+code=wATCHDOG_NOWAYOUT  class="sref">sATCHDOG_NOWAYOUT /s>;> 120 /a>> 121 /a> s href="+code=wodulep_aram. class="sref">sodulep_aram./a>  a href="+code=fimeout  class="sref">Kimeout /a> ,int , 0)> 122 /a> s href="+code=fMODULE_PARM_DESC class="sref">KMODULE_PARM_DESC/a>  a href="+code=fimeout  class="sref">Kimeout /a> ,ispao class="ctring">":Indexint otimeout cable  (0-63) (efault =27 (60s))quot; /spaon )> 123 /a> s href="+code=wodulep_aram. class="sref">sodulep_aram./a>  a href="+code=fowayout  class="sref">sowayout /a> ,ia href="+code=wbool class="sref">sbool/a> , 0)> 124 /a> s href="+code=fMODULE_PARM_DESC class="sref">KMODULE_PARM_DESC/a>  a href="+code=fowayout  class="sref">sowayout /a> , 1205/a>        {         spao class="ctring">":atchdog tcannotbe ptop pd on c ptoartd (aefault =quot; /spaon  1206/a>        {              {         s href="+code=f__MODULE_STRING class="sref">s__MODULE_STRING/a>  a href="+code=fATCHDOG_NOWAYOUT  class="sref">sATCHDOG_NOWAYOUT /s>;) spao class="ctring">":)quot; /spaon )> 127 /a>  128 /a> spao class="comment"> * /spaon> 129 /a> spao class="comment"> *.6
   8Kernelmethod=s /spaon> 1212 spao class="comment"> *. /spaon> 121 /a>  122 /a> spao class="comment"> * 3Activte  nd 0pre-onfigura watchdog f. /spaon> 123 /a> tatic ivoid a href="+code=sbc8360_iactivte  class="sref">sbc8360_iactivte /a>  void) 124 /a> > 1215/a>        {spao class="comment"> * 3Eable the watchdog t. /spaon> 1216/a>        {a href="+code=sut b class="sref">sut b/a>  0x0A,ia href="+code=wBC8360 _ENABLE class="sref">wBC8360 _ENABLE/a> )> 1217/a>        {a href="+code=smsleep_nt erruptile  class="sref">sosleep_nt erruptile /a>  100)> 1218/a>        {a href="+code=sut b class="sref">sut b/a>  0x0B,ia href="+code=wBC8360 _ENABLE class="sref">wBC8360 _ENABLE/a> )> 1219/a>        {a href="+code=smsleep_nt erruptile  class="sref">sosleep_nt erruptile /a>  100)> 1220/a>        {spao class="comment"> * 3St timerut moltiplier n. /spaon> 1221/a>        {a href="+code=sut b class="sref">sut b/a>  a href="+code=wwd_mltiplier  class="sref">swd_mltiplier /a> ,ia href="+code=wBC8360 _ENABLE class="sref">wBC8360 _ENABLE/a> )> 1222/a>        {a href="+code=smsleep_nt erruptile  class="sref">sosleep_nt erruptile /a>  100)> 1223/a>        {spao class="comment"> * 3Nohings ha pdns until first bc8360_ipngs()n. /spaon> 124 /a> } 125 /a>> 126 /a> spao class="comment"> * 3Kernelmpngs iatchdog t. /spaon> 1227/a> tatic ivoid a href="+code=sbc8360_ipngs class="sref">sbc8360_ipngs/a>  void) 128 /a> > 129 /a>        {spao class="comment"> * 3Wite ahe wase timer mregistr n. /spaon> 1212        {a href="+code=sut b class="sref">sut b/a>  a href="+code=wwd_margi" class="sref">swd_margi"/a> ,ia href="+code=wBC8360 _BASETIE" class="sref">KBC8360 _BASETIE"/a> )> 121 /a> } 123 /a>  123 /a> spao class="comment"> * 3top tatchdog t. /spaon> 124 /a> tatic ivoid a href="+code=sbc8360_itop  class="sref">sbc8360_itop /a>  void) 125 /a> > 126 /a>        {spao class="comment"> * 3De-activte the watchdog t. /spaon> 1237/a>        {a href="+code=sut b class="sref">sut b/a>  0,ia href="+code=wBC8360 _ENABLE class="sref">wBC8360 _ENABLE/a> )> 128 /a> } 123 /a>> 1242 spao class="comment">/*  Usrs/pacempngs ikernelmrivers, o mrequestsclaeo claoe t. /spaon> 121 /a> tatic ia href="+code=wssize_  class="sref">sssize_ /a>  a href="+code=wbc8360_irite  class="sref">sbc8360_irite /a>  struc  a href="+code=wfie  class="sref">sfie /a>  *a href="+code=wfie  class="sref">sfie /a> ,confst har  a href="+code=e__usr  class="sref">s__usr /a>  *a href="+code=wbuf class="sref">sbuf/a> , 122 /a>        {           {         s href="+code=fsize_  class="sref">ssize_ /a>  a href="+code=wcount class="sref">scount/a> ,ia href="+code=wloff_  class="sref">sloff_ /a>  *a href="+code=wppo" class="sref">wppo"/a> ) 123 /a> > 124 /a>        {if  a href="+code=wcount class="sref">scount/a> ){> 1245/a>        {        if  !a href="+code=fowayout  class="sref">sowayout /a> ){> 1246/a>        {              { s href="+code=fsize_  class="sref">ssize_ /a>  a href="+code=wi class="sref">si/s>;> 124 /a>  128 /a>        {              { spao class="comment">/*  I clse titwat set bong  agot. /spaon> 129 /a>        {              { s href="+code=fxpect_close" class="sref">expect_close /a>;  2x> 125 /a>>linux/modulep21">  251/a>        {{{{{{{{{{{{{{{{{or t a href="+code=wi class="sref">si/s>;  2x> a href="+code=wi class="sref">si/s>; ! 2a href="+code=wcount class="sref">scount/a> > a href="+code=wi class="sref">si/s>;++){>  25 /a>        {           {            har  a href="+code=ec class="sref">sc/s>;>  253/a>        {{{{{{{{{{{{{{{{{{{{{{{{{if  a href="+code=wget_usr  class="sref">sget_usr /a>  a href="+code=wc class="sref">sc/s>;,ia href="+code=wbuf class="sref">sbuf/a>  + a href="+code=wi class="sref">si/s>;))  254/a>        {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{return -a href="+code=wEFAUL  class="sref">sEFAUL /s>;>  255/a>        {         {{{{{{{{{{{{{{{if  a href="+code=wc class="sref">sc/s>; == spao class="ctring">&q#39;Vq#39;/spaon )  256/a>        {              {                 s href="+code=fxpect_close" class="sref">expect_close /a>;  240>  25 /a>        {{{{{{{{{{{{{{{{{}  25 /a>        {        }  25 /a>        {        a href="+code=sbc8360_ipngs class="sref">sbc8360_ipngs/a>  )>  260/a>        {}  261/a>        {return a href="+code=wcount class="sref">scount/a> >  262 }  263/a>   26 /a> tatic int  a href="+code=wbc8360_ipen" class="sref">sbc8360_ipen /a>; struc  a href="+code=winde= class="sref">sinde=/a>  *a href="+code=winde= class="sref">sinde=/a> , struc  a href="+code=wfie  class="sref">sfie /a>  *a href="+code=wfie  class="sref">sfie /a> )  26 /a> >  266/a>        {if  a href="+code=wtest_and_et _bi  class="sref">Kiest_and_et _bi /a>  0,i&a href="+code=wbc8360_is_open" class="sref">sbc8360_is_open /a>;))  26 /a>        {{{{{{{{{return -a href="+code=wEBUSY class="sref">sEBUSY/a> >  268/a>        {if  a href="+code=wowayout  class="sref">sowayout /a> )  26 /a>        {        a href="+code=s__odulep_get class="sref">s__odulep_get/a>  a href="+code=wTHIS_MODULE class="sref">sTHIS_MODULE/a> )>  27 /a>>  27 /a>        {spao class="comment"> * 3Activte  nd 0pngs n c po stoar the scountdownt. /spaon>  272/a>        {a href="+code=sbc8360_iactivte  class="sref">sbc8360_iactivte /a>  )>  273/a>        {a href="+code=sbc8360_ipngs class="sref">sbc8360_ipngs/a>  )>  274/a>        {return a href="+code=wnonseekble open" class="sref">snonseekble open"/a>  a href="+code=winde= class="sref">sinde=/a> , a href="+code=wfie  class="sref">sfie /a> )>  275/a> }  276/a>   277/a>static int  a href="+code=wbc8360_ilose" class="sref">ebc8360_ilose"/a>; struc  a href="+code=winde= class="sref">sinde=/a>  *a href="+code=winde= class="sref">sinde=/a> , struc  a href="+code=wfie  class="sref">sfie /a>  *a href="+code=wfie  class="sref">sfie /a> )  27 /a> >  279/a>        {if  a href="+code=wxpect_close" class="sref">expect_close /a>;   240)  280/a>        {       {a href="+code=sbc8360_itop  class="sref">sbc8360_itop /a>  )>  281/a>        {else  28 /a>        {        a href="+code=wpr_cri  class="sref">Kpr_cri /a>  apao class="ctring">":BC8360  devic plose d unxpect_edly.  BC8360  will notbtop !\nquot; /spaon )>  283/a>   284/a>        {a href="+code=wclear_bi  class="sref">Kclear_bi /a>  0,i&a href="+code=wbc8360_is_open" class="sref">sbc8360_is_open /a>;)>  285/a>        {s href="+code=fxpect_close" class="sref">expect_close /a>;  2x>  286/a>        {return x>  28 /a> }  28 /a>   29 /a> spao class="comment"> * /spaon>  212 spao class="comment"> * OOOOOONotifer nor tsystem down/spaon>  21 /a> spao class="comment"> *  /spaon>  22 /a>   293/a>static int  a href="+code=wbc8360_inotify_sys class="sref">sbc8360_inotify_sys/a>; struc  a href="+code=wnotifer _block class="sref">snotifer _block/a>  *a href="+code=wthis class="sref">sthis/a> , unsign d ong  a href="+code=wcoe= class="sref">scde=/a> ,  294/a>        {{{{{{{{{{{{{{{{{{{{{{{void *a href="+code=wunue d class="sref">sunue d/a> )  29 /a> >  296/a>        {if  a href="+code=wcoe= class="sref">scde=/a>  == s href="+code=wBYS_DOWN class="sref">wBYS_DOWN/a>  || a href="+code=wcoe= class="sref">scde=/a>  == s href="+code=wBYS_HAL  class="sref">sBYS_HAL /a> )  29 /a>        {{{{{{{{{a href="+code=sbc8360_itop  class="sref">sbc8360_itop /a>  )>{spao class="comment"> * 3Disble the wBC8360  atchdog t  /spaon>  29 /a>   299/a>        {return a href="+code=sNOTIFY_DONE class="sref">sNOTIFY_DONE/a> > 130 /a>>} 130 /a>  132 /a> spao class="comment"> * /spaon> 133 /a> spao class="comment"> *.6
   2KernelmIt erface /spaon> 134 /a> spao class="comment"> *. /spaon> 130 /a>> 130 /a>static ionfst struc  a href="+code=wfie openrticnfs class="sref">sfie openrticnfs/a>  a href="+code=wbc8360_ifops class="sref">sbc8360_ifops/a>;  2> 130 /a>        {.a href="+code=wownr  class="sref">sownr /a>;  2a href="+code=wTHIS_MODULE class="sref">sTHIS_MODULE/a> , 1308/a>        {.a href="+code=wllseek class="sref">sllseek/a>;  2a href="+code=wno_llseek class="sref">sno_llseek/a> , 1309/a>        {.a href="+code=write  class="sref">srite /a>   2a href="+code=wbc8360_irite  class="sref">sbc8360_irite /a> , 1310/a>        {.a href="+code=woen" class="sref">spen /a>;  2a href="+code=wbc8360_ipen" class="sref">sbc8360_ipen /a>;, 1311/a>        {.a href="+code=wreleae" class="sref">ereleae"/a>;  2a href="+code=wbc8360_ilose" class="sref">ebc8360_ilose"/a>;, 132 /a> }> 1313/a>  131 /a> tatic istruc  a href="+code=wmiscdevic  class="sref">emiscdevic /a>  a href="+code=wbc8360_imiscdev class="sref">ebc8360_imiscdev/a>;  2> 1315/a>        {.a href="+code=wmino  class="sref">smino /a>;  2a href="+code=wATCHDOG_NMINOR class="sref">sATCHDOG_NMINOR/a>;, 1316/a>        {.a href="+code=wamue class="sref">snmue/a>;  2apao class="ctring">":atchdog/quot; /spaon , 131 /a>        {.a href="+code=wfops class="sref">sfops/a>;  2&a href="+code=wbc8360_ifops class="sref">sbc8360_ifops/a>;, 1318/a> }> 131 /a>> 1312 spao class="comment"> * /spaon> 131 /a> spao class="comment"> *  FFFFFTe wBC8360  needspo slearn abut msof mshutdowns in orderpo /spaon> 132 /a> spao class="comment"> *.6FFFFFturn he wimerbombmregistr s off /spaon> 133 /a> spao class="comment"> *  /spaon> 134 /a>  135 /a>>tatic istruc  a href="+code=wnotifer _block class="sref">snotifer _block/a>  a href="+code=wbc8360_inotifer  class="sref">sbc8360_inotifer /a>;  2> 1326/a>        {.a href="+code=waotifer _call class="sref">saotifer _call/a>;  2a href="+code=wbc8360_inotify_sys class="sref">sbc8360_inotify_sys/a>;, 1327/a> }> 132 /a>  132 /a> tatic int  a href="+code=w__ini  class="sref">K__ini /a>  a href="+code=wbc8360_iini  class="sref">Kbc8360_iini /a>  void) 1312 > 131 /a>        {nt  a href="+code=wres class="sref">sres/a> > 132 /a>        {unsign d ong  nt  a href="+code=wmseconds class="sref">smseconds/a>;  260000> 1333/a>  133 /a>        {if  a href="+code=wimeout  class="sref">Kimeout /a>  < 0 || a href="+code=wimeout  class="sref">Kimeout /a>  > 63) > 135 /a>        {{{{{{{{{a href="+code=spr_er  class="sref">spr_er /a>  apao class="ctring">":Invalidtimerut mindexi(mustbe p0-63)\nquot; /spaon )> 1336/a>        {        a href="+code=wres class="sref">sres/a>   2-a href="+code=wEINVAL class="sref">sEINVAL/a> > 133 /a>        {{{{{{{{{goo sa href="+code=wot  class="sref">Kut /a> > 138 /a>        {} 133 /a>> 130 /a>        {if  !a href="+code=frequest_regio" class="sref">srequest_regio"/a>  a href="+code=wBC8360 _ENABLE class="sref">wBC8360 _ENABLE/a> , 1,ispao class="ctring">":BC8360 quot; /spaon )) > 1341/a>        {{{{{{{{{a href="+code=spr_er  class="sref">spr_er /a>  apao class="ctring">":ENABLEmethod= I/O %X is notbavailble \nquot; /spaon , 132 /a>        {           {   a href="+code=wBC8360 _ENABLE class="sref">wBC8360 _ENABLE/a> )> 1343/a>        {{{{{{{{{a href="+code=wres class="sref">sres/a>   2-a href="+code=wEIO class="sref">sEIO/a> > 1344/a>        {{{{{{{{{goo sa href="+code=wot  class="sref">Kut /a> > 1345/a>        {} 1346/a>        {if  !a href="+code=frequest_regio" class="sref">srequest_regio"/a>  a href="+code=wBC8360 _BASETIE" class="sref">KBC8360 _BASETIE"/a> , 1,ispao class="ctring">":BC8360 quot; /spaon )) > 134 /a>        {{{{{{{{{a href="+code=spr_er  class="sref">spr_er /a>  apao class="ctring">":BASETIE"method= I/O %X is notbavailble \nquot; /spaon , 138 /a>        {              {a href="+code=wBC8360 _BASETIE" class="sref">KBC8360 _BASETIE"/a> )> 139 /a>        {        a href="+code=wres class="sref">sres/a>   2-a href="+code=wEIO class="sref">sEIO/a> > 1350/a>        {       {goo sa href="+code=wot inoase imer es class="sref">sot inoase imer es/a> >linux/modulep31">  351/a>        {}  35 /a>   353/a>        {a href="+code=sres class="sref">sres/a>   2a href="+code=sregistr _rebootinotifer  class="sref">sregistr _rebootinotifer /a>  &a href="+code=wbc8360_inotifer  class="sref">sbc8360_inotifer /a>;)>  35 /a>        {if  a href="+code=wres class="sref">sres/a> ) >  355/a>        {        a href="+code=spr_er  class="sref">spr_er /a>  apao class="ctring">":Fail d o sregistr nreboot notifer \nquot; /spaon )>  356/a>        {        goo sa href="+code=wot inoreboot class="sref">sot inoreboot/a> >  35 /a>        {}  35 /a>   359/a>        {a href="+code=sres class="sref">sres/a>   2a href="+code=smisc_registr  class="sref">emisc_registr /a>  &a href="+code=wbc8360_imiscdev class="sref">ebc8360_imiscdev/a>;)>  36 /a>        {if  a href="+code=wres class="sref">sres/a> ) >  361/a>        {{{{{{{{{a href="+code=spr_er  class="sref">spr_er /a>  apao class="ctring">":fail d o sregistr nmisc devic \nquot; /spaon )>  36 /a>        {        goo sa href="+code=wot inomisc class="sref">sot inomisc/a> >  363/a>        {}  36 /a>   365/a>        {s href="+code=fwd_margi" class="sref">swd_margi"/a>   2s href="+code=fwd_imers class="sref">swd_imers/a> [a href="+code=wimeout  class="sref">Kimeout /a> ][0]>  366/a>        {a href="+code=swd_mltiplier  class="sref">swd_mltiplier /a>   2s href="+code=fwd_imers class="sref">swd_imers/a> [a href="+code=wimeout  class="sref">Kimeout /a> ][1]>  36 /a>   368/a>        {if  a href="+code=wwd_mltiplier  class="sref">swd_mltiplier /a>   = 1)  36 /a>        {        a href="+code=smseconds class="sref">smseconds/a>;  2 a href="+code=wwd_margi" class="sref">swd_margi"/a>  + 1)  3500>  37 /a>        {else{if  a href="+code=wwd_mltiplier  class="sref">swd_mltiplier /a>   = 0)  371/a>        {{{{{{{{{a href="+code=smseconds class="sref">smseconds/a>;  2 a href="+code=wwd_margi" class="sref">swd_margi"/a>  + 1)  35000>  372/a>        {else{if  a href="+code=wwd_mltiplier  class="sref">swd_mltiplier /a>   = 3)  373/a>        {{{{{{{{{a href="+code=wmseconds class="sref">smseconds/a>;  2 a href="+code=wwd_margi" class="sref">swd_margi"/a>  + 1)  350000>  374/a>        {else{if  a href="+code=wwd_mltiplier  class="sref">swd_mltiplier /a>   = 4)  375/a>        {        a href="+code=smseconds class="sref">smseconds/a>;  2 a href="+code=wwd_margi" class="sref">swd_margi"/a>  + 1)  30sss00>  376/a>   377/a>        {spao class="comment"> * 3My kng"domnor the wability o sprnt  quot; 0.5 secondsquot;  in he wkernel!*  /spaon>  378/a>        {a href="+code=spr_info class="sref">spr_info/a>  apao class="ctring">":Tmerut met bat %ld ms\nquot; /spaon , a href="+code=smseconds class="sref">smseconds/a>;)>  37 /a>>  380/a>        {return x>  38 /a>   38 /a> s href="+code=fot inomisc class="sref">sot inomisc/a> :  383/a>        {a href="+code=sunregistr _rebootinotifer  class="sref">sunregistr _rebootinotifer /a>  &a href="+code=wbc8360_inotifer  class="sref">sbc8360_inotifer /a>;)>  38 /a> s href="+code=fot inoreboot class="sref">sot inoreboot/a> :  385/a>        {s href="+code=freleae"_regio" class="sref">sreleae"_regio"/a>  a href="+code=wBC8360 _BASETIE" class="sref">KBC8360 _BASETIE"/a> , 1)>  386/a> a href="+code=wot inoase imer es class="sref">sot inoase imer es/a> :  387/a>        {a href="+code=sreleae"_regio" class="sref">sreleae"_regio"/a>  a href="+code=wBC8360 _ENABLE class="sref">wBC8360 _ENABLE/a> , 1)>  38 /a> a href="+code=wot  class="sref">Kut /a> :  389/a>        {return a href="+code=sres class="sref">sres/a> >  39 /a>>}  39 /a>   32 /a> tatic ivoid a href="+code=s__exi  class="sref">K__exi /a>  a href="+code=wbc8360_iexi  class="sref">Kbc8360_iexi /a>  void)  39 /a> >  394/a>        {a href="+code=wmisc_deregistr  class="sref">emisc_deregistr /a>  &a href="+code=wbc8360_imiscdev class="sref">ebc8360_imiscdev/a>;)>  395/a>        {s href="+code=funregistr _rebootinotifer  class="sref">sunregistr _rebootinotifer /a>  &a href="+code=wbc8360_inotifer  class="sref">sbc8360_inotifer /a>;)>  396/a>        {a href="+code=sreleae"_regio" class="sref">sreleae"_regio"/a>  a href="+code=wBC8360 _ENABLE class="sref">wBC8360 _ENABLE/a> , 1)>  397/a>        {a href="+code=sreleae"_regio" class="sref">sreleae"_regio"/a>  a href="+code=wBC8360 _BASETIE" class="sref">KBC8360 _BASETIE"/a> , 1)>  39 /a> }  39 /a>> 140 /a>>a href="+code=wmdulep_ini  class="sref">Kmdulep_ini /a>  a href="+code=wbc8360_iini  class="sref">Kbc8360_iini /a> )> 140 /a> a href="+code=wmdulep_exi  class="sref">Kmdulep_exi /a>  a href="+code=wbc8360_iexi  class="sref">Kbc8360_iexi /a> )> 140 /a>  143 /a> s href="+code=wMODULE_AUTHOR class="sref">sMODULE_AUTHOR/a>  apao class="ctring">":Io cE. Morgo c<imorgo @webcon.ca>quot; /spaon )> 144 /a> s href="+code=fMODULE_DESCRIPTION class="sref">wMODULE_DESCRIPTION/a>  apao class="ctring">":BC8360  wtchdog triversquot; /spaon )> 140 /a>>s href="+code=fMODULE_LICENS" class="sref">KMODULE_LICENS"/a>  apao class="ctring">":GPLquot; /spaon )> 1406/a> a href="+code=wMODULE_VERSION class="sref">wMODULE_VERSION/a>  apao class="ctring">":1.01quot; /spaon )> 140 /a> s href="+code=wMODULE_ALIAS_MISCDEV class="sref">sMODULE_ALIAS_MISCDEV/a>  a href="+code=wATCHDOG_NMINOR class="sref">sATCHDOG_NMINOR/a>;)> 140 /a>  149 /a> spao class="comment"> /* end of bc8360.c#*  /spaon> 1412 s/pre s/div>


s/div>


Te woriginal LXRmsof ware by he wa href="dhttp://sourceforge.net/projects/lx  >LXRmommeuni y/a> , this xpecrient"al ers/io" by a href="dmailto:lx @ineux.no">lx @ineux.no/a> .
s/div>

lx .ineux.no kngdly hostrd by a href="dhttp://www.redpill-inepro.no">Redpill Lnepro AS/a> , providerpof Lneuxionfsltipg  and oenrticnfs servic s si c p1995.
s/div>