220-3.10-update_proc_code.patch 101 KB

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