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