diff options
author | Joe Perches <joe@perches.com> | 2011-07-03 04:28:33 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-03 23:05:16 -0400 |
commit | ee9c88f2283c80d9926f980848ae02cc3e88ee57 (patch) | |
tree | 555bb631123e37f36ff7b4e81c2af34a60fe176c /net/econet/af_econet.c | |
parent | 2a49e001cbe3ebf5987024052ed0dff67689c5bb (diff) |
af_econet: Use current logging styles and neatening
Use pr_fmt() without KBUILD_MODNAME to allow AUN and econet prefixes.
Convert printks with KERN_DEBUG to pr_debug.
Hoist assigns from if.
80 column wrapping.
Move open braces to end of line.
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/econet/af_econet.c')
-rw-r--r-- | net/econet/af_econet.c | 149 |
1 files changed, 74 insertions, 75 deletions
diff --git a/net/econet/af_econet.c b/net/econet/af_econet.c index 5afdc8fc81b1..1c1f26c5d672 100644 --- a/net/econet/af_econet.c +++ b/net/econet/af_econet.c | |||
@@ -9,6 +9,8 @@ | |||
9 | * | 9 | * |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #define pr_fmt(fmt) fmt | ||
13 | |||
12 | #include <linux/module.h> | 14 | #include <linux/module.h> |
13 | 15 | ||
14 | #include <linux/types.h> | 16 | #include <linux/types.h> |
@@ -44,7 +46,7 @@ | |||
44 | #include <linux/bitops.h> | 46 | #include <linux/bitops.h> |
45 | #include <linux/mutex.h> | 47 | #include <linux/mutex.h> |
46 | 48 | ||
47 | #include <asm/uaccess.h> | 49 | #include <linux/uaccess.h> |
48 | #include <asm/system.h> | 50 | #include <asm/system.h> |
49 | 51 | ||
50 | static const struct proto_ops econet_ops; | 52 | static const struct proto_ops econet_ops; |
@@ -63,9 +65,7 @@ static DEFINE_SPINLOCK(aun_queue_lock); | |||
63 | static struct socket *udpsock; | 65 | static struct socket *udpsock; |
64 | #define AUN_PORT 0x8000 | 66 | #define AUN_PORT 0x8000 |
65 | 67 | ||
66 | 68 | struct aunhdr { | |
67 | struct aunhdr | ||
68 | { | ||
69 | unsigned char code; /* AUN magic protocol byte */ | 69 | unsigned char code; /* AUN magic protocol byte */ |
70 | unsigned char port; | 70 | unsigned char port; |
71 | unsigned char cb; | 71 | unsigned char cb; |
@@ -82,8 +82,7 @@ static struct timer_list ab_cleanup_timer; | |||
82 | #endif /* CONFIG_ECONET_AUNUDP */ | 82 | #endif /* CONFIG_ECONET_AUNUDP */ |
83 | 83 | ||
84 | /* Per-packet information */ | 84 | /* Per-packet information */ |
85 | struct ec_cb | 85 | struct ec_cb { |
86 | { | ||
87 | struct sockaddr_ec sec; | 86 | struct sockaddr_ec sec; |
88 | unsigned long cookie; /* Supplied by user. */ | 87 | unsigned long cookie; /* Supplied by user. */ |
89 | #ifdef CONFIG_ECONET_AUNUDP | 88 | #ifdef CONFIG_ECONET_AUNUDP |
@@ -137,7 +136,7 @@ static int econet_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
137 | * but then it will block. | 136 | * but then it will block. |
138 | */ | 137 | */ |
139 | 138 | ||
140 | skb=skb_recv_datagram(sk,flags,flags&MSG_DONTWAIT,&err); | 139 | skb = skb_recv_datagram(sk, flags, flags & MSG_DONTWAIT, &err); |
141 | 140 | ||
142 | /* | 141 | /* |
143 | * An error occurred so return it. Because skb_recv_datagram() | 142 | * An error occurred so return it. Because skb_recv_datagram() |
@@ -145,7 +144,7 @@ static int econet_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
145 | * retries. | 144 | * retries. |
146 | */ | 145 | */ |
147 | 146 | ||
148 | if(skb==NULL) | 147 | if (skb == NULL) |
149 | goto out; | 148 | goto out; |
150 | 149 | ||
151 | /* | 150 | /* |
@@ -154,10 +153,9 @@ static int econet_recvmsg(struct kiocb *iocb, struct socket *sock, | |||
154 | */ | 153 | */ |
155 | 154 | ||
156 | copied = skb->len; | 155 | copied = skb->len; |
157 | if (copied > len) | 156 | if (copied > len) { |
158 | { | 157 | copied = len; |
159 | copied=len; | 158 | msg->msg_flags |= MSG_TRUNC; |
160 | msg->msg_flags|=MSG_TRUNC; | ||
161 | } | 159 | } |
162 | 160 | ||
163 | /* We can't use skb_copy_datagram here */ | 161 | /* We can't use skb_copy_datagram here */ |
@@ -186,7 +184,8 @@ out: | |||
186 | * Bind an Econet socket. | 184 | * Bind an Econet socket. |
187 | */ | 185 | */ |
188 | 186 | ||
189 | static int econet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | 187 | static int econet_bind(struct socket *sock, struct sockaddr *uaddr, |
188 | int addr_len) | ||
190 | { | 189 | { |
191 | struct sockaddr_ec *sec = (struct sockaddr_ec *)uaddr; | 190 | struct sockaddr_ec *sec = (struct sockaddr_ec *)uaddr; |
192 | struct sock *sk; | 191 | struct sock *sk; |
@@ -226,9 +225,8 @@ static void tx_result(struct sock *sk, unsigned long cookie, int result) | |||
226 | struct ec_cb *eb; | 225 | struct ec_cb *eb; |
227 | struct sockaddr_ec *sec; | 226 | struct sockaddr_ec *sec; |
228 | 227 | ||
229 | if (skb == NULL) | 228 | if (skb == NULL) { |
230 | { | 229 | pr_debug("econet: memory squeeze, transmit result dropped\n"); |
231 | printk(KERN_DEBUG "ec: memory squeeze, transmit result dropped.\n"); | ||
232 | return; | 230 | return; |
233 | } | 231 | } |
234 | 232 | ||
@@ -265,7 +263,7 @@ static void ec_tx_done(struct sk_buff *skb, int result) | |||
265 | static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | 263 | static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, |
266 | struct msghdr *msg, size_t len) | 264 | struct msghdr *msg, size_t len) |
267 | { | 265 | { |
268 | struct sockaddr_ec *saddr=(struct sockaddr_ec *)msg->msg_name; | 266 | struct sockaddr_ec *saddr = (struct sockaddr_ec *)msg->msg_name; |
269 | struct net_device *dev; | 267 | struct net_device *dev; |
270 | struct ec_addr addr; | 268 | struct ec_addr addr; |
271 | int err; | 269 | int err; |
@@ -298,14 +296,14 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
298 | 296 | ||
299 | mutex_lock(&econet_mutex); | 297 | mutex_lock(&econet_mutex); |
300 | 298 | ||
301 | if (saddr == NULL || msg->msg_namelen < sizeof(struct sockaddr_ec)) { | 299 | if (saddr == NULL || msg->msg_namelen < sizeof(struct sockaddr_ec)) { |
302 | mutex_unlock(&econet_mutex); | 300 | mutex_unlock(&econet_mutex); |
303 | return -EINVAL; | 301 | return -EINVAL; |
304 | } | 302 | } |
305 | addr.station = saddr->addr.station; | 303 | addr.station = saddr->addr.station; |
306 | addr.net = saddr->addr.net; | 304 | addr.net = saddr->addr.net; |
307 | port = saddr->port; | 305 | port = saddr->port; |
308 | cb = saddr->cb; | 306 | cb = saddr->cb; |
309 | 307 | ||
310 | /* Look for a device with the right network number. */ | 308 | /* Look for a device with the right network number. */ |
311 | dev = net2dev_map[addr.net]; | 309 | dev = net2dev_map[addr.net]; |
@@ -333,9 +331,9 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
333 | 331 | ||
334 | dev_hold(dev); | 332 | dev_hold(dev); |
335 | 333 | ||
336 | skb = sock_alloc_send_skb(sk, len+LL_ALLOCATED_SPACE(dev), | 334 | skb = sock_alloc_send_skb(sk, len + LL_ALLOCATED_SPACE(dev), |
337 | msg->msg_flags & MSG_DONTWAIT, &err); | 335 | msg->msg_flags & MSG_DONTWAIT, &err); |
338 | if (skb==NULL) | 336 | if (skb == NULL) |
339 | goto out_unlock; | 337 | goto out_unlock; |
340 | 338 | ||
341 | skb_reserve(skb, LL_RESERVED_SPACE(dev)); | 339 | skb_reserve(skb, LL_RESERVED_SPACE(dev)); |
@@ -355,7 +353,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
355 | struct ec_framehdr *fh; | 353 | struct ec_framehdr *fh; |
356 | /* Poke in our control byte and | 354 | /* Poke in our control byte and |
357 | port number. Hack, hack. */ | 355 | port number. Hack, hack. */ |
358 | fh = (struct ec_framehdr *)(skb->data); | 356 | fh = (struct ec_framehdr *)skb->data; |
359 | fh->cb = cb; | 357 | fh->cb = cb; |
360 | fh->port = port; | 358 | fh->port = port; |
361 | if (sock->type != SOCK_DGRAM) { | 359 | if (sock->type != SOCK_DGRAM) { |
@@ -365,7 +363,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
365 | } | 363 | } |
366 | 364 | ||
367 | /* Copy the data. Returns -EFAULT on error */ | 365 | /* Copy the data. Returns -EFAULT on error */ |
368 | err = memcpy_fromiovec(skb_put(skb,len), msg->msg_iov, len); | 366 | err = memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len); |
369 | skb->protocol = proto; | 367 | skb->protocol = proto; |
370 | skb->dev = dev; | 368 | skb->dev = dev; |
371 | skb->priority = sk->sk_priority; | 369 | skb->priority = sk->sk_priority; |
@@ -385,9 +383,9 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
385 | mutex_unlock(&econet_mutex); | 383 | mutex_unlock(&econet_mutex); |
386 | return len; | 384 | return len; |
387 | 385 | ||
388 | out_free: | 386 | out_free: |
389 | kfree_skb(skb); | 387 | kfree_skb(skb); |
390 | out_unlock: | 388 | out_unlock: |
391 | if (dev) | 389 | if (dev) |
392 | dev_put(dev); | 390 | dev_put(dev); |
393 | #else | 391 | #else |
@@ -458,15 +456,14 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
458 | goto error_free_buf; | 456 | goto error_free_buf; |
459 | 457 | ||
460 | /* Get a skbuff (no data, just holds our cb information) */ | 458 | /* Get a skbuff (no data, just holds our cb information) */ |
461 | if ((skb = sock_alloc_send_skb(sk, 0, | 459 | skb = sock_alloc_send_skb(sk, 0, msg->msg_flags & MSG_DONTWAIT, &err); |
462 | msg->msg_flags & MSG_DONTWAIT, | 460 | if (skb == NULL) |
463 | &err)) == NULL) | ||
464 | goto error_free_buf; | 461 | goto error_free_buf; |
465 | 462 | ||
466 | eb = (struct ec_cb *)&skb->cb; | 463 | eb = (struct ec_cb *)&skb->cb; |
467 | 464 | ||
468 | eb->cookie = saddr->cookie; | 465 | eb->cookie = saddr->cookie; |
469 | eb->timeout = (5*HZ); | 466 | eb->timeout = 5 * HZ; |
470 | eb->start = jiffies; | 467 | eb->start = jiffies; |
471 | ah.handle = aun_seq; | 468 | ah.handle = aun_seq; |
472 | eb->seq = (aun_seq++); | 469 | eb->seq = (aun_seq++); |
@@ -480,9 +477,10 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
480 | udpmsg.msg_iovlen = 2; | 477 | udpmsg.msg_iovlen = 2; |
481 | udpmsg.msg_control = NULL; | 478 | udpmsg.msg_control = NULL; |
482 | udpmsg.msg_controllen = 0; | 479 | udpmsg.msg_controllen = 0; |
483 | udpmsg.msg_flags=0; | 480 | udpmsg.msg_flags = 0; |
484 | 481 | ||
485 | oldfs = get_fs(); set_fs(KERNEL_DS); /* More privs :-) */ | 482 | oldfs = get_fs(); |
483 | set_fs(KERNEL_DS); /* More privs :-) */ | ||
486 | err = sock_sendmsg(udpsock, &udpmsg, size); | 484 | err = sock_sendmsg(udpsock, &udpmsg, size); |
487 | set_fs(oldfs); | 485 | set_fs(oldfs); |
488 | 486 | ||
@@ -530,7 +528,7 @@ static int econet_getname(struct socket *sock, struct sockaddr *uaddr, | |||
530 | 528 | ||
531 | static void econet_destroy_timer(unsigned long data) | 529 | static void econet_destroy_timer(unsigned long data) |
532 | { | 530 | { |
533 | struct sock *sk=(struct sock *)data; | 531 | struct sock *sk = (struct sock *)data; |
534 | 532 | ||
535 | if (!sk_has_allocations(sk)) { | 533 | if (!sk_has_allocations(sk)) { |
536 | sk_free(sk); | 534 | sk_free(sk); |
@@ -539,7 +537,7 @@ static void econet_destroy_timer(unsigned long data) | |||
539 | 537 | ||
540 | sk->sk_timer.expires = jiffies + 10 * HZ; | 538 | sk->sk_timer.expires = jiffies + 10 * HZ; |
541 | add_timer(&sk->sk_timer); | 539 | add_timer(&sk->sk_timer); |
542 | printk(KERN_DEBUG "econet socket destroy delayed\n"); | 540 | pr_debug("econet: socket destroy delayed\n"); |
543 | } | 541 | } |
544 | 542 | ||
545 | /* | 543 | /* |
@@ -651,7 +649,8 @@ static int ec_dev_ioctl(struct socket *sock, unsigned int cmd, void __user *arg) | |||
651 | if (copy_from_user(&ifr, arg, sizeof(struct ifreq))) | 649 | if (copy_from_user(&ifr, arg, sizeof(struct ifreq))) |
652 | return -EFAULT; | 650 | return -EFAULT; |
653 | 651 | ||
654 | if ((dev = dev_get_by_name(&init_net, ifr.ifr_name)) == NULL) | 652 | dev = dev_get_by_name(&init_net, ifr.ifr_name); |
653 | if (dev == NULL) | ||
655 | return -ENODEV; | 654 | return -ENODEV; |
656 | 655 | ||
657 | sec = (struct sockaddr_ec *)&ifr.ifr_addr; | 656 | sec = (struct sockaddr_ec *)&ifr.ifr_addr; |
@@ -715,7 +714,8 @@ static int ec_dev_ioctl(struct socket *sock, unsigned int cmd, void __user *arg) | |||
715 | * Handle generic ioctls | 714 | * Handle generic ioctls |
716 | */ | 715 | */ |
717 | 716 | ||
718 | static int econet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | 717 | static int econet_ioctl(struct socket *sock, unsigned int cmd, |
718 | unsigned long arg) | ||
719 | { | 719 | { |
720 | struct sock *sk = sock->sk; | 720 | struct sock *sk = sock->sk; |
721 | void __user *argp = (void __user *)arg; | 721 | void __user *argp = (void __user *)arg; |
@@ -833,7 +833,7 @@ static void aun_send_response(__u32 addr, unsigned long seq, int code, int cb) | |||
833 | udpmsg.msg_namelen = sizeof(sin); | 833 | udpmsg.msg_namelen = sizeof(sin); |
834 | udpmsg.msg_control = NULL; | 834 | udpmsg.msg_control = NULL; |
835 | udpmsg.msg_controllen = 0; | 835 | udpmsg.msg_controllen = 0; |
836 | udpmsg.msg_flags=0; | 836 | udpmsg.msg_flags = 0; |
837 | 837 | ||
838 | kernel_sendmsg(udpsock, &udpmsg, &iov, 1, sizeof(ah)); | 838 | kernel_sendmsg(udpsock, &udpmsg, &iov, 1, sizeof(ah)); |
839 | } | 839 | } |
@@ -856,26 +856,25 @@ static void aun_incoming(struct sk_buff *skb, struct aunhdr *ah, size_t len) | |||
856 | if (dst) | 856 | if (dst) |
857 | edev = dst->dev->ec_ptr; | 857 | edev = dst->dev->ec_ptr; |
858 | 858 | ||
859 | if (! edev) | 859 | if (!edev) |
860 | goto bad; | 860 | goto bad; |
861 | 861 | ||
862 | if ((sk = ec_listening_socket(ah->port, stn, edev->net)) == NULL) | 862 | sk = ec_listening_socket(ah->port, stn, edev->net); |
863 | if (sk == NULL) | ||
863 | goto bad; /* Nobody wants it */ | 864 | goto bad; /* Nobody wants it */ |
864 | 865 | ||
865 | newskb = alloc_skb((len - sizeof(struct aunhdr) + 15) & ~15, | 866 | newskb = alloc_skb((len - sizeof(struct aunhdr) + 15) & ~15, |
866 | GFP_ATOMIC); | 867 | GFP_ATOMIC); |
867 | if (newskb == NULL) | 868 | if (newskb == NULL) { |
868 | { | 869 | pr_debug("AUN: memory squeeze, dropping packet\n"); |
869 | printk(KERN_DEBUG "AUN: memory squeeze, dropping packet.\n"); | ||
870 | /* Send nack and hope sender tries again */ | 870 | /* Send nack and hope sender tries again */ |
871 | goto bad; | 871 | goto bad; |
872 | } | 872 | } |
873 | 873 | ||
874 | memcpy(skb_put(newskb, len - sizeof(struct aunhdr)), (void *)(ah+1), | 874 | memcpy(skb_put(newskb, len - sizeof(struct aunhdr)), (void *)(ah + 1), |
875 | len - sizeof(struct aunhdr)); | 875 | len - sizeof(struct aunhdr)); |
876 | 876 | ||
877 | if (ec_queue_packet(sk, newskb, stn, edev->net, ah->cb, ah->port)) | 877 | if (ec_queue_packet(sk, newskb, stn, edev->net, ah->cb, ah->port)) { |
878 | { | ||
879 | /* Socket is bankrupt. */ | 878 | /* Socket is bankrupt. */ |
880 | kfree_skb(newskb); | 879 | kfree_skb(newskb); |
881 | goto bad; | 880 | goto bad; |
@@ -911,7 +910,7 @@ static void aun_tx_ack(unsigned long seq, int result) | |||
911 | goto foundit; | 910 | goto foundit; |
912 | } | 911 | } |
913 | spin_unlock_irqrestore(&aun_queue_lock, flags); | 912 | spin_unlock_irqrestore(&aun_queue_lock, flags); |
914 | printk(KERN_DEBUG "AUN: unknown sequence %ld\n", seq); | 913 | pr_debug("AUN: unknown sequence %ld\n", seq); |
915 | return; | 914 | return; |
916 | 915 | ||
917 | foundit: | 916 | foundit: |
@@ -936,18 +935,17 @@ static void aun_data_available(struct sock *sk, int slen) | |||
936 | 935 | ||
937 | while ((skb = skb_recv_datagram(sk, 0, 1, &err)) == NULL) { | 936 | while ((skb = skb_recv_datagram(sk, 0, 1, &err)) == NULL) { |
938 | if (err == -EAGAIN) { | 937 | if (err == -EAGAIN) { |
939 | printk(KERN_ERR "AUN: no data available?!"); | 938 | pr_err("AUN: no data available?!\n"); |
940 | return; | 939 | return; |
941 | } | 940 | } |
942 | printk(KERN_DEBUG "AUN: recvfrom() error %d\n", -err); | 941 | pr_debug("AUN: recvfrom() error %d\n", -err); |
943 | } | 942 | } |
944 | 943 | ||
945 | data = skb_transport_header(skb) + sizeof(struct udphdr); | 944 | data = skb_transport_header(skb) + sizeof(struct udphdr); |
946 | ah = (struct aunhdr *)data; | 945 | ah = (struct aunhdr *)data; |
947 | len = skb->len - sizeof(struct udphdr); | 946 | len = skb->len - sizeof(struct udphdr); |
948 | 947 | ||
949 | switch (ah->code) | 948 | switch (ah->code) { |
950 | { | ||
951 | case 2: | 949 | case 2: |
952 | aun_incoming(skb, ah, len); | 950 | aun_incoming(skb, ah, len); |
953 | break; | 951 | break; |
@@ -958,7 +956,7 @@ static void aun_data_available(struct sock *sk, int slen) | |||
958 | aun_tx_ack(ah->handle, ECTYPE_TRANSMIT_NOT_LISTENING); | 956 | aun_tx_ack(ah->handle, ECTYPE_TRANSMIT_NOT_LISTENING); |
959 | break; | 957 | break; |
960 | default: | 958 | default: |
961 | printk(KERN_DEBUG "unknown AUN packet (type %d)\n", data[0]); | 959 | pr_debug("AUN: unknown packet type: %d\n", data[0]); |
962 | } | 960 | } |
963 | 961 | ||
964 | skb_free_datagram(sk, skb); | 962 | skb_free_datagram(sk, skb); |
@@ -988,7 +986,7 @@ static void ab_cleanup(unsigned long h) | |||
988 | } | 986 | } |
989 | spin_unlock_irqrestore(&aun_queue_lock, flags); | 987 | spin_unlock_irqrestore(&aun_queue_lock, flags); |
990 | 988 | ||
991 | mod_timer(&ab_cleanup_timer, jiffies + (HZ*2)); | 989 | mod_timer(&ab_cleanup_timer, jiffies + (HZ * 2)); |
992 | } | 990 | } |
993 | 991 | ||
994 | static int __init aun_udp_initialise(void) | 992 | static int __init aun_udp_initialise(void) |
@@ -998,7 +996,7 @@ static int __init aun_udp_initialise(void) | |||
998 | 996 | ||
999 | skb_queue_head_init(&aun_queue); | 997 | skb_queue_head_init(&aun_queue); |
1000 | setup_timer(&ab_cleanup_timer, ab_cleanup, 0); | 998 | setup_timer(&ab_cleanup_timer, ab_cleanup, 0); |
1001 | ab_cleanup_timer.expires = jiffies + (HZ*2); | 999 | ab_cleanup_timer.expires = jiffies + (HZ * 2); |
1002 | add_timer(&ab_cleanup_timer); | 1000 | add_timer(&ab_cleanup_timer); |
1003 | 1001 | ||
1004 | memset(&sin, 0, sizeof(sin)); | 1002 | memset(&sin, 0, sizeof(sin)); |
@@ -1006,9 +1004,9 @@ static int __init aun_udp_initialise(void) | |||
1006 | 1004 | ||
1007 | /* We can count ourselves lucky Acorn machines are too dim to | 1005 | /* We can count ourselves lucky Acorn machines are too dim to |
1008 | speak IPv6. :-) */ | 1006 | speak IPv6. :-) */ |
1009 | if ((error = sock_create_kern(PF_INET, SOCK_DGRAM, 0, &udpsock)) < 0) | 1007 | error = sock_create_kern(PF_INET, SOCK_DGRAM, 0, &udpsock); |
1010 | { | 1008 | if (error < 0) { |
1011 | printk("AUN: socket error %d\n", -error); | 1009 | pr_err("AUN: socket error %d\n", -error); |
1012 | return error; | 1010 | return error; |
1013 | } | 1011 | } |
1014 | 1012 | ||
@@ -1017,10 +1015,9 @@ static int __init aun_udp_initialise(void) | |||
1017 | from interrupts */ | 1015 | from interrupts */ |
1018 | 1016 | ||
1019 | error = udpsock->ops->bind(udpsock, (struct sockaddr *)&sin, | 1017 | error = udpsock->ops->bind(udpsock, (struct sockaddr *)&sin, |
1020 | sizeof(sin)); | 1018 | sizeof(sin)); |
1021 | if (error < 0) | 1019 | if (error < 0) { |
1022 | { | 1020 | pr_err("AUN: bind error %d\n", -error); |
1023 | printk("AUN: bind error %d\n", -error); | ||
1024 | goto release; | 1021 | goto release; |
1025 | } | 1022 | } |
1026 | 1023 | ||
@@ -1041,7 +1038,8 @@ release: | |||
1041 | * Receive an Econet frame from a device. | 1038 | * Receive an Econet frame from a device. |
1042 | */ | 1039 | */ |
1043 | 1040 | ||
1044 | static int econet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) | 1041 | static int econet_rcv(struct sk_buff *skb, struct net_device *dev, |
1042 | struct packet_type *pt, struct net_device *orig_dev) | ||
1045 | { | 1043 | { |
1046 | struct ec_framehdr *hdr; | 1044 | struct ec_framehdr *hdr; |
1047 | struct sock *sk = NULL; | 1045 | struct sock *sk = NULL; |
@@ -1056,13 +1054,14 @@ static int econet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet | |||
1056 | if (!edev) | 1054 | if (!edev) |
1057 | goto drop; | 1055 | goto drop; |
1058 | 1056 | ||
1059 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) | 1057 | skb = skb_share_check(skb, GFP_ATOMIC); |
1058 | if (skb == NULL) | ||
1060 | return NET_RX_DROP; | 1059 | return NET_RX_DROP; |
1061 | 1060 | ||
1062 | if (!pskb_may_pull(skb, sizeof(struct ec_framehdr))) | 1061 | if (!pskb_may_pull(skb, sizeof(struct ec_framehdr))) |
1063 | goto drop; | 1062 | goto drop; |
1064 | 1063 | ||
1065 | hdr = (struct ec_framehdr *) skb->data; | 1064 | hdr = (struct ec_framehdr *)skb->data; |
1066 | 1065 | ||
1067 | /* First check for encapsulated IP */ | 1066 | /* First check for encapsulated IP */ |
1068 | if (hdr->port == EC_PORT_IP) { | 1067 | if (hdr->port == EC_PORT_IP) { |
@@ -1090,8 +1089,8 @@ drop: | |||
1090 | } | 1089 | } |
1091 | 1090 | ||
1092 | static struct packet_type econet_packet_type __read_mostly = { | 1091 | static struct packet_type econet_packet_type __read_mostly = { |
1093 | .type = cpu_to_be16(ETH_P_ECONET), | 1092 | .type = cpu_to_be16(ETH_P_ECONET), |
1094 | .func = econet_rcv, | 1093 | .func = econet_rcv, |
1095 | }; | 1094 | }; |
1096 | 1095 | ||
1097 | static void econet_hw_initialise(void) | 1096 | static void econet_hw_initialise(void) |
@@ -1101,9 +1100,10 @@ static void econet_hw_initialise(void) | |||
1101 | 1100 | ||
1102 | #endif | 1101 | #endif |
1103 | 1102 | ||
1104 | static int econet_notifier(struct notifier_block *this, unsigned long msg, void *data) | 1103 | static int econet_notifier(struct notifier_block *this, unsigned long msg, |
1104 | void *data) | ||
1105 | { | 1105 | { |
1106 | struct net_device *dev = (struct net_device *)data; | 1106 | struct net_device *dev = data; |
1107 | struct ec_device *edev; | 1107 | struct ec_device *edev; |
1108 | 1108 | ||
1109 | if (!net_eq(dev_net(dev), &init_net)) | 1109 | if (!net_eq(dev_net(dev), &init_net)) |
@@ -1113,8 +1113,7 @@ static int econet_notifier(struct notifier_block *this, unsigned long msg, void | |||
1113 | case NETDEV_UNREGISTER: | 1113 | case NETDEV_UNREGISTER: |
1114 | /* A device has gone down - kill any data we hold for it. */ | 1114 | /* A device has gone down - kill any data we hold for it. */ |
1115 | edev = dev->ec_ptr; | 1115 | edev = dev->ec_ptr; |
1116 | if (edev) | 1116 | if (edev) { |
1117 | { | ||
1118 | if (net2dev_map[0] == dev) | 1117 | if (net2dev_map[0] == dev) |
1119 | net2dev_map[0] = NULL; | 1118 | net2dev_map[0] = NULL; |
1120 | net2dev_map[edev->net] = NULL; | 1119 | net2dev_map[edev->net] = NULL; |
@@ -1128,7 +1127,7 @@ static int econet_notifier(struct notifier_block *this, unsigned long msg, void | |||
1128 | } | 1127 | } |
1129 | 1128 | ||
1130 | static struct notifier_block econet_netdev_notifier = { | 1129 | static struct notifier_block econet_netdev_notifier = { |
1131 | .notifier_call =econet_notifier, | 1130 | .notifier_call = econet_notifier, |
1132 | }; | 1131 | }; |
1133 | 1132 | ||
1134 | static void __exit econet_proto_exit(void) | 1133 | static void __exit econet_proto_exit(void) |