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
6 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
9 tn7atm.c | 330 ++++++--------
10 tn7dsl.c | 1447 ++++++++++++++++++++++++++++++--------------------------------
12 4 files changed, 922 insertions(+), 1009 deletions(-)
16 @@ -86,27 +86,26 @@ void * tn7atm_memcpy(void * dst, void co
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;
25 //#define ADV_DIAG_STATS 1 //CQ10275 To enable Adv 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
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);
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;
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
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;
93 // * UR8_MERGE_END CQ10979*
94 // * UR8_MERGE_START CQ11057 Jack Zhang
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;
102 // * UR8_MERGE_END CQ11057 *
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);
119 @@ -271,25 +271,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);
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,
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;
148 //CT - Added function to return chipset Id
149 void tn7atm_get_chipsetId (char *pVerId);
150 @@ -412,60 +402,59 @@ static int proc_root_already_exists = TR
153 const unsigned char name[32];
154 - int (*read_func) (char* , char **, off_t , int ,int *, void *);
155 - int (*write_func) (struct file *, const char * , unsigned long , void *);
156 + struct file_operations *fops;
159 - {"avsar_ver", tn7atm_proc_version, NULL},
160 - {"avsar_channels", tn7atm_proc_channels, NULL},
161 - {"avsar_sarhal_stats", tn7sar_proc_sar_stat, NULL},
162 - {"avsar_oam_ping", tn7sar_proc_oam_ping, NULL},
163 - {"avsar_pvc_table", tn7sar_proc_pvc_table, NULL},
164 - {"avsar_rxsnr0", tn7dsl_proc_snr0, NULL},
165 - {"avsar_rxsnr1", tn7dsl_proc_snr1, NULL},
166 - {"avsar_rxsnr2", tn7dsl_proc_snr2, NULL},
167 - {"clear_eoc_stats", tn7dsl_proc_eoc, NULL},
168 - {"avsar_bit_allocation_table", tn7dsl_proc_bit_allocation, NULL},
169 - {"avsar_dsl_modulation_schemes",tn7dsl_proc_train_mode_export, NULL},
170 + {"avsar_ver", &tn7atm_proc_version_fops},
171 + {"avsar_channels", &tn7atm_proc_channels_fops},
172 + {"avsar_sarhal_stats", &tn7sar_proc_sar_stat_fops},
173 + {"avsar_oam_ping", &tn7sar_proc_oam_ping_fops},
174 + {"avsar_pvc_table", &tn7sar_proc_pvc_table_fops},
175 + {"avsar_rxsnr0", &tn7dsl_proc_snr0_fops},
176 + {"avsar_rxsnr1", &tn7dsl_proc_snr1_fops},
177 + {"avsar_rxsnr2", &tn7dsl_proc_snr2_fops},
178 + {"clear_eoc_stats", &tn7dsl_proc_eoc_fops},
179 + {"avsar_bit_allocation_table", &tn7dsl_proc_bit_allocation_fops},
180 + {"avsar_dsl_modulation_schemes",&tn7dsl_proc_train_mode_export_fops},
182 - {"avsar_SNRpsds", tn7dsl_proc_SNRpsds, NULL},
183 - {"avsar_QLNpsds", tn7dsl_proc_QLNpsds, NULL},
184 + {"avsar_SNRpsds", &tn7dsl_proc_SNRpsds_fops},
185 + {"avsar_QLNpsds", &tn7dsl_proc_QLNpsds_fops},
186 // * UR8_MERGE_START CQ10979 Jack Zhang
188 -// {"avsar_HLINpsds", tn7dsl_proc_HLINpsds, NULL},
189 - {"avsar_HLINpsds1", tn7dsl_proc_HLINpsds1, NULL},
190 - {"avsar_HLINpsds2", tn7dsl_proc_HLINpsds2, NULL},
191 - {"avsar_HLINpsds3", tn7dsl_proc_HLINpsds3, NULL},
192 - {"avsar_HLINpsds4", tn7dsl_proc_HLINpsds4, NULL},
193 +// {"avsar_HLINpsds", &tn7dsl_proc_HLINpsds_fops},
194 + {"avsar_HLINpsds1", &tn7dsl_proc_HLINpsds1_fops},
195 + {"avsar_HLINpsds2", &tn7dsl_proc_HLINpsds2_fops},
196 + {"avsar_HLINpsds3", &tn7dsl_proc_HLINpsds3_fops},
197 + {"avsar_HLINpsds4", &tn7dsl_proc_HLINpsds4_fops},
198 #endif //TR69_HLIN_IN
199 // * UR8_MERGE_END CQ10979*
200 // * UR8_MERGE_START CQ11057 Jack Zhang
203 - {"avsar_PMDTestus", tn7dsl_proc_PMDus, NULL},
204 -// {"avsar_PMDTestus1", tn7dsl_proc_PMDus1, NULL},
205 + {"avsar_PMDTestus", &tn7dsl_proc_PMDus_fops},
206 +// {"avsar_PMDTestus1", &tn7dsl_proc_PMDus1_fops},
208 // * UR8_MERGE_END CQ11057 *
210 - {"avsar_private", tn7atm_proc_private, NULL},
211 - {"avsar_modem_training", tn7dsl_proc_modem, NULL},
212 - {"avsar_modem_stats", tn7dsl_proc_stats, tn7dsl_proc_write_stats},
213 + {"avsar_private", &tn7atm_proc_private_fops},
214 + {"avsar_modem_training", &tn7dsl_proc_modem_fops},
215 + {"avsar_modem_stats", &tn7dsl_proc_stats_fops},
217 #ifdef ADV_DIAG_STATS //CQ10275
218 -//for 2.6 {"avsar_modem_adv_stats", tn7dsl_proc_adv_stats, NULL},
219 +//for 2.6 {"avsar_modem_adv_stats", &tn7dsl_proc_adv_stats_fops},
220 //For 2.4 kernel, due to proc file system size limitation
221 - {"avsar_modem_adv_stats1", tn7dsl_proc_adv_stats1, NULL},
222 - {"avsar_modem_adv_stats2", tn7dsl_proc_adv_stats2, NULL},
223 - {"avsar_modem_adv_stats3", tn7dsl_proc_adv_stats3, NULL},
224 + {"avsar_modem_adv_stats1", &tn7dsl_proc_adv_stats1_fops},
225 + {"avsar_modem_adv_stats2", &tn7dsl_proc_adv_stats2_fops},
226 + {"avsar_modem_adv_stats3", &tn7dsl_proc_adv_stats3_fops},
227 //UR8_MERGE_START CQ10682 Jack Zhang
228 - {"avsar_modem_dbg_cmsgs", tn7dsl_proc_dbg_cmsgs, NULL},
229 - {"avsar_modem_dbg_rmsgs1", tn7dsl_proc_dbg_rmsgs1, NULL},
230 - {"avsar_modem_dbg_rmsgs2", tn7dsl_proc_dbg_rmsgs2, NULL},
231 - {"avsar_modem_dbg_rmsgs3", tn7dsl_proc_dbg_rmsgs3, NULL},
232 - {"avsar_modem_dbg_rmsgs4", tn7dsl_proc_dbg_rmsgs4, NULL},
233 + {"avsar_modem_dbg_cmsgs", &tn7dsl_proc_dbg_cmsgs_fops},
234 + {"avsar_modem_dbg_rmsgs1", &tn7dsl_proc_dbg_rmsgs1_fops},
235 + {"avsar_modem_dbg_rmsgs2", &tn7dsl_proc_dbg_rmsgs2_fops},
236 + {"avsar_modem_dbg_rmsgs3", &tn7dsl_proc_dbg_rmsgs3_fops},
237 + {"avsar_modem_dbg_rmsgs4", &tn7dsl_proc_dbg_rmsgs4_fops},
238 // UR8_MERGE_END CQ10682*
239 #endif //ADV_DIAG_STATS
240 - {"avsar_qos_enable", tn7atm_proc_qos_read, tn7atm_proc_qos_write}
241 + {"avsar_qos_enable", &tn7atm_proc_qos_fops}
245 @@ -1703,75 +1692,81 @@ int tn7atm_receive (void *os_dev, int ch
249 -static int tn7atm_proc_channels (char *buf, char **start, off_t offset,
250 - int count, int *eof, void *data)
251 +static int tn7atm_proc_channels (struct seq_file *m, void *data)
254 - int limit = count - 80;
260 - dev = (struct atm_dev *) data;
261 + dev = (struct atm_dev *) m->private;
262 priv = (Tn7AtmPrivate *) dev->dev_data;
265 - len += sprintf (buf + len, "Chan Inuse ChanID VPI VCI \n");
268 - sprintf (buf + len,
269 + seq_printf (m, "Chan Inuse ChanID VPI VCI \n");
271 "------------------------------------------------------------------\n");
273 for (i = 0; i <= MAX_DMA_CHAN; i++)
277 - len += sprintf (buf + len,
278 - " %02d %05d %05d %05d %05d \n",
279 - i, priv->lut[i].inuse, priv->lut[i].chanid,
280 - priv->lut[i].vpi, priv->lut[i].vci);
283 + " %02d %05d %05d %05d %05d \n",
284 + i, priv->lut[i].inuse, priv->lut[i].chanid,
285 + priv->lut[i].vpi, priv->lut[i].vci);
290 - sprintf (buf + len,
292 "------------------------------------------------------------------\n");
298 -static int tn7atm_proc_private (char *buf, char **start, off_t offset,
299 - int count, int *eof, void *data)
300 +static int tn7atm_proc_channels_open(struct inode *inode, struct file *file)
302 + return single_open(file, tn7atm_proc_channels, PDE_DATA(inode));
305 +static struct file_operations tn7atm_proc_channels_fops = {
306 + .owner = THIS_MODULE,
307 + .open = tn7atm_proc_channels_open,
309 + .llseek = seq_lseek,
310 + .release = single_release,
314 +static int tn7atm_proc_private (struct seq_file *m, void *data)
317 - int limit = count - 80;
321 - dev = (struct atm_dev *) data;
322 + dev = (struct atm_dev *) m->private;
323 priv = (Tn7AtmPrivate *) dev->dev_data;
326 - len += sprintf (buf + len, "\nPrivate Data Structure(%s):\n", priv->name);
328 - len += sprintf (buf + len, "----------------------------------------\n");
330 - len += sprintf (buf + len, "priv: 0x%p\n", priv);
332 - len += sprintf (buf + len, "next: 0x%p", priv->next);
334 - len += sprintf (buf + len, "\tdev: 0x%p\n", priv->dev);
337 - len += sprintf (buf + len, "tx_irq: %02d", priv->sar_irq);
339 - len += sprintf (buf + len, "rx_irq: %02d", priv->dsl_irq);
340 + seq_printf (m, "\nPrivate Data Structure(%s):\n", priv->name);
341 + seq_printf (m, "----------------------------------------\n");
342 + seq_printf (m, "priv: 0x%p\n", priv);
343 + seq_printf (m, "next: 0x%p", priv->next);
344 + seq_printf (m, "\tdev: 0x%p\n", priv->dev);
346 + seq_printf (m, "tx_irq: %02d", priv->sar_irq);
347 + seq_printf (m, "rx_irq: %02d", priv->dsl_irq);
353 +static int tn7atm_proc_private_open(struct inode *inode, struct file *file)
355 + return single_open(file, tn7atm_proc_private, PDE_DATA(inode));
358 +static struct file_operations tn7atm_proc_private_fops = {
359 + .owner = THIS_MODULE,
360 + .open = tn7atm_proc_private_open,
362 + .llseek = seq_lseek,
363 + .release = single_release,
366 void tn7atm_sarhal_isr_register (void *os_dev, void *hal_isr,
369 @@ -1890,10 +1885,8 @@ static int __init tn7atm_register (Tn7At
373 -static int tn7atm_proc_version (char *buf, char **start, off_t offset,
374 - int count, int *eof, void *data)
375 +static int tn7atm_proc_version (struct seq_file *m, void *data)
380 char chipsetID[32]; //CT CQ10076 - Added temporary buffer to store chipset Id
381 @@ -1904,56 +1897,64 @@ static int tn7atm_proc_version (char *bu
383 priv = mydev->dev_data;
386 - sprintf (buf + len, "ATM Driver version:[%d.%02d.%02d.%02d]\n",
387 - LINUXATM_VERSION_MAJOR, LINUXATM_VERSION_MINOR,
388 - LINUXATM_VERSION_BUGFIX, LINUXATM_VERSION_BUILDNUM);
389 + seq_printf (m, "ATM Driver version:[%d.%02d.%02d.%02d]\n",
390 + LINUXATM_VERSION_MAJOR, LINUXATM_VERSION_MINOR,
391 + LINUXATM_VERSION_BUGFIX, LINUXATM_VERSION_BUILDNUM);
393 tn7dsl_get_dslhal_version (dslVer);
396 - sprintf (buf + len, "DSL HAL version: [%d.%02d.%02d.%02d]\n", dslVer[0],
397 - dslVer[1], dslVer[2], dslVer[3]);
398 + seq_printf (m, "DSL HAL version: [%d.%02d.%02d.%02d]\n", dslVer[0],
399 + dslVer[1], dslVer[2], dslVer[3]);
400 tn7dsl_get_dsp_version (dspVer);
403 - sprintf (buf + len, "DSP Datapump version: [%d.%02d.%02d.%02d] ",
404 - dspVer[4], dspVer[5], dspVer[6], dspVer[7]);
405 + seq_printf (m, "DSP Datapump version: [%d.%02d.%02d.%02d] ",
406 + dspVer[4], dspVer[5], dspVer[6], dspVer[7]);
407 if (dspVer[8] == 2) // annex B
408 - len += sprintf (buf + len, "Annex B\n");
409 + seq_printf (m, "Annex B\n");
410 else if (dspVer[8] == 3) // annex c
411 - len += sprintf (buf + len, "Annex c\n");
412 + seq_printf (m, "Annex c\n");
414 - len += sprintf (buf + len, "Annex A\n");
415 + seq_printf (m, "Annex A\n");
417 tn7sar_get_sar_version (priv, &pSarVer);
419 - len += sprintf (buf + len, "SAR HAL version: [");
420 + seq_printf (m, "SAR HAL version: [");
421 for (i = 0; i < 8; i++)
423 - len += sprintf (buf + len, "%c", pSarVer[i + 7]);
424 + seq_printf (m, "%c", pSarVer[i + 7]);
426 - len += sprintf (buf + len, "]\n");
427 + seq_printf (m, "]\n");
429 tn7sar_get_sar_firmware_version (&pdspV1, &pdspV2);
430 - len += sprintf (buf + len, "PDSP Firmware version:[%01x.%02x]\n",
431 + seq_printf (m, "PDSP Firmware version:[%01x.%02x]\n",
434 //CT CQ10076 - Added code to report chipset ID using proc file system
435 tn7atm_get_chipsetId(chipsetID);
436 - len += sprintf (buf + len, "Chipset ID: [%s]\n",chipsetID);
437 + seq_printf (m, "Chipset ID: [%s]\n",chipsetID);
443 +static int tn7atm_proc_version_open(struct inode *inode, struct file *file)
445 + return single_open(file, tn7atm_proc_version, PDE_DATA(inode));
448 +static struct file_operations tn7atm_proc_version_fops = {
449 + .owner = THIS_MODULE,
450 + .open = tn7atm_proc_version_open,
452 + .llseek = seq_lseek,
453 + .release = single_release,
457 /* Device detection */
459 static int __init tn7atm_detect (void)
462 - struct proc_dir_entry *dsl_wr_file = NULL; /* Only for ones with a write
465 const char *residual;
467 @@ -2002,24 +2003,7 @@ static int __init tn7atm_detect (void)
469 for (ctr = 0; ctr < (NUM_ELEMS (proc_if)); ctr++)
471 - /* Only if we have a write function, we create a normal proc file. */
472 - if(proc_if[ctr].write_func)
474 - dsl_wr_file = create_proc_entry (proc_if[ctr].name, DRV_PROC_MODE, root_proc_dir_entry);
477 - dsl_wr_file->read_proc = proc_if[ctr].read_func;
478 - dsl_wr_file->write_proc = proc_if[ctr].write_func;
479 - dsl_wr_file->data = (void *)mydev; //UR8_MERGE_START_END CQ10700 Manjula K
481 - dsl_wr_file = NULL;
485 - /* Create a read-only entry. */
486 - create_proc_read_entry (proc_if[ctr].name, 0, root_proc_dir_entry,
487 - proc_if[ctr].read_func, mydev);
489 + proc_create_data(proc_if[ctr].name, DRV_PROC_MODE, root_proc_dir_entry, proc_if[ctr].fops, (void *)mydev);
492 tn7dsl_dslmod_sysctl_register ();
493 @@ -2491,63 +2475,10 @@ static int tn7atm_set_can_support_adsl2
498 - * This function matches a name such as "serial", and that specified by the
501 -static int tn7atm_proc_match (int len, const char *name,
502 - struct proc_dir_entry *de)
503 +static int tn7atm_proc_qos_read(struct seq_file *m, void *data)
505 - if (!de || !de->low_ino)
507 - if (de->namelen != len)
508 + seq_printf (m, "\nEnableQoS = %d\n", EnableQoS);
510 - return !strncmp (name, de->name, len);
514 - * This function parses a name such as "tty/driver/serial", and
515 - * returns the struct proc_dir_entry for "/proc/tty/driver", and
516 - * returns "serial" in residual.
518 -static int tn7atm_xlate_proc_name (const char *name,
519 - struct proc_dir_entry **ret,
520 - const char **residual)
522 - const char *cp = name, *next;
523 - struct proc_dir_entry *de;
525 - extern struct proc_dir_entry proc_root;
530 - next = strchr (cp, '/');
535 - for (de = de->subdir; de; de = de->next)
537 - if (tn7atm_proc_match (len, cp, de))
550 -static int tn7atm_proc_qos_read(char *buf, char **start, off_t offset, int count, int *eof, void *data)
554 - len += sprintf (buf + len, "\nEnableQoS = %d\n", EnableQoS);
558 static int tn7atm_proc_qos_write(struct file *fp, const char *buf, unsigned long count, void *data)
559 @@ -2581,5 +2512,19 @@ static int tn7atm_proc_qos_write(struct
563 +static int tn7atm_proc_qos_open(struct inode *inode, struct file *file)
565 + return single_open(file, tn7atm_proc_qos_read, PDE_DATA(inode));
568 +static struct file_operations tn7atm_proc_qos_fops = {
569 + .owner = THIS_MODULE,
570 + .open = tn7atm_proc_qos_open,
572 + .llseek = seq_lseek,
573 + .release = single_release,
574 + .write = tn7atm_proc_qos_write,
577 module_init (tn7atm_detect);
578 module_exit (tn7atm_exit);
581 @@ -339,7 +339,7 @@ static void tn7dsl_register_dslss_led(vo
582 void tn7dsl_dslmod_sysctl_register(void);
583 void tn7dsl_dslmod_sysctl_unregister(void);
584 static int tn7dsl_clear_eoc_receive(void);
585 -static int tn7dsl_proc_snr_print (char *buf, int count, int *eof, int data);
586 +static int tn7dsl_proc_snr_print (struct seq_file *m, int data);
587 /* end of internal functions */
589 // UR8_MERGE_START CQ11054 Jack Zhang
590 @@ -635,11 +635,9 @@ void shim_osCriticalExit(void)
591 spin_unlock_irqrestore(&shimLock, flags);
594 -static int tn7dsl_proc_snr_print (char *buf, int count, int *eof, int data)
595 +static int tn7dsl_proc_snr_print (struct seq_file *m, int data)
599 - int limit = count - 80;
601 int bin = (int) data;
602 unsigned short *rxSnrPerBin;
603 @@ -660,95 +658,128 @@ static int tn7dsl_proc_snr_print (char *
608 - len += sprintf (buf + len, "\nInvalid bin selected Bin%d :\n", bin);
611 + seq_printf (m, "\nInvalid bin selected Bin%d :\n", bin);
616 - len += sprintf (buf + len, "\nAR7 DSL Modem Rx SNR Per Bin for Bin%d :\n", bin);
617 + seq_printf (m, "\nAR7 DSL Modem Rx SNR Per Bin for Bin%d :\n", bin);
619 for (i=0; i<pIhw->AppData.max_ds_tones/16; i++)
625 - sprintf (buf + len, "%04x ",
626 + seq_printf (m, "%04x ",
627 (unsigned short) rxSnrPerBin[i * 16 + j]);
630 - len += sprintf(buf+len, "\n");
632 + seq_printf(m, "\n");
640 //@Added SNR per bin info per customer request. 05-14-2004
641 -int tn7dsl_proc_snr0 (char *buf, char **start, off_t offset, int count,
642 - int *eof, void *data)
643 +static int tn7dsl_proc_snr0 (struct seq_file *m, void *data)
645 - return tn7dsl_proc_snr_print(buf, count, eof, 0);
646 + return tn7dsl_proc_snr_print(m, 0);
649 -int tn7dsl_proc_snr1 (char *buf, char **start, off_t offset, int count,
650 - int *eof, void *data)
651 +static int tn7dsl_proc_snr0_open(struct inode *inode, struct file *file)
653 - return tn7dsl_proc_snr_print(buf, count, eof, 1);
654 + return single_open(file, tn7dsl_proc_snr0, PDE_DATA(inode));
657 +struct file_operations tn7dsl_proc_snr0_fops = {
658 + .owner = THIS_MODULE,
659 + .open = tn7dsl_proc_snr0_open,
661 + .llseek = seq_lseek,
662 + .release = single_release,
665 +static int tn7dsl_proc_snr1 (struct seq_file *m, void *data)
667 + return tn7dsl_proc_snr_print(m, 1);
670 -int tn7dsl_proc_snr2 (char *buf, char **start, off_t offset, int count,
671 - int *eof, void *data)
672 +static int tn7dsl_proc_snr1_open(struct inode *inode, struct file *file)
674 - return tn7dsl_proc_snr_print(buf, count, eof, 2);
675 + return single_open(file, tn7dsl_proc_snr1, PDE_DATA(inode));
678 +struct file_operations tn7dsl_proc_snr1_fops = {
679 + .owner = THIS_MODULE,
680 + .open = tn7dsl_proc_snr1_open,
682 + .llseek = seq_lseek,
683 + .release = single_release,
686 +static int tn7dsl_proc_snr2 (struct seq_file *m, void *data)
688 + return tn7dsl_proc_snr_print(m, 2);
691 +static int tn7dsl_proc_snr2_open(struct inode *inode, struct file *file)
693 + return single_open(file, tn7dsl_proc_snr2, PDE_DATA(inode));
696 +struct file_operations tn7dsl_proc_snr2_fops = {
697 + .owner = THIS_MODULE,
698 + .open = tn7dsl_proc_snr2_open,
700 + .llseek = seq_lseek,
701 + .release = single_release,
704 //@Added bit allocation table per customer request. 05-14-2004
705 -int tn7dsl_proc_bit_allocation (char *buf, char **start, off_t offset,
706 - int count, int *eof, void *data)
707 +static int tn7dsl_proc_bit_allocation (struct seq_file *m, void *data)
711 - int limit = count - 80;
715 - len += sprintf(buf+len, "\nAR7 DSL Modem US Bit Allocation:");
716 + seq_printf(m, "\nAR7 DSL Modem US Bit Allocation:");
718 for(i=0; i<pIhw->AppData.max_us_tones; i++)
723 - len += sprintf(buf+len, "\n");
724 + seq_printf(m, "\n");
728 - sprintf (buf + len, "%02x ",
729 - (unsigned char) pIhw->AppData.BitAllocTblUstrm[i]);
730 + seq_printf (m, "%02x ",
731 + (unsigned char) pIhw->AppData.BitAllocTblUstrm[i]);
735 - len += sprintf(buf+len, "\n\nAR7 DSL Modem DS Bit Allocation:\n");
736 + seq_printf(m, "\n\nAR7 DSL Modem DS Bit Allocation:\n");
738 for (i=0; i<pIhw->AppData.max_ds_tones/16; i++)
744 - sprintf (buf + len, "%02x ",
745 - (unsigned char) pIhw->AppData.BitAllocTblDstrm[i * 16 +
747 + seq_printf (m, "%02x ",
748 + (unsigned char) pIhw->AppData.BitAllocTblDstrm[i * 16 +
752 - len += sprintf(buf+len, "\n");
753 + seq_printf(m, "\n");
760 +int tn7dsl_proc_bit_allocation_open(struct inode *inode, struct file *file)
762 + return single_open(file, tn7dsl_proc_bit_allocation, PDE_DATA(inode));
765 +struct file_operations tn7dsl_proc_bit_allocation_fops = {
766 + .owner = THIS_MODULE,
767 + .open = tn7dsl_proc_bit_allocation_open,
769 + .llseek = seq_lseek,
770 + .release = single_release,
774 int tn7dsl_proc_ds_noise(char* buf, char **start, off_t offset, int count,
775 int *eof, void *data)
776 @@ -811,59 +842,48 @@ static char *pUnknown= "Unknown";
777 #ifdef ADV_DIAG_STATS //CQ10275, CQ10449
778 //UR8_MERGE_START CQ10449 Jack Zhang
780 -static int proc_adv_stats_header(char* buf, int limit);
781 +static int proc_adv_stats_header(struct seq_file *m);
783 -int tn7dsl_proc_adv_stats(char* buf, char **start, off_t offset, int count,
784 - int *eof, void *data)
785 +static int tn7dsl_proc_adv_stats(struct seq_file *m, void *data)
789 - int limit = count - 80;
790 //char *cp = buf + offset;
794 - static int ctr = 0;
796 // printk("proc_adv_stats: buf=0x%X, ctr=%d, offset=%d, count=%d, eof=%d\n",
797 // (unsigned int)buf, ctr, offset, count, *eof);
800 - len = proc_adv_stats_header( cp, limit);
803 - len += sprintf(cp+len, "\n\tBin No.\tBits:\tMargin:\tSNR\n");
810 + proc_adv_stats_header(m);
812 + seq_printf(m, "\n\tBin No.\tBits:\tMargin:\tSNR\n");
814 for( i =strt; i<512; i++)
818 - len += sprintf(cp+len, "\t%u\t%u\t%u\t%d\n", i,
819 + seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
820 (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
821 (unsigned int)pIhw->AppData.marginTblDstrm[i],
822 (int)pIhw->AppData.rxSnrPerBin0[i]);
828 - *(cp + len) = '\0';
829 - printk("proc_adv_stats - return: ctr=%d, len=%d\n", ctr, len);
835 printk("proc_adv_stats - return: ctr=%d, len=%d\n", ctr, len);
841 +static int tn7dsl_proc_adv_stats_open(struct inode *inode, struct file *file)
843 + return single_open(file, tn7dsl_proc_adv_stats, PDE_DATA(inode));
846 -static int proc_adv_stats_header(char* buf, int limit)
847 +struct file_operations tn7dsl_proc_adv_stats_fops = {
848 + .owner = THIS_MODULE,
849 + .open = tn7dsl_proc_adv_stats_open,
851 + .llseek = seq_lseek,
852 + .release = single_release,
855 +static int proc_adv_stats_header(struct seq_file *m)
859 @@ -872,66 +892,53 @@ static int proc_adv_stats_header(char* b
862 dslhal_api_gatherStatistics(pIhw);
864 - len += sprintf(buf+len, "\nAR7 DSL Modem Advanced Statistics:\n");
865 + seq_printf(m, "\nAR7 DSL Modem Advanced Statistics:\n");
868 + if(pIhw->lConnected != 1)
870 - if(pIhw->lConnected != 1)
872 - pIhw->AppData.USConRate = 0;
873 - pIhw->AppData.DSConRate = 0;
876 - sprintf (buf + len,
877 + pIhw->AppData.USConRate = 0;
878 + pIhw->AppData.DSConRate = 0;
881 "\t[Connection Rate]\tUS:\t%u\tDS:\t%u\n",
882 (unsigned int)pIhw->AppData.USConRate,
883 (unsigned int)pIhw->AppData.DSConRate );
886 // UR8_MERGE_START CQ11054 Jack Zhang
887 + if (dslhal_api_getHighPrecision())
889 - if (dslhal_api_getHighPrecision())
892 - sprintf (buf + len, "\t[Margin]\tUS:\t%d.%u\tDS:\t\t%d.%u\n",
893 - gInt(pIhw->AppData.usMargin), gDot1(pIhw->AppData.usMargin),
894 - gInt(pIhw->AppData.dsMargin), gDot1(pIhw->AppData.dsMargin));
899 - sprintf (buf + len, "\t[Margin]\tUS:\t%u\tDS:\t\t%u\n",
900 - (unsigned int)pIhw->AppData.usMargin,
901 - (unsigned int)pIhw->AppData.dsMargin/2 );
903 + seq_printf (m, "\t[Margin]\tUS:\t%d.%u\tDS:\t\t%d.%u\n",
904 + gInt(pIhw->AppData.usMargin), gDot1(pIhw->AppData.usMargin),
905 + gInt(pIhw->AppData.dsMargin), gDot1(pIhw->AppData.dsMargin));
909 + seq_printf (m, "\t[Margin]\tUS:\t%u\tDS:\t\t%u\n",
910 + (unsigned int)pIhw->AppData.usMargin,
911 + (unsigned int)pIhw->AppData.dsMargin/2 );
913 // UR8_MERGE_END CQ11054*
916 * Downstream/Upstream Interleaved Errors
919 - len += sprintf(buf+len, "\t[Interleave path] US (TX):\tCRC: \t%u\tFEC: \t%u\n",
920 + seq_printf(m, "\t[Interleave path] US (TX):\tCRC: \t%u\tFEC: \t%u\n",
921 (unsigned int)pIhw->AppData.usICRC_errors,
922 (unsigned int)pIhw->AppData.usIFEC_errors);
924 - len += sprintf(buf+len, "\t[Interleave path] DS (RX):\tCRC: \t%u\tFEC: \t%u\n",
925 + seq_printf(m, "\t[Interleave path] DS (RX):\tCRC: \t%u\tFEC: \t%u\n",
926 (unsigned int)pIhw->AppData.dsICRC_errors,
927 (unsigned int)pIhw->AppData.dsIFEC_errors);
929 * Upstream/Downstream Fast Errors
932 - len += sprintf(buf+len, "\t[Fast path] US (TX): \tCRC: \t%u\tFEC: \t%u\n",
933 + seq_printf(m, "\t[Fast path] US (TX): \tCRC: \t%u\tFEC: \t%u\n",
934 (unsigned int)pIhw->AppData.usFCRC_errors,
935 (unsigned int)pIhw->AppData.usFFEC_errors);
937 - len += sprintf(buf+len, "\t[Fast path] DS (RX):\tCRC: \t%u\tFEC: \t%u\n",
938 + seq_printf(m, "\t[Fast path] DS (RX):\tCRC: \t%u\tFEC: \t%u\n",
939 (unsigned int)pIhw->AppData.dsFCRC_errors,
940 (unsigned int)pIhw->AppData.dsFFEC_errors);
947 static int getDiagDisplayMode()
948 @@ -954,29 +961,24 @@ static int getDiagDisplayMode()
952 -int tn7dsl_proc_adv_stats1(char* buf, char **start, off_t offset, int count,
953 - int *eof, void *data)
954 +int tn7dsl_proc_adv_stats1(struct seq_file *m, void *data)
958 - int limit = count - 80;
960 int mode = 0; //mode = 0 => ADSL1 or ADSL2 & 2+
961 unsigned char SNRpsds[512];
964 - len = proc_adv_stats_header( buf+len, limit);
965 + proc_adv_stats_header( m);
966 mode = getDiagDisplayMode();
969 - len += sprintf(buf+len, "\tBin No.\tBits:\tMargin:\tSNR (Part 1 of 3)\n");
971 + seq_printf(m, "\tBin No.\tBits:\tMargin:\tSNR (Part 1 of 3)\n");
975 for( i =32; i<128; i++)
978 - len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
979 + seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
980 (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
981 (unsigned int)pIhw->AppData.marginTblDstrm[i],
982 (int)pIhw->AppData.rxSnrPerBin0[i]);
983 @@ -987,26 +989,34 @@ int tn7dsl_proc_adv_stats1(char* buf, ch
984 if (dslhal_api_getSNRpsds(pIhw, SNRpsds, 1))
986 dgprintf(4, "dslhal_api_getSNRpsds failed!\n");
990 for( i =32; i<128; i++)
993 - len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
994 + seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
995 (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
996 (unsigned int)pIhw->AppData.marginTblDstrm[i],
997 (i<pIhw->AppData.max_ds_tones)?(unsigned char)SNRpsds[i]:0);
1004 -int tn7dsl_proc_adv_stats2(char* buf, char **start, off_t offset, int count,
1005 - int *eof, void *data)
1006 +static int tn7dsl_proc_adv_stats1_open(struct inode *inode, struct file *file)
1008 + return single_open(file, tn7dsl_proc_adv_stats1, PDE_DATA(inode));
1012 - int limit = count - 80;
1013 +struct file_operations tn7dsl_proc_adv_stats1_fops = {
1014 + .owner = THIS_MODULE,
1015 + .open = tn7dsl_proc_adv_stats1_open,
1017 + .llseek = seq_lseek,
1018 + .release = single_release,
1021 +int tn7dsl_proc_adv_stats2(struct seq_file *m, void *data)
1024 int mode = 0; //mode = 0 => ADSL1 or ADSL2 & 2+
1025 unsigned char SNRpsds[512];
1026 @@ -1016,12 +1026,10 @@ int tn7dsl_proc_adv_stats2(char* buf, ch
1027 if( mode==1) //ADSL1
1029 dslhal_api_gatherStatistics(pIhw);
1031 - len += sprintf(buf+len, "\tBin No.\tBits:\tMargin:\tSNR (Part 2 of 3):\n");
1032 + seq_printf(m, "\tBin No.\tBits:\tMargin:\tSNR (Part 2 of 3):\n");
1033 for( i =128; i<320; i++)
1036 - len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
1037 + seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
1038 (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
1039 (unsigned int)pIhw->AppData.marginTblDstrm[i],
1040 (int)pIhw->AppData.rxSnrPerBin0[i]);
1041 @@ -1032,26 +1040,35 @@ int tn7dsl_proc_adv_stats2(char* buf, ch
1042 if (dslhal_api_getSNRpsds(pIhw, SNRpsds, 1))
1044 dgprintf(4, "dslhal_api_getSNRpsds failed!\n");
1048 for( i =128; i<320; i++)
1051 - len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
1052 + seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
1053 (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
1054 (unsigned int)pIhw->AppData.marginTblDstrm[i],
1055 (i<pIhw->AppData.max_ds_tones)?(unsigned char)SNRpsds[i]:0);
1062 -int tn7dsl_proc_adv_stats3(char* buf, char **start, off_t offset, int count,
1063 - int *eof, void *data)
1064 +static int tn7dsl_proc_adv_stats2_open(struct inode *inode, struct file *file)
1066 + return single_open(file, tn7dsl_proc_adv_stats2, PDE_DATA(inode));
1069 +struct file_operations tn7dsl_proc_adv_stats2_fops = {
1070 + .owner = THIS_MODULE,
1071 + .open = tn7dsl_proc_adv_stats2_open,
1073 + .llseek = seq_lseek,
1074 + .release = single_release,
1077 +int tn7dsl_proc_adv_stats3(struct seq_file *m, void *data)
1081 - int limit = count - 80;
1083 int mode = 0; //mode = 0 => ADSL1 or ADSL2 & 2+
1084 unsigned char SNRpsds[512];
1085 @@ -1061,12 +1078,10 @@ int tn7dsl_proc_adv_stats3(char* buf, ch
1086 if( mode==1) //ADSL1
1088 dslhal_api_gatherStatistics(pIhw);
1090 - len += sprintf(buf+len, "\tBin No.\tBits:\tMargin:\tSNR (Part 3 of 3):\n");
1091 + seq_printf(m, "\tBin No.\tBits:\tMargin:\tSNR (Part 3 of 3):\n");
1092 for( i =320; i<512; i++)
1095 - len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
1096 + seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
1097 (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
1098 (unsigned int)pIhw->AppData.marginTblDstrm[i],
1099 (int)pIhw->AppData.rxSnrPerBin0[i]);
1100 @@ -1077,283 +1092,287 @@ int tn7dsl_proc_adv_stats3(char* buf, ch
1101 if (dslhal_api_getSNRpsds(pIhw, SNRpsds, 1))
1103 dgprintf(4, "dslhal_api_getSNRpsds failed!\n");
1107 for( i =320; i<512; i++)
1110 - len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
1111 + seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
1112 (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
1113 (unsigned int)pIhw->AppData.marginTblDstrm[i],
1114 (i<pIhw->AppData.max_ds_tones)?(unsigned char)SNRpsds[i]:0);
1118 - len += sprintf(buf+len, "[End of Stats]\n");
1120 + seq_printf(m, "[End of Stats]\n");
1123 -//UR8_MERGE_END CQ10449
1124 -//UR8_MERGE_START CQ10682 Jack Zhang
1125 -int tn7dsl_proc_dbg_cmsgs(char* buf, char **start, off_t offset, int count,
1126 - int *eof, void *data)
1128 +static int tn7dsl_proc_adv_stats3_open(struct inode *inode, struct file *file)
1130 + return single_open(file, tn7dsl_proc_adv_stats3, PDE_DATA(inode));
1134 - int limit = count - 80;
1135 +struct file_operations tn7dsl_proc_adv_stats3_fops = {
1136 + .owner = THIS_MODULE,
1137 + .open = tn7dsl_proc_adv_stats3_open,
1139 + .llseek = seq_lseek,
1140 + .release = single_release,
1143 +//UR8_MERGE_END CQ10449
1144 +//UR8_MERGE_START CQ10682 Jack Zhang
1145 +int tn7dsl_proc_dbg_cmsgs(struct seq_file *m, void *data)
1149 dslhal_api_gatherStatistics(pIhw);
1152 - len += sprintf(buf+len, "Training Messages (C-Msgs 1-5)..\n");
1153 + seq_printf(m, "Training Messages (C-Msgs 1-5)..\n");
1156 - len += sprintf(buf+len, "ADSL2 DELT C-Msg1Ld \t Message Length:%d\n",
1157 + seq_printf(m, "ADSL2 DELT C-Msg1Ld \t Message Length:%d\n",
1158 pIhw->adsl2DiagnosticMessages.cMsg1LdLen);
1159 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg1LdLen;rc++)
1162 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg1Ld[rc]);
1163 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg1Ld[rc]);
1164 if(rc!=0 && (rc%16==0))
1166 - len += sprintf(buf+len, "\n");
1167 + seq_printf(m, "\n");
1170 - len += sprintf(buf+len, "\nADSL2 DELT C-Msg2Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg2LdLen);
1171 + seq_printf(m, "\nADSL2 DELT C-Msg2Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg2LdLen);
1173 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg2LdLen;rc++)
1176 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg2Ld[rc]);
1177 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg2Ld[rc]);
1178 if(rc!=0 && (rc%16==0))
1180 - len += sprintf(buf+len, "\n");
1181 + seq_printf(m, "\n");
1185 - len += sprintf(buf+len, "\nADSL2 DELT C-Msg3Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg3LdLen);
1186 + seq_printf(m, "\nADSL2 DELT C-Msg3Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg3LdLen);
1188 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg3LdLen;rc++)
1191 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg3Ld[rc]);
1192 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg3Ld[rc]);
1193 if(rc!=0 && (rc%16==0))
1195 - len += sprintf(buf+len, "\n");
1196 + seq_printf(m, "\n");
1200 - len += sprintf(buf+len, "\nADSL2 DELT C-Msg4Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg4LdLen);
1201 + seq_printf(m, "\nADSL2 DELT C-Msg4Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg4LdLen);
1203 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg4LdLen;rc++)
1206 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg4Ld[rc]);
1207 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg4Ld[rc]);
1208 if(rc!=0 && (rc%16==0))
1210 - len += sprintf(buf+len, "\n");
1211 + seq_printf(m, "\n");
1215 - len += sprintf(buf+len, "\nADSL2 DELT C-Msg5Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg5LdLen);
1216 + seq_printf(m, "\nADSL2 DELT C-Msg5Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg5LdLen);
1218 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg5LdLen;rc++)
1221 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg5Ld[rc]);
1222 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg5Ld[rc]);
1223 if(rc!=0 && (rc%16==0))
1225 - len += sprintf(buf+len, "\n");
1226 + seq_printf(m, "\n");
1229 - len += sprintf(buf+len, "\n");
1231 + seq_printf(m, "\n");
1235 -int tn7dsl_proc_dbg_rmsgs1(char* buf, char **start, off_t offset, int count,
1236 - int *eof, void *data)
1237 +static int tn7dsl_proc_dbg_cmsgs_open(struct inode *inode, struct file *file)
1239 + return single_open(file, tn7dsl_proc_dbg_cmsgs, PDE_DATA(inode));
1243 - int limit = count - 80;
1244 +struct file_operations tn7dsl_proc_dbg_cmsgs_fops = {
1245 + .owner = THIS_MODULE,
1246 + .open = tn7dsl_proc_dbg_cmsgs_open,
1248 + .llseek = seq_lseek,
1249 + .release = single_release,
1253 +int tn7dsl_proc_dbg_rmsgs1(struct seq_file *m, void *data)
1258 dslhal_api_gatherStatistics(pIhw);
1261 - len += sprintf(buf+len, "Training Messages (R-Msgs 1-3)..\n");
1262 + seq_printf(m, "Training Messages (R-Msgs 1-3)..\n");
1265 - len += sprintf(buf+len, "\nADSL2 DELT R-Msg1Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsg1LdLen);
1266 + seq_printf(m, "\nADSL2 DELT R-Msg1Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsg1LdLen);
1268 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsg1LdLen;rc++)
1271 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg1Ld[rc]);
1272 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg1Ld[rc]);
1273 if(rc!=0 && (rc%16==0))
1275 - len += sprintf(buf+len, "\n");
1276 + seq_printf(m, "\n");
1280 - len += sprintf(buf+len, "\nADSL2 DELT R-Msg2Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1281 + seq_printf(m, "\nADSL2 DELT R-Msg2Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1283 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
1286 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg2Ld[rc]);
1287 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg2Ld[rc]);
1288 if(rc!=0 && (rc%16==0))
1290 - len += sprintf(buf+len, "\n");
1291 + seq_printf(m, "\n");
1295 - len += sprintf(buf+len, "\nADSL2 DELT R-Msg3Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1296 + seq_printf(m, "\nADSL2 DELT R-Msg3Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1297 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
1300 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg3Ld[rc]);
1301 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg3Ld[rc]);
1302 if(rc!=0 && (rc%16==0))
1304 - len += sprintf(buf+len, "\n");
1305 + seq_printf(m, "\n");
1308 - len += sprintf(buf+len, "\n");
1310 + seq_printf(m, "\n");
1314 -int tn7dsl_proc_dbg_rmsgs2(char* buf, char **start, off_t offset, int count,
1315 - int *eof, void *data)
1316 +static int tn7dsl_proc_dbg_rmsgs1_open(struct inode *inode, struct file *file)
1318 + return single_open(file, tn7dsl_proc_dbg_rmsgs1, PDE_DATA(inode));
1322 - int limit = count - 80;
1323 +struct file_operations tn7dsl_proc_dbg_rmsgs1_fops = {
1324 + .owner = THIS_MODULE,
1325 + .open = tn7dsl_proc_dbg_rmsgs1_open,
1327 + .llseek = seq_lseek,
1328 + .release = single_release,
1332 +int tn7dsl_proc_dbg_rmsgs2(struct seq_file *m, void *data)
1337 dslhal_api_gatherStatistics(pIhw);
1340 - len += sprintf(buf+len, "Training Messages (R-Msgs 4-5)..\n");
1341 + seq_printf(m, "Training Messages (R-Msgs 4-5)..\n");
1344 - len += sprintf(buf+len, "\nADSL2 DELT R-Msg4Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1345 + seq_printf(m, "\nADSL2 DELT R-Msg4Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1346 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
1349 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg4Ld[rc]);
1350 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg4Ld[rc]);
1351 if(rc!=0 && (rc%16==0))
1353 - len += sprintf(buf+len, "\n");
1354 + len += sprintf(m, "\n");
1358 - len += sprintf(buf+len, "\nADSL2 DELT R-Msg5Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1359 + seq_printf(m, "\nADSL2 DELT R-Msg5Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1360 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
1363 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg5Ld[rc]);
1364 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg5Ld[rc]);
1365 if(rc!=0 && (rc%16==0))
1367 - len += sprintf(buf+len, "\n");
1368 + seq_printf(m, "\n");
1372 - len += sprintf(buf+len, "\n");
1374 + seq_printf(m, "\n");
1378 -int tn7dsl_proc_dbg_rmsgs3(char* buf, char **start, off_t offset, int count,
1379 - int *eof, void *data)
1380 +static int tn7dsl_proc_dbg_rmsgs2_open(struct inode *inode, struct file *file)
1382 + return single_open(file, tn7dsl_proc_dbg_rmsgs2, PDE_DATA(inode));
1386 - int limit = count - 80;
1387 +struct file_operations _fops = {
1388 + .owner = THIS_MODULE,
1389 + .open = tn7dsl_proc_dbg_rmsgs2_open,
1391 + .llseek = seq_lseek,
1392 + .release = single_release,
1395 +int tn7dsl_proc_dbg_rmsgs3(struct seq_file *m, void *data)
1400 dslhal_api_gatherStatistics(pIhw);
1403 - len += sprintf(buf+len, "Training Messages (R-Msgs 6-7)..\n");
1404 + seq_printf(m, "Training Messages (R-Msgs 6-7)..\n");
1407 - len += sprintf(buf+len, "\nADSL2 DELT R-Msg6Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1408 + seq_printf(m, "\nADSL2 DELT R-Msg6Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1409 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
1412 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg6Ld[rc]);
1413 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg6Ld[rc]);
1414 if(rc!=0 && (rc%16==0))
1416 - len += sprintf(buf+len, "\n");
1417 + seq_printf(m, "\n");
1420 - len += sprintf(buf+len, "\nADSL2 DELT R-Msg7Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1421 + seq_printf(m, "\nADSL2 DELT R-Msg7Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1422 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
1425 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg7Ld[rc]);
1426 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg7Ld[rc]);
1427 if(rc!=0 && (rc%16==0))
1429 - len += sprintf(buf+len, "\n");
1430 + seq_printf(m, "\n");
1433 - len += sprintf(buf+len, "\n");
1434 + seq_printf(m, "\n");
1440 -int tn7dsl_proc_dbg_rmsgs4(char* buf, char **start, off_t offset, int count,
1441 - int *eof, void *data)
1442 +static int tn7dsl_proc_dbg_rmsgs3_open(struct inode *inode, struct file *file)
1444 + return single_open(file, tn7dsl_proc_dbg_rmsgs3, PDE_DATA(inode));
1448 - int limit = count - 80;
1449 +struct file_operations tn7dsl_proc_dbg_rmsgs3_fops = {
1450 + .owner = THIS_MODULE,
1451 + .open = tn7dsl_proc_dbg_rmsgs3_open,
1453 + .llseek = seq_lseek,
1454 + .release = single_release,
1457 +int tn7dsl_proc_dbg_rmsgs4(struct seq_file *m, void *data)
1462 dslhal_api_gatherStatistics(pIhw);
1465 - len += sprintf(buf+len, "Training Messages (R-Msgs 8-9)..\n");
1466 + seq_printf(m, "Training Messages (R-Msgs 8-9)..\n");
1469 - len += sprintf(buf+len, "\nADSL2 DELT R-Msg8Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1470 + seq_printf(m, "\nADSL2 DELT R-Msg8Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1471 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
1474 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg8Ld[rc]);
1475 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg8Ld[rc]);
1476 if(rc!=0 && (rc%16==0))
1478 - len += sprintf(buf+len, "\n");
1479 + seq_printf(m, "\n");
1483 - len += sprintf(buf+len, "\nADSL2 DELT R-Msg9Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1484 + seq_printf(m, "\nADSL2 DELT R-Msg9Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1485 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
1488 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg9Ld[rc]);
1489 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg9Ld[rc]);
1490 if(rc!=0 && (rc%16==0))
1492 - len += sprintf(buf+len, "\n");
1493 + seq_printf(m, "\n");
1496 - len += sprintf(buf+len, "\n");
1497 + seq_printf(m, "\n");
1503 +static int tn7dsl_proc_dbg_rmsgs4_open(struct inode *inode, struct file *file)
1505 + return single_open(file, tn7dsl_proc_dbg_rmsgs4, PDE_DATA(inode));
1508 +struct file_operations tn7dsl_proc_dbg_rmsgs4_fops = {
1509 + .owner = THIS_MODULE,
1510 + .open = tn7dsl_proc_dbg_rmsgs4_open,
1512 + .llseek = seq_lseek,
1513 + .release = single_release,
1516 //UR8_MERGE_END CQ10682*
1517 #endif //ADV_DIAG_STATS
1519 -int tn7dsl_proc_stats(char* buf, char **start, off_t offset, int count,
1520 - int *eof, void *data)
1521 +static int tn7dsl_proc_stats(struct seq_file *m, void *data)
1525 - int limit = count - 80;
1526 int F4count, F5count;
1527 unsigned int maxRate=0;
1528 unsigned int us_maxRate=0;
1529 @@ -1361,80 +1380,58 @@ int tn7dsl_proc_stats(char* buf, char **
1530 //UR8_MERGE_START CQ10700 Manjula K
1531 struct atm_dev *dev;
1532 Tn7AtmPrivate *priv;
1533 - dev = (struct atm_dev *)data;
1534 + int offset[2] = { 32, 0 };
1535 + unsigned int usBitswap, dsBitswap;
1536 + dev = (struct atm_dev *)m->private;
1537 priv = (Tn7AtmPrivate *)dev->dev_data;
1538 //UR8_MERGE_END CQ10700
1545 dslhal_api_gatherStatistics(pIhw);
1547 - len += sprintf(buf+len, "\nAR7 DSL Modem Statistics:\n");
1549 - len += sprintf(buf+len, "--------------------------------\n");
1550 + seq_printf(m, "\nAR7 DSL Modem Statistics:\n");
1551 + seq_printf(m, "--------------------------------\n");
1553 * us and ds Connection Rates
1556 - len += sprintf(buf+len, "[DSL Modem Stats]\n");
1557 + seq_printf(m, "[DSL Modem Stats]\n");
1561 + if(pIhw->lConnected != 1)
1563 - if(pIhw->lConnected != 1)
1565 - pIhw->AppData.USConRate = 0;
1566 - pIhw->AppData.DSConRate = 0;
1569 - sprintf (buf + len,
1570 - "\tUS Connection Rate:\t%u\tDS Connection Rate:\t%u\n",
1571 - (unsigned int)pIhw->AppData.USConRate,
1572 - (unsigned int)pIhw->AppData.DSConRate );
1573 + pIhw->AppData.USConRate = 0;
1574 + pIhw->AppData.DSConRate = 0;
1578 + "\tUS Connection Rate:\t%u\tDS Connection Rate:\t%u\n",
1579 + (unsigned int)pIhw->AppData.USConRate,
1580 + (unsigned int)pIhw->AppData.DSConRate );
1581 // UR8_MERGE_START CQ11054 Jack Zhang
1583 - if (dslhal_api_getHighPrecision())
1586 - sprintf (buf + len, "\tDS Line Attenuation:\t%u.%u\tDS Margin:\t\t%d.%u\n",
1587 + if (dslhal_api_getHighPrecision())
1588 + seq_printf (m, "\tDS Line Attenuation:\t%u.%u\tDS Margin:\t\t%d.%u\n",
1589 gInt(pIhw->AppData.dsLineAttn), gDot1(pIhw->AppData.dsLineAttn),
1590 gInt(pIhw->AppData.dsMargin), gDot1(pIhw->AppData.dsMargin));
1594 - sprintf (buf + len, "\tDS Line Attenuation:\t%u\tDS Margin:\t\t%u\n",
1596 + seq_printf (m, "\tDS Line Attenuation:\t%u\tDS Margin:\t\t%u\n",
1597 (unsigned int)pIhw->AppData.dsLineAttn/2,
1598 (unsigned int)pIhw->AppData.dsMargin/2 );
1601 // UR8_MERGE_END CQ11054*
1604 // UR8_MERGE_START CQ11054 Jack Zhang
1606 - if (dslhal_api_getHighPrecision())
1609 - sprintf (buf + len, "\tUS Line Attenuation:\t%u.%u\tUS Margin:\t\t%d.%u\n",
1610 + if (dslhal_api_getHighPrecision())
1611 + seq_printf (m, "\tUS Line Attenuation:\t%u.%u\tUS Margin:\t\t%d.%u\n",
1612 gInt(pIhw->AppData.usLineAttn), gDot1(pIhw->AppData.usLineAttn),
1613 gInt(pIhw->AppData.usMargin), gDot1(pIhw->AppData.usMargin));
1618 - sprintf (buf + len, "\tUS Line Attenuation:\t%u\tUS Margin:\t\t%u\n",
1620 + seq_printf (m, "\tUS Line Attenuation:\t%u\tUS Margin:\t\t%u\n",
1621 (unsigned int)pIhw->AppData.usLineAttn/2,
1622 (unsigned int)pIhw->AppData.usMargin );
1625 // UR8_MERGE_END CQ11054*
1628 - len += sprintf(buf+len, "\tUS Payload :\t\t%u\tDS Payload:\t\t%u\n",
1629 + seq_printf(m, "\tUS Payload :\t\t%u\tDS Payload:\t\t%u\n",
1630 ((unsigned int) pIhw->AppData.usAtm_count[0] +
1631 (unsigned int) pIhw->AppData.usAtm_count[1]) * 48,
1632 ((unsigned int) pIhw->AppData.dsGood_count[0] +
1633 @@ -1442,9 +1439,7 @@ int tn7dsl_proc_stats(char* buf, char **
1639 - sprintf (buf + len,
1641 "\tUS Superframe Cnt :\t%u\tDS Superframe Cnt:\t%u\n",
1642 (unsigned int)pIhw->AppData.usSuperFrmCnt,
1643 (unsigned int)pIhw->AppData.dsSuperFrmCnt );
1644 @@ -1452,57 +1447,45 @@ int tn7dsl_proc_stats(char* buf, char **
1649 + if(pIhw->AppData.bState < 5)
1651 - if(pIhw->AppData.bState < 5)
1653 - pIhw->AppData.usTxPower = 0;
1654 - pIhw->AppData.dsTxPower = 0;
1657 - sprintf (buf + len,
1658 + pIhw->AppData.usTxPower = 0;
1659 + pIhw->AppData.dsTxPower = 0;
1662 +// UR8_MERGE_START - CQ11579 - Jeremy #1
1663 "\tUS Transmit Power :\t%u\tDS Transmit Power:\t%u\n",
1664 (unsigned int)pIhw->AppData.usTxPower/256,
1665 (unsigned int)pIhw->AppData.dsTxPower/256 );
1667 +// UR8_MERGE_END - CQ11579
1672 - len += sprintf(buf+len, "\tLOS errors:\t\t%u\tSEF errors:\t\t%u\n",
1673 + seq_printf(m, "\tLOS errors:\t\t%u\tSEF errors:\t\t%u\n",
1674 (unsigned int)pIhw->AppData.LOS_errors,
1675 (unsigned int)pIhw->AppData.SEF_errors );
1677 //UR8_MERGE_START Report_SES Manjula K
1680 - len += sprintf(buf+len, "\tErrored Seconds:\t%u\tSeverely Err Secs:\t%u\n",
1681 + seq_printf(m, "\tErrored Seconds:\t%u\tSeverely Err Secs:\t%u\n",
1682 (unsigned int)pIhw->AppData.erroredSeconds,
1683 (unsigned int)pIhw->AppData.severelyerrsecs );
1684 //UR8_MERGE_END Report_SES
1687 - len += sprintf(buf+len, "\tFrame mode:\t\t%u\tMax Frame mode:\t\t%u\n",
1689 + seq_printf(m, "\tFrame mode:\t\t%u\tMax Frame mode:\t\t%u\n",
1690 (unsigned int)pIhw->AppData.FrmMode,
1691 (unsigned int)pIhw->AppData.MaxFrmMode );
1694 - sprintf (buf + len, "\tTrained Path:\t\t%u\tUS Peak Cell Rate:\t%u\n",
1695 + seq_printf (m, "\tTrained Path:\t\t%u\tUS Peak Cell Rate:\t%u\n",
1696 (unsigned int)pIhw->AppData.TrainedPath,
1697 (unsigned int)pIhw->AppData.USConRate*1000/8/53 );
1700 - sprintf (buf + len, "\tTrained Mode:\t\t%u\tSelected Mode:\t\t%u\n",
1701 + seq_printf (m, "\tTrained Mode:\t\t%u\tSelected Mode:\t\t%u\n",
1702 (unsigned int) pIhw->AppData.TrainedMode,
1703 (unsigned int) pIhw->AppData.StdMode);
1707 - sprintf (buf + len, "\tATUC Vendor Code:\t%X\tATUC Revision:\t%u\n",
1708 + seq_printf (m, "\tATUC Vendor Code:\t%X\tATUC Revision:\t%u\n",
1709 (unsigned int) pIhw->AppData.atucVendorId,
1710 pIhw->AppData.atucRevisionNum);
1712 - len += sprintf(buf+len, "\tHybrid Selected:\t%u\tTrellis:\t\t%u\n",
1713 + seq_printf(m, "\tHybrid Selected:\t%u\tTrellis:\t\t%u\n",
1714 (unsigned int)pIhw->AppData.currentHybridNum, trellis);
1716 //@Added Maximum attainable bit rate information. 05-14-2004
1717 @@ -1514,12 +1497,12 @@ int tn7dsl_proc_stats(char* buf, char **
1721 - int offset[2] = {5, 1};
1722 + int dspOffset[2] = { 5, 1 };
1723 unsigned char rMsgsRA[12];
1724 int numPayloadBytes = 0;
1726 dslhal_api_dspInterfaceRead (pIhw, (unsigned int) pIhw->pmainAddr, 2,
1727 - (unsigned int *) &offset,
1728 + (unsigned int *) &dspOffset,
1729 (unsigned char *) &rMsgsRA[0], 12);
1731 maxRate = (unsigned int)pIhw->AppData.DSConRate;
1732 @@ -1535,283 +1518,213 @@ int tn7dsl_proc_stats(char* buf, char **
1738 - sprintf (buf + len,
1740 "\tShowtime Count:\t\t%u\tDS Max Attainable Bit Rate: %u kbps\n",
1741 (unsigned int)pIhw->AppData.showtimeCount, maxRate);
1745 - int offset[2] = {32, 0};
1746 - unsigned int usBitswap, dsBitswap;
1747 + tn7dsl_generic_read(2, (unsigned int *)&offset);
1748 + dsBitswap = dslReg & dslhal_support_byteSwap32(0x000000ff);
1750 - tn7dsl_generic_read(2, (unsigned int *)&offset);
1751 - dsBitswap = dslReg & dslhal_support_byteSwap32(0x000000ff);
1753 + tn7dsl_generic_read(2, (unsigned int *)&offset);
1754 + usBitswap = dslReg & dslhal_support_byteSwap32(0x000000ff);
1757 - tn7dsl_generic_read(2, (unsigned int *)&offset);
1758 - usBitswap = dslReg & dslhal_support_byteSwap32(0x000000ff);
1760 - if(pIhw->AppData.dsl_modulation > 5)
1762 - sprintf (buf + len,
1763 + if(pIhw->AppData.dsl_modulation > 5)
1765 "\tBitSwap:\t\t%u\tUS Max Attainable Bit Rate: %u bps\n",
1766 (unsigned int)(usBitswap && dsBitswap), us_maxRate);
1769 - sprintf (buf + len,
1772 "\tBitSwap:\t\t%u\tUS Max Attainable Bit Rate:\tn/a\n",
1773 (unsigned int)(usBitswap && dsBitswap));
1779 - sprintf (buf + len, "\tAnnex: \t\t\t%s\tpsd_mask_qualifier: 0x%04x\n",
1780 + seq_printf (m, "\tAnnex: \t\t\t%s\tpsd_mask_qualifier: 0x%04x\n",
1781 tn7dsl_AnnexFromNum(pIhw->AppData.annex_selected),
1782 pIhw->AppData.psd_mask_qualifier);
1784 // UR8_MERGE_START CQ10979 Jack Zhang
1785 // UR8_MERGE_START CQ10978 Jack Zhang
1788 - sprintf (buf + len, "\tPower Management Status: L%d\tDS HLINSC: %d\n",
1789 + seq_printf (m, "\tPower Management Status: L%d\tDS HLINSC: %d\n",
1790 pIhw->AppData.pwrStatus, pIhw->AppData.dsHLINSC);
1791 // UR8_MERGE_END CQ10978*
1795 - sprintf (buf + len, "\tUS ACTPSD: \t\t%d\tDS ACTPSD: %d\n",
1796 + seq_printf (m, "\tUS ACTPSD: \t\t%d\tDS ACTPSD: %d\n",
1797 pIhw->AppData.usACTPSD, pIhw->AppData.dsACTPSD);
1801 - sprintf (buf + len, "\tTotal init. errors: \t%d\tTotal init. timeouts: %d\n",
1802 + seq_printf (m, "\tTotal init. errors: \t%d\tTotal init. timeouts: %d\n",
1803 pIhw->AppData.totalInitErrs, pIhw->AppData.totalInitTOs);
1807 - sprintf (buf + len, "\tShowtime init. errors: \t%d\tShowtime init. timeouts: %d\n",
1808 + seq_printf (m, "\tShowtime init. errors: \t%d\tShowtime init. timeouts: %d\n",
1809 pIhw->AppData.showtimeInitErrs, pIhw->AppData.showtimeInitTOs);
1813 - sprintf (buf + len, "\tLast showtime init. errors: %ld\tLast showtime init. timeouts: %ld\n",
1814 + seq_printf (m, "\tLast showtime init. errors: %ld\tLast showtime init. timeouts: %ld\n",
1815 pIhw->AppData.lastshowInitErrs, pIhw->AppData.lastshowInitTOs);
1816 // UR8_MERGE_END CQ10979*
1820 - len += sprintf(buf+len,"\tATUC ghsVid: ");
1821 - for (i=0; i<8; i++)
1822 - len+= sprintf(buf+len, " %02x", pIhw->AppData.ghsATUCVendorId[i]);
1824 + seq_printf(m,"\tATUC ghsVid: ");
1825 + for (i=0; i<8; i++)
1826 + seq_printf(m, " %02x", pIhw->AppData.ghsATUCVendorId[i]);
1830 - len += sprintf (buf + len, "\n");
1832 + seq_printf (m, "\n");
1837 - sprintf (buf + len,
1839 "\tT1413Vid: %02x %02x\t\tT1413Rev: %02x\t\tVendorRev: %02x\n",
1840 pIhw->AppData.t1413ATUC.VendorId[0],
1841 pIhw->AppData.t1413ATUC.VendorId[1],
1842 pIhw->AppData.t1413ATUC.t1413Revision,
1843 pIhw->AppData.t1413ATUC.VendorRevision);
1848 - len += sprintf(buf+len,"\tATUR ghsVid: ");
1849 - for (i=0; i<8; i++)
1850 - len+= sprintf(buf+len, " %02x", pIhw->AppData.ghsATURVendorId[i]);
1852 + seq_printf(m,"\tATUR ghsVid: ");
1853 + for (i=0; i<8; i++)
1854 + seq_printf(m, " %02x", pIhw->AppData.ghsATURVendorId[i]);
1858 - len += sprintf (buf + len, "\n");
1860 + seq_printf (m, "\n");
1865 - sprintf (buf + len,
1867 "\tT1413Vid: %02x %02x\tT1413Rev: %02x\tVendorRev: %02x\n",
1868 pIhw->AppData.t1413ATUR.VendorId[0],
1869 pIhw->AppData.t1413ATUR.VendorId[1],
1870 pIhw->AppData.t1413ATUR.t1413Revision,
1871 pIhw->AppData.t1413ATUR.VendorRevision);
1876 * Upstream Interleaved Errors
1879 - len += sprintf(buf+len, "\n\t[Upstream (TX) Interleave path]\n");
1881 - len += sprintf(buf+len, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
1882 + seq_printf(m, "\n\t[Upstream (TX) Interleave path]\n");
1883 + seq_printf(m, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
1884 (unsigned int)pIhw->AppData.usICRC_errors,
1885 (unsigned int)pIhw->AppData.usIFEC_errors,
1886 (unsigned int)pIhw->AppData.usINCD_error);
1888 - len += sprintf(buf+len, "\tLCD: \t%u\tHEC: \t%u\n",
1889 + seq_printf(m, "\tLCD: \t%u\tHEC: \t%u\n",
1890 (unsigned int)pIhw->AppData.usILCD_errors,
1891 (unsigned int)pIhw->AppData.usIHEC_errors);
1893 * Downstream Interleaved Errors
1896 - len += sprintf(buf+len, "\n\t[Downstream (RX) Interleave path]\n");
1898 - len += sprintf(buf+len, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
1899 + seq_printf(m, "\n\t[Downstream (RX) Interleave path]\n");
1900 + seq_printf(m, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
1901 (unsigned int)pIhw->AppData.dsICRC_errors,
1902 (unsigned int)pIhw->AppData.dsIFEC_errors,
1903 (unsigned int)pIhw->AppData.dsINCD_error);
1905 - len += sprintf(buf+len, "\tLCD: \t%u\tHEC: \t%u\n",
1906 + seq_printf(m, "\tLCD: \t%u\tHEC: \t%u\n",
1907 (unsigned int)pIhw->AppData.dsILCD_errors,
1908 (unsigned int)pIhw->AppData.dsIHEC_errors);
1910 * Upstream Fast Errors
1913 - len += sprintf(buf+len, "\n\t[Upstream (TX) Fast path]\n");
1915 - len += sprintf(buf+len, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
1916 + seq_printf(m, "\n\t[Upstream (TX) Fast path]\n");
1917 + seq_printf(m, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
1918 (unsigned int)pIhw->AppData.usFCRC_errors,
1919 (unsigned int)pIhw->AppData.usFFEC_errors,
1920 (unsigned int)pIhw->AppData.usFNCD_error);
1922 - len += sprintf(buf+len, "\tLCD: \t%u\tHEC: \t%u\n",
1923 + seq_printf(m, "\tLCD: \t%u\tHEC: \t%u\n",
1924 (unsigned int)pIhw->AppData.usFLCD_errors,
1925 (unsigned int)pIhw->AppData.usFHEC_errors);
1927 * Downstream Fast Errors
1930 - len += sprintf(buf+len, "\n\t[Downstream (RX) Fast path]\n");
1932 - len += sprintf(buf+len, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
1933 + seq_printf(m, "\n\t[Downstream (RX) Fast path]\n");
1934 + seq_printf(m, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
1935 (unsigned int)pIhw->AppData.dsFCRC_errors,
1936 (unsigned int)pIhw->AppData.dsFFEC_errors,
1937 (unsigned int)pIhw->AppData.dsFNCD_error);
1939 - len += sprintf(buf+len, "\tLCD: \t%u\tHEC: \t%u\n",
1940 - (unsigned int)pIhw->AppData.dsFLCD_errors,
1941 - (unsigned int)pIhw->AppData.dsFHEC_errors);
1942 + seq_printf(m, "\tLCD: \t%u\tHEC: \t%u\n",
1943 + (unsigned int)pIhw->AppData.dsFLCD_errors,
1944 + (unsigned int)pIhw->AppData.dsFHEC_errors);
1947 * ATM stats upstream
1950 - len += sprintf(buf+len, "\n[ATM Stats]");
1952 - len += sprintf(buf+len, "\n\t[Upstream/TX]\n");
1955 - sprintf (buf + len, "\tGood Cell Cnt:\t%u\n\tIdle Cell Cnt:\t%u\n\n",
1956 - (unsigned int) pIhw->AppData.usAtm_count[0] +
1957 - (unsigned int) pIhw->AppData.usAtm_count[1],
1958 - (unsigned int) pIhw->AppData.usIdle_count[0] +
1959 - (unsigned int) pIhw->AppData.usIdle_count[1]);
1960 -//UR8_MERGE_START CQ10700 Manjula K
1963 - sprintf (buf + len,
1964 + seq_printf(m, "\n[ATM Stats]");
1965 + seq_printf(m, "\n\t[Upstream/TX]\n");
1966 + seq_printf (m, "\tGood Cell Cnt:\t%u\n\tIdle Cell Cnt:\t%u\n\n",
1967 + (unsigned int) pIhw->AppData.usAtm_count[0] +
1968 + (unsigned int) pIhw->AppData.usAtm_count[1],
1969 + (unsigned int) pIhw->AppData.usIdle_count[0] +
1970 + (unsigned int) pIhw->AppData.usIdle_count[1]);
1971 +//UR8_MERGE_START CQ10700 Manjula K
1973 "\tTx Packets Dropped Count:\t%lu\n\tTx Bad Packets Count:\t%lu\n",
1974 priv->stats.tx_dropped, priv->stats.tx_errors);
1975 //UR8_MERGE_END CQ10700
1977 * ATM stats downstream
1980 - len += sprintf(buf+len, "\n\t[Downstream/RX)]\n");
1983 - sprintf (buf + len,
1984 - "\tGood Cell Cnt:\t%u\n\tIdle Cell Cnt:\t%u\n\tBad Hec Cell Cnt:\t%u\n",
1985 - (unsigned int) pIhw->AppData.dsGood_count[0] +
1986 - (unsigned int) pIhw->AppData.dsGood_count[1],
1987 - (unsigned int) pIhw->AppData.dsIdle_count[0] +
1988 - (unsigned int) pIhw->AppData.dsIdle_count[1],
1989 - (unsigned int) pIhw->AppData.dsBadHec_count[0] +
1990 - (unsigned int) pIhw->AppData.dsBadHec_count[1]);
1992 - len += sprintf(buf+len, "\tOverflow Dropped Cell Cnt:\t%u\n",
1993 - (unsigned int) pIhw->AppData.dsOVFDrop_count[0] +
1994 - (unsigned int) pIhw->AppData.dsOVFDrop_count[1]);
1996 - //UR8_MERGE_START CQ10700 Manjula K
1999 - sprintf (buf + len,
2000 - "\tRx Packets Dropped Count:\t%lu\n\tRx Bad Packets Count:\t%lu\n\n",
2001 - priv->stats.rx_dropped, priv->stats.rx_errors);
2002 + seq_printf(m, "\n\t[Downstream/RX)]\n");
2004 + "\tGood Cell Cnt:\t%u\n\tIdle Cell Cnt:\t%u\n\tBad Hec Cell Cnt:\t%u\n",
2005 + (unsigned int) pIhw->AppData.dsGood_count[0] +
2006 + (unsigned int) pIhw->AppData.dsGood_count[1],
2007 + (unsigned int) pIhw->AppData.dsIdle_count[0] +
2008 + (unsigned int) pIhw->AppData.dsIdle_count[1],
2009 + (unsigned int) pIhw->AppData.dsBadHec_count[0] +
2010 + (unsigned int) pIhw->AppData.dsBadHec_count[1]);
2011 + seq_printf(m, "\tOverflow Dropped Cell Cnt:\t%u\n",
2012 + (unsigned int) pIhw->AppData.dsOVFDrop_count[0] +
2013 + (unsigned int) pIhw->AppData.dsOVFDrop_count[1]);
2015 + //UR8_MERGE_START CQ10700 Manjula K
2017 + "\tRx Packets Dropped Count:\t%lu\n\tRx Bad Packets Count:\t%lu\n\n",
2018 + priv->stats.rx_dropped, priv->stats.rx_errors);
2019 //UR8_MERGE_END CQ10700
2021 tn7sar_get_stats(pIhw->pOsContext);
2023 - len += sprintf(buf+len, "\n[SAR AAL5 Stats]\n");
2025 - len += sprintf(buf+len, "\tTx PDU's:\t%u\n\tRx PDU's:\t%u\n",
2026 - sarStat.txPktCnt, sarStat.rxPktCnt);
2029 - sprintf (buf + len, "\tTx Total Bytes:\t%u\n\tRx Total Bytes:\t%u\n",
2030 - sarStat.txBytes, sarStat.rxBytes);
2033 - sprintf (buf + len,
2034 - "\tTx Total Error Counts:\t%u\n\tRx Total Error Counts:\t%u\n\n",
2035 - sarStat.txErrors, sarStat.rxErrors);
2036 + seq_printf(m, "\n[SAR AAL5 Stats]\n");
2037 + seq_printf(m, "\tTx PDU's:\t%u\n\tRx PDU's:\t%u\n",
2038 + sarStat.txPktCnt, sarStat.rxPktCnt);
2039 + seq_printf (m, "\tTx Total Bytes:\t%u\n\tRx Total Bytes:\t%u\n",
2040 + sarStat.txBytes, sarStat.rxBytes);
2042 + "\tTx Total Error Counts:\t%u\n\tRx Total Error Counts:\t%u\n\n",
2043 + sarStat.txErrors, sarStat.rxErrors);
2049 - len += sprintf(buf+len, "\n[OAM Stats]\n");
2050 + seq_printf(m, "\n[OAM Stats]\n");
2052 tn7sar_get_near_end_loopback_count(&F4count, &F5count);
2057 - sprintf (buf + len,
2058 - "\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",
2060 + "\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",
2061 F5count, F4count, oamFarLBCount[0] + oamFarLBCount[2],
2062 oamFarLBCount[1] + oamFarLBCount[3]);
2065 #define USE_OAM_DROP_COUNT //CQ10273
2066 //Read OAM ping responses count:
2067 #ifdef USE_OAM_DROP_COUNT
2071 - sprintf (buf + len,
2072 - "\tSAR OAM Retry in 0x%X cycles, Drop Count=%d\n",
2073 - tn7dsl_get_memory(0xa30085cc), tn7dsl_get_memory(0xa30085c4)); */
2075 + "\tSAR OAM Retry in 0x%X cycles, Drop Count=%d\n",
2076 + tn7dsl_get_memory(0xa30085cc), tn7dsl_get_memory(0xa30085c4)); */
2078 - len += sprintf (buf + len, "\tSAR OAM Ping Response Drop Count=%d\n",
2079 - tn7dsl_get_memory(0xa30085b0));
2081 + seq_printf (m, "\tSAR OAM Ping Response Drop Count=%d\n",
2082 + tn7dsl_get_memory(0xa30085b0));
2083 #endif // USE_OAM_DROP_COUNT
2089 -int tn7dsl_proc_modem(char* buf, char **start, off_t offset, int count,
2090 - int *eof, void *data)
2091 +static int tn7dsl_proc_stats_open(struct inode *inode, struct file *file)
2093 + return single_open(file, tn7dsl_proc_stats, PDE_DATA(inode));
2097 - int limit = count - 80;
2098 +int tn7dsl_proc_write_stats (struct file *fp, const char *buf, unsigned long count, void *data);
2100 +struct file_operations tn7dsl_proc_stats_fops = {
2101 + .owner = THIS_MODULE,
2102 + .open = tn7dsl_proc_stats_open,
2104 + .llseek = seq_lseek,
2105 + .release = single_release,
2106 + .write = tn7dsl_proc_write_stats,
2109 +static int tn7dsl_proc_modem(struct seq_file *m, void *data)
2114 @@ -1845,16 +1758,26 @@ int tn7dsl_proc_modem(char* buf, char **
2116 if(pIhw->lConnected == 1)
2119 - len += sprintf(buf+len,"%s\n",state);
2121 - len += sprintf(buf+len, "%d\n", dslReg);
2123 - len += sprintf(buf+len, "failTrains=%d\n", pIhw->AppData.trainFails);
2124 + seq_printf(m,"%s\n",state);
2125 + seq_printf(m, "%d\n", dslReg);
2126 + seq_printf(m, "failTrains=%d\n", pIhw->AppData.trainFails);
2132 +static int tn7dsl_proc_modem_open(struct inode *inode, struct file *file)
2134 + return single_open(file, tn7dsl_proc_modem, PDE_DATA(inode));
2137 +struct file_operations tn7dsl_proc_modem_fops = {
2138 + .owner = THIS_MODULE,
2139 + .open = tn7dsl_proc_modem_open,
2141 + .llseek = seq_lseek,
2142 + .release = single_release,
2145 /**********************************************************************
2147 ** tn7dsl_hdlc_update_crc() -- Calculate CRC *
2148 @@ -2119,11 +2042,8 @@ static int tn7dsl_hdlc_rx_process(unsign
2152 -int tn7dsl_proc_eoc (char *buf, char **start, off_t OffSet, int count,
2153 - int *eof, void *data)
2154 +static int tn7dsl_proc_eoc (struct seq_file *m, void *data)
2157 - int limit = count - 80;
2158 int offset[2] = {34, 0}; // point to buffer parameter data structure
2159 clearEocParm_t peoc;
2161 @@ -2132,62 +2052,49 @@ int tn7dsl_proc_eoc (char *buf, char **s
2162 (unsigned char *) &peoc,
2163 sizeof (clearEocParm_t));
2166 - len += sprintf(buf+len, "\nClear EOC Channel:\n\n");
2168 - len += sprintf(buf+len, " Enabled:\t%d\n", dslhal_support_byteSwap32(peoc.clearEocEnabled));
2170 - len += sprintf(buf+len, " TxBuf[0]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[0]));
2172 - len += sprintf(buf+len, " TxBuf[1]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[1]));
2174 - len += sprintf(buf+len, " TxBuf[2]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[2]));
2176 - len += sprintf(buf+len, " TxBuf[3]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[3]));
2178 - len += sprintf(buf+len, " RxBuf[0]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[0]));
2180 - len += sprintf(buf+len, " RxBuf[1]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[1]));
2182 - len += sprintf(buf+len, " RxBuf[2]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[2]));
2184 - len += sprintf(buf+len, " RxBuf[3]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[3]));
2186 - len += sprintf(buf+len, " txRdIndex:\t%d\n", dslhal_support_byteSwap32(peoc.txRdIndex));
2188 - len += sprintf(buf+len, " txWrIndex:\t%d\n", dslhal_support_byteSwap32(peoc.txWrIndex));
2190 - len += sprintf(buf+len, " rxRdIndex:\t%d\n", dslhal_support_byteSwap32(peoc.rxRdIndex));
2192 - len += sprintf(buf+len, " rxWrIndex:\t%d\n\n", dslhal_support_byteSwap32(peoc.rxWrIndex));
2194 - len += sprintf(buf+len, " TotalTxPkts:\t%d\n", EocTxTotalPackets);
2196 - len += sprintf(buf+len, " TotalRxPkts:\t%d\n", EocRxTotalPackets);
2198 - len += sprintf(buf+len, " TotalTxBytes:\t%d\n", EocTxTotalBytes);
2200 - len += sprintf(buf+len, " TotalRxBytes:\t%d\n\n", EocRxTotalBytes);
2202 - len += sprintf(buf+len, " ErrBufFull:\t%d\n", ErrEocBufFull);
2204 - len += sprintf(buf+len, " ErrBufIndx:\t%d\n", ErrEocBufIndex);
2206 - len += sprintf(buf+len, " ErrBufMax:\t%d\n", ErrEocBufMax);
2208 - len += sprintf(buf+len, " ErrMsgMax:\t%d\n", ErrEocMsgOversized);
2210 - len += sprintf(buf+len, " ErrTxHDLC:\t%d\n", ErrEocTxHdlcCRC);
2212 - len += sprintf(buf+len, " ErrRxHDLC:\t%d\n", ErrEocRxHdlcCRC);
2214 - len += sprintf(buf+len, " ErrRxSnmp:\t%d\n", ErrEocRxHdlcFraming);
2216 - len += sprintf(buf+len, " ErrRxPush:\t%d\n\n", ErrEocRxPush);
2217 + seq_printf(m, "\nClear EOC Channel:\n\n");
2218 + seq_printf(m, " Enabled:\t%d\n", dslhal_support_byteSwap32(peoc.clearEocEnabled));
2219 + seq_printf(m, " TxBuf[0]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[0]));
2220 + seq_printf(m, " TxBuf[1]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[1]));
2221 + seq_printf(m, " TxBuf[2]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[2]));
2222 + seq_printf(m, " TxBuf[3]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[3]));
2223 + seq_printf(m, " RxBuf[0]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[0]));
2224 + seq_printf(m, " RxBuf[1]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[1]));
2225 + seq_printf(m, " RxBuf[2]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[2]));
2226 + seq_printf(m, " RxBuf[3]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[3]));
2227 + seq_printf(m, " txRdIndex:\t%d\n", dslhal_support_byteSwap32(peoc.txRdIndex));
2228 + seq_printf(m, " txWrIndex:\t%d\n", dslhal_support_byteSwap32(peoc.txWrIndex));
2229 + seq_printf(m, " rxRdIndex:\t%d\n", dslhal_support_byteSwap32(peoc.rxRdIndex));
2230 + seq_printf(m, " rxWrIndex:\t%d\n\n", dslhal_support_byteSwap32(peoc.rxWrIndex));
2231 + seq_printf(m, " TotalTxPkts:\t%d\n", EocTxTotalPackets);
2232 + seq_printf(m, " TotalRxPkts:\t%d\n", EocRxTotalPackets);
2233 + seq_printf(m, " TotalTxBytes:\t%d\n", EocTxTotalBytes);
2234 + seq_printf(m, " TotalRxBytes:\t%d\n\n", EocRxTotalBytes);
2235 + seq_printf(m, " ErrBufFull:\t%d\n", ErrEocBufFull);
2236 + seq_printf(m, " ErrBufIndx:\t%d\n", ErrEocBufIndex);
2237 + seq_printf(m, " ErrBufMax:\t%d\n", ErrEocBufMax);
2238 + seq_printf(m, " ErrMsgMax:\t%d\n", ErrEocMsgOversized);
2239 + seq_printf(m, " ErrTxHDLC:\t%d\n", ErrEocTxHdlcCRC);
2240 + seq_printf(m, " ErrRxHDLC:\t%d\n", ErrEocRxHdlcCRC);
2241 + seq_printf(m, " ErrRxSnmp:\t%d\n", ErrEocRxHdlcFraming);
2242 + seq_printf(m, " ErrRxPush:\t%d\n\n", ErrEocRxPush);
2248 +static int tn7dsl_proc_eoc_open(struct inode *inode, struct file *file)
2250 + return single_open(file, tn7dsl_proc_eoc, PDE_DATA(inode));
2253 +struct file_operations tn7dsl_proc_eoc_fops = {
2254 + .owner = THIS_MODULE,
2255 + .open = tn7dsl_proc_eoc_open,
2257 + .llseek = seq_lseek,
2258 + .release = single_release,
2261 int tn7dsl_clear_eoc_setup(void)
2264 @@ -4407,14 +4314,10 @@ int tn7dsl_proc_write_stats (struct file
2268 -int tn7dsl_proc_train_mode_export (char *buf, char **start, off_t offset,
2269 - int count, int *eof, void *data)
2270 +static int tn7dsl_proc_train_mode_export (struct seq_file *m, void *data)
2274 - char *cp = buf + offset;
2276 - static int ctr = 0;
2280 @@ -4495,197 +4398,185 @@ int tn7dsl_proc_train_mode_export (char
2285 + for (i = 0; (i < num_entries) ; i++)
2287 - for (i = ctr; ((i < num_entries)&& (len <= count)) ; i++)
2290 - * Write the current string only if we can fit it into the buffer
2292 - if((strlen(dsl_modes[i].mode_name) + 6 + len) <= count)
2294 - len += snprintf(cp+len, (count - len), "%s\t\t\t%#x\n",
2295 - dsl_modes[i].mode_name, dsl_modes[i].mode_value);
2300 + seq_printf(m, "%s\t\t\t%#x\n",
2301 + dsl_modes[i].mode_name, dsl_modes[i].mode_value);
2305 - * Data was completely written
2307 - if (i >= num_entries)
2310 - * We are done with this
2318 - * We have not been able to write the complete data, and we have to nul
2319 - * terminate the buffer.
2321 - *(cp + len) = '\0';
2324 - * Save the value of the counter for the next read for the rest of the
2334 -#ifndef NO_ADV_STATS
2335 -int tn7dsl_proc_SNRpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data)
2336 +static int tn7dsl_proc_train_mode_export_open(struct inode *inode, struct file *file)
2340 + return single_open(file, tn7dsl_proc_train_mode_export, PDE_DATA(inode));
2343 +struct file_operations tn7dsl_proc_train_mode_export_fops = {
2344 + .owner = THIS_MODULE,
2345 + .open = tn7dsl_proc_train_mode_export_open,
2347 + .llseek = seq_lseek,
2348 + .release = single_release,
2351 - int limit = count - 80;
2352 +#ifndef NO_ADV_STATS
2353 +int tn7dsl_proc_SNRpsds(struct seq_file *m, void *data)
2356 unsigned char SNRpsds[512];
2359 - len += sprintf(buf+len, "\nAR7 SNRpsds:");
2360 + seq_printf(m, "\nAR7 SNRpsds:");
2362 if (dslhal_api_getSNRpsds(pIhw, SNRpsds, 1))
2364 dgprintf(4, "dslhal_api_getSNRpsds failed!\n");
2369 for (i=0; i<pIhw->AppData.max_ds_tones; i++)
2374 - len += sprintf(buf+len, "\n");
2375 + seq_printf(m, "\n");
2379 - len += sprintf(buf+len, "%d ", (unsigned char)SNRpsds[i]);
2380 + seq_printf(m, "%d ", (unsigned char)SNRpsds[i]);
2384 - len += sprintf(buf+len, "\n");
2385 + seq_printf(m, "\n");
2393 +static int tn7dsl_proc_SNRpsds_open(struct inode *inode, struct file *file)
2395 + return single_open(file, tn7dsl_proc_SNRpsds, PDE_DATA(inode));
2398 +struct file_operations tn7dsl_proc_SNRpsds_fops = {
2399 + .owner = THIS_MODULE,
2400 + .open = tn7dsl_proc_SNRpsds_open,
2402 + .llseek = seq_lseek,
2403 + .release = single_release,
2408 #ifndef NO_ADV_STATS
2409 -int tn7dsl_proc_QLNpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data)
2410 +static int tn7dsl_proc_QLNpsds(struct seq_file *m, void *data)
2414 - int limit = count - 80;
2415 unsigned char QLNpsds[512];
2419 - len += sprintf(buf+len, "\nAR7 QLNpsds:");
2420 + seq_printf(m, "\nAR7 QLNpsds:");
2422 // call API instead of access internal buf directly
2423 if (dslhal_api_getQLNpsds(pIhw, QLNpsds, 0))
2425 dgprintf(4, "dslhal_api_getQLNpsds failed!\n");
2430 for (i=0; i<pIhw->AppData.max_ds_tones; i++)
2435 - len += sprintf(buf+len, "\n");
2436 + seq_printf(m, "\n");
2440 - len += sprintf(buf+len, "%d ", (unsigned char)QLNpsds[i]);
2441 + seq_printf(m, "%d ", (unsigned char)QLNpsds[i]);
2445 - len += sprintf(buf+len, "\n");
2446 + seq_printf(m, "\n");
2453 +static int tn7dsl_proc_QLNpsds_open(struct inode *inode, struct file *file)
2455 + return single_open(file, tn7dsl_proc_QLNpsds, PDE_DATA(inode));
2458 +struct file_operations tn7dsl_proc_QLNpsds_fops = {
2459 + .owner = THIS_MODULE,
2460 + .open = tn7dsl_proc_QLNpsds_open,
2462 + .llseek = seq_lseek,
2463 + .release = single_release,
2468 // UR8_MERGE_START CQ10979 Jack Zhang
2470 #ifndef NO_ADV_STATS
2471 -int tn7dsl_proc_HLINpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data)
2472 +static int tn7dsl_proc_HLINpsds(struct seq_file *m, void *data)
2476 - int limit = count - 80;
2477 short HLINpsds[2*512];
2481 - len += sprintf(buf+len, "\nAR7 HLINpsds:");
2482 + seq_printf(m, "\nAR7 HLINpsds:");
2484 // call API instead of access internal buf directly
2485 if (dslhal_api_getHLINpsds(pIhw, (unsigned char *)HLINpsds, 1))
2487 dgprintf(4, "dslhal_api_getHLINpsds failed!\n");
2492 for (i=0; i<pIhw->AppData.max_ds_tones; i++)
2497 - len += sprintf(buf+len, "\n");
2498 + seq_printf(m, "\n");
2502 - len += sprintf(buf+len, "(%d,%d) ", HLINpsds[2*i], HLINpsds[2*i+1]);
2503 + seq_printf(m, "(%d,%d) ", HLINpsds[2*i], HLINpsds[2*i+1]);
2507 - len += sprintf(buf+len, "\n");
2508 + seq_printf(m, "\n");
2515 -static int tn7dsl_proc_HLINpsdsIndx(char* buf, char **start, off_t offset, int count,int *eof, void *data, int indx)
2516 +static int tn7dsl_proc_HLINpsds_open(struct inode *inode, struct file *file)
2519 + return single_open(file, tn7dsl_proc_HLINpsds, PDE_DATA(inode));
2522 - int limit = count - 80;
2523 +struct file_operations tn7dsl_proc_HLINpsds_fops = {
2524 + .owner = THIS_MODULE,
2525 + .open = tn7dsl_proc_HLINpsds_open,
2527 + .llseek = seq_lseek,
2528 + .release = single_release,
2531 +static int tn7dsl_proc_HLINpsdsIndx(struct seq_file *m, void *data, int indx)
2533 short HLINpsds[2*512];
2535 int start=0, dim=128;
2538 - len += sprintf(buf+len, "\nAR7 HLINpsds: (section %d)", indx);
2539 + seq_printf(m, "\nAR7 HLINpsds: (section %d)", indx);
2541 if((indx > 2) && (pIhw->AppData.max_ds_tones <= 256))
2544 - len += sprintf(buf+len, "\n[End of data]");
2546 + seq_printf(m, "\n[End of data]");
2550 // call API instead of access internal buf directly
2551 if (dslhal_api_getHLINpsds(pIhw, (unsigned char *)HLINpsds, 1))
2553 dgprintf(4, "dslhal_api_getHLINpsds failed!\n");
2558 start = (indx -1) * 128;
2559 @@ -4694,39 +4585,89 @@ static int tn7dsl_proc_HLINpsdsIndx(char
2564 - len += sprintf(buf+len, "\n%d: ", i);
2565 + seq_printf(m, "\n%d: ", i);
2569 - len += sprintf(buf+len, "(%d,%d) ", HLINpsds[2*i], HLINpsds[2*i+1]);
2570 + seq_printf(m, "(%d,%d) ", HLINpsds[2*i], HLINpsds[2*i+1]);
2574 - len += sprintf(buf+len, "\n");
2575 + seq_printf(m, "\n");
2581 +static int tn7dsl_proc_HLINpsds1(struct seq_file *m, void *data)
2583 + return tn7dsl_proc_HLINpsdsIndx(m, data, 1);
2586 +static int tn7dsl_proc_HLINpsds2(struct seq_file *m, void *data)
2588 + return tn7dsl_proc_HLINpsdsIndx(m, data, 2);
2591 +static int tn7dsl_proc_HLINpsds3(struct seq_file *m, void *data)
2593 + return tn7dsl_proc_HLINpsdsIndx(m, data, 3);
2596 +static int tn7dsl_proc_HLINpsds4(struct seq_file *m, void *data)
2598 + return tn7dsl_proc_HLINpsdsIndx(m, data, 4);
2601 -int tn7dsl_proc_HLINpsds1(char* buf, char **start, off_t offset, int count,int *eof, void *data)
2602 +static int tn7dsl_proc_HLINpsds1_open(struct inode *inode, struct file *file)
2604 - return tn7dsl_proc_HLINpsdsIndx(buf, start, offset, count,eof, data, 1);
2605 + return single_open(file, tn7dsl_proc_HLINpsds1, PDE_DATA(inode));
2608 -int tn7dsl_proc_HLINpsds2(char* buf, char **start, off_t offset, int count,int *eof, void *data)
2609 +static int tn7dsl_proc_HLINpsds2_open(struct inode *inode, struct file *file)
2611 - return tn7dsl_proc_HLINpsdsIndx(buf, start, offset, count,eof, data, 2);
2612 + return single_open(file, tn7dsl_proc_HLINpsds2, PDE_DATA(inode));
2615 -int tn7dsl_proc_HLINpsds3(char* buf, char **start, off_t offset, int count,int *eof, void *data)
2616 +static int tn7dsl_proc_HLINpsds3_open(struct inode *inode, struct file *file)
2618 - return tn7dsl_proc_HLINpsdsIndx(buf, start, offset, count,eof, data, 3);
2619 + return single_open(file, tn7dsl_proc_HLINpsds3, PDE_DATA(inode));
2622 -int tn7dsl_proc_HLINpsds4(char* buf, char **start, off_t offset, int count,int *eof, void *data)
2623 +static int tn7dsl_proc_HLINpsds4_open(struct inode *inode, struct file *file)
2625 - return tn7dsl_proc_HLINpsdsIndx(buf, start, offset, count,eof, data, 4);
2626 + return single_open(file, tn7dsl_proc_HLINpsds4, PDE_DATA(inode));
2629 +struct file_operations tn7dsl_proc_HLINpsds1_fops = {
2630 + .owner = THIS_MODULE,
2631 + .open = tn7dsl_proc_HLINpsds1_open,
2633 + .llseek = seq_lseek,
2634 + .release = single_release,
2637 +struct file_operations tn7dsl_proc_HLINpsds2_fops = {
2638 + .owner = THIS_MODULE,
2639 + .open = tn7dsl_proc_HLINpsds2_open,
2641 + .llseek = seq_lseek,
2642 + .release = single_release,
2645 +struct file_operations tn7dsl_proc_HLINpsds3_fops = {
2646 + .owner = THIS_MODULE,
2647 + .open = tn7dsl_proc_HLINpsds3_open,
2649 + .llseek = seq_lseek,
2650 + .release = single_release,
2653 +struct file_operations tn7dsl_proc_HLINpsds4_fops = {
2654 + .owner = THIS_MODULE,
2655 + .open = tn7dsl_proc_HLINpsds4_open,
2657 + .llseek = seq_lseek,
2658 + .release = single_release,
2662 #endif //TR69_HLIN_IN
2663 // UR8_MERGE_END CQ10979*
2664 @@ -4734,64 +4675,48 @@ int tn7dsl_proc_HLINpsds4(char* buf, cha
2665 // * UR8_MERGE_START CQ11057 Jack Zhang
2667 #ifndef NO_ADV_STATS
2668 -int tn7dsl_proc_PMDus(char* buf, char **start, off_t offset, int count,int *eof, void *data)
2669 +static int tn7dsl_proc_PMDus(struct seq_file *m, void *data)
2673 - int limit = count - 80;
2675 CoPMDTestParams_t co_pmdtest_params;
2678 - len += sprintf(buf+len, "\nAR7 US PMD Test:\n");
2680 + seq_printf(m, "\nAR7 US PMD Test:\n");
2682 // call API instead of access internal buf directly
2683 if (dslhal_api_getPMDTestus(pIhw, &co_pmdtest_params, 0) != DSLHAL_ERROR_NO_ERRORS)
2685 dgprintf(4, "dslhal_api_getPMDTestus failed!\n");
2691 - len += sprintf(buf+len, "LATN=%d\n", co_pmdtest_params.co_latn);
2692 + seq_printf(m, "LATN=%d\n", co_pmdtest_params.co_latn);
2695 - len += sprintf(buf+len, "SATN=%d\n", co_pmdtest_params.co_satn);
2696 + seq_printf(m, "SATN=%d\n", co_pmdtest_params.co_satn);
2699 - len += sprintf(buf+len, "SNRM=%d\n", co_pmdtest_params.usMargin);
2700 + seq_printf(m, "SNRM=%d\n", co_pmdtest_params.usMargin);
2703 - len += sprintf(buf+len, "attndr=%ld\n", co_pmdtest_params.co_attndr);
2704 + seq_printf(m, "attndr=%ld\n", co_pmdtest_params.co_attndr);
2707 - len += sprintf(buf+len, "NearActatp=%d\n", co_pmdtest_params.co_near_actatp);
2708 + seq_printf(m, "NearActatp=%d\n", co_pmdtest_params.co_near_actatp);
2711 - len += sprintf(buf+len, "FarActatp=%d\n", co_pmdtest_params.co_far_actatp);
2712 + seq_printf(m, "FarActatp=%d\n", co_pmdtest_params.co_far_actatp);
2715 for (i=0; i<pIhw->AppData.max_us_tones; i++)
2720 - len += sprintf(buf+len, "\nHLOG(%3d):", i);
2723 - len += sprintf(buf+len, " %d", co_pmdtest_params.TestParmCOHlogfMsg[i]);
2724 + seq_printf(m, "\nHLOG(%3d):", i);
2726 + seq_printf(m, " %d", co_pmdtest_params.TestParmCOHlogfMsg[i]);
2730 for (i=0; i<pIhw->AppData.max_us_tones; i++)
2735 - len += sprintf(buf+len, "\nQLN(%3d):", i);
2738 - len += sprintf(buf+len, " %d", co_pmdtest_params.TestParmCOQLNfMsg[i]);
2739 + seq_printf(m, "\nQLN(%3d):", i);
2741 + seq_printf(m, " %d", co_pmdtest_params.TestParmCOQLNfMsg[i]);
2745 @@ -4799,19 +4724,28 @@ int tn7dsl_proc_PMDus(char* buf, char **
2746 for (i=0; i<pIhw->AppData.max_us_tones; i++)
2751 - len += sprintf(buf+len, "\nSNR(%3d):", i);
2754 - len += sprintf(buf+len, " %d", co_pmdtest_params.TestParmCOSNRfMsg[i]);
2755 + seq_printf(m, "\nSNR(%3d):", i);
2756 + seq_printf(m, " %d", co_pmdtest_params.TestParmCOSNRfMsg[i]);
2760 - len += sprintf(buf+len, "\n");
2761 + seq_printf(m, "\n");
2767 +static int tn7dsl_proc_PMDus_open(struct inode *inode, struct file *file)
2769 + return single_open(file, tn7dsl_proc_PMDus, PDE_DATA(inode));
2772 +struct file_operations tn7dsl_proc_PMDus_fops = {
2773 + .owner = THIS_MODULE,
2774 + .open = tn7dsl_proc_PMDus_open,
2776 + .llseek = seq_lseek,
2777 + .release = single_release,
2780 #endif //NO_ADV_STATS
2781 #endif //TR69_PMD_IN
2782 // * UR8_MERGE_END CQ11057 *
2785 @@ -1395,44 +1395,66 @@ int tn7sar_oam_generation(void *privCont
2789 -int tn7sar_proc_oam_ping(char* buf, char **start, off_t offset, int count,int *eof, void *data)
2790 +static int tn7sar_proc_oam_ping(struct seq_file *m, void *data)
2793 unsigned int oam_ps = oamPingStatus;
2795 if( oam_ps == OAM_PING_PENDING_RECVD )
2796 oam_ps = OAM_PING_PENDING; //jz CQ9861: Only export the PENDING status, not internal state
2798 - len += sprintf(buf+len, "%d\n", oam_ps); //oamPingStatus);
2799 + seq_printf(m, "%d\n", oam_ps); //oamPingStatus);
2805 -int tn7sar_proc_pvc_table(char* buf, char **start, off_t offset, int count,int *eof, void *data)
2806 +static int tn7sar_proc_oam_ping_open(struct inode *inode, struct file *file)
2808 + return single_open(file, tn7sar_proc_oam_ping, PDE_DATA(inode));
2811 +struct file_operations tn7sar_proc_oam_ping_fops = {
2812 + .owner = THIS_MODULE,
2813 + .open = tn7sar_proc_oam_ping_open,
2815 + .llseek = seq_lseek,
2816 + .release = single_release,
2820 +static int tn7sar_proc_pvc_table(struct seq_file *m, void *data)
2827 if(pvc_result[i].bInUse)
2829 - len += sprintf(buf+len, "%d,%d\n", pvc_result[i].vpi,pvc_result[i].vci);
2830 + seq_printf(m, "%d,%d\n", pvc_result[i].vpi,pvc_result[i].vci);
2834 - len += sprintf(buf+len, "0,0\n");
2835 + seq_printf(m, "0,0\n");
2842 +static int tn7sar_proc_pvc_table_open(struct inode *inode, struct file *file)
2844 + return single_open(file, tn7sar_proc_pvc_table, PDE_DATA(inode));
2847 +struct file_operations tn7sar_proc_pvc_table_fops = {
2848 + .owner = THIS_MODULE,
2849 + .open = tn7sar_proc_pvc_table_open,
2851 + .llseek = seq_lseek,
2852 + .release = single_release,
2856 -int tn7sar_proc_sar_stat(char* buf, char **start, off_t offset, int count,int *eof, void *data)
2857 +static int tn7sar_proc_sar_stat(struct seq_file *m, void *data)
2860 - int limit = count - 80;
2861 struct atm_dev *dev;
2862 Tn7AtmPrivate *priv;
2864 @@ -1441,21 +1463,19 @@ int tn7sar_proc_sar_stat(char* buf, char
2865 unsigned int *pStateBase, *pSarStat;
2866 HAL_FUNCTIONS *pHalFunc;
2867 HAL_DEVICE *pHalDev;
2870 - dev = (struct atm_dev *)data;
2871 + dev = (struct atm_dev *)m->private;
2872 priv = (Tn7AtmPrivate *)dev->dev_data;
2874 pHalFunc = (HAL_FUNCTIONS *)priv->pSarHalFunc;
2875 pHalDev = (HAL_DEVICE *)priv->pSarHalDev;
2877 - len += sprintf(buf+len, "SAR HAL Statistics");
2878 + seq_printf(m, "SAR HAL Statistics");
2879 for(i=0;i<MAX_DMA_CHAN;i++)
2881 if(priv->lut[i].inuse)
2884 - len += sprintf(buf+len, "\nChannel %d:\n",priv->lut[i].chanid);
2885 + seq_printf(m, "\nChannel %d:\n",priv->lut[i].chanid);
2889 @@ -1468,26 +1488,18 @@ int tn7sar_proc_sar_stat(char* buf, char
2891 if((char *)*pSarStat == NULL)
2895 - dBytes = sprintf(buf+len, "%s: ",(char *) *pSarStat);
2900 + seq_printf(m, "%s: ",(char *) *pSarStat);
2901 + k += strlen((char *) *pSarStat) + strlen(": ");
2905 - dBytes = sprintf(buf+len, "%s; \n",(char *) *pSarStat);
2909 + seq_printf(m, "%s; \n",(char *) *pSarStat);
2910 + k += strlen((char *) *pSarStat) + strlen("; \n");
2917 - len += sprintf(buf+len, "\n");
2918 + seq_printf(m, "\n");
2922 @@ -1496,9 +1508,22 @@ int tn7sar_proc_sar_stat(char* buf, char
2930 +static int tn7sar_proc_sar_stat_open(struct inode *inode, struct file *file)
2932 + return single_open(file, tn7sar_proc_sar_stat, PDE_DATA(inode));
2935 +struct file_operations tn7sar_proc_sar_stat_fops = {
2936 + .owner = THIS_MODULE,
2937 + .open = tn7sar_proc_sar_stat_open,
2939 + .llseek = seq_lseek,
2940 + .release = single_release,
2943 void tn7sar_get_sar_firmware_version(unsigned int *pdsp_version_ms, unsigned int *pdsp_version_ls)