提交 07367adb 编写于 作者: J Joe Perches 提交者: David S. Miller

net/atm/proc.c: checkpatch cleanups

Convert #include <asm... to #include <linux...
Mostly 80 column wrapped.
Spacing cleanups
Move trailing statements to new lines
switch/case cleanups
Signed-off-by: NJoe Perches <joe@perches.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 d81219db
...@@ -24,15 +24,15 @@ ...@@ -24,15 +24,15 @@
#include <linux/init.h> /* for __init */ #include <linux/init.h> /* for __init */
#include <net/net_namespace.h> #include <net/net_namespace.h>
#include <net/atmclip.h> #include <net/atmclip.h>
#include <asm/uaccess.h> #include <linux/uaccess.h>
#include <linux/param.h> /* for HZ */
#include <asm/atomic.h> #include <asm/atomic.h>
#include <asm/param.h> /* for HZ */
#include "resources.h" #include "resources.h"
#include "common.h" /* atm_proc_init prototype */ #include "common.h" /* atm_proc_init prototype */
#include "signaling.h" /* to get sigd - ugly too */ #include "signaling.h" /* to get sigd - ugly too */
static ssize_t proc_dev_atm_read(struct file *file,char __user *buf,size_t count, static ssize_t proc_dev_atm_read(struct file *file, char __user *buf,
loff_t *pos); size_t count, loff_t *pos);
static const struct file_operations proc_atm_dev_ops = { static const struct file_operations proc_atm_dev_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
...@@ -43,8 +43,8 @@ static void add_stats(struct seq_file *seq, const char *aal, ...@@ -43,8 +43,8 @@ static void add_stats(struct seq_file *seq, const char *aal,
const struct k_atm_aal_stats *stats) const struct k_atm_aal_stats *stats)
{ {
seq_printf(seq, "%s ( %d %d %d %d %d )", aal, seq_printf(seq, "%s ( %d %d %d %d %d )", aal,
atomic_read(&stats->tx),atomic_read(&stats->tx_err), atomic_read(&stats->tx), atomic_read(&stats->tx_err),
atomic_read(&stats->rx),atomic_read(&stats->rx_err), atomic_read(&stats->rx), atomic_read(&stats->rx_err),
atomic_read(&stats->rx_drop)); atomic_read(&stats->rx_drop));
} }
...@@ -151,8 +151,8 @@ static void *vcc_seq_next(struct seq_file *seq, void *v, loff_t *pos) ...@@ -151,8 +151,8 @@ static void *vcc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
static void pvc_info(struct seq_file *seq, struct atm_vcc *vcc) static void pvc_info(struct seq_file *seq, struct atm_vcc *vcc)
{ {
static const char *const class_name[] = static const char *const class_name[] = {
{"off","UBR","CBR","VBR","ABR"}; "off", "UBR", "CBR", "VBR", "ABR"};
static const char *const aal_name[] = { static const char *const aal_name[] = {
"---", "1", "2", "3/4", /* 0- 3 */ "---", "1", "2", "3/4", /* 0- 3 */
"???", "5", "???", "???", /* 4- 7 */ "???", "5", "???", "???", /* 4- 7 */
...@@ -160,10 +160,11 @@ static void pvc_info(struct seq_file *seq, struct atm_vcc *vcc) ...@@ -160,10 +160,11 @@ static void pvc_info(struct seq_file *seq, struct atm_vcc *vcc)
"???", "0", "???", "???"}; /* 12-15 */ "???", "0", "???", "???"}; /* 12-15 */
seq_printf(seq, "%3d %3d %5d %-3s %7d %-5s %7d %-6s", seq_printf(seq, "%3d %3d %5d %-3s %7d %-5s %7d %-6s",
vcc->dev->number,vcc->vpi,vcc->vci, vcc->dev->number, vcc->vpi, vcc->vci,
vcc->qos.aal >= ARRAY_SIZE(aal_name) ? "err" : vcc->qos.aal >= ARRAY_SIZE(aal_name) ? "err" :
aal_name[vcc->qos.aal],vcc->qos.rxtp.min_pcr, aal_name[vcc->qos.aal], vcc->qos.rxtp.min_pcr,
class_name[vcc->qos.rxtp.traffic_class],vcc->qos.txtp.min_pcr, class_name[vcc->qos.rxtp.traffic_class],
vcc->qos.txtp.min_pcr,
class_name[vcc->qos.txtp.traffic_class]); class_name[vcc->qos.txtp.traffic_class]);
if (test_bit(ATM_VF_IS_CLIP, &vcc->flags)) { if (test_bit(ATM_VF_IS_CLIP, &vcc->flags)) {
struct clip_vcc *clip_vcc = CLIP_VCC(vcc); struct clip_vcc *clip_vcc = CLIP_VCC(vcc);
...@@ -204,7 +205,8 @@ static void vcc_info(struct seq_file *seq, struct atm_vcc *vcc) ...@@ -204,7 +205,8 @@ static void vcc_info(struct seq_file *seq, struct atm_vcc *vcc)
default: default:
seq_printf(seq, "%3d", sk->sk_family); seq_printf(seq, "%3d", sk->sk_family);
} }
seq_printf(seq, " %04lx %5d %7d/%7d %7d/%7d [%d]\n", vcc->flags, sk->sk_err, seq_printf(seq, " %04lx %5d %7d/%7d %7d/%7d [%d]\n",
vcc->flags, sk->sk_err,
sk_wmem_alloc_get(sk), sk->sk_sndbuf, sk_wmem_alloc_get(sk), sk->sk_sndbuf,
sk_rmem_alloc_get(sk), sk->sk_rcvbuf, sk_rmem_alloc_get(sk), sk->sk_rcvbuf,
atomic_read(&sk->sk_refcnt)); atomic_read(&sk->sk_refcnt));
...@@ -376,32 +378,35 @@ static ssize_t proc_dev_atm_read(struct file *file, char __user *buf, ...@@ -376,32 +378,35 @@ static ssize_t proc_dev_atm_read(struct file *file, char __user *buf,
unsigned long page; unsigned long page;
int length; int length;
if (count == 0) return 0; if (count == 0)
return 0;
page = get_zeroed_page(GFP_KERNEL); page = get_zeroed_page(GFP_KERNEL);
if (!page) return -ENOMEM; if (!page)
return -ENOMEM;
dev = PDE(file->f_path.dentry->d_inode)->data; dev = PDE(file->f_path.dentry->d_inode)->data;
if (!dev->ops->proc_read) if (!dev->ops->proc_read)
length = -EINVAL; length = -EINVAL;
else { else {
length = dev->ops->proc_read(dev,pos,(char *) page); length = dev->ops->proc_read(dev, pos, (char *)page);
if (length > count) length = -EINVAL; if (length > count)
length = -EINVAL;
} }
if (length >= 0) { if (length >= 0) {
if (copy_to_user(buf,(char *) page,length)) length = -EFAULT; if (copy_to_user(buf, (char *)page, length))
length = -EFAULT;
(*pos)++; (*pos)++;
} }
free_page(page); free_page(page);
return length; return length;
} }
struct proc_dir_entry *atm_proc_root; struct proc_dir_entry *atm_proc_root;
EXPORT_SYMBOL(atm_proc_root); EXPORT_SYMBOL(atm_proc_root);
int atm_proc_dev_register(struct atm_dev *dev) int atm_proc_dev_register(struct atm_dev *dev)
{ {
int digits,num; int digits, num;
int error; int error;
/* No proc info */ /* No proc info */
...@@ -410,26 +415,28 @@ int atm_proc_dev_register(struct atm_dev *dev) ...@@ -410,26 +415,28 @@ int atm_proc_dev_register(struct atm_dev *dev)
error = -ENOMEM; error = -ENOMEM;
digits = 0; digits = 0;
for (num = dev->number; num; num /= 10) digits++; for (num = dev->number; num; num /= 10)
if (!digits) digits++; digits++;
if (!digits)
digits++;
dev->proc_name = kmalloc(strlen(dev->type) + digits + 2, GFP_KERNEL); dev->proc_name = kmalloc(strlen(dev->type) + digits + 2, GFP_KERNEL);
if (!dev->proc_name) if (!dev->proc_name)
goto err_out; goto err_out;
sprintf(dev->proc_name,"%s:%d",dev->type, dev->number); sprintf(dev->proc_name, "%s:%d", dev->type, dev->number);
dev->proc_entry = proc_create_data(dev->proc_name, 0, atm_proc_root, dev->proc_entry = proc_create_data(dev->proc_name, 0, atm_proc_root,
&proc_atm_dev_ops, dev); &proc_atm_dev_ops, dev);
if (!dev->proc_entry) if (!dev->proc_entry)
goto err_free_name; goto err_free_name;
return 0; return 0;
err_free_name: err_free_name:
kfree(dev->proc_name); kfree(dev->proc_name);
err_out: err_out:
return error; return error;
} }
void atm_proc_dev_deregister(struct atm_dev *dev) void atm_proc_dev_deregister(struct atm_dev *dev)
{ {
if (!dev->ops->proc_read) if (!dev->ops->proc_read)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册