aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel
diff options
context:
space:
mode:
authorJonas Gorski <jogo@openwrt.org>2013-10-12 10:50:19 +0000
committerJonas Gorski <jogo@openwrt.org>2013-10-12 10:50:19 +0000
commit8a240be62b35193c945cf94e448ac24f215b2f31 (patch)
treee6391c325ffdad4172b3c41e957b6db8d1cbb765 /package/kernel
parent78f69b66d44f8e9e9459ca3650d233b45252fd4e (diff)
downloadupstream-8a240be62b35193c945cf94e448ac24f215b2f31.tar.gz
upstream-8a240be62b35193c945cf94e448ac24f215b2f31.tar.bz2
upstream-8a240be62b35193c945cf94e448ac24f215b2f31.zip
ar7-atm: fix compilation for linux 3.10
Update proc code to new proc_create to allow compilation with linux 3.10+. Signed-off-by: Jonas Gorski <jogo@openwrt.org> SVN-Revision: 38366
Diffstat (limited to 'package/kernel')
-rw-r--r--package/kernel/ar7-atm/patches-D7.04.03.00/160-module-params.patch18
-rw-r--r--package/kernel/ar7-atm/patches-D7.04.03.00/200-2.6.37_args.patch2
-rw-r--r--package/kernel/ar7-atm/patches-D7.04.03.00/220-3.10-update_proc_code.patch2965
-rw-r--r--package/kernel/ar7-atm/patches-D7.05.01.00/160-module-params.patch14
-rw-r--r--package/kernel/ar7-atm/patches-D7.05.01.00/200-2.6.37_args.patch2
-rw-r--r--package/kernel/ar7-atm/patches-D7.05.01.00/220-3.10-update_proc_code.patch3102
6 files changed, 6085 insertions, 18 deletions
diff --git a/package/kernel/ar7-atm/patches-D7.04.03.00/160-module-params.patch b/package/kernel/ar7-atm/patches-D7.04.03.00/160-module-params.patch
index 67802ae1e9..c3d07a9def 100644
--- a/package/kernel/ar7-atm/patches-D7.04.03.00/160-module-params.patch
+++ b/package/kernel/ar7-atm/patches-D7.04.03.00/160-module-params.patch
@@ -147,7 +147,7 @@
#endif
#ifndef TRUE
-@@ -655,9 +795,9 @@
+@@ -655,9 +795,9 @@ static int __init tn7atm_irq_request (st
* interrupt pacing
*/
ptr = prom_getenv ("sar_ipacemax");
@@ -159,7 +159,7 @@
}
/* avalanche_request_pacing (priv->sar_irq, ATM_SAR_INT_PACING_BLOCK_NUM,
def_sar_inter_pace);*/
-@@ -795,9 +935,18 @@
+@@ -795,9 +935,18 @@ static int __init tn7atm_get_ESI (struct
{
int i;
char esi_addr[ESI_LEN] = { 0x00, 0x00, 0x11, 0x22, 0x33, 0x44 };
@@ -180,7 +180,7 @@
if (!esiaddr_str)
{
-@@ -1930,15 +2079,15 @@
+@@ -1930,15 +2079,15 @@ static int tn7atm_autoDetectDspBoost (vo
//UR8_MERGE_END CQ10450*
cp = prom_getenv ("dsp_noboost");
@@ -200,7 +200,7 @@
if (dspfreq == 250)
{
boostDsp = 1;
-@@ -2187,8 +2336,9 @@
+@@ -2187,8 +2336,9 @@ static int __init tn7atm_init (struct at
// Inter-Op DSL phy Control
// Note the setting of _dsl_Feature_0 and _dsl_Feature_1 must before
// dslhal_api_dslStartup (in tn7dsl_init()).
@@ -211,7 +211,7 @@
if ((ptr[0] == '0') && (ptr[1] == 'x')) // skip 0x before pass to
// os_atoh
ptr += 2;
-@@ -2196,8 +2346,9 @@
+@@ -2196,8 +2346,9 @@ static int __init tn7atm_init (struct at
_dsl_Feature_0_defined = 1;
}
@@ -222,7 +222,7 @@
if ((ptr[0] == '0') && (ptr[1] == 'x')) // skip 0x before pass to
// os_atoh
ptr += 2;
-@@ -2209,8 +2360,9 @@
+@@ -2209,8 +2360,9 @@ static int __init tn7atm_init (struct at
// DSL phy Feature Control
// Note the setting of _dsl_PhyControl_0 and _dsl_PhyControl_1 must before
// dslhal_api_dslStartup (in tn7dsl_init()).
@@ -233,7 +233,7 @@
if ((ptr[0] == '0') && (ptr[1] == 'x')) // skip 0x before pass to
// os_atoh
ptr += 2;
-@@ -2218,8 +2370,9 @@
+@@ -2218,8 +2370,9 @@ static int __init tn7atm_init (struct at
_dsl_PhyControl_0_defined = 1;
}
@@ -244,7 +244,7 @@
if ((ptr[0] == '0') && (ptr[1] == 'x')) // skip 0x before pass to
// os_atoh
ptr += 2;
-@@ -2247,9 +2400,9 @@
+@@ -2247,9 +2400,9 @@ static int __init tn7atm_init (struct at
priv->bTurboDsl = 1;
// read config for turbo dsl
ptr = prom_getenv ("TurboDSL");
@@ -256,7 +256,7 @@
}
// @Added to make Rx buffer number & Service max configurable through
-@@ -2257,30 +2410,30 @@
+@@ -2257,30 +2410,30 @@ static int __init tn7atm_init (struct at
priv->sarRxBuf = RX_BUFFER_NUM;
ptr = NULL;
ptr = prom_getenv ("SarRxBuf");
diff --git a/package/kernel/ar7-atm/patches-D7.04.03.00/200-2.6.37_args.patch b/package/kernel/ar7-atm/patches-D7.04.03.00/200-2.6.37_args.patch
index 59c1d58d15..e8668b6c5e 100644
--- a/package/kernel/ar7-atm/patches-D7.04.03.00/200-2.6.37_args.patch
+++ b/package/kernel/ar7-atm/patches-D7.04.03.00/200-2.6.37_args.patch
@@ -1,6 +1,6 @@
--- a/tn7atm.c
+++ b/tn7atm.c
-@@ -1867,7 +1867,11 @@ static int __init tn7atm_register (Tn7At
+@@ -1876,7 +1876,11 @@ static int __init tn7atm_register (Tn7At
dgprintf (4, "device %s being registered\n", priv->name);
diff --git a/package/kernel/ar7-atm/patches-D7.04.03.00/220-3.10-update_proc_code.patch b/package/kernel/ar7-atm/patches-D7.04.03.00/220-3.10-update_proc_code.patch
new file mode 100644
index 0000000000..be81ee1253
--- /dev/null
+++ b/package/kernel/ar7-atm/patches-D7.04.03.00/220-3.10-update_proc_code.patch
@@ -0,0 +1,2965 @@
+From 2826b9f6aa1ad2ac4c2846bbce10eb3378014555 Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jogo@openwrt.org>
+Date: Thu, 26 Sep 2013 12:28:35 +0200
+Subject: [PATCH 3/3] update proc code to fix compilation for 3.10
+
+Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+---
+ tn7api.h | 63 ++-
+ tn7atm.c | 330 ++++++--------
+ tn7dsl.c | 1447 ++++++++++++++++++++++++++++++--------------------------------
+ tn7sar.c | 91 ++--
+ 4 files changed, 922 insertions(+), 1009 deletions(-)
+
+--- a/tn7api.h
++++ b/tn7api.h
+@@ -86,27 +86,26 @@ void * tn7atm_memcpy(void * dst, void co
+ /* tn7dsl.h */
+ void tn7dsl_exit(void);
+ int tn7dsl_init(void *priv);
+-int tn7dsl_proc_eoc(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_stats(char* buf, char **start, off_t offset, int count,int *eof, void *data);
++extern struct file_operations tn7dsl_proc_eoc_fops;
++extern struct file_operations tn7dsl_proc_stats_fops;
+
+ //#define ADV_DIAG_STATS 1 //CQ10275 To enable Adv Stats
+
+ #ifdef ADV_DIAG_STATS
+-int tn7dsl_proc_adv_stats(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_adv_stats1(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_adv_stats2(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_adv_stats3(char* buf, char **start, off_t offset, int count,int *eof, void *data);
++extern struct file_operations tn7dsl_proc_adv_stats_fops;
++extern struct file_operations tn7dsl_proc_adv1_stats_fops;
++extern struct file_operations tn7dsl_proc_adv2_stats_fops;
++extern struct file_operations tn7dsl_proc_adv3_stats_fops;
+ //UR8_MERGE_START CQ10682 Jack Zhang
+-int tn7dsl_proc_dbg_cmsgs(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_dbg_rmsgs1(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_dbg_rmsgs2(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_dbg_rmsgs3(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_dbg_rmsgs4(char* buf, char **start, off_t offset, int count,int *eof, void *data);
++extern struct file_operations tn7dsl_proc_dbg_cmsgs_fops;
++extern struct file_operations tn7dsl_proc_dbg_cmsgs1_fops;
++extern struct file_operations tn7dsl_proc_dbg_cmsgs2_fops;
++extern struct file_operations tn7dsl_proc_dbg_cmsgs3_fops;
++extern struct file_operations tn7dsl_proc_dbg_cmsgs4_fops;
+ //UR8_MERGE_END CQ10682*
+ #endif //ADV_DIAG_STATS
+
+-int tn7dsl_proc_write_stats(struct file *fp, const char * buf, unsigned long count, void * data);
+-int tn7dsl_proc_modem(char* buf, char **start, off_t offset, int count,int *eof, void *data);
++extern struct file_operations tn7dsl_proc_modem_fops;
+ int tn7dsl_handle_interrupt(void);
+
+ void tn7dsl_dslmod_sysctl_register(void);
+@@ -127,31 +126,31 @@ unsigned int tn7dsl_get_memory(unsigned
+ int os_atoi(const char *pStr);
+ int os_atoh(const char *pStr);
+ unsigned long os_atoul(const char *pStr);
+-int tn7dsl_proc_snr0(char* buf, char **start, off_t offset, int count, int *eof, void *data);
+-int tn7dsl_proc_snr1(char* buf, char **start, off_t offset, int count, int *eof, void *data);
+-int tn7dsl_proc_snr2(char* buf, char **start, off_t offset, int count, int *eof, void *data);
+-int tn7dsl_proc_bit_allocation(char* buf, char **start, off_t offset, int count, int *eof, void *data);
+-int tn7dsl_proc_ds_noise(char* buf, char **start, off_t offset, int count, int *eof, void *data);
+-int tn7dsl_proc_generic_read_result(char* buf, char **start, off_t offset, int count, int *eof, void *data);
+-int tn7dsl_proc_train_mode_export(char* buf, char **start, off_t offset, int count,int *eof, void *data);
++extern struct file_operations tn7dsl_proc_snr0_fops;
++extern struct file_operations tn7dsl_proc_snr1_fops;
++extern struct file_operations tn7dsl_proc_snr2_fops;
++extern struct file_operations tn7dsl_proc_bit_allocation_fops;
++extern struct file_operations tn7dsl_proc_ds_noise_fops;
++extern struct file_operations tn7dsl_proc_generic_read_result_fops;
++extern struct file_operations tn7dsl_proc_train_mode_export_fops;
+
+ #ifndef NO_ADV_STATS
+-int tn7dsl_proc_SNRpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_QLNpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data);
++extern struct file_operations tn7dsl_proc_SNRpsds_fops;
++extern struct file_operations tn7dsl_proc_QLNpsds_fops;
+ // * UR8_MERGE_START CQ10979 Jack Zhang
+ #ifdef TR69_HLIN_IN
+-//int tn7dsl_proc_HLINpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_HLINpsds1(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_HLINpsds2(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_HLINpsds3(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_HLINpsds4(char* buf, char **start, off_t offset, int count,int *eof, void *data);
++//extern struct file_operations tn7dsl_proc_HLINpsds_fops;
++extern struct file_operations tn7dsl_proc_HLINpsds1_fops;
++extern struct file_operations tn7dsl_proc_HLINpsds2_fops;
++extern struct file_operations tn7dsl_proc_HLINpsds3_fops;
++extern struct file_operations tn7dsl_proc_HLINpsds4_fops;
+ #endif //TR69_HLIN_IN
+ // * UR8_MERGE_END CQ10979*
+ // * UR8_MERGE_START CQ11057 Jack Zhang
+ #define TR69_PMD_IN
+ #ifdef TR69_PMD_IN
+-//int tn7dsl_proc_PMDus(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_PMDus(char* buf, char **start, off_t offset, int count,int *eof, void *data);
++//extern struct file_operations tn7dsl_proc_PMDus_fops;
++extern struct file_operations tn7dsl_proc_PMDus_fops;
+ #endif //TR69_PMD_IN
+ // * UR8_MERGE_END CQ11057 *
+ #endif
+@@ -168,9 +167,9 @@ void tn7sar_get_sar_version(Tn7AtmPrivat
+ int tn7sar_get_near_end_loopback_count(unsigned int *pF4count, unsigned int *pF5count);
+ int tn7sar_oam_generation(void *privContext, int chan, int type, int vpi, int vci, int timeout);
+ int tn7sar_get_stats(void *priv1);
+-int tn7sar_proc_sar_stat(char* buf, char **start, off_t offset, int count,int *eof, void *data);
++extern struct file_operations tn7sar_proc_sar_stat_fops;
+ void tn7sar_get_sar_firmware_version(unsigned int *pdsp_version_ms, unsigned int *pdsp_version_ls);
+-int tn7sar_proc_oam_ping(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7sar_proc_pvc_table(char* buf, char **start, off_t offset, int count,int *eof, void *data);
++extern struct file_operations tn7sar_proc_oam_ping_fops;
++extern struct file_operations tn7sar_proc_pvc_table_fops;
+ int tn7sar_tx_flush(void *privContext, int chan, int queue, int skip);
+ #endif __SGAPI_H
+--- a/tn7atm.c
++++ b/tn7atm.c
+@@ -277,25 +277,15 @@ static int tn7atm_change_qos (struct atm
+ static int tn7atm_detect (void);
+ static int tn7atm_init (struct atm_dev *dev);
+ static int tn7atm_irq_request (struct atm_dev *dev);
+-static int tn7atm_proc_version (char *buf, char **start, off_t offset,
+- int count, int *eof, void *data);
++
++static struct file_operations tn7atm_proc_version_fops;
+ static void tn7atm_exit (void);
+-static int tn7atm_proc_channels (char *buf, char **start, off_t offset,
+- int count, int *eof, void *data);
+-static int tn7atm_proc_private (char *buf, char **start, off_t offset,
+- int count, int *eof, void *data);
++static struct file_operations tn7atm_proc_channels_fops;
++static struct file_operations tn7atm_proc_private_fops;
+ inline static int tn7atm_queue_packet_to_sar (void *vcc1, void *skb1,
+ int chan);
+
+-static int tn7atm_xlate_proc_name (const char *name,
+- struct proc_dir_entry **ret,
+- const char **residual);
+-static int tn7atm_proc_match (int len, const char *name,
+- struct proc_dir_entry *de);
+-static int tn7atm_proc_qos_read (char *buf, char **start, off_t offset,
+- int count, int *eof, void *data);
+-static int tn7atm_proc_qos_write (struct file *fp, const char *buf,
+- unsigned long count, void *data);
++static struct file_operations tn7atm_proc_qos_fops;
+
+ //CT - Added function to return chipset Id
+ void tn7atm_get_chipsetId (char *pVerId);
+@@ -415,63 +405,67 @@ const char drv_proc_root_folder[] = "ava
+ static struct proc_dir_entry *root_proc_dir_entry = NULL;
+ #define DRV_PROC_MODE 0644
+ static int proc_root_already_exists = TRUE;
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
++#define PDE_DATA(inode) PDE(inode)->data
++#endif
++
+ static struct
+ {
+ const unsigned char name[32];
+- int (*read_func) (char* , char **, off_t , int ,int *, void *);
+- int (*write_func) (struct file *, const char * , unsigned long , void *);
++ struct file_operations *fops;
+
+ } proc_if[] = {
+- {"avsar_ver", tn7atm_proc_version, NULL},
+- {"avsar_channels", tn7atm_proc_channels, NULL},
+- {"avsar_sarhal_stats", tn7sar_proc_sar_stat, NULL},
+- {"avsar_oam_ping", tn7sar_proc_oam_ping, NULL},
+- {"avsar_pvc_table", tn7sar_proc_pvc_table, NULL},
+- {"avsar_rxsnr0", tn7dsl_proc_snr0, NULL},
+- {"avsar_rxsnr1", tn7dsl_proc_snr1, NULL},
+- {"avsar_rxsnr2", tn7dsl_proc_snr2, NULL},
+- {"clear_eoc_stats", tn7dsl_proc_eoc, NULL},
+- {"avsar_bit_allocation_table", tn7dsl_proc_bit_allocation, NULL},
+- {"avsar_dsl_modulation_schemes",tn7dsl_proc_train_mode_export, NULL},
++ {"avsar_ver", &tn7atm_proc_version_fops},
++ {"avsar_channels", &tn7atm_proc_channels_fops},
++ {"avsar_sarhal_stats", &tn7sar_proc_sar_stat_fops},
++ {"avsar_oam_ping", &tn7sar_proc_oam_ping_fops},
++ {"avsar_pvc_table", &tn7sar_proc_pvc_table_fops},
++ {"avsar_rxsnr0", &tn7dsl_proc_snr0_fops},
++ {"avsar_rxsnr1", &tn7dsl_proc_snr1_fops},
++ {"avsar_rxsnr2", &tn7dsl_proc_snr2_fops},
++ {"clear_eoc_stats", &tn7dsl_proc_eoc_fops},
++ {"avsar_bit_allocation_table", &tn7dsl_proc_bit_allocation_fops},
++ {"avsar_dsl_modulation_schemes",&tn7dsl_proc_train_mode_export_fops},
+ #ifndef NO_ADV_STATS
+- {"avsar_SNRpsds", tn7dsl_proc_SNRpsds, NULL},
+- {"avsar_QLNpsds", tn7dsl_proc_QLNpsds, NULL},
++ {"avsar_SNRpsds", &tn7dsl_proc_SNRpsds_fops},
++ {"avsar_QLNpsds", &tn7dsl_proc_QLNpsds_fops},
+ // * UR8_MERGE_START CQ10979 Jack Zhang
+ #ifdef TR69_HLIN_IN
+-// {"avsar_HLINpsds", tn7dsl_proc_HLINpsds, NULL},
+- {"avsar_HLINpsds1", tn7dsl_proc_HLINpsds1, NULL},
+- {"avsar_HLINpsds2", tn7dsl_proc_HLINpsds2, NULL},
+- {"avsar_HLINpsds3", tn7dsl_proc_HLINpsds3, NULL},
+- {"avsar_HLINpsds4", tn7dsl_proc_HLINpsds4, NULL},
++// {"avsar_HLINpsds", &tn7dsl_proc_HLINpsds_fops},
++ {"avsar_HLINpsds1", &tn7dsl_proc_HLINpsds1_fops},
++ {"avsar_HLINpsds2", &tn7dsl_proc_HLINpsds2_fops},
++ {"avsar_HLINpsds3", &tn7dsl_proc_HLINpsds3_fops},
++ {"avsar_HLINpsds4", &tn7dsl_proc_HLINpsds4_fops},
+ #endif //TR69_HLIN_IN
+ // * UR8_MERGE_END CQ10979*
+ // * UR8_MERGE_START CQ11057 Jack Zhang
+ #define TR69_PMD_IN
+ #ifdef TR69_PMD_IN
+- {"avsar_PMDTestus", tn7dsl_proc_PMDus, NULL},
+-// {"avsar_PMDTestus1", tn7dsl_proc_PMDus1, NULL},
++ {"avsar_PMDTestus", &tn7dsl_proc_PMDus_fops},
++// {"avsar_PMDTestus1", &tn7dsl_proc_PMDus1_fops},
+ #endif //TR69_PMD_IN
+ // * UR8_MERGE_END CQ11057 *
+ #endif
+- {"avsar_private", tn7atm_proc_private, NULL},
+- {"avsar_modem_training", tn7dsl_proc_modem, NULL},
+- {"avsar_modem_stats", tn7dsl_proc_stats, tn7dsl_proc_write_stats},
++ {"avsar_private", &tn7atm_proc_private_fops},
++ {"avsar_modem_training", &tn7dsl_proc_modem_fops},
++ {"avsar_modem_stats", &tn7dsl_proc_stats_fops},
+
+ #ifdef ADV_DIAG_STATS //CQ10275
+-//for 2.6 {"avsar_modem_adv_stats", tn7dsl_proc_adv_stats, NULL},
++//for 2.6 {"avsar_modem_adv_stats", &tn7dsl_proc_adv_stats_fops},
+ //For 2.4 kernel, due to proc file system size limitation
+- {"avsar_modem_adv_stats1", tn7dsl_proc_adv_stats1, NULL},
+- {"avsar_modem_adv_stats2", tn7dsl_proc_adv_stats2, NULL},
+- {"avsar_modem_adv_stats3", tn7dsl_proc_adv_stats3, NULL},
++ {"avsar_modem_adv_stats1", &tn7dsl_proc_adv_stats1_fops},
++ {"avsar_modem_adv_stats2", &tn7dsl_proc_adv_stats2_fops},
++ {"avsar_modem_adv_stats3", &tn7dsl_proc_adv_stats3_fops},
+ //UR8_MERGE_START CQ10682 Jack Zhang
+- {"avsar_modem_dbg_cmsgs", tn7dsl_proc_dbg_cmsgs, NULL},
+- {"avsar_modem_dbg_rmsgs1", tn7dsl_proc_dbg_rmsgs1, NULL},
+- {"avsar_modem_dbg_rmsgs2", tn7dsl_proc_dbg_rmsgs2, NULL},
+- {"avsar_modem_dbg_rmsgs3", tn7dsl_proc_dbg_rmsgs3, NULL},
+- {"avsar_modem_dbg_rmsgs4", tn7dsl_proc_dbg_rmsgs4, NULL},
++ {"avsar_modem_dbg_cmsgs", &tn7dsl_proc_dbg_cmsgs_fops},
++ {"avsar_modem_dbg_rmsgs1", &tn7dsl_proc_dbg_rmsgs1_fops},
++ {"avsar_modem_dbg_rmsgs2", &tn7dsl_proc_dbg_rmsgs2_fops},
++ {"avsar_modem_dbg_rmsgs3", &tn7dsl_proc_dbg_rmsgs3_fops},
++ {"avsar_modem_dbg_rmsgs4", &tn7dsl_proc_dbg_rmsgs4_fops},
+ // UR8_MERGE_END CQ10682*
+ #endif //ADV_DIAG_STATS
+- {"avsar_qos_enable", tn7atm_proc_qos_read, tn7atm_proc_qos_write}
++ {"avsar_qos_enable", &tn7atm_proc_qos_fops}
+ };
+
+ /* *INDENT-ON* */
+@@ -1709,75 +1703,81 @@ int tn7atm_receive (void *os_dev, int ch
+ return 0;
+ }
+
+-static int tn7atm_proc_channels (char *buf, char **start, off_t offset,
+- int count, int *eof, void *data)
++static int tn7atm_proc_channels (struct seq_file *m, void *data)
+ {
+- int len = 0;
+- int limit = count - 80;
+ int i;
+
+ struct atm_dev *dev;
+ Tn7AtmPrivate *priv;
+
+- dev = (struct atm_dev *) data;
++ dev = (struct atm_dev *) m->private;
+ priv = (Tn7AtmPrivate *) dev->dev_data;
+
+- if (len <= limit)
+- len += sprintf (buf + len, "Chan Inuse ChanID VPI VCI \n");
+- if (len <= limit)
+- len +=
+- sprintf (buf + len,
++ seq_printf (m, "Chan Inuse ChanID VPI VCI \n");
++ seq_printf (m,
+ "------------------------------------------------------------------\n");
+
+ for (i = 0; i <= MAX_DMA_CHAN; i++)
+ {
+- if (len <= limit)
+- {
+- len += sprintf (buf + len,
+- " %02d %05d %05d %05d %05d \n",
+- i, priv->lut[i].inuse, priv->lut[i].chanid,
+- priv->lut[i].vpi, priv->lut[i].vci);
+- }
++ seq_printf (m,
++ " %02d %05d %05d %05d %05d \n",
++ i, priv->lut[i].inuse, priv->lut[i].chanid,
++ priv->lut[i].vpi, priv->lut[i].vci);
+ }
+
+- if (len <= limit)
+- len +=
+- sprintf (buf + len,
++ seq_printf (m,
+ "------------------------------------------------------------------\n");
+
+- return len;
++ return 0;
++}
++
++static int tn7atm_proc_channels_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7atm_proc_channels, PDE_DATA(inode));
+ }
+
+-static int tn7atm_proc_private (char *buf, char **start, off_t offset,
+- int count, int *eof, void *data)
++static struct file_operations tn7atm_proc_channels_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7atm_proc_channels_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++
++static int tn7atm_proc_private (struct seq_file *m, void *data)
+ {
+- int len = 0;
+- int limit = count - 80;
+ struct atm_dev *dev;
+ Tn7AtmPrivate *priv;
+
+- dev = (struct atm_dev *) data;
++ dev = (struct atm_dev *) m->private;
+ priv = (Tn7AtmPrivate *) dev->dev_data;
+
+- if (len <= limit)
+- len += sprintf (buf + len, "\nPrivate Data Structure(%s):\n", priv->name);
+- if (len <= limit)
+- len += sprintf (buf + len, "----------------------------------------\n");
+- if (len <= limit)
+- len += sprintf (buf + len, "priv: 0x%p\n", priv);
+- if (len <= limit)
+- len += sprintf (buf + len, "next: 0x%p", priv->next);
+- if (len <= limit)
+- len += sprintf (buf + len, "\tdev: 0x%p\n", priv->dev);
+-
+- if (len <= limit)
+- len += sprintf (buf + len, "tx_irq: %02d", priv->sar_irq);
+- if (len <= limit)
+- len += sprintf (buf + len, "rx_irq: %02d", priv->dsl_irq);
++ seq_printf (m, "\nPrivate Data Structure(%s):\n", priv->name);
++ seq_printf (m, "----------------------------------------\n");
++ seq_printf (m, "priv: 0x%p\n", priv);
++ seq_printf (m, "next: 0x%p", priv->next);
++ seq_printf (m, "\tdev: 0x%p\n", priv->dev);
++
++ seq_printf (m, "tx_irq: %02d", priv->sar_irq);
++ seq_printf (m, "rx_irq: %02d", priv->dsl_irq);
+
+- return len;
++ return 0;
++}
++
++static int tn7atm_proc_private_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7atm_proc_private, PDE_DATA(inode));
+ }
+
++static struct file_operations tn7atm_proc_private_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7atm_proc_private_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+ void tn7atm_sarhal_isr_register (void *os_dev, void *hal_isr,
+ int interrupt_num)
+ {
+@@ -1900,10 +1900,8 @@ static int __init tn7atm_register (Tn7At
+ return ATM_REG_OK;
+ }
+
+-static int tn7atm_proc_version (char *buf, char **start, off_t offset,
+- int count, int *eof, void *data)
++static int tn7atm_proc_version (struct seq_file *m, void *data)
+ {
+- int len = 0;
+ char dslVer[8];
+ char dspVer[10];
+ char chipsetID[32]; //CT CQ10076 - Added temporary buffer to store chipset Id
+@@ -1914,56 +1912,64 @@ static int tn7atm_proc_version (char *bu
+
+ priv = mydev->dev_data;
+
+- len +=
+- sprintf (buf + len, "ATM Driver version:[%d.%02d.%02d.%02d]\n",
+- LINUXATM_VERSION_MAJOR, LINUXATM_VERSION_MINOR,
+- LINUXATM_VERSION_BUGFIX, LINUXATM_VERSION_BUILDNUM);
++ seq_printf (m, "ATM Driver version:[%d.%02d.%02d.%02d]\n",
++ LINUXATM_VERSION_MAJOR, LINUXATM_VERSION_MINOR,
++ LINUXATM_VERSION_BUGFIX, LINUXATM_VERSION_BUILDNUM);
+
+ tn7dsl_get_dslhal_version (dslVer);
+
+- len +=
+- sprintf (buf + len, "DSL HAL version: [%d.%02d.%02d.%02d]\n", dslVer[0],
+- dslVer[1], dslVer[2], dslVer[3]);
++ seq_printf (m, "DSL HAL version: [%d.%02d.%02d.%02d]\n", dslVer[0],
++ dslVer[1], dslVer[2], dslVer[3]);
+ tn7dsl_get_dsp_version (dspVer);
+
+- len +=
+- sprintf (buf + len, "DSP Datapump version: [%d.%02d.%02d.%02d] ",
+- dspVer[4], dspVer[5], dspVer[6], dspVer[7]);
++ seq_printf (m, "DSP Datapump version: [%d.%02d.%02d.%02d] ",
++ dspVer[4], dspVer[5], dspVer[6], dspVer[7]);
+ if (dspVer[8] == 2) // annex B
+- len += sprintf (buf + len, "Annex B\n");
++ seq_printf (m, "Annex B\n");
+ else if (dspVer[8] == 3) // annex c
+- len += sprintf (buf + len, "Annex c\n");
++ seq_printf (m, "Annex c\n");
+ else
+- len += sprintf (buf + len, "Annex A\n");
++ seq_printf (m, "Annex A\n");
+
+ tn7sar_get_sar_version (priv, &pSarVer);
+
+- len += sprintf (buf + len, "SAR HAL version: [");
++ seq_printf (m, "SAR HAL version: [");
+ for (i = 0; i < 8; i++)
+ {
+- len += sprintf (buf + len, "%c", pSarVer[i + 7]);
++ seq_printf (m, "%c", pSarVer[i + 7]);
+ }
+- len += sprintf (buf + len, "]\n");
++ seq_printf (m, "]\n");
+
+ tn7sar_get_sar_firmware_version (&pdspV1, &pdspV2);
+- len += sprintf (buf + len, "PDSP Firmware version:[%01x.%02x]\n",
++ seq_printf (m, "PDSP Firmware version:[%01x.%02x]\n",
+ pdspV1, pdspV2);
+
+ //CT CQ10076 - Added code to report chipset ID using proc file system
+ tn7atm_get_chipsetId(chipsetID);
+- len += sprintf (buf + len, "Chipset ID: [%s]\n",chipsetID);
++ seq_printf (m, "Chipset ID: [%s]\n",chipsetID);
+
+- return len;
++ return 0;
+ }
+
++static int tn7atm_proc_version_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7atm_proc_version, PDE_DATA(inode));
++}
++
++static struct file_operations tn7atm_proc_version_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7atm_proc_version_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+
+ /* Device detection */
+
+ static int __init tn7atm_detect (void)
+ {
+ Tn7AtmPrivate *priv;
+- struct proc_dir_entry *dsl_wr_file = NULL; /* Only for ones with a write
+- * function. */
+ int ctr;
+ const char *residual;
+
+@@ -2012,24 +2018,7 @@ static int __init tn7atm_detect (void)
+ */
+ for (ctr = 0; ctr < (NUM_ELEMS (proc_if)); ctr++)
+ {
+- /* Only if we have a write function, we create a normal proc file. */
+- if(proc_if[ctr].write_func)
+- {
+- dsl_wr_file = create_proc_entry (proc_if[ctr].name, DRV_PROC_MODE, root_proc_dir_entry);
+- if (dsl_wr_file)
+- {
+- dsl_wr_file->read_proc = proc_if[ctr].read_func;
+- dsl_wr_file->write_proc = proc_if[ctr].write_func;
+- dsl_wr_file->data = (void *)mydev; //UR8_MERGE_START_END CQ10700 Manjula K
+- }
+- dsl_wr_file = NULL;
+- }
+- else
+- {
+- /* Create a read-only entry. */
+- create_proc_read_entry (proc_if[ctr].name, 0, root_proc_dir_entry,
+- proc_if[ctr].read_func, mydev);
+- }
++ proc_create_data(proc_if[ctr].name, DRV_PROC_MODE, root_proc_dir_entry, proc_if[ctr].fops, (void *)mydev);
+ }
+
+ tn7dsl_dslmod_sysctl_register ();
+@@ -2501,63 +2490,10 @@ static int tn7atm_set_can_support_adsl2
+ return TRUE;
+ }
+
+-/*
+- * This function matches a name such as "serial", and that specified by the
+- * proc_dir_entry
+- */
+-static int tn7atm_proc_match (int len, const char *name,
+- struct proc_dir_entry *de)
++static int tn7atm_proc_qos_read(struct seq_file *m, void *data)
+ {
+- if (!de || !de->low_ino)
+- return 0;
+- if (de->namelen != len)
++ seq_printf (m, "\nEnableQoS = %d\n", EnableQoS);
+ return 0;
+- return !strncmp (name, de->name, len);
+-}
+-
+-/*
+- * This function parses a name such as "tty/driver/serial", and
+- * returns the struct proc_dir_entry for "/proc/tty/driver", and
+- * returns "serial" in residual.
+- */
+-static int tn7atm_xlate_proc_name (const char *name,
+- struct proc_dir_entry **ret,
+- const char **residual)
+-{
+- const char *cp = name, *next;
+- struct proc_dir_entry *de;
+- int len;
+- extern struct proc_dir_entry proc_root;
+-
+- de = &proc_root;
+- while (1)
+- {
+- next = strchr (cp, '/');
+- if (!next)
+- break;
+-
+- len = next - cp;
+- for (de = de->subdir; de; de = de->next)
+- {
+- if (tn7atm_proc_match (len, cp, de))
+- break;
+- }
+- if (!de)
+- return -ENOENT;
+- cp += len + 1;
+- }
+- *residual = cp;
+- *ret = de;
+-
+- return 0;
+-}
+-
+-static int tn7atm_proc_qos_read(char *buf, char **start, off_t offset, int count, int *eof, void *data)
+-{
+- int len = 0;
+-
+- len += sprintf (buf + len, "\nEnableQoS = %d\n", EnableQoS);
+- return len;
+
+ }
+ static int tn7atm_proc_qos_write(struct file *fp, const char *buf, unsigned long count, void *data)
+@@ -2591,5 +2527,19 @@ static int tn7atm_proc_qos_write(struct
+ return count;
+ }
+
++static int tn7atm_proc_qos_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7atm_proc_qos_read, PDE_DATA(inode));
++}
++
++static struct file_operations tn7atm_proc_qos_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7atm_proc_qos_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++ .write = tn7atm_proc_qos_write,
++};
++
+ module_init (tn7atm_detect);
+ module_exit (tn7atm_exit);
+--- a/tn7dsl.c
++++ b/tn7dsl.c
+@@ -221,6 +221,9 @@ static struct led_funcs ledreg[2];
+
+ #define tn7dsl_kfree_skb(x) dev_kfree_skb(x)
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
++#define PDE_DATA(inode) PDE(inode)->data
++#endif
+
+ //---------------------------------------------
+ // Begin Clear EOC definitions
+@@ -349,7 +352,7 @@ static void tn7dsl_register_dslss_led(vo
+ void tn7dsl_dslmod_sysctl_register(void);
+ void tn7dsl_dslmod_sysctl_unregister(void);
+ static int tn7dsl_clear_eoc_receive(void);
+-static int tn7dsl_proc_snr_print (char *buf, int count, int *eof, int data);
++static int tn7dsl_proc_snr_print (struct seq_file *m, int data);
+ /* end of internal functions */
+
+ // UR8_MERGE_START CQ11054 Jack Zhang
+@@ -649,11 +652,9 @@ void shim_osCriticalExit(void)
+ spin_unlock_irqrestore(&shimLock, flags);
+ }
+
+-static int tn7dsl_proc_snr_print (char *buf, int count, int *eof, int data)
++static int tn7dsl_proc_snr_print (struct seq_file *m, int data)
+ {
+
+- int len = 0;
+- int limit = count - 80;
+ int i, j;
+ int bin = (int) data;
+ unsigned short *rxSnrPerBin;
+@@ -674,95 +675,128 @@ static int tn7dsl_proc_snr_print (char *
+ break;
+
+ default:
+- if(len<=limit)
+- len += sprintf (buf + len, "\nInvalid bin selected Bin%d :\n", bin);
+- return len;
+-}
++ seq_printf (m, "\nInvalid bin selected Bin%d :\n", bin);
++ return 0;
++ }
+
+- if(len<=limit)
+- len += sprintf (buf + len, "\nAR7 DSL Modem Rx SNR Per Bin for Bin%d :\n", bin);
++ seq_printf (m, "\nAR7 DSL Modem Rx SNR Per Bin for Bin%d :\n", bin);
+
+ for (i=0; i<pIhw->AppData.max_ds_tones/16; i++)
+ {
+ for(j=0;j<16;j++)
+ {
+- if(len <=limit)
+- len +=
+- sprintf (buf + len, "%04x ",
++ seq_printf (m, "%04x ",
+ (unsigned short) rxSnrPerBin[i * 16 + j]);
+- }
+- if(len <=limit)
+- len += sprintf(buf+len, "\n");
+ }
++ seq_printf(m, "\n");
++ }
+
+- return len;
++ return 0;
+ }
+
+
+ //@Added SNR per bin info per customer request. 05-14-2004
+-int tn7dsl_proc_snr0 (char *buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_snr0 (struct seq_file *m, void *data)
+ {
+- return tn7dsl_proc_snr_print(buf, count, eof, 0);
++ return tn7dsl_proc_snr_print(m, 0);
+ }
+
+-int tn7dsl_proc_snr1 (char *buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_snr0_open(struct inode *inode, struct file *file)
+ {
+- return tn7dsl_proc_snr_print(buf, count, eof, 1);
++ return single_open(file, tn7dsl_proc_snr0, PDE_DATA(inode));
++}
++
++struct file_operations tn7dsl_proc_snr0_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_snr0_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++static int tn7dsl_proc_snr1 (struct seq_file *m, void *data)
++{
++ return tn7dsl_proc_snr_print(m, 1);
+ }
+
+-int tn7dsl_proc_snr2 (char *buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_snr1_open(struct inode *inode, struct file *file)
+ {
+- return tn7dsl_proc_snr_print(buf, count, eof, 2);
++ return single_open(file, tn7dsl_proc_snr1, PDE_DATA(inode));
+ }
+
++struct file_operations tn7dsl_proc_snr1_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_snr1_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++static int tn7dsl_proc_snr2 (struct seq_file *m, void *data)
++{
++ return tn7dsl_proc_snr_print(m, 2);
++}
++
++static int tn7dsl_proc_snr2_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7dsl_proc_snr2, PDE_DATA(inode));
++}
++
++struct file_operations tn7dsl_proc_snr2_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_snr2_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+ //@Added bit allocation table per customer request. 05-14-2004
+-int tn7dsl_proc_bit_allocation (char *buf, char **start, off_t offset,
+- int count, int *eof, void *data)
++static int tn7dsl_proc_bit_allocation (struct seq_file *m, void *data)
+ {
+
+- int len = 0;
+- int limit = count - 80;
+ int i, j;
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nAR7 DSL Modem US Bit Allocation:");
++ seq_printf(m, "\nAR7 DSL Modem US Bit Allocation:");
+
+ for(i=0; i<pIhw->AppData.max_us_tones; i++)
+ {
+ if (!(i%16))
+ {
+- if(len <=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+- if(len <=limit)
+- len +=
+- sprintf (buf + len, "%02x ",
+- (unsigned char) pIhw->AppData.BitAllocTblUstrm[i]);
++ seq_printf (m, "%02x ",
++ (unsigned char) pIhw->AppData.BitAllocTblUstrm[i]);
+ }
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\n\nAR7 DSL Modem DS Bit Allocation:\n");
++ seq_printf(m, "\n\nAR7 DSL Modem DS Bit Allocation:\n");
+
+ for (i=0; i<pIhw->AppData.max_ds_tones/16; i++)
+ {
+ for(j=0;j<16;j++)
+ {
+- if(len <=limit)
+- len +=
+- sprintf (buf + len, "%02x ",
+- (unsigned char) pIhw->AppData.BitAllocTblDstrm[i * 16 +
+- j]);
++ seq_printf (m, "%02x ",
++ (unsigned char) pIhw->AppData.BitAllocTblDstrm[i * 16 +
++ j]);
+ }
+- if(len <=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+
+- return len;
++ return 0;
++}
++
++int tn7dsl_proc_bit_allocation_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7dsl_proc_bit_allocation, PDE_DATA(inode));
+ }
+
++struct file_operations tn7dsl_proc_bit_allocation_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_bit_allocation_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+ #ifndef NO_ACT
+ int tn7dsl_proc_ds_noise(char* buf, char **start, off_t offset, int count,
+ int *eof, void *data)
+@@ -825,59 +859,48 @@ static char *pUnknown= "Unknown";
+ #ifdef ADV_DIAG_STATS //CQ10275, CQ10449
+ //UR8_MERGE_START CQ10449 Jack Zhang
+
+-static int proc_adv_stats_header(char* buf, int limit);
++static int proc_adv_stats_header(struct seq_file *m);
+
+-int tn7dsl_proc_adv_stats(char* buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_adv_stats(struct seq_file *m, void *data)
+ {
+
+- int len = 0;
+- int limit = count - 80;
+ //char *cp = buf + offset;
+ char *cp = buf;
+ int i = 0;
+ int strt = 32;
+- static int ctr = 0;
+
+ // printk("proc_adv_stats: buf=0x%X, ctr=%d, offset=%d, count=%d, eof=%d\n",
+ // (unsigned int)buf, ctr, offset, count, *eof);
+- if( ctr == 0)
+- {
+- len = proc_adv_stats_header( cp, limit);
+-
+- if( len<=limit)
+- len += sprintf(cp+len, "\n\tBin No.\tBits:\tMargin:\tSNR\n");
+- }
+- else
+- {
+- strt = ctr;
+- }
+-
++ proc_adv_stats_header(m);
++
++ seq_printf(m, "\n\tBin No.\tBits:\tMargin:\tSNR\n");
++
+ for( i =strt; i<512; i++)
+ {
+- if(len<=limit)
+- {
+- len += sprintf(cp+len, "\t%u\t%u\t%u\t%d\n", i,
++ seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
+ (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
+ (unsigned int)pIhw->AppData.marginTblDstrm[i],
+ (int)pIhw->AppData.rxSnrPerBin0[i]);
+- }
+- else
+- {
+- ctr = i;
+- //*eof = 0;
+- *(cp + len) = '\0';
+- printk("proc_adv_stats - return: ctr=%d, len=%d\n", ctr, len);
+- return len;
+- }
+ }
+- ctr = 0;
+- *eof = 1;
+ printk("proc_adv_stats - return: ctr=%d, len=%d\n", ctr, len);
+- return len;
++ return 0;
++}
++
++
++static int tn7dsl_proc_adv_stats_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7dsl_proc_adv_stats, PDE_DATA(inode));
+ }
+
+-static int proc_adv_stats_header(char* buf, int limit)
++struct file_operations tn7dsl_proc_adv_stats_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_adv_stats_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++static int proc_adv_stats_header(struct seq_file *m)
+ {
+ int len = 0;
+ int i = 0;
+@@ -886,66 +909,53 @@ static int proc_adv_stats_header(char* b
+ */
+
+ dslhal_api_gatherStatistics(pIhw);
+- if(len<=limit)
+- len += sprintf(buf+len, "\nAR7 DSL Modem Advanced Statistics:\n");
++ seq_printf(m, "\nAR7 DSL Modem Advanced Statistics:\n");
+
+- if(len<=limit)
++ if(pIhw->lConnected != 1)
+ {
+- if(pIhw->lConnected != 1)
+- {
+- pIhw->AppData.USConRate = 0;
+- pIhw->AppData.DSConRate = 0;
+- }
+- len +=
+- sprintf (buf + len,
++ pIhw->AppData.USConRate = 0;
++ pIhw->AppData.DSConRate = 0;
++ }
++ seq_printf (m,
+ "\t[Connection Rate]\tUS:\t%u\tDS:\t%u\n",
+ (unsigned int)pIhw->AppData.USConRate,
+ (unsigned int)pIhw->AppData.DSConRate );
+ }
+- if(len<=limit)
+ // UR8_MERGE_START CQ11054 Jack Zhang
++ if (dslhal_api_getHighPrecision())
+ {
+- if (dslhal_api_getHighPrecision())
+- {
+- len +=
+- sprintf (buf + len, "\t[Margin]\tUS:\t%d.%u\tDS:\t\t%d.%u\n",
+- gInt(pIhw->AppData.usMargin), gDot1(pIhw->AppData.usMargin),
+- gInt(pIhw->AppData.dsMargin), gDot1(pIhw->AppData.dsMargin));
+- }
+- else
+- {
+- len +=
+- sprintf (buf + len, "\t[Margin]\tUS:\t%u\tDS:\t\t%u\n",
+- (unsigned int)pIhw->AppData.usMargin,
+- (unsigned int)pIhw->AppData.dsMargin/2 );
+- }
++ seq_printf (m, "\t[Margin]\tUS:\t%d.%u\tDS:\t\t%d.%u\n",
++ gInt(pIhw->AppData.usMargin), gDot1(pIhw->AppData.usMargin),
++ gInt(pIhw->AppData.dsMargin), gDot1(pIhw->AppData.dsMargin));
++ }
++ else
++ {
++ seq_printf (m, "\t[Margin]\tUS:\t%u\tDS:\t\t%u\n",
++ (unsigned int)pIhw->AppData.usMargin,
++ (unsigned int)pIhw->AppData.dsMargin/2 );
+ }
+ // UR8_MERGE_END CQ11054*
+
+ /*
+ * Downstream/Upstream Interleaved Errors
+ */
+- if(len<=limit)
+- len += sprintf(buf+len, "\t[Interleave path] US (TX):\tCRC: \t%u\tFEC: \t%u\n",
++ seq_printf(m, "\t[Interleave path] US (TX):\tCRC: \t%u\tFEC: \t%u\n",
+ (unsigned int)pIhw->AppData.usICRC_errors,
+ (unsigned int)pIhw->AppData.usIFEC_errors);
+- if(len<=limit)
+- len += sprintf(buf+len, "\t[Interleave path] DS (RX):\tCRC: \t%u\tFEC: \t%u\n",
++ seq_printf(m, "\t[Interleave path] DS (RX):\tCRC: \t%u\tFEC: \t%u\n",
+ (unsigned int)pIhw->AppData.dsICRC_errors,
+ (unsigned int)pIhw->AppData.dsIFEC_errors);
+ /*
+ * Upstream/Downstream Fast Errors
+ */
+- if(len<=limit)
+- len += sprintf(buf+len, "\t[Fast path] US (TX): \tCRC: \t%u\tFEC: \t%u\n",
++ seq_printf(m, "\t[Fast path] US (TX): \tCRC: \t%u\tFEC: \t%u\n",
+ (unsigned int)pIhw->AppData.usFCRC_errors,
+ (unsigned int)pIhw->AppData.usFFEC_errors);
+- if(len<=limit)
+- len += sprintf(buf+len, "\t[Fast path] DS (RX):\tCRC: \t%u\tFEC: \t%u\n",
++ seq_printf(m, "\t[Fast path] DS (RX):\tCRC: \t%u\tFEC: \t%u\n",
+ (unsigned int)pIhw->AppData.dsFCRC_errors,
+ (unsigned int)pIhw->AppData.dsFFEC_errors);
+-
+- return len;
++
++ return 0;
+ }
+
+ static int getDiagDisplayMode()
+@@ -968,29 +978,24 @@ static int getDiagDisplayMode()
+ ret = 2;
+ return ret;
+ }
+-int tn7dsl_proc_adv_stats1(char* buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++int tn7dsl_proc_adv_stats1(struct seq_file *m, void *data)
+ {
+
+- int len = 0;
+- int limit = count - 80;
+ int i;
+ int mode = 0; //mode = 0 => ADSL1 or ADSL2 & 2+
+ unsigned char SNRpsds[512];
+ int n;
+
+- len = proc_adv_stats_header( buf+len, limit);
++ proc_adv_stats_header( m);
+ mode = getDiagDisplayMode();
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\tBin No.\tBits:\tMargin:\tSNR (Part 1 of 3)\n");
+-
++ seq_printf(m, "\tBin No.\tBits:\tMargin:\tSNR (Part 1 of 3)\n");
++
+ if(mode==1) //ADSL1
+ {
+ for( i =32; i<128; i++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
++ seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
+ (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
+ (unsigned int)pIhw->AppData.marginTblDstrm[i],
+ (int)pIhw->AppData.rxSnrPerBin0[i]);
+@@ -1001,26 +1006,34 @@ int tn7dsl_proc_adv_stats1(char* buf, ch
+ if (dslhal_api_getSNRpsds(pIhw, SNRpsds, 1))
+ {
+ dgprintf(4, "dslhal_api_getSNRpsds failed!\n");
+- return len;
++ return -EIO;
+ }
+ for( i =32; i<128; i++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
++ seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
+ (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
+ (unsigned int)pIhw->AppData.marginTblDstrm[i],
+ (i<pIhw->AppData.max_ds_tones)?(unsigned char)SNRpsds[i]:0);
+ }
+ }
+- return len;
++ return 0;
+ }
+
+-int tn7dsl_proc_adv_stats2(char* buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_adv_stats1_open(struct inode *inode, struct file *file)
+ {
++ return single_open(file, tn7dsl_proc_adv_stats1, PDE_DATA(inode));
++}
+
+- int len = 0;
+- int limit = count - 80;
++struct file_operations tn7dsl_proc_adv_stats1_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_adv_stats1_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++int tn7dsl_proc_adv_stats2(struct seq_file *m, void *data)
++{
+ int i;
+ int mode = 0; //mode = 0 => ADSL1 or ADSL2 & 2+
+ unsigned char SNRpsds[512];
+@@ -1030,12 +1043,10 @@ int tn7dsl_proc_adv_stats2(char* buf, ch
+ if( mode==1) //ADSL1
+ {
+ dslhal_api_gatherStatistics(pIhw);
+- if(len<=limit)
+- len += sprintf(buf+len, "\tBin No.\tBits:\tMargin:\tSNR (Part 2 of 3):\n");
++ seq_printf(m, "\tBin No.\tBits:\tMargin:\tSNR (Part 2 of 3):\n");
+ for( i =128; i<320; i++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
++ seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
+ (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
+ (unsigned int)pIhw->AppData.marginTblDstrm[i],
+ (int)pIhw->AppData.rxSnrPerBin0[i]);
+@@ -1046,26 +1057,35 @@ int tn7dsl_proc_adv_stats2(char* buf, ch
+ if (dslhal_api_getSNRpsds(pIhw, SNRpsds, 1))
+ {
+ dgprintf(4, "dslhal_api_getSNRpsds failed!\n");
+- return len;
++ return -EIO;
+ }
+ for( i =128; i<320; i++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
++ seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
+ (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
+ (unsigned int)pIhw->AppData.marginTblDstrm[i],
+ (i<pIhw->AppData.max_ds_tones)?(unsigned char)SNRpsds[i]:0);
+ }
+ }
+- return len;
++ return 0;
+ }
+
+-int tn7dsl_proc_adv_stats3(char* buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_adv_stats2_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7dsl_proc_adv_stats2, PDE_DATA(inode));
++}
++
++struct file_operations tn7dsl_proc_adv_stats2_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_adv_stats2_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++int tn7dsl_proc_adv_stats3(struct seq_file *m, void *data)
+ {
+
+- int len = 0;
+- int limit = count - 80;
+ int i;
+ int mode = 0; //mode = 0 => ADSL1 or ADSL2 & 2+
+ unsigned char SNRpsds[512];
+@@ -1075,12 +1095,10 @@ int tn7dsl_proc_adv_stats3(char* buf, ch
+ if( mode==1) //ADSL1
+ {
+ dslhal_api_gatherStatistics(pIhw);
+- if(len<=limit)
+- len += sprintf(buf+len, "\tBin No.\tBits:\tMargin:\tSNR (Part 3 of 3):\n");
++ seq_printf(m, "\tBin No.\tBits:\tMargin:\tSNR (Part 3 of 3):\n");
+ for( i =320; i<512; i++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
++ seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
+ (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
+ (unsigned int)pIhw->AppData.marginTblDstrm[i],
+ (int)pIhw->AppData.rxSnrPerBin0[i]);
+@@ -1091,283 +1109,287 @@ int tn7dsl_proc_adv_stats3(char* buf, ch
+ if (dslhal_api_getSNRpsds(pIhw, SNRpsds, 1))
+ {
+ dgprintf(4, "dslhal_api_getSNRpsds failed!\n");
+- return len;
++ return -EIO;
+ }
+ for( i =320; i<512; i++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
++ seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
+ (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
+ (unsigned int)pIhw->AppData.marginTblDstrm[i],
+ (i<pIhw->AppData.max_ds_tones)?(unsigned char)SNRpsds[i]:0);
+ }
+ }
+- if(len<=limit)
+- len += sprintf(buf+len, "[End of Stats]\n");
+- return len;
++ seq_printf(m, "[End of Stats]\n");
++ return 0;
+ }
+-//UR8_MERGE_END CQ10449
+-//UR8_MERGE_START CQ10682 Jack Zhang
+-int tn7dsl_proc_dbg_cmsgs(char* buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++
++static int tn7dsl_proc_adv_stats3_open(struct inode *inode, struct file *file)
+ {
++ return single_open(file, tn7dsl_proc_adv_stats3, PDE_DATA(inode));
++}
+
+- int len = 0;
+- int limit = count - 80;
++struct file_operations tn7dsl_proc_adv_stats3_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_adv_stats3_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
+
++//UR8_MERGE_END CQ10449
++//UR8_MERGE_START CQ10682 Jack Zhang
++int tn7dsl_proc_dbg_cmsgs(struct seq_file *m, void *data)
++{
+ int rc=0;
+
+ dslhal_api_gatherStatistics(pIhw);
+
+- if(len<=limit)
+- len += sprintf(buf+len, "Training Messages (C-Msgs 1-5)..\n");
++ seq_printf(m, "Training Messages (C-Msgs 1-5)..\n");
+
+- if(len<=limit)
+- len += sprintf(buf+len, "ADSL2 DELT C-Msg1Ld \t Message Length:%d\n",
++ seq_printf(m, "ADSL2 DELT C-Msg1Ld \t Message Length:%d\n",
+ pIhw->adsl2DiagnosticMessages.cMsg1LdLen);
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg1LdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg1Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg1Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT C-Msg2Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg2LdLen);
++ seq_printf(m, "\nADSL2 DELT C-Msg2Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg2LdLen);
+
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg2LdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg2Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg2Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT C-Msg3Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg3LdLen);
++ seq_printf(m, "\nADSL2 DELT C-Msg3Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg3LdLen);
+
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg3LdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg3Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg3Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT C-Msg4Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg4LdLen);
++ seq_printf(m, "\nADSL2 DELT C-Msg4Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg4LdLen);
+
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg4LdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg4Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg4Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT C-Msg5Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg5LdLen);
++ seq_printf(m, "\nADSL2 DELT C-Msg5Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg5LdLen);
+
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg5LdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg5Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg5Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
+- return len;
++ seq_printf(m, "\n");
++ return 0;
+ }
+
+-int tn7dsl_proc_dbg_rmsgs1(char* buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_dbg_cmsgs_open(struct inode *inode, struct file *file)
+ {
++ return single_open(file, tn7dsl_proc_dbg_cmsgs, PDE_DATA(inode));
++}
++
++struct file_operations tn7dsl_proc_dbg_cmsgs_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_dbg_cmsgs_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
+
+- int len = 0;
+- int limit = count - 80;
++
++int tn7dsl_proc_dbg_rmsgs1(struct seq_file *m, void *data)
++{
+
+ int rc=0;
+
+ dslhal_api_gatherStatistics(pIhw);
+
+- if(len<=limit)
+- len += sprintf(buf+len, "Training Messages (R-Msgs 1-3)..\n");
++ seq_printf(m, "Training Messages (R-Msgs 1-3)..\n");
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT R-Msg1Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsg1LdLen);
++ seq_printf(m, "\nADSL2 DELT R-Msg1Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsg1LdLen);
+
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsg1LdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg1Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg1Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT R-Msg2Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
++ seq_printf(m, "\nADSL2 DELT R-Msg2Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
+
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg2Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg2Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT R-Msg3Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
++ seq_printf(m, "\nADSL2 DELT R-Msg3Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg3Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg3Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
+- return len;
++ seq_printf(m, "\n");
++ return 0;
+ }
+
+-int tn7dsl_proc_dbg_rmsgs2(char* buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_dbg_rmsgs1_open(struct inode *inode, struct file *file)
+ {
++ return single_open(file, tn7dsl_proc_dbg_rmsgs1, PDE_DATA(inode));
++}
+
+- int len = 0;
+- int limit = count - 80;
++struct file_operations tn7dsl_proc_dbg_rmsgs1_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_dbg_rmsgs1_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++
++int tn7dsl_proc_dbg_rmsgs2(struct seq_file *m, void *data)
++{
+
+ int rc=0;
+
+ dslhal_api_gatherStatistics(pIhw);
+
+- if(len<=limit)
+- len += sprintf(buf+len, "Training Messages (R-Msgs 4-5)..\n");
++ seq_printf(m, "Training Messages (R-Msgs 4-5)..\n");
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT R-Msg4Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
++ seq_printf(m, "\nADSL2 DELT R-Msg4Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg4Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg4Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ len += sprintf(m, "\n");
+ }
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT R-Msg5Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
++ seq_printf(m, "\nADSL2 DELT R-Msg5Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg5Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg5Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
+- return len;
++ seq_printf(m, "\n");
++ return 0;
+ }
+
+-int tn7dsl_proc_dbg_rmsgs3(char* buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_dbg_rmsgs2_open(struct inode *inode, struct file *file)
+ {
++ return single_open(file, tn7dsl_proc_dbg_rmsgs2, PDE_DATA(inode));
++}
+
+- int len = 0;
+- int limit = count - 80;
++struct file_operations _fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_dbg_rmsgs2_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++int tn7dsl_proc_dbg_rmsgs3(struct seq_file *m, void *data)
++{
+
+ int rc=0;
+
+ dslhal_api_gatherStatistics(pIhw);
+
+- if(len<=limit)
+- len += sprintf(buf+len, "Training Messages (R-Msgs 6-7)..\n");
++ seq_printf(m, "Training Messages (R-Msgs 6-7)..\n");
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT R-Msg6Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
++ seq_printf(m, "\nADSL2 DELT R-Msg6Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg6Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg6Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT R-Msg7Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
++ seq_printf(m, "\nADSL2 DELT R-Msg7Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg7Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg7Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+
+- return len;
++ return 0;
+ }
+
+-int tn7dsl_proc_dbg_rmsgs4(char* buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_dbg_rmsgs3_open(struct inode *inode, struct file *file)
+ {
++ return single_open(file, tn7dsl_proc_dbg_rmsgs3, PDE_DATA(inode));
++}
+
+- int len = 0;
+- int limit = count - 80;
++struct file_operations tn7dsl_proc_dbg_rmsgs3_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_dbg_rmsgs3_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++int tn7dsl_proc_dbg_rmsgs4(struct seq_file *m, void *data)
++{
+
+ int rc=0;
+
+ dslhal_api_gatherStatistics(pIhw);
+
+- if(len<=limit)
+- len += sprintf(buf+len, "Training Messages (R-Msgs 8-9)..\n");
++ seq_printf(m, "Training Messages (R-Msgs 8-9)..\n");
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT R-Msg8Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
++ seq_printf(m, "\nADSL2 DELT R-Msg8Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg8Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg8Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT R-Msg9Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
++ seq_printf(m, "\nADSL2 DELT R-Msg9Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg9Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg9Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+
+- return len;
++ return 0;
++}
++
++static int tn7dsl_proc_dbg_rmsgs4_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7dsl_proc_dbg_rmsgs4, PDE_DATA(inode));
+ }
++
++struct file_operations tn7dsl_proc_dbg_rmsgs4_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_dbg_rmsgs4_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+ //UR8_MERGE_END CQ10682*
+ #endif //ADV_DIAG_STATS
+
+-int tn7dsl_proc_stats(char* buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_stats(struct seq_file *m, void *data)
+ {
+
+- int len = 0;
+- int limit = count - 80;
+ int F4count, F5count;
+ unsigned int maxRate=0;
+ unsigned int us_maxRate=0;
+@@ -1375,80 +1397,58 @@ int tn7dsl_proc_stats(char* buf, char **
+ //UR8_MERGE_START CQ10700 Manjula K
+ struct atm_dev *dev;
+ Tn7AtmPrivate *priv;
+- dev = (struct atm_dev *)data;
++ int offset[2] = { 32, 0 };
++ unsigned int usBitswap, dsBitswap;
++ dev = (struct atm_dev *)m->private;
+ priv = (Tn7AtmPrivate *)dev->dev_data;
+ //UR8_MERGE_END CQ10700
+
++
+ /*
+ * Read Ax5 Stats
+ */
+
+ dslhal_api_gatherStatistics(pIhw);
+- if(len<=limit)
+- len += sprintf(buf+len, "\nAR7 DSL Modem Statistics:\n");
+- if(len<=limit)
+- len += sprintf(buf+len, "--------------------------------\n");
++ seq_printf(m, "\nAR7 DSL Modem Statistics:\n");
++ seq_printf(m, "--------------------------------\n");
+ /*
+ * us and ds Connection Rates
+ */
+- if(len<=limit)
+- len += sprintf(buf+len, "[DSL Modem Stats]\n");
++ seq_printf(m, "[DSL Modem Stats]\n");
+
+
+- if(len<=limit)
++ if(pIhw->lConnected != 1)
+ {
+- if(pIhw->lConnected != 1)
+- {
+- pIhw->AppData.USConRate = 0;
+- pIhw->AppData.DSConRate = 0;
+- }
+- len +=
+- sprintf (buf + len,
+- "\tUS Connection Rate:\t%u\tDS Connection Rate:\t%u\n",
+- (unsigned int)pIhw->AppData.USConRate,
+- (unsigned int)pIhw->AppData.DSConRate );
++ pIhw->AppData.USConRate = 0;
++ pIhw->AppData.DSConRate = 0;
+ }
+- if(len<=limit)
++ seq_printf (m,
++ "\tUS Connection Rate:\t%u\tDS Connection Rate:\t%u\n",
++ (unsigned int)pIhw->AppData.USConRate,
++ (unsigned int)pIhw->AppData.DSConRate );
+ // UR8_MERGE_START CQ11054 Jack Zhang
+- {
+- if (dslhal_api_getHighPrecision())
+- {
+- len +=
+- sprintf (buf + len, "\tDS Line Attenuation:\t%u.%u\tDS Margin:\t\t%d.%u\n",
++ if (dslhal_api_getHighPrecision())
++ seq_printf (m, "\tDS Line Attenuation:\t%u.%u\tDS Margin:\t\t%d.%u\n",
+ gInt(pIhw->AppData.dsLineAttn), gDot1(pIhw->AppData.dsLineAttn),
+ gInt(pIhw->AppData.dsMargin), gDot1(pIhw->AppData.dsMargin));
+- }
+- else{
+- len +=
+- sprintf (buf + len, "\tDS Line Attenuation:\t%u\tDS Margin:\t\t%u\n",
++ else
++ seq_printf (m, "\tDS Line Attenuation:\t%u\tDS Margin:\t\t%u\n",
+ (unsigned int)pIhw->AppData.dsLineAttn/2,
+ (unsigned int)pIhw->AppData.dsMargin/2 );
+- }
+- }
+ // UR8_MERGE_END CQ11054*
+
+- if(len<=limit)
+ // UR8_MERGE_START CQ11054 Jack Zhang
+- {
+- if (dslhal_api_getHighPrecision())
+- {
+- len +=
+- sprintf (buf + len, "\tUS Line Attenuation:\t%u.%u\tUS Margin:\t\t%d.%u\n",
++ if (dslhal_api_getHighPrecision())
++ seq_printf (m, "\tUS Line Attenuation:\t%u.%u\tUS Margin:\t\t%d.%u\n",
+ gInt(pIhw->AppData.usLineAttn), gDot1(pIhw->AppData.usLineAttn),
+ gInt(pIhw->AppData.usMargin), gDot1(pIhw->AppData.usMargin));
+- }
+- else
+- {
+- len +=
+- sprintf (buf + len, "\tUS Line Attenuation:\t%u\tUS Margin:\t\t%u\n",
++ else
++ seq_printf (m, "\tUS Line Attenuation:\t%u\tUS Margin:\t\t%u\n",
+ (unsigned int)pIhw->AppData.usLineAttn/2,
+ (unsigned int)pIhw->AppData.usMargin );
+- }
+- }
+ // UR8_MERGE_END CQ11054*
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\tUS Payload :\t\t%u\tDS Payload:\t\t%u\n",
++ seq_printf(m, "\tUS Payload :\t\t%u\tDS Payload:\t\t%u\n",
+ ((unsigned int) pIhw->AppData.usAtm_count[0] +
+ (unsigned int) pIhw->AppData.usAtm_count[1]) * 48,
+ ((unsigned int) pIhw->AppData.dsGood_count[0] +
+@@ -1456,9 +1456,7 @@ int tn7dsl_proc_stats(char* buf, char **
+ /*
+ * Superframe Count
+ */
+- if(len<=limit)
+- len +=
+- sprintf (buf + len,
++ seq_printf (m,
+ "\tUS Superframe Cnt :\t%u\tDS Superframe Cnt:\t%u\n",
+ (unsigned int)pIhw->AppData.usSuperFrmCnt,
+ (unsigned int)pIhw->AppData.dsSuperFrmCnt );
+@@ -1466,57 +1464,45 @@ int tn7dsl_proc_stats(char* buf, char **
+ /*
+ * US and DS power
+ */
+- if(len<=limit)
++ if(pIhw->AppData.bState < 5)
+ {
+- if(pIhw->AppData.bState < 5)
+- {
+- pIhw->AppData.usTxPower = 0;
+- pIhw->AppData.dsTxPower = 0;
+- }
+- len +=
+- sprintf (buf + len,
++ pIhw->AppData.usTxPower = 0;
++ pIhw->AppData.dsTxPower = 0;
++ }
++ seq_printf (m,
++// UR8_MERGE_START - CQ11579 - Jeremy #1
+ "\tUS Transmit Power :\t%u\tDS Transmit Power:\t%u\n",
+ (unsigned int)pIhw->AppData.usTxPower/256,
+ (unsigned int)pIhw->AppData.dsTxPower/256 );
+- }
++// UR8_MERGE_END - CQ11579
+ /*
+ * DSL Stats Errors
+ */
+- if(len<=limit)
+- len += sprintf(buf+len, "\tLOS errors:\t\t%u\tSEF errors:\t\t%u\n",
++ seq_printf(m, "\tLOS errors:\t\t%u\tSEF errors:\t\t%u\n",
+ (unsigned int)pIhw->AppData.LOS_errors,
+ (unsigned int)pIhw->AppData.SEF_errors );
+
+ //UR8_MERGE_START Report_SES Manjula K
+ //CQ10369
+- if(len<=limit)
+- len += sprintf(buf+len, "\tErrored Seconds:\t%u\tSeverely Err Secs:\t%u\n",
++ seq_printf(m, "\tErrored Seconds:\t%u\tSeverely Err Secs:\t%u\n",
+ (unsigned int)pIhw->AppData.erroredSeconds,
+ (unsigned int)pIhw->AppData.severelyerrsecs );
+ //UR8_MERGE_END Report_SES
+-
+- if(len<=limit)
+- len += sprintf(buf+len, "\tFrame mode:\t\t%u\tMax Frame mode:\t\t%u\n",
++
++ seq_printf(m, "\tFrame mode:\t\t%u\tMax Frame mode:\t\t%u\n",
+ (unsigned int)pIhw->AppData.FrmMode,
+ (unsigned int)pIhw->AppData.MaxFrmMode );
+- if(len<=limit)
+- len +=
+- sprintf (buf + len, "\tTrained Path:\t\t%u\tUS Peak Cell Rate:\t%u\n",
++ seq_printf (m, "\tTrained Path:\t\t%u\tUS Peak Cell Rate:\t%u\n",
+ (unsigned int)pIhw->AppData.TrainedPath,
+ (unsigned int)pIhw->AppData.USConRate*1000/8/53 );
+- if(len<=limit)
+- len +=
+- sprintf (buf + len, "\tTrained Mode:\t\t%u\tSelected Mode:\t\t%u\n",
++ seq_printf (m, "\tTrained Mode:\t\t%u\tSelected Mode:\t\t%u\n",
+ (unsigned int) pIhw->AppData.TrainedMode,
+ (unsigned int) pIhw->AppData.StdMode);
+
+- if(len<=limit)
+- len +=
+- sprintf (buf + len, "\tATUC Vendor Code:\t%X\tATUC Revision:\t%u\n",
++ seq_printf (m, "\tATUC Vendor Code:\t%X\tATUC Revision:\t%u\n",
+ (unsigned int) pIhw->AppData.atucVendorId,
+ pIhw->AppData.atucRevisionNum);
+- if(len<=limit)
+- len += sprintf(buf+len, "\tHybrid Selected:\t%u\tTrellis:\t\t%u\n",
++ seq_printf(m, "\tHybrid Selected:\t%u\tTrellis:\t\t%u\n",
+ (unsigned int)pIhw->AppData.currentHybridNum, trellis);
+
+ //@Added Maximum attainable bit rate information. 05-14-2004
+@@ -1528,12 +1514,12 @@ int tn7dsl_proc_stats(char* buf, char **
+ }
+ else
+ {
+- int offset[2] = {5, 1};
++ int dspOffset[2] = { 5, 1 };
+ unsigned char rMsgsRA[12];
+ int numPayloadBytes = 0;
+
+ dslhal_api_dspInterfaceRead (pIhw, (unsigned int) pIhw->pmainAddr, 2,
+- (unsigned int *) &offset,
++ (unsigned int *) &dspOffset,
+ (unsigned char *) &rMsgsRA[0], 12);
+
+ maxRate = (unsigned int)pIhw->AppData.DSConRate;
+@@ -1549,283 +1535,213 @@ int tn7dsl_proc_stats(char* buf, char **
+ }
+ }
+
+- if(len<=limit)
+- len +=
+- sprintf (buf + len,
++ seq_printf (m,
+ "\tShowtime Count:\t\t%u\tDS Max Attainable Bit Rate: %u kbps\n",
+ (unsigned int)pIhw->AppData.showtimeCount, maxRate);
+
+- if(len<=limit)
+- {
+- int offset[2] = {32, 0};
+- unsigned int usBitswap, dsBitswap;
++ tn7dsl_generic_read(2, (unsigned int *)&offset);
++ dsBitswap = dslReg & dslhal_support_byteSwap32(0x000000ff);
+
+- tn7dsl_generic_read(2, (unsigned int *)&offset);
+- dsBitswap = dslReg & dslhal_support_byteSwap32(0x000000ff);
++ offset[0] = 33;
++ tn7dsl_generic_read(2, (unsigned int *)&offset);
++ usBitswap = dslReg & dslhal_support_byteSwap32(0x000000ff);
+
+- offset[0] = 33;
+- tn7dsl_generic_read(2, (unsigned int *)&offset);
+- usBitswap = dslReg & dslhal_support_byteSwap32(0x000000ff);
+-
+- if(pIhw->AppData.dsl_modulation > 5)
+- len +=
+- sprintf (buf + len,
++ if(pIhw->AppData.dsl_modulation > 5)
++ seq_printf (m,
+ "\tBitSwap:\t\t%u\tUS Max Attainable Bit Rate: %u bps\n",
+ (unsigned int)(usBitswap && dsBitswap), us_maxRate);
+- else
+- len +=
+- sprintf (buf + len,
++ else
++ seq_printf (m,
+ "\tBitSwap:\t\t%u\tUS Max Attainable Bit Rate:\tn/a\n",
+ (unsigned int)(usBitswap && dsBitswap));
+- }
+
+ #if 1 // TR69
+- if(len<=limit)
+- len +=
+- sprintf (buf + len, "\tAnnex: \t\t\t%s\tpsd_mask_qualifier: 0x%04x\n",
++ seq_printf (m, "\tAnnex: \t\t\t%s\tpsd_mask_qualifier: 0x%04x\n",
+ tn7dsl_AnnexFromNum(pIhw->AppData.annex_selected),
+ pIhw->AppData.psd_mask_qualifier);
+
+ // UR8_MERGE_START CQ10979 Jack Zhang
+ // UR8_MERGE_START CQ10978 Jack Zhang
+- if(len<=limit)
+- len +=
+- sprintf (buf + len, "\tPower Management Status: L%d\tDS HLINSC: %d\n",
++ seq_printf (m, "\tPower Management Status: L%d\tDS HLINSC: %d\n",
+ pIhw->AppData.pwrStatus, pIhw->AppData.dsHLINSC);
+ // UR8_MERGE_END CQ10978*
+
+- if(len<=limit)
+- len +=
+- sprintf (buf + len, "\tUS ACTPSD: \t\t%d\tDS ACTPSD: %d\n",
++ seq_printf (m, "\tUS ACTPSD: \t\t%d\tDS ACTPSD: %d\n",
+ pIhw->AppData.usACTPSD, pIhw->AppData.dsACTPSD);
+
+- if(len<=limit)
+- len +=
+- sprintf (buf + len, "\tTotal init. errors: \t%d\tTotal init. timeouts: %d\n",
++ seq_printf (m, "\tTotal init. errors: \t%d\tTotal init. timeouts: %d\n",
+ pIhw->AppData.totalInitErrs, pIhw->AppData.totalInitTOs);
+
+- if(len<=limit)
+- len +=
+- sprintf (buf + len, "\tShowtime init. errors: \t%d\tShowtime init. timeouts: %d\n",
++ seq_printf (m, "\tShowtime init. errors: \t%d\tShowtime init. timeouts: %d\n",
+ pIhw->AppData.showtimeInitErrs, pIhw->AppData.showtimeInitTOs);
+
+- if(len<=limit)
+- len +=
+- sprintf (buf + len, "\tLast showtime init. errors: %ld\tLast showtime init. timeouts: %ld\n",
++ seq_printf (m, "\tLast showtime init. errors: %ld\tLast showtime init. timeouts: %ld\n",
+ pIhw->AppData.lastshowInitErrs, pIhw->AppData.lastshowInitTOs);
+ // UR8_MERGE_END CQ10979*
+
+- if (len<=limit)
+- {
+- len += sprintf(buf+len,"\tATUC ghsVid: ");
+- for (i=0; i<8; i++)
+- len+= sprintf(buf+len, " %02x", pIhw->AppData.ghsATUCVendorId[i]);
+- }
++ seq_printf(m,"\tATUC ghsVid: ");
++ for (i=0; i<8; i++)
++ seq_printf(m, " %02x", pIhw->AppData.ghsATUCVendorId[i]);
+
+- if (len<=limit)
+- {
+- len += sprintf (buf + len, "\n");
+- }
++ seq_printf (m, "\n");
+
+- if (len <= limit)
+- {
+- len +=
+- sprintf (buf + len,
++ seq_printf (m,
+ "\tT1413Vid: %02x %02x\t\tT1413Rev: %02x\t\tVendorRev: %02x\n",
+ pIhw->AppData.t1413ATUC.VendorId[0],
+ pIhw->AppData.t1413ATUC.VendorId[1],
+ pIhw->AppData.t1413ATUC.t1413Revision,
+ pIhw->AppData.t1413ATUC.VendorRevision);
+- }
+
+- if (len<=limit)
+- {
+- len += sprintf(buf+len,"\tATUR ghsVid: ");
+- for (i=0; i<8; i++)
+- len+= sprintf(buf+len, " %02x", pIhw->AppData.ghsATURVendorId[i]);
+- }
++ seq_printf(m,"\tATUR ghsVid: ");
++ for (i=0; i<8; i++)
++ seq_printf(m, " %02x", pIhw->AppData.ghsATURVendorId[i]);
+
+- if (len<=limit)
+- {
+- len += sprintf (buf + len, "\n");
+- }
++ seq_printf (m, "\n");
+
+- if (len <= limit)
+- {
+- len +=
+- sprintf (buf + len,
++ seq_printf (m,
+ "\tT1413Vid: %02x %02x\tT1413Rev: %02x\tVendorRev: %02x\n",
+ pIhw->AppData.t1413ATUR.VendorId[0],
+ pIhw->AppData.t1413ATUR.VendorId[1],
+ pIhw->AppData.t1413ATUR.t1413Revision,
+ pIhw->AppData.t1413ATUR.VendorRevision);
+- }
+
+ #endif
+ /*
+ * Upstream Interleaved Errors
+ */
+- if(len<=limit)
+- len += sprintf(buf+len, "\n\t[Upstream (TX) Interleave path]\n");
+- if(len<=limit)
+- len += sprintf(buf+len, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
++ seq_printf(m, "\n\t[Upstream (TX) Interleave path]\n");
++ seq_printf(m, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
+ (unsigned int)pIhw->AppData.usICRC_errors,
+ (unsigned int)pIhw->AppData.usIFEC_errors,
+ (unsigned int)pIhw->AppData.usINCD_error);
+- if(len<=limit)
+- len += sprintf(buf+len, "\tLCD: \t%u\tHEC: \t%u\n",
++ seq_printf(m, "\tLCD: \t%u\tHEC: \t%u\n",
+ (unsigned int)pIhw->AppData.usILCD_errors,
+ (unsigned int)pIhw->AppData.usIHEC_errors);
+ /*
+ * Downstream Interleaved Errors
+ */
+- if(len<=limit)
+- len += sprintf(buf+len, "\n\t[Downstream (RX) Interleave path]\n");
+- if(len<=limit)
+- len += sprintf(buf+len, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
++ seq_printf(m, "\n\t[Downstream (RX) Interleave path]\n");
++ seq_printf(m, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
+ (unsigned int)pIhw->AppData.dsICRC_errors,
+ (unsigned int)pIhw->AppData.dsIFEC_errors,
+ (unsigned int)pIhw->AppData.dsINCD_error);
+- if(len<=limit)
+- len += sprintf(buf+len, "\tLCD: \t%u\tHEC: \t%u\n",
++ seq_printf(m, "\tLCD: \t%u\tHEC: \t%u\n",
+ (unsigned int)pIhw->AppData.dsILCD_errors,
+ (unsigned int)pIhw->AppData.dsIHEC_errors);
+ /*
+ * Upstream Fast Errors
+ */
+- if(len<=limit)
+- len += sprintf(buf+len, "\n\t[Upstream (TX) Fast path]\n");
+- if(len<=limit)
+- len += sprintf(buf+len, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
++ seq_printf(m, "\n\t[Upstream (TX) Fast path]\n");
++ seq_printf(m, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
+ (unsigned int)pIhw->AppData.usFCRC_errors,
+ (unsigned int)pIhw->AppData.usFFEC_errors,
+ (unsigned int)pIhw->AppData.usFNCD_error);
+- if(len<=limit)
+- len += sprintf(buf+len, "\tLCD: \t%u\tHEC: \t%u\n",
++ seq_printf(m, "\tLCD: \t%u\tHEC: \t%u\n",
+ (unsigned int)pIhw->AppData.usFLCD_errors,
+ (unsigned int)pIhw->AppData.usFHEC_errors);
+ /*
+ * Downstream Fast Errors
+ */
+- if(len<=limit)
+- len += sprintf(buf+len, "\n\t[Downstream (RX) Fast path]\n");
+- if(len<=limit)
+- len += sprintf(buf+len, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
++ seq_printf(m, "\n\t[Downstream (RX) Fast path]\n");
++ seq_printf(m, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
+ (unsigned int)pIhw->AppData.dsFCRC_errors,
+ (unsigned int)pIhw->AppData.dsFFEC_errors,
+ (unsigned int)pIhw->AppData.dsFNCD_error);
+- if(len<=limit)
+- len += sprintf(buf+len, "\tLCD: \t%u\tHEC: \t%u\n",
+- (unsigned int)pIhw->AppData.dsFLCD_errors,
+- (unsigned int)pIhw->AppData.dsFHEC_errors);
++ seq_printf(m, "\tLCD: \t%u\tHEC: \t%u\n",
++ (unsigned int)pIhw->AppData.dsFLCD_errors,
++ (unsigned int)pIhw->AppData.dsFHEC_errors);
+
+ /*
+ * ATM stats upstream
+ */
+- if(len<=limit)
+- len += sprintf(buf+len, "\n[ATM Stats]");
+- if(len<=limit)
+- len += sprintf(buf+len, "\n\t[Upstream/TX]\n");
+- if(len<=limit)
+- len +=
+- sprintf (buf + len, "\tGood Cell Cnt:\t%u\n\tIdle Cell Cnt:\t%u\n\n",
+- (unsigned int) pIhw->AppData.usAtm_count[0] +
+- (unsigned int) pIhw->AppData.usAtm_count[1],
+- (unsigned int) pIhw->AppData.usIdle_count[0] +
+- (unsigned int) pIhw->AppData.usIdle_count[1]);
+-//UR8_MERGE_START CQ10700 Manjula K
+- if (len <= limit)
+- len +=
+- sprintf (buf + len,
++ seq_printf(m, "\n[ATM Stats]");
++ seq_printf(m, "\n\t[Upstream/TX]\n");
++ seq_printf (m, "\tGood Cell Cnt:\t%u\n\tIdle Cell Cnt:\t%u\n\n",
++ (unsigned int) pIhw->AppData.usAtm_count[0] +
++ (unsigned int) pIhw->AppData.usAtm_count[1],
++ (unsigned int) pIhw->AppData.usIdle_count[0] +
++ (unsigned int) pIhw->AppData.usIdle_count[1]);
++//UR8_MERGE_START CQ10700 Manjula K
++ seq_printf (m,
+ "\tTx Packets Dropped Count:\t%lu\n\tTx Bad Packets Count:\t%lu\n",
+ priv->stats.tx_dropped, priv->stats.tx_errors);
+ //UR8_MERGE_END CQ10700
+ /*
+ * ATM stats downstream
+ */
+- if(len<=limit)
+- len += sprintf(buf+len, "\n\t[Downstream/RX)]\n");
+- if(len<=limit)
+- len +=
+- sprintf (buf + len,
+- "\tGood Cell Cnt:\t%u\n\tIdle Cell Cnt:\t%u\n\tBad Hec Cell Cnt:\t%u\n",
+- (unsigned int) pIhw->AppData.dsGood_count[0] +
+- (unsigned int) pIhw->AppData.dsGood_count[1],
+- (unsigned int) pIhw->AppData.dsIdle_count[0] +
+- (unsigned int) pIhw->AppData.dsIdle_count[1],
+- (unsigned int) pIhw->AppData.dsBadHec_count[0] +
+- (unsigned int) pIhw->AppData.dsBadHec_count[1]);
+- if(len<=limit)
+- len += sprintf(buf+len, "\tOverflow Dropped Cell Cnt:\t%u\n",
+- (unsigned int) pIhw->AppData.dsOVFDrop_count[0] +
+- (unsigned int) pIhw->AppData.dsOVFDrop_count[1]);
+-
+- //UR8_MERGE_START CQ10700 Manjula K
+- if (len <= limit)
+- len +=
+- sprintf (buf + len,
+- "\tRx Packets Dropped Count:\t%lu\n\tRx Bad Packets Count:\t%lu\n\n",
+- priv->stats.rx_dropped, priv->stats.rx_errors);
++ seq_printf(m, "\n\t[Downstream/RX)]\n");
++ seq_printf (m,
++ "\tGood Cell Cnt:\t%u\n\tIdle Cell Cnt:\t%u\n\tBad Hec Cell Cnt:\t%u\n",
++ (unsigned int) pIhw->AppData.dsGood_count[0] +
++ (unsigned int) pIhw->AppData.dsGood_count[1],
++ (unsigned int) pIhw->AppData.dsIdle_count[0] +
++ (unsigned int) pIhw->AppData.dsIdle_count[1],
++ (unsigned int) pIhw->AppData.dsBadHec_count[0] +
++ (unsigned int) pIhw->AppData.dsBadHec_count[1]);
++ seq_printf(m, "\tOverflow Dropped Cell Cnt:\t%u\n",
++ (unsigned int) pIhw->AppData.dsOVFDrop_count[0] +
++ (unsigned int) pIhw->AppData.dsOVFDrop_count[1]);
++
++ //UR8_MERGE_START CQ10700 Manjula K
++ seq_printf (m,
++ "\tRx Packets Dropped Count:\t%lu\n\tRx Bad Packets Count:\t%lu\n\n",
++ priv->stats.rx_dropped, priv->stats.rx_errors);
+ //UR8_MERGE_END CQ10700
+
+ tn7sar_get_stats(pIhw->pOsContext);
+- if(len<=limit)
+- len += sprintf(buf+len, "\n[SAR AAL5 Stats]\n");
+- if(len<=limit)
+- len += sprintf(buf+len, "\tTx PDU's:\t%u\n\tRx PDU's:\t%u\n",
+- sarStat.txPktCnt, sarStat.rxPktCnt);
+- if(len<=limit)
+- len +=
+- sprintf (buf + len, "\tTx Total Bytes:\t%u\n\tRx Total Bytes:\t%u\n",
+- sarStat.txBytes, sarStat.rxBytes);
+- if (len <= limit)
+- len +=
+- sprintf (buf + len,
+- "\tTx Total Error Counts:\t%u\n\tRx Total Error Counts:\t%u\n\n",
+- sarStat.txErrors, sarStat.rxErrors);
++ seq_printf(m, "\n[SAR AAL5 Stats]\n");
++ seq_printf(m, "\tTx PDU's:\t%u\n\tRx PDU's:\t%u\n",
++ sarStat.txPktCnt, sarStat.rxPktCnt);
++ seq_printf (m, "\tTx Total Bytes:\t%u\n\tRx Total Bytes:\t%u\n",
++ sarStat.txBytes, sarStat.rxBytes);
++ seq_printf (m,
++ "\tTx Total Error Counts:\t%u\n\tRx Total Error Counts:\t%u\n\n",
++ sarStat.txErrors, sarStat.rxErrors);
+
+ /*
+ * oam loopback info
+ */
+- if(len<=limit)
+- len += sprintf(buf+len, "\n[OAM Stats]\n");
++ seq_printf(m, "\n[OAM Stats]\n");
+
+ tn7sar_get_near_end_loopback_count(&F4count, &F5count);
+
+- if(len<=limit)
+- {
+- len +=
+- sprintf (buf + len,
+- "\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",
++ seq_printf (m,
++ "\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",
+ F5count, F4count, oamFarLBCount[0] + oamFarLBCount[2],
+ oamFarLBCount[1] + oamFarLBCount[3]);
+- }
+
+ #define USE_OAM_DROP_COUNT //CQ10273
+ //Read OAM ping responses count:
+ #ifdef USE_OAM_DROP_COUNT
+- if(len<=limit)
+- {
+- /* len +=
+- sprintf (buf + len,
+- "\tSAR OAM Retry in 0x%X cycles, Drop Count=%d\n",
+- tn7dsl_get_memory(0xa30085cc), tn7dsl_get_memory(0xa30085c4)); */
++/* seq_printf (m,
++ "\tSAR OAM Retry in 0x%X cycles, Drop Count=%d\n",
++ tn7dsl_get_memory(0xa30085cc), tn7dsl_get_memory(0xa30085c4)); */
+
+- len += sprintf (buf + len, "\tSAR OAM Ping Response Drop Count=%d\n",
+- tn7dsl_get_memory(0xa30085b0));
+- }
++ seq_printf (m, "\tSAR OAM Ping Response Drop Count=%d\n",
++ tn7dsl_get_memory(0xa30085b0));
+ #endif // USE_OAM_DROP_COUNT
+
+- return len;
++ return 0;
+ }
+
+-int tn7dsl_proc_modem(char* buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_stats_open(struct inode *inode, struct file *file)
+ {
++ return single_open(file, tn7dsl_proc_stats, PDE_DATA(inode));
++}
+
+- int len = 0;
+- int limit = count - 80;
++int tn7dsl_proc_write_stats (struct file *fp, const char *buf, unsigned long count, void *data);
++
++struct file_operations tn7dsl_proc_stats_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_stats_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++ .write = tn7dsl_proc_write_stats,
++};
+
++static int tn7dsl_proc_modem(struct seq_file *m, void *data)
++{
+ char *state;
+ int tag;
+
+@@ -1859,16 +1775,26 @@ int tn7dsl_proc_modem(char* buf, char **
+
+ if(pIhw->lConnected == 1)
+ state = "SHOWTIME";
+- if(len<=limit)
+- len += sprintf(buf+len,"%s\n",state);
+- if(len<=limit)
+- len += sprintf(buf+len, "%d\n", dslReg);
+- if(len<=limit)
+- len += sprintf(buf+len, "failTrains=%d\n", pIhw->AppData.trainFails);
++ seq_printf(m,"%s\n",state);
++ seq_printf(m, "%d\n", dslReg);
++ seq_printf(m, "failTrains=%d\n", pIhw->AppData.trainFails);
+
+- return len;
++ return 0;
++}
++
++static int tn7dsl_proc_modem_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7dsl_proc_modem, PDE_DATA(inode));
+ }
+
++struct file_operations tn7dsl_proc_modem_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_modem_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+ /**********************************************************************
+ ** *
+ ** tn7dsl_hdlc_update_crc() -- Calculate CRC *
+@@ -2133,11 +2059,8 @@ static int tn7dsl_hdlc_rx_process(unsign
+ return(ret);
+ }
+
+-int tn7dsl_proc_eoc (char *buf, char **start, off_t OffSet, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_eoc (struct seq_file *m, void *data)
+ {
+- int len = 0;
+- int limit = count - 80;
+ int offset[2] = {34, 0}; // point to buffer parameter data structure
+ clearEocParm_t peoc;
+
+@@ -2146,62 +2069,49 @@ int tn7dsl_proc_eoc (char *buf, char **s
+ (unsigned char *) &peoc,
+ sizeof (clearEocParm_t));
+
+- if (len <= limit)
+- len += sprintf(buf+len, "\nClear EOC Channel:\n\n");
+- if (len <= limit)
+- len += sprintf(buf+len, " Enabled:\t%d\n", dslhal_support_byteSwap32(peoc.clearEocEnabled));
+- if (len <= limit)
+- len += sprintf(buf+len, " TxBuf[0]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[0]));
+- if (len <= limit)
+- len += sprintf(buf+len, " TxBuf[1]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[1]));
+- if (len <= limit)
+- len += sprintf(buf+len, " TxBuf[2]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[2]));
+- if (len <= limit)
+- len += sprintf(buf+len, " TxBuf[3]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[3]));
+- if (len <= limit)
+- len += sprintf(buf+len, " RxBuf[0]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[0]));
+- if (len <= limit)
+- len += sprintf(buf+len, " RxBuf[1]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[1]));
+- if (len <= limit)
+- len += sprintf(buf+len, " RxBuf[2]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[2]));
+- if (len <= limit)
+- len += sprintf(buf+len, " RxBuf[3]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[3]));
+- if (len <= limit)
+- len += sprintf(buf+len, " txRdIndex:\t%d\n", dslhal_support_byteSwap32(peoc.txRdIndex));
+- if (len <= limit)
+- len += sprintf(buf+len, " txWrIndex:\t%d\n", dslhal_support_byteSwap32(peoc.txWrIndex));
+- if (len <= limit)
+- len += sprintf(buf+len, " rxRdIndex:\t%d\n", dslhal_support_byteSwap32(peoc.rxRdIndex));
+- if (len <= limit)
+- len += sprintf(buf+len, " rxWrIndex:\t%d\n\n", dslhal_support_byteSwap32(peoc.rxWrIndex));
+- if (len <= limit)
+- len += sprintf(buf+len, " TotalTxPkts:\t%d\n", EocTxTotalPackets);
+- if (len <= limit)
+- len += sprintf(buf+len, " TotalRxPkts:\t%d\n", EocRxTotalPackets);
+- if (len <= limit)
+- len += sprintf(buf+len, " TotalTxBytes:\t%d\n", EocTxTotalBytes);
+- if (len <= limit)
+- len += sprintf(buf+len, " TotalRxBytes:\t%d\n\n", EocRxTotalBytes);
+- if (len <= limit)
+- len += sprintf(buf+len, " ErrBufFull:\t%d\n", ErrEocBufFull);
+- if (len <= limit)
+- len += sprintf(buf+len, " ErrBufIndx:\t%d\n", ErrEocBufIndex);
+- if (len <= limit)
+- len += sprintf(buf+len, " ErrBufMax:\t%d\n", ErrEocBufMax);
+- if (len <= limit)
+- len += sprintf(buf+len, " ErrMsgMax:\t%d\n", ErrEocMsgOversized);
+- if (len <= limit)
+- len += sprintf(buf+len, " ErrTxHDLC:\t%d\n", ErrEocTxHdlcCRC);
+- if (len <= limit)
+- len += sprintf(buf+len, " ErrRxHDLC:\t%d\n", ErrEocRxHdlcCRC);
+- if (len <= limit)
+- len += sprintf(buf+len, " ErrRxSnmp:\t%d\n", ErrEocRxHdlcFraming);
+- if (len <= limit)
+- len += sprintf(buf+len, " ErrRxPush:\t%d\n\n", ErrEocRxPush);
++ seq_printf(m, "\nClear EOC Channel:\n\n");
++ seq_printf(m, " Enabled:\t%d\n", dslhal_support_byteSwap32(peoc.clearEocEnabled));
++ seq_printf(m, " TxBuf[0]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[0]));
++ seq_printf(m, " TxBuf[1]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[1]));
++ seq_printf(m, " TxBuf[2]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[2]));
++ seq_printf(m, " TxBuf[3]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[3]));
++ seq_printf(m, " RxBuf[0]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[0]));
++ seq_printf(m, " RxBuf[1]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[1]));
++ seq_printf(m, " RxBuf[2]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[2]));
++ seq_printf(m, " RxBuf[3]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[3]));
++ seq_printf(m, " txRdIndex:\t%d\n", dslhal_support_byteSwap32(peoc.txRdIndex));
++ seq_printf(m, " txWrIndex:\t%d\n", dslhal_support_byteSwap32(peoc.txWrIndex));
++ seq_printf(m, " rxRdIndex:\t%d\n", dslhal_support_byteSwap32(peoc.rxRdIndex));
++ seq_printf(m, " rxWrIndex:\t%d\n\n", dslhal_support_byteSwap32(peoc.rxWrIndex));
++ seq_printf(m, " TotalTxPkts:\t%d\n", EocTxTotalPackets);
++ seq_printf(m, " TotalRxPkts:\t%d\n", EocRxTotalPackets);
++ seq_printf(m, " TotalTxBytes:\t%d\n", EocTxTotalBytes);
++ seq_printf(m, " TotalRxBytes:\t%d\n\n", EocRxTotalBytes);
++ seq_printf(m, " ErrBufFull:\t%d\n", ErrEocBufFull);
++ seq_printf(m, " ErrBufIndx:\t%d\n", ErrEocBufIndex);
++ seq_printf(m, " ErrBufMax:\t%d\n", ErrEocBufMax);
++ seq_printf(m, " ErrMsgMax:\t%d\n", ErrEocMsgOversized);
++ seq_printf(m, " ErrTxHDLC:\t%d\n", ErrEocTxHdlcCRC);
++ seq_printf(m, " ErrRxHDLC:\t%d\n", ErrEocRxHdlcCRC);
++ seq_printf(m, " ErrRxSnmp:\t%d\n", ErrEocRxHdlcFraming);
++ seq_printf(m, " ErrRxPush:\t%d\n\n", ErrEocRxPush);
+
+- return len;
++ return 0;
++}
++
++static int tn7dsl_proc_eoc_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7dsl_proc_eoc, PDE_DATA(inode));
+ }
+
++struct file_operations tn7dsl_proc_eoc_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_eoc_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+ int tn7dsl_clear_eoc_setup(void)
+ {
+ int i;
+@@ -4440,14 +4350,10 @@ int tn7dsl_proc_write_stats (struct file
+ }
+
+
+-int tn7dsl_proc_train_mode_export (char *buf, char **start, off_t offset,
+- int count, int *eof, void *data)
++static int tn7dsl_proc_train_mode_export (struct seq_file *m, void *data)
+ {
+
+- int len = 0;
+- char *cp = buf + offset;
+ int i = 0;
+- static int ctr = 0;
+
+ typedef struct
+ {
+@@ -4528,197 +4434,185 @@ int tn7dsl_proc_train_mode_export (char
+ }
+
+
+- if(len <= count)
++ for (i = 0; (i < num_entries) ; i++)
+ {
+- for (i = ctr; ((i < num_entries)&& (len <= count)) ; i++)
+- {
+- /*
+- * Write the current string only if we can fit it into the buffer
+- */
+- if((strlen(dsl_modes[i].mode_name) + 6 + len) <= count)
+- {
+- len += snprintf(cp+len, (count - len), "%s\t\t\t%#x\n",
+- dsl_modes[i].mode_name, dsl_modes[i].mode_value);
+- }
+- else
+- break;
+- }
++ seq_printf(m, "%s\t\t\t%#x\n",
++ dsl_modes[i].mode_name, dsl_modes[i].mode_value);
+ }
+
+- /*
+- * Data was completely written
+- */
+- if (i >= num_entries)
+- {
+- /*
+- * We are done with this
+- */
+- *eof = 1;
+- ctr = 0;
+- }
+- else
+- {
+- /*
+- * We have not been able to write the complete data, and we have to nul
+- * terminate the buffer.
+- */
+- *(cp + len) = '\0';
+-
+- /*
+- * Save the value of the counter for the next read for the rest of the
+- * data.
+- */
+- ctr = i;
+- }
+-
+- return len;
++ return 0;
+ }
+
+-#ifndef NO_ADV_STATS
+-int tn7dsl_proc_SNRpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data)
++static int tn7dsl_proc_train_mode_export_open(struct inode *inode, struct file *file)
+ {
+- int len = 0;
+-
++ return single_open(file, tn7dsl_proc_train_mode_export, PDE_DATA(inode));
++}
+
++struct file_operations tn7dsl_proc_train_mode_export_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_train_mode_export_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
+
+- int limit = count - 80;
++#ifndef NO_ADV_STATS
++int tn7dsl_proc_SNRpsds(struct seq_file *m, void *data)
++{
+ int i;
+ unsigned char SNRpsds[512];
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nAR7 SNRpsds:");
++ seq_printf(m, "\nAR7 SNRpsds:");
+
+ if (dslhal_api_getSNRpsds(pIhw, SNRpsds, 1))
+ {
+ dgprintf(4, "dslhal_api_getSNRpsds failed!\n");
+- return len;
++ return -EIO;
+ }
+
+ for (i=0; i<pIhw->AppData.max_ds_tones; i++)
+ {
+ if (!(i%16))
+ {
+- if(len <=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+
+- if(len <=limit)
+- len += sprintf(buf+len, "%d ", (unsigned char)SNRpsds[i]);
++ seq_printf(m, "%d ", (unsigned char)SNRpsds[i]);
+ }
+
+- if(len <=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+
+
+
+- return len;
++ return 0;
+ }
+
++static int tn7dsl_proc_SNRpsds_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7dsl_proc_SNRpsds, PDE_DATA(inode));
++}
++
++struct file_operations tn7dsl_proc_SNRpsds_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_SNRpsds_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+ #endif
+
+ #ifndef NO_ADV_STATS
+-int tn7dsl_proc_QLNpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data)
++static int tn7dsl_proc_QLNpsds(struct seq_file *m, void *data)
+ {
+- int len = 0;
+-
+- int limit = count - 80;
+ unsigned char QLNpsds[512];
+ int i;
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nAR7 QLNpsds:");
++ seq_printf(m, "\nAR7 QLNpsds:");
+
+ // call API instead of access internal buf directly
+ if (dslhal_api_getQLNpsds(pIhw, QLNpsds, 0))
+ {
+ dgprintf(4, "dslhal_api_getQLNpsds failed!\n");
+- return len;
++ return -EIO;
+ }
+
+ for (i=0; i<pIhw->AppData.max_ds_tones; i++)
+ {
+ if (!(i%16))
+ {
+- if(len <=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+
+- if(len <=limit)
+- len += sprintf(buf+len, "%d ", (unsigned char)QLNpsds[i]);
++ seq_printf(m, "%d ", (unsigned char)QLNpsds[i]);
+ }
+
+- if(len <=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+
+
+- return len;
++ return 0;
+ }
++
++static int tn7dsl_proc_QLNpsds_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7dsl_proc_QLNpsds, PDE_DATA(inode));
++}
++
++struct file_operations tn7dsl_proc_QLNpsds_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_QLNpsds_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+ #endif
+
+ // UR8_MERGE_START CQ10979 Jack Zhang
+ #ifdef TR69_HLIN_IN
+ #ifndef NO_ADV_STATS
+-int tn7dsl_proc_HLINpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data)
++static int tn7dsl_proc_HLINpsds(struct seq_file *m, void *data)
+ {
+- int len = 0;
+-
+- int limit = count - 80;
+ short HLINpsds[2*512];
+ int i;
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nAR7 HLINpsds:");
++ seq_printf(m, "\nAR7 HLINpsds:");
+
+ // call API instead of access internal buf directly
+ if (dslhal_api_getHLINpsds(pIhw, (unsigned char *)HLINpsds, 1))
+ {
+ dgprintf(4, "dslhal_api_getHLINpsds failed!\n");
+- return len;
++ return -EIO;
+ }
+
+ for (i=0; i<pIhw->AppData.max_ds_tones; i++)
+ {
+ if (!(i%8))
+ {
+- if(len <=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+
+- if(len <=limit)
+- len += sprintf(buf+len, "(%d,%d) ", HLINpsds[2*i], HLINpsds[2*i+1]);
++ seq_printf(m, "(%d,%d) ", HLINpsds[2*i], HLINpsds[2*i+1]);
+ }
+
+- if(len <=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+
+
+- return len;
++ return 0;
+ }
+
+-static int tn7dsl_proc_HLINpsdsIndx(char* buf, char **start, off_t offset, int count,int *eof, void *data, int indx)
++static int tn7dsl_proc_HLINpsds_open(struct inode *inode, struct file *file)
+ {
+- int len = 0;
++ return single_open(file, tn7dsl_proc_HLINpsds, PDE_DATA(inode));
++}
+
+- int limit = count - 80;
++struct file_operations tn7dsl_proc_HLINpsds_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_HLINpsds_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++static int tn7dsl_proc_HLINpsdsIndx(struct seq_file *m, void *data, int indx)
++{
+ short HLINpsds[2*512];
+ int i;
+ int start=0, dim=128;
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nAR7 HLINpsds: (section %d)", indx);
++ seq_printf(m, "\nAR7 HLINpsds: (section %d)", indx);
+
+ if((indx > 2) && (pIhw->AppData.max_ds_tones <= 256))
+ {
+- if(len <=limit)
+- len += sprintf(buf+len, "\n[End of data]");
+- return len;
++ seq_printf(m, "\n[End of data]");
++ return 0;
+ }
+
+ // call API instead of access internal buf directly
+ if (dslhal_api_getHLINpsds(pIhw, (unsigned char *)HLINpsds, 1))
+ {
+ dgprintf(4, "dslhal_api_getHLINpsds failed!\n");
+- return len;
++ return -EIO;
+ }
+
+ start = (indx -1) * 128;
+@@ -4727,39 +4621,89 @@ static int tn7dsl_proc_HLINpsdsIndx(char
+ {
+ if (!(i%8))
+ {
+- if(len <=limit)
+- len += sprintf(buf+len, "\n%d: ", i);
++ seq_printf(m, "\n%d: ", i);
+ }
+
+- if(len <=limit)
+- len += sprintf(buf+len, "(%d,%d) ", HLINpsds[2*i], HLINpsds[2*i+1]);
++ seq_printf(m, "(%d,%d) ", HLINpsds[2*i], HLINpsds[2*i+1]);
+ }
+
+- if(len <=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+
+- return len;
++ return 0;
++}
++
++static int tn7dsl_proc_HLINpsds1(struct seq_file *m, void *data)
++{
++ return tn7dsl_proc_HLINpsdsIndx(m, data, 1);
++}
++
++static int tn7dsl_proc_HLINpsds2(struct seq_file *m, void *data)
++{
++ return tn7dsl_proc_HLINpsdsIndx(m, data, 2);
++}
++
++static int tn7dsl_proc_HLINpsds3(struct seq_file *m, void *data)
++{
++ return tn7dsl_proc_HLINpsdsIndx(m, data, 3);
++}
++
++static int tn7dsl_proc_HLINpsds4(struct seq_file *m, void *data)
++{
++ return tn7dsl_proc_HLINpsdsIndx(m, data, 4);
+ }
+
+-int tn7dsl_proc_HLINpsds1(char* buf, char **start, off_t offset, int count,int *eof, void *data)
++static int tn7dsl_proc_HLINpsds1_open(struct inode *inode, struct file *file)
+ {
+- return tn7dsl_proc_HLINpsdsIndx(buf, start, offset, count,eof, data, 1);
++ return single_open(file, tn7dsl_proc_HLINpsds1, PDE_DATA(inode));
+ }
+
+-int tn7dsl_proc_HLINpsds2(char* buf, char **start, off_t offset, int count,int *eof, void *data)
++static int tn7dsl_proc_HLINpsds2_open(struct inode *inode, struct file *file)
+ {
+- return tn7dsl_proc_HLINpsdsIndx(buf, start, offset, count,eof, data, 2);
++ return single_open(file, tn7dsl_proc_HLINpsds2, PDE_DATA(inode));
+ }
+
+-int tn7dsl_proc_HLINpsds3(char* buf, char **start, off_t offset, int count,int *eof, void *data)
++static int tn7dsl_proc_HLINpsds3_open(struct inode *inode, struct file *file)
+ {
+- return tn7dsl_proc_HLINpsdsIndx(buf, start, offset, count,eof, data, 3);
++ return single_open(file, tn7dsl_proc_HLINpsds3, PDE_DATA(inode));
+ }
+
+-int tn7dsl_proc_HLINpsds4(char* buf, char **start, off_t offset, int count,int *eof, void *data)
++static int tn7dsl_proc_HLINpsds4_open(struct inode *inode, struct file *file)
+ {
+- return tn7dsl_proc_HLINpsdsIndx(buf, start, offset, count,eof, data, 4);
++ return single_open(file, tn7dsl_proc_HLINpsds4, PDE_DATA(inode));
+ }
++
++struct file_operations tn7dsl_proc_HLINpsds1_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_HLINpsds1_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++struct file_operations tn7dsl_proc_HLINpsds2_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_HLINpsds2_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++struct file_operations tn7dsl_proc_HLINpsds3_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_HLINpsds3_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++struct file_operations tn7dsl_proc_HLINpsds4_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_HLINpsds4_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+ #endif
+ #endif //TR69_HLIN_IN
+ // UR8_MERGE_END CQ10979*
+@@ -4767,64 +4711,48 @@ int tn7dsl_proc_HLINpsds4(char* buf, cha
+ // * UR8_MERGE_START CQ11057 Jack Zhang
+ #ifdef TR69_PMD_IN
+ #ifndef NO_ADV_STATS
+-int tn7dsl_proc_PMDus(char* buf, char **start, off_t offset, int count,int *eof, void *data)
++static int tn7dsl_proc_PMDus(struct seq_file *m, void *data)
+ {
+- int len = 0;
+-
+- int limit = count - 80;
+ int i;
+ CoPMDTestParams_t co_pmdtest_params;
+-
+- if(len<=limit)
+- len += sprintf(buf+len, "\nAR7 US PMD Test:\n");
++
++ seq_printf(m, "\nAR7 US PMD Test:\n");
+
+ // call API instead of access internal buf directly
+ if (dslhal_api_getPMDTestus(pIhw, &co_pmdtest_params, 0) != DSLHAL_ERROR_NO_ERRORS)
+ {
+ dgprintf(4, "dslhal_api_getPMDTestus failed!\n");
+- return len;
++ return -EIO;
+ }
+
+- if(len<=limit)
+- len += sprintf(buf+len, "LATN=%d\n", co_pmdtest_params.co_latn);
++ seq_printf(m, "LATN=%d\n", co_pmdtest_params.co_latn);
+
+- if(len<=limit)
+- len += sprintf(buf+len, "SATN=%d\n", co_pmdtest_params.co_satn);
++ seq_printf(m, "SATN=%d\n", co_pmdtest_params.co_satn);
+
+- if(len<=limit)
+- len += sprintf(buf+len, "SNRM=%d\n", co_pmdtest_params.usMargin);
++ seq_printf(m, "SNRM=%d\n", co_pmdtest_params.usMargin);
+
+- if(len<=limit)
+- len += sprintf(buf+len, "attndr=%ld\n", co_pmdtest_params.co_attndr);
++ seq_printf(m, "attndr=%ld\n", co_pmdtest_params.co_attndr);
+
+- if(len<=limit)
+- len += sprintf(buf+len, "NearActatp=%d\n", co_pmdtest_params.co_near_actatp);
++ seq_printf(m, "NearActatp=%d\n", co_pmdtest_params.co_near_actatp);
+
+- if(len<=limit)
+- len += sprintf(buf+len, "FarActatp=%d\n", co_pmdtest_params.co_far_actatp);
++ seq_printf(m, "FarActatp=%d\n", co_pmdtest_params.co_far_actatp);
+
+ //HLOG
+ for (i=0; i<pIhw->AppData.max_us_tones; i++)
+ {
+ if (!(i%16))
+- {
+- if(len <=limit)
+- len += sprintf(buf+len, "\nHLOG(%3d):", i);
+- }
+- if(len <=limit)
+- len += sprintf(buf+len, " %d", co_pmdtest_params.TestParmCOHlogfMsg[i]);
++ seq_printf(m, "\nHLOG(%3d):", i);
++
++ seq_printf(m, " %d", co_pmdtest_params.TestParmCOHlogfMsg[i]);
+ }
+
+ //QLN
+ for (i=0; i<pIhw->AppData.max_us_tones; i++)
+ {
+ if (!(i%16))
+- {
+- if(len <=limit)
+- len += sprintf(buf+len, "\nQLN(%3d):", i);
+- }
+- if(len <=limit)
+- len += sprintf(buf+len, " %d", co_pmdtest_params.TestParmCOQLNfMsg[i]);
++ seq_printf(m, "\nQLN(%3d):", i);
++
++ seq_printf(m, " %d", co_pmdtest_params.TestParmCOQLNfMsg[i]);
+
+ }
+
+@@ -4832,19 +4760,28 @@ int tn7dsl_proc_PMDus(char* buf, char **
+ for (i=0; i<pIhw->AppData.max_us_tones; i++)
+ {
+ if (!(i%16))
+- {
+- if(len <=limit)
+- len += sprintf(buf+len, "\nSNR(%3d):", i);
+- }
+- if(len <=limit)
+- len += sprintf(buf+len, " %d", co_pmdtest_params.TestParmCOSNRfMsg[i]);
++ seq_printf(m, "\nSNR(%3d):", i);
++ seq_printf(m, " %d", co_pmdtest_params.TestParmCOSNRfMsg[i]);
+ }
+
+- if(len <=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+
+- return len;
++ return 0;
++}
++
++static int tn7dsl_proc_PMDus_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7dsl_proc_PMDus, PDE_DATA(inode));
+ }
++
++struct file_operations tn7dsl_proc_PMDus_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_PMDus_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+ #endif //NO_ADV_STATS
+ #endif //TR69_PMD_IN
+ // * UR8_MERGE_END CQ11057 *
+--- a/tn7sar.c
++++ b/tn7sar.c
+@@ -1401,44 +1401,70 @@ int tn7sar_oam_generation(void *privCont
+ return 0;
+ }
+
+-int tn7sar_proc_oam_ping(char* buf, char **start, off_t offset, int count,int *eof, void *data)
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
++#define PDE_DATA(inode) PDE(inode)->data
++#endif
++
++static int tn7sar_proc_oam_ping(struct seq_file *m, void *data)
+ {
+- int len = 0;
+ unsigned int oam_ps = oamPingStatus;
+
+ if( oam_ps == OAM_PING_PENDING_RECVD )
+ oam_ps = OAM_PING_PENDING; //jz CQ9861: Only export the PENDING status, not internal state
+
+- len += sprintf(buf+len, "%d\n", oam_ps); //oamPingStatus);
++ seq_printf(m, "%d\n", oam_ps); //oamPingStatus);
+
+- return len;
++ return 0;
+ }
+
+-int tn7sar_proc_pvc_table(char* buf, char **start, off_t offset, int count,int *eof, void *data)
++static int tn7sar_proc_oam_ping_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7sar_proc_oam_ping, PDE_DATA(inode));
++}
++
++struct file_operations tn7sar_proc_oam_ping_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7sar_proc_oam_ping_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++
++static int tn7sar_proc_pvc_table(struct seq_file *m, void *data)
+ {
+- int len = 0;
+ int i;
+
+ for(i=0;i<16;i++)
+ {
+ if(pvc_result[i].bInUse)
+ {
+- len += sprintf(buf+len, "%d,%d\n", pvc_result[i].vpi,pvc_result[i].vci);
++ seq_printf(m, "%d,%d\n", pvc_result[i].vpi,pvc_result[i].vci);
+ }
+ else
+ {
+- len += sprintf(buf+len, "0,0\n");
++ seq_printf(m, "0,0\n");
+ }
+ }
+- return len;
++ return 0;
++}
++
++static int tn7sar_proc_pvc_table_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7sar_proc_pvc_table, PDE_DATA(inode));
+ }
+
++struct file_operations tn7sar_proc_pvc_table_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7sar_proc_pvc_table_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
+
+
+-int tn7sar_proc_sar_stat(char* buf, char **start, off_t offset, int count,int *eof, void *data)
++static int tn7sar_proc_sar_stat(struct seq_file *m, void *data)
+ {
+- int len = 0;
+- int limit = count - 80;
+ struct atm_dev *dev;
+ Tn7AtmPrivate *priv;
+ int i, j, k;
+@@ -1447,21 +1473,19 @@ int tn7sar_proc_sar_stat(char* buf, char
+ unsigned int *pStateBase, *pSarStat;
+ HAL_FUNCTIONS *pHalFunc;
+ HAL_DEVICE *pHalDev;
+- int dBytes;
+
+- dev = (struct atm_dev *)data;
++ dev = (struct atm_dev *)m->private;
+ priv = (Tn7AtmPrivate *)dev->dev_data;
+
+ pHalFunc = (HAL_FUNCTIONS *)priv->pSarHalFunc;
+ pHalDev = (HAL_DEVICE *)priv->pSarHalDev;
+
+- len += sprintf(buf+len, "SAR HAL Statistics");
++ seq_printf(m, "SAR HAL Statistics");
+ for(i=0;i<MAX_DMA_CHAN;i++)
+ {
+ if(priv->lut[i].inuse)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, "\nChannel %d:\n",priv->lut[i].chanid);
++ seq_printf(m, "\nChannel %d:\n",priv->lut[i].chanid);
+ k=0;
+ for(j=0;j<4;j++)
+ {
+@@ -1474,26 +1498,16 @@ int tn7sar_proc_sar_stat(char* buf, char
+ {
+ if((char *)*pSarStat == NULL)
+ break;
+- if(len<=limit)
+- {
+- dBytes = sprintf(buf+len, "%s: ",(char *) *pSarStat);
+- len += dBytes;
+- k += dBytes;
+- }
++
++ k += seq_printf(m, "%s: ",(char *) *pSarStat);
+ pSarStat++;
+- if(len<=limit)
+- {
+- dBytes = sprintf(buf+len, "%s; \n",(char *) *pSarStat);
+- len += dBytes;
+- k += dBytes;
+- }
++ k += seq_printf(m, "%s; \n",(char *) *pSarStat);
+ pSarStat++;
+
+ if(k > 60)
+ {
+ k=0;
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+ }
+
+@@ -1502,9 +1516,22 @@ int tn7sar_proc_sar_stat(char* buf, char
+ }
+ }
+
+- return len;
++ return 0;
+ }
+
++static int tn7sar_proc_sar_stat_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7sar_proc_sar_stat, PDE_DATA(inode));
++}
++
++struct file_operations tn7sar_proc_sar_stat_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7sar_proc_sar_stat_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+ void tn7sar_get_sar_firmware_version(unsigned int *pdsp_version_ms, unsigned int *pdsp_version_ls)
+ {
+
diff --git a/package/kernel/ar7-atm/patches-D7.05.01.00/160-module-params.patch b/package/kernel/ar7-atm/patches-D7.05.01.00/160-module-params.patch
index 75a41d1e36..9c504c0e33 100644
--- a/package/kernel/ar7-atm/patches-D7.05.01.00/160-module-params.patch
+++ b/package/kernel/ar7-atm/patches-D7.05.01.00/160-module-params.patch
@@ -147,7 +147,7 @@
#endif
#ifndef TRUE
-@@ -728,9 +868,9 @@
+@@ -728,9 +868,9 @@ static int __init tn7atm_irq_request (st
* interrupt pacing
*/
ptr = prom_getenv ("sar_ipacemax");
@@ -159,7 +159,7 @@
}
/* avalanche_request_pacing (priv->sar_irq, ATM_SAR_INT_PACING_BLOCK_NUM,
def_sar_inter_pace); */
-@@ -878,9 +1018,18 @@
+@@ -878,9 +1018,18 @@ static int __init tn7atm_get_ESI (struct
{
int i;
char esi_addr[ESI_LEN] = { 0x00, 0x00, 0x11, 0x22, 0x33, 0x44 };
@@ -180,7 +180,7 @@
if (!esiaddr_str)
{
-@@ -2139,15 +2288,15 @@
+@@ -2139,15 +2288,15 @@ static int tn7atm_autoDetectDspBoost (vo
//UR8_MERGE_END CQ10450*
cp = prom_getenv ("dsp_noboost");
@@ -200,7 +200,7 @@
if (dspfreq == 250)
{
boostDsp = 1;
-@@ -2396,15 +2545,17 @@
+@@ -2396,15 +2545,17 @@ static int __init tn7atm_init (struct at
// Inter-Op DSL phy Control
// Note the setting of _dsl_Feature_0 and _dsl_Feature_1 must before
// dslhal_api_dslStartup (in tn7dsl_init()).
@@ -222,7 +222,7 @@
_dsl_Feature_1_defined = 1;
}
-@@ -2412,15 +2563,17 @@
+@@ -2412,15 +2563,17 @@ static int __init tn7atm_init (struct at
// DSL phy Feature Control
// Note the setting of _dsl_PhyControl_0 and _dsl_PhyControl_1 must before
// dslhal_api_dslStartup (in tn7dsl_init()).
@@ -244,7 +244,7 @@
_dsl_PhyControl_1_defined = 1;
}
-@@ -2440,12 +2593,12 @@
+@@ -2440,12 +2593,12 @@ static int __init tn7atm_init (struct at
// read config for turbo dsl
ptr = prom_getenv ("TurboDSL");
@@ -259,7 +259,7 @@
#endif
}
else
-@@ -2459,33 +2612,33 @@
+@@ -2459,33 +2612,33 @@ static int __init tn7atm_init (struct at
priv->sarRxBuf = RX_BUFFER_NUM;
ptr = NULL;
ptr = prom_getenv ("SarRxBuf");
diff --git a/package/kernel/ar7-atm/patches-D7.05.01.00/200-2.6.37_args.patch b/package/kernel/ar7-atm/patches-D7.05.01.00/200-2.6.37_args.patch
index a3bff1b940..f6dba4be9f 100644
--- a/package/kernel/ar7-atm/patches-D7.05.01.00/200-2.6.37_args.patch
+++ b/package/kernel/ar7-atm/patches-D7.05.01.00/200-2.6.37_args.patch
@@ -1,6 +1,6 @@
--- a/tn7atm.c
+++ b/tn7atm.c
-@@ -2000,7 +2000,11 @@ static int __init tn7atm_register (Tn7At
+@@ -2009,7 +2009,11 @@ static int __init tn7atm_register (Tn7At
dgprintf (4, "device %s being registered\n", priv->name);
diff --git a/package/kernel/ar7-atm/patches-D7.05.01.00/220-3.10-update_proc_code.patch b/package/kernel/ar7-atm/patches-D7.05.01.00/220-3.10-update_proc_code.patch
new file mode 100644
index 0000000000..747869bf7c
--- /dev/null
+++ b/package/kernel/ar7-atm/patches-D7.05.01.00/220-3.10-update_proc_code.patch
@@ -0,0 +1,3102 @@
+From 42d0f4c2f5cf0f73edd827263dc65aefc8f82192 Mon Sep 17 00:00:00 2001
+From: Jonas Gorski <jogo@openwrt.org>
+Date: Thu, 26 Sep 2013 12:28:35 +0200
+Subject: [PATCH] update proc code to fix compilation for 3.10
+
+Signed-off-by: Jonas Gorski <jogo@openwrt.org>
+
+---
+ tn7api.h | 66 ++-
+ tn7atm.c | 395 ++++++++---------
+ tn7dsl.c | 1439 ++++++++++++++++++++++++++++++--------------------------------
+ tn7sar.c | 91 ++--
+ 4 files changed, 951 insertions(+), 1040 deletions(-)
+
+--- a/tn7api.h
++++ b/tn7api.h
+@@ -91,31 +91,29 @@ void * tn7atm_memcpy(void * dst, void co
+ /* tn7dsl.h */
+ void tn7dsl_exit(void);
+ int tn7dsl_init(void *priv);
+-int tn7dsl_proc_eoc(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_stats(char* buf, char **start, off_t offset, int count,int *eof, void *data);
++extern struct file_operations tn7dsl_proc_eoc_fops;
++extern struct file_operations tn7dsl_proc_stats_fops;
+
+ //#define ADV_DIAG_STATS 1 //CQ10275 To enable Adv Stats
+
+ #ifdef ADV_DIAG_STATS
+-int tn7dsl_proc_adv_stats(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_adv_stats1(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_adv_stats2(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_adv_stats3(char* buf, char **start, off_t offset, int count,int *eof, void *data);
++extern struct file_operations tn7dsl_proc_adv_stats_fops;
++extern struct file_operations tn7dsl_proc_adv1_stats_fops;
++extern struct file_operations tn7dsl_proc_adv2_stats_fops;
++extern struct file_operations tn7dsl_proc_adv3_stats_fops;
+ //UR8_MERGE_START CQ10682 Jack Zhang
+-int tn7dsl_proc_dbg_cmsgs(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_dbg_rmsgs1(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_dbg_rmsgs2(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_dbg_rmsgs3(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_dbg_rmsgs4(char* buf, char **start, off_t offset, int count,int *eof, void *data);
++extern struct file_operations tn7dsl_proc_dbg_cmsgs_fops;
++extern struct file_operations tn7dsl_proc_dbg_cmsgs1_fops;
++extern struct file_operations tn7dsl_proc_dbg_cmsgs2_fops;
++extern struct file_operations tn7dsl_proc_dbg_cmsgs3_fops;
++extern struct file_operations tn7dsl_proc_dbg_cmsgs4_fops;
+ //UR8_MERGE_END CQ10682*
+ #endif //ADV_DIAG_STATS
+
+-int tn7dsl_proc_write_stats(struct file *fp, const char * buf, unsigned long count, void * data);
+-int tn7dsl_proc_modem(char* buf, char **start, off_t offset, int count,int *eof, void *data);
++extern struct file_operations tn7dsl_proc_modem_fops;
+ //UR8_MERGE_START CQ11813 Hao-Ting
+ #ifdef LINUX_CLI_SUPPORT
+-int tn7dsl_proc_dbgmsg_write(struct file *fp, const char *buf, unsigned long count, void *data);
+-int tn7dsl_proc_dbgmsg_read(char* buf, char **start, off_t offset, int count,int *eof, void *data);
++extern struct file_operations tn7dsl_proc_dbgmsg_fops;
+ #endif
+ //UR8_MERGE_END CQ11813
+ int tn7dsl_handle_interrupt(void);
+@@ -142,31 +140,31 @@ int os_atoih(const char *pStr);
+ #endif
+
+ unsigned long os_atoul(const char *pStr);
+-int tn7dsl_proc_snr0(char* buf, char **start, off_t offset, int count, int *eof, void *data);
+-int tn7dsl_proc_snr1(char* buf, char **start, off_t offset, int count, int *eof, void *data);
+-int tn7dsl_proc_snr2(char* buf, char **start, off_t offset, int count, int *eof, void *data);
+-int tn7dsl_proc_bit_allocation(char* buf, char **start, off_t offset, int count, int *eof, void *data);
+-int tn7dsl_proc_ds_noise(char* buf, char **start, off_t offset, int count, int *eof, void *data);
+-int tn7dsl_proc_generic_read_result(char* buf, char **start, off_t offset, int count, int *eof, void *data);
+-int tn7dsl_proc_train_mode_export(char* buf, char **start, off_t offset, int count,int *eof, void *data);
++extern struct file_operations tn7dsl_proc_snr0_fops;
++extern struct file_operations tn7dsl_proc_snr1_fops;
++extern struct file_operations tn7dsl_proc_snr2_fops;
++extern struct file_operations tn7dsl_proc_bit_allocation_fops;
++extern struct file_operations tn7dsl_proc_ds_noise_fops;
++extern struct file_operations tn7dsl_proc_generic_read_result_fops;
++extern struct file_operations tn7dsl_proc_train_mode_export_fops;
+
+ #ifndef NO_ADV_STATS
+-int tn7dsl_proc_SNRpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_QLNpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data);
++extern struct file_operations tn7dsl_proc_SNRpsds_fops;
++extern struct file_operations tn7dsl_proc_QLNpsds_fops;
+ // * UR8_MERGE_START CQ10979 Jack Zhang
+ #ifdef TR69_HLIN_IN
+-//int tn7dsl_proc_HLINpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_HLINpsds1(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_HLINpsds2(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_HLINpsds3(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_HLINpsds4(char* buf, char **start, off_t offset, int count,int *eof, void *data);
++//extern struct file_operations tn7dsl_proc_HLINpsds_fops;
++extern struct file_operations tn7dsl_proc_HLINpsds1_fops;
++extern struct file_operations tn7dsl_proc_HLINpsds2_fops;
++extern struct file_operations tn7dsl_proc_HLINpsds3_fops;
++extern struct file_operations tn7dsl_proc_HLINpsds4_fops;
+ #endif //TR69_HLIN_IN
+ // * UR8_MERGE_END CQ10979*
+ // * UR8_MERGE_START CQ11057 Jack Zhang
+ #define TR69_PMD_IN
+ #ifdef TR69_PMD_IN
+-//int tn7dsl_proc_PMDus(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7dsl_proc_PMDus(char* buf, char **start, off_t offset, int count,int *eof, void *data);
++//extern struct file_operations tn7dsl_proc_PMDus_fops;
++extern struct file_operations tn7dsl_proc_PMDus_fops;
+ #endif //TR69_PMD_IN
+ // * UR8_MERGE_END CQ11057 *
+ #endif
+@@ -183,12 +181,12 @@ void tn7sar_get_sar_version(Tn7AtmPrivat
+ int tn7sar_get_near_end_loopback_count(unsigned int *pF4count, unsigned int *pF5count);
+ int tn7sar_oam_generation(void *privContext, int chan, int type, int vpi, int vci, int timeout);
+ int tn7sar_get_stats(void *priv1);
+-int tn7sar_proc_sar_stat(char* buf, char **start, off_t offset, int count,int *eof, void *data);
++extern struct file_operations tn7sar_proc_sar_stat_fops;
+ #ifdef AR7_EFM
+ void tn7sar_get_EFM_firmware_version(unsigned int *pdsp_version_ms, unsigned int *pdsp_version_ls);
+ #endif
+ void tn7sar_get_sar_firmware_version(unsigned int *pdsp_version_ms, unsigned int *pdsp_version_ls);
+-int tn7sar_proc_oam_ping(char* buf, char **start, off_t offset, int count,int *eof, void *data);
+-int tn7sar_proc_pvc_table(char* buf, char **start, off_t offset, int count,int *eof, void *data);
++extern struct file_operations tn7sar_proc_oam_ping_fops;
++extern struct file_operations tn7sar_proc_pvc_table_fops;
+ int tn7sar_tx_flush(void *privContext, int chan, int queue, int skip);
+ #endif __SGAPI_H
+--- a/tn7atm.c
++++ b/tn7atm.c
+@@ -265,11 +265,9 @@ MODULE_PARM_DESC(oam_lb_timeout, "OAM LB
+
+ #ifdef AR7_EFM
+ extern void tn7dsl_disable_alarm(void);
+-extern int tn7efm_proc_channels (char *buf, char **start,
+- off_t offset, int count, int *eof, void *data);
+-extern int tn7efm_proc_ctrl_read (char *buf, char **start, off_t offset, int count, int *eof, void *data);
+-extern int tn7efm_proc_ctrl_write (struct file *fp, const char *buf, unsigned long count, void *data);
+-extern int tn7efm_proc_info (char *buf, char **start, off_t offset, int count, int *eof, void *data);
++extern struct file_operations tn7efm_proc_channels_fops;
++extern struct file_operations tn7efm_proc_ctrl_fops;
++extern struct file_operations tn7efm_proc_info_fops;
+ extern unsigned int g_efm_proc_ctl;
+ extern struct net_device *mydev_efm;
+ extern Tn7AtmPrivate *mypriv;
+@@ -305,31 +303,17 @@ extern int tn7efm_register (Tn7AtmPrivat
+ static int tn7atm_irq_request (struct atm_dev *dev);
+ #endif
+
+-static int tn7atm_proc_version (char *buf, char **start, off_t offset,
+- int count, int *eof, void *data);
++static struct file_operations tn7atm_proc_version_fops;
+ static void tn7atm_exit (void);
+-static int tn7atm_proc_channels (char *buf, char **start, off_t offset,
+- int count, int *eof, void *data);
+-static int tn7atm_proc_private (char *buf, char **start, off_t offset,
+- int count, int *eof, void *data);
++static struct file_operations tn7atm_proc_channels_fops;
++static struct file_operations tn7atm_proc_private_fops;
+ inline static int tn7atm_queue_packet_to_sar (void *vcc1, void *skb1,
+ int chan);
+
+-static int tn7atm_xlate_proc_name (const char *name,
+- struct proc_dir_entry **ret,
+- const char **residual);
+-static int tn7atm_proc_match (int len, const char *name,
+- struct proc_dir_entry *de);
+-static int tn7atm_proc_qos_read (char *buf, char **start, off_t offset,
+- int count, int *eof, void *data);
+-static int tn7atm_proc_qos_write (struct file *fp, const char *buf,
+- unsigned long count, void *data);
++static struct file_operations tn7atm_proc_qos_fops;
+
+ // [KT]
+-static int tn7atm_proc_turbodsl_read (char *buf, char **start, off_t offset,
+- int count, int *eof, void *data);
+-static int tn7atm_proc_turbodsl_write (struct file *fp, const char *buf,
+- unsigned long count, void *data);
++static struct file_operations tn7atm_proc_turbodsl_fops;
+
+ //CT - Added function to return chipset Id
+ void tn7atm_get_chipsetId (char *pVerId);
+@@ -456,78 +440,83 @@ const char drv_proc_root_folder[] = "ava
+ static struct proc_dir_entry *root_proc_dir_entry = NULL;
+ #define DRV_PROC_MODE 0644
+ static int proc_root_already_exists = TRUE;
++
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
++#define PDE_DATA(inode) PDE(inode)->data
++#endif
++
+ static struct
+ {
+ const unsigned char name[32];
+- int (*read_func) (char* , char **, off_t , int ,int *, void *);
+- int (*write_func) (struct file *, const char * , unsigned long , void *);
++ struct file_operations *fops;
+
+ } proc_if[] = {
+ #ifdef AR7_EFM
+ #ifdef EFM_DEBUG
+- {"avsar_efm_channel", tn7efm_proc_channels, NULL},
++ {"avsar_efm_channel", &tn7efm_proc_channels_fops},
+ #endif
+- {"avsar_efm_info", tn7efm_proc_info, NULL},
+- {"avsar_efm_ctl", tn7efm_proc_ctrl_read, tn7efm_proc_ctrl_write},
++ {"avsar_efm_info", &tn7efm_proc_info_fops},
++ {"avsar_efm_ctl", &tn7efm_proc_ctrl_fops},
+ #endif
+- {"avsar_ver", tn7atm_proc_version, NULL},
+- {"avsar_channels", tn7atm_proc_channels, NULL},
+- {"avsar_sarhal_stats", tn7sar_proc_sar_stat, NULL},
+- {"avsar_oam_ping", tn7sar_proc_oam_ping, NULL},
+- {"avsar_pvc_table", tn7sar_proc_pvc_table, NULL},
+- {"avsar_rxsnr0", tn7dsl_proc_snr0, NULL},
+- {"avsar_rxsnr1", tn7dsl_proc_snr1, NULL},
+- {"avsar_rxsnr2", tn7dsl_proc_snr2, NULL},
+- {"clear_eoc_stats", tn7dsl_proc_eoc, NULL},
+- {"avsar_bit_allocation_table", tn7dsl_proc_bit_allocation, NULL},
+- {"avsar_dsl_modulation_schemes",tn7dsl_proc_train_mode_export, NULL},
++ {"avsar_ver", &tn7atm_proc_version_fops},
++ {"avsar_channels", &tn7atm_proc_channels_fops},
++ {"avsar_sarhal_stats", &tn7sar_proc_sar_stat_fops},
++ {"avsar_oam_ping", &tn7sar_proc_oam_ping_fops},
++ {"avsar_pvc_table", &tn7sar_proc_pvc_table_fops},
++ {"avsar_rxsnr0", &tn7dsl_proc_snr0_fops},
++ {"avsar_rxsnr1", &tn7dsl_proc_snr1_fops},
++ {"avsar_rxsnr2", &tn7dsl_proc_snr2_fops},
++ {"clear_eoc_stats", &tn7dsl_proc_eoc_fops},
++ {"avsar_bit_allocation_table", &tn7dsl_proc_bit_allocation_fops},
++ {"avsar_dsl_modulation_schemes",&tn7dsl_proc_train_mode_export_fops},
+ #ifndef NO_ADV_STATS
+- {"avsar_SNRpsds", tn7dsl_proc_SNRpsds, NULL},
+- {"avsar_QLNpsds", tn7dsl_proc_QLNpsds, NULL},
++ {"avsar_SNRpsds", &tn7dsl_proc_SNRpsds_fops},
++ {"avsar_QLNpsds", &tn7dsl_proc_QLNpsds_fops},
+ // * UR8_MERGE_START CQ10979 Jack Zhang
+ #ifdef TR69_HLIN_IN
+-// {"avsar_HLINpsds", tn7dsl_proc_HLINpsds, NULL},
+- {"avsar_HLINpsds1", tn7dsl_proc_HLINpsds1, NULL},
+- {"avsar_HLINpsds2", tn7dsl_proc_HLINpsds2, NULL},
+- {"avsar_HLINpsds3", tn7dsl_proc_HLINpsds3, NULL},
+- {"avsar_HLINpsds4", tn7dsl_proc_HLINpsds4, NULL},
++// {"avsar_HLINpsds", &tn7dsl_proc_HLINpsds_fops},
++ {"avsar_HLINpsds1", &tn7dsl_proc_HLINpsds1_fops},
++ {"avsar_HLINpsds2", &tn7dsl_proc_HLINpsds2_fops},
++ {"avsar_HLINpsds3", &tn7dsl_proc_HLINpsds3_fops},
++ {"avsar_HLINpsds4", &tn7dsl_proc_HLINpsds4_fops},
+ #endif //TR69_HLIN_IN
+ // * UR8_MERGE_END CQ10979*
+ // * UR8_MERGE_START CQ11057 Jack Zhang
+ #define TR69_PMD_IN
+ #ifdef TR69_PMD_IN
+- {"avsar_PMDTestus", tn7dsl_proc_PMDus, NULL},
+-// {"avsar_PMDTestus1", tn7dsl_proc_PMDus1, NULL},
++ {"avsar_PMDTestus", &tn7dsl_proc_PMDus_fops},
++// {"avsar_PMDTestus1", &tn7dsl_proc_PMDus1_fops},
+ #endif //TR69_PMD_IN
+ // * UR8_MERGE_END CQ11057 *
+ #endif
+- {"avsar_private", tn7atm_proc_private, NULL},
+- {"avsar_modem_training", tn7dsl_proc_modem, NULL},
+- {"avsar_modem_stats", tn7dsl_proc_stats, tn7dsl_proc_write_stats},
++ {"avsar_private", &tn7atm_proc_private_fops},
++ {"avsar_modem_training", &tn7dsl_proc_modem_fops},
++ {"avsar_modem_stats", &tn7dsl_proc_stats_fops},
+
+ #ifdef ADV_DIAG_STATS //CQ10275
+-//for 2.6 {"avsar_modem_adv_stats", tn7dsl_proc_adv_stats, NULL},
++//for 2.6 {"avsar_modem_adv_stats", &tn7dsl_proc_adv_stats_fops},
+ //For 2.4 kernel, due to proc file system size limitation
+- {"avsar_modem_adv_stats1", tn7dsl_proc_adv_stats1, NULL},
+- {"avsar_modem_adv_stats2", tn7dsl_proc_adv_stats2, NULL},
+- {"avsar_modem_adv_stats3", tn7dsl_proc_adv_stats3, NULL},
++ {"avsar_modem_adv_stats1", &tn7dsl_proc_adv_stats1_fops},
++ {"avsar_modem_adv_stats2", &tn7dsl_proc_adv_stats2_fops},
++ {"avsar_modem_adv_stats3", &tn7dsl_proc_adv_stats3_fops},
+ //UR8_MERGE_START CQ10682 Jack Zhang
+- {"avsar_modem_dbg_cmsgs", tn7dsl_proc_dbg_cmsgs, NULL},
+- {"avsar_modem_dbg_rmsgs1", tn7dsl_proc_dbg_rmsgs1, NULL},
+- {"avsar_modem_dbg_rmsgs2", tn7dsl_proc_dbg_rmsgs2, NULL},
+- {"avsar_modem_dbg_rmsgs3", tn7dsl_proc_dbg_rmsgs3, NULL},
+- {"avsar_modem_dbg_rmsgs4", tn7dsl_proc_dbg_rmsgs4, NULL},
++ {"avsar_modem_dbg_cmsgs", &tn7dsl_proc_dbg_cmsgs_fops},
++ {"avsar_modem_dbg_rmsgs1", &tn7dsl_proc_dbg_rmsgs1_fops},
++ {"avsar_modem_dbg_rmsgs2", &tn7dsl_proc_dbg_rmsgs2_fops},
++ {"avsar_modem_dbg_rmsgs3", &tn7dsl_proc_dbg_rmsgs3_fops},
++ {"avsar_modem_dbg_rmsgs4", &tn7dsl_proc_dbg_rmsgs4_fops},
+ // UR8_MERGE_END CQ10682*
+ #endif //ADV_DIAG_STATS
+ //UR8_MERGE_START CQ11813 Hao-Ting
+ #ifdef LINUX_CLI_SUPPORT
+- {"avsar_dbg_enable", tn7dsl_proc_dbgmsg_read, tn7dsl_proc_dbgmsg_write},
++ {"avsar_dbg_enable", &tn7dsl_proc_dbgmsg_fops},
+ #endif
+ //UR8_MERGE_END CQ11813
+- {"avsar_qos_enable", tn7atm_proc_qos_read, tn7atm_proc_qos_write},
++ {"avsar_qos_enable", &tn7atm_proc_qos_fops},
+ #if 1 /* [MS] */
+- {"avsar_turbodsl", tn7atm_proc_turbodsl_read, tn7atm_proc_turbodsl_write}
++ {"avsar_turbodsl", &tn7atm_proc_turbodsl_fops}
+ #endif
++
+ };
+
+ /* *INDENT-ON* */
+@@ -1811,76 +1800,81 @@ int tn7atm_receive (void *os_dev, int ch
+ return 0;
+ }
+
+-
+-static int tn7atm_proc_channels (char *buf, char **start, off_t offset,
+- int count, int *eof, void *data)
++static int tn7atm_proc_channels (struct seq_file *m, void *data)
+ {
+- int len = 0;
+- int limit = count - 80;
+ int i;
+
+ struct atm_dev *dev;
+ Tn7AtmPrivate *priv;
+
+- dev = (struct atm_dev *) data;
++ dev = (struct atm_dev *) m->private;
+ priv = (Tn7AtmPrivate *) dev->dev_data;
+
+- if (len <= limit)
+- len += sprintf (buf + len, "Chan Inuse ChanID VPI VCI \n");
+- if (len <= limit)
+- len +=
+- sprintf (buf + len,
++ seq_printf (m, "Chan Inuse ChanID VPI VCI \n");
++ seq_printf (m,
+ "------------------------------------------------------------------\n");
+
+ for (i = 0; i <= MAX_DMA_CHAN; i++)
+ {
+- if (len <= limit)
+- {
+- len += sprintf (buf + len,
+- " %02d %05d %05d %05d %05d \n",
+- i, priv->lut[i].inuse, priv->lut[i].chanid,
+- priv->lut[i].vpi, priv->lut[i].vci);
+- }
++ seq_printf (m,
++ " %02d %05d %05d %05d %05d \n",
++ i, priv->lut[i].inuse, priv->lut[i].chanid,
++ priv->lut[i].vpi, priv->lut[i].vci);
+ }
+
+- if (len <= limit)
+- len +=
+- sprintf (buf + len,
++ seq_printf (m,
+ "------------------------------------------------------------------\n");
+
+- return len;
++ return 0;
++}
++
++static int tn7atm_proc_channels_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7atm_proc_channels, PDE_DATA(inode));
+ }
+
+-static int tn7atm_proc_private (char *buf, char **start, off_t offset,
+- int count, int *eof, void *data)
++static struct file_operations tn7atm_proc_channels_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7atm_proc_channels_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++
++static int tn7atm_proc_private (struct seq_file *m, void *data)
+ {
+- int len = 0;
+- int limit = count - 80;
+ struct atm_dev *dev;
+ Tn7AtmPrivate *priv;
+
+- dev = (struct atm_dev *) data;
++ dev = (struct atm_dev *) m->private;
+ priv = (Tn7AtmPrivate *) dev->dev_data;
+
+- if (len <= limit)
+- len += sprintf (buf + len, "\nPrivate Data Structure(%s):\n", priv->name);
+- if (len <= limit)
+- len += sprintf (buf + len, "----------------------------------------\n");
+- if (len <= limit)
+- len += sprintf (buf + len, "priv: 0x%p\n", priv);
+- if (len <= limit)
+- len += sprintf (buf + len, "next: 0x%p", priv->next);
+- if (len <= limit)
+- len += sprintf (buf + len, "\tdev: 0x%p\n", priv->dev);
+-
+- if (len <= limit)
+- len += sprintf (buf + len, "tx_irq: %02d", priv->sar_irq);
+- if (len <= limit)
+- len += sprintf (buf + len, "rx_irq: %02d", priv->dsl_irq);
++ seq_printf (m, "\nPrivate Data Structure(%s):\n", priv->name);
++ seq_printf (m, "----------------------------------------\n");
++ seq_printf (m, "priv: 0x%p\n", priv);
++ seq_printf (m, "next: 0x%p", priv->next);
++ seq_printf (m, "\tdev: 0x%p\n", priv->dev);
++
++ seq_printf (m, "tx_irq: %02d", priv->sar_irq);
++ seq_printf (m, "rx_irq: %02d", priv->dsl_irq);
++
++ return 0;
++}
+
+- return len;
++static int tn7atm_proc_private_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7atm_proc_private, PDE_DATA(inode));
+ }
+
++static struct file_operations tn7atm_proc_private_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7atm_proc_private_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+ void tn7atm_sarhal_isr_register (void *os_dev, void *hal_isr,
+ int interrupt_num)
+ {
+@@ -2033,10 +2027,8 @@ static int __init tn7atm_register (Tn7At
+ return ATM_REG_OK;
+ }
+
+-static int tn7atm_proc_version (char *buf, char **start, off_t offset,
+- int count, int *eof, void *data)
++static int tn7atm_proc_version (struct seq_file *m, void *data)
+ {
+- int len = 0;
+ char dslVer[8];
+ char dspVer[10];
+ char chipsetID[32]; //CT CQ10076 - Added temporary buffer to store chipset Id
+@@ -2051,58 +2043,52 @@ static int tn7atm_proc_version (char *bu
+ priv = mydev->dev_data;
+
+ #ifdef AR7_EFM
+- len +=
+- sprintf (buf + len, "ATM/EFM Driver version:[%d.%02d.%02d.%02d]\n",
+- LINUXATM_VERSION_MAJOR, LINUXATM_VERSION_MINOR,
+- LINUXATM_VERSION_BUGFIX, LINUXATM_VERSION_BUILDNUM);
+-
++ seq_printf (m, "ATM/EFM Driver version:[%d.%02d.%02d.%02d]\n",
++ LINUXATM_VERSION_MAJOR, LINUXATM_VERSION_MINOR,
++ LINUXATM_VERSION_BUGFIX, LINUXATM_VERSION_BUILDNUM);
+ #else
+- len +=
+- sprintf (buf + len, "ATM Driver version:[%d.%02d.%02d.%02d]\n",
+- LINUXATM_VERSION_MAJOR, LINUXATM_VERSION_MINOR,
+- LINUXATM_VERSION_BUGFIX, LINUXATM_VERSION_BUILDNUM);
++ seq_printf (m, "ATM Driver version:[%d.%02d.%02d.%02d]\n",
++ LINUXATM_VERSION_MAJOR, LINUXATM_VERSION_MINOR,
++ LINUXATM_VERSION_BUGFIX, LINUXATM_VERSION_BUILDNUM);
+ #endif
+
+ tn7dsl_get_dslhal_version (dslVer);
+
+- len +=
+- sprintf (buf + len, "DSL HAL version: [%d.%02d.%02d.%02d]\n", dslVer[0],
+- dslVer[1], dslVer[2], dslVer[3]);
++ seq_printf (m, "DSL HAL version: [%d.%02d.%02d.%02d]\n", dslVer[0],
++ dslVer[1], dslVer[2], dslVer[3]);
+ tn7dsl_get_dsp_version (dspVer);
+
+ #ifdef EFM_DEBUG
+- len +=
+- sprintf (buf + len, "DSP Datapump version: [%d.%02d.%02d.%02d(%u)] ",
+- dspVer[4], dspVer[5], dspVer[6], dspVer[7], (unsigned char) dspVer[7]);
++ seq_printf (m, "DSP Datapump version: [%d.%02d.%02d.%02d(%u)] ",
++ dspVer[4], dspVer[5], dspVer[6], dspVer[7], (unsigned char) dspVer[7]);
+ #else
+- len +=
+- sprintf (buf + len, "DSP Datapump version: [%d.%02d.%02d.%02d] ",
+- dspVer[4], dspVer[5], dspVer[6], dspVer[7]);
++ seq_printf (m, "DSP Datapump version: [%d.%02d.%02d.%02d] ",
++ dspVer[4], dspVer[5], dspVer[6], dspVer[7]);
+ #endif
+ if (dspVer[8] == 2) // annex B
+- len += sprintf (buf + len, "Annex B\n");
++ seq_printf (m, "Annex B\n");
+ else if (dspVer[8] == 3) // annex c
+- len += sprintf (buf + len, "Annex c\n");
++ seq_printf (m, "Annex c\n");
+ else
+- len += sprintf (buf + len, "Annex A\n");
++ seq_printf (m, "Annex A\n");
+
+ tn7sar_get_sar_version (priv, &pSarVer);
+
+- len += sprintf (buf + len, "SAR HAL version: [");
++ seq_printf (m, "SAR HAL version: [");
+ for (i = 0; i < 8; i++)
+ {
+- len += sprintf (buf + len, "%c", pSarVer[i + 7]);
++ seq_printf (m, "%c", pSarVer[i + 7]);
+ }
+- len += sprintf (buf + len, "]\n");
++ seq_printf (m, "]\n");
+
+ tn7sar_get_sar_firmware_version (&pdspV1, &pdspV2);
+
+ #ifndef AR7_EFM
+- len += sprintf (buf + len, "PDSP Firmware version:[%01x.%02x]\n",
++ seq_printf (m, "PDSP Firmware version:[%01x.%02x]\n",
+ pdspV1, pdspV2);
+ #else
+
+- len += sprintf (buf + len, "PDSP Firmware version:[%01x.%02x](ATM)%c\n",
++ seq_printf (m, "PDSP Firmware version:[%01x.%02x](ATM)%c\n",
+ pdspV1, pdspV2, (priv->curr_TC_mode== TC_MODE_ATM) ? '*' : ' ');
+
+ tn7sar_get_EFM_firmware_version (&pdspV1, &pdspV2);
+@@ -2114,26 +2100,37 @@ static int tn7atm_proc_version (char *bu
+ #endif
+ str = "EFM";
+
+- len += sprintf (buf + len, "PDSP Firmware version:[%01x.%02x](%s)%c\n",
++ seq_printf (m, "PDSP Firmware version:[%01x.%02x](%s)%c\n",
+ pdspV1, pdspV2, str, (priv->curr_TC_mode== TC_MODE_PTM) ? '*' : ' ');
+
+ #endif
+
+ //CT CQ10076 - Added code to report chipset ID using proc file system
+ tn7atm_get_chipsetId(chipsetID);
+- len += sprintf (buf + len, "Chipset ID: [%s]\n",chipsetID);
++ seq_printf (m, "Chipset ID: [%s]\n",chipsetID);
++
++ return 0;
++}
+
+- return len;
++static int tn7atm_proc_version_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7atm_proc_version, PDE_DATA(inode));
+ }
+
++static struct file_operations tn7atm_proc_version_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7atm_proc_version_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+
+ /* Device detection */
+
+ static int __init tn7atm_detect (void)
+ {
+ Tn7AtmPrivate *priv;
+- struct proc_dir_entry *dsl_wr_file = NULL; /* Only for ones with a write
+- * function. */
+ int ctr;
+ const char *residual;
+
+@@ -2214,24 +2211,7 @@ static int __init tn7atm_detect (void)
+ */
+ for (ctr = 0; ctr < (NUM_ELEMS (proc_if)); ctr++)
+ {
+- /* Only if we have a write function, we create a normal proc file. */
+- if(proc_if[ctr].write_func)
+- {
+- dsl_wr_file = create_proc_entry (proc_if[ctr].name, DRV_PROC_MODE, root_proc_dir_entry);
+- if (dsl_wr_file)
+- {
+- dsl_wr_file->read_proc = proc_if[ctr].read_func;
+- dsl_wr_file->write_proc = proc_if[ctr].write_func;
+- dsl_wr_file->data = (void *)mydev; //UR8_MERGE_START_END CQ10700 Manjula K
+- }
+- dsl_wr_file = NULL;
+- }
+- else
+- {
+- /* Create a read-only entry. */
+- create_proc_read_entry (proc_if[ctr].name, 0, root_proc_dir_entry,
+- proc_if[ctr].read_func, mydev);
+- }
++ proc_create_data(proc_if[ctr].name, DRV_PROC_MODE, root_proc_dir_entry, proc_if[ctr].fops, (void *)mydev);
+ }
+
+ tn7dsl_dslmod_sysctl_register ();
+@@ -2711,73 +2691,18 @@ static int tn7atm_set_can_support_adsl2
+ return TRUE;
+ }
+
+-/*
+- * This function matches a name such as "serial", and that specified by the
+- * proc_dir_entry
+- */
+-static int tn7atm_proc_match (int len, const char *name,
+- struct proc_dir_entry *de)
++static int tn7atm_proc_qos_read(struct seq_file *m, void *data)
+ {
+- if (!de || !de->low_ino)
++ seq_printf (m, "\nEnableQoS = %d\n", EnableQoS);
+ return 0;
+- if (de->namelen != len)
+- return 0;
+- return !strncmp (name, de->name, len);
+-}
+-
+-/*
+- * This function parses a name such as "tty/driver/serial", and
+- * returns the struct proc_dir_entry for "/proc/tty/driver", and
+- * returns "serial" in residual.
+- */
+-static int tn7atm_xlate_proc_name (const char *name,
+- struct proc_dir_entry **ret,
+- const char **residual)
+-{
+- const char *cp = name, *next;
+- struct proc_dir_entry *de;
+- int len;
+- extern struct proc_dir_entry proc_root;
+-
+- de = &proc_root;
+- while (1)
+- {
+- next = strchr (cp, '/');
+- if (!next)
+- break;
+-
+- len = next - cp;
+- for (de = de->subdir; de; de = de->next)
+- {
+- if (tn7atm_proc_match (len, cp, de))
+- break;
+- }
+- if (!de)
+- return -ENOENT;
+- cp += len + 1;
+- }
+- *residual = cp;
+- *ret = de;
+-
+- return 0;
+-}
+-
+-static int tn7atm_proc_qos_read(char *buf, char **start, off_t offset, int count, int *eof, void *data)
+-{
+- int len = 0;
+-
+- len += sprintf (buf + len, "\nEnableQoS = %d\n", EnableQoS);
+- return len;
+
+ }
+
+ // [KT]
+-static int tn7atm_proc_turbodsl_read(char *buf, char **start, off_t offset, int count, int *eof, void *data)
++static int tn7atm_proc_turbodsl_read(struct seq_file *m, void *data)
+ {
+- int len = 0;
+-
+- len += sprintf (buf + len, "%d\n", bTurboDsl);
+- return len;
++ seq_printf (m, "%d\n", bTurboDsl);
++ return 0;
+ }
+
+ static int tn7atm_proc_qos_write(struct file *fp, const char *buf, unsigned long count, void *data)
+@@ -2812,7 +2737,7 @@ static int tn7atm_proc_qos_write(struct
+ }
+
+ // [KT]
+-int tn7atm_proc_turbodsl_write(struct file *fp, const char *buf, unsigned long count, void *data)
++static int tn7atm_proc_turbodsl_write(struct file *fp, const char *buf, unsigned long count, void *data)
+ {
+ char local_buf[10];
+
+@@ -2843,5 +2768,33 @@ int tn7atm_proc_turbodsl_write(struct fi
+ return count;
+ }
+
++static int tn7atm_proc_qos_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7atm_proc_qos_read, PDE_DATA(inode));
++}
++
++static struct file_operations tn7atm_proc_qos_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7atm_proc_qos_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++ .write = tn7atm_proc_qos_write,
++};
++
++static int tn7atm_proc_turbodsl_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7atm_proc_turbodsl_read, PDE_DATA(inode));
++}
++
++static struct file_operations tn7atm_proc_turbodsl_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7atm_proc_turbodsl_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++ .write = tn7atm_proc_turbodsl_write,
++};
++
+ module_init (tn7atm_detect);
+ module_exit (tn7atm_exit);
+--- a/tn7dsl.c
++++ b/tn7dsl.c
+@@ -233,6 +233,9 @@ static struct led_funcs ledreg[2];
+
+ #define tn7dsl_kfree_skb(x) dev_kfree_skb(x)
+
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
++#define PDE_DATA(inode) PDE(inode)->data
++#endif
+
+ //---------------------------------------------
+ // Begin Clear EOC definitions
+@@ -366,7 +369,7 @@ static void tn7dsl_register_dslss_led(vo
+ void tn7dsl_dslmod_sysctl_register(void);
+ void tn7dsl_dslmod_sysctl_unregister(void);
+ static int tn7dsl_clear_eoc_receive(void);
+-static int tn7dsl_proc_snr_print (char *buf, int count, int *eof, int data);
++static int tn7dsl_proc_snr_print (struct seq_file *m, int data);
+ /* end of internal functions */
+
+ // UR8_MERGE_START CQ11054 Jack Zhang
+@@ -698,11 +701,9 @@ void shim_osCriticalExit(void)
+ spin_unlock_irqrestore(&shimLock, flags);
+ }
+
+-static int tn7dsl_proc_snr_print (char *buf, int count, int *eof, int data)
++static int tn7dsl_proc_snr_print (struct seq_file *m, int data)
+ {
+
+- int len = 0;
+- int limit = count - 80;
+ int i, j;
+ int bin = (int) data;
+ unsigned short *rxSnrPerBin;
+@@ -723,95 +724,128 @@ static int tn7dsl_proc_snr_print (char *
+ break;
+
+ default:
+- if(len<=limit)
+- len += sprintf (buf + len, "\nInvalid bin selected Bin%d :\n", bin);
+- return len;
+-}
++ seq_printf (m, "\nInvalid bin selected Bin%d :\n", bin);
++ return 0;
++ }
+
+- if(len<=limit)
+- len += sprintf (buf + len, "\nAR7 DSL Modem Rx SNR Per Bin for Bin%d :\n", bin);
++ seq_printf (m, "\nAR7 DSL Modem Rx SNR Per Bin for Bin%d :\n", bin);
+
+ for (i=0; i<pIhw->AppData.max_ds_tones/16; i++)
+ {
+ for(j=0;j<16;j++)
+ {
+- if(len <=limit)
+- len +=
+- sprintf (buf + len, "%04x ",
++ seq_printf (m, "%04x ",
+ (unsigned short) rxSnrPerBin[i * 16 + j]);
+- }
+- if(len <=limit)
+- len += sprintf(buf+len, "\n");
+ }
++ seq_printf(m, "\n");
++ }
+
+- return len;
++ return 0;
+ }
+
+
+ //@Added SNR per bin info per customer request. 05-14-2004
+-int tn7dsl_proc_snr0 (char *buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_snr0 (struct seq_file *m, void *data)
+ {
+- return tn7dsl_proc_snr_print(buf, count, eof, 0);
++ return tn7dsl_proc_snr_print(m, 0);
+ }
+
+-int tn7dsl_proc_snr1 (char *buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_snr0_open(struct inode *inode, struct file *file)
+ {
+- return tn7dsl_proc_snr_print(buf, count, eof, 1);
++ return single_open(file, tn7dsl_proc_snr0, PDE_DATA(inode));
++}
++
++struct file_operations tn7dsl_proc_snr0_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_snr0_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++static int tn7dsl_proc_snr1 (struct seq_file *m, void *data)
++{
++ return tn7dsl_proc_snr_print(m, 1);
+ }
+
+-int tn7dsl_proc_snr2 (char *buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_snr1_open(struct inode *inode, struct file *file)
+ {
+- return tn7dsl_proc_snr_print(buf, count, eof, 2);
++ return single_open(file, tn7dsl_proc_snr1, PDE_DATA(inode));
+ }
+
++struct file_operations tn7dsl_proc_snr1_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_snr1_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++static int tn7dsl_proc_snr2 (struct seq_file *m, void *data)
++{
++ return tn7dsl_proc_snr_print(m, 2);
++}
++
++static int tn7dsl_proc_snr2_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7dsl_proc_snr2, PDE_DATA(inode));
++}
++
++struct file_operations tn7dsl_proc_snr2_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_snr2_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+ //@Added bit allocation table per customer request. 05-14-2004
+-int tn7dsl_proc_bit_allocation (char *buf, char **start, off_t offset,
+- int count, int *eof, void *data)
++static int tn7dsl_proc_bit_allocation (struct seq_file *m, void *data)
+ {
+
+- int len = 0;
+- int limit = count - 80;
+ int i, j;
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nAR7 DSL Modem US Bit Allocation:");
++ seq_printf(m, "\nAR7 DSL Modem US Bit Allocation:");
+
+ for(i=0; i<pIhw->AppData.max_us_tones; i++)
+ {
+ if (!(i%16))
+ {
+- if(len <=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+- if(len <=limit)
+- len +=
+- sprintf (buf + len, "%02x ",
+- (unsigned char) pIhw->AppData.BitAllocTblUstrm[i]);
++ seq_printf (m, "%02x ",
++ (unsigned char) pIhw->AppData.BitAllocTblUstrm[i]);
+ }
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\n\nAR7 DSL Modem DS Bit Allocation:\n");
++ seq_printf(m, "\n\nAR7 DSL Modem DS Bit Allocation:\n");
+
+ for (i=0; i<pIhw->AppData.max_ds_tones/16; i++)
+ {
+ for(j=0;j<16;j++)
+ {
+- if(len <=limit)
+- len +=
+- sprintf (buf + len, "%02x ",
+- (unsigned char) pIhw->AppData.BitAllocTblDstrm[i * 16 +
+- j]);
++ seq_printf (m, "%02x ",
++ (unsigned char) pIhw->AppData.BitAllocTblDstrm[i * 16 +
++ j]);
+ }
+- if(len <=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+
+- return len;
++ return 0;
++}
++
++int tn7dsl_proc_bit_allocation_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7dsl_proc_bit_allocation, PDE_DATA(inode));
+ }
+
++struct file_operations tn7dsl_proc_bit_allocation_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_bit_allocation_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+ #ifndef NO_ACT
+ int tn7dsl_proc_ds_noise(char* buf, char **start, off_t offset, int count,
+ int *eof, void *data)
+@@ -874,59 +908,48 @@ static char *pUnknown= "Unknown";
+ #ifdef ADV_DIAG_STATS //CQ10275, CQ10449
+ //UR8_MERGE_START CQ10449 Jack Zhang
+
+-static int proc_adv_stats_header(char* buf, int limit);
++static int proc_adv_stats_header(struct seq_file *m);
+
+-int tn7dsl_proc_adv_stats(char* buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_adv_stats(struct seq_file *m, void *data)
+ {
+
+- int len = 0;
+- int limit = count - 80;
+ //char *cp = buf + offset;
+ char *cp = buf;
+ int i = 0;
+ int strt = 32;
+- static int ctr = 0;
+
+ // printk("proc_adv_stats: buf=0x%X, ctr=%d, offset=%d, count=%d, eof=%d\n",
+ // (unsigned int)buf, ctr, offset, count, *eof);
+- if( ctr == 0)
+- {
+- len = proc_adv_stats_header( cp, limit);
++ proc_adv_stats_header(m);
+
+- if( len<=limit)
+- len += sprintf(cp+len, "\n\tBin No.\tBits:\tMargin:\tSNR\n");
+- }
+- else
+- {
+- strt = ctr;
+- }
++ seq_printf(m, "\n\tBin No.\tBits:\tMargin:\tSNR\n");
+
+ for( i =strt; i<512; i++)
+ {
+- if(len<=limit)
+- {
+- len += sprintf(cp+len, "\t%u\t%u\t%u\t%d\n", i,
++ seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
+ (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
+ (unsigned int)pIhw->AppData.marginTblDstrm[i],
+ (int)pIhw->AppData.rxSnrPerBin0[i]);
+- }
+- else
+- {
+- ctr = i;
+- //*eof = 0;
+- *(cp + len) = '\0';
+- printk("proc_adv_stats - return: ctr=%d, len=%d\n", ctr, len);
+- return len;
+- }
+ }
+- ctr = 0;
+- *eof = 1;
+ printk("proc_adv_stats - return: ctr=%d, len=%d\n", ctr, len);
+- return len;
++ return 0;
+ }
+
+-static int proc_adv_stats_header(char* buf, int limit)
++
++static int tn7dsl_proc_adv_stats_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7dsl_proc_adv_stats, PDE_DATA(inode));
++}
++
++struct file_operations tn7dsl_proc_adv_stats_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_adv_stats_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++static int proc_adv_stats_header(struct seq_file *m)
+ {
+ int len = 0;
+ int i = 0;
+@@ -935,66 +958,53 @@ static int proc_adv_stats_header(char* b
+ */
+
+ dslhal_api_gatherStatistics(pIhw);
+- if(len<=limit)
+- len += sprintf(buf+len, "\nAR7 DSL Modem Advanced Statistics:\n");
++ seq_printf(m, "\nAR7 DSL Modem Advanced Statistics:\n");
+
+- if(len<=limit)
++ if(pIhw->lConnected != 1)
+ {
+- if(pIhw->lConnected != 1)
+- {
+- pIhw->AppData.USConRate = 0;
+- pIhw->AppData.DSConRate = 0;
+- }
+- len +=
+- sprintf (buf + len,
++ pIhw->AppData.USConRate = 0;
++ pIhw->AppData.DSConRate = 0;
++ }
++ seq_printf (m,
+ "\t[Connection Rate]\tUS:\t%u\tDS:\t%u\n",
+ (unsigned int)pIhw->AppData.USConRate,
+ (unsigned int)pIhw->AppData.DSConRate );
+ }
+- if(len<=limit)
+ // UR8_MERGE_START CQ11054 Jack Zhang
++ if (dslhal_api_getHighPrecision())
+ {
+- if (dslhal_api_getHighPrecision())
+- {
+- len +=
+- sprintf (buf + len, "\t[Margin]\tUS:\t%d.%u\tDS:\t\t%d.%u\n",
+- gInt(pIhw->AppData.usMargin), gDot1(pIhw->AppData.usMargin),
+- gInt(pIhw->AppData.dsMargin), gDot1(pIhw->AppData.dsMargin));
+- }
+- else
+- {
+- len +=
+- sprintf (buf + len, "\t[Margin]\tUS:\t%u\tDS:\t\t%u\n",
+- (unsigned int)pIhw->AppData.usMargin,
+- (unsigned int)pIhw->AppData.dsMargin/2 );
+- }
++ seq_printf (m, "\t[Margin]\tUS:\t%d.%u\tDS:\t\t%d.%u\n",
++ gInt(pIhw->AppData.usMargin), gDot1(pIhw->AppData.usMargin),
++ gInt(pIhw->AppData.dsMargin), gDot1(pIhw->AppData.dsMargin));
++ }
++ else
++ {
++ seq_printf (m, "\t[Margin]\tUS:\t%u\tDS:\t\t%u\n",
++ (unsigned int)pIhw->AppData.usMargin,
++ (unsigned int)pIhw->AppData.dsMargin/2 );
+ }
+ // UR8_MERGE_END CQ11054*
+
+ /*
+ * Downstream/Upstream Interleaved Errors
+ */
+- if(len<=limit)
+- len += sprintf(buf+len, "\t[Interleave path] US (TX):\tCRC: \t%u\tFEC: \t%u\n",
++ seq_printf(m, "\t[Interleave path] US (TX):\tCRC: \t%u\tFEC: \t%u\n",
+ (unsigned int)pIhw->AppData.usICRC_errors,
+ (unsigned int)pIhw->AppData.usIFEC_errors);
+- if(len<=limit)
+- len += sprintf(buf+len, "\t[Interleave path] DS (RX):\tCRC: \t%u\tFEC: \t%u\n",
++ seq_printf(m, "\t[Interleave path] DS (RX):\tCRC: \t%u\tFEC: \t%u\n",
+ (unsigned int)pIhw->AppData.dsICRC_errors,
+ (unsigned int)pIhw->AppData.dsIFEC_errors);
+ /*
+ * Upstream/Downstream Fast Errors
+ */
+- if(len<=limit)
+- len += sprintf(buf+len, "\t[Fast path] US (TX): \tCRC: \t%u\tFEC: \t%u\n",
++ seq_printf(m, "\t[Fast path] US (TX): \tCRC: \t%u\tFEC: \t%u\n",
+ (unsigned int)pIhw->AppData.usFCRC_errors,
+ (unsigned int)pIhw->AppData.usFFEC_errors);
+- if(len<=limit)
+- len += sprintf(buf+len, "\t[Fast path] DS (RX):\tCRC: \t%u\tFEC: \t%u\n",
++ seq_printf(m, "\t[Fast path] DS (RX):\tCRC: \t%u\tFEC: \t%u\n",
+ (unsigned int)pIhw->AppData.dsFCRC_errors,
+ (unsigned int)pIhw->AppData.dsFFEC_errors);
+
+- return len;
++ return 0;
+ }
+
+ static int getDiagDisplayMode()
+@@ -1017,29 +1027,24 @@ static int getDiagDisplayMode()
+ ret = 2;
+ return ret;
+ }
+-int tn7dsl_proc_adv_stats1(char* buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++int tn7dsl_proc_adv_stats1(struct seq_file *m, void *data)
+ {
+
+- int len = 0;
+- int limit = count - 80;
+ int i;
+ int mode = 0; //mode = 0 => ADSL1 or ADSL2 & 2+
+ unsigned char SNRpsds[512];
+ int n;
+
+- len = proc_adv_stats_header( buf+len, limit);
++ proc_adv_stats_header( m);
+ mode = getDiagDisplayMode();
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\tBin No.\tBits:\tMargin:\tSNR (Part 1 of 3)\n");
++ seq_printf(m, "\tBin No.\tBits:\tMargin:\tSNR (Part 1 of 3)\n");
+
+ if(mode==1) //ADSL1
+ {
+ for( i =32; i<128; i++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
++ seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
+ (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
+ (unsigned int)pIhw->AppData.marginTblDstrm[i],
+ (int)pIhw->AppData.rxSnrPerBin0[i]);
+@@ -1050,26 +1055,34 @@ int tn7dsl_proc_adv_stats1(char* buf, ch
+ if (dslhal_api_getSNRpsds(pIhw, SNRpsds, 1))
+ {
+ dgprintf(4, "dslhal_api_getSNRpsds failed!\n");
+- return len;
++ return -EIO;
+ }
+ for( i =32; i<128; i++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
++ seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
+ (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
+ (unsigned int)pIhw->AppData.marginTblDstrm[i],
+ (i<pIhw->AppData.max_ds_tones)?(unsigned char)SNRpsds[i]:0);
+ }
+ }
+- return len;
++ return 0;
+ }
+
+-int tn7dsl_proc_adv_stats2(char* buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_adv_stats1_open(struct inode *inode, struct file *file)
+ {
++ return single_open(file, tn7dsl_proc_adv_stats1, PDE_DATA(inode));
++}
+
+- int len = 0;
+- int limit = count - 80;
++struct file_operations tn7dsl_proc_adv_stats1_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_adv_stats1_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++int tn7dsl_proc_adv_stats2(struct seq_file *m, void *data)
++{
+ int i;
+ int mode = 0; //mode = 0 => ADSL1 or ADSL2 & 2+
+ unsigned char SNRpsds[512];
+@@ -1079,12 +1092,10 @@ int tn7dsl_proc_adv_stats2(char* buf, ch
+ if( mode==1) //ADSL1
+ {
+ dslhal_api_gatherStatistics(pIhw);
+- if(len<=limit)
+- len += sprintf(buf+len, "\tBin No.\tBits:\tMargin:\tSNR (Part 2 of 3):\n");
++ seq_printf(m, "\tBin No.\tBits:\tMargin:\tSNR (Part 2 of 3):\n");
+ for( i =128; i<320; i++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
++ seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
+ (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
+ (unsigned int)pIhw->AppData.marginTblDstrm[i],
+ (int)pIhw->AppData.rxSnrPerBin0[i]);
+@@ -1095,26 +1106,35 @@ int tn7dsl_proc_adv_stats2(char* buf, ch
+ if (dslhal_api_getSNRpsds(pIhw, SNRpsds, 1))
+ {
+ dgprintf(4, "dslhal_api_getSNRpsds failed!\n");
+- return len;
++ return -EIO;
+ }
+ for( i =128; i<320; i++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
++ seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
+ (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
+ (unsigned int)pIhw->AppData.marginTblDstrm[i],
+ (i<pIhw->AppData.max_ds_tones)?(unsigned char)SNRpsds[i]:0);
+ }
+ }
+- return len;
++ return 0;
+ }
+
+-int tn7dsl_proc_adv_stats3(char* buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_adv_stats2_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7dsl_proc_adv_stats2, PDE_DATA(inode));
++}
++
++struct file_operations tn7dsl_proc_adv_stats2_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_adv_stats2_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++int tn7dsl_proc_adv_stats3(struct seq_file *m, void *data)
+ {
+
+- int len = 0;
+- int limit = count - 80;
+ int i;
+ int mode = 0; //mode = 0 => ADSL1 or ADSL2 & 2+
+ unsigned char SNRpsds[512];
+@@ -1124,12 +1144,10 @@ int tn7dsl_proc_adv_stats3(char* buf, ch
+ if( mode==1) //ADSL1
+ {
+ dslhal_api_gatherStatistics(pIhw);
+- if(len<=limit)
+- len += sprintf(buf+len, "\tBin No.\tBits:\tMargin:\tSNR (Part 3 of 3):\n");
++ seq_printf(m, "\tBin No.\tBits:\tMargin:\tSNR (Part 3 of 3):\n");
+ for( i =320; i<512; i++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
++ seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
+ (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
+ (unsigned int)pIhw->AppData.marginTblDstrm[i],
+ (int)pIhw->AppData.rxSnrPerBin0[i]);
+@@ -1140,283 +1158,287 @@ int tn7dsl_proc_adv_stats3(char* buf, ch
+ if (dslhal_api_getSNRpsds(pIhw, SNRpsds, 1))
+ {
+ dgprintf(4, "dslhal_api_getSNRpsds failed!\n");
+- return len;
++ return -EIO;
+ }
+ for( i =320; i<512; i++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, "\t%u\t%u\t%u\t%d\n", i,
++ seq_printf(m, "\t%u\t%u\t%u\t%d\n", i,
+ (unsigned int)pIhw->AppData.BitAllocTblDstrm[i],
+ (unsigned int)pIhw->AppData.marginTblDstrm[i],
+ (i<pIhw->AppData.max_ds_tones)?(unsigned char)SNRpsds[i]:0);
+ }
+ }
+- if(len<=limit)
+- len += sprintf(buf+len, "[End of Stats]\n");
+- return len;
++ seq_printf(m, "[End of Stats]\n");
++ return 0;
+ }
+-//UR8_MERGE_END CQ10449
+-//UR8_MERGE_START CQ10682 Jack Zhang
+-int tn7dsl_proc_dbg_cmsgs(char* buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++
++static int tn7dsl_proc_adv_stats3_open(struct inode *inode, struct file *file)
+ {
++ return single_open(file, tn7dsl_proc_adv_stats3, PDE_DATA(inode));
++}
+
+- int len = 0;
+- int limit = count - 80;
++struct file_operations tn7dsl_proc_adv_stats3_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_adv_stats3_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
+
++//UR8_MERGE_END CQ10449
++//UR8_MERGE_START CQ10682 Jack Zhang
++int tn7dsl_proc_dbg_cmsgs(struct seq_file *m, void *data)
++{
+ int rc=0;
+
+ dslhal_api_gatherStatistics(pIhw);
+
+- if(len<=limit)
+- len += sprintf(buf+len, "Training Messages (C-Msgs 1-5)..\n");
++ seq_printf(m, "Training Messages (C-Msgs 1-5)..\n");
+
+- if(len<=limit)
+- len += sprintf(buf+len, "ADSL2 DELT C-Msg1Ld \t Message Length:%d\n",
++ seq_printf(m, "ADSL2 DELT C-Msg1Ld \t Message Length:%d\n",
+ pIhw->adsl2DiagnosticMessages.cMsg1LdLen);
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg1LdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg1Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg1Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT C-Msg2Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg2LdLen);
++ seq_printf(m, "\nADSL2 DELT C-Msg2Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg2LdLen);
+
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg2LdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg2Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg2Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT C-Msg3Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg3LdLen);
++ seq_printf(m, "\nADSL2 DELT C-Msg3Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg3LdLen);
+
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg3LdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg3Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg3Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT C-Msg4Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg4LdLen);
++ seq_printf(m, "\nADSL2 DELT C-Msg4Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg4LdLen);
+
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg4LdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg4Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg4Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT C-Msg5Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg5LdLen);
++ seq_printf(m, "\nADSL2 DELT C-Msg5Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.cMsg5LdLen);
+
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.cMsg5LdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg5Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.cMsg5Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
+- return len;
++ seq_printf(m, "\n");
++ return 0;
+ }
+
+-int tn7dsl_proc_dbg_rmsgs1(char* buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_dbg_cmsgs_open(struct inode *inode, struct file *file)
+ {
++ return single_open(file, tn7dsl_proc_dbg_cmsgs, PDE_DATA(inode));
++}
+
+- int len = 0;
+- int limit = count - 80;
++struct file_operations tn7dsl_proc_dbg_cmsgs_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_dbg_cmsgs_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++
++int tn7dsl_proc_dbg_rmsgs1(struct seq_file *m, void *data)
++{
+
+ int rc=0;
+
+ dslhal_api_gatherStatistics(pIhw);
+
+- if(len<=limit)
+- len += sprintf(buf+len, "Training Messages (R-Msgs 1-3)..\n");
++ seq_printf(m, "Training Messages (R-Msgs 1-3)..\n");
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT R-Msg1Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsg1LdLen);
++ seq_printf(m, "\nADSL2 DELT R-Msg1Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsg1LdLen);
+
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsg1LdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg1Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg1Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT R-Msg2Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
++ seq_printf(m, "\nADSL2 DELT R-Msg2Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
+
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg2Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg2Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT R-Msg3Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
++ seq_printf(m, "\nADSL2 DELT R-Msg3Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg3Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg3Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
+- return len;
++ seq_printf(m, "\n");
++ return 0;
+ }
+
+-int tn7dsl_proc_dbg_rmsgs2(char* buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_dbg_rmsgs1_open(struct inode *inode, struct file *file)
+ {
++ return single_open(file, tn7dsl_proc_dbg_rmsgs1, PDE_DATA(inode));
++}
+
+- int len = 0;
+- int limit = count - 80;
++struct file_operations tn7dsl_proc_dbg_rmsgs1_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_dbg_rmsgs1_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++
++int tn7dsl_proc_dbg_rmsgs2(struct seq_file *m, void *data)
++{
+
+ int rc=0;
+
+ dslhal_api_gatherStatistics(pIhw);
+
+- if(len<=limit)
+- len += sprintf(buf+len, "Training Messages (R-Msgs 4-5)..\n");
++ seq_printf(m, "Training Messages (R-Msgs 4-5)..\n");
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT R-Msg4Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
++ seq_printf(m, "\nADSL2 DELT R-Msg4Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg4Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg4Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ len += sprintf(m, "\n");
+ }
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT R-Msg5Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
++ seq_printf(m, "\nADSL2 DELT R-Msg5Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg5Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg5Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
+- return len;
++ seq_printf(m, "\n");
++ return 0;
+ }
+
+-int tn7dsl_proc_dbg_rmsgs3(char* buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_dbg_rmsgs2_open(struct inode *inode, struct file *file)
+ {
++ return single_open(file, tn7dsl_proc_dbg_rmsgs2, PDE_DATA(inode));
++}
+
+- int len = 0;
+- int limit = count - 80;
++struct file_operations _fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_dbg_rmsgs2_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++int tn7dsl_proc_dbg_rmsgs3(struct seq_file *m, void *data)
++{
+
+ int rc=0;
+
+ dslhal_api_gatherStatistics(pIhw);
+
+- if(len<=limit)
+- len += sprintf(buf+len, "Training Messages (R-Msgs 6-7)..\n");
++ seq_printf(m, "Training Messages (R-Msgs 6-7)..\n");
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT R-Msg6Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
++ seq_printf(m, "\nADSL2 DELT R-Msg6Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg6Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg6Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT R-Msg7Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
++ seq_printf(m, "\nADSL2 DELT R-Msg7Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg7Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg7Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+
+- return len;
++ return 0;
+ }
+
+-int tn7dsl_proc_dbg_rmsgs4(char* buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_dbg_rmsgs3_open(struct inode *inode, struct file *file)
+ {
++ return single_open(file, tn7dsl_proc_dbg_rmsgs3, PDE_DATA(inode));
++}
+
+- int len = 0;
+- int limit = count - 80;
++struct file_operations tn7dsl_proc_dbg_rmsgs3_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_dbg_rmsgs3_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++int tn7dsl_proc_dbg_rmsgs4(struct seq_file *m, void *data)
++{
+
+ int rc=0;
+
+ dslhal_api_gatherStatistics(pIhw);
+
+- if(len<=limit)
+- len += sprintf(buf+len, "Training Messages (R-Msgs 8-9)..\n");
++ seq_printf(m, "Training Messages (R-Msgs 8-9)..\n");
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT R-Msg8Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
++ seq_printf(m, "\nADSL2 DELT R-Msg8Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg8Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg8Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nADSL2 DELT R-Msg9Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
++ seq_printf(m, "\nADSL2 DELT R-Msg9Ld \t Message Length:%d\n",pIhw->adsl2DiagnosticMessages.rMsgxLdLen);
+ for(rc=0;rc<pIhw->adsl2DiagnosticMessages.rMsgxLdLen;rc++)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg9Ld[rc]);
++ seq_printf(m, " %02x",(unsigned char)pIhw->adsl2DiagnosticMessages.rMsg9Ld[rc]);
+ if(rc!=0 && (rc%16==0))
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+
+- return len;
++ return 0;
+ }
++
++static int tn7dsl_proc_dbg_rmsgs4_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7dsl_proc_dbg_rmsgs4, PDE_DATA(inode));
++}
++
++struct file_operations tn7dsl_proc_dbg_rmsgs4_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_dbg_rmsgs4_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+ //UR8_MERGE_END CQ10682*
+ #endif //ADV_DIAG_STATS
+
+-int tn7dsl_proc_stats(char* buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_stats(struct seq_file *m, void *data)
+ {
+
+- int len = 0;
+- int limit = count - 80;
+ int F4count, F5count;
+ unsigned int maxRate=0;
+ unsigned int us_maxRate=0;
+@@ -1424,80 +1446,58 @@ int tn7dsl_proc_stats(char* buf, char **
+ //UR8_MERGE_START CQ10700 Manjula K
+ struct atm_dev *dev;
+ Tn7AtmPrivate *priv;
+- dev = (struct atm_dev *)data;
++ int offset[2] = { 32, 0 };
++ unsigned int usBitswap, dsBitswap;
++ dev = (struct atm_dev *)m->private;
+ priv = (Tn7AtmPrivate *)dev->dev_data;
+ //UR8_MERGE_END CQ10700
+
++
+ /*
+ * Read Ax5 Stats
+ */
+
+ dslhal_api_gatherStatistics(pIhw);
+- if(len<=limit)
+- len += sprintf(buf+len, "\nAR7 DSL Modem Statistics:\n");
+- if(len<=limit)
+- len += sprintf(buf+len, "--------------------------------\n");
++ seq_printf(m, "\nAR7 DSL Modem Statistics:\n");
++ seq_printf(m, "--------------------------------\n");
+ /*
+ * us and ds Connection Rates
+ */
+- if(len<=limit)
+- len += sprintf(buf+len, "[DSL Modem Stats]\n");
++ seq_printf(m, "[DSL Modem Stats]\n");
+
+
+- if(len<=limit)
++ if(pIhw->lConnected != 1)
+ {
+- if(pIhw->lConnected != 1)
+- {
+- pIhw->AppData.USConRate = 0;
+- pIhw->AppData.DSConRate = 0;
+- }
+- len +=
+- sprintf (buf + len,
+- "\tUS Connection Rate:\t%u\tDS Connection Rate:\t%u\n",
+- (unsigned int)pIhw->AppData.USConRate,
+- (unsigned int)pIhw->AppData.DSConRate );
++ pIhw->AppData.USConRate = 0;
++ pIhw->AppData.DSConRate = 0;
+ }
+- if(len<=limit)
++ seq_printf (m,
++ "\tUS Connection Rate:\t%u\tDS Connection Rate:\t%u\n",
++ (unsigned int)pIhw->AppData.USConRate,
++ (unsigned int)pIhw->AppData.DSConRate );
+ // UR8_MERGE_START CQ11054 Jack Zhang
+- {
+- if (dslhal_api_getHighPrecision())
+- {
+- len +=
+- sprintf (buf + len, "\tDS Line Attenuation:\t%u.%u\tDS Margin:\t\t%d.%u\n",
++ if (dslhal_api_getHighPrecision())
++ seq_printf (m, "\tDS Line Attenuation:\t%u.%u\tDS Margin:\t\t%d.%u\n",
+ gInt(pIhw->AppData.dsLineAttn), gDot1(pIhw->AppData.dsLineAttn),
+ gInt(pIhw->AppData.dsMargin), gDot1(pIhw->AppData.dsMargin));
+- }
+- else{
+- len +=
+- sprintf (buf + len, "\tDS Line Attenuation:\t%u\tDS Margin:\t\t%u\n",
++ else
++ seq_printf (m, "\tDS Line Attenuation:\t%u\tDS Margin:\t\t%u\n",
+ (unsigned int)pIhw->AppData.dsLineAttn/2,
+ (unsigned int)pIhw->AppData.dsMargin/2 );
+- }
+- }
+ // UR8_MERGE_END CQ11054*
+
+- if(len<=limit)
+ // UR8_MERGE_START CQ11054 Jack Zhang
+- {
+- if (dslhal_api_getHighPrecision())
+- {
+- len +=
+- sprintf (buf + len, "\tUS Line Attenuation:\t%u.%u\tUS Margin:\t\t%d.%u\n",
++ if (dslhal_api_getHighPrecision())
++ seq_printf (m, "\tUS Line Attenuation:\t%u.%u\tUS Margin:\t\t%d.%u\n",
+ gInt(pIhw->AppData.usLineAttn), gDot1(pIhw->AppData.usLineAttn),
+ gInt(pIhw->AppData.usMargin), gDot1(pIhw->AppData.usMargin));
+- }
+- else
+- {
+- len +=
+- sprintf (buf + len, "\tUS Line Attenuation:\t%u\tUS Margin:\t\t%u\n",
++ else
++ seq_printf (m, "\tUS Line Attenuation:\t%u\tUS Margin:\t\t%u\n",
+ (unsigned int)pIhw->AppData.usLineAttn/2,
+ (unsigned int)pIhw->AppData.usMargin );
+- }
+- }
+ // UR8_MERGE_END CQ11054*
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\tUS Payload :\t\t%u\tDS Payload:\t\t%u\n",
++ seq_printf(m, "\tUS Payload :\t\t%u\tDS Payload:\t\t%u\n",
+ ((unsigned int) pIhw->AppData.usAtm_count[0] +
+ (unsigned int) pIhw->AppData.usAtm_count[1]) * 48,
+ ((unsigned int) pIhw->AppData.dsGood_count[0] +
+@@ -1505,9 +1505,7 @@ int tn7dsl_proc_stats(char* buf, char **
+ /*
+ * Superframe Count
+ */
+- if(len<=limit)
+- len +=
+- sprintf (buf + len,
++ seq_printf (m,
+ "\tUS Superframe Cnt :\t%u\tDS Superframe Cnt:\t%u\n",
+ (unsigned int)pIhw->AppData.usSuperFrmCnt,
+ (unsigned int)pIhw->AppData.dsSuperFrmCnt );
+@@ -1515,59 +1513,45 @@ int tn7dsl_proc_stats(char* buf, char **
+ /*
+ * US and DS power
+ */
+- if(len<=limit)
++ if(pIhw->AppData.bState < 5)
+ {
+- if(pIhw->AppData.bState < 5)
+- {
+- pIhw->AppData.usTxPower = 0;
+- pIhw->AppData.dsTxPower = 0;
+- }
+- len +=
+- sprintf (buf + len,
++ pIhw->AppData.usTxPower = 0;
++ pIhw->AppData.dsTxPower = 0;
++ }
++ seq_printf (m,
+ // UR8_MERGE_START - CQ11579 - Jeremy #1
+ "\tUS Transmit Power :\t%d\tDS Transmit Power:\t%d\n",
+ pIhw->AppData.usTxPower/256,
+ pIhw->AppData.dsTxPower/256 );
+ // UR8_MERGE_END - CQ11579
+- }
+ /*
+ * DSL Stats Errors
+ */
+- if(len<=limit)
+- len += sprintf(buf+len, "\tLOS errors:\t\t%u\tSEF errors:\t\t%u\n",
++ seq_printf(m, "\tLOS errors:\t\t%u\tSEF errors:\t\t%u\n",
+ (unsigned int)pIhw->AppData.LOS_errors,
+ (unsigned int)pIhw->AppData.SEF_errors );
+
+ //UR8_MERGE_START Report_SES Manjula K
+ //CQ10369
+- if(len<=limit)
+- len += sprintf(buf+len, "\tErrored Seconds:\t%u\tSeverely Err Secs:\t%u\n",
++ seq_printf(m, "\tErrored Seconds:\t%u\tSeverely Err Secs:\t%u\n",
+ (unsigned int)pIhw->AppData.erroredSeconds,
+ (unsigned int)pIhw->AppData.severelyerrsecs );
+ //UR8_MERGE_END Report_SES
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\tFrame mode:\t\t%u\tMax Frame mode:\t\t%u\n",
++ seq_printf(m, "\tFrame mode:\t\t%u\tMax Frame mode:\t\t%u\n",
+ (unsigned int)pIhw->AppData.FrmMode,
+ (unsigned int)pIhw->AppData.MaxFrmMode );
+- if(len<=limit)
+- len +=
+- sprintf (buf + len, "\tTrained Path:\t\t%u\tUS Peak Cell Rate:\t%u\n",
++ seq_printf (m, "\tTrained Path:\t\t%u\tUS Peak Cell Rate:\t%u\n",
+ (unsigned int)pIhw->AppData.TrainedPath,
+ (unsigned int)pIhw->AppData.USConRate*1000/8/53 );
+- if(len<=limit)
+- len +=
+- sprintf (buf + len, "\tTrained Mode:\t\t%u\tSelected Mode:\t\t%u\n",
++ seq_printf (m, "\tTrained Mode:\t\t%u\tSelected Mode:\t\t%u\n",
+ (unsigned int) pIhw->AppData.TrainedMode,
+ (unsigned int) pIhw->AppData.StdMode);
+
+- if(len<=limit)
+- len +=
+- sprintf (buf + len, "\tATUC Vendor Code:\t%X\tATUC Revision:\t%u\n",
++ seq_printf (m, "\tATUC Vendor Code:\t%X\tATUC Revision:\t%u\n",
+ (unsigned int) pIhw->AppData.atucVendorId,
+ pIhw->AppData.atucRevisionNum);
+- if(len<=limit)
+- len += sprintf(buf+len, "\tHybrid Selected:\t%u\tTrellis:\t\t%u\n",
++ seq_printf(m, "\tHybrid Selected:\t%u\tTrellis:\t\t%u\n",
+ (unsigned int)pIhw->AppData.currentHybridNum, trellis);
+
+ //@Added Maximum attainable bit rate information. 05-14-2004
+@@ -1581,12 +1565,12 @@ int tn7dsl_proc_stats(char* buf, char **
+ }
+ else
+ {
+- int offset[2] = {5, 1};
++ int dspOffset[2] = { 5, 1 };
+ unsigned char rMsgsRA[12];
+ int numPayloadBytes = 0;
+
+ dslhal_api_dspInterfaceRead (pIhw, (unsigned int) pIhw->pmainAddr, 2,
+- (unsigned int *) &offset,
++ (unsigned int *) &dspOffset,
+ (unsigned char *) &rMsgsRA[0], 12);
+
+ maxRate = (unsigned int)pIhw->AppData.DSConRate;
+@@ -1602,294 +1586,223 @@ int tn7dsl_proc_stats(char* buf, char **
+ }
+ }
+
+- if(len<=limit)
+- len +=
+- sprintf (buf + len,
++ seq_printf (m,
+ "\tShowtime Count:\t\t%u\tDS Max Attainable Bit Rate: %u kbps\n",
+ (unsigned int)pIhw->AppData.showtimeCount, maxRate);
+
+- if(len<=limit)
+- {
+- int offset[2] = {32, 0};
+- unsigned int usBitswap, dsBitswap;
+-
+- tn7dsl_generic_read(2, (unsigned int *)&offset);
+- dsBitswap = dslReg & dslhal_support_byteSwap32(0x000000ff);
++ tn7dsl_generic_read(2, (unsigned int *)&offset);
++ dsBitswap = dslReg & dslhal_support_byteSwap32(0x000000ff);
+
+- offset[0] = 33;
+- tn7dsl_generic_read(2, (unsigned int *)&offset);
+- usBitswap = dslReg & dslhal_support_byteSwap32(0x000000ff);
++ offset[0] = 33;
++ tn7dsl_generic_read(2, (unsigned int *)&offset);
++ usBitswap = dslReg & dslhal_support_byteSwap32(0x000000ff);
+
+ // UR8_MERGE_START - CQ11579 - Jeremy
+- if((pIhw->AppData.dsl_modulation > 5) && (pIhw->AppData.dsl_modulation != 128))
++ if((pIhw->AppData.dsl_modulation > 5) && (pIhw->AppData.dsl_modulation != 128))
+ // UR8_MERGE_END - CQ11579 - Jeremy
+- len +=
+- sprintf (buf + len,
++ seq_printf (m,
+ "\tBitSwap:\t\t%u\tUS Max Attainable Bit Rate: %u bps\n",
+ (unsigned int)(usBitswap && dsBitswap), us_maxRate);
+- else
+- len +=
+- sprintf (buf + len,
++ else
++ seq_printf (m,
+ "\tBitSwap:\t\t%u\tUS Max Attainable Bit Rate:\tn/a\n",
+ (unsigned int)(usBitswap && dsBitswap));
+- }
+
+ #if 1 // TR69
+- if(len<=limit)
+- len +=
+- sprintf (buf + len, "\tAnnex: \t\t\t%s\tpsd_mask_qualifier: 0x%04x\n",
++ seq_printf (m, "\tAnnex: \t\t\t%s\tpsd_mask_qualifier: 0x%04x\n",
+ tn7dsl_AnnexFromNum(pIhw->AppData.annex_selected),
+ pIhw->AppData.psd_mask_qualifier);
+
+ // UR8_MERGE_START CQ10979 Jack Zhang
+ // UR8_MERGE_START CQ10978 Jack Zhang
+- if(len<=limit)
+- len +=
+- sprintf (buf + len, "\tPower Management Status: L%d\tDS HLINSC: %d\n",
++ seq_printf (m, "\tPower Management Status: L%d\tDS HLINSC: %d\n",
+ pIhw->AppData.pwrStatus, pIhw->AppData.dsHLINSC);
+ // UR8_MERGE_END CQ10978*
+
+- if(len<=limit)
+- len +=
+- sprintf (buf + len, "\tUS ACTPSD: \t\t%d\tDS ACTPSD: %d\n",
++ seq_printf (m, "\tUS ACTPSD: \t\t%d\tDS ACTPSD: %d\n",
+ pIhw->AppData.usACTPSD, pIhw->AppData.dsACTPSD);
+
+- if(len<=limit)
+- len +=
+- sprintf (buf + len, "\tTotal init. errors: \t%d\tTotal init. timeouts: %d\n",
++ seq_printf (m, "\tTotal init. errors: \t%d\tTotal init. timeouts: %d\n",
+ pIhw->AppData.totalInitErrs, pIhw->AppData.totalInitTOs);
+
+- if(len<=limit)
+- len +=
+- sprintf (buf + len, "\tShowtime init. errors: \t%d\tShowtime init. timeouts: %d\n",
++ seq_printf (m, "\tShowtime init. errors: \t%d\tShowtime init. timeouts: %d\n",
+ pIhw->AppData.showtimeInitErrs, pIhw->AppData.showtimeInitTOs);
+
+- if(len<=limit)
+- len +=
+- sprintf (buf + len, "\tLast showtime init. errors: %d\tLast showtime init. timeouts: %d\n",
++ seq_printf (m, "\tLast showtime init. errors: %d\tLast showtime init. timeouts: %d\n",
+ pIhw->AppData.lastshowInitErrs, pIhw->AppData.lastshowInitTOs);
+ // UR8_MERGE_END CQ10979*
+
+- if (len<=limit)
+- {
+- len += sprintf(buf+len,"\tATUC ghsVid: ");
+- for (i=0; i<8; i++)
+- len+= sprintf(buf+len, " %02x", pIhw->AppData.ghsATUCVendorId[i]);
+- }
++ seq_printf(m,"\tATUC ghsVid: ");
++ for (i=0; i<8; i++)
++ seq_printf(m, " %02x", pIhw->AppData.ghsATUCVendorId[i]);
+
+- if (len<=limit)
+- {
+- len += sprintf (buf + len, "\n");
+- }
++ seq_printf (m, "\n");
+
+- if (len <= limit)
+- {
+- len +=
+- sprintf (buf + len,
++ seq_printf (m,
+ "\tT1413Vid: %02x %02x\t\tT1413Rev: %02x\t\tVendorRev: %02x\n",
+ pIhw->AppData.t1413ATUC.VendorId[0],
+ pIhw->AppData.t1413ATUC.VendorId[1],
+ pIhw->AppData.t1413ATUC.t1413Revision,
+ pIhw->AppData.t1413ATUC.VendorRevision);
+- }
+
+- if (len<=limit)
+- {
+- len += sprintf(buf+len,"\tATUR ghsVid: ");
+- for (i=0; i<8; i++)
+- len+= sprintf(buf+len, " %02x", pIhw->AppData.ghsATURVendorId[i]);
+- }
++ seq_printf(m,"\tATUR ghsVid: ");
++ for (i=0; i<8; i++)
++ seq_printf(m, " %02x", pIhw->AppData.ghsATURVendorId[i]);
+
+- if (len<=limit)
+- {
+- len += sprintf (buf + len, "\n");
+- }
++ seq_printf (m, "\n");
+
+- if (len <= limit)
+- {
+- len +=
+- sprintf (buf + len,
++ seq_printf (m,
+ "\tT1413Vid: %02x %02x\tT1413Rev: %02x\tVendorRev: %02x\n",
+ pIhw->AppData.t1413ATUR.VendorId[0],
+ pIhw->AppData.t1413ATUR.VendorId[1],
+ pIhw->AppData.t1413ATUR.t1413Revision,
+ pIhw->AppData.t1413ATUR.VendorRevision);
+- }
+
+ #ifdef AR7_EFM
+- if (len <= limit)
+- {
+- len += sprintf(buf + len, "\tTC Mode: %s\n",
++ seq_printf(m, "\tTC Mode: %s\n",
+ (priv->curr_TC_mode == TC_MODE_PTM) ? "PTM" : "ATM");
+- }
+ #endif
+
+ #endif
+ /*
+ * Upstream Interleaved Errors
+ */
+- if(len<=limit)
+- len += sprintf(buf+len, "\n\t[Upstream (TX) Interleave path]\n");
+- if(len<=limit)
+- len += sprintf(buf+len, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
++ seq_printf(m, "\n\t[Upstream (TX) Interleave path]\n");
++ seq_printf(m, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
+ (unsigned int)pIhw->AppData.usICRC_errors,
+ (unsigned int)pIhw->AppData.usIFEC_errors,
+ (unsigned int)pIhw->AppData.usINCD_error);
+- if(len<=limit)
+- len += sprintf(buf+len, "\tLCD: \t%u\tHEC: \t%u\n",
++ seq_printf(m, "\tLCD: \t%u\tHEC: \t%u\n",
+ (unsigned int)pIhw->AppData.usILCD_errors,
+ (unsigned int)pIhw->AppData.usIHEC_errors);
+ /*
+ * Downstream Interleaved Errors
+ */
+- if(len<=limit)
+- len += sprintf(buf+len, "\n\t[Downstream (RX) Interleave path]\n");
+- if(len<=limit)
+- len += sprintf(buf+len, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
++ seq_printf(m, "\n\t[Downstream (RX) Interleave path]\n");
++ seq_printf(m, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
+ (unsigned int)pIhw->AppData.dsICRC_errors,
+ (unsigned int)pIhw->AppData.dsIFEC_errors,
+ (unsigned int)pIhw->AppData.dsINCD_error);
+- if(len<=limit)
+- len += sprintf(buf+len, "\tLCD: \t%u\tHEC: \t%u\n",
++ seq_printf(m, "\tLCD: \t%u\tHEC: \t%u\n",
+ (unsigned int)pIhw->AppData.dsILCD_errors,
+ (unsigned int)pIhw->AppData.dsIHEC_errors);
+ /*
+ * Upstream Fast Errors
+ */
+- if(len<=limit)
+- len += sprintf(buf+len, "\n\t[Upstream (TX) Fast path]\n");
+- if(len<=limit)
+- len += sprintf(buf+len, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
++ seq_printf(m, "\n\t[Upstream (TX) Fast path]\n");
++ seq_printf(m, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
+ (unsigned int)pIhw->AppData.usFCRC_errors,
+ (unsigned int)pIhw->AppData.usFFEC_errors,
+ (unsigned int)pIhw->AppData.usFNCD_error);
+- if(len<=limit)
+- len += sprintf(buf+len, "\tLCD: \t%u\tHEC: \t%u\n",
++ seq_printf(m, "\tLCD: \t%u\tHEC: \t%u\n",
+ (unsigned int)pIhw->AppData.usFLCD_errors,
+ (unsigned int)pIhw->AppData.usFHEC_errors);
+ /*
+ * Downstream Fast Errors
+ */
+- if(len<=limit)
+- len += sprintf(buf+len, "\n\t[Downstream (RX) Fast path]\n");
+- if(len<=limit)
+- len += sprintf(buf+len, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
++ seq_printf(m, "\n\t[Downstream (RX) Fast path]\n");
++ seq_printf(m, "\tCRC: \t%u\tFEC: \t%u\tNCD: \t%u\n",
+ (unsigned int)pIhw->AppData.dsFCRC_errors,
+ (unsigned int)pIhw->AppData.dsFFEC_errors,
+ (unsigned int)pIhw->AppData.dsFNCD_error);
+- if(len<=limit)
+- len += sprintf(buf+len, "\tLCD: \t%u\tHEC: \t%u\n",
+- (unsigned int)pIhw->AppData.dsFLCD_errors,
+- (unsigned int)pIhw->AppData.dsFHEC_errors);
++ seq_printf(m, "\tLCD: \t%u\tHEC: \t%u\n",
++ (unsigned int)pIhw->AppData.dsFLCD_errors,
++ (unsigned int)pIhw->AppData.dsFHEC_errors);
+
+ /*
+ * ATM stats upstream
+ */
+- if(len<=limit)
+- len += sprintf(buf+len, "\n[ATM Stats]");
+- if(len<=limit)
+- len += sprintf(buf+len, "\n\t[Upstream/TX]\n");
+- if(len<=limit)
+- len +=
+- sprintf (buf + len, "\tGood Cell Cnt:\t%u\n\tIdle Cell Cnt:\t%u\n\n",
+- (unsigned int) pIhw->AppData.usAtm_count[0] +
+- (unsigned int) pIhw->AppData.usAtm_count[1],
+- (unsigned int) pIhw->AppData.usIdle_count[0] +
+- (unsigned int) pIhw->AppData.usIdle_count[1]);
++ seq_printf(m, "\n[ATM Stats]");
++ seq_printf(m, "\n\t[Upstream/TX]\n");
++ seq_printf (m, "\tGood Cell Cnt:\t%u\n\tIdle Cell Cnt:\t%u\n\n",
++ (unsigned int) pIhw->AppData.usAtm_count[0] +
++ (unsigned int) pIhw->AppData.usAtm_count[1],
++ (unsigned int) pIhw->AppData.usIdle_count[0] +
++ (unsigned int) pIhw->AppData.usIdle_count[1]);
+ //UR8_MERGE_START CQ10700 Manjula K
+- if (len <= limit)
+- len +=
+- sprintf (buf + len,
++ seq_printf (m,
+ "\tTx Packets Dropped Count:\t%lu\n\tTx Bad Packets Count:\t%lu\n",
+ priv->stats.tx_dropped, priv->stats.tx_errors);
+ //UR8_MERGE_END CQ10700
+ /*
+ * ATM stats downstream
+ */
+- if(len<=limit)
+- len += sprintf(buf+len, "\n\t[Downstream/RX)]\n");
+- if(len<=limit)
+- len +=
+- sprintf (buf + len,
+- "\tGood Cell Cnt:\t%u\n\tIdle Cell Cnt:\t%u\n\tBad Hec Cell Cnt:\t%u\n",
+- (unsigned int) pIhw->AppData.dsGood_count[0] +
+- (unsigned int) pIhw->AppData.dsGood_count[1],
+- (unsigned int) pIhw->AppData.dsIdle_count[0] +
+- (unsigned int) pIhw->AppData.dsIdle_count[1],
+- (unsigned int) pIhw->AppData.dsBadHec_count[0] +
+- (unsigned int) pIhw->AppData.dsBadHec_count[1]);
+- if(len<=limit)
+- len += sprintf(buf+len, "\tOverflow Dropped Cell Cnt:\t%u\n",
+- (unsigned int) pIhw->AppData.dsOVFDrop_count[0] +
+- (unsigned int) pIhw->AppData.dsOVFDrop_count[1]);
++ seq_printf(m, "\n\t[Downstream/RX)]\n");
++ seq_printf (m,
++ "\tGood Cell Cnt:\t%u\n\tIdle Cell Cnt:\t%u\n\tBad Hec Cell Cnt:\t%u\n",
++ (unsigned int) pIhw->AppData.dsGood_count[0] +
++ (unsigned int) pIhw->AppData.dsGood_count[1],
++ (unsigned int) pIhw->AppData.dsIdle_count[0] +
++ (unsigned int) pIhw->AppData.dsIdle_count[1],
++ (unsigned int) pIhw->AppData.dsBadHec_count[0] +
++ (unsigned int) pIhw->AppData.dsBadHec_count[1]);
++ seq_printf(m, "\tOverflow Dropped Cell Cnt:\t%u\n",
++ (unsigned int) pIhw->AppData.dsOVFDrop_count[0] +
++ (unsigned int) pIhw->AppData.dsOVFDrop_count[1]);
+
+ //UR8_MERGE_START CQ10700 Manjula K
+- if (len <= limit)
+- len +=
+- sprintf (buf + len,
+- "\tRx Packets Dropped Count:\t%lu\n\tRx Bad Packets Count:\t%lu\n\n",
+- priv->stats.rx_dropped, priv->stats.rx_errors);
++ seq_printf (m,
++ "\tRx Packets Dropped Count:\t%lu\n\tRx Bad Packets Count:\t%lu\n\n",
++ priv->stats.rx_dropped, priv->stats.rx_errors);
+ //UR8_MERGE_END CQ10700
+
+ tn7sar_get_stats(pIhw->pOsContext);
+- if(len<=limit)
+- len += sprintf(buf+len, "\n[SAR AAL5 Stats]\n");
+- if(len<=limit)
+- len += sprintf(buf+len, "\tTx PDU's:\t%u\n\tRx PDU's:\t%u\n",
+- sarStat.txPktCnt, sarStat.rxPktCnt);
+- if(len<=limit)
+- len +=
+- sprintf (buf + len, "\tTx Total Bytes:\t%u\n\tRx Total Bytes:\t%u\n",
+- sarStat.txBytes, sarStat.rxBytes);
+- if (len <= limit)
+- len +=
+- sprintf (buf + len,
+- "\tTx Total Error Counts:\t%u\n\tRx Total Error Counts:\t%u\n\n",
+- sarStat.txErrors, sarStat.rxErrors);
++ seq_printf(m, "\n[SAR AAL5 Stats]\n");
++ seq_printf(m, "\tTx PDU's:\t%u\n\tRx PDU's:\t%u\n",
++ sarStat.txPktCnt, sarStat.rxPktCnt);
++ seq_printf (m, "\tTx Total Bytes:\t%u\n\tRx Total Bytes:\t%u\n",
++ sarStat.txBytes, sarStat.rxBytes);
++ seq_printf (m,
++ "\tTx Total Error Counts:\t%u\n\tRx Total Error Counts:\t%u\n\n",
++ sarStat.txErrors, sarStat.rxErrors);
+
+ /*
+ * oam loopback info
+ */
+- if(len<=limit)
+- len += sprintf(buf+len, "\n[OAM Stats]\n");
++ seq_printf(m, "\n[OAM Stats]\n");
+
+ tn7sar_get_near_end_loopback_count(&F4count, &F5count);
+
+- if(len<=limit)
+- {
+- len +=
+- sprintf (buf + len,
+- "\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",
++ seq_printf (m,
++ "\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",
+ F5count, F4count, oamFarLBCount[0] + oamFarLBCount[2],
+ oamFarLBCount[1] + oamFarLBCount[3]);
+- }
+
+ #define USE_OAM_DROP_COUNT //CQ10273
+ //Read OAM ping responses count:
+ #ifdef USE_OAM_DROP_COUNT
+- if(len<=limit)
+- {
+- /* len +=
+- sprintf (buf + len,
+- "\tSAR OAM Retry in 0x%X cycles, Drop Count=%d\n",
+- tn7dsl_get_memory(0xa30085cc), tn7dsl_get_memory(0xa30085c4)); */
++/* seq_printf (m,
++ "\tSAR OAM Retry in 0x%X cycles, Drop Count=%d\n",
++ tn7dsl_get_memory(0xa30085cc), tn7dsl_get_memory(0xa30085c4)); */
+
+- len += sprintf (buf + len, "\tSAR OAM Ping Response Drop Count=%d\n",
+- tn7dsl_get_memory(0xa30085b0));
+- }
++ seq_printf (m, "\tSAR OAM Ping Response Drop Count=%d\n",
++ tn7dsl_get_memory(0xa30085b0));
+ #endif // USE_OAM_DROP_COUNT
+
+- return len;
++ return 0;
+ }
+
+-int tn7dsl_proc_modem(char* buf, char **start, off_t offset, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_stats_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7dsl_proc_stats, PDE_DATA(inode));
++}
++
++int tn7dsl_proc_write_stats(struct file *fp, const char * buf, unsigned long count, void * data);
++
++struct file_operations tn7dsl_proc_stats_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_stats_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++ .write = tn7dsl_proc_write_stats,
++};
++
++static int tn7dsl_proc_modem(struct seq_file *m, void *data)
+ {
+ #ifdef AR7_EFM
+ extern int tn7efm_get_currTCmode(void);
+ #endif
+- int len = 0;
+- int limit = count - 80;
+ char *state;
+ int tag;
+
+@@ -1923,22 +1836,31 @@ extern int tn7efm_get_currTCmode(void);
+
+ if(pIhw->lConnected == 1)
+ state = "SHOWTIME";
+- if(len<=limit)
+- len += sprintf(buf+len,"%s\n",state);
+- if(len<=limit)
+- len += sprintf(buf+len, "%d\n", dslReg);
+- if(len<=limit)
+- len += sprintf(buf+len, "failTrains=%d\n", pIhw->AppData.trainFails);
++ seq_printf(m,"%s\n",state);
++ seq_printf(m, "%d\n", dslReg);
++ seq_printf(m, "failTrains=%d\n", pIhw->AppData.trainFails);
+
+ #ifdef AR7_EFM
+- if (len<=limit)
+- len += sprintf(buf+len, "TCMODE=%s\n",
+- tn7efm_get_currTCmode()== TC_MODE_PTM ? "EFM" : "ATM");
++ seq_printf(m, "TCMODE=%s\n",
++ tn7efm_get_currTCmode()== TC_MODE_PTM ? "EFM" : "ATM");
+ #endif
+
+- return len;
++ return 0;
++}
++
++static int tn7dsl_proc_modem_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7dsl_proc_modem, PDE_DATA(inode));
+ }
+
++struct file_operations tn7dsl_proc_modem_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_modem_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+ /**********************************************************************
+ ** *
+ ** tn7dsl_hdlc_update_crc() -- Calculate CRC *
+@@ -2203,11 +2125,8 @@ static int tn7dsl_hdlc_rx_process(unsign
+ return(ret);
+ }
+
+-int tn7dsl_proc_eoc (char *buf, char **start, off_t OffSet, int count,
+- int *eof, void *data)
++static int tn7dsl_proc_eoc (struct seq_file *m, void *data)
+ {
+- int len = 0;
+- int limit = count - 80;
+ int offset[2] = {34, 0}; // point to buffer parameter data structure
+ clearEocParm_t peoc;
+
+@@ -2216,62 +2135,49 @@ int tn7dsl_proc_eoc (char *buf, char **s
+ (unsigned char *) &peoc,
+ sizeof (clearEocParm_t));
+
+- if (len <= limit)
+- len += sprintf(buf+len, "\nClear EOC Channel:\n\n");
+- if (len <= limit)
+- len += sprintf(buf+len, " Enabled:\t%d\n", dslhal_support_byteSwap32(peoc.clearEocEnabled));
+- if (len <= limit)
+- len += sprintf(buf+len, " TxBuf[0]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[0]));
+- if (len <= limit)
+- len += sprintf(buf+len, " TxBuf[1]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[1]));
+- if (len <= limit)
+- len += sprintf(buf+len, " TxBuf[2]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[2]));
+- if (len <= limit)
+- len += sprintf(buf+len, " TxBuf[3]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[3]));
+- if (len <= limit)
+- len += sprintf(buf+len, " RxBuf[0]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[0]));
+- if (len <= limit)
+- len += sprintf(buf+len, " RxBuf[1]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[1]));
+- if (len <= limit)
+- len += sprintf(buf+len, " RxBuf[2]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[2]));
+- if (len <= limit)
+- len += sprintf(buf+len, " RxBuf[3]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[3]));
+- if (len <= limit)
+- len += sprintf(buf+len, " txRdIndex:\t%d\n", dslhal_support_byteSwap32(peoc.txRdIndex));
+- if (len <= limit)
+- len += sprintf(buf+len, " txWrIndex:\t%d\n", dslhal_support_byteSwap32(peoc.txWrIndex));
+- if (len <= limit)
+- len += sprintf(buf+len, " rxRdIndex:\t%d\n", dslhal_support_byteSwap32(peoc.rxRdIndex));
+- if (len <= limit)
+- len += sprintf(buf+len, " rxWrIndex:\t%d\n\n", dslhal_support_byteSwap32(peoc.rxWrIndex));
+- if (len <= limit)
+- len += sprintf(buf+len, " TotalTxPkts:\t%d\n", EocTxTotalPackets);
+- if (len <= limit)
+- len += sprintf(buf+len, " TotalRxPkts:\t%d\n", EocRxTotalPackets);
+- if (len <= limit)
+- len += sprintf(buf+len, " TotalTxBytes:\t%d\n", EocTxTotalBytes);
+- if (len <= limit)
+- len += sprintf(buf+len, " TotalRxBytes:\t%d\n\n", EocRxTotalBytes);
+- if (len <= limit)
+- len += sprintf(buf+len, " ErrBufFull:\t%d\n", ErrEocBufFull);
+- if (len <= limit)
+- len += sprintf(buf+len, " ErrBufIndx:\t%d\n", ErrEocBufIndex);
+- if (len <= limit)
+- len += sprintf(buf+len, " ErrBufMax:\t%d\n", ErrEocBufMax);
+- if (len <= limit)
+- len += sprintf(buf+len, " ErrMsgMax:\t%d\n", ErrEocMsgOversized);
+- if (len <= limit)
+- len += sprintf(buf+len, " ErrTxHDLC:\t%d\n", ErrEocTxHdlcCRC);
+- if (len <= limit)
+- len += sprintf(buf+len, " ErrRxHDLC:\t%d\n", ErrEocRxHdlcCRC);
+- if (len <= limit)
+- len += sprintf(buf+len, " ErrRxSnmp:\t%d\n", ErrEocRxHdlcFraming);
+- if (len <= limit)
+- len += sprintf(buf+len, " ErrRxPush:\t%d\n\n", ErrEocRxPush);
++ seq_printf(m, "\nClear EOC Channel:\n\n");
++ seq_printf(m, " Enabled:\t%d\n", dslhal_support_byteSwap32(peoc.clearEocEnabled));
++ seq_printf(m, " TxBuf[0]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[0]));
++ seq_printf(m, " TxBuf[1]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[1]));
++ seq_printf(m, " TxBuf[2]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[2]));
++ seq_printf(m, " TxBuf[3]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pTxBufDesc[3]));
++ seq_printf(m, " RxBuf[0]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[0]));
++ seq_printf(m, " RxBuf[1]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[1]));
++ seq_printf(m, " RxBuf[2]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[2]));
++ seq_printf(m, " RxBuf[3]:\t0x%08x\n", dslhal_support_byteSwap32((unsigned int)peoc.pRxBufDesc[3]));
++ seq_printf(m, " txRdIndex:\t%d\n", dslhal_support_byteSwap32(peoc.txRdIndex));
++ seq_printf(m, " txWrIndex:\t%d\n", dslhal_support_byteSwap32(peoc.txWrIndex));
++ seq_printf(m, " rxRdIndex:\t%d\n", dslhal_support_byteSwap32(peoc.rxRdIndex));
++ seq_printf(m, " rxWrIndex:\t%d\n\n", dslhal_support_byteSwap32(peoc.rxWrIndex));
++ seq_printf(m, " TotalTxPkts:\t%d\n", EocTxTotalPackets);
++ seq_printf(m, " TotalRxPkts:\t%d\n", EocRxTotalPackets);
++ seq_printf(m, " TotalTxBytes:\t%d\n", EocTxTotalBytes);
++ seq_printf(m, " TotalRxBytes:\t%d\n\n", EocRxTotalBytes);
++ seq_printf(m, " ErrBufFull:\t%d\n", ErrEocBufFull);
++ seq_printf(m, " ErrBufIndx:\t%d\n", ErrEocBufIndex);
++ seq_printf(m, " ErrBufMax:\t%d\n", ErrEocBufMax);
++ seq_printf(m, " ErrMsgMax:\t%d\n", ErrEocMsgOversized);
++ seq_printf(m, " ErrTxHDLC:\t%d\n", ErrEocTxHdlcCRC);
++ seq_printf(m, " ErrRxHDLC:\t%d\n", ErrEocRxHdlcCRC);
++ seq_printf(m, " ErrRxSnmp:\t%d\n", ErrEocRxHdlcFraming);
++ seq_printf(m, " ErrRxPush:\t%d\n\n", ErrEocRxPush);
+
+- return len;
++ return 0;
++}
++
++static int tn7dsl_proc_eoc_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7dsl_proc_eoc, PDE_DATA(inode));
+ }
+
++struct file_operations tn7dsl_proc_eoc_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_eoc_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+ int tn7dsl_clear_eoc_setup(void)
+ {
+ int i;
+@@ -4624,14 +4530,10 @@ int tn7dsl_proc_write_stats (struct file
+ }
+
+
+-int tn7dsl_proc_train_mode_export (char *buf, char **start, off_t offset,
+- int count, int *eof, void *data)
++static int tn7dsl_proc_train_mode_export (struct seq_file *m, void *data)
+ {
+
+- int len = 0;
+- char *cp = buf + offset;
+ int i = 0;
+- static int ctr = 0;
+
+ typedef struct
+ {
+@@ -4712,197 +4614,185 @@ int tn7dsl_proc_train_mode_export (char
+ }
+
+
+- if(len <= count)
++ for (i = 0; (i < num_entries) ; i++)
+ {
+- for (i = ctr; ((i < num_entries)&& (len <= count)) ; i++)
+- {
+- /*
+- * Write the current string only if we can fit it into the buffer
+- */
+- if((strlen(dsl_modes[i].mode_name) + 6 + len) <= count)
+- {
+- len += snprintf(cp+len, (count - len), "%s\t\t\t%#x\n",
+- dsl_modes[i].mode_name, dsl_modes[i].mode_value);
+- }
+- else
+- break;
+- }
++ seq_printf(m, "%s\t\t\t%#x\n",
++ dsl_modes[i].mode_name, dsl_modes[i].mode_value);
+ }
+
+- /*
+- * Data was completely written
+- */
+- if (i >= num_entries)
+- {
+- /*
+- * We are done with this
+- */
+- *eof = 1;
+- ctr = 0;
+- }
+- else
+- {
+- /*
+- * We have not been able to write the complete data, and we have to nul
+- * terminate the buffer.
+- */
+- *(cp + len) = '\0';
+-
+- /*
+- * Save the value of the counter for the next read for the rest of the
+- * data.
+- */
+- ctr = i;
+- }
+-
+- return len;
++ return 0;
+ }
+
+-#ifndef NO_ADV_STATS
+-int tn7dsl_proc_SNRpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data)
++static int tn7dsl_proc_train_mode_export_open(struct inode *inode, struct file *file)
+ {
+- int len = 0;
+-
++ return single_open(file, tn7dsl_proc_train_mode_export, PDE_DATA(inode));
++}
+
++struct file_operations tn7dsl_proc_train_mode_export_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_train_mode_export_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
+
+- int limit = count - 80;
++#ifndef NO_ADV_STATS
++int tn7dsl_proc_SNRpsds(struct seq_file *m, void *data)
++{
+ int i;
+ unsigned char SNRpsds[512];
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nAR7 SNRpsds:");
++ seq_printf(m, "\nAR7 SNRpsds:");
+
+ if (dslhal_api_getSNRpsds(pIhw, SNRpsds, 1))
+ {
+ dgprintf(4, "dslhal_api_getSNRpsds failed!\n");
+- return len;
++ return -EIO;
+ }
+
+ for (i=0; i<pIhw->AppData.max_ds_tones; i++)
+ {
+ if (!(i%16))
+ {
+- if(len <=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+
+- if(len <=limit)
+- len += sprintf(buf+len, "%d ", (unsigned char)SNRpsds[i]);
++ seq_printf(m, "%d ", (unsigned char)SNRpsds[i]);
+ }
+
+- if(len <=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+
+
+
+- return len;
++ return 0;
++}
++
++static int tn7dsl_proc_SNRpsds_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7dsl_proc_SNRpsds, PDE_DATA(inode));
+ }
+
++struct file_operations tn7dsl_proc_SNRpsds_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_SNRpsds_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+ #endif
+
+ #ifndef NO_ADV_STATS
+-int tn7dsl_proc_QLNpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data)
++static int tn7dsl_proc_QLNpsds(struct seq_file *m, void *data)
+ {
+- int len = 0;
+-
+- int limit = count - 80;
+ unsigned char QLNpsds[512];
+ int i;
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nAR7 QLNpsds:");
++ seq_printf(m, "\nAR7 QLNpsds:");
+
+ // call API instead of access internal buf directly
+ if (dslhal_api_getQLNpsds(pIhw, QLNpsds, 0))
+ {
+ dgprintf(4, "dslhal_api_getQLNpsds failed!\n");
+- return len;
++ return -EIO;
+ }
+
+ for (i=0; i<pIhw->AppData.max_ds_tones; i++)
+ {
+ if (!(i%16))
+ {
+- if(len <=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+
+- if(len <=limit)
+- len += sprintf(buf+len, "%d ", (unsigned char)QLNpsds[i]);
++ seq_printf(m, "%d ", (unsigned char)QLNpsds[i]);
+ }
+
+- if(len <=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+
+
+- return len;
++ return 0;
+ }
++
++static int tn7dsl_proc_QLNpsds_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7dsl_proc_QLNpsds, PDE_DATA(inode));
++}
++
++struct file_operations tn7dsl_proc_QLNpsds_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_QLNpsds_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+ #endif
+
+ // UR8_MERGE_START CQ10979 Jack Zhang
+ #ifdef TR69_HLIN_IN
+ #ifndef NO_ADV_STATS
+-int tn7dsl_proc_HLINpsds(char* buf, char **start, off_t offset, int count,int *eof, void *data)
++static int tn7dsl_proc_HLINpsds(struct seq_file *m, void *data)
+ {
+- int len = 0;
+-
+- int limit = count - 80;
+ short HLINpsds[2*512];
+ int i;
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nAR7 HLINpsds:");
++ seq_printf(m, "\nAR7 HLINpsds:");
+
+ // call API instead of access internal buf directly
+ if (dslhal_api_getHLINpsds(pIhw, (unsigned char *)HLINpsds, 1))
+ {
+ dgprintf(4, "dslhal_api_getHLINpsds failed!\n");
+- return len;
++ return -EIO;
+ }
+
+ for (i=0; i<pIhw->AppData.max_ds_tones; i++)
+ {
+ if (!(i%8))
+ {
+- if(len <=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+
+- if(len <=limit)
+- len += sprintf(buf+len, "(%d,%d) ", HLINpsds[2*i], HLINpsds[2*i+1]);
++ seq_printf(m, "(%d,%d) ", HLINpsds[2*i], HLINpsds[2*i+1]);
+ }
+
+- if(len <=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+
+
+- return len;
++ return 0;
+ }
+
+-static int tn7dsl_proc_HLINpsdsIndx(char* buf, char **start, off_t offset, int count,int *eof, void *data, int indx)
++static int tn7dsl_proc_HLINpsds_open(struct inode *inode, struct file *file)
+ {
+- int len = 0;
++ return single_open(file, tn7dsl_proc_HLINpsds, PDE_DATA(inode));
++}
+
+- int limit = count - 80;
++struct file_operations tn7dsl_proc_HLINpsds_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_HLINpsds_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++static int tn7dsl_proc_HLINpsdsIndx(struct seq_file *m, void *data, int indx)
++{
+ short HLINpsds[2*512];
+ int i;
+ int start=0, dim=128;
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nAR7 HLINpsds: (section %d)", indx);
++ seq_printf(m, "\nAR7 HLINpsds: (section %d)", indx);
+
+ if((indx > 2) && (pIhw->AppData.max_ds_tones <= 256))
+ {
+- if(len <=limit)
+- len += sprintf(buf+len, "\n[End of data]");
+- return len;
++ seq_printf(m, "\n[End of data]");
++ return 0;
+ }
+
+ // call API instead of access internal buf directly
+ if (dslhal_api_getHLINpsds(pIhw, (unsigned char *)HLINpsds, 1))
+ {
+ dgprintf(4, "dslhal_api_getHLINpsds failed!\n");
+- return len;
++ return -1;
+ }
+
+ start = (indx -1) * 128;
+@@ -4911,39 +4801,89 @@ static int tn7dsl_proc_HLINpsdsIndx(char
+ {
+ if (!(i%8))
+ {
+- if(len <=limit)
+- len += sprintf(buf+len, "\n%d: ", i);
++ seq_printf(m, "\n%d: ", i);
+ }
+
+- if(len <=limit)
+- len += sprintf(buf+len, "(%d,%d) ", HLINpsds[2*i], HLINpsds[2*i+1]);
++ seq_printf(m, "(%d,%d) ", HLINpsds[2*i], HLINpsds[2*i+1]);
+ }
+
+- if(len <=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+
+- return len;
++ return 0;
++}
++
++static int tn7dsl_proc_HLINpsds1(struct seq_file *m, void *data)
++{
++ return tn7dsl_proc_HLINpsdsIndx(m, data, 1);
++}
++
++static int tn7dsl_proc_HLINpsds2(struct seq_file *m, void *data)
++{
++ return tn7dsl_proc_HLINpsdsIndx(m, data, 2);
++}
++
++static int tn7dsl_proc_HLINpsds3(struct seq_file *m, void *data)
++{
++ return tn7dsl_proc_HLINpsdsIndx(m, data, 3);
++}
++
++static int tn7dsl_proc_HLINpsds4(struct seq_file *m, void *data)
++{
++ return tn7dsl_proc_HLINpsdsIndx(m, data, 4);
+ }
+
+-int tn7dsl_proc_HLINpsds1(char* buf, char **start, off_t offset, int count,int *eof, void *data)
++static int tn7dsl_proc_HLINpsds1_open(struct inode *inode, struct file *file)
+ {
+- return tn7dsl_proc_HLINpsdsIndx(buf, start, offset, count,eof, data, 1);
++ return single_open(file, tn7dsl_proc_HLINpsds1, PDE_DATA(inode));
+ }
+
+-int tn7dsl_proc_HLINpsds2(char* buf, char **start, off_t offset, int count,int *eof, void *data)
++static int tn7dsl_proc_HLINpsds2_open(struct inode *inode, struct file *file)
+ {
+- return tn7dsl_proc_HLINpsdsIndx(buf, start, offset, count,eof, data, 2);
++ return single_open(file, tn7dsl_proc_HLINpsds2, PDE_DATA(inode));
+ }
+
+-int tn7dsl_proc_HLINpsds3(char* buf, char **start, off_t offset, int count,int *eof, void *data)
++static int tn7dsl_proc_HLINpsds3_open(struct inode *inode, struct file *file)
+ {
+- return tn7dsl_proc_HLINpsdsIndx(buf, start, offset, count,eof, data, 3);
++ return single_open(file, tn7dsl_proc_HLINpsds3, PDE_DATA(inode));
+ }
+
+-int tn7dsl_proc_HLINpsds4(char* buf, char **start, off_t offset, int count,int *eof, void *data)
++static int tn7dsl_proc_HLINpsds4_open(struct inode *inode, struct file *file)
+ {
+- return tn7dsl_proc_HLINpsdsIndx(buf, start, offset, count,eof, data, 4);
++ return single_open(file, tn7dsl_proc_HLINpsds4, PDE_DATA(inode));
+ }
++
++struct file_operations tn7dsl_proc_HLINpsds1_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_HLINpsds1_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++struct file_operations tn7dsl_proc_HLINpsds2_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_HLINpsds2_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++struct file_operations tn7dsl_proc_HLINpsds3_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_HLINpsds3_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++struct file_operations tn7dsl_proc_HLINpsds4_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_HLINpsds4_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+ #endif
+ #endif //TR69_HLIN_IN
+ // UR8_MERGE_END CQ10979*
+@@ -4951,64 +4891,48 @@ int tn7dsl_proc_HLINpsds4(char* buf, cha
+ // * UR8_MERGE_START CQ11057 Jack Zhang
+ #ifdef TR69_PMD_IN
+ #ifndef NO_ADV_STATS
+-int tn7dsl_proc_PMDus(char* buf, char **start, off_t offset, int count,int *eof, void *data)
++static int tn7dsl_proc_PMDus(struct seq_file *m, void *data)
+ {
+- int len = 0;
+-
+- int limit = count - 80;
+ int i;
+ CoPMDTestParams_t co_pmdtest_params;
+
+- if(len<=limit)
+- len += sprintf(buf+len, "\nAR7 US PMD Test:\n");
++ seq_printf(m, "\nAR7 US PMD Test:\n");
+
+ // call API instead of access internal buf directly
+ if (dslhal_api_getPMDTestus(pIhw, &co_pmdtest_params, 0) != DSLHAL_ERROR_NO_ERRORS)
+ {
+ dgprintf(4, "dslhal_api_getPMDTestus failed!\n");
+- return len;
++ return -EIO;
+ }
+
+- if(len<=limit)
+- len += sprintf(buf+len, "LATN=%d\n", co_pmdtest_params.co_latn);
++ seq_printf(m, "LATN=%d\n", co_pmdtest_params.co_latn);
+
+- if(len<=limit)
+- len += sprintf(buf+len, "SATN=%d\n", co_pmdtest_params.co_satn);
++ seq_printf(m, "SATN=%d\n", co_pmdtest_params.co_satn);
+
+- if(len<=limit)
+- len += sprintf(buf+len, "SNRM=%d\n", co_pmdtest_params.usMargin);
++ seq_printf(m, "SNRM=%d\n", co_pmdtest_params.usMargin);
+
+- if(len<=limit)
+- len += sprintf(buf+len, "attndr=%ld\n", co_pmdtest_params.co_attndr);
++ seq_printf(m, "attndr=%ld\n", co_pmdtest_params.co_attndr);
+
+- if(len<=limit)
+- len += sprintf(buf+len, "NearActatp=%d\n", co_pmdtest_params.co_near_actatp);
++ seq_printf(m, "NearActatp=%d\n", co_pmdtest_params.co_near_actatp);
+
+- if(len<=limit)
+- len += sprintf(buf+len, "FarActatp=%d\n", co_pmdtest_params.co_far_actatp);
++ seq_printf(m, "FarActatp=%d\n", co_pmdtest_params.co_far_actatp);
+
+ //HLOG
+ for (i=0; i<pIhw->AppData.max_us_tones; i++)
+ {
+ if (!(i%16))
+- {
+- if(len <=limit)
+- len += sprintf(buf+len, "\nHLOG(%3d):", i);
+- }
+- if(len <=limit)
+- len += sprintf(buf+len, " %d", co_pmdtest_params.TestParmCOHlogfMsg[i]);
++ seq_printf(m, "\nHLOG(%3d):", i);
++
++ seq_printf(m, " %d", co_pmdtest_params.TestParmCOHlogfMsg[i]);
+ }
+
+ //QLN
+ for (i=0; i<pIhw->AppData.max_us_tones; i++)
+ {
+ if (!(i%16))
+- {
+- if(len <=limit)
+- len += sprintf(buf+len, "\nQLN(%3d):", i);
+- }
+- if(len <=limit)
+- len += sprintf(buf+len, " %d", co_pmdtest_params.TestParmCOQLNfMsg[i]);
++ seq_printf(m, "\nQLN(%3d):", i);
++
++ seq_printf(m, " %d", co_pmdtest_params.TestParmCOQLNfMsg[i]);
+
+ }
+
+@@ -5016,19 +4940,28 @@ int tn7dsl_proc_PMDus(char* buf, char **
+ for (i=0; i<pIhw->AppData.max_us_tones; i++)
+ {
+ if (!(i%16))
+- {
+- if(len <=limit)
+- len += sprintf(buf+len, "\nSNR(%3d):", i);
+- }
+- if(len <=limit)
+- len += sprintf(buf+len, " %d", co_pmdtest_params.TestParmCOSNRfMsg[i]);
++ seq_printf(m, "\nSNR(%3d):", i);
++ seq_printf(m, " %d", co_pmdtest_params.TestParmCOSNRfMsg[i]);
+ }
+
+- if(len <=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+
+- return len;
++ return 0;
++}
++
++static int tn7dsl_proc_PMDus_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7dsl_proc_PMDus, PDE_DATA(inode));
+ }
++
++struct file_operations tn7dsl_proc_PMDus_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7dsl_proc_PMDus_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+ #endif //NO_ADV_STATS
+ #endif //TR69_PMD_IN
+ // * UR8_MERGE_END CQ11057 *
+--- a/tn7sar.c
++++ b/tn7sar.c
+@@ -1553,44 +1553,70 @@ int tn7sar_oam_generation(void *privCont
+ return 0;
+ }
+
+-int tn7sar_proc_oam_ping(char* buf, char **start, off_t offset, int count,int *eof, void *data)
++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,10,0)
++#define PDE_DATA(inode) PDE(inode)->data
++#endif
++
++static int tn7sar_proc_oam_ping(struct seq_file *m, void *data)
+ {
+- int len = 0;
+ unsigned int oam_ps = oamPingStatus;
+
+ if( oam_ps == OAM_PING_PENDING_RECVD )
+ oam_ps = OAM_PING_PENDING; //jz CQ9861: Only export the PENDING status, not internal state
+
+- len += sprintf(buf+len, "%d\n", oam_ps); //oamPingStatus);
++ seq_printf(m, "%d\n", oam_ps); //oamPingStatus);
+
+- return len;
++ return 0;
+ }
+
+-int tn7sar_proc_pvc_table(char* buf, char **start, off_t offset, int count,int *eof, void *data)
++static int tn7sar_proc_oam_ping_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7sar_proc_oam_ping, PDE_DATA(inode));
++}
++
++struct file_operations tn7sar_proc_oam_ping_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7sar_proc_oam_ping_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
++
++static int tn7sar_proc_pvc_table(struct seq_file *m, void *data)
+ {
+- int len = 0;
+ int i;
+
+ for(i=0;i<16;i++)
+ {
+ if(pvc_result[i].bInUse)
+ {
+- len += sprintf(buf+len, "%d,%d\n", pvc_result[i].vpi,pvc_result[i].vci);
++ seq_printf(m, "%d,%d\n", pvc_result[i].vpi,pvc_result[i].vci);
+ }
+ else
+ {
+- len += sprintf(buf+len, "0,0\n");
++ seq_printf(m, "0,0\n");
+ }
+ }
+- return len;
++ return 0;
++}
++
++static int tn7sar_proc_pvc_table_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7sar_proc_pvc_table, PDE_DATA(inode));
+ }
+
++struct file_operations tn7sar_proc_pvc_table_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7sar_proc_pvc_table_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
+
+
+-int tn7sar_proc_sar_stat(char* buf, char **start, off_t offset, int count,int *eof, void *data)
++static int tn7sar_proc_sar_stat(struct seq_file *m, void *data)
+ {
+- int len = 0;
+- int limit = count - 80;
+ struct atm_dev *dev;
+ Tn7AtmPrivate *priv;
+ int i, j, k;
+@@ -1599,21 +1625,19 @@ int tn7sar_proc_sar_stat(char* buf, char
+ unsigned int *pStateBase, *pSarStat;
+ HAL_FUNCTIONS *pHalFunc;
+ HAL_DEVICE *pHalDev;
+- int dBytes;
+
+- dev = (struct atm_dev *)data;
++ dev = (struct atm_dev *)m->private;
+ priv = (Tn7AtmPrivate *)dev->dev_data;
+
+ pHalFunc = (HAL_FUNCTIONS *)priv->pSarHalFunc;
+ pHalDev = (HAL_DEVICE *)priv->pSarHalDev;
+
+- len += sprintf(buf+len, "SAR HAL Statistics");
++ seq_printf(m, "SAR HAL Statistics");
+ for(i=0;i<MAX_DMA_CHAN;i++)
+ {
+ if(priv->lut[i].inuse)
+ {
+- if(len<=limit)
+- len += sprintf(buf+len, "\nChannel %d:\n",priv->lut[i].chanid);
++ seq_printf(m, "\nChannel %d:\n",priv->lut[i].chanid);
+ k=0;
+ for(j=0;j<4;j++)
+ {
+@@ -1626,26 +1650,16 @@ int tn7sar_proc_sar_stat(char* buf, char
+ {
+ if((char *)*pSarStat == NULL)
+ break;
+- if(len<=limit)
+- {
+- dBytes = sprintf(buf+len, "%s: ",(char *) *pSarStat);
+- len += dBytes;
+- k += dBytes;
+- }
++
++ k += seq_printf(m, "%s: ",(char *) *pSarStat);
+ pSarStat++;
+- if(len<=limit)
+- {
+- dBytes = sprintf(buf+len, "%s; \n",(char *) *pSarStat);
+- len += dBytes;
+- k += dBytes;
+- }
++ k += seq_printf(m, "%s; \n",(char *) *pSarStat);
+ pSarStat++;
+
+ if(k > 60)
+ {
+ k=0;
+- if(len<=limit)
+- len += sprintf(buf+len, "\n");
++ seq_printf(m, "\n");
+ }
+ }
+
+@@ -1654,9 +1668,22 @@ int tn7sar_proc_sar_stat(char* buf, char
+ }
+ }
+
+- return len;
++ return 0;
+ }
+
++static int tn7sar_proc_sar_stat_open(struct inode *inode, struct file *file)
++{
++ return single_open(file, tn7sar_proc_sar_stat, PDE_DATA(inode));
++}
++
++struct file_operations tn7sar_proc_sar_stat_fops = {
++ .owner = THIS_MODULE,
++ .open = tn7sar_proc_sar_stat_open,
++ .read = seq_read,
++ .llseek = seq_lseek,
++ .release = single_release,
++};
++
+ #ifdef AR7_EFM
+ void tn7sar_get_EFM_firmware_version(unsigned int *pdsp_version_ms, unsigned int *pdsp_version_ls)
+ {