Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ee9c88f2 authored by Joe Perches's avatar Joe Perches Committed by David S. Miller
Browse files

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: default avatarJoe Perches <joe@perches.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2a49e001
Loading
Loading
Loading
Loading
+74 −75
Original line number Diff line number Diff line
@@ -9,6 +9,8 @@
 *
 */

#define pr_fmt(fmt) fmt

#include <linux/module.h>

#include <linux/types.h>
@@ -44,7 +46,7 @@
#include <linux/bitops.h>
#include <linux/mutex.h>

#include <asm/uaccess.h>
#include <linux/uaccess.h>
#include <asm/system.h>

static const struct proto_ops econet_ops;
@@ -63,9 +65,7 @@ static DEFINE_SPINLOCK(aun_queue_lock);
static struct socket *udpsock;
#define AUN_PORT	0x8000


struct aunhdr
{
struct aunhdr {
	unsigned char code;		/* AUN magic protocol byte */
	unsigned char port;
	unsigned char cb;
@@ -82,8 +82,7 @@ static struct timer_list ab_cleanup_timer;
#endif		/* CONFIG_ECONET_AUNUDP */

/* Per-packet information */
struct ec_cb
{
struct ec_cb {
	struct sockaddr_ec sec;
	unsigned long cookie;		/* Supplied by user. */
#ifdef CONFIG_ECONET_AUNUDP
@@ -154,8 +153,7 @@ static int econet_recvmsg(struct kiocb *iocb, struct socket *sock,
	 */

	copied = skb->len;
	if (copied > len)
	{
	if (copied > len) {
		copied = len;
		msg->msg_flags |= MSG_TRUNC;
	}
@@ -186,7 +184,8 @@ out:
 *	Bind an Econet socket.
 */

static int econet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
static int econet_bind(struct socket *sock, struct sockaddr *uaddr,
		       int addr_len)
{
	struct sockaddr_ec *sec = (struct sockaddr_ec *)uaddr;
	struct sock *sk;
@@ -226,9 +225,8 @@ static void tx_result(struct sock *sk, unsigned long cookie, int result)
	struct ec_cb *eb;
	struct sockaddr_ec *sec;

	if (skb == NULL)
	{
		printk(KERN_DEBUG "ec: memory squeeze, transmit result dropped.\n");
	if (skb == NULL) {
		pr_debug("econet: memory squeeze, transmit result dropped\n");
		return;
	}

@@ -355,7 +353,7 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
			struct ec_framehdr *fh;
			/* Poke in our control byte and
			   port number.  Hack, hack.  */
			fh = (struct ec_framehdr *)(skb->data);
			fh = (struct ec_framehdr *)skb->data;
			fh->cb = cb;
			fh->port = port;
			if (sock->type != SOCK_DGRAM) {
@@ -458,15 +456,14 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
		goto error_free_buf;

	/* Get a skbuff (no data, just holds our cb information) */
	if ((skb = sock_alloc_send_skb(sk, 0,
				       msg->msg_flags & MSG_DONTWAIT,
				       &err)) == NULL)
	skb = sock_alloc_send_skb(sk, 0, msg->msg_flags & MSG_DONTWAIT, &err);
	if (skb == NULL)
		goto error_free_buf;

	eb = (struct ec_cb *)&skb->cb;

	eb->cookie = saddr->cookie;
	eb->timeout = (5*HZ);
	eb->timeout = 5 * HZ;
	eb->start = jiffies;
	ah.handle = aun_seq;
	eb->seq = (aun_seq++);
@@ -482,7 +479,8 @@ static int econet_sendmsg(struct kiocb *iocb, struct socket *sock,
	udpmsg.msg_controllen = 0;
	udpmsg.msg_flags = 0;

	oldfs = get_fs(); set_fs(KERNEL_DS);	/* More privs :-) */
	oldfs = get_fs();
	set_fs(KERNEL_DS);		/* More privs :-) */
	err = sock_sendmsg(udpsock, &udpmsg, size);
	set_fs(oldfs);

@@ -539,7 +537,7 @@ static void econet_destroy_timer(unsigned long data)

	sk->sk_timer.expires = jiffies + 10 * HZ;
	add_timer(&sk->sk_timer);
	printk(KERN_DEBUG "econet socket destroy delayed\n");
	pr_debug("econet: socket destroy delayed\n");
}

/*
@@ -651,7 +649,8 @@ static int ec_dev_ioctl(struct socket *sock, unsigned int cmd, void __user *arg)
	if (copy_from_user(&ifr, arg, sizeof(struct ifreq)))
		return -EFAULT;

	if ((dev = dev_get_by_name(&init_net, ifr.ifr_name)) == NULL)
	dev = dev_get_by_name(&init_net, ifr.ifr_name);
	if (dev == NULL)
		return -ENODEV;

	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)
 *	Handle generic ioctls
 */

static int econet_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
static int econet_ioctl(struct socket *sock, unsigned int cmd,
			unsigned long arg)
{
	struct sock *sk = sock->sk;
	void __user *argp = (void __user *)arg;
@@ -859,14 +859,14 @@ static void aun_incoming(struct sk_buff *skb, struct aunhdr *ah, size_t len)
	if (!edev)
		goto bad;

	if ((sk = ec_listening_socket(ah->port, stn, edev->net)) == NULL)
	sk = ec_listening_socket(ah->port, stn, edev->net);
	if (sk == NULL)
		goto bad;		/* Nobody wants it */

	newskb = alloc_skb((len - sizeof(struct aunhdr) + 15) & ~15,
			   GFP_ATOMIC);
	if (newskb == NULL)
	{
		printk(KERN_DEBUG "AUN: memory squeeze, dropping packet.\n");
	if (newskb == NULL) {
		pr_debug("AUN: memory squeeze, dropping packet\n");
		/* Send nack and hope sender tries again */
		goto bad;
	}
@@ -874,8 +874,7 @@ static void aun_incoming(struct sk_buff *skb, struct aunhdr *ah, size_t len)
	memcpy(skb_put(newskb, len - sizeof(struct aunhdr)), (void *)(ah + 1),
	       len - sizeof(struct aunhdr));

	if (ec_queue_packet(sk, newskb, stn, edev->net, ah->cb, ah->port))
	{
	if (ec_queue_packet(sk, newskb, stn, edev->net, ah->cb, ah->port)) {
		/* Socket is bankrupt. */
		kfree_skb(newskb);
		goto bad;
@@ -911,7 +910,7 @@ static void aun_tx_ack(unsigned long seq, int result)
			goto foundit;
	}
	spin_unlock_irqrestore(&aun_queue_lock, flags);
	printk(KERN_DEBUG "AUN: unknown sequence %ld\n", seq);
	pr_debug("AUN: unknown sequence %ld\n", seq);
	return;

foundit:
@@ -936,18 +935,17 @@ static void aun_data_available(struct sock *sk, int slen)

	while ((skb = skb_recv_datagram(sk, 0, 1, &err)) == NULL) {
		if (err == -EAGAIN) {
			printk(KERN_ERR "AUN: no data available?!");
			pr_err("AUN: no data available?!\n");
			return;
		}
		printk(KERN_DEBUG "AUN: recvfrom() error %d\n", -err);
		pr_debug("AUN: recvfrom() error %d\n", -err);
	}

	data = skb_transport_header(skb) + sizeof(struct udphdr);
	ah = (struct aunhdr *)data;
	len = skb->len - sizeof(struct udphdr);

	switch (ah->code)
	{
	switch (ah->code) {
	case 2:
		aun_incoming(skb, ah, len);
		break;
@@ -958,7 +956,7 @@ static void aun_data_available(struct sock *sk, int slen)
		aun_tx_ack(ah->handle, ECTYPE_TRANSMIT_NOT_LISTENING);
		break;
	default:
		printk(KERN_DEBUG "unknown AUN packet (type %d)\n", data[0]);
		pr_debug("AUN: unknown packet type: %d\n", data[0]);
	}

	skb_free_datagram(sk, skb);
@@ -1006,9 +1004,9 @@ static int __init aun_udp_initialise(void)

	/* We can count ourselves lucky Acorn machines are too dim to
	   speak IPv6. :-) */
	if ((error = sock_create_kern(PF_INET, SOCK_DGRAM, 0, &udpsock)) < 0)
	{
		printk("AUN: socket error %d\n", -error);
	error = sock_create_kern(PF_INET, SOCK_DGRAM, 0, &udpsock);
	if (error < 0) {
		pr_err("AUN: socket error %d\n", -error);
		return error;
	}

@@ -1018,9 +1016,8 @@ static int __init aun_udp_initialise(void)

	error = udpsock->ops->bind(udpsock, (struct sockaddr *)&sin,
				   sizeof(sin));
	if (error < 0)
	{
		printk("AUN: bind error %d\n", -error);
	if (error < 0) {
		pr_err("AUN: bind error %d\n", -error);
		goto release;
	}

@@ -1041,7 +1038,8 @@ release:
 *	Receive an Econet frame from a device.
 */

static int econet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev)
static int econet_rcv(struct sk_buff *skb, struct net_device *dev,
		      struct packet_type *pt, struct net_device *orig_dev)
{
	struct ec_framehdr *hdr;
	struct sock *sk = NULL;
@@ -1056,7 +1054,8 @@ static int econet_rcv(struct sk_buff *skb, struct net_device *dev, struct packet
	if (!edev)
		goto drop;

	if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
	skb = skb_share_check(skb, GFP_ATOMIC);
	if (skb == NULL)
		return NET_RX_DROP;

	if (!pskb_may_pull(skb, sizeof(struct ec_framehdr)))
@@ -1101,9 +1100,10 @@ static void econet_hw_initialise(void)

#endif

static int econet_notifier(struct notifier_block *this, unsigned long msg, void *data)
static int econet_notifier(struct notifier_block *this, unsigned long msg,
			   void *data)
{
	struct net_device *dev = (struct net_device *)data;
	struct net_device *dev = data;
	struct ec_device *edev;

	if (!net_eq(dev_net(dev), &init_net))
@@ -1113,8 +1113,7 @@ static int econet_notifier(struct notifier_block *this, unsigned long msg, void
	case NETDEV_UNREGISTER:
		/* A device has gone down - kill any data we hold for it. */
		edev = dev->ec_ptr;
		if (edev)
		{
		if (edev) {
			if (net2dev_map[0] == dev)
				net2dev_map[0] = NULL;
			net2dev_map[edev->net] = NULL;