220-3.10-update_proc_code.patch 106 KB

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