1 From 42d0f4c2f5cf0f73edd827263dc65aefc8f82192 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jogo@openwrt.org>
3 Date: Thu, 26 Sep 2013 12:28:35 +0200
4 Subject: [PATCH] update proc code to fix compilation for 3.10
6 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
10 tn7atm.c | 395 ++++++++---------
11 tn7dsl.c | 1439 ++++++++++++++++++++++++++++++--------------------------------
13 4 files changed, 951 insertions(+), 1040 deletions(-)
17 @@ -91,31 +91,29 @@ void * tn7atm_memcpy(void * dst, void co
19 void tn7dsl_exit(void);
20 int tn7dsl_init(void *priv);
21 -int tn7dsl_proc_eoc(char* buf, char **start, off_t offset, int count,int *eof, void *data);
22 -int tn7dsl_proc_stats(char* buf, char **start, off_t offset, int count,int *eof, void *data);
23 +extern struct file_operations tn7dsl_proc_eoc_fops;
24 +extern struct file_operations tn7dsl_proc_stats_fops;
26 //#define ADV_DIAG_STATS 1 //CQ10275 To enable Adv Stats
29 -int tn7dsl_proc_adv_stats(char* buf, char **start, off_t offset, int count,int *eof, void *data);
30 -int tn7dsl_proc_adv_stats1(char* buf, char **start, off_t offset, int count,int *eof, void *data);
31 -int tn7dsl_proc_adv_stats2(char* buf, char **start, off_t offset, int count,int *eof, void *data);
32 -int tn7dsl_proc_adv_stats3(char* buf, char **start, off_t offset, int count,int *eof, void *data);
33 +extern struct file_operations tn7dsl_proc_adv_stats_fops;
34 +extern struct file_operations tn7dsl_proc_adv1_stats_fops;
35 +extern struct file_operations tn7dsl_proc_adv2_stats_fops;
36 +extern struct file_operations tn7dsl_proc_adv3_stats_fops;
37 //UR8_MERGE_START CQ10682 Jack Zhang
38 -int tn7dsl_proc_dbg_cmsgs(char* buf, char **start, off_t offset, int count,int *eof, void *data);
39 -int tn7dsl_proc_dbg_rmsgs1(char* buf, char **start, off_t offset, int count,int *eof, void *data);
40 -int tn7dsl_proc_dbg_rmsgs2(char* buf, char **start, off_t offset, int count,int *eof, void *data);
41 -int tn7dsl_proc_dbg_rmsgs3(char* buf, char **start, off_t offset, int count,int *eof, void *data);
42 -int tn7dsl_proc_dbg_rmsgs4(char* buf, char **start, off_t offset, int count,int *eof, void *data);
43 +extern struct file_operations tn7dsl_proc_dbg_cmsgs_fops;
44 +extern struct file_operations tn7dsl_proc_dbg_cmsgs1_fops;
45 +extern struct file_operations tn7dsl_proc_dbg_cmsgs2_fops;
46 +extern struct file_operations tn7dsl_proc_dbg_cmsgs3_fops;
47 +extern struct file_operations tn7dsl_proc_dbg_cmsgs4_fops;
48 //UR8_MERGE_END CQ10682*
49 #endif //ADV_DIAG_STATS
51 -int tn7dsl_proc_write_stats(struct file *fp, const char * buf, unsigned long count, void * data);
52 -int tn7dsl_proc_modem(char* buf, char **start, off_t offset, int count,int *eof, void *data);
53 +extern struct file_operations tn7dsl_proc_modem_fops;
54 //UR8_MERGE_START CQ11813 Hao-Ting
55 #ifdef LINUX_CLI_SUPPORT
56 -int tn7dsl_proc_dbgmsg_write(struct file *fp, const char *buf, unsigned long count, void *data);
57 -int tn7dsl_proc_dbgmsg_read(char* buf, char **start, off_t offset, int count,int *eof, void *data);
58 +extern struct file_operations tn7dsl_proc_dbgmsg_fops;
60 //UR8_MERGE_END CQ11813
61 int tn7dsl_handle_interrupt(void);
62 @@ -142,31 +140,31 @@ int os_atoih(const char *pStr);
65 unsigned long os_atoul(const char *pStr);
66 -int tn7dsl_proc_snr0(char* buf, char **start, off_t offset, int count, int *eof, void *data);
67 -int tn7dsl_proc_snr1(char* buf, char **start, off_t offset, int count, int *eof, void *data);
68 -int tn7dsl_proc_snr2(char* buf, char **start, off_t offset, int count, int *eof, void *data);
69 -int tn7dsl_proc_bit_allocation(char* buf, char **start, off_t offset, int count, int *eof, void *data);
70 -int tn7dsl_proc_ds_noise(char* buf, char **start, off_t offset, int count, int *eof, void *data);
71 -int tn7dsl_proc_generic_read_result(char* buf, char **start, off_t offset, int count, int *eof, void *data);
72 -int tn7dsl_proc_train_mode_export(char* buf, char **start, off_t offset, int count,int *eof, void *data);
73 +extern struct file_operations tn7dsl_proc_snr0_fops;
74 +extern struct file_operations tn7dsl_proc_snr1_fops;
75 +extern struct file_operations tn7dsl_proc_snr2_fops;
76 +extern struct file_operations tn7dsl_proc_bit_allocation_fops;
77 +extern struct file_operations tn7dsl_proc_ds_noise_fops;
78 +extern struct file_operations tn7dsl_proc_generic_read_result_fops;
79 +extern struct file_operations tn7dsl_proc_train_mode_export_fops;
82 -int tn7dsl_proc_SNRpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data);
83 -int tn7dsl_proc_QLNpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data);
84 +extern struct file_operations tn7dsl_proc_SNRpsds_fops;
85 +extern struct file_operations tn7dsl_proc_QLNpsds_fops;
86 // * UR8_MERGE_START CQ10979 Jack Zhang
88 -//int tn7dsl_proc_HLINpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data);
89 -int tn7dsl_proc_HLINpsds1(char* buf, char **start, off_t offset, int count,int *eof, void *data);
90 -int tn7dsl_proc_HLINpsds2(char* buf, char **start, off_t offset, int count,int *eof, void *data);
91 -int tn7dsl_proc_HLINpsds3(char* buf, char **start, off_t offset, int count,int *eof, void *data);
92 -int tn7dsl_proc_HLINpsds4(char* buf, char **start, off_t offset, int count,int *eof, void *data);
93 +//extern struct file_operations tn7dsl_proc_HLINpsds_fops;
94 +extern struct file_operations tn7dsl_proc_HLINpsds1_fops;
95 +extern struct file_operations tn7dsl_proc_HLINpsds2_fops;
96 +extern struct file_operations tn7dsl_proc_HLINpsds3_fops;
97 +extern struct file_operations tn7dsl_proc_HLINpsds4_fops;
99 // * UR8_MERGE_END CQ10979*
100 // * UR8_MERGE_START CQ11057 Jack Zhang
103 -//int tn7dsl_proc_PMDus(char* buf, char **start, off_t offset, int count,int *eof, void *data);
104 -int tn7dsl_proc_PMDus(char* buf, char **start, off_t offset, int count,int *eof, void *data);
105 +//extern struct file_operations tn7dsl_proc_PMDus_fops;
106 +extern struct file_operations tn7dsl_proc_PMDus_fops;
108 // * UR8_MERGE_END CQ11057 *
110 @@ -183,12 +181,12 @@ void tn7sar_get_sar_version(Tn7AtmPrivat
111 int tn7sar_get_near_end_loopback_count(unsigned int *pF4count, unsigned int *pF5count);
112 int tn7sar_oam_generation(void *privContext, int chan, int type, int vpi, int vci, int timeout);
113 int tn7sar_get_stats(void *priv1);
114 -int tn7sar_proc_sar_stat(char* buf, char **start, off_t offset, int count,int *eof, void *data);
115 +extern struct file_operations tn7sar_proc_sar_stat_fops;
117 void tn7sar_get_EFM_firmware_version(unsigned int *pdsp_version_ms, unsigned int *pdsp_version_ls);
119 void tn7sar_get_sar_firmware_version(unsigned int *pdsp_version_ms, unsigned int *pdsp_version_ls);
120 -int tn7sar_proc_oam_ping(char* buf, char **start, off_t offset, int count,int *eof, void *data);
121 -int tn7sar_proc_pvc_table(char* buf, char **start, off_t offset, int count,int *eof, void *data);
122 +extern struct file_operations tn7sar_proc_oam_ping_fops;
123 +extern struct file_operations tn7sar_proc_pvc_table_fops;
124 int tn7sar_tx_flush(void *privContext, int chan, int queue, int skip);
128 @@ -265,11 +265,9 @@ MODULE_PARM_DESC(oam_lb_timeout, "OAM LB
131 extern void tn7dsl_disable_alarm(void);
132 -extern int tn7efm_proc_channels (char *buf, char **start,
133 - off_t offset, int count, int *eof, void *data);
134 -extern int tn7efm_proc_ctrl_read (char *buf, char **start, off_t offset, int count, int *eof, void *data);
135 -extern int tn7efm_proc_ctrl_write (struct file *fp, const char *buf, unsigned long count, void *data);
136 -extern int tn7efm_proc_info (char *buf, char **start, off_t offset, int count, int *eof, void *data);
137 +extern struct file_operations tn7efm_proc_channels_fops;
138 +extern struct file_operations tn7efm_proc_ctrl_fops;
139 +extern struct file_operations tn7efm_proc_info_fops;
140 extern unsigned int g_efm_proc_ctl;
141 extern struct net_device *mydev_efm;
142 extern Tn7AtmPrivate *mypriv;
143 @@ -305,31 +303,17 @@ extern int tn7efm_register (Tn7AtmPrivat
144 static int tn7atm_irq_request (struct atm_dev *dev);
147 -static int tn7atm_proc_version (char *buf, char **start, off_t offset,
148 - int count, int *eof, void *data);
149 +static struct file_operations tn7atm_proc_version_fops;
150 static void tn7atm_exit (void);
151 -static int tn7atm_proc_channels (char *buf, char **start, off_t offset,
152 - int count, int *eof, void *data);
153 -static int tn7atm_proc_private (char *buf, char **start, off_t offset,
154 - int count, int *eof, void *data);
155 +static struct file_operations tn7atm_proc_channels_fops;
156 +static struct file_operations tn7atm_proc_private_fops;
157 inline static int tn7atm_queue_packet_to_sar (void *vcc1, void *skb1,
160 -static int tn7atm_xlate_proc_name (const char *name,
161 - struct proc_dir_entry **ret,
162 - const char **residual);
163 -static int tn7atm_proc_match (int len, const char *name,
164 - struct proc_dir_entry *de);
165 -static int tn7atm_proc_qos_read (char *buf, char **start, off_t offset,
166 - int count, int *eof, void *data);
167 -static int tn7atm_proc_qos_write (struct file *fp, const char *buf,
168 - unsigned long count, void *data);
169 +static struct file_operations tn7atm_proc_qos_fops;
172 -static int tn7atm_proc_turbodsl_read (char *buf, char **start, off_t offset,
173 - int count, int *eof, void *data);
174 -static int tn7atm_proc_turbodsl_write (struct file *fp, const char *buf,
175 - unsigned long count, void *data);
176 +static struct file_operations tn7atm_proc_turbodsl_fops;
178 //CT - Added function to return chipset Id
179 void tn7atm_get_chipsetId (char *pVerId);
180 @@ -456,78 +440,83 @@ const char drv_proc_root_folder[] = "ava
181 static struct proc_dir_entry *root_proc_dir_entry = NULL;
182 #define DRV_PROC_MODE 0644
183 static int proc_root_already_exists = TRUE;
185 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
186 +#define PDE_DATA(inode) PDE(inode)->data
191 const unsigned char name[32];
192 - int (*read_func) (char* , char **, off_t , int ,int *, void *);
193 - int (*write_func) (struct file *, const char * , unsigned long , void *);
194 + struct file_operations *fops;
199 - {"avsar_efm_channel", tn7efm_proc_channels, NULL},
200 + {"avsar_efm_channel", &tn7efm_proc_channels_fops},
202 - {"avsar_efm_info", tn7efm_proc_info, NULL},
203 - {"avsar_efm_ctl", tn7efm_proc_ctrl_read, tn7efm_proc_ctrl_write},
204 + {"avsar_efm_info", &tn7efm_proc_info_fops},
205 + {"avsar_efm_ctl", &tn7efm_proc_ctrl_fops},
207 - {"avsar_ver", tn7atm_proc_version, NULL},
208 - {"avsar_channels", tn7atm_proc_channels, NULL},
209 - {"avsar_sarhal_stats", tn7sar_proc_sar_stat, NULL},
210 - {"avsar_oam_ping", tn7sar_proc_oam_ping, NULL},
211 - {"avsar_pvc_table", tn7sar_proc_pvc_table, NULL},
212 - {"avsar_rxsnr0", tn7dsl_proc_snr0, NULL},
213 - {"avsar_rxsnr1", tn7dsl_proc_snr1, NULL},
214 - {"avsar_rxsnr2", tn7dsl_proc_snr2, NULL},
215 - {"clear_eoc_stats", tn7dsl_proc_eoc, NULL},
216 - {"avsar_bit_allocation_table", tn7dsl_proc_bit_allocation, NULL},
217 - {"avsar_dsl_modulation_schemes",tn7dsl_proc_train_mode_export, NULL},
218 + {"avsar_ver", &tn7atm_proc_version_fops},
219 + {"avsar_channels", &tn7atm_proc_channels_fops},
220 + {"avsar_sarhal_stats", &tn7sar_proc_sar_stat_fops},
221 + {"avsar_oam_ping", &tn7sar_proc_oam_ping_fops},
222 + {"avsar_pvc_table", &tn7sar_proc_pvc_table_fops},
223 + {"avsar_rxsnr0", &tn7dsl_proc_snr0_fops},
224 + {"avsar_rxsnr1", &tn7dsl_proc_snr1_fops},
225 + {"avsar_rxsnr2", &tn7dsl_proc_snr2_fops},
226 + {"clear_eoc_stats", &tn7dsl_proc_eoc_fops},
227 + {"avsar_bit_allocation_table", &tn7dsl_proc_bit_allocation_fops},
228 + {"avsar_dsl_modulation_schemes",&tn7dsl_proc_train_mode_export_fops},
230 - {"avsar_SNRpsds", tn7dsl_proc_SNRpsds, NULL},
231 - {"avsar_QLNpsds", tn7dsl_proc_QLNpsds, NULL},
232 + {"avsar_SNRpsds", &tn7dsl_proc_SNRpsds_fops},
233 + {"avsar_QLNpsds", &tn7dsl_proc_QLNpsds_fops},
234 // * UR8_MERGE_START CQ10979 Jack Zhang
236 -// {"avsar_HLINpsds", tn7dsl_proc_HLINpsds, NULL},
237 - {"avsar_HLINpsds1", tn7dsl_proc_HLINpsds1, NULL},
238 - {"avsar_HLINpsds2", tn7dsl_proc_HLINpsds2, NULL},
239 - {"avsar_HLINpsds3", tn7dsl_proc_HLINpsds3, NULL},
240 - {"avsar_HLINpsds4", tn7dsl_proc_HLINpsds4, NULL},
241 +// {"avsar_HLINpsds", &tn7dsl_proc_HLINpsds_fops},
242 + {"avsar_HLINpsds1", &tn7dsl_proc_HLINpsds1_fops},
243 + {"avsar_HLINpsds2", &tn7dsl_proc_HLINpsds2_fops},
244 + {"avsar_HLINpsds3", &tn7dsl_proc_HLINpsds3_fops},
245 + {"avsar_HLINpsds4", &tn7dsl_proc_HLINpsds4_fops},
246 #endif //TR69_HLIN_IN
247 // * UR8_MERGE_END CQ10979*
248 // * UR8_MERGE_START CQ11057 Jack Zhang
251 - {"avsar_PMDTestus", tn7dsl_proc_PMDus, NULL},
252 -// {"avsar_PMDTestus1", tn7dsl_proc_PMDus1, NULL},
253 + {"avsar_PMDTestus", &tn7dsl_proc_PMDus_fops},
254 +// {"avsar_PMDTestus1", &tn7dsl_proc_PMDus1_fops},
256 // * UR8_MERGE_END CQ11057 *
258 - {"avsar_private", tn7atm_proc_private, NULL},
259 - {"avsar_modem_training", tn7dsl_proc_modem, NULL},
260 - {"avsar_modem_stats", tn7dsl_proc_stats, tn7dsl_proc_write_stats},
261 + {"avsar_private", &tn7atm_proc_private_fops},
262 + {"avsar_modem_training", &tn7dsl_proc_modem_fops},
263 + {"avsar_modem_stats", &tn7dsl_proc_stats_fops},
265 #ifdef ADV_DIAG_STATS //CQ10275
266 -//for 2.6 {"avsar_modem_adv_stats", tn7dsl_proc_adv_stats, NULL},
267 +//for 2.6 {"avsar_modem_adv_stats", &tn7dsl_proc_adv_stats_fops},
268 //For 2.4 kernel, due to proc file system size limitation
269 - {"avsar_modem_adv_stats1", tn7dsl_proc_adv_stats1, NULL},
270 - {"avsar_modem_adv_stats2", tn7dsl_proc_adv_stats2, NULL},
271 - {"avsar_modem_adv_stats3", tn7dsl_proc_adv_stats3, NULL},
272 + {"avsar_modem_adv_stats1", &tn7dsl_proc_adv_stats1_fops},
273 + {"avsar_modem_adv_stats2", &tn7dsl_proc_adv_stats2_fops},
274 + {"avsar_modem_adv_stats3", &tn7dsl_proc_adv_stats3_fops},
275 //UR8_MERGE_START CQ10682 Jack Zhang
276 - {"avsar_modem_dbg_cmsgs", tn7dsl_proc_dbg_cmsgs, NULL},
277 - {"avsar_modem_dbg_rmsgs1", tn7dsl_proc_dbg_rmsgs1, NULL},
278 - {"avsar_modem_dbg_rmsgs2", tn7dsl_proc_dbg_rmsgs2, NULL},
279 - {"avsar_modem_dbg_rmsgs3", tn7dsl_proc_dbg_rmsgs3, NULL},
280 - {"avsar_modem_dbg_rmsgs4", tn7dsl_proc_dbg_rmsgs4, NULL},
281 + {"avsar_modem_dbg_cmsgs", &tn7dsl_proc_dbg_cmsgs_fops},
282 + {"avsar_modem_dbg_rmsgs1", &tn7dsl_proc_dbg_rmsgs1_fops},
283 + {"avsar_modem_dbg_rmsgs2", &tn7dsl_proc_dbg_rmsgs2_fops},
284 + {"avsar_modem_dbg_rmsgs3", &tn7dsl_proc_dbg_rmsgs3_fops},
285 + {"avsar_modem_dbg_rmsgs4", &tn7dsl_proc_dbg_rmsgs4_fops},
286 // UR8_MERGE_END CQ10682*
287 #endif //ADV_DIAG_STATS
288 //UR8_MERGE_START CQ11813 Hao-Ting
289 #ifdef LINUX_CLI_SUPPORT
290 - {"avsar_dbg_enable", tn7dsl_proc_dbgmsg_read, tn7dsl_proc_dbgmsg_write},
291 + {"avsar_dbg_enable", &tn7dsl_proc_dbgmsg_fops},
293 //UR8_MERGE_END CQ11813
294 - {"avsar_qos_enable", tn7atm_proc_qos_read, tn7atm_proc_qos_write},
295 + {"avsar_qos_enable", &tn7atm_proc_qos_fops},
297 - {"avsar_turbodsl", tn7atm_proc_turbodsl_read, tn7atm_proc_turbodsl_write}
298 + {"avsar_turbodsl", &tn7atm_proc_turbodsl_fops}
304 @@ -1811,76 +1800,81 @@ int tn7atm_receive (void *os_dev, int ch
309 -static int tn7atm_proc_channels (char *buf, char **start, off_t offset,
310 - int count, int *eof, void *data)
311 +static int tn7atm_proc_channels (struct seq_file *m, void *data)
314 - int limit = count - 80;
320 - dev = (struct atm_dev *) data;
321 + dev = (struct atm_dev *) m->private;
322 priv = (Tn7AtmPrivate *) dev->dev_data;
325 - len += sprintf (buf + len, "Chan Inuse ChanID VPI VCI \n");
328 - sprintf (buf + len,
329 + seq_printf (m, "Chan Inuse ChanID VPI VCI \n");
331 "------------------------------------------------------------------\n");
333 for (i = 0; i <= MAX_DMA_CHAN; i++)
337 - len += sprintf (buf + len,
338 - " %02d %05d %05d %05d %05d \n",
339 - i, priv->lut[i].inuse, priv->lut[i].chanid,
340 - priv->lut[i].vpi, priv->lut[i].vci);
343 + " %02d %05d %05d %05d %05d \n",
344 + i, priv->lut[i].inuse, priv->lut[i].chanid,
345 + priv->lut[i].vpi, priv->lut[i].vci);
350 - sprintf (buf + len,
352 "------------------------------------------------------------------\n");
358 +static int tn7atm_proc_channels_open(struct inode *inode, struct file *file)
360 + return single_open(file, tn7atm_proc_channels, PDE_DATA(inode));
363 -static int tn7atm_proc_private (char *buf, char **start, off_t offset,
364 - int count, int *eof, void *data)
365 +static struct file_operations tn7atm_proc_channels_fops = {
366 + .owner = THIS_MODULE,
367 + .open = tn7atm_proc_channels_open,
369 + .llseek = seq_lseek,
370 + .release = single_release,
374 +static int tn7atm_proc_private (struct seq_file *m, void *data)
377 - int limit = count - 80;
381 - dev = (struct atm_dev *) data;
382 + dev = (struct atm_dev *) m->private;
383 priv = (Tn7AtmPrivate *) dev->dev_data;
386 - len += sprintf (buf + len, "\nPrivate Data Structure(%s):\n", priv->name);
388 - len += sprintf (buf + len, "----------------------------------------\n");
390 - len += sprintf (buf + len, "priv: 0x%p\n", priv);
392 - len += sprintf (buf + len, "next: 0x%p", priv->next);
394 - len += sprintf (buf + len, "\tdev: 0x%p\n", priv->dev);
397 - len += sprintf (buf + len, "tx_irq: %02d", priv->sar_irq);
399 - len += sprintf (buf + len, "rx_irq: %02d", priv->dsl_irq);
400 + seq_printf (m, "\nPrivate Data Structure(%s):\n", priv->name);
401 + seq_printf (m, "----------------------------------------\n");
402 + seq_printf (m, "priv: 0x%p\n", priv);
403 + seq_printf (m, "next: 0x%p", priv->next);
404 + seq_printf (m, "\tdev: 0x%p\n", priv->dev);
406 + seq_printf (m, "tx_irq: %02d", priv->sar_irq);
407 + seq_printf (m, "rx_irq: %02d", priv->dsl_irq);
413 +static int tn7atm_proc_private_open(struct inode *inode, struct file *file)
415 + return single_open(file, tn7atm_proc_private, PDE_DATA(inode));
418 +static struct file_operations tn7atm_proc_private_fops = {
419 + .owner = THIS_MODULE,
420 + .open = tn7atm_proc_private_open,
422 + .llseek = seq_lseek,
423 + .release = single_release,
426 void tn7atm_sarhal_isr_register (void *os_dev, void *hal_isr,
429 @@ -2033,10 +2027,8 @@ static int __init tn7atm_register (Tn7At
433 -static int tn7atm_proc_version (char *buf, char **start, off_t offset,
434 - int count, int *eof, void *data)
435 +static int tn7atm_proc_version (struct seq_file *m, void *data)
440 char chipsetID[32]; //CT CQ10076 - Added temporary buffer to store chipset Id
441 @@ -2051,58 +2043,52 @@ static int tn7atm_proc_version (char *bu
442 priv = mydev->dev_data;
446 - sprintf (buf + len, "ATM/EFM Driver version:[%d.%02d.%02d.%02d]\n",
447 - LINUXATM_VERSION_MAJOR, LINUXATM_VERSION_MINOR,
448 - LINUXATM_VERSION_BUGFIX, LINUXATM_VERSION_BUILDNUM);
450 + seq_printf (m, "ATM/EFM Driver version:[%d.%02d.%02d.%02d]\n",
451 + LINUXATM_VERSION_MAJOR, LINUXATM_VERSION_MINOR,
452 + LINUXATM_VERSION_BUGFIX, LINUXATM_VERSION_BUILDNUM);
455 - sprintf (buf + len, "ATM Driver version:[%d.%02d.%02d.%02d]\n",
456 - LINUXATM_VERSION_MAJOR, LINUXATM_VERSION_MINOR,
457 - LINUXATM_VERSION_BUGFIX, LINUXATM_VERSION_BUILDNUM);
458 + seq_printf (m, "ATM Driver version:[%d.%02d.%02d.%02d]\n",
459 + LINUXATM_VERSION_MAJOR, LINUXATM_VERSION_MINOR,
460 + LINUXATM_VERSION_BUGFIX, LINUXATM_VERSION_BUILDNUM);
463 tn7dsl_get_dslhal_version (dslVer);
466 - sprintf (buf + len, "DSL HAL version: [%d.%02d.%02d.%02d]\n", dslVer[0],
467 - dslVer[1], dslVer[2], dslVer[3]);
468 + seq_printf (m, "DSL HAL version: [%d.%02d.%02d.%02d]\n", dslVer[0],
469 + dslVer[1], dslVer[2], dslVer[3]);
470 tn7dsl_get_dsp_version (dspVer);
474 - sprintf (buf + len, "DSP Datapump version: [%d.%02d.%02d.%02d(%u)] ",
475 - dspVer[4], dspVer[5], dspVer[6], dspVer[7], (unsigned char) dspVer[7]);
476 + seq_printf (m, "DSP Datapump version: [%d.%02d.%02d.%02d(%u)] ",
477 + dspVer[4], dspVer[5], dspVer[6], dspVer[7], (unsigned char) dspVer[7]);
480 - sprintf (buf + len, "DSP Datapump version: [%d.%02d.%02d.%02d] ",
481 - dspVer[4], dspVer[5], dspVer[6], dspVer[7]);
482 + seq_printf (m, "DSP Datapump version: [%d.%02d.%02d.%02d] ",
483 + dspVer[4], dspVer[5], dspVer[6], dspVer[7]);
485 if (dspVer[8] == 2) // annex B
486 - len += sprintf (buf + len, "Annex B\n");
487 + seq_printf (m, "Annex B\n");
488 else if (dspVer[8] == 3) // annex c
489 - len += sprintf (buf + len, "Annex c\n");
490 + seq_printf (m, "Annex c\n");
492 - len += sprintf (buf + len, "Annex A\n");
493 + seq_printf (m, "Annex A\n");
495 tn7sar_get_sar_version (priv, &pSarVer);
497 - len += sprintf (buf + len, "SAR HAL version: [");
498 + seq_printf (m, "SAR HAL version: [");
499 for (i = 0; i < 8; i++)
501 - len += sprintf (buf + len, "%c", pSarVer[i + 7]);
502 + seq_printf (m, "%c", pSarVer[i + 7]);
504 - len += sprintf (buf + len, "]\n");
505 + seq_printf (m, "]\n");
507 tn7sar_get_sar_firmware_version (&pdspV1, &pdspV2);
510 - len += sprintf (buf + len, "PDSP Firmware version:[%01x.%02x]\n",
511 + seq_printf (m, "PDSP Firmware version:[%01x.%02x]\n",
515 - len += sprintf (buf + len, "PDSP Firmware version:[%01x.%02x](ATM)%c\n",
516 + seq_printf (m, "PDSP Firmware version:[%01x.%02x](ATM)%c\n",
517 pdspV1, pdspV2, (priv->curr_TC_mode== TC_MODE_ATM) ? '*' : ' ');
519 tn7sar_get_EFM_firmware_version (&pdspV1, &pdspV2);
520 @@ -2114,26 +2100,37 @@ static int tn7atm_proc_version (char *bu
524 - len += sprintf (buf + len, "PDSP Firmware version:[%01x.%02x](%s)%c\n",
525 + seq_printf (m, "PDSP Firmware version:[%01x.%02x](%s)%c\n",
526 pdspV1, pdspV2, str, (priv->curr_TC_mode== TC_MODE_PTM) ? '*' : ' ');
530 //CT CQ10076 - Added code to report chipset ID using proc file system
531 tn7atm_get_chipsetId(chipsetID);
532 - len += sprintf (buf + len, "Chipset ID: [%s]\n",chipsetID);
533 + seq_printf (m, "Chipset ID: [%s]\n",chipsetID);
539 +static int tn7atm_proc_version_open(struct inode *inode, struct file *file)
541 + return single_open(file, tn7atm_proc_version, PDE_DATA(inode));
544 +static struct file_operations tn7atm_proc_version_fops = {
545 + .owner = THIS_MODULE,
546 + .open = tn7atm_proc_version_open,
548 + .llseek = seq_lseek,
549 + .release = single_release,
553 /* Device detection */
555 static int __init tn7atm_detect (void)
558 - struct proc_dir_entry *dsl_wr_file = NULL; /* Only for ones with a write
561 const char *residual;
563 @@ -2214,24 +2211,7 @@ static int __init tn7atm_detect (void)
565 for (ctr = 0; ctr < (NUM_ELEMS (proc_if)); ctr++)
567 - /* Only if we have a write function, we create a normal proc file. */
568 - if(proc_if[ctr].write_func)
570 - dsl_wr_file = create_proc_entry (proc_if[ctr].name, DRV_PROC_MODE, root_proc_dir_entry);
573 - dsl_wr_file->read_proc = proc_if[ctr].read_func;
574 - dsl_wr_file->write_proc = proc_if[ctr].write_func;
575 - dsl_wr_file->data = (void *)mydev; //UR8_MERGE_START_END CQ10700 Manjula K
577 - dsl_wr_file = NULL;
581 - /* Create a read-only entry. */
582 - create_proc_read_entry (proc_if[ctr].name, 0, root_proc_dir_entry,
583 - proc_if[ctr].read_func, mydev);
585 + proc_create_data(proc_if[ctr].name, DRV_PROC_MODE, root_proc_dir_entry, proc_if[ctr].fops, (void *)mydev);
588 tn7dsl_dslmod_sysctl_register ();
589 @@ -2711,73 +2691,18 @@ static int tn7atm_set_can_support_adsl2
594 - * This function matches a name such as "serial", and that specified by the
597 -static int tn7atm_proc_match (int len, const char *name,
598 - struct proc_dir_entry *de)
599 +static int tn7atm_proc_qos_read(struct seq_file *m, void *data)
601 - if (!de || !de->low_ino)
602 + seq_printf (m, "\nEnableQoS = %d\n", EnableQoS);
604 - if (de->namelen != len)
606 - return !strncmp (name, de->name, len);
610 - * This function parses a name such as "tty/driver/serial", and
611 - * returns the struct proc_dir_entry for "/proc/tty/driver", and
612 - * returns "serial" in residual.
614 -static int tn7atm_xlate_proc_name (const char *name,
615 - struct proc_dir_entry **ret,
616 - const char **residual)
618 - const char *cp = name, *next;
619 - struct proc_dir_entry *de;
621 - extern struct proc_dir_entry proc_root;
626 - next = strchr (cp, '/');
631 - for (de = de->subdir; de; de = de->next)
633 - if (tn7atm_proc_match (len, cp, de))
646 -static int tn7atm_proc_qos_read(char *buf, char **start, off_t offset, int count, int *eof, void *data)
650 - len += sprintf (buf + len, "\nEnableQoS = %d\n", EnableQoS);
656 -static int tn7atm_proc_turbodsl_read(char *buf, char **start, off_t offset, int count, int *eof, void *data)
657 +static int tn7atm_proc_turbodsl_read(struct seq_file *m, void *data)
661 - len += sprintf (buf + len, "%d\n", bTurboDsl);
663 + seq_printf (m, "%d\n", bTurboDsl);
667 static int tn7atm_proc_qos_write(struct file *fp, const char *buf, unsigned long count, void *data)
668 @@ -2812,7 +2737,7 @@ static int tn7atm_proc_qos_write(struct
672 -int tn7atm_proc_turbodsl_write(struct file *fp, const char *buf, unsigned long count, void *data)
673 +static int tn7atm_proc_turbodsl_write(struct file *fp, const char *buf, unsigned long count, void *data)
677 @@ -2843,5 +2768,33 @@ int tn7atm_proc_turbodsl_write(struct fi
681 +static int tn7atm_proc_qos_open(struct inode *inode, struct file *file)
683 + return single_open(file, tn7atm_proc_qos_read, PDE_DATA(inode));
686 +static struct file_operations tn7atm_proc_qos_fops = {
687 + .owner = THIS_MODULE,
688 + .open = tn7atm_proc_qos_open,
690 + .llseek = seq_lseek,
691 + .release = single_release,
692 + .write = tn7atm_proc_qos_write,
695 +static int tn7atm_proc_turbodsl_open(struct inode *inode, struct file *file)
697 + return single_open(file, tn7atm_proc_turbodsl_read, PDE_DATA(inode));
700 +static struct file_operations tn7atm_proc_turbodsl_fops = {
701 + .owner = THIS_MODULE,
702 + .open = tn7atm_proc_turbodsl_open,
704 + .llseek = seq_lseek,
705 + .release = single_release,
706 + .write = tn7atm_proc_turbodsl_write,
709 module_init (tn7atm_detect);
710 module_exit (tn7atm_exit);
713 @@ -233,6 +233,9 @@ static struct led_funcs ledreg[2];
715 #define tn7dsl_kfree_skb(x) dev_kfree_skb(x)
717 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
718 +#define PDE_DATA(inode) PDE(inode)->data
721 //---------------------------------------------
722 // Begin Clear EOC definitions
723 @@ -366,7 +369,7 @@ static void tn7dsl_register_dslss_led(vo
724 void tn7dsl_dslmod_sysctl_register(void);
725 void tn7dsl_dslmod_sysctl_unregister(void);
726 static int tn7dsl_clear_eoc_receive(void);
727 -static int tn7dsl_proc_snr_print (char *buf, int count, int *eof, int data);
728 +static int tn7dsl_proc_snr_print (struct seq_file *m, int data);
729 /* end of internal functions */
731 // UR8_MERGE_START CQ11054 Jack Zhang
732 @@ -698,11 +701,9 @@ void shim_osCriticalExit(void)
733 spin_unlock_irqrestore(&shimLock, flags);
736 -static int tn7dsl_proc_snr_print (char *buf, int count, int *eof, int data)
737 +static int tn7dsl_proc_snr_print (struct seq_file *m, int data)
741 - int limit = count - 80;
743 int bin = (int) data;
744 unsigned short *rxSnrPerBin;
745 @@ -723,95 +724,128 @@ static int tn7dsl_proc_snr_print (char *
750 - len += sprintf (buf + len, "\nInvalid bin selected Bin%d :\n", bin);
753 + seq_printf (m, "\nInvalid bin selected Bin%d :\n", bin);
758 - len += sprintf (buf + len, "\nAR7 DSL Modem Rx SNR Per Bin for Bin%d :\n", bin);
759 + seq_printf (m, "\nAR7 DSL Modem Rx SNR Per Bin for Bin%d :\n", bin);
761 for (i=0; i<pIhw->AppData.max_ds_tones/16; i++)
767 - sprintf (buf + len, "%04x ",
768 + seq_printf (m, "%04x ",
769 (unsigned short) rxSnrPerBin[i * 16 + j]);
772 - len += sprintf(buf+len, "\n");
774 + seq_printf(m, "\n");
782 //@Added SNR per bin info per customer request. 05-14-2004
783 -int tn7dsl_proc_snr0 (char *buf, char **start, off_t offset, int count,
784 - int *eof, void *data)
785 +static int tn7dsl_proc_snr0 (struct seq_file *m, void *data)
787 - return tn7dsl_proc_snr_print(buf, count, eof, 0);
788 + return tn7dsl_proc_snr_print(m, 0);
791 -int tn7dsl_proc_snr1 (char *buf, char **start, off_t offset, int count,
792 - int *eof, void *data)
793 +static int tn7dsl_proc_snr0_open(struct inode *inode, struct file *file)
795 - return tn7dsl_proc_snr_print(buf, count, eof, 1);
796 + return single_open(file, tn7dsl_proc_snr0, PDE_DATA(inode));
799 +struct file_operations tn7dsl_proc_snr0_fops = {
800 + .owner = THIS_MODULE,
801 + .open = tn7dsl_proc_snr0_open,
803 + .llseek = seq_lseek,
804 + .release = single_release,
807 +static int tn7dsl_proc_snr1 (struct seq_file *m, void *data)
809 + return tn7dsl_proc_snr_print(m, 1);
812 -int tn7dsl_proc_snr2 (char *buf, char **start, off_t offset, int count,
813 - int *eof, void *data)
814 +static int tn7dsl_proc_snr1_open(struct inode *inode, struct file *file)
816 - return tn7dsl_proc_snr_print(buf, count, eof, 2);
817 + return single_open(file, tn7dsl_proc_snr1, PDE_DATA(inode));
820 +struct file_operations tn7dsl_proc_snr1_fops = {
821 + .owner = THIS_MODULE,
822 + .open = tn7dsl_proc_snr1_open,
824 + .llseek = seq_lseek,
825 + .release = single_release,
828 +static int tn7dsl_proc_snr2 (struct seq_file *m, void *data)
830 + return tn7dsl_proc_snr_print(m, 2);
833 +static int tn7dsl_proc_snr2_open(struct inode *inode, struct file *file)
835 + return single_open(file, tn7dsl_proc_snr2, PDE_DATA(inode));
838 +struct file_operations tn7dsl_proc_snr2_fops = {
839 + .owner = THIS_MODULE,
840 + .open = tn7dsl_proc_snr2_open,
842 + .llseek = seq_lseek,
843 + .release = single_release,
846 //@Added bit allocation table per customer request. 05-14-2004
847 -int tn7dsl_proc_bit_allocation (char *buf, char **start, off_t offset,
848 - int count, int *eof, void *data)
849 +static int tn7dsl_proc_bit_allocation (struct seq_file *m, void *data)
853 - int limit = count - 80;
857 - len += sprintf(buf+len, "\nAR7 DSL Modem US Bit Allocation:");
858 + seq_printf(m, "\nAR7 DSL Modem US Bit Allocation:");
860 for(i=0; i<pIhw->AppData.max_us_tones; i++)
865 - len += sprintf(buf+len, "\n");
866 + seq_printf(m, "\n");
870 - sprintf (buf + len, "%02x ",
871 - (unsigned char) pIhw->AppData.BitAllocTblUstrm[i]);
872 + seq_printf (m, "%02x ",
873 + (unsigned char) pIhw->AppData.BitAllocTblUstrm[i]);
877 - len += sprintf(buf+len, "\n\nAR7 DSL Modem DS Bit Allocation:\n");
878 + seq_printf(m, "\n\nAR7 DSL Modem DS Bit Allocation:\n");
880 for (i=0; i<pIhw->AppData.max_ds_tones/16; i++)
886 - sprintf (buf + len, "%02x ",
887 - (unsigned char) pIhw->AppData.BitAllocTblDstrm[i * 16 +
889 + seq_printf (m, "%02x ",
890 + (unsigned char) pIhw->AppData.BitAllocTblDstrm[i * 16 +
894 - len += sprintf(buf+len, "\n");
895 + seq_printf(m, "\n");
902 +int tn7dsl_proc_bit_allocation_open(struct inode *inode, struct file *file)
904 + return single_open(file, tn7dsl_proc_bit_allocation, PDE_DATA(inode));
907 +struct file_operations tn7dsl_proc_bit_allocation_fops = {
908 + .owner = THIS_MODULE,
909 + .open = tn7dsl_proc_bit_allocation_open,
911 + .llseek = seq_lseek,
912 + .release = single_release,
916 int tn7dsl_proc_ds_noise(char* buf, char **start, off_t offset, int count,
917 int *eof, void *data)
918 @@ -874,59 +908,48 @@ static char *pUnknown= "Unknown";
919 #ifdef ADV_DIAG_STATS //CQ10275, CQ10449
920 //UR8_MERGE_START CQ10449 Jack Zhang
922 -static int proc_adv_stats_header(char* buf, int limit);
923 +static int proc_adv_stats_header(struct seq_file *m);
925 -int tn7dsl_proc_adv_stats(char* buf, char **start, off_t offset, int count,
926 - int *eof, void *data)
927 +static int tn7dsl_proc_adv_stats(struct seq_file *m, void *data)
931 - int limit = count - 80;
932 //char *cp = buf + offset;
936 - static int ctr = 0;
938 // printk("proc_adv_stats: buf=0x%X, ctr=%d, offset=%d, count=%d, eof=%d\n",
939 // (unsigned int)buf, ctr, offset, count, *eof);
942 - len = proc_adv_stats_header( cp, limit);
943 + proc_adv_stats_header(m);
946 - len += sprintf(cp+len, "\n\tBin No.\tBits:\tMargin:\tSNR\n");
952 + seq_printf(m, "\n\tBin No.\tBits:\tMargin:\tSNR\n");
954 for( i =strt; i<512; i++)
958 - len += sprintf(cp+len, "\t%u\t%u\t%u\t%d\n", i,
959 + seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
960 (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
961 (unsigned int)pIhw->AppData.marginTblDstrm[i],
962 (int)pIhw->AppData.rxSnrPerBin0[i]);
968 - *(cp + len) = '\0';
969 - printk("proc_adv_stats - return: ctr=%d, len=%d\n", ctr, len);
975 printk("proc_adv_stats - return: ctr=%d, len=%d\n", ctr, len);
980 -static int proc_adv_stats_header(char* buf, int limit)
982 +static int tn7dsl_proc_adv_stats_open(struct inode *inode, struct file *file)
984 + return single_open(file, tn7dsl_proc_adv_stats, PDE_DATA(inode));
987 +struct file_operations tn7dsl_proc_adv_stats_fops = {
988 + .owner = THIS_MODULE,
989 + .open = tn7dsl_proc_adv_stats_open,
991 + .llseek = seq_lseek,
992 + .release = single_release,
995 +static int proc_adv_stats_header(struct seq_file *m)
999 @@ -935,66 +958,53 @@ static int proc_adv_stats_header(char* b
1002 dslhal_api_gatherStatistics(pIhw);
1004 - len += sprintf(buf+len, "\nAR7 DSL Modem Advanced Statistics:\n");
1005 + seq_printf(m, "\nAR7 DSL Modem Advanced Statistics:\n");
1008 + if(pIhw->lConnected != 1)
1010 - if(pIhw->lConnected != 1)
1012 - pIhw->AppData.USConRate = 0;
1013 - pIhw->AppData.DSConRate = 0;
1016 - sprintf (buf + len,
1017 + pIhw->AppData.USConRate = 0;
1018 + pIhw->AppData.DSConRate = 0;
1021 "\t[Connection Rate]\tUS:\t%u\tDS:\t%u\n",
1022 (unsigned int)pIhw->AppData.USConRate,
1023 (unsigned int)pIhw->AppData.DSConRate );
1026 // UR8_MERGE_START CQ11054 Jack Zhang
1027 + if (dslhal_api_getHighPrecision())
1029 - if (dslhal_api_getHighPrecision())
1032 - sprintf (buf + len, "\t[Margin]\tUS:\t%d.%u\tDS:\t\t%d.%u\n",
1033 - gInt(pIhw->AppData.usMargin), gDot1(pIhw->AppData.usMargin),
1034 - gInt(pIhw->AppData.dsMargin), gDot1(pIhw->AppData.dsMargin));
1039 - sprintf (buf + len, "\t[Margin]\tUS:\t%u\tDS:\t\t%u\n",
1040 - (unsigned int)pIhw->AppData.usMargin,
1041 - (unsigned int)pIhw->AppData.dsMargin/2 );
1043 + seq_printf (m, "\t[Margin]\tUS:\t%d.%u\tDS:\t\t%d.%u\n",
1044 + gInt(pIhw->AppData.usMargin), gDot1(pIhw->AppData.usMargin),
1045 + gInt(pIhw->AppData.dsMargin), gDot1(pIhw->AppData.dsMargin));
1049 + seq_printf (m, "\t[Margin]\tUS:\t%u\tDS:\t\t%u\n",
1050 + (unsigned int)pIhw->AppData.usMargin,
1051 + (unsigned int)pIhw->AppData.dsMargin/2 );
1053 // UR8_MERGE_END CQ11054*
1056 * Downstream/Upstream Interleaved Errors
1059 - len += sprintf(buf+len, "\t[Interleave path] US (TX):\tCRC: \t%u\tFEC: \t%u\n",
1060 + seq_printf(m, "\t[Interleave path] US (TX):\tCRC: \t%u\tFEC: \t%u\n",
1061 (unsigned int)pIhw->AppData.usICRC_errors,
1062 (unsigned int)pIhw->AppData.usIFEC_errors);
1064 - len += sprintf(buf+len, "\t[Interleave path] DS (RX):\tCRC: \t%u\tFEC: \t%u\n",
1065 + seq_printf(m, "\t[Interleave path] DS (RX):\tCRC: \t%u\tFEC: \t%u\n",
1066 (unsigned int)pIhw->AppData.dsICRC_errors,
1067 (unsigned int)pIhw->AppData.dsIFEC_errors);
1069 * Upstream/Downstream Fast Errors
1072 - len += sprintf(buf+len, "\t[Fast path] US (TX): \tCRC: \t%u\tFEC: \t%u\n",
1073 + seq_printf(m, "\t[Fast path] US (TX): \tCRC: \t%u\tFEC: \t%u\n",
1074 (unsigned int)pIhw->AppData.usFCRC_errors,
1075 (unsigned int)pIhw->AppData.usFFEC_errors);
1077 - len += sprintf(buf+len, "\t[Fast path] DS (RX):\tCRC: \t%u\tFEC: \t%u\n",
1078 + seq_printf(m, "\t[Fast path] DS (RX):\tCRC: \t%u\tFEC: \t%u\n",
1079 (unsigned int)pIhw->AppData.dsFCRC_errors,
1080 (unsigned int)pIhw->AppData.dsFFEC_errors);
1086 static int getDiagDisplayMode()
1087 @@ -1017,29 +1027,24 @@ static int getDiagDisplayMode()
1091 -int tn7dsl_proc_adv_stats1(char* buf, char **start, off_t offset, int count,
1092 - int *eof, void *data)
1093 +int tn7dsl_proc_adv_stats1(struct seq_file *m, void *data)
1097 - int limit = count - 80;
1099 int mode = 0; //mode = 0 => ADSL1 or ADSL2 & 2+
1100 unsigned char SNRpsds[512];
1103 - len = proc_adv_stats_header( buf+len, limit);
1104 + proc_adv_stats_header( m);
1105 mode = getDiagDisplayMode();
1108 - len += sprintf(buf+len, "\tBin No.\tBits:\tMargin:\tSNR (Part 1 of 3)\n");
1109 + seq_printf(m, "\tBin No.\tBits:\tMargin:\tSNR (Part 1 of 3)\n");
1113 for( i =32; i<128; i++)
1116 - len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
1117 + seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
1118 (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
1119 (unsigned int)pIhw->AppData.marginTblDstrm[i],
1120 (int)pIhw->AppData.rxSnrPerBin0[i]);
1121 @@ -1050,26 +1055,34 @@ int tn7dsl_proc_adv_stats1(char* buf, ch
1122 if (dslhal_api_getSNRpsds(pIhw, SNRpsds, 1))
1124 dgprintf(4, "dslhal_api_getSNRpsds failed!\n");
1128 for( i =32; i<128; i++)
1131 - len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
1132 + seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
1133 (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
1134 (unsigned int)pIhw->AppData.marginTblDstrm[i],
1135 (i<pIhw->AppData.max_ds_tones)?(unsigned char)SNRpsds[i]:0);
1142 -int tn7dsl_proc_adv_stats2(char* buf, char **start, off_t offset, int count,
1143 - int *eof, void *data)
1144 +static int tn7dsl_proc_adv_stats1_open(struct inode *inode, struct file *file)
1146 + return single_open(file, tn7dsl_proc_adv_stats1, PDE_DATA(inode));
1150 - int limit = count - 80;
1151 +struct file_operations tn7dsl_proc_adv_stats1_fops = {
1152 + .owner = THIS_MODULE,
1153 + .open = tn7dsl_proc_adv_stats1_open,
1155 + .llseek = seq_lseek,
1156 + .release = single_release,
1159 +int tn7dsl_proc_adv_stats2(struct seq_file *m, void *data)
1162 int mode = 0; //mode = 0 => ADSL1 or ADSL2 & 2+
1163 unsigned char SNRpsds[512];
1164 @@ -1079,12 +1092,10 @@ int tn7dsl_proc_adv_stats2(char* buf, ch
1165 if( mode==1) //ADSL1
1167 dslhal_api_gatherStatistics(pIhw);
1169 - len += sprintf(buf+len, "\tBin No.\tBits:\tMargin:\tSNR (Part 2 of 3):\n");
1170 + seq_printf(m, "\tBin No.\tBits:\tMargin:\tSNR (Part 2 of 3):\n");
1171 for( i =128; i<320; i++)
1174 - len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
1175 + seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
1176 (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
1177 (unsigned int)pIhw->AppData.marginTblDstrm[i],
1178 (int)pIhw->AppData.rxSnrPerBin0[i]);
1179 @@ -1095,26 +1106,35 @@ int tn7dsl_proc_adv_stats2(char* buf, ch
1180 if (dslhal_api_getSNRpsds(pIhw, SNRpsds, 1))
1182 dgprintf(4, "dslhal_api_getSNRpsds failed!\n");
1186 for( i =128; i<320; i++)
1189 - len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
1190 + seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
1191 (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
1192 (unsigned int)pIhw->AppData.marginTblDstrm[i],
1193 (i<pIhw->AppData.max_ds_tones)?(unsigned char)SNRpsds[i]:0);
1200 -int tn7dsl_proc_adv_stats3(char* buf, char **start, off_t offset, int count,
1201 - int *eof, void *data)
1202 +static int tn7dsl_proc_adv_stats2_open(struct inode *inode, struct file *file)
1204 + return single_open(file, tn7dsl_proc_adv_stats2, PDE_DATA(inode));
1207 +struct file_operations tn7dsl_proc_adv_stats2_fops = {
1208 + .owner = THIS_MODULE,
1209 + .open = tn7dsl_proc_adv_stats2_open,
1211 + .llseek = seq_lseek,
1212 + .release = single_release,
1215 +int tn7dsl_proc_adv_stats3(struct seq_file *m, void *data)
1219 - int limit = count - 80;
1221 int mode = 0; //mode = 0 => ADSL1 or ADSL2 & 2+
1222 unsigned char SNRpsds[512];
1223 @@ -1124,12 +1144,10 @@ int tn7dsl_proc_adv_stats3(char* buf, ch
1224 if( mode==1) //ADSL1
1226 dslhal_api_gatherStatistics(pIhw);
1228 - len += sprintf(buf+len, "\tBin No.\tBits:\tMargin:\tSNR (Part 3 of 3):\n");
1229 + seq_printf(m, "\tBin No.\tBits:\tMargin:\tSNR (Part 3 of 3):\n");
1230 for( i =320; i<512; i++)
1233 - len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
1234 + seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
1235 (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
1236 (unsigned int)pIhw->AppData.marginTblDstrm[i],
1237 (int)pIhw->AppData.rxSnrPerBin0[i]);
1238 @@ -1140,283 +1158,287 @@ int tn7dsl_proc_adv_stats3(char* buf, ch
1239 if (dslhal_api_getSNRpsds(pIhw, SNRpsds, 1))
1241 dgprintf(4, "dslhal_api_getSNRpsds failed!\n");
1245 for( i =320; i<512; i++)
1248 - len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
1249 + seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
1250 (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
1251 (unsigned int)pIhw->AppData.marginTblDstrm[i],
1252 (i<pIhw->AppData.max_ds_tones)?(unsigned char)SNRpsds[i]:0);
1256 - len += sprintf(buf+len, "[End of Stats]\n");
1258 + seq_printf(m, "[End of Stats]\n");
1261 -//UR8_MERGE_END CQ10449
1262 -//UR8_MERGE_START CQ10682 Jack Zhang
1263 -int tn7dsl_proc_dbg_cmsgs(char* buf, char **start, off_t offset, int count,
1264 - int *eof, void *data)
1266 +static int tn7dsl_proc_adv_stats3_open(struct inode *inode, struct file *file)
1268 + return single_open(file, tn7dsl_proc_adv_stats3, PDE_DATA(inode));
1272 - int limit = count - 80;
1273 +struct file_operations tn7dsl_proc_adv_stats3_fops = {
1274 + .owner = THIS_MODULE,
1275 + .open = tn7dsl_proc_adv_stats3_open,
1277 + .llseek = seq_lseek,
1278 + .release = single_release,
1281 +//UR8_MERGE_END CQ10449
1282 +//UR8_MERGE_START CQ10682 Jack Zhang
1283 +int tn7dsl_proc_dbg_cmsgs(struct seq_file *m, void *data)
1287 dslhal_api_gatherStatistics(pIhw);
1290 - len += sprintf(buf+len, "Training Messages (C-Msgs 1-5)..\n");
1291 + seq_printf(m, "Training Messages (C-Msgs 1-5)..\n");
1294 - len += sprintf(buf+len, "ADSL2 DELT C-Msg1Ld \t Message Length:%d\n",
1295 + seq_printf(m, "ADSL2 DELT C-Msg1Ld \t Message Length:%d\n",
1296 pIhw->adsl2DiagnosticMessages.cMsg1LdLen);
1297 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg1LdLen;rc++)
1300 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg1Ld[rc]);
1301 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg1Ld[rc]);
1302 if(rc!=0 && (rc%16==0))
1304 - len += sprintf(buf+len, "\n");
1305 + seq_printf(m, "\n");
1308 - len += sprintf(buf+len, "\nADSL2 DELT C-Msg2Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg2LdLen);
1309 + seq_printf(m, "\nADSL2 DELT C-Msg2Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg2LdLen);
1311 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg2LdLen;rc++)
1314 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg2Ld[rc]);
1315 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg2Ld[rc]);
1316 if(rc!=0 && (rc%16==0))
1318 - len += sprintf(buf+len, "\n");
1319 + seq_printf(m, "\n");
1323 - len += sprintf(buf+len, "\nADSL2 DELT C-Msg3Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg3LdLen);
1324 + seq_printf(m, "\nADSL2 DELT C-Msg3Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg3LdLen);
1326 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg3LdLen;rc++)
1329 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg3Ld[rc]);
1330 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg3Ld[rc]);
1331 if(rc!=0 && (rc%16==0))
1333 - len += sprintf(buf+len, "\n");
1334 + seq_printf(m, "\n");
1338 - len += sprintf(buf+len, "\nADSL2 DELT C-Msg4Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg4LdLen);
1339 + seq_printf(m, "\nADSL2 DELT C-Msg4Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg4LdLen);
1341 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg4LdLen;rc++)
1344 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg4Ld[rc]);
1345 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg4Ld[rc]);
1346 if(rc!=0 && (rc%16==0))
1348 - len += sprintf(buf+len, "\n");
1349 + seq_printf(m, "\n");
1353 - len += sprintf(buf+len, "\nADSL2 DELT C-Msg5Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg5LdLen);
1354 + seq_printf(m, "\nADSL2 DELT C-Msg5Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg5LdLen);
1356 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg5LdLen;rc++)
1359 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg5Ld[rc]);
1360 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg5Ld[rc]);
1361 if(rc!=0 && (rc%16==0))
1363 - len += sprintf(buf+len, "\n");
1364 + seq_printf(m, "\n");
1367 - len += sprintf(buf+len, "\n");
1369 + seq_printf(m, "\n");
1373 -int tn7dsl_proc_dbg_rmsgs1(char* buf, char **start, off_t offset, int count,
1374 - int *eof, void *data)
1375 +static int tn7dsl_proc_dbg_cmsgs_open(struct inode *inode, struct file *file)
1377 + return single_open(file, tn7dsl_proc_dbg_cmsgs, PDE_DATA(inode));
1381 - int limit = count - 80;
1382 +struct file_operations tn7dsl_proc_dbg_cmsgs_fops = {
1383 + .owner = THIS_MODULE,
1384 + .open = tn7dsl_proc_dbg_cmsgs_open,
1386 + .llseek = seq_lseek,
1387 + .release = single_release,
1391 +int tn7dsl_proc_dbg_rmsgs1(struct seq_file *m, void *data)
1396 dslhal_api_gatherStatistics(pIhw);
1399 - len += sprintf(buf+len, "Training Messages (R-Msgs 1-3)..\n");
1400 + seq_printf(m, "Training Messages (R-Msgs 1-3)..\n");
1403 - len += sprintf(buf+len, "\nADSL2 DELT R-Msg1Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsg1LdLen);
1404 + seq_printf(m, "\nADSL2 DELT R-Msg1Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsg1LdLen);
1406 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsg1LdLen;rc++)
1409 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg1Ld[rc]);
1410 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg1Ld[rc]);
1411 if(rc!=0 && (rc%16==0))
1413 - len += sprintf(buf+len, "\n");
1414 + seq_printf(m, "\n");
1418 - len += sprintf(buf+len, "\nADSL2 DELT R-Msg2Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1419 + seq_printf(m, "\nADSL2 DELT R-Msg2Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1421 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
1424 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg2Ld[rc]);
1425 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg2Ld[rc]);
1426 if(rc!=0 && (rc%16==0))
1428 - len += sprintf(buf+len, "\n");
1429 + seq_printf(m, "\n");
1433 - len += sprintf(buf+len, "\nADSL2 DELT R-Msg3Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1434 + seq_printf(m, "\nADSL2 DELT R-Msg3Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1435 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
1438 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg3Ld[rc]);
1439 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg3Ld[rc]);
1440 if(rc!=0 && (rc%16==0))
1442 - len += sprintf(buf+len, "\n");
1443 + seq_printf(m, "\n");
1446 - len += sprintf(buf+len, "\n");
1448 + seq_printf(m, "\n");
1452 -int tn7dsl_proc_dbg_rmsgs2(char* buf, char **start, off_t offset, int count,
1453 - int *eof, void *data)
1454 +static int tn7dsl_proc_dbg_rmsgs1_open(struct inode *inode, struct file *file)
1456 + return single_open(file, tn7dsl_proc_dbg_rmsgs1, PDE_DATA(inode));
1460 - int limit = count - 80;
1461 +struct file_operations tn7dsl_proc_dbg_rmsgs1_fops = {
1462 + .owner = THIS_MODULE,
1463 + .open = tn7dsl_proc_dbg_rmsgs1_open,
1465 + .llseek = seq_lseek,
1466 + .release = single_release,
1470 +int tn7dsl_proc_dbg_rmsgs2(struct seq_file *m, void *data)
1475 dslhal_api_gatherStatistics(pIhw);
1478 - len += sprintf(buf+len, "Training Messages (R-Msgs 4-5)..\n");
1479 + seq_printf(m, "Training Messages (R-Msgs 4-5)..\n");
1482 - len += sprintf(buf+len, "\nADSL2 DELT R-Msg4Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1483 + seq_printf(m, "\nADSL2 DELT R-Msg4Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1484 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
1487 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg4Ld[rc]);
1488 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg4Ld[rc]);
1489 if(rc!=0 && (rc%16==0))
1491 - len += sprintf(buf+len, "\n");
1492 + len += sprintf(m, "\n");
1496 - len += sprintf(buf+len, "\nADSL2 DELT R-Msg5Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1497 + seq_printf(m, "\nADSL2 DELT R-Msg5Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1498 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
1501 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg5Ld[rc]);
1502 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg5Ld[rc]);
1503 if(rc!=0 && (rc%16==0))
1505 - len += sprintf(buf+len, "\n");
1506 + seq_printf(m, "\n");
1510 - len += sprintf(buf+len, "\n");
1512 + seq_printf(m, "\n");
1516 -int tn7dsl_proc_dbg_rmsgs3(char* buf, char **start, off_t offset, int count,
1517 - int *eof, void *data)
1518 +static int tn7dsl_proc_dbg_rmsgs2_open(struct inode *inode, struct file *file)
1520 + return single_open(file, tn7dsl_proc_dbg_rmsgs2, PDE_DATA(inode));
1524 - int limit = count - 80;
1525 +struct file_operations _fops = {
1526 + .owner = THIS_MODULE,
1527 + .open = tn7dsl_proc_dbg_rmsgs2_open,
1529 + .llseek = seq_lseek,
1530 + .release = single_release,
1533 +int tn7dsl_proc_dbg_rmsgs3(struct seq_file *m, void *data)
1538 dslhal_api_gatherStatistics(pIhw);
1541 - len += sprintf(buf+len, "Training Messages (R-Msgs 6-7)..\n");
1542 + seq_printf(m, "Training Messages (R-Msgs 6-7)..\n");
1545 - len += sprintf(buf+len, "\nADSL2 DELT R-Msg6Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1546 + seq_printf(m, "\nADSL2 DELT R-Msg6Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1547 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
1550 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg6Ld[rc]);
1551 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg6Ld[rc]);
1552 if(rc!=0 && (rc%16==0))
1554 - len += sprintf(buf+len, "\n");
1555 + seq_printf(m, "\n");
1558 - len += sprintf(buf+len, "\nADSL2 DELT R-Msg7Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1559 + seq_printf(m, "\nADSL2 DELT R-Msg7Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1560 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
1563 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg7Ld[rc]);
1564 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg7Ld[rc]);
1565 if(rc!=0 && (rc%16==0))
1567 - len += sprintf(buf+len, "\n");
1568 + seq_printf(m, "\n");
1571 - len += sprintf(buf+len, "\n");
1572 + seq_printf(m, "\n");
1578 -int tn7dsl_proc_dbg_rmsgs4(char* buf, char **start, off_t offset, int count,
1579 - int *eof, void *data)
1580 +static int tn7dsl_proc_dbg_rmsgs3_open(struct inode *inode, struct file *file)
1582 + return single_open(file, tn7dsl_proc_dbg_rmsgs3, PDE_DATA(inode));
1586 - int limit = count - 80;
1587 +struct file_operations tn7dsl_proc_dbg_rmsgs3_fops = {
1588 + .owner = THIS_MODULE,
1589 + .open = tn7dsl_proc_dbg_rmsgs3_open,
1591 + .llseek = seq_lseek,
1592 + .release = single_release,
1595 +int tn7dsl_proc_dbg_rmsgs4(struct seq_file *m, void *data)
1600 dslhal_api_gatherStatistics(pIhw);
1603 - len += sprintf(buf+len, "Training Messages (R-Msgs 8-9)..\n");
1604 + seq_printf(m, "Training Messages (R-Msgs 8-9)..\n");
1607 - len += sprintf(buf+len, "\nADSL2 DELT R-Msg8Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1608 + seq_printf(m, "\nADSL2 DELT R-Msg8Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1609 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
1612 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg8Ld[rc]);
1613 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg8Ld[rc]);
1614 if(rc!=0 && (rc%16==0))
1616 - len += sprintf(buf+len, "\n");
1617 + seq_printf(m, "\n");
1621 - len += sprintf(buf+len, "\nADSL2 DELT R-Msg9Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1622 + seq_printf(m, "\nADSL2 DELT R-Msg9Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
1623 for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
1626 - len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg9Ld[rc]);
1627 + seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg9Ld[rc]);
1628 if(rc!=0 && (rc%16==0))
1630 - len += sprintf(buf+len, "\n");
1631 + seq_printf(m, "\n");
1634 - len += sprintf(buf+len, "\n");
1635 + seq_printf(m, "\n");
1641 +static int tn7dsl_proc_dbg_rmsgs4_open(struct inode *inode, struct file *file)
1643 + return single_open(file, tn7dsl_proc_dbg_rmsgs4, PDE_DATA(inode));
1646 +struct file_operations tn7dsl_proc_dbg_rmsgs4_fops = {
1647 + .owner = THIS_MODULE,
1648 + .open = tn7dsl_proc_dbg_rmsgs4_open,
1650 + .llseek = seq_lseek,
1651 + .release = single_release,
1654 //UR8_MERGE_END CQ10682*
1655 #endif //ADV_DIAG_STATS
1657 -int tn7dsl_proc_stats(char* buf, char **start, off_t offset, int count,
1658 - int *eof, void *data)
1659 +static int tn7dsl_proc_stats(struct seq_file *m, void *data)
1663 - int limit = count - 80;
1664 int F4count, F5count;
1665 unsigned int maxRate=0;
1666 unsigned int us_maxRate=0;
1667 @@ -1424,80 +1446,58 @@ int tn7dsl_proc_stats(char* buf, char **
1668 //UR8_MERGE_START CQ10700 Manjula K
1669 struct atm_dev *dev;
1670 Tn7AtmPrivate *priv;
1671 - dev = (struct atm_dev *)data;
1672 + int offset[2] = { 32, 0 };
1673 + unsigned int usBitswap, dsBitswap;
1674 + dev = (struct atm_dev *)m->private;
1675 priv = (Tn7AtmPrivate *)dev->dev_data;
1676 //UR8_MERGE_END CQ10700
1683 dslhal_api_gatherStatistics(pIhw);
1685 - len += sprintf(buf+len, "\nAR7 DSL Modem Statistics:\n");
1687 - len += sprintf(buf+len, "--------------------------------\n");
1688 + seq_printf(m, "\nAR7 DSL Modem Statistics:\n");
1689 + seq_printf(m, "--------------------------------\n");
1691 * us and ds Connection Rates
1694 - len += sprintf(buf+len, "[DSL Modem Stats]\n");
1695 + seq_printf(m, "[DSL Modem Stats]\n");
1699 + if(pIhw->lConnected != 1)
1701 - if(pIhw->lConnected != 1)
1703 - pIhw->AppData.USConRate = 0;
1704 - pIhw->AppData.DSConRate = 0;
1707 - sprintf (buf + len,
1708 - "\tUS Connection Rate:\t%u\tDS Connection Rate:\t%u\n",
1709 - (unsigned int)pIhw->AppData.USConRate,
1710 - (unsigned int)pIhw->AppData.DSConRate );
1711 + pIhw->AppData.USConRate = 0;
1712 + pIhw->AppData.DSConRate = 0;
1716 + "\tUS Connection Rate:\t%u\tDS Connection Rate:\t%u\n",
1717 + (unsigned int)pIhw->AppData.USConRate,
1718 + (unsigned int)pIhw->AppData.DSConRate );
1719 // UR8_MERGE_START CQ11054 Jack Zhang
1721 - if (dslhal_api_getHighPrecision())
1724 - sprintf (buf + len, "\tDS Line Attenuation:\t%u.%u\tDS Margin:\t\t%d.%u\n",
1725 + if (dslhal_api_getHighPrecision())
1726 + seq_printf (m, "\tDS Line Attenuation:\t%u.%u\tDS Margin:\t\t%d.%u\n",
1727 gInt(pIhw->AppData.dsLineAttn), gDot1(pIhw->AppData.dsLineAttn),
1728 gInt(pIhw->AppData.dsMargin), gDot1(pIhw->AppData.dsMargin));
1732 - sprintf (buf + len, "\tDS Line Attenuation:\t%u\tDS Margin:\t\t%u\n",
1734 + seq_printf (m, "\tDS Line Attenuation:\t%u\tDS Margin:\t\t%u\n",
1735 (unsigned int)pIhw->AppData.dsLineAttn/2,
1736 (unsigned int)pIhw->AppData.dsMargin/2 );
1739 // UR8_MERGE_END CQ11054*
1742 // UR8_MERGE_START CQ11054 Jack Zhang
1744 - if (dslhal_api_getHighPrecision())
1747 - sprintf (buf + len, "\tUS Line Attenuation:\t%u.%u\tUS Margin:\t\t%d.%u\n",
1748 + if (dslhal_api_getHighPrecision())
1749 + seq_printf (m, "\tUS Line Attenuation:\t%u.%u\tUS Margin:\t\t%d.%u\n",
1750 gInt(pIhw->AppData.usLineAttn), gDot1(pIhw->AppData.usLineAttn),
1751 gInt(pIhw->AppData.usMargin), gDot1(pIhw->AppData.usMargin));
1756 - sprintf (buf + len, "\tUS Line Attenuation:\t%u\tUS Margin:\t\t%u\n",
1758 + seq_printf (m, "\tUS Line Attenuation:\t%u\tUS Margin:\t\t%u\n",
1759 (unsigned int)pIhw->AppData.usLineAttn/2,
1760 (unsigned int)pIhw->AppData.usMargin );
1763 // UR8_MERGE_END CQ11054*
1766 - len += sprintf(buf+len, "\tUS Payload :\t\t%u\tDS Payload:\t\t%u\n",
1767 + seq_printf(m, "\tUS Payload :\t\t%u\tDS Payload:\t\t%u\n",
1768 ((unsigned int) pIhw->AppData.usAtm_count[0] +
1769 (unsigned int) pIhw->AppData.usAtm_count[1]) * 48,
1770 ((unsigned int) pIhw->AppData.dsGood_count[0] +
1771 @@ -1505,9 +1505,7 @@ int tn7dsl_proc_stats(char* buf, char **
1777 - sprintf (buf + len,
1779 "\tUS Superframe Cnt :\t%u\tDS Superframe Cnt:\t%u\n",
1780 (unsigned int)pIhw->AppData.usSuperFrmCnt,
1781 (unsigned int)pIhw->AppData.dsSuperFrmCnt );
1782 @@ -1515,59 +1513,45 @@ int tn7dsl_proc_stats(char* buf, char **
1787 + if(pIhw->AppData.bState < 5)
1789 - if(pIhw->AppData.bState < 5)
1791 - pIhw->AppData.usTxPower = 0;
1792 - pIhw->AppData.dsTxPower = 0;
1795 - sprintf (buf + len,
1796 + pIhw->AppData.usTxPower = 0;
1797 + pIhw->AppData.dsTxPower = 0;
1800 // UR8_MERGE_START - CQ11579 - Jeremy #1
1801 "\tUS Transmit Power :\t%d\tDS Transmit Power:\t%d\n",
1802 pIhw->AppData.usTxPower/256,
1803 pIhw->AppData.dsTxPower/256 );
1804 // UR8_MERGE_END - CQ11579
1810 - len += sprintf(buf+len, "\tLOS errors:\t\t%u\tSEF errors:\t\t%u\n",
1811 + seq_printf(m, "\tLOS errors:\t\t%u\tSEF errors:\t\t%u\n",
1812 (unsigned int)pIhw->AppData.LOS_errors,
1813 (unsigned int)pIhw->AppData.SEF_errors );
1815 //UR8_MERGE_START Report_SES Manjula K
1818 - len += sprintf(buf+len, "\tErrored Seconds:\t%u\tSeverely Err Secs:\t%u\n",
1819 + seq_printf(m, "\tErrored Seconds:\t%u\tSeverely Err Secs:\t%u\n",
1820 (unsigned int)pIhw->AppData.erroredSeconds,
1821 (unsigned int)pIhw->AppData.severelyerrsecs );
1822 //UR8_MERGE_END Report_SES
1825 - len += sprintf(buf+len, "\tFrame mode:\t\t%u\tMax Frame mode:\t\t%u\n",
1826 + seq_printf(m, "\tFrame mode:\t\t%u\tMax Frame mode:\t\t%u\n",
1827 (unsigned int)pIhw->AppData.FrmMode,
1828 (unsigned int)pIhw->AppData.MaxFrmMode );
1831 - sprintf (buf + len, "\tTrained Path:\t\t%u\tUS Peak Cell Rate:\t%u\n",
1832 + seq_printf (m, "\tTrained Path:\t\t%u\tUS Peak Cell Rate:\t%u\n",
1833 (unsigned int)pIhw->AppData.TrainedPath,
1834 (unsigned int)pIhw->AppData.USConRate*1000/8/53 );
1837 - sprintf (buf + len, "\tTrained Mode:\t\t%u\tSelected Mode:\t\t%u\n",
1838 + seq_printf (m, "\tTrained Mode:\t\t%u\tSelected Mode:\t\t%u\n",
1839 (unsigned int) pIhw->AppData.TrainedMode,
1840 (unsigned int) pIhw->AppData.StdMode);
1844 - sprintf (buf + len, "\tATUC Vendor Code:\t%X\tATUC Revision:\t%u\n",
1845 + seq_printf (m, "\tATUC Vendor Code:\t%X\tATUC Revision:\t%u\n",
1846 (unsigned int) pIhw->AppData.atucVendorId,
1847 pIhw->AppData.atucRevisionNum);
1849 - len += sprintf(buf+len, "\tHybrid Selected:\t%u\tTrellis:\t\t%u\n",
1850 + seq_printf(m, "\tHybrid Selected:\t%u\tTrellis:\t\t%u\n",
1851 (unsigned int)pIhw->AppData.currentHybridNum, trellis);
1853 //@Added Maximum attainable bit rate information. 05-14-2004
1854 @@ -1581,12 +1565,12 @@ int tn7dsl_proc_stats(char* buf, char **
1858 - int offset[2] = {5, 1};
1859 + int dspOffset[2] = { 5, 1 };
1860 unsigned char rMsgsRA[12];
1861 int numPayloadBytes = 0;
1863 dslhal_api_dspInterfaceRead (pIhw, (unsigned int) pIhw->pmainAddr, 2,
1864 - (unsigned int *) &offset,
1865 + (unsigned int *) &dspOffset,
1866 (unsigned char *) &rMsgsRA[0], 12);
1868 maxRate = (unsigned int)pIhw->AppData.DSConRate;
1869 @@ -1602,294 +1586,223 @@ int tn7dsl_proc_stats(char* buf, char **
1875 - sprintf (buf + len,
1877 "\tShowtime Count:\t\t%u\tDS Max Attainable Bit Rate: %u kbps\n",
1878 (unsigned int)pIhw->AppData.showtimeCount, maxRate);
1882 - int offset[2] = {32, 0};
1883 - unsigned int usBitswap, dsBitswap;
1885 - tn7dsl_generic_read(2, (unsigned int *)&offset);
1886 - dsBitswap = dslReg & dslhal_support_byteSwap32(0x000000ff);
1887 + tn7dsl_generic_read(2, (unsigned int *)&offset);
1888 + dsBitswap = dslReg & dslhal_support_byteSwap32(0x000000ff);
1891 - tn7dsl_generic_read(2, (unsigned int *)&offset);
1892 - usBitswap = dslReg & dslhal_support_byteSwap32(0x000000ff);
1894 + tn7dsl_generic_read(2, (unsigned int *)&offset);
1895 + usBitswap = dslReg & dslhal_support_byteSwap32(0x000000ff);
1897 // UR8_MERGE_START - CQ11579 - Jeremy
1898 - if((pIhw->AppData.dsl_modulation > 5) && (pIhw->AppData.dsl_modulation != 128))
1899 + if((pIhw->AppData.dsl_modulation > 5) && (pIhw->AppData.dsl_modulation != 128))
1900 // UR8_MERGE_END - CQ11579 - Jeremy
1902 - sprintf (buf + len,
1904 "\tBitSwap:\t\t%u\tUS Max Attainable Bit Rate: %u bps\n",
1905 (unsigned int)(usBitswap && dsBitswap), us_maxRate);
1908 - sprintf (buf + len,
1911 "\tBitSwap:\t\t%u\tUS Max Attainable Bit Rate:\tn/a\n",
1912 (unsigned int)(usBitswap && dsBitswap));
1918 - sprintf (buf + len, "\tAnnex: \t\t\t%s\tpsd_mask_qualifier: 0x%04x\n",
1919 + seq_printf (m, "\tAnnex: \t\t\t%s\tpsd_mask_qualifier: 0x%04x\n",
1920 tn7dsl_AnnexFromNum(pIhw->AppData.annex_selected),
1921 pIhw->AppData.psd_mask_qualifier);
1923 // UR8_MERGE_START CQ10979 Jack Zhang
1924 // UR8_MERGE_START CQ10978 Jack Zhang
1927 - sprintf (buf + len, "\tPower Management Status: L%d\tDS HLINSC: %d\n",
1928 + seq_printf (m, "\tPower Management Status: L%d\tDS HLINSC: %d\n",
1929 pIhw->AppData.pwrStatus, pIhw->AppData.dsHLINSC);
1930 // UR8_MERGE_END CQ10978*
1934 - sprintf (buf + len, "\tUS ACTPSD: \t\t%d\tDS ACTPSD: %d\n",
1935 + seq_printf (m, "\tUS ACTPSD: \t\t%d\tDS ACTPSD: %d\n",
1936 pIhw->AppData.usACTPSD, pIhw->AppData.dsACTPSD);
1940 - sprintf (buf + len, "\tTotal init. errors: \t%d\tTotal init. timeouts: %d\n",
1941 + seq_printf (m, "\tTotal init. errors: \t%d\tTotal init. timeouts: %d\n",
1942 pIhw->AppData.totalInitErrs, pIhw->AppData.totalInitTOs);
1946 - sprintf (buf + len, "\tShowtime init. errors: \t%d\tShowtime init. timeouts: %d\n",
1947 + seq_printf (m, "\tShowtime init. errors: \t%d\tShowtime init. timeouts: %d\n",
1948 pIhw->AppData.showtimeInitErrs, pIhw->AppData.showtimeInitTOs);
1952 - sprintf (buf + len, "\tLast showtime init. errors: %d\tLast showtime init. timeouts: %d\n",
1953 + seq_printf (m, "\tLast showtime init. errors: %d\tLast showtime init. timeouts: %d\n",
1954 pIhw->AppData.lastshowInitErrs, pIhw->AppData.lastshowInitTOs);
1955 // UR8_MERGE_END CQ10979*
1959 - len += sprintf(buf+len,"\tATUC ghsVid: ");
1960 - for (i=0; i<8; i++)
1961 - len+= sprintf(buf+len, " %02x", pIhw->AppData.ghsATUCVendorId[i]);
1963 + seq_printf(m,"\tATUC ghsVid: ");
1964 + for (i=0; i<8; i++)
1965 + seq_printf(m, " %02x", pIhw->AppData.ghsATUCVendorId[i]);
1969 - len += sprintf (buf + len, "\n");
1971 + seq_printf (m, "\n");
1976 - sprintf (buf + len,
1978 "\tT1413Vid: %02x %02x\t\tT1413Rev: %02x\t\tVendorRev: %02x\n",
1979 pIhw->AppData.t1413ATUC.VendorId[0],
1980 pIhw->AppData.t1413ATUC.VendorId[1],
1981 pIhw->AppData.t1413ATUC.t1413Revision,
1982 pIhw->AppData.t1413ATUC.VendorRevision);
1987 - len += sprintf(buf+len,"\tATUR ghsVid: ");
1988 - for (i=0; i<8; i++)
1989 - len+= sprintf(buf+len, " %02x", pIhw->AppData.ghsATURVendorId[i]);
1991 + seq_printf(m,"\tATUR ghsVid: ");
1992 + for (i=0; i<8; i++)
1993 + seq_printf(m, " %02x", pIhw->AppData.ghsATURVendorId[i]);
1997 - len += sprintf (buf + len, "\n");
1999 + seq_printf (m, "\n");
2004 - sprintf (buf + len,
2006 "\tT1413Vid: %02x %02x\tT1413Rev: %02x\tVendorRev: %02x\n",
2007 pIhw->AppData.t1413ATUR.VendorId[0],
2008 pIhw->AppData.t1413ATUR.VendorId[1],
2009 pIhw->AppData.t1413ATUR.t1413Revision,
2010 pIhw->AppData.t1413ATUR.VendorRevision);
2016 - len += sprintf(buf + len, "\tTC Mode: %s\n",
2017 + seq_printf(m, "\tTC Mode: %s\n",
2018 (priv->curr_TC_mode == TC_MODE_PTM) ? "PTM" : "ATM");
2024 * Upstream Interleaved Errors
2027 - len += sprintf(buf+len, "\n\t[Upstream (TX) Interleave path]\n");
2029 - len += sprintf(buf+len, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
2030 + seq_printf(m, "\n\t[Upstream (TX) Interleave path]\n");
2031 + seq_printf(m, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
2032 (unsigned int)pIhw->AppData.usICRC_errors,
2033 (unsigned int)pIhw->AppData.usIFEC_errors,
2034 (unsigned int)pIhw->AppData.usINCD_error);
2036 - len += sprintf(buf+len, "\tLCD: \t%u\tHEC: \t%u\n",
2037 + seq_printf(m, "\tLCD: \t%u\tHEC: \t%u\n",
2038 (unsigned int)pIhw->AppData.usILCD_errors,
2039 (unsigned int)pIhw->AppData.usIHEC_errors);
2041 * Downstream Interleaved Errors
2044 - len += sprintf(buf+len, "\n\t[Downstream (RX) Interleave path]\n");
2046 - len += sprintf(buf+len, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
2047 + seq_printf(m, "\n\t[Downstream (RX) Interleave path]\n");
2048 + seq_printf(m, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
2049 (unsigned int)pIhw->AppData.dsICRC_errors,
2050 (unsigned int)pIhw->AppData.dsIFEC_errors,
2051 (unsigned int)pIhw->AppData.dsINCD_error);
2053 - len += sprintf(buf+len, "\tLCD: \t%u\tHEC: \t%u\n",
2054 + seq_printf(m, "\tLCD: \t%u\tHEC: \t%u\n",
2055 (unsigned int)pIhw->AppData.dsILCD_errors,
2056 (unsigned int)pIhw->AppData.dsIHEC_errors);
2058 * Upstream Fast Errors
2061 - len += sprintf(buf+len, "\n\t[Upstream (TX) Fast path]\n");
2063 - len += sprintf(buf+len, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
2064 + seq_printf(m, "\n\t[Upstream (TX) Fast path]\n");
2065 + seq_printf(m, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
2066 (unsigned int)pIhw->AppData.usFCRC_errors,
2067 (unsigned int)pIhw->AppData.usFFEC_errors,
2068 (unsigned int)pIhw->AppData.usFNCD_error);
2070 - len += sprintf(buf+len, "\tLCD: \t%u\tHEC: \t%u\n",
2071 + seq_printf(m, "\tLCD: \t%u\tHEC: \t%u\n",
2072 (unsigned int)pIhw->AppData.usFLCD_errors,
2073 (unsigned int)pIhw->AppData.usFHEC_errors);
2075 * Downstream Fast Errors
2078 - len += sprintf(buf+len, "\n\t[Downstream (RX) Fast path]\n");
2080 - len += sprintf(buf+len, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
2081 + seq_printf(m, "\n\t[Downstream (RX) Fast path]\n");
2082 + seq_printf(m, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
2083 (unsigned int)pIhw->AppData.dsFCRC_errors,
2084 (unsigned int)pIhw->AppData.dsFFEC_errors,
2085 (unsigned int)pIhw->AppData.dsFNCD_error);
2087 - len += sprintf(buf+len, "\tLCD: \t%u\tHEC: \t%u\n",
2088 - (unsigned int)pIhw->AppData.dsFLCD_errors,
2089 - (unsigned int)pIhw->AppData.dsFHEC_errors);
2090 + seq_printf(m, "\tLCD: \t%u\tHEC: \t%u\n",
2091 + (unsigned int)pIhw->AppData.dsFLCD_errors,
2092 + (unsigned int)pIhw->AppData.dsFHEC_errors);
2095 * ATM stats upstream
2098 - len += sprintf(buf+len, "\n[ATM Stats]");
2100 - len += sprintf(buf+len, "\n\t[Upstream/TX]\n");
2103 - sprintf (buf + len, "\tGood Cell Cnt:\t%u\n\tIdle Cell Cnt:\t%u\n\n",
2104 - (unsigned int) pIhw->AppData.usAtm_count[0] +
2105 - (unsigned int) pIhw->AppData.usAtm_count[1],
2106 - (unsigned int) pIhw->AppData.usIdle_count[0] +
2107 - (unsigned int) pIhw->AppData.usIdle_count[1]);
2108 + seq_printf(m, "\n[ATM Stats]");
2109 + seq_printf(m, "\n\t[Upstream/TX]\n");
2110 + seq_printf (m, "\tGood Cell Cnt:\t%u\n\tIdle Cell Cnt:\t%u\n\n",
2111 + (unsigned int) pIhw->AppData.usAtm_count[0] +
2112 + (unsigned int) pIhw->AppData.usAtm_count[1],
2113 + (unsigned int) pIhw->AppData.usIdle_count[0] +
2114 + (unsigned int) pIhw->AppData.usIdle_count[1]);
2115 //UR8_MERGE_START CQ10700 Manjula K
2118 - sprintf (buf + len,
2120 "\tTx Packets Dropped Count:\t%lu\n\tTx Bad Packets Count:\t%lu\n",
2121 priv->stats.tx_dropped, priv->stats.tx_errors);
2122 //UR8_MERGE_END CQ10700
2124 * ATM stats downstream
2127 - len += sprintf(buf+len, "\n\t[Downstream/RX)]\n");
2130 - sprintf (buf + len,
2131 - "\tGood Cell Cnt:\t%u\n\tIdle Cell Cnt:\t%u\n\tBad Hec Cell Cnt:\t%u\n",
2132 - (unsigned int) pIhw->AppData.dsGood_count[0] +
2133 - (unsigned int) pIhw->AppData.dsGood_count[1],
2134 - (unsigned int) pIhw->AppData.dsIdle_count[0] +
2135 - (unsigned int) pIhw->AppData.dsIdle_count[1],
2136 - (unsigned int) pIhw->AppData.dsBadHec_count[0] +
2137 - (unsigned int) pIhw->AppData.dsBadHec_count[1]);
2139 - len += sprintf(buf+len, "\tOverflow Dropped Cell Cnt:\t%u\n",
2140 - (unsigned int) pIhw->AppData.dsOVFDrop_count[0] +
2141 - (unsigned int) pIhw->AppData.dsOVFDrop_count[1]);
2142 + seq_printf(m, "\n\t[Downstream/RX)]\n");
2144 + "\tGood Cell Cnt:\t%u\n\tIdle Cell Cnt:\t%u\n\tBad Hec Cell Cnt:\t%u\n",
2145 + (unsigned int) pIhw->AppData.dsGood_count[0] +
2146 + (unsigned int) pIhw->AppData.dsGood_count[1],
2147 + (unsigned int) pIhw->AppData.dsIdle_count[0] +
2148 + (unsigned int) pIhw->AppData.dsIdle_count[1],
2149 + (unsigned int) pIhw->AppData.dsBadHec_count[0] +
2150 + (unsigned int) pIhw->AppData.dsBadHec_count[1]);
2151 + seq_printf(m, "\tOverflow Dropped Cell Cnt:\t%u\n",
2152 + (unsigned int) pIhw->AppData.dsOVFDrop_count[0] +
2153 + (unsigned int) pIhw->AppData.dsOVFDrop_count[1]);
2155 //UR8_MERGE_START CQ10700 Manjula K
2158 - sprintf (buf + len,
2159 - "\tRx Packets Dropped Count:\t%lu\n\tRx Bad Packets Count:\t%lu\n\n",
2160 - priv->stats.rx_dropped, priv->stats.rx_errors);
2162 + "\tRx Packets Dropped Count:\t%lu\n\tRx Bad Packets Count:\t%lu\n\n",
2163 + priv->stats.rx_dropped, priv->stats.rx_errors);
2164 //UR8_MERGE_END CQ10700
2166 tn7sar_get_stats(pIhw->pOsContext);
2168 - len += sprintf(buf+len, "\n[SAR AAL5 Stats]\n");
2170 - len += sprintf(buf+len, "\tTx PDU's:\t%u\n\tRx PDU's:\t%u\n",
2171 - sarStat.txPktCnt, sarStat.rxPktCnt);
2174 - sprintf (buf + len, "\tTx Total Bytes:\t%u\n\tRx Total Bytes:\t%u\n",
2175 - sarStat.txBytes, sarStat.rxBytes);
2178 - sprintf (buf + len,
2179 - "\tTx Total Error Counts:\t%u\n\tRx Total Error Counts:\t%u\n\n",
2180 - sarStat.txErrors, sarStat.rxErrors);
2181 + seq_printf(m, "\n[SAR AAL5 Stats]\n");
2182 + seq_printf(m, "\tTx PDU's:\t%u\n\tRx PDU's:\t%u\n",
2183 + sarStat.txPktCnt, sarStat.rxPktCnt);
2184 + seq_printf (m, "\tTx Total Bytes:\t%u\n\tRx Total Bytes:\t%u\n",
2185 + sarStat.txBytes, sarStat.rxBytes);
2187 + "\tTx Total Error Counts:\t%u\n\tRx Total Error Counts:\t%u\n\n",
2188 + sarStat.txErrors, sarStat.rxErrors);
2194 - len += sprintf(buf+len, "\n[OAM Stats]\n");
2195 + seq_printf(m, "\n[OAM Stats]\n");
2197 tn7sar_get_near_end_loopback_count(&F4count, &F5count);
2202 - sprintf (buf + len,
2203 - "\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",
2205 + "\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",
2206 F5count, F4count, oamFarLBCount[0] + oamFarLBCount[2],
2207 oamFarLBCount[1] + oamFarLBCount[3]);
2210 #define USE_OAM_DROP_COUNT //CQ10273
2211 //Read OAM ping responses count:
2212 #ifdef USE_OAM_DROP_COUNT
2216 - sprintf (buf + len,
2217 - "\tSAR OAM Retry in 0x%X cycles, Drop Count=%d\n",
2218 - tn7dsl_get_memory(0xa30085cc), tn7dsl_get_memory(0xa30085c4)); */
2220 + "\tSAR OAM Retry in 0x%X cycles, Drop Count=%d\n",
2221 + tn7dsl_get_memory(0xa30085cc), tn7dsl_get_memory(0xa30085c4)); */
2223 - len += sprintf (buf + len, "\tSAR OAM Ping Response Drop Count=%d\n",
2224 - tn7dsl_get_memory(0xa30085b0));
2226 + seq_printf (m, "\tSAR OAM Ping Response Drop Count=%d\n",
2227 + tn7dsl_get_memory(0xa30085b0));
2228 #endif // USE_OAM_DROP_COUNT
2234 -int tn7dsl_proc_modem(char* buf, char **start, off_t offset, int count,
2235 - int *eof, void *data)
2236 +static int tn7dsl_proc_stats_open(struct inode *inode, struct file *file)
2238 + return single_open(file, tn7dsl_proc_stats, PDE_DATA(inode));
2241 +int tn7dsl_proc_write_stats(struct file *fp, const char * buf, unsigned long count, void * data);
2243 +struct file_operations tn7dsl_proc_stats_fops = {
2244 + .owner = THIS_MODULE,
2245 + .open = tn7dsl_proc_stats_open,
2247 + .llseek = seq_lseek,
2248 + .release = single_release,
2249 + .write = tn7dsl_proc_write_stats,
2252 +static int tn7dsl_proc_modem(struct seq_file *m, void *data)
2255 extern int tn7efm_get_currTCmode(void);
2258 - int limit = count - 80;
2262 @@ -1923,22 +1836,31 @@ extern int tn7efm_get_currTCmode(void);
2264 if(pIhw->lConnected == 1)
2267 - len += sprintf(buf+len,"%s\n",state);
2269 - len += sprintf(buf+len, "%d\n", dslReg);
2271 - len += sprintf(buf+len, "failTrains=%d\n", pIhw->AppData.trainFails);
2272 + seq_printf(m,"%s\n",state);
2273 + seq_printf(m, "%d\n", dslReg);
2274 + seq_printf(m, "failTrains=%d\n", pIhw->AppData.trainFails);
2278 - len += sprintf(buf+len, "TCMODE=%s\n",
2279 - tn7efm_get_currTCmode()== TC_MODE_PTM ? "EFM" : "ATM");
2280 + seq_printf(m, "TCMODE=%s\n",
2281 + tn7efm_get_currTCmode()== TC_MODE_PTM ? "EFM" : "ATM");
2288 +static int tn7dsl_proc_modem_open(struct inode *inode, struct file *file)
2290 + return single_open(file, tn7dsl_proc_modem, PDE_DATA(inode));
2293 +struct file_operations tn7dsl_proc_modem_fops = {
2294 + .owner = THIS_MODULE,
2295 + .open = tn7dsl_proc_modem_open,
2297 + .llseek = seq_lseek,
2298 + .release = single_release,
2301 /**********************************************************************
2303 ** tn7dsl_hdlc_update_crc() -- Calculate CRC *
2304 @@ -2203,11 +2125,8 @@ static int tn7dsl_hdlc_rx_process(unsign
2308 -int tn7dsl_proc_eoc (char *buf, char **start, off_t OffSet, int count,
2309 - int *eof, void *data)
2310 +static int tn7dsl_proc_eoc (struct seq_file *m, void *data)
2313 - int limit = count - 80;
2314 int offset[2] = {34, 0}; // point to buffer parameter data structure
2315 clearEocParm_t peoc;
2317 @@ -2216,62 +2135,49 @@ int tn7dsl_proc_eoc (char *buf, char **s
2318 (unsigned char *) &peoc,
2319 sizeof (clearEocParm_t));
2322 - len += sprintf(buf+len, "\nClear EOC Channel:\n\n");
2324 - len += sprintf(buf+len, " Enabled:\t%d\n", dslhal_support_byteSwap32(peoc.clearEocEnabled));
2326 - len += sprintf(buf+len, " TxBuf[0]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[0]));
2328 - len += sprintf(buf+len, " TxBuf[1]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[1]));
2330 - len += sprintf(buf+len, " TxBuf[2]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[2]));
2332 - len += sprintf(buf+len, " TxBuf[3]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[3]));
2334 - len += sprintf(buf+len, " RxBuf[0]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[0]));
2336 - len += sprintf(buf+len, " RxBuf[1]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[1]));
2338 - len += sprintf(buf+len, " RxBuf[2]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[2]));
2340 - len += sprintf(buf+len, " RxBuf[3]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[3]));
2342 - len += sprintf(buf+len, " txRdIndex:\t%d\n", dslhal_support_byteSwap32(peoc.txRdIndex));
2344 - len += sprintf(buf+len, " txWrIndex:\t%d\n", dslhal_support_byteSwap32(peoc.txWrIndex));
2346 - len += sprintf(buf+len, " rxRdIndex:\t%d\n", dslhal_support_byteSwap32(peoc.rxRdIndex));
2348 - len += sprintf(buf+len, " rxWrIndex:\t%d\n\n", dslhal_support_byteSwap32(peoc.rxWrIndex));
2350 - len += sprintf(buf+len, " TotalTxPkts:\t%d\n", EocTxTotalPackets);
2352 - len += sprintf(buf+len, " TotalRxPkts:\t%d\n", EocRxTotalPackets);
2354 - len += sprintf(buf+len, " TotalTxBytes:\t%d\n", EocTxTotalBytes);
2356 - len += sprintf(buf+len, " TotalRxBytes:\t%d\n\n", EocRxTotalBytes);
2358 - len += sprintf(buf+len, " ErrBufFull:\t%d\n", ErrEocBufFull);
2360 - len += sprintf(buf+len, " ErrBufIndx:\t%d\n", ErrEocBufIndex);
2362 - len += sprintf(buf+len, " ErrBufMax:\t%d\n", ErrEocBufMax);
2364 - len += sprintf(buf+len, " ErrMsgMax:\t%d\n", ErrEocMsgOversized);
2366 - len += sprintf(buf+len, " ErrTxHDLC:\t%d\n", ErrEocTxHdlcCRC);
2368 - len += sprintf(buf+len, " ErrRxHDLC:\t%d\n", ErrEocRxHdlcCRC);
2370 - len += sprintf(buf+len, " ErrRxSnmp:\t%d\n", ErrEocRxHdlcFraming);
2372 - len += sprintf(buf+len, " ErrRxPush:\t%d\n\n", ErrEocRxPush);
2373 + seq_printf(m, "\nClear EOC Channel:\n\n");
2374 + seq_printf(m, " Enabled:\t%d\n", dslhal_support_byteSwap32(peoc.clearEocEnabled));
2375 + seq_printf(m, " TxBuf[0]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[0]));
2376 + seq_printf(m, " TxBuf[1]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[1]));
2377 + seq_printf(m, " TxBuf[2]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[2]));
2378 + seq_printf(m, " TxBuf[3]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[3]));
2379 + seq_printf(m, " RxBuf[0]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[0]));
2380 + seq_printf(m, " RxBuf[1]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[1]));
2381 + seq_printf(m, " RxBuf[2]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[2]));
2382 + seq_printf(m, " RxBuf[3]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[3]));
2383 + seq_printf(m, " txRdIndex:\t%d\n", dslhal_support_byteSwap32(peoc.txRdIndex));
2384 + seq_printf(m, " txWrIndex:\t%d\n", dslhal_support_byteSwap32(peoc.txWrIndex));
2385 + seq_printf(m, " rxRdIndex:\t%d\n", dslhal_support_byteSwap32(peoc.rxRdIndex));
2386 + seq_printf(m, " rxWrIndex:\t%d\n\n", dslhal_support_byteSwap32(peoc.rxWrIndex));
2387 + seq_printf(m, " TotalTxPkts:\t%d\n", EocTxTotalPackets);
2388 + seq_printf(m, " TotalRxPkts:\t%d\n", EocRxTotalPackets);
2389 + seq_printf(m, " TotalTxBytes:\t%d\n", EocTxTotalBytes);
2390 + seq_printf(m, " TotalRxBytes:\t%d\n\n", EocRxTotalBytes);
2391 + seq_printf(m, " ErrBufFull:\t%d\n", ErrEocBufFull);
2392 + seq_printf(m, " ErrBufIndx:\t%d\n", ErrEocBufIndex);
2393 + seq_printf(m, " ErrBufMax:\t%d\n", ErrEocBufMax);
2394 + seq_printf(m, " ErrMsgMax:\t%d\n", ErrEocMsgOversized);
2395 + seq_printf(m, " ErrTxHDLC:\t%d\n", ErrEocTxHdlcCRC);
2396 + seq_printf(m, " ErrRxHDLC:\t%d\n", ErrEocRxHdlcCRC);
2397 + seq_printf(m, " ErrRxSnmp:\t%d\n", ErrEocRxHdlcFraming);
2398 + seq_printf(m, " ErrRxPush:\t%d\n\n", ErrEocRxPush);
2404 +static int tn7dsl_proc_eoc_open(struct inode *inode, struct file *file)
2406 + return single_open(file, tn7dsl_proc_eoc, PDE_DATA(inode));
2409 +struct file_operations tn7dsl_proc_eoc_fops = {
2410 + .owner = THIS_MODULE,
2411 + .open = tn7dsl_proc_eoc_open,
2413 + .llseek = seq_lseek,
2414 + .release = single_release,
2417 int tn7dsl_clear_eoc_setup(void)
2420 @@ -4624,14 +4530,10 @@ int tn7dsl_proc_write_stats (struct file
2424 -int tn7dsl_proc_train_mode_export (char *buf, char **start, off_t offset,
2425 - int count, int *eof, void *data)
2426 +static int tn7dsl_proc_train_mode_export (struct seq_file *m, void *data)
2430 - char *cp = buf + offset;
2432 - static int ctr = 0;
2436 @@ -4712,197 +4614,185 @@ int tn7dsl_proc_train_mode_export (char
2441 + for (i = 0; (i < num_entries) ; i++)
2443 - for (i = ctr; ((i < num_entries)&& (len <= count)) ; i++)
2446 - * Write the current string only if we can fit it into the buffer
2448 - if((strlen(dsl_modes[i].mode_name) + 6 + len) <= count)
2450 - len += snprintf(cp+len, (count - len), "%s\t\t\t%#x\n",
2451 - dsl_modes[i].mode_name, dsl_modes[i].mode_value);
2456 + seq_printf(m, "%s\t\t\t%#x\n",
2457 + dsl_modes[i].mode_name, dsl_modes[i].mode_value);
2461 - * Data was completely written
2463 - if (i >= num_entries)
2466 - * We are done with this
2474 - * We have not been able to write the complete data, and we have to nul
2475 - * terminate the buffer.
2477 - *(cp + len) = '\0';
2480 - * Save the value of the counter for the next read for the rest of the
2490 -#ifndef NO_ADV_STATS
2491 -int tn7dsl_proc_SNRpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data)
2492 +static int tn7dsl_proc_train_mode_export_open(struct inode *inode, struct file *file)
2496 + return single_open(file, tn7dsl_proc_train_mode_export, PDE_DATA(inode));
2499 +struct file_operations tn7dsl_proc_train_mode_export_fops = {
2500 + .owner = THIS_MODULE,
2501 + .open = tn7dsl_proc_train_mode_export_open,
2503 + .llseek = seq_lseek,
2504 + .release = single_release,
2507 - int limit = count - 80;
2508 +#ifndef NO_ADV_STATS
2509 +int tn7dsl_proc_SNRpsds(struct seq_file *m, void *data)
2512 unsigned char SNRpsds[512];
2515 - len += sprintf(buf+len, "\nAR7 SNRpsds:");
2516 + seq_printf(m, "\nAR7 SNRpsds:");
2518 if (dslhal_api_getSNRpsds(pIhw, SNRpsds, 1))
2520 dgprintf(4, "dslhal_api_getSNRpsds failed!\n");
2525 for (i=0; i<pIhw->AppData.max_ds_tones; i++)
2530 - len += sprintf(buf+len, "\n");
2531 + seq_printf(m, "\n");
2535 - len += sprintf(buf+len, "%d ", (unsigned char)SNRpsds[i]);
2536 + seq_printf(m, "%d ", (unsigned char)SNRpsds[i]);
2540 - len += sprintf(buf+len, "\n");
2541 + seq_printf(m, "\n");
2549 +static int tn7dsl_proc_SNRpsds_open(struct inode *inode, struct file *file)
2551 + return single_open(file, tn7dsl_proc_SNRpsds, PDE_DATA(inode));
2554 +struct file_operations tn7dsl_proc_SNRpsds_fops = {
2555 + .owner = THIS_MODULE,
2556 + .open = tn7dsl_proc_SNRpsds_open,
2558 + .llseek = seq_lseek,
2559 + .release = single_release,
2564 #ifndef NO_ADV_STATS
2565 -int tn7dsl_proc_QLNpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data)
2566 +static int tn7dsl_proc_QLNpsds(struct seq_file *m, void *data)
2570 - int limit = count - 80;
2571 unsigned char QLNpsds[512];
2575 - len += sprintf(buf+len, "\nAR7 QLNpsds:");
2576 + seq_printf(m, "\nAR7 QLNpsds:");
2578 // call API instead of access internal buf directly
2579 if (dslhal_api_getQLNpsds(pIhw, QLNpsds, 0))
2581 dgprintf(4, "dslhal_api_getQLNpsds failed!\n");
2586 for (i=0; i<pIhw->AppData.max_ds_tones; i++)
2591 - len += sprintf(buf+len, "\n");
2592 + seq_printf(m, "\n");
2596 - len += sprintf(buf+len, "%d ", (unsigned char)QLNpsds[i]);
2597 + seq_printf(m, "%d ", (unsigned char)QLNpsds[i]);
2601 - len += sprintf(buf+len, "\n");
2602 + seq_printf(m, "\n");
2609 +static int tn7dsl_proc_QLNpsds_open(struct inode *inode, struct file *file)
2611 + return single_open(file, tn7dsl_proc_QLNpsds, PDE_DATA(inode));
2614 +struct file_operations tn7dsl_proc_QLNpsds_fops = {
2615 + .owner = THIS_MODULE,
2616 + .open = tn7dsl_proc_QLNpsds_open,
2618 + .llseek = seq_lseek,
2619 + .release = single_release,
2624 // UR8_MERGE_START CQ10979 Jack Zhang
2626 #ifndef NO_ADV_STATS
2627 -int tn7dsl_proc_HLINpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data)
2628 +static int tn7dsl_proc_HLINpsds(struct seq_file *m, void *data)
2632 - int limit = count - 80;
2633 short HLINpsds[2*512];
2637 - len += sprintf(buf+len, "\nAR7 HLINpsds:");
2638 + seq_printf(m, "\nAR7 HLINpsds:");
2640 // call API instead of access internal buf directly
2641 if (dslhal_api_getHLINpsds(pIhw, (unsigned char *)HLINpsds, 1))
2643 dgprintf(4, "dslhal_api_getHLINpsds failed!\n");
2648 for (i=0; i<pIhw->AppData.max_ds_tones; i++)
2653 - len += sprintf(buf+len, "\n");
2654 + seq_printf(m, "\n");
2658 - len += sprintf(buf+len, "(%d,%d) ", HLINpsds[2*i], HLINpsds[2*i+1]);
2659 + seq_printf(m, "(%d,%d) ", HLINpsds[2*i], HLINpsds[2*i+1]);
2663 - len += sprintf(buf+len, "\n");
2664 + seq_printf(m, "\n");
2671 -static int tn7dsl_proc_HLINpsdsIndx(char* buf, char **start, off_t offset, int count,int *eof, void *data, int indx)
2672 +static int tn7dsl_proc_HLINpsds_open(struct inode *inode, struct file *file)
2675 + return single_open(file, tn7dsl_proc_HLINpsds, PDE_DATA(inode));
2678 - int limit = count - 80;
2679 +struct file_operations tn7dsl_proc_HLINpsds_fops = {
2680 + .owner = THIS_MODULE,
2681 + .open = tn7dsl_proc_HLINpsds_open,
2683 + .llseek = seq_lseek,
2684 + .release = single_release,
2687 +static int tn7dsl_proc_HLINpsdsIndx(struct seq_file *m, void *data, int indx)
2689 short HLINpsds[2*512];
2691 int start=0, dim=128;
2694 - len += sprintf(buf+len, "\nAR7 HLINpsds: (section %d)", indx);
2695 + seq_printf(m, "\nAR7 HLINpsds: (section %d)", indx);
2697 if((indx > 2) && (pIhw->AppData.max_ds_tones <= 256))
2700 - len += sprintf(buf+len, "\n[End of data]");
2702 + seq_printf(m, "\n[End of data]");
2706 // call API instead of access internal buf directly
2707 if (dslhal_api_getHLINpsds(pIhw, (unsigned char *)HLINpsds, 1))
2709 dgprintf(4, "dslhal_api_getHLINpsds failed!\n");
2714 start = (indx -1) * 128;
2715 @@ -4911,39 +4801,89 @@ static int tn7dsl_proc_HLINpsdsIndx(char
2720 - len += sprintf(buf+len, "\n%d: ", i);
2721 + seq_printf(m, "\n%d: ", i);
2725 - len += sprintf(buf+len, "(%d,%d) ", HLINpsds[2*i], HLINpsds[2*i+1]);
2726 + seq_printf(m, "(%d,%d) ", HLINpsds[2*i], HLINpsds[2*i+1]);
2730 - len += sprintf(buf+len, "\n");
2731 + seq_printf(m, "\n");
2737 +static int tn7dsl_proc_HLINpsds1(struct seq_file *m, void *data)
2739 + return tn7dsl_proc_HLINpsdsIndx(m, data, 1);
2742 +static int tn7dsl_proc_HLINpsds2(struct seq_file *m, void *data)
2744 + return tn7dsl_proc_HLINpsdsIndx(m, data, 2);
2747 +static int tn7dsl_proc_HLINpsds3(struct seq_file *m, void *data)
2749 + return tn7dsl_proc_HLINpsdsIndx(m, data, 3);
2752 +static int tn7dsl_proc_HLINpsds4(struct seq_file *m, void *data)
2754 + return tn7dsl_proc_HLINpsdsIndx(m, data, 4);
2757 -int tn7dsl_proc_HLINpsds1(char* buf, char **start, off_t offset, int count,int *eof, void *data)
2758 +static int tn7dsl_proc_HLINpsds1_open(struct inode *inode, struct file *file)
2760 - return tn7dsl_proc_HLINpsdsIndx(buf, start, offset, count,eof, data, 1);
2761 + return single_open(file, tn7dsl_proc_HLINpsds1, PDE_DATA(inode));
2764 -int tn7dsl_proc_HLINpsds2(char* buf, char **start, off_t offset, int count,int *eof, void *data)
2765 +static int tn7dsl_proc_HLINpsds2_open(struct inode *inode, struct file *file)
2767 - return tn7dsl_proc_HLINpsdsIndx(buf, start, offset, count,eof, data, 2);
2768 + return single_open(file, tn7dsl_proc_HLINpsds2, PDE_DATA(inode));
2771 -int tn7dsl_proc_HLINpsds3(char* buf, char **start, off_t offset, int count,int *eof, void *data)
2772 +static int tn7dsl_proc_HLINpsds3_open(struct inode *inode, struct file *file)
2774 - return tn7dsl_proc_HLINpsdsIndx(buf, start, offset, count,eof, data, 3);
2775 + return single_open(file, tn7dsl_proc_HLINpsds3, PDE_DATA(inode));
2778 -int tn7dsl_proc_HLINpsds4(char* buf, char **start, off_t offset, int count,int *eof, void *data)
2779 +static int tn7dsl_proc_HLINpsds4_open(struct inode *inode, struct file *file)
2781 - return tn7dsl_proc_HLINpsdsIndx(buf, start, offset, count,eof, data, 4);
2782 + return single_open(file, tn7dsl_proc_HLINpsds4, PDE_DATA(inode));
2785 +struct file_operations tn7dsl_proc_HLINpsds1_fops = {
2786 + .owner = THIS_MODULE,
2787 + .open = tn7dsl_proc_HLINpsds1_open,
2789 + .llseek = seq_lseek,
2790 + .release = single_release,
2793 +struct file_operations tn7dsl_proc_HLINpsds2_fops = {
2794 + .owner = THIS_MODULE,
2795 + .open = tn7dsl_proc_HLINpsds2_open,
2797 + .llseek = seq_lseek,
2798 + .release = single_release,
2801 +struct file_operations tn7dsl_proc_HLINpsds3_fops = {
2802 + .owner = THIS_MODULE,
2803 + .open = tn7dsl_proc_HLINpsds3_open,
2805 + .llseek = seq_lseek,
2806 + .release = single_release,
2809 +struct file_operations tn7dsl_proc_HLINpsds4_fops = {
2810 + .owner = THIS_MODULE,
2811 + .open = tn7dsl_proc_HLINpsds4_open,
2813 + .llseek = seq_lseek,
2814 + .release = single_release,
2818 #endif //TR69_HLIN_IN
2819 // UR8_MERGE_END CQ10979*
2820 @@ -4951,64 +4891,48 @@ int tn7dsl_proc_HLINpsds4(char* buf, cha
2821 // * UR8_MERGE_START CQ11057 Jack Zhang
2823 #ifndef NO_ADV_STATS
2824 -int tn7dsl_proc_PMDus(char* buf, char **start, off_t offset, int count,int *eof, void *data)
2825 +static int tn7dsl_proc_PMDus(struct seq_file *m, void *data)
2829 - int limit = count - 80;
2831 CoPMDTestParams_t co_pmdtest_params;
2834 - len += sprintf(buf+len, "\nAR7 US PMD Test:\n");
2835 + seq_printf(m, "\nAR7 US PMD Test:\n");
2837 // call API instead of access internal buf directly
2838 if (dslhal_api_getPMDTestus(pIhw, &co_pmdtest_params, 0) != DSLHAL_ERROR_NO_ERRORS)
2840 dgprintf(4, "dslhal_api_getPMDTestus failed!\n");
2846 - len += sprintf(buf+len, "LATN=%d\n", co_pmdtest_params.co_latn);
2847 + seq_printf(m, "LATN=%d\n", co_pmdtest_params.co_latn);
2850 - len += sprintf(buf+len, "SATN=%d\n", co_pmdtest_params.co_satn);
2851 + seq_printf(m, "SATN=%d\n", co_pmdtest_params.co_satn);
2854 - len += sprintf(buf+len, "SNRM=%d\n", co_pmdtest_params.usMargin);
2855 + seq_printf(m, "SNRM=%d\n", co_pmdtest_params.usMargin);
2858 - len += sprintf(buf+len, "attndr=%ld\n", co_pmdtest_params.co_attndr);
2859 + seq_printf(m, "attndr=%ld\n", co_pmdtest_params.co_attndr);
2862 - len += sprintf(buf+len, "NearActatp=%d\n", co_pmdtest_params.co_near_actatp);
2863 + seq_printf(m, "NearActatp=%d\n", co_pmdtest_params.co_near_actatp);
2866 - len += sprintf(buf+len, "FarActatp=%d\n", co_pmdtest_params.co_far_actatp);
2867 + seq_printf(m, "FarActatp=%d\n", co_pmdtest_params.co_far_actatp);
2870 for (i=0; i<pIhw->AppData.max_us_tones; i++)
2875 - len += sprintf(buf+len, "\nHLOG(%3d):", i);
2878 - len += sprintf(buf+len, " %d", co_pmdtest_params.TestParmCOHlogfMsg[i]);
2879 + seq_printf(m, "\nHLOG(%3d):", i);
2881 + seq_printf(m, " %d", co_pmdtest_params.TestParmCOHlogfMsg[i]);
2885 for (i=0; i<pIhw->AppData.max_us_tones; i++)
2890 - len += sprintf(buf+len, "\nQLN(%3d):", i);
2893 - len += sprintf(buf+len, " %d", co_pmdtest_params.TestParmCOQLNfMsg[i]);
2894 + seq_printf(m, "\nQLN(%3d):", i);
2896 + seq_printf(m, " %d", co_pmdtest_params.TestParmCOQLNfMsg[i]);
2900 @@ -5016,19 +4940,28 @@ int tn7dsl_proc_PMDus(char* buf, char **
2901 for (i=0; i<pIhw->AppData.max_us_tones; i++)
2906 - len += sprintf(buf+len, "\nSNR(%3d):", i);
2909 - len += sprintf(buf+len, " %d", co_pmdtest_params.TestParmCOSNRfMsg[i]);
2910 + seq_printf(m, "\nSNR(%3d):", i);
2911 + seq_printf(m, " %d", co_pmdtest_params.TestParmCOSNRfMsg[i]);
2915 - len += sprintf(buf+len, "\n");
2916 + seq_printf(m, "\n");
2922 +static int tn7dsl_proc_PMDus_open(struct inode *inode, struct file *file)
2924 + return single_open(file, tn7dsl_proc_PMDus, PDE_DATA(inode));
2927 +struct file_operations tn7dsl_proc_PMDus_fops = {
2928 + .owner = THIS_MODULE,
2929 + .open = tn7dsl_proc_PMDus_open,
2931 + .llseek = seq_lseek,
2932 + .release = single_release,
2935 #endif //NO_ADV_STATS
2936 #endif //TR69_PMD_IN
2937 // * UR8_MERGE_END CQ11057 *
2940 @@ -1553,44 +1553,70 @@ int tn7sar_oam_generation(void *privCont
2944 -int tn7sar_proc_oam_ping(char* buf, char **start, off_t offset, int count,int *eof, void *data)
2945 +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
2946 +#define PDE_DATA(inode) PDE(inode)->data
2949 +static int tn7sar_proc_oam_ping(struct seq_file *m, void *data)
2952 unsigned int oam_ps = oamPingStatus;
2954 if( oam_ps == OAM_PING_PENDING_RECVD )
2955 oam_ps = OAM_PING_PENDING; //jz CQ9861: Only export the PENDING status, not internal state
2957 - len += sprintf(buf+len, "%d\n", oam_ps); //oamPingStatus);
2958 + seq_printf(m, "%d\n", oam_ps); //oamPingStatus);
2964 -int tn7sar_proc_pvc_table(char* buf, char **start, off_t offset, int count,int *eof, void *data)
2965 +static int tn7sar_proc_oam_ping_open(struct inode *inode, struct file *file)
2967 + return single_open(file, tn7sar_proc_oam_ping, PDE_DATA(inode));
2970 +struct file_operations tn7sar_proc_oam_ping_fops = {
2971 + .owner = THIS_MODULE,
2972 + .open = tn7sar_proc_oam_ping_open,
2974 + .llseek = seq_lseek,
2975 + .release = single_release,
2979 +static int tn7sar_proc_pvc_table(struct seq_file *m, void *data)
2986 if(pvc_result[i].bInUse)
2988 - len += sprintf(buf+len, "%d,%d\n", pvc_result[i].vpi,pvc_result[i].vci);
2989 + seq_printf(m, "%d,%d\n", pvc_result[i].vpi,pvc_result[i].vci);
2993 - len += sprintf(buf+len, "0,0\n");
2994 + seq_printf(m, "0,0\n");
3001 +static int tn7sar_proc_pvc_table_open(struct inode *inode, struct file *file)
3003 + return single_open(file, tn7sar_proc_pvc_table, PDE_DATA(inode));
3006 +struct file_operations tn7sar_proc_pvc_table_fops = {
3007 + .owner = THIS_MODULE,
3008 + .open = tn7sar_proc_pvc_table_open,
3010 + .llseek = seq_lseek,
3011 + .release = single_release,
3015 -int tn7sar_proc_sar_stat(char* buf, char **start, off_t offset, int count,int *eof, void *data)
3016 +static int tn7sar_proc_sar_stat(struct seq_file *m, void *data)
3019 - int limit = count - 80;
3020 struct atm_dev *dev;
3021 Tn7AtmPrivate *priv;
3023 @@ -1599,21 +1625,19 @@ int tn7sar_proc_sar_stat(char* buf, char
3024 unsigned int *pStateBase, *pSarStat;
3025 HAL_FUNCTIONS *pHalFunc;
3026 HAL_DEVICE *pHalDev;
3029 - dev = (struct atm_dev *)data;
3030 + dev = (struct atm_dev *)m->private;
3031 priv = (Tn7AtmPrivate *)dev->dev_data;
3033 pHalFunc = (HAL_FUNCTIONS *)priv->pSarHalFunc;
3034 pHalDev = (HAL_DEVICE *)priv->pSarHalDev;
3036 - len += sprintf(buf+len, "SAR HAL Statistics");
3037 + seq_printf(m, "SAR HAL Statistics");
3038 for(i=0;i<MAX_DMA_CHAN;i++)
3040 if(priv->lut[i].inuse)
3043 - len += sprintf(buf+len, "\nChannel %d:\n",priv->lut[i].chanid);
3044 + seq_printf(m, "\nChannel %d:\n",priv->lut[i].chanid);
3048 @@ -1626,26 +1650,16 @@ int tn7sar_proc_sar_stat(char* buf, char
3050 if((char *)*pSarStat == NULL)
3054 - dBytes = sprintf(buf+len, "%s: ",(char *) *pSarStat);
3059 + k += seq_printf(m, "%s: ",(char *) *pSarStat);
3063 - dBytes = sprintf(buf+len, "%s; \n",(char *) *pSarStat);
3067 + k += seq_printf(m, "%s; \n",(char *) *pSarStat);
3074 - len += sprintf(buf+len, "\n");
3075 + seq_printf(m, "\n");
3079 @@ -1654,9 +1668,22 @@ int tn7sar_proc_sar_stat(char* buf, char
3087 +static int tn7sar_proc_sar_stat_open(struct inode *inode, struct file *file)
3089 + return single_open(file, tn7sar_proc_sar_stat, PDE_DATA(inode));
3092 +struct file_operations tn7sar_proc_sar_stat_fops = {
3093 + .owner = THIS_MODULE,
3094 + .open = tn7sar_proc_sar_stat_open,
3096 + .llseek = seq_lseek,
3097 + .release = single_release,
3101 void tn7sar_get_EFM_firmware_version(unsigned int *pdsp_version_ms, unsigned int *pdsp_version_ls)