aboutsummaryrefslogtreecommitdiffstats
path: root/net/atm/mpoa_proc.c
diff options
context:
space:
mode:
authorJoe Perches <joe@perches.com>2010-01-26 06:40:11 -0500
committerDavid S. Miller <davem@davemloft.net>2010-01-27 00:16:01 -0500
commitf1e100491e0e696b19f37f2b0cf728a5f2bc56e7 (patch)
tree69f2ed2e4eab1dfac4bae180e84a6e647f9adaaa /net/atm/mpoa_proc.c
parentbee67d34b2dd495feafb1a37b5ea2d6179b74178 (diff)
net/atm/mpoa_proc.c: checkpatch cleanups
Convert #include <asm... to #include <linux... Add printk argument verification to dprintk and ddprintk Spacing cleanups Mostly 80 column wrapped. Removed unnecessary breaks after returns Use %pI4 in seq_printf of IP address Signed-off-by: Joe Perches <joe@perches.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/atm/mpoa_proc.c')
-rw-r--r--net/atm/mpoa_proc.c64
1 files changed, 31 insertions, 33 deletions
diff --git a/net/atm/mpoa_proc.c b/net/atm/mpoa_proc.c
index 0603ab478cf5..aae4a87c22ac 100644
--- a/net/atm/mpoa_proc.c
+++ b/net/atm/mpoa_proc.c
@@ -9,7 +9,7 @@
9#include <linux/proc_fs.h> 9#include <linux/proc_fs.h>
10#include <linux/time.h> 10#include <linux/time.h>
11#include <linux/seq_file.h> 11#include <linux/seq_file.h>
12#include <asm/uaccess.h> 12#include <linux/uaccess.h>
13#include <linux/atmmpc.h> 13#include <linux/atmmpc.h>
14#include <linux/atm.h> 14#include <linux/atm.h>
15#include "mpc.h" 15#include "mpc.h"
@@ -21,9 +21,10 @@
21 */ 21 */
22 22
23#if 1 23#if 1
24#define dprintk printk /* debug */ 24#define dprintk(format, args...) printk(KERN_DEBUG format, ##args) /* debug */
25#else 25#else
26#define dprintk(format,args...) 26#define dprintk(format, args...) \
27 do { if (0) printk(KERN_DEBUG format, ##args); } while (0)
27#endif 28#endif
28 29
29#define STAT_FILE_NAME "mpc" /* Our statistic file's name */ 30#define STAT_FILE_NAME "mpc" /* Our statistic file's name */
@@ -52,42 +53,37 @@ static const struct file_operations mpc_file_operations = {
52/* 53/*
53 * Returns the state of an ingress cache entry as a string 54 * Returns the state of an ingress cache entry as a string
54 */ 55 */
55static const char *ingress_state_string(int state){ 56static const char *ingress_state_string(int state)
56 switch(state) { 57{
58 switch (state) {
57 case INGRESS_RESOLVING: 59 case INGRESS_RESOLVING:
58 return "resolving "; 60 return "resolving ";
59 break;
60 case INGRESS_RESOLVED: 61 case INGRESS_RESOLVED:
61 return "resolved "; 62 return "resolved ";
62 break;
63 case INGRESS_INVALID: 63 case INGRESS_INVALID:
64 return "invalid "; 64 return "invalid ";
65 break;
66 case INGRESS_REFRESHING: 65 case INGRESS_REFRESHING:
67 return "refreshing "; 66 return "refreshing ";
68 break;
69 default:
70 return "";
71 } 67 }
68
69 return "";
72} 70}
73 71
74/* 72/*
75 * Returns the state of an egress cache entry as a string 73 * Returns the state of an egress cache entry as a string
76 */ 74 */
77static const char *egress_state_string(int state){ 75static const char *egress_state_string(int state)
78 switch(state) { 76{
77 switch (state) {
79 case EGRESS_RESOLVED: 78 case EGRESS_RESOLVED:
80 return "resolved "; 79 return "resolved ";
81 break;
82 case EGRESS_PURGE: 80 case EGRESS_PURGE:
83 return "purge "; 81 return "purge ";
84 break;
85 case EGRESS_INVALID: 82 case EGRESS_INVALID:
86 return "invalid "; 83 return "invalid ";
87 break;
88 default:
89 return "";
90 } 84 }
85
86 return "";
91} 87}
92 88
93/* 89/*
@@ -124,7 +120,6 @@ static void mpc_stop(struct seq_file *m, void *v)
124static int mpc_show(struct seq_file *m, void *v) 120static int mpc_show(struct seq_file *m, void *v)
125{ 121{
126 struct mpoa_client *mpc = v; 122 struct mpoa_client *mpc = v;
127 unsigned char *temp;
128 int i; 123 int i;
129 in_cache_entry *in_entry; 124 in_cache_entry *in_entry;
130 eg_cache_entry *eg_entry; 125 eg_cache_entry *eg_entry;
@@ -141,15 +136,17 @@ static int mpc_show(struct seq_file *m, void *v)
141 do_gettimeofday(&now); 136 do_gettimeofday(&now);
142 137
143 for (in_entry = mpc->in_cache; in_entry; in_entry = in_entry->next) { 138 for (in_entry = mpc->in_cache; in_entry; in_entry = in_entry->next) {
144 temp = (unsigned char *)&in_entry->ctrl_info.in_dst_ip; 139 sprintf(ip_string, "%pI4", &in_entry->ctrl_info.in_dst_ip);
145 sprintf(ip_string,"%d.%d.%d.%d", temp[0], temp[1], temp[2], temp[3]);
146 seq_printf(m, "%-16s%s%-14lu%-12u", 140 seq_printf(m, "%-16s%s%-14lu%-12u",
147 ip_string, 141 ip_string,
148 ingress_state_string(in_entry->entry_state), 142 ingress_state_string(in_entry->entry_state),
149 in_entry->ctrl_info.holding_time-(now.tv_sec-in_entry->tv.tv_sec), 143 in_entry->ctrl_info.holding_time -
150 in_entry->packets_fwded); 144 (now.tv_sec-in_entry->tv.tv_sec),
145 in_entry->packets_fwded);
151 if (in_entry->shortcut) 146 if (in_entry->shortcut)
152 seq_printf(m, " %-3d %-3d",in_entry->shortcut->vpi,in_entry->shortcut->vci); 147 seq_printf(m, " %-3d %-3d",
148 in_entry->shortcut->vpi,
149 in_entry->shortcut->vci);
153 seq_printf(m, "\n"); 150 seq_printf(m, "\n");
154 } 151 }
155 152
@@ -157,21 +154,23 @@ static int mpc_show(struct seq_file *m, void *v)
157 seq_printf(m, "Egress Entries:\nIngress MPC ATM addr\nCache-id State Holding time Packets recvd Latest IP addr VPI VCI\n"); 154 seq_printf(m, "Egress Entries:\nIngress MPC ATM addr\nCache-id State Holding time Packets recvd Latest IP addr VPI VCI\n");
158 for (eg_entry = mpc->eg_cache; eg_entry; eg_entry = eg_entry->next) { 155 for (eg_entry = mpc->eg_cache; eg_entry; eg_entry = eg_entry->next) {
159 unsigned char *p = eg_entry->ctrl_info.in_MPC_data_ATM_addr; 156 unsigned char *p = eg_entry->ctrl_info.in_MPC_data_ATM_addr;
160 for(i = 0; i < ATM_ESA_LEN; i++) 157 for (i = 0; i < ATM_ESA_LEN; i++)
161 seq_printf(m, "%02x", p[i]); 158 seq_printf(m, "%02x", p[i]);
162 seq_printf(m, "\n%-16lu%s%-14lu%-15u", 159 seq_printf(m, "\n%-16lu%s%-14lu%-15u",
163 (unsigned long)ntohl(eg_entry->ctrl_info.cache_id), 160 (unsigned long)ntohl(eg_entry->ctrl_info.cache_id),
164 egress_state_string(eg_entry->entry_state), 161 egress_state_string(eg_entry->entry_state),
165 (eg_entry->ctrl_info.holding_time-(now.tv_sec-eg_entry->tv.tv_sec)), 162 (eg_entry->ctrl_info.holding_time -
163 (now.tv_sec-eg_entry->tv.tv_sec)),
166 eg_entry->packets_rcvd); 164 eg_entry->packets_rcvd);
167 165
168 /* latest IP address */ 166 /* latest IP address */
169 temp = (unsigned char *)&eg_entry->latest_ip_addr; 167 sprintf(ip_string, "%pI4", &eg_entry->latest_ip_addr);
170 sprintf(ip_string, "%d.%d.%d.%d", temp[0], temp[1], temp[2], temp[3]);
171 seq_printf(m, "%-16s", ip_string); 168 seq_printf(m, "%-16s", ip_string);
172 169
173 if (eg_entry->shortcut) 170 if (eg_entry->shortcut)
174 seq_printf(m, " %-3d %-3d",eg_entry->shortcut->vpi,eg_entry->shortcut->vci); 171 seq_printf(m, " %-3d %-3d",
172 eg_entry->shortcut->vpi,
173 eg_entry->shortcut->vci);
175 seq_printf(m, "\n"); 174 seq_printf(m, "\n");
176 } 175 }
177 seq_printf(m, "\n"); 176 seq_printf(m, "\n");
@@ -290,10 +289,9 @@ int mpc_proc_init(void)
290 */ 289 */
291void mpc_proc_clean(void) 290void mpc_proc_clean(void)
292{ 291{
293 remove_proc_entry(STAT_FILE_NAME,atm_proc_root); 292 remove_proc_entry(STAT_FILE_NAME, atm_proc_root);
294} 293}
295 294
296
297#endif /* CONFIG_PROC_FS */ 295#endif /* CONFIG_PROC_FS */
298 296
299 297