220-3.10-update_proc_code.patch 101 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945
  1. From 2826b9f6aa1ad2ac4c2846bbce10eb3378014555 Mon Sep 17 00:00:00 2001
  2. From: Jonas Gorski <jogo@openwrt.org>
  3. Date: Thu, 26 Sep 2013 12:28:35 +0200
  4. Subject: [PATCH 3/3] update proc code to fix compilation for 3.10
  5. Signed-off-by: Jonas Gorski <jogo@openwrt.org>
  6. ---
  7. tn7api.h | 63 ++-
  8. tn7atm.c | 330 ++++++--------
  9. tn7dsl.c | 1447 ++++++++++++++++++++++++++++++--------------------------------
  10. tn7sar.c | 91 ++--
  11. 4 files changed, 922 insertions(+), 1009 deletions(-)
  12. --- a/tn7api.h
  13. +++ b/tn7api.h
  14. @@ -86,27 +86,26 @@ void * tn7atm_memcpy(void * dst, void co
  15. /* tn7dsl.h */
  16. void tn7dsl_exit(void);
  17. int tn7dsl_init(void *priv);
  18. -int tn7dsl_proc_eoc(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  19. -int tn7dsl_proc_stats(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  20. +extern struct file_operations tn7dsl_proc_eoc_fops;
  21. +extern struct file_operations tn7dsl_proc_stats_fops;
  22. //#define ADV_DIAG_STATS 1 //CQ10275 To enable Adv Stats
  23. #ifdef ADV_DIAG_STATS
  24. -int tn7dsl_proc_adv_stats(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  25. -int tn7dsl_proc_adv_stats1(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  26. -int tn7dsl_proc_adv_stats2(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  27. -int tn7dsl_proc_adv_stats3(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  28. +extern struct file_operations tn7dsl_proc_adv_stats_fops;
  29. +extern struct file_operations tn7dsl_proc_adv1_stats_fops;
  30. +extern struct file_operations tn7dsl_proc_adv2_stats_fops;
  31. +extern struct file_operations tn7dsl_proc_adv3_stats_fops;
  32. //UR8_MERGE_START CQ10682 Jack Zhang
  33. -int tn7dsl_proc_dbg_cmsgs(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  34. -int tn7dsl_proc_dbg_rmsgs1(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  35. -int tn7dsl_proc_dbg_rmsgs2(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  36. -int tn7dsl_proc_dbg_rmsgs3(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  37. -int tn7dsl_proc_dbg_rmsgs4(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  38. +extern struct file_operations tn7dsl_proc_dbg_cmsgs_fops;
  39. +extern struct file_operations tn7dsl_proc_dbg_cmsgs1_fops;
  40. +extern struct file_operations tn7dsl_proc_dbg_cmsgs2_fops;
  41. +extern struct file_operations tn7dsl_proc_dbg_cmsgs3_fops;
  42. +extern struct file_operations tn7dsl_proc_dbg_cmsgs4_fops;
  43. //UR8_MERGE_END CQ10682*
  44. #endif //ADV_DIAG_STATS
  45. -int tn7dsl_proc_write_stats(struct file *fp, const char * buf, unsigned long count, void * data);
  46. -int tn7dsl_proc_modem(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  47. +extern struct file_operations tn7dsl_proc_modem_fops;
  48. int tn7dsl_handle_interrupt(void);
  49. void tn7dsl_dslmod_sysctl_register(void);
  50. @@ -127,31 +126,31 @@ unsigned int tn7dsl_get_memory(unsigned
  51. int os_atoi(const char *pStr);
  52. int os_atoh(const char *pStr);
  53. unsigned long os_atoul(const char *pStr);
  54. -int tn7dsl_proc_snr0(char* buf, char **start, off_t offset, int count, int *eof, void *data);
  55. -int tn7dsl_proc_snr1(char* buf, char **start, off_t offset, int count, int *eof, void *data);
  56. -int tn7dsl_proc_snr2(char* buf, char **start, off_t offset, int count, int *eof, void *data);
  57. -int tn7dsl_proc_bit_allocation(char* buf, char **start, off_t offset, int count, int *eof, void *data);
  58. -int tn7dsl_proc_ds_noise(char* buf, char **start, off_t offset, int count, int *eof, void *data);
  59. -int tn7dsl_proc_generic_read_result(char* buf, char **start, off_t offset, int count, int *eof, void *data);
  60. -int tn7dsl_proc_train_mode_export(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  61. +extern struct file_operations tn7dsl_proc_snr0_fops;
  62. +extern struct file_operations tn7dsl_proc_snr1_fops;
  63. +extern struct file_operations tn7dsl_proc_snr2_fops;
  64. +extern struct file_operations tn7dsl_proc_bit_allocation_fops;
  65. +extern struct file_operations tn7dsl_proc_ds_noise_fops;
  66. +extern struct file_operations tn7dsl_proc_generic_read_result_fops;
  67. +extern struct file_operations tn7dsl_proc_train_mode_export_fops;
  68. #ifndef NO_ADV_STATS
  69. -int tn7dsl_proc_SNRpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  70. -int tn7dsl_proc_QLNpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  71. +extern struct file_operations tn7dsl_proc_SNRpsds_fops;
  72. +extern struct file_operations tn7dsl_proc_QLNpsds_fops;
  73. // * UR8_MERGE_START CQ10979 Jack Zhang
  74. #ifdef TR69_HLIN_IN
  75. -//int tn7dsl_proc_HLINpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  76. -int tn7dsl_proc_HLINpsds1(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  77. -int tn7dsl_proc_HLINpsds2(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  78. -int tn7dsl_proc_HLINpsds3(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  79. -int tn7dsl_proc_HLINpsds4(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  80. +//extern struct file_operations tn7dsl_proc_HLINpsds_fops;
  81. +extern struct file_operations tn7dsl_proc_HLINpsds1_fops;
  82. +extern struct file_operations tn7dsl_proc_HLINpsds2_fops;
  83. +extern struct file_operations tn7dsl_proc_HLINpsds3_fops;
  84. +extern struct file_operations tn7dsl_proc_HLINpsds4_fops;
  85. #endif //TR69_HLIN_IN
  86. // * UR8_MERGE_END CQ10979*
  87. // * UR8_MERGE_START CQ11057 Jack Zhang
  88. #define TR69_PMD_IN
  89. #ifdef TR69_PMD_IN
  90. -//int tn7dsl_proc_PMDus(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  91. -int tn7dsl_proc_PMDus(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  92. +//extern struct file_operations tn7dsl_proc_PMDus_fops;
  93. +extern struct file_operations tn7dsl_proc_PMDus_fops;
  94. #endif //TR69_PMD_IN
  95. // * UR8_MERGE_END CQ11057 *
  96. #endif
  97. @@ -168,9 +167,9 @@ void tn7sar_get_sar_version(Tn7AtmPrivat
  98. int tn7sar_get_near_end_loopback_count(unsigned int *pF4count, unsigned int *pF5count);
  99. int tn7sar_oam_generation(void *privContext, int chan, int type, int vpi, int vci, int timeout);
  100. int tn7sar_get_stats(void *priv1);
  101. -int tn7sar_proc_sar_stat(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  102. +extern struct file_operations tn7sar_proc_sar_stat_fops;
  103. void tn7sar_get_sar_firmware_version(unsigned int *pdsp_version_ms, unsigned int *pdsp_version_ls);
  104. -int tn7sar_proc_oam_ping(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  105. -int tn7sar_proc_pvc_table(char* buf, char **start, off_t offset, int count,int *eof, void *data);
  106. +extern struct file_operations tn7sar_proc_oam_ping_fops;
  107. +extern struct file_operations tn7sar_proc_pvc_table_fops;
  108. int tn7sar_tx_flush(void *privContext, int chan, int queue, int skip);
  109. #endif __SGAPI_H
  110. --- a/tn7atm.c
  111. +++ b/tn7atm.c
  112. @@ -271,25 +271,15 @@ static int tn7atm_change_qos (struct atm
  113. static int tn7atm_detect (void);
  114. static int tn7atm_init (struct atm_dev *dev);
  115. static int tn7atm_irq_request (struct atm_dev *dev);
  116. -static int tn7atm_proc_version (char *buf, char **start, off_t offset,
  117. - int count, int *eof, void *data);
  118. +
  119. +static struct file_operations tn7atm_proc_version_fops;
  120. static void tn7atm_exit (void);
  121. -static int tn7atm_proc_channels (char *buf, char **start, off_t offset,
  122. - int count, int *eof, void *data);
  123. -static int tn7atm_proc_private (char *buf, char **start, off_t offset,
  124. - int count, int *eof, void *data);
  125. +static struct file_operations tn7atm_proc_channels_fops;
  126. +static struct file_operations tn7atm_proc_private_fops;
  127. inline static int tn7atm_queue_packet_to_sar (void *vcc1, void *skb1,
  128. int chan);
  129. -static int tn7atm_xlate_proc_name (const char *name,
  130. - struct proc_dir_entry **ret,
  131. - const char **residual);
  132. -static int tn7atm_proc_match (int len, const char *name,
  133. - struct proc_dir_entry *de);
  134. -static int tn7atm_proc_qos_read (char *buf, char **start, off_t offset,
  135. - int count, int *eof, void *data);
  136. -static int tn7atm_proc_qos_write (struct file *fp, const char *buf,
  137. - unsigned long count, void *data);
  138. +static struct file_operations tn7atm_proc_qos_fops;
  139. //CT - Added function to return chipset Id
  140. void tn7atm_get_chipsetId (char *pVerId);
  141. @@ -412,60 +402,59 @@ static int proc_root_already_exists = TR
  142. static struct
  143. {
  144. const unsigned char name[32];
  145. - int (*read_func) (char* , char **, off_t , int ,int *, void *);
  146. - int (*write_func) (struct file *, const char * , unsigned long , void *);
  147. + struct file_operations *fops;
  148. } proc_if[] = {
  149. - {"avsar_ver", tn7atm_proc_version, NULL},
  150. - {"avsar_channels", tn7atm_proc_channels, NULL},
  151. - {"avsar_sarhal_stats", tn7sar_proc_sar_stat, NULL},
  152. - {"avsar_oam_ping", tn7sar_proc_oam_ping, NULL},
  153. - {"avsar_pvc_table", tn7sar_proc_pvc_table, NULL},
  154. - {"avsar_rxsnr0", tn7dsl_proc_snr0, NULL},
  155. - {"avsar_rxsnr1", tn7dsl_proc_snr1, NULL},
  156. - {"avsar_rxsnr2", tn7dsl_proc_snr2, NULL},
  157. - {"clear_eoc_stats", tn7dsl_proc_eoc, NULL},
  158. - {"avsar_bit_allocation_table", tn7dsl_proc_bit_allocation, NULL},
  159. - {"avsar_dsl_modulation_schemes",tn7dsl_proc_train_mode_export, NULL},
  160. + {"avsar_ver", &tn7atm_proc_version_fops},
  161. + {"avsar_channels", &tn7atm_proc_channels_fops},
  162. + {"avsar_sarhal_stats", &tn7sar_proc_sar_stat_fops},
  163. + {"avsar_oam_ping", &tn7sar_proc_oam_ping_fops},
  164. + {"avsar_pvc_table", &tn7sar_proc_pvc_table_fops},
  165. + {"avsar_rxsnr0", &tn7dsl_proc_snr0_fops},
  166. + {"avsar_rxsnr1", &tn7dsl_proc_snr1_fops},
  167. + {"avsar_rxsnr2", &tn7dsl_proc_snr2_fops},
  168. + {"clear_eoc_stats", &tn7dsl_proc_eoc_fops},
  169. + {"avsar_bit_allocation_table", &tn7dsl_proc_bit_allocation_fops},
  170. + {"avsar_dsl_modulation_schemes",&tn7dsl_proc_train_mode_export_fops},
  171. #ifndef NO_ADV_STATS
  172. - {"avsar_SNRpsds", tn7dsl_proc_SNRpsds, NULL},
  173. - {"avsar_QLNpsds", tn7dsl_proc_QLNpsds, NULL},
  174. + {"avsar_SNRpsds", &tn7dsl_proc_SNRpsds_fops},
  175. + {"avsar_QLNpsds", &tn7dsl_proc_QLNpsds_fops},
  176. // * UR8_MERGE_START CQ10979 Jack Zhang
  177. #ifdef TR69_HLIN_IN
  178. -// {"avsar_HLINpsds", tn7dsl_proc_HLINpsds, NULL},
  179. - {"avsar_HLINpsds1", tn7dsl_proc_HLINpsds1, NULL},
  180. - {"avsar_HLINpsds2", tn7dsl_proc_HLINpsds2, NULL},
  181. - {"avsar_HLINpsds3", tn7dsl_proc_HLINpsds3, NULL},
  182. - {"avsar_HLINpsds4", tn7dsl_proc_HLINpsds4, NULL},
  183. +// {"avsar_HLINpsds", &tn7dsl_proc_HLINpsds_fops},
  184. + {"avsar_HLINpsds1", &tn7dsl_proc_HLINpsds1_fops},
  185. + {"avsar_HLINpsds2", &tn7dsl_proc_HLINpsds2_fops},
  186. + {"avsar_HLINpsds3", &tn7dsl_proc_HLINpsds3_fops},
  187. + {"avsar_HLINpsds4", &tn7dsl_proc_HLINpsds4_fops},
  188. #endif //TR69_HLIN_IN
  189. // * UR8_MERGE_END CQ10979*
  190. // * UR8_MERGE_START CQ11057 Jack Zhang
  191. #define TR69_PMD_IN
  192. #ifdef TR69_PMD_IN
  193. - {"avsar_PMDTestus", tn7dsl_proc_PMDus, NULL},
  194. -// {"avsar_PMDTestus1", tn7dsl_proc_PMDus1, NULL},
  195. + {"avsar_PMDTestus", &tn7dsl_proc_PMDus_fops},
  196. +// {"avsar_PMDTestus1", &tn7dsl_proc_PMDus1_fops},
  197. #endif //TR69_PMD_IN
  198. // * UR8_MERGE_END CQ11057 *
  199. #endif
  200. - {"avsar_private", tn7atm_proc_private, NULL},
  201. - {"avsar_modem_training", tn7dsl_proc_modem, NULL},
  202. - {"avsar_modem_stats", tn7dsl_proc_stats, tn7dsl_proc_write_stats},
  203. + {"avsar_private", &tn7atm_proc_private_fops},
  204. + {"avsar_modem_training", &tn7dsl_proc_modem_fops},
  205. + {"avsar_modem_stats", &tn7dsl_proc_stats_fops},
  206. #ifdef ADV_DIAG_STATS //CQ10275
  207. -//for 2.6 {"avsar_modem_adv_stats", tn7dsl_proc_adv_stats, NULL},
  208. +//for 2.6 {"avsar_modem_adv_stats", &tn7dsl_proc_adv_stats_fops},
  209. //For 2.4 kernel, due to proc file system size limitation
  210. - {"avsar_modem_adv_stats1", tn7dsl_proc_adv_stats1, NULL},
  211. - {"avsar_modem_adv_stats2", tn7dsl_proc_adv_stats2, NULL},
  212. - {"avsar_modem_adv_stats3", tn7dsl_proc_adv_stats3, NULL},
  213. + {"avsar_modem_adv_stats1", &tn7dsl_proc_adv_stats1_fops},
  214. + {"avsar_modem_adv_stats2", &tn7dsl_proc_adv_stats2_fops},
  215. + {"avsar_modem_adv_stats3", &tn7dsl_proc_adv_stats3_fops},
  216. //UR8_MERGE_START CQ10682 Jack Zhang
  217. - {"avsar_modem_dbg_cmsgs", tn7dsl_proc_dbg_cmsgs, NULL},
  218. - {"avsar_modem_dbg_rmsgs1", tn7dsl_proc_dbg_rmsgs1, NULL},
  219. - {"avsar_modem_dbg_rmsgs2", tn7dsl_proc_dbg_rmsgs2, NULL},
  220. - {"avsar_modem_dbg_rmsgs3", tn7dsl_proc_dbg_rmsgs3, NULL},
  221. - {"avsar_modem_dbg_rmsgs4", tn7dsl_proc_dbg_rmsgs4, NULL},
  222. + {"avsar_modem_dbg_cmsgs", &tn7dsl_proc_dbg_cmsgs_fops},
  223. + {"avsar_modem_dbg_rmsgs1", &tn7dsl_proc_dbg_rmsgs1_fops},
  224. + {"avsar_modem_dbg_rmsgs2", &tn7dsl_proc_dbg_rmsgs2_fops},
  225. + {"avsar_modem_dbg_rmsgs3", &tn7dsl_proc_dbg_rmsgs3_fops},
  226. + {"avsar_modem_dbg_rmsgs4", &tn7dsl_proc_dbg_rmsgs4_fops},
  227. // UR8_MERGE_END CQ10682*
  228. #endif //ADV_DIAG_STATS
  229. - {"avsar_qos_enable", tn7atm_proc_qos_read, tn7atm_proc_qos_write}
  230. + {"avsar_qos_enable", &tn7atm_proc_qos_fops}
  231. };
  232. /* *INDENT-ON* */
  233. @@ -1703,75 +1692,81 @@ int tn7atm_receive (void *os_dev, int ch
  234. return 0;
  235. }
  236. -static int tn7atm_proc_channels (char *buf, char **start, off_t offset,
  237. - int count, int *eof, void *data)
  238. +static int tn7atm_proc_channels (struct seq_file *m, void *data)
  239. {
  240. - int len = 0;
  241. - int limit = count - 80;
  242. int i;
  243. struct atm_dev *dev;
  244. Tn7AtmPrivate *priv;
  245. - dev = (struct atm_dev *) data;
  246. + dev = (struct atm_dev *) m->private;
  247. priv = (Tn7AtmPrivate *) dev->dev_data;
  248. - if (len <= limit)
  249. - len += sprintf (buf + len, "Chan Inuse ChanID VPI VCI \n");
  250. - if (len <= limit)
  251. - len +=
  252. - sprintf (buf + len,
  253. + seq_printf (m, "Chan Inuse ChanID VPI VCI \n");
  254. + seq_printf (m,
  255. "------------------------------------------------------------------\n");
  256. for (i = 0; i <= MAX_DMA_CHAN; i++)
  257. {
  258. - if (len <= limit)
  259. - {
  260. - len += sprintf (buf + len,
  261. - " %02d %05d %05d %05d %05d \n",
  262. - i, priv->lut[i].inuse, priv->lut[i].chanid,
  263. - priv->lut[i].vpi, priv->lut[i].vci);
  264. - }
  265. + seq_printf (m,
  266. + " %02d %05d %05d %05d %05d \n",
  267. + i, priv->lut[i].inuse, priv->lut[i].chanid,
  268. + priv->lut[i].vpi, priv->lut[i].vci);
  269. }
  270. - if (len <= limit)
  271. - len +=
  272. - sprintf (buf + len,
  273. + seq_printf (m,
  274. "------------------------------------------------------------------\n");
  275. - return len;
  276. + return 0;
  277. }
  278. -static int tn7atm_proc_private (char *buf, char **start, off_t offset,
  279. - int count, int *eof, void *data)
  280. +static int tn7atm_proc_channels_open(struct inode *inode, struct file *file)
  281. +{
  282. + return single_open(file, tn7atm_proc_channels, PDE_DATA(inode));
  283. +}
  284. +
  285. +static struct file_operations tn7atm_proc_channels_fops = {
  286. + .owner = THIS_MODULE,
  287. + .open = tn7atm_proc_channels_open,
  288. + .read = seq_read,
  289. + .llseek = seq_lseek,
  290. + .release = single_release,
  291. +};
  292. +
  293. +
  294. +static int tn7atm_proc_private (struct seq_file *m, void *data)
  295. {
  296. - int len = 0;
  297. - int limit = count - 80;
  298. struct atm_dev *dev;
  299. Tn7AtmPrivate *priv;
  300. - dev = (struct atm_dev *) data;
  301. + dev = (struct atm_dev *) m->private;
  302. priv = (Tn7AtmPrivate *) dev->dev_data;
  303. - if (len <= limit)
  304. - len += sprintf (buf + len, "\nPrivate Data Structure(%s):\n", priv->name);
  305. - if (len <= limit)
  306. - len += sprintf (buf + len, "----------------------------------------\n");
  307. - if (len <= limit)
  308. - len += sprintf (buf + len, "priv: 0x%p\n", priv);
  309. - if (len <= limit)
  310. - len += sprintf (buf + len, "next: 0x%p", priv->next);
  311. - if (len <= limit)
  312. - len += sprintf (buf + len, "\tdev: 0x%p\n", priv->dev);
  313. -
  314. - if (len <= limit)
  315. - len += sprintf (buf + len, "tx_irq: %02d", priv->sar_irq);
  316. - if (len <= limit)
  317. - len += sprintf (buf + len, "rx_irq: %02d", priv->dsl_irq);
  318. + seq_printf (m, "\nPrivate Data Structure(%s):\n", priv->name);
  319. + seq_printf (m, "----------------------------------------\n");
  320. + seq_printf (m, "priv: 0x%p\n", priv);
  321. + seq_printf (m, "next: 0x%p", priv->next);
  322. + seq_printf (m, "\tdev: 0x%p\n", priv->dev);
  323. +
  324. + seq_printf (m, "tx_irq: %02d", priv->sar_irq);
  325. + seq_printf (m, "rx_irq: %02d", priv->dsl_irq);
  326. +
  327. + return 0;
  328. +}
  329. - return len;
  330. +static int tn7atm_proc_private_open(struct inode *inode, struct file *file)
  331. +{
  332. + return single_open(file, tn7atm_proc_private, PDE_DATA(inode));
  333. }
  334. +static struct file_operations tn7atm_proc_private_fops = {
  335. + .owner = THIS_MODULE,
  336. + .open = tn7atm_proc_private_open,
  337. + .read = seq_read,
  338. + .llseek = seq_lseek,
  339. + .release = single_release,
  340. +};
  341. +
  342. void tn7atm_sarhal_isr_register (void *os_dev, void *hal_isr,
  343. int interrupt_num)
  344. {
  345. @@ -1890,10 +1885,8 @@ static int __init tn7atm_register (Tn7At
  346. return ATM_REG_OK;
  347. }
  348. -static int tn7atm_proc_version (char *buf, char **start, off_t offset,
  349. - int count, int *eof, void *data)
  350. +static int tn7atm_proc_version (struct seq_file *m, void *data)
  351. {
  352. - int len = 0;
  353. char dslVer[8];
  354. char dspVer[10];
  355. char chipsetID[32]; //CT CQ10076 - Added temporary buffer to store chipset Id
  356. @@ -1904,56 +1897,64 @@ static int tn7atm_proc_version (char *bu
  357. priv = mydev->dev_data;
  358. - len +=
  359. - sprintf (buf + len, "ATM Driver version:[%d.%02d.%02d.%02d]\n",
  360. - LINUXATM_VERSION_MAJOR, LINUXATM_VERSION_MINOR,
  361. - LINUXATM_VERSION_BUGFIX, LINUXATM_VERSION_BUILDNUM);
  362. + seq_printf (m, "ATM Driver version:[%d.%02d.%02d.%02d]\n",
  363. + LINUXATM_VERSION_MAJOR, LINUXATM_VERSION_MINOR,
  364. + LINUXATM_VERSION_BUGFIX, LINUXATM_VERSION_BUILDNUM);
  365. tn7dsl_get_dslhal_version (dslVer);
  366. - len +=
  367. - sprintf (buf + len, "DSL HAL version: [%d.%02d.%02d.%02d]\n", dslVer[0],
  368. - dslVer[1], dslVer[2], dslVer[3]);
  369. + seq_printf (m, "DSL HAL version: [%d.%02d.%02d.%02d]\n", dslVer[0],
  370. + dslVer[1], dslVer[2], dslVer[3]);
  371. tn7dsl_get_dsp_version (dspVer);
  372. - len +=
  373. - sprintf (buf + len, "DSP Datapump version: [%d.%02d.%02d.%02d] ",
  374. - dspVer[4], dspVer[5], dspVer[6], dspVer[7]);
  375. + seq_printf (m, "DSP Datapump version: [%d.%02d.%02d.%02d] ",
  376. + dspVer[4], dspVer[5], dspVer[6], dspVer[7]);
  377. if (dspVer[8] == 2) // annex B
  378. - len += sprintf (buf + len, "Annex B\n");
  379. + seq_printf (m, "Annex B\n");
  380. else if (dspVer[8] == 3) // annex c
  381. - len += sprintf (buf + len, "Annex c\n");
  382. + seq_printf (m, "Annex c\n");
  383. else
  384. - len += sprintf (buf + len, "Annex A\n");
  385. + seq_printf (m, "Annex A\n");
  386. tn7sar_get_sar_version (priv, &pSarVer);
  387. - len += sprintf (buf + len, "SAR HAL version: [");
  388. + seq_printf (m, "SAR HAL version: [");
  389. for (i = 0; i < 8; i++)
  390. {
  391. - len += sprintf (buf + len, "%c", pSarVer[i + 7]);
  392. + seq_printf (m, "%c", pSarVer[i + 7]);
  393. }
  394. - len += sprintf (buf + len, "]\n");
  395. + seq_printf (m, "]\n");
  396. tn7sar_get_sar_firmware_version (&pdspV1, &pdspV2);
  397. - len += sprintf (buf + len, "PDSP Firmware version:[%01x.%02x]\n",
  398. + seq_printf (m, "PDSP Firmware version:[%01x.%02x]\n",
  399. pdspV1, pdspV2);
  400. //CT CQ10076 - Added code to report chipset ID using proc file system
  401. tn7atm_get_chipsetId(chipsetID);
  402. - len += sprintf (buf + len, "Chipset ID: [%s]\n",chipsetID);
  403. + seq_printf (m, "Chipset ID: [%s]\n",chipsetID);
  404. - return len;
  405. + return 0;
  406. }
  407. +static int tn7atm_proc_version_open(struct inode *inode, struct file *file)
  408. +{
  409. + return single_open(file, tn7atm_proc_version, PDE_DATA(inode));
  410. +}
  411. +
  412. +static struct file_operations tn7atm_proc_version_fops = {
  413. + .owner = THIS_MODULE,
  414. + .open = tn7atm_proc_version_open,
  415. + .read = seq_read,
  416. + .llseek = seq_lseek,
  417. + .release = single_release,
  418. +};
  419. +
  420. /* Device detection */
  421. static int __init tn7atm_detect (void)
  422. {
  423. Tn7AtmPrivate *priv;
  424. - struct proc_dir_entry *dsl_wr_file = NULL; /* Only for ones with a write
  425. - * function. */
  426. int ctr;
  427. const char *residual;
  428. @@ -2002,24 +2003,7 @@ static int __init tn7atm_detect (void)
  429. */
  430. for (ctr = 0; ctr < (NUM_ELEMS (proc_if)); ctr++)
  431. {
  432. - /* Only if we have a write function, we create a normal proc file. */
  433. - if(proc_if[ctr].write_func)
  434. - {
  435. - dsl_wr_file = create_proc_entry (proc_if[ctr].name, DRV_PROC_MODE, root_proc_dir_entry);
  436. - if (dsl_wr_file)
  437. - {
  438. - dsl_wr_file->read_proc = proc_if[ctr].read_func;
  439. - dsl_wr_file->write_proc = proc_if[ctr].write_func;
  440. - dsl_wr_file->data = (void *)mydev; //UR8_MERGE_START_END CQ10700 Manjula K
  441. - }
  442. - dsl_wr_file = NULL;
  443. - }
  444. - else
  445. - {
  446. - /* Create a read-only entry. */
  447. - create_proc_read_entry (proc_if[ctr].name, 0, root_proc_dir_entry,
  448. - proc_if[ctr].read_func, mydev);
  449. - }
  450. + proc_create_data(proc_if[ctr].name, DRV_PROC_MODE, root_proc_dir_entry, proc_if[ctr].fops, (void *)mydev);
  451. }
  452. tn7dsl_dslmod_sysctl_register ();
  453. @@ -2491,63 +2475,10 @@ static int tn7atm_set_can_support_adsl2
  454. return TRUE;
  455. }
  456. -/*
  457. - * This function matches a name such as "serial", and that specified by the
  458. - * proc_dir_entry
  459. - */
  460. -static int tn7atm_proc_match (int len, const char *name,
  461. - struct proc_dir_entry *de)
  462. +static int tn7atm_proc_qos_read(struct seq_file *m, void *data)
  463. {
  464. - if (!de || !de->low_ino)
  465. - return 0;
  466. - if (de->namelen != len)
  467. + seq_printf (m, "\nEnableQoS = %d\n", EnableQoS);
  468. return 0;
  469. - return !strncmp (name, de->name, len);
  470. -}
  471. -
  472. -/*
  473. - * This function parses a name such as "tty/driver/serial", and
  474. - * returns the struct proc_dir_entry for "/proc/tty/driver", and
  475. - * returns "serial" in residual.
  476. - */
  477. -static int tn7atm_xlate_proc_name (const char *name,
  478. - struct proc_dir_entry **ret,
  479. - const char **residual)
  480. -{
  481. - const char *cp = name, *next;
  482. - struct proc_dir_entry *de;
  483. - int len;
  484. - extern struct proc_dir_entry proc_root;
  485. -
  486. - de = &proc_root;
  487. - while (1)
  488. - {
  489. - next = strchr (cp, '/');
  490. - if (!next)
  491. - break;
  492. -
  493. - len = next - cp;
  494. - for (de = de->subdir; de; de = de->next)
  495. - {
  496. - if (tn7atm_proc_match (len, cp, de))
  497. - break;
  498. - }
  499. - if (!de)
  500. - return -ENOENT;
  501. - cp += len + 1;
  502. - }
  503. - *residual = cp;
  504. - *ret = de;
  505. -
  506. - return 0;
  507. -}
  508. -
  509. -static int tn7atm_proc_qos_read(char *buf, char **start, off_t offset, int count, int *eof, void *data)
  510. -{
  511. - int len = 0;
  512. -
  513. - len += sprintf (buf + len, "\nEnableQoS = %d\n", EnableQoS);
  514. - return len;
  515. }
  516. static int tn7atm_proc_qos_write(struct file *fp, const char *buf, unsigned long count, void *data)
  517. @@ -2581,5 +2512,19 @@ static int tn7atm_proc_qos_write(struct
  518. return count;
  519. }
  520. +static int tn7atm_proc_qos_open(struct inode *inode, struct file *file)
  521. +{
  522. + return single_open(file, tn7atm_proc_qos_read, PDE_DATA(inode));
  523. +}
  524. +
  525. +static struct file_operations tn7atm_proc_qos_fops = {
  526. + .owner = THIS_MODULE,
  527. + .open = tn7atm_proc_qos_open,
  528. + .read = seq_read,
  529. + .llseek = seq_lseek,
  530. + .release = single_release,
  531. + .write = tn7atm_proc_qos_write,
  532. +};
  533. +
  534. module_init (tn7atm_detect);
  535. module_exit (tn7atm_exit);
  536. --- a/tn7dsl.c
  537. +++ b/tn7dsl.c
  538. @@ -339,7 +339,7 @@ static void tn7dsl_register_dslss_led(vo
  539. void tn7dsl_dslmod_sysctl_register(void);
  540. void tn7dsl_dslmod_sysctl_unregister(void);
  541. static int tn7dsl_clear_eoc_receive(void);
  542. -static int tn7dsl_proc_snr_print (char *buf, int count, int *eof, int data);
  543. +static int tn7dsl_proc_snr_print (struct seq_file *m, int data);
  544. /* end of internal functions */
  545. // UR8_MERGE_START CQ11054 Jack Zhang
  546. @@ -635,11 +635,9 @@ void shim_osCriticalExit(void)
  547. spin_unlock_irqrestore(&shimLock, flags);
  548. }
  549. -static int tn7dsl_proc_snr_print (char *buf, int count, int *eof, int data)
  550. +static int tn7dsl_proc_snr_print (struct seq_file *m, int data)
  551. {
  552. - int len = 0;
  553. - int limit = count - 80;
  554. int i, j;
  555. int bin = (int) data;
  556. unsigned short *rxSnrPerBin;
  557. @@ -660,95 +658,128 @@ static int tn7dsl_proc_snr_print (char *
  558. break;
  559. default:
  560. - if(len<=limit)
  561. - len += sprintf (buf + len, "\nInvalid bin selected Bin%d :\n", bin);
  562. - return len;
  563. -}
  564. + seq_printf (m, "\nInvalid bin selected Bin%d :\n", bin);
  565. + return 0;
  566. + }
  567. - if(len<=limit)
  568. - len += sprintf (buf + len, "\nAR7 DSL Modem Rx SNR Per Bin for Bin%d :\n", bin);
  569. + seq_printf (m, "\nAR7 DSL Modem Rx SNR Per Bin for Bin%d :\n", bin);
  570. for (i=0; i<pIhw->AppData.max_ds_tones/16; i++)
  571. {
  572. for(j=0;j<16;j++)
  573. {
  574. - if(len <=limit)
  575. - len +=
  576. - sprintf (buf + len, "%04x ",
  577. + seq_printf (m, "%04x ",
  578. (unsigned short) rxSnrPerBin[i * 16 + j]);
  579. - }
  580. - if(len <=limit)
  581. - len += sprintf(buf+len, "\n");
  582. }
  583. + seq_printf(m, "\n");
  584. + }
  585. - return len;
  586. + return 0;
  587. }
  588. //@Added SNR per bin info per customer request. 05-14-2004
  589. -int tn7dsl_proc_snr0 (char *buf, char **start, off_t offset, int count,
  590. - int *eof, void *data)
  591. +static int tn7dsl_proc_snr0 (struct seq_file *m, void *data)
  592. {
  593. - return tn7dsl_proc_snr_print(buf, count, eof, 0);
  594. + return tn7dsl_proc_snr_print(m, 0);
  595. }
  596. -int tn7dsl_proc_snr1 (char *buf, char **start, off_t offset, int count,
  597. - int *eof, void *data)
  598. +static int tn7dsl_proc_snr0_open(struct inode *inode, struct file *file)
  599. {
  600. - return tn7dsl_proc_snr_print(buf, count, eof, 1);
  601. + return single_open(file, tn7dsl_proc_snr0, PDE_DATA(inode));
  602. +}
  603. +
  604. +struct file_operations tn7dsl_proc_snr0_fops = {
  605. + .owner = THIS_MODULE,
  606. + .open = tn7dsl_proc_snr0_open,
  607. + .read = seq_read,
  608. + .llseek = seq_lseek,
  609. + .release = single_release,
  610. +};
  611. +
  612. +static int tn7dsl_proc_snr1 (struct seq_file *m, void *data)
  613. +{
  614. + return tn7dsl_proc_snr_print(m, 1);
  615. }
  616. -int tn7dsl_proc_snr2 (char *buf, char **start, off_t offset, int count,
  617. - int *eof, void *data)
  618. +static int tn7dsl_proc_snr1_open(struct inode *inode, struct file *file)
  619. {
  620. - return tn7dsl_proc_snr_print(buf, count, eof, 2);
  621. + return single_open(file, tn7dsl_proc_snr1, PDE_DATA(inode));
  622. }
  623. +struct file_operations tn7dsl_proc_snr1_fops = {
  624. + .owner = THIS_MODULE,
  625. + .open = tn7dsl_proc_snr1_open,
  626. + .read = seq_read,
  627. + .llseek = seq_lseek,
  628. + .release = single_release,
  629. +};
  630. +
  631. +static int tn7dsl_proc_snr2 (struct seq_file *m, void *data)
  632. +{
  633. + return tn7dsl_proc_snr_print(m, 2);
  634. +}
  635. +
  636. +static int tn7dsl_proc_snr2_open(struct inode *inode, struct file *file)
  637. +{
  638. + return single_open(file, tn7dsl_proc_snr2, PDE_DATA(inode));
  639. +}
  640. +
  641. +struct file_operations tn7dsl_proc_snr2_fops = {
  642. + .owner = THIS_MODULE,
  643. + .open = tn7dsl_proc_snr2_open,
  644. + .read = seq_read,
  645. + .llseek = seq_lseek,
  646. + .release = single_release,
  647. +};
  648. +
  649. //@Added bit allocation table per customer request. 05-14-2004
  650. -int tn7dsl_proc_bit_allocation (char *buf, char **start, off_t offset,
  651. - int count, int *eof, void *data)
  652. +static int tn7dsl_proc_bit_allocation (struct seq_file *m, void *data)
  653. {
  654. - int len = 0;
  655. - int limit = count - 80;
  656. int i, j;
  657. - if(len<=limit)
  658. - len += sprintf(buf+len, "\nAR7 DSL Modem US Bit Allocation:");
  659. + seq_printf(m, "\nAR7 DSL Modem US Bit Allocation:");
  660. for(i=0; i<pIhw->AppData.max_us_tones; i++)
  661. {
  662. if (!(i%16))
  663. {
  664. - if(len <=limit)
  665. - len += sprintf(buf+len, "\n");
  666. + seq_printf(m, "\n");
  667. }
  668. - if(len <=limit)
  669. - len +=
  670. - sprintf (buf + len, "%02x ",
  671. - (unsigned char) pIhw->AppData.BitAllocTblUstrm[i]);
  672. + seq_printf (m, "%02x ",
  673. + (unsigned char) pIhw->AppData.BitAllocTblUstrm[i]);
  674. }
  675. - if(len<=limit)
  676. - len += sprintf(buf+len, "\n\nAR7 DSL Modem DS Bit Allocation:\n");
  677. + seq_printf(m, "\n\nAR7 DSL Modem DS Bit Allocation:\n");
  678. for (i=0; i<pIhw->AppData.max_ds_tones/16; i++)
  679. {
  680. for(j=0;j<16;j++)
  681. {
  682. - if(len <=limit)
  683. - len +=
  684. - sprintf (buf + len, "%02x ",
  685. - (unsigned char) pIhw->AppData.BitAllocTblDstrm[i * 16 +
  686. - j]);
  687. + seq_printf (m, "%02x ",
  688. + (unsigned char) pIhw->AppData.BitAllocTblDstrm[i * 16 +
  689. + j]);
  690. }
  691. - if(len <=limit)
  692. - len += sprintf(buf+len, "\n");
  693. + seq_printf(m, "\n");
  694. }
  695. - return len;
  696. + return 0;
  697. +}
  698. +
  699. +int tn7dsl_proc_bit_allocation_open(struct inode *inode, struct file *file)
  700. +{
  701. + return single_open(file, tn7dsl_proc_bit_allocation, PDE_DATA(inode));
  702. }
  703. +struct file_operations tn7dsl_proc_bit_allocation_fops = {
  704. + .owner = THIS_MODULE,
  705. + .open = tn7dsl_proc_bit_allocation_open,
  706. + .read = seq_read,
  707. + .llseek = seq_lseek,
  708. + .release = single_release,
  709. +};
  710. +
  711. #ifndef NO_ACT
  712. int tn7dsl_proc_ds_noise(char* buf, char **start, off_t offset, int count,
  713. int *eof, void *data)
  714. @@ -811,59 +842,48 @@ static char *pUnknown= "Unknown";
  715. #ifdef ADV_DIAG_STATS //CQ10275, CQ10449
  716. //UR8_MERGE_START CQ10449 Jack Zhang
  717. -static int proc_adv_stats_header(char* buf, int limit);
  718. +static int proc_adv_stats_header(struct seq_file *m);
  719. -int tn7dsl_proc_adv_stats(char* buf, char **start, off_t offset, int count,
  720. - int *eof, void *data)
  721. +static int tn7dsl_proc_adv_stats(struct seq_file *m, void *data)
  722. {
  723. - int len = 0;
  724. - int limit = count - 80;
  725. //char *cp = buf + offset;
  726. char *cp = buf;
  727. int i = 0;
  728. int strt = 32;
  729. - static int ctr = 0;
  730. // printk("proc_adv_stats: buf=0x%X, ctr=%d, offset=%d, count=%d, eof=%d\n",
  731. // (unsigned int)buf, ctr, offset, count, *eof);
  732. - if( ctr == 0)
  733. - {
  734. - len = proc_adv_stats_header( cp, limit);
  735. -
  736. - if( len<=limit)
  737. - len += sprintf(cp+len, "\n\tBin No.\tBits:\tMargin:\tSNR\n");
  738. - }
  739. - else
  740. - {
  741. - strt = ctr;
  742. - }
  743. -
  744. + proc_adv_stats_header(m);
  745. +
  746. + seq_printf(m, "\n\tBin No.\tBits:\tMargin:\tSNR\n");
  747. +
  748. for( i =strt; i<512; i++)
  749. {
  750. - if(len<=limit)
  751. - {
  752. - len += sprintf(cp+len, "\t%u\t%u\t%u\t%d\n", i,
  753. + seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
  754. (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
  755. (unsigned int)pIhw->AppData.marginTblDstrm[i],
  756. (int)pIhw->AppData.rxSnrPerBin0[i]);
  757. - }
  758. - else
  759. - {
  760. - ctr = i;
  761. - //*eof = 0;
  762. - *(cp + len) = '\0';
  763. - printk("proc_adv_stats - return: ctr=%d, len=%d\n", ctr, len);
  764. - return len;
  765. - }
  766. }
  767. - ctr = 0;
  768. - *eof = 1;
  769. printk("proc_adv_stats - return: ctr=%d, len=%d\n", ctr, len);
  770. - return len;
  771. + return 0;
  772. +}
  773. +
  774. +
  775. +static int tn7dsl_proc_adv_stats_open(struct inode *inode, struct file *file)
  776. +{
  777. + return single_open(file, tn7dsl_proc_adv_stats, PDE_DATA(inode));
  778. }
  779. -static int proc_adv_stats_header(char* buf, int limit)
  780. +struct file_operations tn7dsl_proc_adv_stats_fops = {
  781. + .owner = THIS_MODULE,
  782. + .open = tn7dsl_proc_adv_stats_open,
  783. + .read = seq_read,
  784. + .llseek = seq_lseek,
  785. + .release = single_release,
  786. +};
  787. +
  788. +static int proc_adv_stats_header(struct seq_file *m)
  789. {
  790. int len = 0;
  791. int i = 0;
  792. @@ -872,66 +892,53 @@ static int proc_adv_stats_header(char* b
  793. */
  794. dslhal_api_gatherStatistics(pIhw);
  795. - if(len<=limit)
  796. - len += sprintf(buf+len, "\nAR7 DSL Modem Advanced Statistics:\n");
  797. + seq_printf(m, "\nAR7 DSL Modem Advanced Statistics:\n");
  798. - if(len<=limit)
  799. + if(pIhw->lConnected != 1)
  800. {
  801. - if(pIhw->lConnected != 1)
  802. - {
  803. - pIhw->AppData.USConRate = 0;
  804. - pIhw->AppData.DSConRate = 0;
  805. - }
  806. - len +=
  807. - sprintf (buf + len,
  808. + pIhw->AppData.USConRate = 0;
  809. + pIhw->AppData.DSConRate = 0;
  810. + }
  811. + seq_printf (m,
  812. "\t[Connection Rate]\tUS:\t%u\tDS:\t%u\n",
  813. (unsigned int)pIhw->AppData.USConRate,
  814. (unsigned int)pIhw->AppData.DSConRate );
  815. }
  816. - if(len<=limit)
  817. // UR8_MERGE_START CQ11054 Jack Zhang
  818. + if (dslhal_api_getHighPrecision())
  819. {
  820. - if (dslhal_api_getHighPrecision())
  821. - {
  822. - len +=
  823. - sprintf (buf + len, "\t[Margin]\tUS:\t%d.%u\tDS:\t\t%d.%u\n",
  824. - gInt(pIhw->AppData.usMargin), gDot1(pIhw->AppData.usMargin),
  825. - gInt(pIhw->AppData.dsMargin), gDot1(pIhw->AppData.dsMargin));
  826. - }
  827. - else
  828. - {
  829. - len +=
  830. - sprintf (buf + len, "\t[Margin]\tUS:\t%u\tDS:\t\t%u\n",
  831. - (unsigned int)pIhw->AppData.usMargin,
  832. - (unsigned int)pIhw->AppData.dsMargin/2 );
  833. - }
  834. + seq_printf (m, "\t[Margin]\tUS:\t%d.%u\tDS:\t\t%d.%u\n",
  835. + gInt(pIhw->AppData.usMargin), gDot1(pIhw->AppData.usMargin),
  836. + gInt(pIhw->AppData.dsMargin), gDot1(pIhw->AppData.dsMargin));
  837. + }
  838. + else
  839. + {
  840. + seq_printf (m, "\t[Margin]\tUS:\t%u\tDS:\t\t%u\n",
  841. + (unsigned int)pIhw->AppData.usMargin,
  842. + (unsigned int)pIhw->AppData.dsMargin/2 );
  843. }
  844. // UR8_MERGE_END CQ11054*
  845. /*
  846. * Downstream/Upstream Interleaved Errors
  847. */
  848. - if(len<=limit)
  849. - len += sprintf(buf+len, "\t[Interleave path] US (TX):\tCRC: \t%u\tFEC: \t%u\n",
  850. + seq_printf(m, "\t[Interleave path] US (TX):\tCRC: \t%u\tFEC: \t%u\n",
  851. (unsigned int)pIhw->AppData.usICRC_errors,
  852. (unsigned int)pIhw->AppData.usIFEC_errors);
  853. - if(len<=limit)
  854. - len += sprintf(buf+len, "\t[Interleave path] DS (RX):\tCRC: \t%u\tFEC: \t%u\n",
  855. + seq_printf(m, "\t[Interleave path] DS (RX):\tCRC: \t%u\tFEC: \t%u\n",
  856. (unsigned int)pIhw->AppData.dsICRC_errors,
  857. (unsigned int)pIhw->AppData.dsIFEC_errors);
  858. /*
  859. * Upstream/Downstream Fast Errors
  860. */
  861. - if(len<=limit)
  862. - len += sprintf(buf+len, "\t[Fast path] US (TX): \tCRC: \t%u\tFEC: \t%u\n",
  863. + seq_printf(m, "\t[Fast path] US (TX): \tCRC: \t%u\tFEC: \t%u\n",
  864. (unsigned int)pIhw->AppData.usFCRC_errors,
  865. (unsigned int)pIhw->AppData.usFFEC_errors);
  866. - if(len<=limit)
  867. - len += sprintf(buf+len, "\t[Fast path] DS (RX):\tCRC: \t%u\tFEC: \t%u\n",
  868. + seq_printf(m, "\t[Fast path] DS (RX):\tCRC: \t%u\tFEC: \t%u\n",
  869. (unsigned int)pIhw->AppData.dsFCRC_errors,
  870. (unsigned int)pIhw->AppData.dsFFEC_errors);
  871. -
  872. - return len;
  873. +
  874. + return 0;
  875. }
  876. static int getDiagDisplayMode()
  877. @@ -954,29 +961,24 @@ static int getDiagDisplayMode()
  878. ret = 2;
  879. return ret;
  880. }
  881. -int tn7dsl_proc_adv_stats1(char* buf, char **start, off_t offset, int count,
  882. - int *eof, void *data)
  883. +int tn7dsl_proc_adv_stats1(struct seq_file *m, void *data)
  884. {
  885. - int len = 0;
  886. - int limit = count - 80;
  887. int i;
  888. int mode = 0; //mode = 0 => ADSL1 or ADSL2 & 2+
  889. unsigned char SNRpsds[512];
  890. int n;
  891. - len = proc_adv_stats_header( buf+len, limit);
  892. + proc_adv_stats_header( m);
  893. mode = getDiagDisplayMode();
  894. - if(len<=limit)
  895. - len += sprintf(buf+len, "\tBin No.\tBits:\tMargin:\tSNR (Part 1 of 3)\n");
  896. -
  897. + seq_printf(m, "\tBin No.\tBits:\tMargin:\tSNR (Part 1 of 3)\n");
  898. +
  899. if(mode==1) //ADSL1
  900. {
  901. for( i =32; i<128; i++)
  902. {
  903. - if(len<=limit)
  904. - len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
  905. + seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
  906. (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
  907. (unsigned int)pIhw->AppData.marginTblDstrm[i],
  908. (int)pIhw->AppData.rxSnrPerBin0[i]);
  909. @@ -987,26 +989,34 @@ int tn7dsl_proc_adv_stats1(char* buf, ch
  910. if (dslhal_api_getSNRpsds(pIhw, SNRpsds, 1))
  911. {
  912. dgprintf(4, "dslhal_api_getSNRpsds failed!\n");
  913. - return len;
  914. + return -EIO;
  915. }
  916. for( i =32; i<128; i++)
  917. {
  918. - if(len<=limit)
  919. - len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
  920. + seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
  921. (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
  922. (unsigned int)pIhw->AppData.marginTblDstrm[i],
  923. (i<pIhw->AppData.max_ds_tones)?(unsigned char)SNRpsds[i]:0);
  924. }
  925. }
  926. - return len;
  927. + return 0;
  928. }
  929. -int tn7dsl_proc_adv_stats2(char* buf, char **start, off_t offset, int count,
  930. - int *eof, void *data)
  931. +static int tn7dsl_proc_adv_stats1_open(struct inode *inode, struct file *file)
  932. {
  933. + return single_open(file, tn7dsl_proc_adv_stats1, PDE_DATA(inode));
  934. +}
  935. - int len = 0;
  936. - int limit = count - 80;
  937. +struct file_operations tn7dsl_proc_adv_stats1_fops = {
  938. + .owner = THIS_MODULE,
  939. + .open = tn7dsl_proc_adv_stats1_open,
  940. + .read = seq_read,
  941. + .llseek = seq_lseek,
  942. + .release = single_release,
  943. +};
  944. +
  945. +int tn7dsl_proc_adv_stats2(struct seq_file *m, void *data)
  946. +{
  947. int i;
  948. int mode = 0; //mode = 0 => ADSL1 or ADSL2 & 2+
  949. unsigned char SNRpsds[512];
  950. @@ -1016,12 +1026,10 @@ int tn7dsl_proc_adv_stats2(char* buf, ch
  951. if( mode==1) //ADSL1
  952. {
  953. dslhal_api_gatherStatistics(pIhw);
  954. - if(len<=limit)
  955. - len += sprintf(buf+len, "\tBin No.\tBits:\tMargin:\tSNR (Part 2 of 3):\n");
  956. + seq_printf(m, "\tBin No.\tBits:\tMargin:\tSNR (Part 2 of 3):\n");
  957. for( i =128; i<320; i++)
  958. {
  959. - if(len<=limit)
  960. - len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
  961. + seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
  962. (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
  963. (unsigned int)pIhw->AppData.marginTblDstrm[i],
  964. (int)pIhw->AppData.rxSnrPerBin0[i]);
  965. @@ -1032,26 +1040,35 @@ int tn7dsl_proc_adv_stats2(char* buf, ch
  966. if (dslhal_api_getSNRpsds(pIhw, SNRpsds, 1))
  967. {
  968. dgprintf(4, "dslhal_api_getSNRpsds failed!\n");
  969. - return len;
  970. + return -EIO;
  971. }
  972. for( i =128; i<320; i++)
  973. {
  974. - if(len<=limit)
  975. - len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
  976. + seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
  977. (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
  978. (unsigned int)pIhw->AppData.marginTblDstrm[i],
  979. (i<pIhw->AppData.max_ds_tones)?(unsigned char)SNRpsds[i]:0);
  980. }
  981. }
  982. - return len;
  983. + return 0;
  984. }
  985. -int tn7dsl_proc_adv_stats3(char* buf, char **start, off_t offset, int count,
  986. - int *eof, void *data)
  987. +static int tn7dsl_proc_adv_stats2_open(struct inode *inode, struct file *file)
  988. +{
  989. + return single_open(file, tn7dsl_proc_adv_stats2, PDE_DATA(inode));
  990. +}
  991. +
  992. +struct file_operations tn7dsl_proc_adv_stats2_fops = {
  993. + .owner = THIS_MODULE,
  994. + .open = tn7dsl_proc_adv_stats2_open,
  995. + .read = seq_read,
  996. + .llseek = seq_lseek,
  997. + .release = single_release,
  998. +};
  999. +
  1000. +int tn7dsl_proc_adv_stats3(struct seq_file *m, void *data)
  1001. {
  1002. - int len = 0;
  1003. - int limit = count - 80;
  1004. int i;
  1005. int mode = 0; //mode = 0 => ADSL1 or ADSL2 & 2+
  1006. unsigned char SNRpsds[512];
  1007. @@ -1061,12 +1078,10 @@ int tn7dsl_proc_adv_stats3(char* buf, ch
  1008. if( mode==1) //ADSL1
  1009. {
  1010. dslhal_api_gatherStatistics(pIhw);
  1011. - if(len<=limit)
  1012. - len += sprintf(buf+len, "\tBin No.\tBits:\tMargin:\tSNR (Part 3 of 3):\n");
  1013. + seq_printf(m, "\tBin No.\tBits:\tMargin:\tSNR (Part 3 of 3):\n");
  1014. for( i =320; i<512; i++)
  1015. {
  1016. - if(len<=limit)
  1017. - len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
  1018. + seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
  1019. (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
  1020. (unsigned int)pIhw->AppData.marginTblDstrm[i],
  1021. (int)pIhw->AppData.rxSnrPerBin0[i]);
  1022. @@ -1077,283 +1092,287 @@ int tn7dsl_proc_adv_stats3(char* buf, ch
  1023. if (dslhal_api_getSNRpsds(pIhw, SNRpsds, 1))
  1024. {
  1025. dgprintf(4, "dslhal_api_getSNRpsds failed!\n");
  1026. - return len;
  1027. + return -EIO;
  1028. }
  1029. for( i =320; i<512; i++)
  1030. {
  1031. - if(len<=limit)
  1032. - len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
  1033. + seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
  1034. (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
  1035. (unsigned int)pIhw->AppData.marginTblDstrm[i],
  1036. (i<pIhw->AppData.max_ds_tones)?(unsigned char)SNRpsds[i]:0);
  1037. }
  1038. }
  1039. - if(len<=limit)
  1040. - len += sprintf(buf+len, "[End of Stats]\n");
  1041. - return len;
  1042. + seq_printf(m, "[End of Stats]\n");
  1043. + return 0;
  1044. }
  1045. -//UR8_MERGE_END CQ10449
  1046. -//UR8_MERGE_START CQ10682 Jack Zhang
  1047. -int tn7dsl_proc_dbg_cmsgs(char* buf, char **start, off_t offset, int count,
  1048. - int *eof, void *data)
  1049. +
  1050. +static int tn7dsl_proc_adv_stats3_open(struct inode *inode, struct file *file)
  1051. {
  1052. + return single_open(file, tn7dsl_proc_adv_stats3, PDE_DATA(inode));
  1053. +}
  1054. - int len = 0;
  1055. - int limit = count - 80;
  1056. +struct file_operations tn7dsl_proc_adv_stats3_fops = {
  1057. + .owner = THIS_MODULE,
  1058. + .open = tn7dsl_proc_adv_stats3_open,
  1059. + .read = seq_read,
  1060. + .llseek = seq_lseek,
  1061. + .release = single_release,
  1062. +};
  1063. +//UR8_MERGE_END CQ10449
  1064. +//UR8_MERGE_START CQ10682 Jack Zhang
  1065. +int tn7dsl_proc_dbg_cmsgs(struct seq_file *m, void *data)
  1066. +{
  1067. int rc=0;
  1068. dslhal_api_gatherStatistics(pIhw);
  1069. - if(len<=limit)
  1070. - len += sprintf(buf+len, "Training Messages (C-Msgs 1-5)..\n");
  1071. + seq_printf(m, "Training Messages (C-Msgs 1-5)..\n");
  1072. - if(len<=limit)
  1073. - len += sprintf(buf+len, "ADSL2 DELT C-Msg1Ld \t Message Length:%d\n",
  1074. + seq_printf(m, "ADSL2 DELT C-Msg1Ld \t Message Length:%d\n",
  1075. pIhw->adsl2DiagnosticMessages.cMsg1LdLen);
  1076. for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg1LdLen;rc++)
  1077. {
  1078. - if(len<=limit)
  1079. - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg1Ld[rc]);
  1080. + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg1Ld[rc]);
  1081. if(rc!=0 && (rc%16==0))
  1082. - if(len<=limit)
  1083. - len += sprintf(buf+len, "\n");
  1084. + seq_printf(m, "\n");
  1085. }
  1086. - if(len<=limit)
  1087. - len += sprintf(buf+len, "\nADSL2 DELT C-Msg2Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg2LdLen);
  1088. + seq_printf(m, "\nADSL2 DELT C-Msg2Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg2LdLen);
  1089. for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg2LdLen;rc++)
  1090. {
  1091. - if(len<=limit)
  1092. - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg2Ld[rc]);
  1093. + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg2Ld[rc]);
  1094. if(rc!=0 && (rc%16==0))
  1095. - if(len<=limit)
  1096. - len += sprintf(buf+len, "\n");
  1097. + seq_printf(m, "\n");
  1098. }
  1099. - if(len<=limit)
  1100. - len += sprintf(buf+len, "\nADSL2 DELT C-Msg3Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg3LdLen);
  1101. + seq_printf(m, "\nADSL2 DELT C-Msg3Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg3LdLen);
  1102. for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg3LdLen;rc++)
  1103. {
  1104. - if(len<=limit)
  1105. - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg3Ld[rc]);
  1106. + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg3Ld[rc]);
  1107. if(rc!=0 && (rc%16==0))
  1108. - if(len<=limit)
  1109. - len += sprintf(buf+len, "\n");
  1110. + seq_printf(m, "\n");
  1111. }
  1112. - if(len<=limit)
  1113. - len += sprintf(buf+len, "\nADSL2 DELT C-Msg4Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg4LdLen);
  1114. + seq_printf(m, "\nADSL2 DELT C-Msg4Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg4LdLen);
  1115. for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg4LdLen;rc++)
  1116. {
  1117. - if(len<=limit)
  1118. - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg4Ld[rc]);
  1119. + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg4Ld[rc]);
  1120. if(rc!=0 && (rc%16==0))
  1121. - if(len<=limit)
  1122. - len += sprintf(buf+len, "\n");
  1123. + seq_printf(m, "\n");
  1124. }
  1125. - if(len<=limit)
  1126. - len += sprintf(buf+len, "\nADSL2 DELT C-Msg5Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg5LdLen);
  1127. + seq_printf(m, "\nADSL2 DELT C-Msg5Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg5LdLen);
  1128. for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg5LdLen;rc++)
  1129. {
  1130. - if(len<=limit)
  1131. - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg5Ld[rc]);
  1132. + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg5Ld[rc]);
  1133. if(rc!=0 && (rc%16==0))
  1134. - if(len<=limit)
  1135. - len += sprintf(buf+len, "\n");
  1136. + seq_printf(m, "\n");
  1137. }
  1138. - if(len<=limit)
  1139. - len += sprintf(buf+len, "\n");
  1140. - return len;
  1141. + seq_printf(m, "\n");
  1142. + return 0;
  1143. }
  1144. -int tn7dsl_proc_dbg_rmsgs1(char* buf, char **start, off_t offset, int count,
  1145. - int *eof, void *data)
  1146. +static int tn7dsl_proc_dbg_cmsgs_open(struct inode *inode, struct file *file)
  1147. {
  1148. + return single_open(file, tn7dsl_proc_dbg_cmsgs, PDE_DATA(inode));
  1149. +}
  1150. - int len = 0;
  1151. - int limit = count - 80;
  1152. +struct file_operations tn7dsl_proc_dbg_cmsgs_fops = {
  1153. + .owner = THIS_MODULE,
  1154. + .open = tn7dsl_proc_dbg_cmsgs_open,
  1155. + .read = seq_read,
  1156. + .llseek = seq_lseek,
  1157. + .release = single_release,
  1158. +};
  1159. +
  1160. +
  1161. +int tn7dsl_proc_dbg_rmsgs1(struct seq_file *m, void *data)
  1162. +{
  1163. int rc=0;
  1164. dslhal_api_gatherStatistics(pIhw);
  1165. - if(len<=limit)
  1166. - len += sprintf(buf+len, "Training Messages (R-Msgs 1-3)..\n");
  1167. + seq_printf(m, "Training Messages (R-Msgs 1-3)..\n");
  1168. - if(len<=limit)
  1169. - len += sprintf(buf+len, "\nADSL2 DELT R-Msg1Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsg1LdLen);
  1170. + seq_printf(m, "\nADSL2 DELT R-Msg1Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsg1LdLen);
  1171. for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsg1LdLen;rc++)
  1172. {
  1173. - if(len<=limit)
  1174. - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg1Ld[rc]);
  1175. + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg1Ld[rc]);
  1176. if(rc!=0 && (rc%16==0))
  1177. - if(len<=limit)
  1178. - len += sprintf(buf+len, "\n");
  1179. + seq_printf(m, "\n");
  1180. }
  1181. - if(len<=limit)
  1182. - len += sprintf(buf+len, "\nADSL2 DELT R-Msg2Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
  1183. + seq_printf(m, "\nADSL2 DELT R-Msg2Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
  1184. for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
  1185. {
  1186. - if(len<=limit)
  1187. - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg2Ld[rc]);
  1188. + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg2Ld[rc]);
  1189. if(rc!=0 && (rc%16==0))
  1190. - if(len<=limit)
  1191. - len += sprintf(buf+len, "\n");
  1192. + seq_printf(m, "\n");
  1193. }
  1194. - if(len<=limit)
  1195. - len += sprintf(buf+len, "\nADSL2 DELT R-Msg3Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
  1196. + seq_printf(m, "\nADSL2 DELT R-Msg3Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
  1197. for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
  1198. {
  1199. - if(len<=limit)
  1200. - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg3Ld[rc]);
  1201. + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg3Ld[rc]);
  1202. if(rc!=0 && (rc%16==0))
  1203. - if(len<=limit)
  1204. - len += sprintf(buf+len, "\n");
  1205. + seq_printf(m, "\n");
  1206. }
  1207. - if(len<=limit)
  1208. - len += sprintf(buf+len, "\n");
  1209. - return len;
  1210. + seq_printf(m, "\n");
  1211. + return 0;
  1212. }
  1213. -int tn7dsl_proc_dbg_rmsgs2(char* buf, char **start, off_t offset, int count,
  1214. - int *eof, void *data)
  1215. +static int tn7dsl_proc_dbg_rmsgs1_open(struct inode *inode, struct file *file)
  1216. {
  1217. + return single_open(file, tn7dsl_proc_dbg_rmsgs1, PDE_DATA(inode));
  1218. +}
  1219. - int len = 0;
  1220. - int limit = count - 80;
  1221. +struct file_operations tn7dsl_proc_dbg_rmsgs1_fops = {
  1222. + .owner = THIS_MODULE,
  1223. + .open = tn7dsl_proc_dbg_rmsgs1_open,
  1224. + .read = seq_read,
  1225. + .llseek = seq_lseek,
  1226. + .release = single_release,
  1227. +};
  1228. +
  1229. +
  1230. +int tn7dsl_proc_dbg_rmsgs2(struct seq_file *m, void *data)
  1231. +{
  1232. int rc=0;
  1233. dslhal_api_gatherStatistics(pIhw);
  1234. - if(len<=limit)
  1235. - len += sprintf(buf+len, "Training Messages (R-Msgs 4-5)..\n");
  1236. + seq_printf(m, "Training Messages (R-Msgs 4-5)..\n");
  1237. - if(len<=limit)
  1238. - len += sprintf(buf+len, "\nADSL2 DELT R-Msg4Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
  1239. + seq_printf(m, "\nADSL2 DELT R-Msg4Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
  1240. for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
  1241. {
  1242. - if(len<=limit)
  1243. - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg4Ld[rc]);
  1244. + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg4Ld[rc]);
  1245. if(rc!=0 && (rc%16==0))
  1246. - if(len<=limit)
  1247. - len += sprintf(buf+len, "\n");
  1248. + len += sprintf(m, "\n");
  1249. }
  1250. - if(len<=limit)
  1251. - len += sprintf(buf+len, "\nADSL2 DELT R-Msg5Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
  1252. + seq_printf(m, "\nADSL2 DELT R-Msg5Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
  1253. for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
  1254. {
  1255. - if(len<=limit)
  1256. - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg5Ld[rc]);
  1257. + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg5Ld[rc]);
  1258. if(rc!=0 && (rc%16==0))
  1259. - if(len<=limit)
  1260. - len += sprintf(buf+len, "\n");
  1261. + seq_printf(m, "\n");
  1262. }
  1263. - if(len<=limit)
  1264. - len += sprintf(buf+len, "\n");
  1265. - return len;
  1266. + seq_printf(m, "\n");
  1267. + return 0;
  1268. }
  1269. -int tn7dsl_proc_dbg_rmsgs3(char* buf, char **start, off_t offset, int count,
  1270. - int *eof, void *data)
  1271. +static int tn7dsl_proc_dbg_rmsgs2_open(struct inode *inode, struct file *file)
  1272. {
  1273. + return single_open(file, tn7dsl_proc_dbg_rmsgs2, PDE_DATA(inode));
  1274. +}
  1275. - int len = 0;
  1276. - int limit = count - 80;
  1277. +struct file_operations _fops = {
  1278. + .owner = THIS_MODULE,
  1279. + .open = tn7dsl_proc_dbg_rmsgs2_open,
  1280. + .read = seq_read,
  1281. + .llseek = seq_lseek,
  1282. + .release = single_release,
  1283. +};
  1284. +
  1285. +int tn7dsl_proc_dbg_rmsgs3(struct seq_file *m, void *data)
  1286. +{
  1287. int rc=0;
  1288. dslhal_api_gatherStatistics(pIhw);
  1289. - if(len<=limit)
  1290. - len += sprintf(buf+len, "Training Messages (R-Msgs 6-7)..\n");
  1291. + seq_printf(m, "Training Messages (R-Msgs 6-7)..\n");
  1292. - if(len<=limit)
  1293. - len += sprintf(buf+len, "\nADSL2 DELT R-Msg6Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
  1294. + seq_printf(m, "\nADSL2 DELT R-Msg6Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
  1295. for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
  1296. {
  1297. - if(len<=limit)
  1298. - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg6Ld[rc]);
  1299. + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg6Ld[rc]);
  1300. if(rc!=0 && (rc%16==0))
  1301. - if(len<=limit)
  1302. - len += sprintf(buf+len, "\n");
  1303. + seq_printf(m, "\n");
  1304. }
  1305. - if(len<=limit)
  1306. - len += sprintf(buf+len, "\nADSL2 DELT R-Msg7Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
  1307. + seq_printf(m, "\nADSL2 DELT R-Msg7Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
  1308. for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
  1309. {
  1310. - if(len<=limit)
  1311. - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg7Ld[rc]);
  1312. + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg7Ld[rc]);
  1313. if(rc!=0 && (rc%16==0))
  1314. - if(len<=limit)
  1315. - len += sprintf(buf+len, "\n");
  1316. + seq_printf(m, "\n");
  1317. }
  1318. - if(len<=limit)
  1319. - len += sprintf(buf+len, "\n");
  1320. + seq_printf(m, "\n");
  1321. - return len;
  1322. + return 0;
  1323. }
  1324. -int tn7dsl_proc_dbg_rmsgs4(char* buf, char **start, off_t offset, int count,
  1325. - int *eof, void *data)
  1326. +static int tn7dsl_proc_dbg_rmsgs3_open(struct inode *inode, struct file *file)
  1327. {
  1328. + return single_open(file, tn7dsl_proc_dbg_rmsgs3, PDE_DATA(inode));
  1329. +}
  1330. - int len = 0;
  1331. - int limit = count - 80;
  1332. +struct file_operations tn7dsl_proc_dbg_rmsgs3_fops = {
  1333. + .owner = THIS_MODULE,
  1334. + .open = tn7dsl_proc_dbg_rmsgs3_open,
  1335. + .read = seq_read,
  1336. + .llseek = seq_lseek,
  1337. + .release = single_release,
  1338. +};
  1339. +
  1340. +int tn7dsl_proc_dbg_rmsgs4(struct seq_file *m, void *data)
  1341. +{
  1342. int rc=0;
  1343. dslhal_api_gatherStatistics(pIhw);
  1344. - if(len<=limit)
  1345. - len += sprintf(buf+len, "Training Messages (R-Msgs 8-9)..\n");
  1346. + seq_printf(m, "Training Messages (R-Msgs 8-9)..\n");
  1347. - if(len<=limit)
  1348. - len += sprintf(buf+len, "\nADSL2 DELT R-Msg8Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
  1349. + seq_printf(m, "\nADSL2 DELT R-Msg8Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
  1350. for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
  1351. {
  1352. - if(len<=limit)
  1353. - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg8Ld[rc]);
  1354. + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg8Ld[rc]);
  1355. if(rc!=0 && (rc%16==0))
  1356. - if(len<=limit)
  1357. - len += sprintf(buf+len, "\n");
  1358. + seq_printf(m, "\n");
  1359. }
  1360. - if(len<=limit)
  1361. - len += sprintf(buf+len, "\nADSL2 DELT R-Msg9Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
  1362. + seq_printf(m, "\nADSL2 DELT R-Msg9Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
  1363. for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
  1364. {
  1365. - if(len<=limit)
  1366. - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg9Ld[rc]);
  1367. + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg9Ld[rc]);
  1368. if(rc!=0 && (rc%16==0))
  1369. - if(len<=limit)
  1370. - len += sprintf(buf+len, "\n");
  1371. + seq_printf(m, "\n");
  1372. }
  1373. - if(len<=limit)
  1374. - len += sprintf(buf+len, "\n");
  1375. + seq_printf(m, "\n");
  1376. - return len;
  1377. + return 0;
  1378. +}
  1379. +
  1380. +static int tn7dsl_proc_dbg_rmsgs4_open(struct inode *inode, struct file *file)
  1381. +{
  1382. + return single_open(file, tn7dsl_proc_dbg_rmsgs4, PDE_DATA(inode));
  1383. }
  1384. +
  1385. +struct file_operations tn7dsl_proc_dbg_rmsgs4_fops = {
  1386. + .owner = THIS_MODULE,
  1387. + .open = tn7dsl_proc_dbg_rmsgs4_open,
  1388. + .read = seq_read,
  1389. + .llseek = seq_lseek,
  1390. + .release = single_release,
  1391. +};
  1392. +
  1393. //UR8_MERGE_END CQ10682*
  1394. #endif //ADV_DIAG_STATS
  1395. -int tn7dsl_proc_stats(char* buf, char **start, off_t offset, int count,
  1396. - int *eof, void *data)
  1397. +static int tn7dsl_proc_stats(struct seq_file *m, void *data)
  1398. {
  1399. - int len = 0;
  1400. - int limit = count - 80;
  1401. int F4count, F5count;
  1402. unsigned int maxRate=0;
  1403. unsigned int us_maxRate=0;
  1404. @@ -1361,80 +1380,58 @@ int tn7dsl_proc_stats(char* buf, char **
  1405. //UR8_MERGE_START CQ10700 Manjula K
  1406. struct atm_dev *dev;
  1407. Tn7AtmPrivate *priv;
  1408. - dev = (struct atm_dev *)data;
  1409. + int offset[2] = { 32, 0 };
  1410. + unsigned int usBitswap, dsBitswap;
  1411. + dev = (struct atm_dev *)m->private;
  1412. priv = (Tn7AtmPrivate *)dev->dev_data;
  1413. //UR8_MERGE_END CQ10700
  1414. +
  1415. /*
  1416. * Read Ax5 Stats
  1417. */
  1418. dslhal_api_gatherStatistics(pIhw);
  1419. - if(len<=limit)
  1420. - len += sprintf(buf+len, "\nAR7 DSL Modem Statistics:\n");
  1421. - if(len<=limit)
  1422. - len += sprintf(buf+len, "--------------------------------\n");
  1423. + seq_printf(m, "\nAR7 DSL Modem Statistics:\n");
  1424. + seq_printf(m, "--------------------------------\n");
  1425. /*
  1426. * us and ds Connection Rates
  1427. */
  1428. - if(len<=limit)
  1429. - len += sprintf(buf+len, "[DSL Modem Stats]\n");
  1430. + seq_printf(m, "[DSL Modem Stats]\n");
  1431. - if(len<=limit)
  1432. + if(pIhw->lConnected != 1)
  1433. {
  1434. - if(pIhw->lConnected != 1)
  1435. - {
  1436. - pIhw->AppData.USConRate = 0;
  1437. - pIhw->AppData.DSConRate = 0;
  1438. - }
  1439. - len +=
  1440. - sprintf (buf + len,
  1441. - "\tUS Connection Rate:\t%u\tDS Connection Rate:\t%u\n",
  1442. - (unsigned int)pIhw->AppData.USConRate,
  1443. - (unsigned int)pIhw->AppData.DSConRate );
  1444. + pIhw->AppData.USConRate = 0;
  1445. + pIhw->AppData.DSConRate = 0;
  1446. }
  1447. - if(len<=limit)
  1448. + seq_printf (m,
  1449. + "\tUS Connection Rate:\t%u\tDS Connection Rate:\t%u\n",
  1450. + (unsigned int)pIhw->AppData.USConRate,
  1451. + (unsigned int)pIhw->AppData.DSConRate );
  1452. // UR8_MERGE_START CQ11054 Jack Zhang
  1453. - {
  1454. - if (dslhal_api_getHighPrecision())
  1455. - {
  1456. - len +=
  1457. - sprintf (buf + len, "\tDS Line Attenuation:\t%u.%u\tDS Margin:\t\t%d.%u\n",
  1458. + if (dslhal_api_getHighPrecision())
  1459. + seq_printf (m, "\tDS Line Attenuation:\t%u.%u\tDS Margin:\t\t%d.%u\n",
  1460. gInt(pIhw->AppData.dsLineAttn), gDot1(pIhw->AppData.dsLineAttn),
  1461. gInt(pIhw->AppData.dsMargin), gDot1(pIhw->AppData.dsMargin));
  1462. - }
  1463. - else{
  1464. - len +=
  1465. - sprintf (buf + len, "\tDS Line Attenuation:\t%u\tDS Margin:\t\t%u\n",
  1466. + else
  1467. + seq_printf (m, "\tDS Line Attenuation:\t%u\tDS Margin:\t\t%u\n",
  1468. (unsigned int)pIhw->AppData.dsLineAttn/2,
  1469. (unsigned int)pIhw->AppData.dsMargin/2 );
  1470. - }
  1471. - }
  1472. // UR8_MERGE_END CQ11054*
  1473. - if(len<=limit)
  1474. // UR8_MERGE_START CQ11054 Jack Zhang
  1475. - {
  1476. - if (dslhal_api_getHighPrecision())
  1477. - {
  1478. - len +=
  1479. - sprintf (buf + len, "\tUS Line Attenuation:\t%u.%u\tUS Margin:\t\t%d.%u\n",
  1480. + if (dslhal_api_getHighPrecision())
  1481. + seq_printf (m, "\tUS Line Attenuation:\t%u.%u\tUS Margin:\t\t%d.%u\n",
  1482. gInt(pIhw->AppData.usLineAttn), gDot1(pIhw->AppData.usLineAttn),
  1483. gInt(pIhw->AppData.usMargin), gDot1(pIhw->AppData.usMargin));
  1484. - }
  1485. - else
  1486. - {
  1487. - len +=
  1488. - sprintf (buf + len, "\tUS Line Attenuation:\t%u\tUS Margin:\t\t%u\n",
  1489. + else
  1490. + seq_printf (m, "\tUS Line Attenuation:\t%u\tUS Margin:\t\t%u\n",
  1491. (unsigned int)pIhw->AppData.usLineAttn/2,
  1492. (unsigned int)pIhw->AppData.usMargin );
  1493. - }
  1494. - }
  1495. // UR8_MERGE_END CQ11054*
  1496. - if(len<=limit)
  1497. - len += sprintf(buf+len, "\tUS Payload :\t\t%u\tDS Payload:\t\t%u\n",
  1498. + seq_printf(m, "\tUS Payload :\t\t%u\tDS Payload:\t\t%u\n",
  1499. ((unsigned int) pIhw->AppData.usAtm_count[0] +
  1500. (unsigned int) pIhw->AppData.usAtm_count[1]) * 48,
  1501. ((unsigned int) pIhw->AppData.dsGood_count[0] +
  1502. @@ -1442,9 +1439,7 @@ int tn7dsl_proc_stats(char* buf, char **
  1503. /*
  1504. * Superframe Count
  1505. */
  1506. - if(len<=limit)
  1507. - len +=
  1508. - sprintf (buf + len,
  1509. + seq_printf (m,
  1510. "\tUS Superframe Cnt :\t%u\tDS Superframe Cnt:\t%u\n",
  1511. (unsigned int)pIhw->AppData.usSuperFrmCnt,
  1512. (unsigned int)pIhw->AppData.dsSuperFrmCnt );
  1513. @@ -1452,57 +1447,45 @@ int tn7dsl_proc_stats(char* buf, char **
  1514. /*
  1515. * US and DS power
  1516. */
  1517. - if(len<=limit)
  1518. + if(pIhw->AppData.bState < 5)
  1519. {
  1520. - if(pIhw->AppData.bState < 5)
  1521. - {
  1522. - pIhw->AppData.usTxPower = 0;
  1523. - pIhw->AppData.dsTxPower = 0;
  1524. - }
  1525. - len +=
  1526. - sprintf (buf + len,
  1527. + pIhw->AppData.usTxPower = 0;
  1528. + pIhw->AppData.dsTxPower = 0;
  1529. + }
  1530. + seq_printf (m,
  1531. +// UR8_MERGE_START - CQ11579 - Jeremy #1
  1532. "\tUS Transmit Power :\t%u\tDS Transmit Power:\t%u\n",
  1533. (unsigned int)pIhw->AppData.usTxPower/256,
  1534. (unsigned int)pIhw->AppData.dsTxPower/256 );
  1535. - }
  1536. +// UR8_MERGE_END - CQ11579
  1537. /*
  1538. * DSL Stats Errors
  1539. */
  1540. - if(len<=limit)
  1541. - len += sprintf(buf+len, "\tLOS errors:\t\t%u\tSEF errors:\t\t%u\n",
  1542. + seq_printf(m, "\tLOS errors:\t\t%u\tSEF errors:\t\t%u\n",
  1543. (unsigned int)pIhw->AppData.LOS_errors,
  1544. (unsigned int)pIhw->AppData.SEF_errors );
  1545. //UR8_MERGE_START Report_SES Manjula K
  1546. //CQ10369
  1547. - if(len<=limit)
  1548. - len += sprintf(buf+len, "\tErrored Seconds:\t%u\tSeverely Err Secs:\t%u\n",
  1549. + seq_printf(m, "\tErrored Seconds:\t%u\tSeverely Err Secs:\t%u\n",
  1550. (unsigned int)pIhw->AppData.erroredSeconds,
  1551. (unsigned int)pIhw->AppData.severelyerrsecs );
  1552. //UR8_MERGE_END Report_SES
  1553. -
  1554. - if(len<=limit)
  1555. - len += sprintf(buf+len, "\tFrame mode:\t\t%u\tMax Frame mode:\t\t%u\n",
  1556. +
  1557. + seq_printf(m, "\tFrame mode:\t\t%u\tMax Frame mode:\t\t%u\n",
  1558. (unsigned int)pIhw->AppData.FrmMode,
  1559. (unsigned int)pIhw->AppData.MaxFrmMode );
  1560. - if(len<=limit)
  1561. - len +=
  1562. - sprintf (buf + len, "\tTrained Path:\t\t%u\tUS Peak Cell Rate:\t%u\n",
  1563. + seq_printf (m, "\tTrained Path:\t\t%u\tUS Peak Cell Rate:\t%u\n",
  1564. (unsigned int)pIhw->AppData.TrainedPath,
  1565. (unsigned int)pIhw->AppData.USConRate*1000/8/53 );
  1566. - if(len<=limit)
  1567. - len +=
  1568. - sprintf (buf + len, "\tTrained Mode:\t\t%u\tSelected Mode:\t\t%u\n",
  1569. + seq_printf (m, "\tTrained Mode:\t\t%u\tSelected Mode:\t\t%u\n",
  1570. (unsigned int) pIhw->AppData.TrainedMode,
  1571. (unsigned int) pIhw->AppData.StdMode);
  1572. - if(len<=limit)
  1573. - len +=
  1574. - sprintf (buf + len, "\tATUC Vendor Code:\t%X\tATUC Revision:\t%u\n",
  1575. + seq_printf (m, "\tATUC Vendor Code:\t%X\tATUC Revision:\t%u\n",
  1576. (unsigned int) pIhw->AppData.atucVendorId,
  1577. pIhw->AppData.atucRevisionNum);
  1578. - if(len<=limit)
  1579. - len += sprintf(buf+len, "\tHybrid Selected:\t%u\tTrellis:\t\t%u\n",
  1580. + seq_printf(m, "\tHybrid Selected:\t%u\tTrellis:\t\t%u\n",
  1581. (unsigned int)pIhw->AppData.currentHybridNum, trellis);
  1582. //@Added Maximum attainable bit rate information. 05-14-2004
  1583. @@ -1514,12 +1497,12 @@ int tn7dsl_proc_stats(char* buf, char **
  1584. }
  1585. else
  1586. {
  1587. - int offset[2] = {5, 1};
  1588. + int dspOffset[2] = { 5, 1 };
  1589. unsigned char rMsgsRA[12];
  1590. int numPayloadBytes = 0;
  1591. dslhal_api_dspInterfaceRead (pIhw, (unsigned int) pIhw->pmainAddr, 2,
  1592. - (unsigned int *) &offset,
  1593. + (unsigned int *) &dspOffset,
  1594. (unsigned char *) &rMsgsRA[0], 12);
  1595. maxRate = (unsigned int)pIhw->AppData.DSConRate;
  1596. @@ -1535,283 +1518,213 @@ int tn7dsl_proc_stats(char* buf, char **
  1597. }
  1598. }
  1599. - if(len<=limit)
  1600. - len +=
  1601. - sprintf (buf + len,
  1602. + seq_printf (m,
  1603. "\tShowtime Count:\t\t%u\tDS Max Attainable Bit Rate: %u kbps\n",
  1604. (unsigned int)pIhw->AppData.showtimeCount, maxRate);
  1605. - if(len<=limit)
  1606. - {
  1607. - int offset[2] = {32, 0};
  1608. - unsigned int usBitswap, dsBitswap;
  1609. + tn7dsl_generic_read(2, (unsigned int *)&offset);
  1610. + dsBitswap = dslReg & dslhal_support_byteSwap32(0x000000ff);
  1611. - tn7dsl_generic_read(2, (unsigned int *)&offset);
  1612. - dsBitswap = dslReg & dslhal_support_byteSwap32(0x000000ff);
  1613. + offset[0] = 33;
  1614. + tn7dsl_generic_read(2, (unsigned int *)&offset);
  1615. + usBitswap = dslReg & dslhal_support_byteSwap32(0x000000ff);
  1616. - offset[0] = 33;
  1617. - tn7dsl_generic_read(2, (unsigned int *)&offset);
  1618. - usBitswap = dslReg & dslhal_support_byteSwap32(0x000000ff);
  1619. -
  1620. - if(pIhw->AppData.dsl_modulation > 5)
  1621. - len +=
  1622. - sprintf (buf + len,
  1623. + if(pIhw->AppData.dsl_modulation > 5)
  1624. + seq_printf (m,
  1625. "\tBitSwap:\t\t%u\tUS Max Attainable Bit Rate: %u bps\n",
  1626. (unsigned int)(usBitswap && dsBitswap), us_maxRate);
  1627. - else
  1628. - len +=
  1629. - sprintf (buf + len,
  1630. + else
  1631. + seq_printf (m,
  1632. "\tBitSwap:\t\t%u\tUS Max Attainable Bit Rate:\tn/a\n",
  1633. (unsigned int)(usBitswap && dsBitswap));
  1634. - }
  1635. #if 1 // TR69
  1636. - if(len<=limit)
  1637. - len +=
  1638. - sprintf (buf + len, "\tAnnex: \t\t\t%s\tpsd_mask_qualifier: 0x%04x\n",
  1639. + seq_printf (m, "\tAnnex: \t\t\t%s\tpsd_mask_qualifier: 0x%04x\n",
  1640. tn7dsl_AnnexFromNum(pIhw->AppData.annex_selected),
  1641. pIhw->AppData.psd_mask_qualifier);
  1642. // UR8_MERGE_START CQ10979 Jack Zhang
  1643. // UR8_MERGE_START CQ10978 Jack Zhang
  1644. - if(len<=limit)
  1645. - len +=
  1646. - sprintf (buf + len, "\tPower Management Status: L%d\tDS HLINSC: %d\n",
  1647. + seq_printf (m, "\tPower Management Status: L%d\tDS HLINSC: %d\n",
  1648. pIhw->AppData.pwrStatus, pIhw->AppData.dsHLINSC);
  1649. // UR8_MERGE_END CQ10978*
  1650. - if(len<=limit)
  1651. - len +=
  1652. - sprintf (buf + len, "\tUS ACTPSD: \t\t%d\tDS ACTPSD: %d\n",
  1653. + seq_printf (m, "\tUS ACTPSD: \t\t%d\tDS ACTPSD: %d\n",
  1654. pIhw->AppData.usACTPSD, pIhw->AppData.dsACTPSD);
  1655. - if(len<=limit)
  1656. - len +=
  1657. - sprintf (buf + len, "\tTotal init. errors: \t%d\tTotal init. timeouts: %d\n",
  1658. + seq_printf (m, "\tTotal init. errors: \t%d\tTotal init. timeouts: %d\n",
  1659. pIhw->AppData.totalInitErrs, pIhw->AppData.totalInitTOs);
  1660. - if(len<=limit)
  1661. - len +=
  1662. - sprintf (buf + len, "\tShowtime init. errors: \t%d\tShowtime init. timeouts: %d\n",
  1663. + seq_printf (m, "\tShowtime init. errors: \t%d\tShowtime init. timeouts: %d\n",
  1664. pIhw->AppData.showtimeInitErrs, pIhw->AppData.showtimeInitTOs);
  1665. - if(len<=limit)
  1666. - len +=
  1667. - sprintf (buf + len, "\tLast showtime init. errors: %ld\tLast showtime init. timeouts: %ld\n",
  1668. + seq_printf (m, "\tLast showtime init. errors: %ld\tLast showtime init. timeouts: %ld\n",
  1669. pIhw->AppData.lastshowInitErrs, pIhw->AppData.lastshowInitTOs);
  1670. // UR8_MERGE_END CQ10979*
  1671. - if (len<=limit)
  1672. - {
  1673. - len += sprintf(buf+len,"\tATUC ghsVid: ");
  1674. - for (i=0; i<8; i++)
  1675. - len+= sprintf(buf+len, " %02x", pIhw->AppData.ghsATUCVendorId[i]);
  1676. - }
  1677. + seq_printf(m,"\tATUC ghsVid: ");
  1678. + for (i=0; i<8; i++)
  1679. + seq_printf(m, " %02x", pIhw->AppData.ghsATUCVendorId[i]);
  1680. - if (len<=limit)
  1681. - {
  1682. - len += sprintf (buf + len, "\n");
  1683. - }
  1684. + seq_printf (m, "\n");
  1685. - if (len <= limit)
  1686. - {
  1687. - len +=
  1688. - sprintf (buf + len,
  1689. + seq_printf (m,
  1690. "\tT1413Vid: %02x %02x\t\tT1413Rev: %02x\t\tVendorRev: %02x\n",
  1691. pIhw->AppData.t1413ATUC.VendorId[0],
  1692. pIhw->AppData.t1413ATUC.VendorId[1],
  1693. pIhw->AppData.t1413ATUC.t1413Revision,
  1694. pIhw->AppData.t1413ATUC.VendorRevision);
  1695. - }
  1696. - if (len<=limit)
  1697. - {
  1698. - len += sprintf(buf+len,"\tATUR ghsVid: ");
  1699. - for (i=0; i<8; i++)
  1700. - len+= sprintf(buf+len, " %02x", pIhw->AppData.ghsATURVendorId[i]);
  1701. - }
  1702. + seq_printf(m,"\tATUR ghsVid: ");
  1703. + for (i=0; i<8; i++)
  1704. + seq_printf(m, " %02x", pIhw->AppData.ghsATURVendorId[i]);
  1705. - if (len<=limit)
  1706. - {
  1707. - len += sprintf (buf + len, "\n");
  1708. - }
  1709. + seq_printf (m, "\n");
  1710. - if (len <= limit)
  1711. - {
  1712. - len +=
  1713. - sprintf (buf + len,
  1714. + seq_printf (m,
  1715. "\tT1413Vid: %02x %02x\tT1413Rev: %02x\tVendorRev: %02x\n",
  1716. pIhw->AppData.t1413ATUR.VendorId[0],
  1717. pIhw->AppData.t1413ATUR.VendorId[1],
  1718. pIhw->AppData.t1413ATUR.t1413Revision,
  1719. pIhw->AppData.t1413ATUR.VendorRevision);
  1720. - }
  1721. #endif
  1722. /*
  1723. * Upstream Interleaved Errors
  1724. */
  1725. - if(len<=limit)
  1726. - len += sprintf(buf+len, "\n\t[Upstream (TX) Interleave path]\n");
  1727. - if(len<=limit)
  1728. - len += sprintf(buf+len, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
  1729. + seq_printf(m, "\n\t[Upstream (TX) Interleave path]\n");
  1730. + seq_printf(m, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
  1731. (unsigned int)pIhw->AppData.usICRC_errors,
  1732. (unsigned int)pIhw->AppData.usIFEC_errors,
  1733. (unsigned int)pIhw->AppData.usINCD_error);
  1734. - if(len<=limit)
  1735. - len += sprintf(buf+len, "\tLCD: \t%u\tHEC: \t%u\n",
  1736. + seq_printf(m, "\tLCD: \t%u\tHEC: \t%u\n",
  1737. (unsigned int)pIhw->AppData.usILCD_errors,
  1738. (unsigned int)pIhw->AppData.usIHEC_errors);
  1739. /*
  1740. * Downstream Interleaved Errors
  1741. */
  1742. - if(len<=limit)
  1743. - len += sprintf(buf+len, "\n\t[Downstream (RX) Interleave path]\n");
  1744. - if(len<=limit)
  1745. - len += sprintf(buf+len, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
  1746. + seq_printf(m, "\n\t[Downstream (RX) Interleave path]\n");
  1747. + seq_printf(m, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
  1748. (unsigned int)pIhw->AppData.dsICRC_errors,
  1749. (unsigned int)pIhw->AppData.dsIFEC_errors,
  1750. (unsigned int)pIhw->AppData.dsINCD_error);
  1751. - if(len<=limit)
  1752. - len += sprintf(buf+len, "\tLCD: \t%u\tHEC: \t%u\n",
  1753. + seq_printf(m, "\tLCD: \t%u\tHEC: \t%u\n",
  1754. (unsigned int)pIhw->AppData.dsILCD_errors,
  1755. (unsigned int)pIhw->AppData.dsIHEC_errors);
  1756. /*
  1757. * Upstream Fast Errors
  1758. */
  1759. - if(len<=limit)
  1760. - len += sprintf(buf+len, "\n\t[Upstream (TX) Fast path]\n");
  1761. - if(len<=limit)
  1762. - len += sprintf(buf+len, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
  1763. + seq_printf(m, "\n\t[Upstream (TX) Fast path]\n");
  1764. + seq_printf(m, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
  1765. (unsigned int)pIhw->AppData.usFCRC_errors,
  1766. (unsigned int)pIhw->AppData.usFFEC_errors,
  1767. (unsigned int)pIhw->AppData.usFNCD_error);
  1768. - if(len<=limit)
  1769. - len += sprintf(buf+len, "\tLCD: \t%u\tHEC: \t%u\n",
  1770. + seq_printf(m, "\tLCD: \t%u\tHEC: \t%u\n",
  1771. (unsigned int)pIhw->AppData.usFLCD_errors,
  1772. (unsigned int)pIhw->AppData.usFHEC_errors);
  1773. /*
  1774. * Downstream Fast Errors
  1775. */
  1776. - if(len<=limit)
  1777. - len += sprintf(buf+len, "\n\t[Downstream (RX) Fast path]\n");
  1778. - if(len<=limit)
  1779. - len += sprintf(buf+len, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
  1780. + seq_printf(m, "\n\t[Downstream (RX) Fast path]\n");
  1781. + seq_printf(m, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
  1782. (unsigned int)pIhw->AppData.dsFCRC_errors,
  1783. (unsigned int)pIhw->AppData.dsFFEC_errors,
  1784. (unsigned int)pIhw->AppData.dsFNCD_error);
  1785. - if(len<=limit)
  1786. - len += sprintf(buf+len, "\tLCD: \t%u\tHEC: \t%u\n",
  1787. - (unsigned int)pIhw->AppData.dsFLCD_errors,
  1788. - (unsigned int)pIhw->AppData.dsFHEC_errors);
  1789. + seq_printf(m, "\tLCD: \t%u\tHEC: \t%u\n",
  1790. + (unsigned int)pIhw->AppData.dsFLCD_errors,
  1791. + (unsigned int)pIhw->AppData.dsFHEC_errors);
  1792. /*
  1793. * ATM stats upstream
  1794. */
  1795. - if(len<=limit)
  1796. - len += sprintf(buf+len, "\n[ATM Stats]");
  1797. - if(len<=limit)
  1798. - len += sprintf(buf+len, "\n\t[Upstream/TX]\n");
  1799. - if(len<=limit)
  1800. - len +=
  1801. - sprintf (buf + len, "\tGood Cell Cnt:\t%u\n\tIdle Cell Cnt:\t%u\n\n",
  1802. - (unsigned int) pIhw->AppData.usAtm_count[0] +
  1803. - (unsigned int) pIhw->AppData.usAtm_count[1],
  1804. - (unsigned int) pIhw->AppData.usIdle_count[0] +
  1805. - (unsigned int) pIhw->AppData.usIdle_count[1]);
  1806. -//UR8_MERGE_START CQ10700 Manjula K
  1807. - if (len <= limit)
  1808. - len +=
  1809. - sprintf (buf + len,
  1810. + seq_printf(m, "\n[ATM Stats]");
  1811. + seq_printf(m, "\n\t[Upstream/TX]\n");
  1812. + seq_printf (m, "\tGood Cell Cnt:\t%u\n\tIdle Cell Cnt:\t%u\n\n",
  1813. + (unsigned int) pIhw->AppData.usAtm_count[0] +
  1814. + (unsigned int) pIhw->AppData.usAtm_count[1],
  1815. + (unsigned int) pIhw->AppData.usIdle_count[0] +
  1816. + (unsigned int) pIhw->AppData.usIdle_count[1]);
  1817. +//UR8_MERGE_START CQ10700 Manjula K
  1818. + seq_printf (m,
  1819. "\tTx Packets Dropped Count:\t%lu\n\tTx Bad Packets Count:\t%lu\n",
  1820. priv->stats.tx_dropped, priv->stats.tx_errors);
  1821. //UR8_MERGE_END CQ10700
  1822. /*
  1823. * ATM stats downstream
  1824. */
  1825. - if(len<=limit)
  1826. - len += sprintf(buf+len, "\n\t[Downstream/RX)]\n");
  1827. - if(len<=limit)
  1828. - len +=
  1829. - sprintf (buf + len,
  1830. - "\tGood Cell Cnt:\t%u\n\tIdle Cell Cnt:\t%u\n\tBad Hec Cell Cnt:\t%u\n",
  1831. - (unsigned int) pIhw->AppData.dsGood_count[0] +
  1832. - (unsigned int) pIhw->AppData.dsGood_count[1],
  1833. - (unsigned int) pIhw->AppData.dsIdle_count[0] +
  1834. - (unsigned int) pIhw->AppData.dsIdle_count[1],
  1835. - (unsigned int) pIhw->AppData.dsBadHec_count[0] +
  1836. - (unsigned int) pIhw->AppData.dsBadHec_count[1]);
  1837. - if(len<=limit)
  1838. - len += sprintf(buf+len, "\tOverflow Dropped Cell Cnt:\t%u\n",
  1839. - (unsigned int) pIhw->AppData.dsOVFDrop_count[0] +
  1840. - (unsigned int) pIhw->AppData.dsOVFDrop_count[1]);
  1841. -
  1842. - //UR8_MERGE_START CQ10700 Manjula K
  1843. - if (len <= limit)
  1844. - len +=
  1845. - sprintf (buf + len,
  1846. - "\tRx Packets Dropped Count:\t%lu\n\tRx Bad Packets Count:\t%lu\n\n",
  1847. - priv->stats.rx_dropped, priv->stats.rx_errors);
  1848. + seq_printf(m, "\n\t[Downstream/RX)]\n");
  1849. + seq_printf (m,
  1850. + "\tGood Cell Cnt:\t%u\n\tIdle Cell Cnt:\t%u\n\tBad Hec Cell Cnt:\t%u\n",
  1851. + (unsigned int) pIhw->AppData.dsGood_count[0] +
  1852. + (unsigned int) pIhw->AppData.dsGood_count[1],
  1853. + (unsigned int) pIhw->AppData.dsIdle_count[0] +
  1854. + (unsigned int) pIhw->AppData.dsIdle_count[1],
  1855. + (unsigned int) pIhw->AppData.dsBadHec_count[0] +
  1856. + (unsigned int) pIhw->AppData.dsBadHec_count[1]);
  1857. + seq_printf(m, "\tOverflow Dropped Cell Cnt:\t%u\n",
  1858. + (unsigned int) pIhw->AppData.dsOVFDrop_count[0] +
  1859. + (unsigned int) pIhw->AppData.dsOVFDrop_count[1]);
  1860. +
  1861. + //UR8_MERGE_START CQ10700 Manjula K
  1862. + seq_printf (m,
  1863. + "\tRx Packets Dropped Count:\t%lu\n\tRx Bad Packets Count:\t%lu\n\n",
  1864. + priv->stats.rx_dropped, priv->stats.rx_errors);
  1865. //UR8_MERGE_END CQ10700
  1866. tn7sar_get_stats(pIhw->pOsContext);
  1867. - if(len<=limit)
  1868. - len += sprintf(buf+len, "\n[SAR AAL5 Stats]\n");
  1869. - if(len<=limit)
  1870. - len += sprintf(buf+len, "\tTx PDU's:\t%u\n\tRx PDU's:\t%u\n",
  1871. - sarStat.txPktCnt, sarStat.rxPktCnt);
  1872. - if(len<=limit)
  1873. - len +=
  1874. - sprintf (buf + len, "\tTx Total Bytes:\t%u\n\tRx Total Bytes:\t%u\n",
  1875. - sarStat.txBytes, sarStat.rxBytes);
  1876. - if (len <= limit)
  1877. - len +=
  1878. - sprintf (buf + len,
  1879. - "\tTx Total Error Counts:\t%u\n\tRx Total Error Counts:\t%u\n\n",
  1880. - sarStat.txErrors, sarStat.rxErrors);
  1881. + seq_printf(m, "\n[SAR AAL5 Stats]\n");
  1882. + seq_printf(m, "\tTx PDU's:\t%u\n\tRx PDU's:\t%u\n",
  1883. + sarStat.txPktCnt, sarStat.rxPktCnt);
  1884. + seq_printf (m, "\tTx Total Bytes:\t%u\n\tRx Total Bytes:\t%u\n",
  1885. + sarStat.txBytes, sarStat.rxBytes);
  1886. + seq_printf (m,
  1887. + "\tTx Total Error Counts:\t%u\n\tRx Total Error Counts:\t%u\n\n",
  1888. + sarStat.txErrors, sarStat.rxErrors);
  1889. /*
  1890. * oam loopback info
  1891. */
  1892. - if(len<=limit)
  1893. - len += sprintf(buf+len, "\n[OAM Stats]\n");
  1894. + seq_printf(m, "\n[OAM Stats]\n");
  1895. tn7sar_get_near_end_loopback_count(&F4count, &F5count);
  1896. - if(len<=limit)
  1897. - {
  1898. - len +=
  1899. - sprintf (buf + len,
  1900. - "\tNear End F5 Loop Back Count:\t%u\n\tNear End F4 Loop Back Count:\t%u\n\tFar End F5 Loop Back Count:\t%u\n\tFar End F4 Loop Back Count:\t%u\n",
  1901. + seq_printf (m,
  1902. + "\tNear End F5 Loop Back Count:\t%u\n\tNear End F4 Loop Back Count:\t%u\n\tFar End F5 Loop Back Count:\t%u\n\tFar End F4 Loop Back Count:\t%u\n",
  1903. F5count, F4count, oamFarLBCount[0] + oamFarLBCount[2],
  1904. oamFarLBCount[1] + oamFarLBCount[3]);
  1905. - }
  1906. #define USE_OAM_DROP_COUNT //CQ10273
  1907. //Read OAM ping responses count:
  1908. #ifdef USE_OAM_DROP_COUNT
  1909. - if(len<=limit)
  1910. - {
  1911. - /* len +=
  1912. - sprintf (buf + len,
  1913. - "\tSAR OAM Retry in 0x%X cycles, Drop Count=%d\n",
  1914. - tn7dsl_get_memory(0xa30085cc), tn7dsl_get_memory(0xa30085c4)); */
  1915. +/* seq_printf (m,
  1916. + "\tSAR OAM Retry in 0x%X cycles, Drop Count=%d\n",
  1917. + tn7dsl_get_memory(0xa30085cc), tn7dsl_get_memory(0xa30085c4)); */
  1918. - len += sprintf (buf + len, "\tSAR OAM Ping Response Drop Count=%d\n",
  1919. - tn7dsl_get_memory(0xa30085b0));
  1920. - }
  1921. + seq_printf (m, "\tSAR OAM Ping Response Drop Count=%d\n",
  1922. + tn7dsl_get_memory(0xa30085b0));
  1923. #endif // USE_OAM_DROP_COUNT
  1924. - return len;
  1925. + return 0;
  1926. }
  1927. -int tn7dsl_proc_modem(char* buf, char **start, off_t offset, int count,
  1928. - int *eof, void *data)
  1929. +static int tn7dsl_proc_stats_open(struct inode *inode, struct file *file)
  1930. {
  1931. + return single_open(file, tn7dsl_proc_stats, PDE_DATA(inode));
  1932. +}
  1933. - int len = 0;
  1934. - int limit = count - 80;
  1935. +int tn7dsl_proc_write_stats (struct file *fp, const char *buf, unsigned long count, void *data);
  1936. +
  1937. +struct file_operations tn7dsl_proc_stats_fops = {
  1938. + .owner = THIS_MODULE,
  1939. + .open = tn7dsl_proc_stats_open,
  1940. + .read = seq_read,
  1941. + .llseek = seq_lseek,
  1942. + .release = single_release,
  1943. + .write = tn7dsl_proc_write_stats,
  1944. +};
  1945. +static int tn7dsl_proc_modem(struct seq_file *m, void *data)
  1946. +{
  1947. char *state;
  1948. int tag;
  1949. @@ -1845,16 +1758,26 @@ int tn7dsl_proc_modem(char* buf, char **
  1950. if(pIhw->lConnected == 1)
  1951. state = "SHOWTIME";
  1952. - if(len<=limit)
  1953. - len += sprintf(buf+len,"%s\n",state);
  1954. - if(len<=limit)
  1955. - len += sprintf(buf+len, "%d\n", dslReg);
  1956. - if(len<=limit)
  1957. - len += sprintf(buf+len, "failTrains=%d\n", pIhw->AppData.trainFails);
  1958. + seq_printf(m,"%s\n",state);
  1959. + seq_printf(m, "%d\n", dslReg);
  1960. + seq_printf(m, "failTrains=%d\n", pIhw->AppData.trainFails);
  1961. - return len;
  1962. + return 0;
  1963. +}
  1964. +
  1965. +static int tn7dsl_proc_modem_open(struct inode *inode, struct file *file)
  1966. +{
  1967. + return single_open(file, tn7dsl_proc_modem, PDE_DATA(inode));
  1968. }
  1969. +struct file_operations tn7dsl_proc_modem_fops = {
  1970. + .owner = THIS_MODULE,
  1971. + .open = tn7dsl_proc_modem_open,
  1972. + .read = seq_read,
  1973. + .llseek = seq_lseek,
  1974. + .release = single_release,
  1975. +};
  1976. +
  1977. /**********************************************************************
  1978. ** *
  1979. ** tn7dsl_hdlc_update_crc() -- Calculate CRC *
  1980. @@ -2119,11 +2042,8 @@ static int tn7dsl_hdlc_rx_process(unsign
  1981. return(ret);
  1982. }
  1983. -int tn7dsl_proc_eoc (char *buf, char **start, off_t OffSet, int count,
  1984. - int *eof, void *data)
  1985. +static int tn7dsl_proc_eoc (struct seq_file *m, void *data)
  1986. {
  1987. - int len = 0;
  1988. - int limit = count - 80;
  1989. int offset[2] = {34, 0}; // point to buffer parameter data structure
  1990. clearEocParm_t peoc;
  1991. @@ -2132,62 +2052,49 @@ int tn7dsl_proc_eoc (char *buf, char **s
  1992. (unsigned char *) &peoc,
  1993. sizeof (clearEocParm_t));
  1994. - if (len <= limit)
  1995. - len += sprintf(buf+len, "\nClear EOC Channel:\n\n");
  1996. - if (len <= limit)
  1997. - len += sprintf(buf+len, " Enabled:\t%d\n", dslhal_support_byteSwap32(peoc.clearEocEnabled));
  1998. - if (len <= limit)
  1999. - len += sprintf(buf+len, " TxBuf[0]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[0]));
  2000. - if (len <= limit)
  2001. - len += sprintf(buf+len, " TxBuf[1]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[1]));
  2002. - if (len <= limit)
  2003. - len += sprintf(buf+len, " TxBuf[2]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[2]));
  2004. - if (len <= limit)
  2005. - len += sprintf(buf+len, " TxBuf[3]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[3]));
  2006. - if (len <= limit)
  2007. - len += sprintf(buf+len, " RxBuf[0]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[0]));
  2008. - if (len <= limit)
  2009. - len += sprintf(buf+len, " RxBuf[1]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[1]));
  2010. - if (len <= limit)
  2011. - len += sprintf(buf+len, " RxBuf[2]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[2]));
  2012. - if (len <= limit)
  2013. - len += sprintf(buf+len, " RxBuf[3]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[3]));
  2014. - if (len <= limit)
  2015. - len += sprintf(buf+len, " txRdIndex:\t%d\n", dslhal_support_byteSwap32(peoc.txRdIndex));
  2016. - if (len <= limit)
  2017. - len += sprintf(buf+len, " txWrIndex:\t%d\n", dslhal_support_byteSwap32(peoc.txWrIndex));
  2018. - if (len <= limit)
  2019. - len += sprintf(buf+len, " rxRdIndex:\t%d\n", dslhal_support_byteSwap32(peoc.rxRdIndex));
  2020. - if (len <= limit)
  2021. - len += sprintf(buf+len, " rxWrIndex:\t%d\n\n", dslhal_support_byteSwap32(peoc.rxWrIndex));
  2022. - if (len <= limit)
  2023. - len += sprintf(buf+len, " TotalTxPkts:\t%d\n", EocTxTotalPackets);
  2024. - if (len <= limit)
  2025. - len += sprintf(buf+len, " TotalRxPkts:\t%d\n", EocRxTotalPackets);
  2026. - if (len <= limit)
  2027. - len += sprintf(buf+len, " TotalTxBytes:\t%d\n", EocTxTotalBytes);
  2028. - if (len <= limit)
  2029. - len += sprintf(buf+len, " TotalRxBytes:\t%d\n\n", EocRxTotalBytes);
  2030. - if (len <= limit)
  2031. - len += sprintf(buf+len, " ErrBufFull:\t%d\n", ErrEocBufFull);
  2032. - if (len <= limit)
  2033. - len += sprintf(buf+len, " ErrBufIndx:\t%d\n", ErrEocBufIndex);
  2034. - if (len <= limit)
  2035. - len += sprintf(buf+len, " ErrBufMax:\t%d\n", ErrEocBufMax);
  2036. - if (len <= limit)
  2037. - len += sprintf(buf+len, " ErrMsgMax:\t%d\n", ErrEocMsgOversized);
  2038. - if (len <= limit)
  2039. - len += sprintf(buf+len, " ErrTxHDLC:\t%d\n", ErrEocTxHdlcCRC);
  2040. - if (len <= limit)
  2041. - len += sprintf(buf+len, " ErrRxHDLC:\t%d\n", ErrEocRxHdlcCRC);
  2042. - if (len <= limit)
  2043. - len += sprintf(buf+len, " ErrRxSnmp:\t%d\n", ErrEocRxHdlcFraming);
  2044. - if (len <= limit)
  2045. - len += sprintf(buf+len, " ErrRxPush:\t%d\n\n", ErrEocRxPush);
  2046. + seq_printf(m, "\nClear EOC Channel:\n\n");
  2047. + seq_printf(m, " Enabled:\t%d\n", dslhal_support_byteSwap32(peoc.clearEocEnabled));
  2048. + seq_printf(m, " TxBuf[0]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[0]));
  2049. + seq_printf(m, " TxBuf[1]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[1]));
  2050. + seq_printf(m, " TxBuf[2]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[2]));
  2051. + seq_printf(m, " TxBuf[3]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[3]));
  2052. + seq_printf(m, " RxBuf[0]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[0]));
  2053. + seq_printf(m, " RxBuf[1]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[1]));
  2054. + seq_printf(m, " RxBuf[2]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[2]));
  2055. + seq_printf(m, " RxBuf[3]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[3]));
  2056. + seq_printf(m, " txRdIndex:\t%d\n", dslhal_support_byteSwap32(peoc.txRdIndex));
  2057. + seq_printf(m, " txWrIndex:\t%d\n", dslhal_support_byteSwap32(peoc.txWrIndex));
  2058. + seq_printf(m, " rxRdIndex:\t%d\n", dslhal_support_byteSwap32(peoc.rxRdIndex));
  2059. + seq_printf(m, " rxWrIndex:\t%d\n\n", dslhal_support_byteSwap32(peoc.rxWrIndex));
  2060. + seq_printf(m, " TotalTxPkts:\t%d\n", EocTxTotalPackets);
  2061. + seq_printf(m, " TotalRxPkts:\t%d\n", EocRxTotalPackets);
  2062. + seq_printf(m, " TotalTxBytes:\t%d\n", EocTxTotalBytes);
  2063. + seq_printf(m, " TotalRxBytes:\t%d\n\n", EocRxTotalBytes);
  2064. + seq_printf(m, " ErrBufFull:\t%d\n", ErrEocBufFull);
  2065. + seq_printf(m, " ErrBufIndx:\t%d\n", ErrEocBufIndex);
  2066. + seq_printf(m, " ErrBufMax:\t%d\n", ErrEocBufMax);
  2067. + seq_printf(m, " ErrMsgMax:\t%d\n", ErrEocMsgOversized);
  2068. + seq_printf(m, " ErrTxHDLC:\t%d\n", ErrEocTxHdlcCRC);
  2069. + seq_printf(m, " ErrRxHDLC:\t%d\n", ErrEocRxHdlcCRC);
  2070. + seq_printf(m, " ErrRxSnmp:\t%d\n", ErrEocRxHdlcFraming);
  2071. + seq_printf(m, " ErrRxPush:\t%d\n\n", ErrEocRxPush);
  2072. - return len;
  2073. + return 0;
  2074. +}
  2075. +
  2076. +static int tn7dsl_proc_eoc_open(struct inode *inode, struct file *file)
  2077. +{
  2078. + return single_open(file, tn7dsl_proc_eoc, PDE_DATA(inode));
  2079. }
  2080. +struct file_operations tn7dsl_proc_eoc_fops = {
  2081. + .owner = THIS_MODULE,
  2082. + .open = tn7dsl_proc_eoc_open,
  2083. + .read = seq_read,
  2084. + .llseek = seq_lseek,
  2085. + .release = single_release,
  2086. +};
  2087. +
  2088. int tn7dsl_clear_eoc_setup(void)
  2089. {
  2090. int i;
  2091. @@ -4407,14 +4314,10 @@ int tn7dsl_proc_write_stats (struct file
  2092. }
  2093. -int tn7dsl_proc_train_mode_export (char *buf, char **start, off_t offset,
  2094. - int count, int *eof, void *data)
  2095. +static int tn7dsl_proc_train_mode_export (struct seq_file *m, void *data)
  2096. {
  2097. - int len = 0;
  2098. - char *cp = buf + offset;
  2099. int i = 0;
  2100. - static int ctr = 0;
  2101. typedef struct
  2102. {
  2103. @@ -4495,197 +4398,185 @@ int tn7dsl_proc_train_mode_export (char
  2104. }
  2105. - if(len <= count)
  2106. + for (i = 0; (i < num_entries) ; i++)
  2107. {
  2108. - for (i = ctr; ((i < num_entries)&& (len <= count)) ; i++)
  2109. - {
  2110. - /*
  2111. - * Write the current string only if we can fit it into the buffer
  2112. - */
  2113. - if((strlen(dsl_modes[i].mode_name) + 6 + len) <= count)
  2114. - {
  2115. - len += snprintf(cp+len, (count - len), "%s\t\t\t%#x\n",
  2116. - dsl_modes[i].mode_name, dsl_modes[i].mode_value);
  2117. - }
  2118. - else
  2119. - break;
  2120. - }
  2121. + seq_printf(m, "%s\t\t\t%#x\n",
  2122. + dsl_modes[i].mode_name, dsl_modes[i].mode_value);
  2123. }
  2124. - /*
  2125. - * Data was completely written
  2126. - */
  2127. - if (i >= num_entries)
  2128. - {
  2129. - /*
  2130. - * We are done with this
  2131. - */
  2132. - *eof = 1;
  2133. - ctr = 0;
  2134. - }
  2135. - else
  2136. - {
  2137. - /*
  2138. - * We have not been able to write the complete data, and we have to nul
  2139. - * terminate the buffer.
  2140. - */
  2141. - *(cp + len) = '\0';
  2142. -
  2143. - /*
  2144. - * Save the value of the counter for the next read for the rest of the
  2145. - * data.
  2146. - */
  2147. - ctr = i;
  2148. - }
  2149. -
  2150. - return len;
  2151. + return 0;
  2152. }
  2153. -#ifndef NO_ADV_STATS
  2154. -int tn7dsl_proc_SNRpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data)
  2155. +static int tn7dsl_proc_train_mode_export_open(struct inode *inode, struct file *file)
  2156. {
  2157. - int len = 0;
  2158. -
  2159. + return single_open(file, tn7dsl_proc_train_mode_export, PDE_DATA(inode));
  2160. +}
  2161. +struct file_operations tn7dsl_proc_train_mode_export_fops = {
  2162. + .owner = THIS_MODULE,
  2163. + .open = tn7dsl_proc_train_mode_export_open,
  2164. + .read = seq_read,
  2165. + .llseek = seq_lseek,
  2166. + .release = single_release,
  2167. +};
  2168. - int limit = count - 80;
  2169. +#ifndef NO_ADV_STATS
  2170. +int tn7dsl_proc_SNRpsds(struct seq_file *m, void *data)
  2171. +{
  2172. int i;
  2173. unsigned char SNRpsds[512];
  2174. - if(len<=limit)
  2175. - len += sprintf(buf+len, "\nAR7 SNRpsds:");
  2176. + seq_printf(m, "\nAR7 SNRpsds:");
  2177. if (dslhal_api_getSNRpsds(pIhw, SNRpsds, 1))
  2178. {
  2179. dgprintf(4, "dslhal_api_getSNRpsds failed!\n");
  2180. - return len;
  2181. + return -EIO;
  2182. }
  2183. for (i=0; i<pIhw->AppData.max_ds_tones; i++)
  2184. {
  2185. if (!(i%16))
  2186. {
  2187. - if(len <=limit)
  2188. - len += sprintf(buf+len, "\n");
  2189. + seq_printf(m, "\n");
  2190. }
  2191. - if(len <=limit)
  2192. - len += sprintf(buf+len, "%d ", (unsigned char)SNRpsds[i]);
  2193. + seq_printf(m, "%d ", (unsigned char)SNRpsds[i]);
  2194. }
  2195. - if(len <=limit)
  2196. - len += sprintf(buf+len, "\n");
  2197. + seq_printf(m, "\n");
  2198. - return len;
  2199. + return 0;
  2200. }
  2201. +static int tn7dsl_proc_SNRpsds_open(struct inode *inode, struct file *file)
  2202. +{
  2203. + return single_open(file, tn7dsl_proc_SNRpsds, PDE_DATA(inode));
  2204. +}
  2205. +
  2206. +struct file_operations tn7dsl_proc_SNRpsds_fops = {
  2207. + .owner = THIS_MODULE,
  2208. + .open = tn7dsl_proc_SNRpsds_open,
  2209. + .read = seq_read,
  2210. + .llseek = seq_lseek,
  2211. + .release = single_release,
  2212. +};
  2213. +
  2214. #endif
  2215. #ifndef NO_ADV_STATS
  2216. -int tn7dsl_proc_QLNpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data)
  2217. +static int tn7dsl_proc_QLNpsds(struct seq_file *m, void *data)
  2218. {
  2219. - int len = 0;
  2220. -
  2221. - int limit = count - 80;
  2222. unsigned char QLNpsds[512];
  2223. int i;
  2224. - if(len<=limit)
  2225. - len += sprintf(buf+len, "\nAR7 QLNpsds:");
  2226. + seq_printf(m, "\nAR7 QLNpsds:");
  2227. // call API instead of access internal buf directly
  2228. if (dslhal_api_getQLNpsds(pIhw, QLNpsds, 0))
  2229. {
  2230. dgprintf(4, "dslhal_api_getQLNpsds failed!\n");
  2231. - return len;
  2232. + return -EIO;
  2233. }
  2234. for (i=0; i<pIhw->AppData.max_ds_tones; i++)
  2235. {
  2236. if (!(i%16))
  2237. {
  2238. - if(len <=limit)
  2239. - len += sprintf(buf+len, "\n");
  2240. + seq_printf(m, "\n");
  2241. }
  2242. - if(len <=limit)
  2243. - len += sprintf(buf+len, "%d ", (unsigned char)QLNpsds[i]);
  2244. + seq_printf(m, "%d ", (unsigned char)QLNpsds[i]);
  2245. }
  2246. - if(len <=limit)
  2247. - len += sprintf(buf+len, "\n");
  2248. + seq_printf(m, "\n");
  2249. - return len;
  2250. + return 0;
  2251. }
  2252. +
  2253. +static int tn7dsl_proc_QLNpsds_open(struct inode *inode, struct file *file)
  2254. +{
  2255. + return single_open(file, tn7dsl_proc_QLNpsds, PDE_DATA(inode));
  2256. +}
  2257. +
  2258. +struct file_operations tn7dsl_proc_QLNpsds_fops = {
  2259. + .owner = THIS_MODULE,
  2260. + .open = tn7dsl_proc_QLNpsds_open,
  2261. + .read = seq_read,
  2262. + .llseek = seq_lseek,
  2263. + .release = single_release,
  2264. +};
  2265. +
  2266. #endif
  2267. // UR8_MERGE_START CQ10979 Jack Zhang
  2268. #ifdef TR69_HLIN_IN
  2269. #ifndef NO_ADV_STATS
  2270. -int tn7dsl_proc_HLINpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data)
  2271. +static int tn7dsl_proc_HLINpsds(struct seq_file *m, void *data)
  2272. {
  2273. - int len = 0;
  2274. -
  2275. - int limit = count - 80;
  2276. short HLINpsds[2*512];
  2277. int i;
  2278. - if(len<=limit)
  2279. - len += sprintf(buf+len, "\nAR7 HLINpsds:");
  2280. + seq_printf(m, "\nAR7 HLINpsds:");
  2281. // call API instead of access internal buf directly
  2282. if (dslhal_api_getHLINpsds(pIhw, (unsigned char *)HLINpsds, 1))
  2283. {
  2284. dgprintf(4, "dslhal_api_getHLINpsds failed!\n");
  2285. - return len;
  2286. + return -EIO;
  2287. }
  2288. for (i=0; i<pIhw->AppData.max_ds_tones; i++)
  2289. {
  2290. if (!(i%8))
  2291. {
  2292. - if(len <=limit)
  2293. - len += sprintf(buf+len, "\n");
  2294. + seq_printf(m, "\n");
  2295. }
  2296. - if(len <=limit)
  2297. - len += sprintf(buf+len, "(%d,%d) ", HLINpsds[2*i], HLINpsds[2*i+1]);
  2298. + seq_printf(m, "(%d,%d) ", HLINpsds[2*i], HLINpsds[2*i+1]);
  2299. }
  2300. - if(len <=limit)
  2301. - len += sprintf(buf+len, "\n");
  2302. + seq_printf(m, "\n");
  2303. - return len;
  2304. + return 0;
  2305. }
  2306. -static int tn7dsl_proc_HLINpsdsIndx(char* buf, char **start, off_t offset, int count,int *eof, void *data, int indx)
  2307. +static int tn7dsl_proc_HLINpsds_open(struct inode *inode, struct file *file)
  2308. {
  2309. - int len = 0;
  2310. + return single_open(file, tn7dsl_proc_HLINpsds, PDE_DATA(inode));
  2311. +}
  2312. - int limit = count - 80;
  2313. +struct file_operations tn7dsl_proc_HLINpsds_fops = {
  2314. + .owner = THIS_MODULE,
  2315. + .open = tn7dsl_proc_HLINpsds_open,
  2316. + .read = seq_read,
  2317. + .llseek = seq_lseek,
  2318. + .release = single_release,
  2319. +};
  2320. +
  2321. +static int tn7dsl_proc_HLINpsdsIndx(struct seq_file *m, void *data, int indx)
  2322. +{
  2323. short HLINpsds[2*512];
  2324. int i;
  2325. int start=0, dim=128;
  2326. - if(len<=limit)
  2327. - len += sprintf(buf+len, "\nAR7 HLINpsds: (section %d)", indx);
  2328. + seq_printf(m, "\nAR7 HLINpsds: (section %d)", indx);
  2329. if((indx > 2) && (pIhw->AppData.max_ds_tones <= 256))
  2330. {
  2331. - if(len <=limit)
  2332. - len += sprintf(buf+len, "\n[End of data]");
  2333. - return len;
  2334. + seq_printf(m, "\n[End of data]");
  2335. + return 0;
  2336. }
  2337. // call API instead of access internal buf directly
  2338. if (dslhal_api_getHLINpsds(pIhw, (unsigned char *)HLINpsds, 1))
  2339. {
  2340. dgprintf(4, "dslhal_api_getHLINpsds failed!\n");
  2341. - return len;
  2342. + return -EIO;
  2343. }
  2344. start = (indx -1) * 128;
  2345. @@ -4694,39 +4585,89 @@ static int tn7dsl_proc_HLINpsdsIndx(char
  2346. {
  2347. if (!(i%8))
  2348. {
  2349. - if(len <=limit)
  2350. - len += sprintf(buf+len, "\n%d: ", i);
  2351. + seq_printf(m, "\n%d: ", i);
  2352. }
  2353. - if(len <=limit)
  2354. - len += sprintf(buf+len, "(%d,%d) ", HLINpsds[2*i], HLINpsds[2*i+1]);
  2355. + seq_printf(m, "(%d,%d) ", HLINpsds[2*i], HLINpsds[2*i+1]);
  2356. }
  2357. - if(len <=limit)
  2358. - len += sprintf(buf+len, "\n");
  2359. + seq_printf(m, "\n");
  2360. - return len;
  2361. + return 0;
  2362. +}
  2363. +
  2364. +static int tn7dsl_proc_HLINpsds1(struct seq_file *m, void *data)
  2365. +{
  2366. + return tn7dsl_proc_HLINpsdsIndx(m, data, 1);
  2367. +}
  2368. +
  2369. +static int tn7dsl_proc_HLINpsds2(struct seq_file *m, void *data)
  2370. +{
  2371. + return tn7dsl_proc_HLINpsdsIndx(m, data, 2);
  2372. +}
  2373. +
  2374. +static int tn7dsl_proc_HLINpsds3(struct seq_file *m, void *data)
  2375. +{
  2376. + return tn7dsl_proc_HLINpsdsIndx(m, data, 3);
  2377. +}
  2378. +
  2379. +static int tn7dsl_proc_HLINpsds4(struct seq_file *m, void *data)
  2380. +{
  2381. + return tn7dsl_proc_HLINpsdsIndx(m, data, 4);
  2382. }
  2383. -int tn7dsl_proc_HLINpsds1(char* buf, char **start, off_t offset, int count,int *eof, void *data)
  2384. +static int tn7dsl_proc_HLINpsds1_open(struct inode *inode, struct file *file)
  2385. {
  2386. - return tn7dsl_proc_HLINpsdsIndx(buf, start, offset, count,eof, data, 1);
  2387. + return single_open(file, tn7dsl_proc_HLINpsds1, PDE_DATA(inode));
  2388. }
  2389. -int tn7dsl_proc_HLINpsds2(char* buf, char **start, off_t offset, int count,int *eof, void *data)
  2390. +static int tn7dsl_proc_HLINpsds2_open(struct inode *inode, struct file *file)
  2391. {
  2392. - return tn7dsl_proc_HLINpsdsIndx(buf, start, offset, count,eof, data, 2);
  2393. + return single_open(file, tn7dsl_proc_HLINpsds2, PDE_DATA(inode));
  2394. }
  2395. -int tn7dsl_proc_HLINpsds3(char* buf, char **start, off_t offset, int count,int *eof, void *data)
  2396. +static int tn7dsl_proc_HLINpsds3_open(struct inode *inode, struct file *file)
  2397. {
  2398. - return tn7dsl_proc_HLINpsdsIndx(buf, start, offset, count,eof, data, 3);
  2399. + return single_open(file, tn7dsl_proc_HLINpsds3, PDE_DATA(inode));
  2400. }
  2401. -int tn7dsl_proc_HLINpsds4(char* buf, char **start, off_t offset, int count,int *eof, void *data)
  2402. +static int tn7dsl_proc_HLINpsds4_open(struct inode *inode, struct file *file)
  2403. {
  2404. - return tn7dsl_proc_HLINpsdsIndx(buf, start, offset, count,eof, data, 4);
  2405. + return single_open(file, tn7dsl_proc_HLINpsds4, PDE_DATA(inode));
  2406. }
  2407. +
  2408. +struct file_operations tn7dsl_proc_HLINpsds1_fops = {
  2409. + .owner = THIS_MODULE,
  2410. + .open = tn7dsl_proc_HLINpsds1_open,
  2411. + .read = seq_read,
  2412. + .llseek = seq_lseek,
  2413. + .release = single_release,
  2414. +};
  2415. +
  2416. +struct file_operations tn7dsl_proc_HLINpsds2_fops = {
  2417. + .owner = THIS_MODULE,
  2418. + .open = tn7dsl_proc_HLINpsds2_open,
  2419. + .read = seq_read,
  2420. + .llseek = seq_lseek,
  2421. + .release = single_release,
  2422. +};
  2423. +
  2424. +struct file_operations tn7dsl_proc_HLINpsds3_fops = {
  2425. + .owner = THIS_MODULE,
  2426. + .open = tn7dsl_proc_HLINpsds3_open,
  2427. + .read = seq_read,
  2428. + .llseek = seq_lseek,
  2429. + .release = single_release,
  2430. +};
  2431. +
  2432. +struct file_operations tn7dsl_proc_HLINpsds4_fops = {
  2433. + .owner = THIS_MODULE,
  2434. + .open = tn7dsl_proc_HLINpsds4_open,
  2435. + .read = seq_read,
  2436. + .llseek = seq_lseek,
  2437. + .release = single_release,
  2438. +};
  2439. +
  2440. #endif
  2441. #endif //TR69_HLIN_IN
  2442. // UR8_MERGE_END CQ10979*
  2443. @@ -4734,64 +4675,48 @@ int tn7dsl_proc_HLINpsds4(char* buf, cha
  2444. // * UR8_MERGE_START CQ11057 Jack Zhang
  2445. #ifdef TR69_PMD_IN
  2446. #ifndef NO_ADV_STATS
  2447. -int tn7dsl_proc_PMDus(char* buf, char **start, off_t offset, int count,int *eof, void *data)
  2448. +static int tn7dsl_proc_PMDus(struct seq_file *m, void *data)
  2449. {
  2450. - int len = 0;
  2451. -
  2452. - int limit = count - 80;
  2453. int i;
  2454. CoPMDTestParams_t co_pmdtest_params;
  2455. -
  2456. - if(len<=limit)
  2457. - len += sprintf(buf+len, "\nAR7 US PMD Test:\n");
  2458. +
  2459. + seq_printf(m, "\nAR7 US PMD Test:\n");
  2460. // call API instead of access internal buf directly
  2461. if (dslhal_api_getPMDTestus(pIhw, &co_pmdtest_params, 0) != DSLHAL_ERROR_NO_ERRORS)
  2462. {
  2463. dgprintf(4, "dslhal_api_getPMDTestus failed!\n");
  2464. - return len;
  2465. + return -EIO;
  2466. }
  2467. - if(len<=limit)
  2468. - len += sprintf(buf+len, "LATN=%d\n", co_pmdtest_params.co_latn);
  2469. + seq_printf(m, "LATN=%d\n", co_pmdtest_params.co_latn);
  2470. - if(len<=limit)
  2471. - len += sprintf(buf+len, "SATN=%d\n", co_pmdtest_params.co_satn);
  2472. + seq_printf(m, "SATN=%d\n", co_pmdtest_params.co_satn);
  2473. - if(len<=limit)
  2474. - len += sprintf(buf+len, "SNRM=%d\n", co_pmdtest_params.usMargin);
  2475. + seq_printf(m, "SNRM=%d\n", co_pmdtest_params.usMargin);
  2476. - if(len<=limit)
  2477. - len += sprintf(buf+len, "attndr=%ld\n", co_pmdtest_params.co_attndr);
  2478. + seq_printf(m, "attndr=%ld\n", co_pmdtest_params.co_attndr);
  2479. - if(len<=limit)
  2480. - len += sprintf(buf+len, "NearActatp=%d\n", co_pmdtest_params.co_near_actatp);
  2481. + seq_printf(m, "NearActatp=%d\n", co_pmdtest_params.co_near_actatp);
  2482. - if(len<=limit)
  2483. - len += sprintf(buf+len, "FarActatp=%d\n", co_pmdtest_params.co_far_actatp);
  2484. + seq_printf(m, "FarActatp=%d\n", co_pmdtest_params.co_far_actatp);
  2485. //HLOG
  2486. for (i=0; i<pIhw->AppData.max_us_tones; i++)
  2487. {
  2488. if (!(i%16))
  2489. - {
  2490. - if(len <=limit)
  2491. - len += sprintf(buf+len, "\nHLOG(%3d):", i);
  2492. - }
  2493. - if(len <=limit)
  2494. - len += sprintf(buf+len, " %d", co_pmdtest_params.TestParmCOHlogfMsg[i]);
  2495. + seq_printf(m, "\nHLOG(%3d):", i);
  2496. +
  2497. + seq_printf(m, " %d", co_pmdtest_params.TestParmCOHlogfMsg[i]);
  2498. }
  2499. //QLN
  2500. for (i=0; i<pIhw->AppData.max_us_tones; i++)
  2501. {
  2502. if (!(i%16))
  2503. - {
  2504. - if(len <=limit)
  2505. - len += sprintf(buf+len, "\nQLN(%3d):", i);
  2506. - }
  2507. - if(len <=limit)
  2508. - len += sprintf(buf+len, " %d", co_pmdtest_params.TestParmCOQLNfMsg[i]);
  2509. + seq_printf(m, "\nQLN(%3d):", i);
  2510. +
  2511. + seq_printf(m, " %d", co_pmdtest_params.TestParmCOQLNfMsg[i]);
  2512. }
  2513. @@ -4799,19 +4724,28 @@ int tn7dsl_proc_PMDus(char* buf, char **
  2514. for (i=0; i<pIhw->AppData.max_us_tones; i++)
  2515. {
  2516. if (!(i%16))
  2517. - {
  2518. - if(len <=limit)
  2519. - len += sprintf(buf+len, "\nSNR(%3d):", i);
  2520. - }
  2521. - if(len <=limit)
  2522. - len += sprintf(buf+len, " %d", co_pmdtest_params.TestParmCOSNRfMsg[i]);
  2523. + seq_printf(m, "\nSNR(%3d):", i);
  2524. + seq_printf(m, " %d", co_pmdtest_params.TestParmCOSNRfMsg[i]);
  2525. }
  2526. - if(len <=limit)
  2527. - len += sprintf(buf+len, "\n");
  2528. + seq_printf(m, "\n");
  2529. - return len;
  2530. + return 0;
  2531. +}
  2532. +
  2533. +static int tn7dsl_proc_PMDus_open(struct inode *inode, struct file *file)
  2534. +{
  2535. + return single_open(file, tn7dsl_proc_PMDus, PDE_DATA(inode));
  2536. }
  2537. +
  2538. +struct file_operations tn7dsl_proc_PMDus_fops = {
  2539. + .owner = THIS_MODULE,
  2540. + .open = tn7dsl_proc_PMDus_open,
  2541. + .read = seq_read,
  2542. + .llseek = seq_lseek,
  2543. + .release = single_release,
  2544. +};
  2545. +
  2546. #endif //NO_ADV_STATS
  2547. #endif //TR69_PMD_IN
  2548. // * UR8_MERGE_END CQ11057 *
  2549. --- a/tn7sar.c
  2550. +++ b/tn7sar.c
  2551. @@ -1395,44 +1395,66 @@ int tn7sar_oam_generation(void *privCont
  2552. return 0;
  2553. }
  2554. -int tn7sar_proc_oam_ping(char* buf, char **start, off_t offset, int count,int *eof, void *data)
  2555. +static int tn7sar_proc_oam_ping(struct seq_file *m, void *data)
  2556. {
  2557. - int len = 0;
  2558. unsigned int oam_ps = oamPingStatus;
  2559. if( oam_ps == OAM_PING_PENDING_RECVD )
  2560. oam_ps = OAM_PING_PENDING; //jz CQ9861: Only export the PENDING status, not internal state
  2561. - len += sprintf(buf+len, "%d\n", oam_ps); //oamPingStatus);
  2562. + seq_printf(m, "%d\n", oam_ps); //oamPingStatus);
  2563. - return len;
  2564. + return 0;
  2565. }
  2566. -int tn7sar_proc_pvc_table(char* buf, char **start, off_t offset, int count,int *eof, void *data)
  2567. +static int tn7sar_proc_oam_ping_open(struct inode *inode, struct file *file)
  2568. +{
  2569. + return single_open(file, tn7sar_proc_oam_ping, PDE_DATA(inode));
  2570. +}
  2571. +
  2572. +struct file_operations tn7sar_proc_oam_ping_fops = {
  2573. + .owner = THIS_MODULE,
  2574. + .open = tn7sar_proc_oam_ping_open,
  2575. + .read = seq_read,
  2576. + .llseek = seq_lseek,
  2577. + .release = single_release,
  2578. +};
  2579. +
  2580. +
  2581. +static int tn7sar_proc_pvc_table(struct seq_file *m, void *data)
  2582. {
  2583. - int len = 0;
  2584. int i;
  2585. for(i=0;i<16;i++)
  2586. {
  2587. if(pvc_result[i].bInUse)
  2588. {
  2589. - len += sprintf(buf+len, "%d,%d\n", pvc_result[i].vpi,pvc_result[i].vci);
  2590. + seq_printf(m, "%d,%d\n", pvc_result[i].vpi,pvc_result[i].vci);
  2591. }
  2592. else
  2593. {
  2594. - len += sprintf(buf+len, "0,0\n");
  2595. + seq_printf(m, "0,0\n");
  2596. }
  2597. }
  2598. - return len;
  2599. + return 0;
  2600. +}
  2601. +
  2602. +static int tn7sar_proc_pvc_table_open(struct inode *inode, struct file *file)
  2603. +{
  2604. + return single_open(file, tn7sar_proc_pvc_table, PDE_DATA(inode));
  2605. }
  2606. +struct file_operations tn7sar_proc_pvc_table_fops = {
  2607. + .owner = THIS_MODULE,
  2608. + .open = tn7sar_proc_pvc_table_open,
  2609. + .read = seq_read,
  2610. + .llseek = seq_lseek,
  2611. + .release = single_release,
  2612. +};
  2613. -int tn7sar_proc_sar_stat(char* buf, char **start, off_t offset, int count,int *eof, void *data)
  2614. +static int tn7sar_proc_sar_stat(struct seq_file *m, void *data)
  2615. {
  2616. - int len = 0;
  2617. - int limit = count - 80;
  2618. struct atm_dev *dev;
  2619. Tn7AtmPrivate *priv;
  2620. int i, j, k;
  2621. @@ -1441,21 +1463,19 @@ int tn7sar_proc_sar_stat(char* buf, char
  2622. unsigned int *pStateBase, *pSarStat;
  2623. HAL_FUNCTIONS *pHalFunc;
  2624. HAL_DEVICE *pHalDev;
  2625. - int dBytes;
  2626. - dev = (struct atm_dev *)data;
  2627. + dev = (struct atm_dev *)m->private;
  2628. priv = (Tn7AtmPrivate *)dev->dev_data;
  2629. pHalFunc = (HAL_FUNCTIONS *)priv->pSarHalFunc;
  2630. pHalDev = (HAL_DEVICE *)priv->pSarHalDev;
  2631. - len += sprintf(buf+len, "SAR HAL Statistics");
  2632. + seq_printf(m, "SAR HAL Statistics");
  2633. for(i=0;i<MAX_DMA_CHAN;i++)
  2634. {
  2635. if(priv->lut[i].inuse)
  2636. {
  2637. - if(len<=limit)
  2638. - len += sprintf(buf+len, "\nChannel %d:\n",priv->lut[i].chanid);
  2639. + seq_printf(m, "\nChannel %d:\n",priv->lut[i].chanid);
  2640. k=0;
  2641. for(j=0;j<4;j++)
  2642. {
  2643. @@ -1468,26 +1488,18 @@ int tn7sar_proc_sar_stat(char* buf, char
  2644. {
  2645. if((char *)*pSarStat == NULL)
  2646. break;
  2647. - if(len<=limit)
  2648. - {
  2649. - dBytes = sprintf(buf+len, "%s: ",(char *) *pSarStat);
  2650. - len += dBytes;
  2651. - k += dBytes;
  2652. - }
  2653. +
  2654. + seq_printf(m, "%s: ",(char *) *pSarStat);
  2655. + k += strlen((char *) *pSarStat) + strlen(": ");
  2656. pSarStat++;
  2657. - if(len<=limit)
  2658. - {
  2659. - dBytes = sprintf(buf+len, "%s; \n",(char *) *pSarStat);
  2660. - len += dBytes;
  2661. - k += dBytes;
  2662. - }
  2663. + seq_printf(m, "%s; \n",(char *) *pSarStat);
  2664. + k += strlen((char *) *pSarStat) + strlen("; \n");
  2665. pSarStat++;
  2666. if(k > 60)
  2667. {
  2668. k=0;
  2669. - if(len<=limit)
  2670. - len += sprintf(buf+len, "\n");
  2671. + seq_printf(m, "\n");
  2672. }
  2673. }
  2674. @@ -1496,9 +1508,22 @@ int tn7sar_proc_sar_stat(char* buf, char
  2675. }
  2676. }
  2677. - return len;
  2678. + return 0;
  2679. }
  2680. +static int tn7sar_proc_sar_stat_open(struct inode *inode, struct file *file)
  2681. +{
  2682. + return single_open(file, tn7sar_proc_sar_stat, PDE_DATA(inode));
  2683. +}
  2684. +
  2685. +struct file_operations tn7sar_proc_sar_stat_fops = {
  2686. + .owner = THIS_MODULE,
  2687. + .open = tn7sar_proc_sar_stat_open,
  2688. + .read = seq_read,
  2689. + .llseek = seq_lseek,
  2690. + .release = single_release,
  2691. +};
  2692. +
  2693. void tn7sar_get_sar_firmware_version(unsigned int *pdsp_version_ms, unsigned int *pdsp_version_ls)
  2694. {