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

net/atm/resources.c: checkpatch cleanups

Spacing cleanups
Mostly 80 column wrapped.
Move embedded assigns out of tests
Move trailing statements to new lines
switch/case cleanups
Signed-off-by: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fa61f0ca
...@@ -71,7 +71,7 @@ struct atm_dev *atm_dev_lookup(int number) ...@@ -71,7 +71,7 @@ struct atm_dev *atm_dev_lookup(int number)
mutex_unlock(&atm_dev_mutex); mutex_unlock(&atm_dev_mutex);
return dev; return dev;
} }
EXPORT_SYMBOL(atm_dev_lookup);
struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops, struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
int number, unsigned long *flags) int number, unsigned long *flags)
...@@ -85,7 +85,8 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops, ...@@ -85,7 +85,8 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
} }
mutex_lock(&atm_dev_mutex); mutex_lock(&atm_dev_mutex);
if (number != -1) { if (number != -1) {
if ((inuse = __atm_dev_lookup(number))) { inuse = __atm_dev_lookup(number);
if (inuse) {
atm_dev_put(inuse); atm_dev_put(inuse);
mutex_unlock(&atm_dev_mutex); mutex_unlock(&atm_dev_mutex);
kfree(dev); kfree(dev);
...@@ -130,7 +131,7 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops, ...@@ -130,7 +131,7 @@ struct atm_dev *atm_dev_register(const char *type, const struct atmdev_ops *ops,
dev = NULL; dev = NULL;
goto out; goto out;
} }
EXPORT_SYMBOL(atm_dev_register);
void atm_dev_deregister(struct atm_dev *dev) void atm_dev_deregister(struct atm_dev *dev)
{ {
...@@ -152,7 +153,7 @@ void atm_dev_deregister(struct atm_dev *dev) ...@@ -152,7 +153,7 @@ void atm_dev_deregister(struct atm_dev *dev)
atm_dev_put(dev); atm_dev_put(dev);
} }
EXPORT_SYMBOL(atm_dev_deregister);
static void copy_aal_stats(struct k_atm_aal_stats *from, static void copy_aal_stats(struct k_atm_aal_stats *from,
struct atm_aal_stats *to) struct atm_aal_stats *to)
...@@ -162,7 +163,6 @@ static void copy_aal_stats(struct k_atm_aal_stats *from, ...@@ -162,7 +163,6 @@ static void copy_aal_stats(struct k_atm_aal_stats *from,
#undef __HANDLE_ITEM #undef __HANDLE_ITEM
} }
static void subtract_aal_stats(struct k_atm_aal_stats *from, static void subtract_aal_stats(struct k_atm_aal_stats *from,
struct atm_aal_stats *to) struct atm_aal_stats *to)
{ {
...@@ -171,8 +171,8 @@ static void subtract_aal_stats(struct k_atm_aal_stats *from, ...@@ -171,8 +171,8 @@ static void subtract_aal_stats(struct k_atm_aal_stats *from,
#undef __HANDLE_ITEM #undef __HANDLE_ITEM
} }
static int fetch_stats(struct atm_dev *dev, struct atm_dev_stats __user *arg,
static int fetch_stats(struct atm_dev *dev, struct atm_dev_stats __user *arg, int zero) int zero)
{ {
struct atm_dev_stats tmp; struct atm_dev_stats tmp;
int error = 0; int error = 0;
...@@ -190,7 +190,6 @@ static int fetch_stats(struct atm_dev *dev, struct atm_dev_stats __user *arg, in ...@@ -190,7 +190,6 @@ static int fetch_stats(struct atm_dev *dev, struct atm_dev_stats __user *arg, in
return error ? -EFAULT : 0; return error ? -EFAULT : 0;
} }
int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat) int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat)
{ {
void __user *buf; void __user *buf;
...@@ -207,7 +206,6 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat) ...@@ -207,7 +206,6 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat)
switch (cmd) { switch (cmd) {
case ATM_GETNAMES: case ATM_GETNAMES:
if (compat) { if (compat) {
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
struct compat_atm_iobuf __user *ciobuf = arg; struct compat_atm_iobuf __user *ciobuf = arg;
...@@ -278,8 +276,10 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat) ...@@ -278,8 +276,10 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat)
if (get_user(number, &sioc->number)) if (get_user(number, &sioc->number))
return -EFAULT; return -EFAULT;
} }
if (!(dev = try_then_request_module(atm_dev_lookup(number),
"atm-device-%d", number))) dev = try_then_request_module(atm_dev_lookup(number), "atm-device-%d",
number);
if (!dev)
return -ENODEV; return -ENODEV;
switch (cmd) { switch (cmd) {
...@@ -361,12 +361,13 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat) ...@@ -361,12 +361,13 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat)
case ATM_DELADDR: case ATM_DELADDR:
case ATM_ADDLECSADDR: case ATM_ADDLECSADDR:
case ATM_DELLECSADDR: case ATM_DELLECSADDR:
{
struct sockaddr_atmsvc addr;
if (!capable(CAP_NET_ADMIN)) { if (!capable(CAP_NET_ADMIN)) {
error = -EPERM; error = -EPERM;
goto done; goto done;
} }
{
struct sockaddr_atmsvc addr;
if (copy_from_user(&addr, buf, sizeof(addr))) { if (copy_from_user(&addr, buf, sizeof(addr))) {
error = -EFAULT; error = -EFAULT;
...@@ -392,8 +393,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat) ...@@ -392,8 +393,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat)
size = error; size = error;
/* may return 0, but later on size == 0 means "don't /* may return 0, but later on size == 0 means "don't
write the length" */ write the length" */
error = put_user(size, sioc_len) error = put_user(size, sioc_len) ? -EFAULT : 0;
? -EFAULT : 0;
goto done; goto done;
case ATM_SETLOOP: case ATM_SETLOOP:
if (__ATM_LM_XTRMT((int) (unsigned long) buf) && if (__ATM_LM_XTRMT((int) (unsigned long) buf) &&
...@@ -436,8 +436,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat) ...@@ -436,8 +436,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat)
} }
if (size) if (size)
error = put_user(size, sioc_len) error = put_user(size, sioc_len) ? -EFAULT : 0;
? -EFAULT : 0;
else else
error = 0; error = 0;
done: done:
...@@ -445,7 +444,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat) ...@@ -445,7 +444,7 @@ int atm_dev_ioctl(unsigned int cmd, void __user *arg, int compat)
return error; return error;
} }
static __inline__ void *dev_get_idx(loff_t left) static inline void *dev_get_idx(loff_t left)
{ {
struct list_head *p; struct list_head *p;
...@@ -474,8 +473,3 @@ void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos) ...@@ -474,8 +473,3 @@ void *atm_dev_seq_next(struct seq_file *seq, void *v, loff_t *pos)
? atm_devs.next : ((struct list_head *)v)->next; ? atm_devs.next : ((struct list_head *)v)->next;
return (v == &atm_devs) ? NULL : v; return (v == &atm_devs) ? NULL : v;
} }
EXPORT_SYMBOL(atm_dev_register);
EXPORT_SYMBOL(atm_dev_deregister);
EXPORT_SYMBOL(atm_dev_lookup);
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