Commit f1e10049 authored by Joe Perches's avatar Joe Perches Committed by David S. Miller

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: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bee67d34
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
#include <linux/time.h> #include <linux/time.h>
#include <linux/seq_file.h> #include <linux/seq_file.h>
#include <asm/uaccess.h> #include <linux/uaccess.h>
#include <linux/atmmpc.h> #include <linux/atmmpc.h>
#include <linux/atm.h> #include <linux/atm.h>
#include "mpc.h" #include "mpc.h"
...@@ -21,9 +21,10 @@ ...@@ -21,9 +21,10 @@
*/ */
#if 1 #if 1
#define dprintk printk /* debug */ #define dprintk(format, args...) printk(KERN_DEBUG format, ##args) /* debug */
#else #else
#define dprintk(format,args...) #define dprintk(format, args...) \
do { if (0) printk(KERN_DEBUG format, ##args); } while (0)
#endif #endif
#define STAT_FILE_NAME "mpc" /* Our statistic file's name */ #define STAT_FILE_NAME "mpc" /* Our statistic file's name */
...@@ -52,42 +53,37 @@ static const struct file_operations mpc_file_operations = { ...@@ -52,42 +53,37 @@ static const struct file_operations mpc_file_operations = {
/* /*
* Returns the state of an ingress cache entry as a string * Returns the state of an ingress cache entry as a string
*/ */
static const char *ingress_state_string(int state){ static const char *ingress_state_string(int state)
switch(state) { {
switch (state) {
case INGRESS_RESOLVING: case INGRESS_RESOLVING:
return "resolving "; return "resolving ";
break;
case INGRESS_RESOLVED: case INGRESS_RESOLVED:
return "resolved "; return "resolved ";
break;
case INGRESS_INVALID: case INGRESS_INVALID:
return "invalid "; return "invalid ";
break;
case INGRESS_REFRESHING: case INGRESS_REFRESHING:
return "refreshing "; return "refreshing ";
break;
default:
return "";
} }
return "";
} }
/* /*
* Returns the state of an egress cache entry as a string * Returns the state of an egress cache entry as a string
*/ */
static const char *egress_state_string(int state){ static const char *egress_state_string(int state)
switch(state) { {
switch (state) {
case EGRESS_RESOLVED: case EGRESS_RESOLVED:
return "resolved "; return "resolved ";
break;
case EGRESS_PURGE: case EGRESS_PURGE:
return "purge "; return "purge ";
break;
case EGRESS_INVALID: case EGRESS_INVALID:
return "invalid "; return "invalid ";
break;
default:
return "";
} }
return "";
} }
/* /*
...@@ -124,7 +120,6 @@ static void mpc_stop(struct seq_file *m, void *v) ...@@ -124,7 +120,6 @@ static void mpc_stop(struct seq_file *m, void *v)
static int mpc_show(struct seq_file *m, void *v) static int mpc_show(struct seq_file *m, void *v)
{ {
struct mpoa_client *mpc = v; struct mpoa_client *mpc = v;
unsigned char *temp;
int i; int i;
in_cache_entry *in_entry; in_cache_entry *in_entry;
eg_cache_entry *eg_entry; eg_cache_entry *eg_entry;
...@@ -141,15 +136,17 @@ static int mpc_show(struct seq_file *m, void *v) ...@@ -141,15 +136,17 @@ static int mpc_show(struct seq_file *m, void *v)
do_gettimeofday(&now); do_gettimeofday(&now);
for (in_entry = mpc->in_cache; in_entry; in_entry = in_entry->next) { for (in_entry = mpc->in_cache; in_entry; in_entry = in_entry->next) {
temp = (unsigned char *)&in_entry->ctrl_info.in_dst_ip; sprintf(ip_string, "%pI4", &in_entry->ctrl_info.in_dst_ip);
sprintf(ip_string,"%d.%d.%d.%d", temp[0], temp[1], temp[2], temp[3]);
seq_printf(m, "%-16s%s%-14lu%-12u", seq_printf(m, "%-16s%s%-14lu%-12u",
ip_string, ip_string,
ingress_state_string(in_entry->entry_state), ingress_state_string(in_entry->entry_state),
in_entry->ctrl_info.holding_time-(now.tv_sec-in_entry->tv.tv_sec), in_entry->ctrl_info.holding_time -
in_entry->packets_fwded); (now.tv_sec-in_entry->tv.tv_sec),
in_entry->packets_fwded);
if (in_entry->shortcut) if (in_entry->shortcut)
seq_printf(m, " %-3d %-3d",in_entry->shortcut->vpi,in_entry->shortcut->vci); seq_printf(m, " %-3d %-3d",
in_entry->shortcut->vpi,
in_entry->shortcut->vci);
seq_printf(m, "\n"); seq_printf(m, "\n");
} }
...@@ -157,21 +154,23 @@ static int mpc_show(struct seq_file *m, void *v) ...@@ -157,21 +154,23 @@ static int mpc_show(struct seq_file *m, void *v)
seq_printf(m, "Egress Entries:\nIngress MPC ATM addr\nCache-id State Holding time Packets recvd Latest IP addr VPI VCI\n"); seq_printf(m, "Egress Entries:\nIngress MPC ATM addr\nCache-id State Holding time Packets recvd Latest IP addr VPI VCI\n");
for (eg_entry = mpc->eg_cache; eg_entry; eg_entry = eg_entry->next) { for (eg_entry = mpc->eg_cache; eg_entry; eg_entry = eg_entry->next) {
unsigned char *p = eg_entry->ctrl_info.in_MPC_data_ATM_addr; unsigned char *p = eg_entry->ctrl_info.in_MPC_data_ATM_addr;
for(i = 0; i < ATM_ESA_LEN; i++) for (i = 0; i < ATM_ESA_LEN; i++)
seq_printf(m, "%02x", p[i]); seq_printf(m, "%02x", p[i]);
seq_printf(m, "\n%-16lu%s%-14lu%-15u", seq_printf(m, "\n%-16lu%s%-14lu%-15u",
(unsigned long)ntohl(eg_entry->ctrl_info.cache_id), (unsigned long)ntohl(eg_entry->ctrl_info.cache_id),
egress_state_string(eg_entry->entry_state), egress_state_string(eg_entry->entry_state),
(eg_entry->ctrl_info.holding_time-(now.tv_sec-eg_entry->tv.tv_sec)), (eg_entry->ctrl_info.holding_time -
(now.tv_sec-eg_entry->tv.tv_sec)),
eg_entry->packets_rcvd); eg_entry->packets_rcvd);
/* latest IP address */ /* latest IP address */
temp = (unsigned char *)&eg_entry->latest_ip_addr; sprintf(ip_string, "%pI4", &eg_entry->latest_ip_addr);
sprintf(ip_string, "%d.%d.%d.%d", temp[0], temp[1], temp[2], temp[3]);
seq_printf(m, "%-16s", ip_string); seq_printf(m, "%-16s", ip_string);
if (eg_entry->shortcut) if (eg_entry->shortcut)
seq_printf(m, " %-3d %-3d",eg_entry->shortcut->vpi,eg_entry->shortcut->vci); seq_printf(m, " %-3d %-3d",
eg_entry->shortcut->vpi,
eg_entry->shortcut->vci);
seq_printf(m, "\n"); seq_printf(m, "\n");
} }
seq_printf(m, "\n"); seq_printf(m, "\n");
...@@ -290,10 +289,9 @@ int mpc_proc_init(void) ...@@ -290,10 +289,9 @@ int mpc_proc_init(void)
*/ */
void mpc_proc_clean(void) void mpc_proc_clean(void)
{ {
remove_proc_entry(STAT_FILE_NAME,atm_proc_root); remove_proc_entry(STAT_FILE_NAME, atm_proc_root);
} }
#endif /* CONFIG_PROC_FS */ #endif /* CONFIG_PROC_FS */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment