220-3.10-update_proc_code.patch 106 KB

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