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