linux/drivers/rtc/rtc-proc.c
<<
ion>.14/spaue= .14/forme= .14a ion>.1 href="../linux+v3opt.2/drivers/rtc/rtc-proc.c">ion>.14img src="../.static/gfx/right.png" alt=">>">io4/spaue=io4spau class="lxr_search">ion>ion>.14input typ v3hidden" nam v3navtarget" > v3">ion>.14input typ v3text" nam v3search" idv3search">ion>.14butt typ v3submit">Search.1 onclick="return ajax_prefs();">ion>.1Prefs= .14/a>io4/spaue=n>.1 14/dive=n>.1 14form acvalu="ajax+*" method="post" onsubmit="return false;">io4input typ v3hidden" nam v3ajax_lookup" idv3ajax_lookup" > v3">in>.1 14/forme=in>.1 14div class="headingbott m">.1.1 .1 14div idv3search_results" class="search_results"= .e=n>.1 14/dive= 4div idv3content">= 4div idv3file_contents"e
1 114/a>4spau class="comment">/*4/spaue=1 124/a>4spau class="comment"> * RTC subsystem, proc interface4/spaue=1 134/a>4spau class="comment"> *4/spaue=1 144/a>4spau class="comment"> * Copyright (C) 2005-06 Tower Technologies4/spaue=1 154/a>4spau class="comment"> * Author: Alessandro Zummo <a.zummo@towertech.it>4/spaue=1 164/a>4spau class="comment"> *4/spaue=1 174/a>4spau class="comment"> * based on arch/arm/common/rtctime.c4/spaue=1 184/a>4spau class="comment"> *4/spaue=1 194/a>4spau class="comment"> * This program is free software; you cau redistribute it and/or modify4/spaue=1 ptioa>4spau class="comment"> * it under the terms of the GNU General Public License vers"
	 2 as4/spaue=1 114/a>4spau class="comment"> * published by the Free Software Foundavalu.4/spaue=1 124/a>4spau class="comment">*/4/spaue=1 134/a>=1 144/a>#include <linux/module.h4/a>>=1 154/a>#include <linux/rtc.h4/a>>=1 164/a>#include <linux/proc_fs.h4/a>>=1 174/a>#include <linux/seq_file.h4/a>>=1 184/a>=1 194/a>#include "rtc-core.h4/a>"=1 204/a>=1 214/a>#define14a href="+code=NAME_SIZE" class="sref">NAME_SIZE4/a>n>.1 1 pt=1 224/a>=1 234/a>#if14a href="+code=defined" class="sref">defined4/a>(4a href="+code=CONFIG_RTC_HCTOSYS_DEVICE" class="sref">CONFIG_RTC_HCTOSYS_DEVICE4/a>)=1 244/a>static14a href="+code=bool" class="sref">bool4/a>n4a href="+code=is_rtc_hctosys" class="sref">is_rtc_hctosys4/a>(structn4a href="+code=rtc_device" class="sref">rtc_device4/a>n*4a href="+code=rtc" class="sref">rtc4/a>)=1 254/a>{=1 264/a>n>.1 1  intn4a href="+code=size" class="sref">size4/a>;=1 274/a>n>.1 1  charn4a href="+code=nam " class="sref">nam 4/a>[4a href="+code=NAME_SIZE" class="sref">NAME_SIZE4/a>];=1 284/a>=1 294/a>n>.1 1  4a href="+code=size" class="sref">size4/a> = 4a href="+code=scnprintf" class="sref">scnprintf4/a>(4a href="+code=nam " class="sref">nam 4/a>,14a href="+code=NAME_SIZE" class="sref">NAME_SIZE4/a>,14spau class="string">"rtc%d"rtc4/a>->4a href="+code=id" class="sref">id4/a>);=1 304/a>n>.1 1  if (4a href="+code=size" class="sref">size4/a> >14a href="+code=NAME_SIZE" class="sref">NAME_SIZE4/a>)=1 314/a>n>.1 1          return 4a href="+code=false" class="sref">false4/a>;=1 324/a>=1 334/a>n>.1 1  return !4a href="+code=strncmp" class="sref">strncmp4/a>(4a href="+code=nam " class="sref">nam 4/a>,14a href="+code=CONFIG_RTC_HCTOSYS_DEVICE" class="sref">CONFIG_RTC_HCTOSYS_DEVICE4/a>,14a href="+code=NAME_SIZE" class="sref">NAME_SIZE4/a>);=1 344/a>}=1 354/a>#else=1 364/a>static14a href="+code=bool" class="sref">bool4/a>n4a href="+code=is_rtc_hctosys" class="sref">is_rtc_hctosys4/a>(structn4a href="+code=rtc_device" class="sref">rtc_device4/a>n*4a href="+code=rtc" class="sref">rtc4/a>)=1 374/a>{=1 384/a>n>.1 1  return (4a href="+code=rtc" class="sref">rtc4/a>->4a href="+code=id" class="sref">id4/a> == 0);=1 394/a>}=1 404/a>#endif=1 414/a>=1 424/a>static1intn4a href="+code=rtc_proc_show" class="sref">rtc_proc_show4/a>(structn4a href="+code=seq_file" class="sref">seq_file4/a>n*4a href="+code=seq" class="sref">seq4/a>,1voidn*4a href="+code=offset" class="sref">offset4/a>)=1 434/a>{=1 444/a>n>.1 1  intn4a href="+code=err" class="sref">err4/a>;=1 454/a>n>.1 1  structn4a href="+code=rtc_device" class="sref">rtc_device4/a>n*4a href="+code=rtc" class="sref">rtc4/a> = 4a href="+code=seq" class="sref">seq4/a>->4a href="+code=private" class="sref">private4/a>;=1 464/a>n>.1 1  const structn4a href="+code=rtc_class_ops" class="sref">rtc_class_ops4/a>n*4a href="+code=ops" class="sref">ops4/a>n= 4a href="+code=rtc" class="sref">rtc4/a>->4a href="+code=ops" class="sref">ops4/a>;=1 474/a>n>.1 1  structn4a href="+code=rtc_wkalrm" class="sref">rtc_wkalrm4/a>n4a href="+code=alrm" class="sref">alrm4/a>;=1 484/a>n>.1 1  structn4a href="+code=rtc_time" class="sref">rtc_time4/a>n4a href="+code=tm" class="sref">tm4/a>;=1 494/a>=1 504/a>n>.1 1  4a href="+code=err" class="sref">err4/a>n= 4a href="+code=rtc_read_time" class="sref">rtc_read_time4/a>(4a href="+code=rtc" class="sref">rtc4/a>, &4a href="+code=tm" class="sref">tm4/a>);=1 514/a>n>.1 1  if (4a href="+code=err" class="sref">err4/a>n== 0) {=1 524/a>n>.1 1          4a href="+code=seq_printf" class="sref">seq_printf4/a>(4a href="+code=seq" class="sref">seq4/a>,=1 534/a>n>.1 1                  4spau class="string">"rtc_time\t: %02d:%02d:%02d\n"1 544/a>n>.1 1                  4spau class="string">"rtc_date\t: %04d-%02d-%02d\n"1 554/a>n>.1 1                  4a href="+code=tm" class="sref">tm4/a>.4a href="+code=tm_hour" class="sref">tm_hour4/a>,14a href="+code=tm" class="sref">tm4/a>.4a href="+code=tm_min" class="sref">tm_min4/a>,14a href="+code=tm" class="sref">tm4/a>.4a href="+code=tm_sec" class="sref">tm_sec4/a>,=1 564/a>n>.1 1                  4a href="+code=tm" class="sref">tm4/a>.4a href="+code=tm_year" class="sref">tm_year4/a>n+ 1900,14a href="+code=tm" class="sref">tm4/a>.4a href="+code=tm_mon" class="sref">tm_mon4/a>n+ 1,14a href="+code=tm" class="sref">tm4/a>.4a href="+code=tm_mday" class="sref">tm_mday4/a>);=1 574/a>n>.1 1  }=1 584/a>=1 594/a>n>.1 1  4a href="+code=err" class="sref">err4/a>n= 4a href="+code=rtc_read_alarm" class="sref">rtc_read_alarm4/a>(4a href="+code=rtc" class="sref">rtc4/a>, &4a href="+code=alrm" class="sref">alrm4/a>);=1 604/a>n>.1 1  if (4a href="+code=err" class="sref">err4/a>n== 0) {=1 614/a>n>.1 1          4a href="+code=seq_printf" class="sref">seq_printf4/a>(4a href="+code=seq" class="sref">seq4/a>, 4spau class="string">"alrm_time\t: "1 624/a>n>.1 1          if ((unsigned int)4a href="+code=alrm" class="sref">alrm4/a>.4a href="+code=time" class="sref">time4/a>.4a href="+code=tm_hour" class="sref">tm_hour4/a> <= 24)=1 634/a>n>.1 1                  4a href="+code=seq_printf" class="sref">seq_printf4/a>(4a href="+code=seq" class="sref">seq4/a>, 4spau class="string">"%02d:"alrm4/a>.4a href="+code=time" class="sref">time4/a>.4a href="+code=tm_hour" class="sref">tm_hour4/a>);=1 644/a>n>.1 1          else=1 654/a>n>.1 1                  4a href="+code=seq_printf" class="sref">seq_printf4/a>(4a href="+code=seq" class="sref">seq4/a>, 4spau class="string">"**:"1 664/a>n>.1 1          if ((unsigned int)4a href="+code=alrm" class="sref">alrm4/a>.4a href="+code=time" class="sref">time4/a>.4a href="+code=tm_min" class="sref">tm_min4/a> <= 59)=1 674/a>n>.1 1                  4a href="+code=seq_printf" class="sref">seq_printf4/a>(4a href="+code=seq" class="sref">seq4/a>, 4spau class="string">"%02d:"alrm4/a>.4a href="+code=time" class="sref">time4/a>.4a href="+code=tm_min" class="sref">tm_min4/a>);=1 684/a>n>.1 1          else=1 694/a>n>.1 1                  4a href="+code=seq_printf" class="sref">seq_printf4/a>(4a href="+code=seq" class="sref">seq4/a>, 4spau class="string">"**:"1 704/a>n>.1 1          if ((unsigned int)4a href="+code=alrm" class="sref">alrm4/a>.4a href="+code=time" class="sref">time4/a>.4a href="+code=tm_sec" class="sref">tm_sec4/a> <= 59)=1 714/a>n>.1 1                  4a href="+code=seq_printf" class="sref">seq_printf4/a>(4a href="+code=seq" class="sref">seq4/a>, 4spau class="string">"%02d\n"alrm4/a>.4a href="+code=time" class="sref">time4/a>.4a href="+code=tm_sec" class="sref">tm_sec4/a>);=1 724/a>n>.1 1          else=1 734/a>n>.1 1                  4a href="+code=seq_printf" class="sref">seq_printf4/a>(4a href="+code=seq" class="sref">seq4/a>, 4spau class="string">"**\n"1 744/a>="%0foc.c#L74" idv3L74" class=7ss="sref">seq4/a>, 4spa7 clas7="string">"**:"1 664/a>n>.1 1          if ((unsigned ="line" nam v3L56">1 564/a>n>.1"sref">00>alrm4/a>.4a href="+code=time" classL6" idv3LL6" class="line" nam v3Lm_min7 class="sref">tm_min4/a> <= 59)=1 674/a>n>.1 1                  4a href="+code=seq_priv3L5class="sref">seq_printf4/a>(4a href="+code=seq" class="sref">seq4/a>, 4spau class="string">"%02d\n"1 564/a>n>.1 1    0ring">"%0foc.c#L74" idv3L74e" class7"sref">time4/a>.4a href7"+cod7=tm_min" class="sref">tm_min4/a>);=1 684/a>n>.1 1          else=1 694/a>n>.1 1                  4a href="+code=seq**- value="v3.100ring">"%0foc.c#L74" idv3L78=seq" cl8ss="sref">seq4/a>, 4spa8 clas8="string">"**:"1 704/a>n>.1 1          if ((unsigned f="+code=tm_year" class="sref"sref"11>alrm4/a>.4a href="+code=time" clas8="sref">8ime4/a>.4a href="+code=8m_sec8 class="sref">tm_sec4/a> <= 59)=1 714/a>n>.1 1                  4a href="+code=seq_printL5class="sref">seq_printf4/a>(4a href="+code=seq" class="sref">seq4/a>, 4spau class="string">"%02d\n"t0ring">"%0foc.c#L74" idv3L78e" class8"sref">time4/a>.4a href8"+cod8=tm_sec" class="sref">tm_sec4/a>);=1 724/a>n>.1 1          else=1 734/a>n>.1 1                  4a href="+code=seq- value="v3.100ring">"%0foc.c#L74" idv3L78seq" cla8s="sref">seq4/a>, 4spau8class8m_hour" class="sref">ass="sref">alrm4/a>a href="+code=seq" class="sref">seq4/a>, 4spau class="string">"%02d\n"1 704/a>n>.1 1          if ((unsigned f href="+code=tm_mon" class="s>nsref"31>alrm4/a>.4a href="+code=time" clas8ef="driv8rs/rtc/rtc-proc.c#L74" 8dv3L783L64">1 644/a>n>.1 1          else=1 654/a>n>.1 1                  4a href="+code=seq_printf" class="sref">seq_printf4/a>(4a href="+code=seq" class="sref">seq4/a>, 4spau class="string">"%02d\n"tm_mon4/a>n+ 1,14a href="+code=8" class=8ss="sref">seq4/a>, 4spa8 clas8="string">"**:&q>tm_sec4/a>);=tm_min4/a> <= 59)=1 674/a>n>.1 1                  4a href="+code=seq_printf" class="sref">seq_printf4/a>(4a href="+code81 174/a>44spau class="comment"> *"+cod8=tm_min" class="sref"L74">1 744/a>=1 544/a>n>.1 1                  4spau c8proc.c#L88" idv3L68" class="line8 nam 83L68">1 684/a>n>.1 1         s="sref"L74">1 744/a>=seq4/a>, 4senabl24/a>=?ef class="liOp20op0tion>
  
