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