yesm v3L54">1 54 :ef class="liOp20op0tion>
  
norintf" class="sref">seq_printf4/a>(4a href="+code9=seq" cl9ss="sref">seq4/a>, 4spa9 clas9="string">"**:&qL74">1 744/a>=1 544/a>n>.1 1                  4spau c9="sref">9ime4/a>.4a href="+code=9m_sec9ss="s6L69" class="line" nam "sref">9ime4/a>.4a6o6tion>
  
 2 ode=9m_ss="string">&quo9ime4/a>nam v3L71">1 714/a>n>.2
	  >
  v3.2 op1op22tion>
  
 2 op1op22ption>
  2 op12otion value="v3.14.13"
1d f href="+coa>, 4spa9 clas9="s}ot;**\n"time4/a>dm_sec" class="sref">tm_9lass=9sref">tm_sec4/a>);=rtc4/a>)=1ref"code=seq" class=uie5">1ref"ce8 nam 83L68">1 684/a>n>.1 1         s="sref"L74">1 7)a6o6tion>
  
 2 ode=9m_ss="string">&quo9ime4/a>nam v3L71">1 714/a>n>.2
	  >
  v3.2 op1op22tion>
  
 2 op1op22ption>
  2 op12otio        9     4a href="+code=seq9 valu9="v3.100ring">"" 1 1    s9="s}ot;**\n"nsigned 9 href="+code=tm_mon" cl9ss="s9nsref"31>alrm4/a>.4a href="+cs="sref">rtc4/a>)=n>.1 1         s="srpie5a>n>.1 >1 7)a6o6tion>
  
 2 ode=9m_ss="string">&quo9ime4/a>nam v3L71">1 714/a>n>.2
	  >
  v3.2 op1op22tion>
  
 2 op1op22ption>
  2 op12otio02d\n&qu9t;tm_mon4/aquot;seq4/9>, 4spa8 clas8="string"9"9**:&q>tm_sec4/a>);="Ż        9    4a href="+code=seq_9rintf9 class="sref">seq_printf4/a>(4a href="+code81 174/a>44spau class="comment"> *"+cod8=tm_min" class="sref"L74">1 744/a>= *  based on arch/arm/commoam v39sref">tm_min4/a>);="๾c/rtc-procc.c#L9" idv3L9" class="lirintlirref">tm_min4m_mon4/a>n+ 1,14a href="+code=tm" c10c/rtc-pro0c.c#L10" idv3L10" class=01intlilass="line" nam v3L39">1 394/a>}=(4a href="+code81 174/a>44spau class="comment"> *"+cod8=tm_min" class="sref"L74">1 744/a>=1 674/a>n>.1 1    10lished by0 the Free Software Found03intli4/spaue=n>.1 1  const structL45" class="line" nam o"**\n"n>.1 1  const structL45" class="line" nam ortc4/a>)==<"+cod8=tm_min" class="sref"L74">1 744/a"line" nam v3L67">1 674/a>n>.1 1    10t;=tm_sec4c" clas0line" nam v3L67">1 674/a>n>.1 1    10="drivers0/rtc/rtc-proc.c#L17" idv08hntli clasm_mon4/a>n+ 1,14a href="+code=tm" c10 <1 484/a>n>.1 1  structn4a href="+co1tc/rtc-prooc.c#L9" idv3L9" class="lline"1nam v3="line" nam v3L40">1 404/a>#endif=#endif=ate" class="srefinde=a href="driversinde=*:&q,structn4a href="+code=r3L41">1 414/a>=1 414/a>=, &4a href="+code=alrm" class1paue=1 404/a>intn4a href="+codrc_procline" nam v3L67">1 674/a>n>.1 1    1blished byy the Free Software Founddaval11sref">tm_sec4oc.c#L44" idv3L44" class="line" nam v3L44">1 444/a>n>.1 1  intn4a href="+code=err" class="sref">err4/a>;=PDE_DATAseq4s="sref">rtc4/a>inde=a href="driversinde=*:&q"line" nam v3L67">1 674/a>n>.1 1    1#L12" idv33L12" class="line" nam v33L12"11 class="sref">seq_printf4/a>(4a href="+1 href="driivers/rtc/rtc-proc.c#L14"" idv115ode=offset" c37;="sref">false4/atry_#L13" _gintn4a href="+codtry_#L13" _ginseq4s="sref">rtc4/a>THIS_MODULode=strncmp" claTHIS_MODULo*:&q"/ue=tm_mon4/ac" clas-="sref">rtc4/a>ENODEVde=strncmp" claENODEVprocline" nam v3L67">1 674/a>n>.1 1    1bef="driveers/rtc/rtc-proc.c#L16" iidv3L16" claine" nam v3L67">1 674/a>n>.1 1    1b="driverss/rtc/rtc-proc.c#L17" idvv3L1711 class="sref" v3L40">1 404/a>intn4a href="+codrc_proc;=rtc4/a>3L41">1 414/a>=scnprintf4/a"line" nam v3L67">1 674/a>n>.1 1    1# <1 404/a>intn4a href="+codrc_proc/ue=seq_printf4/a>(4a href#L13" _puntn4a href="+cod#L13" _punseq4s="sref">rtc4/a>THIS_MODULode=strncmp" claTHIS_MODULo*:&q"line" nam v3L67">1 674/a>n>.1 1    1clude &qu1ot;1 544/a>nef="+code=size" class=>intn4a href="+codrc_procline" nam v3L67">1 674/a>n>.1 1    1>1 204/a>1=1 214/a>1#define14a href="+code=N1AME_S124/spaue=1 234/a>#if14a href="+1code=1efined" class nam v3L40">1 404/a>#endif=size4/a> >>#endif=ate" class="srefinde=a href="driversinde=*:&q,structn4a href="+code=r3L41">1 414/a>=1 414/a>=is_r1c_hctosys4/a>(structn4a href="+code=rtc_d1evice" cl1ass="sref">rtc_device4/a1>n*4a1href="+code=rtc" class="sref">rtcref">seq4/a>->4aeef="drivers/rtc/rtc-pro//rt" _releaef">size4/a> >//rt" _releaefseq4s="sref">rtc4/a>inde=a href="driversinde=*:&q+code=scnprintf" 3L41">1 414/a>=1 674/a>n>.1 1    1>ef="driveL25">1 254/a>{=rtc4/a>THIS_MODULode=strncmp" claTHIS_MODULo*:&q"line" nam v3L67">1 674/a>n>.1 1    1c="drivers3L27" class="line" nam v13L27"12ref="+code=rtc" claslass="sref">rtcref">seq4/a>->4aeef="dline" nam v3L67">1 674/a>n>.1 1    1c <nam 4/a>[4a href="1+code128">1 384/a>n>.1 1  return (4a href="+cod1sref">NAM1E_SIZE4/a>,14spau class=1"stri1319" class="line" nam v3L19">1 194/a>#in10" idv3L310" class="line" nam v3L310">1 104/a>n" classrtc4/a> = 4a href="+code=seqax_looper the f">seq4/a>->4ax_looper the fef="+ v3L40">1 404/a>#endif=seq4/a>->4a hrdif=(structn4a href="+code=rtc_d1_SIZE4/a>1)=seq_pris/rtc/rtc-proc.c#L58"dif=#endif=1 314/a1>n>.1 1          return 14a hr1f="+code=falsesec9ss="s6L69" cL58"">seq4/a>->4aeadseq4ef">seq_pris/rtc/rtc-proc.c#ass=L58"">seq4/a>->4ass=L58"seq4;,14a href="+code=C1ONFIG134"+code=falsesec9ss="s6L69" cllseek">seq4/a>->4llseekseq4ef">seq_ps/rtc/rtc-proc.c#ass=lseek">seq4/a>->4ass=lseekseq4;,14a href="+1code=135"+code=falsesec9ss="s6L69" cL5leaef">size4/a> >>eleaefseq4>seq_pris/rtc/rtc-proc.c#L58"dif=size4/a> >>#endif=1 674/a>n>.1 1    1code=is_r1tc_hctosys" class="sref"1>is_r13" claine" nam v3L67">1 674/a>n>.1 1    1evice" cl1ass="sref">rtc_device4/a1>n*4a1href="am v3rtc/rtc-proc.c#L58"dif=1 444/a>dif=1 444/a>n>.1 1  intn4a href="+code=err" class="sref">err4/a>/ue=1 sys4/a>(structn4a href="+code=rtc_d1e=rtc" cl1ass="sref">rtc4/a>->41a hre14"sref">rtc_read_alarm4/a>(4a hre idv3L35" class="line" nam v3L35">1 354/a>#else=4a href="+code=err" class="sref">err4/a>//ue=#endif=seq4/a>->4a hrdif=scnprintf4/a"line" nam v3L67">1 674/a>n>.1 1    1f="driver1s/rtc/rtc-proc.c#L40" id1v3L4014c#L21m_mon4/a>n+ 1,14a href="+code=tm" c1a>(struct1n4a href="+code=seq_file1" cla144/spaue=1 444/a>dif=1 444/a>n>.1 1  intn4a href="+code=err" class="sref">err4/a>/ue=1 434/a>{=rtc_d1evice4/a>n*4a href="+cod1e=rtc1 class="sref">ad_alarm4/a>(4a hre idv3L35" class="line" nam v3L35">1 354/a>#else=4a href="+code=err" class="sref">err4/a>//ue=tm_sec4/a>);=dif=dif=1 674/a>n>.1 1    1fvice" cl17" class="line" nam v3L417">1 14 clasm_mon4/a>n+ 1,14a href="+code=tm" c1roc.c#L481" idv3L48" class="line" 1nam v1L48">1
The original LXRidv3L8" ct"> * itmon4/a>n+http://sourceforge.nete/lijects/lxr">LXRilineunityf="d+c/dri experie" nal 14a ribu"> mon4/a>n+mailto:lxr@lux/p.no;4lxr@lux/p.no=9m_s
p v3hiden" nv3L48" subfooter">
lxr.lux/p.no kindly hostent"> mon4/a>n+http://www.redpill-lux/li.no;4Redpill Lux/li ASf="d+c/livint">of Luxuxsrtc4ult/rt84/a oper the f ser.1 1f since 1995.
p v3hidde/bodyide/htmle=