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

Commit 4710d806 authored by Varka Bhadram's avatar Varka Bhadram Committed by David S. Miller
Browse files

6lowpan: mac802154: fix coding style issues



This patch fixed the coding style issues reported by checkpatch.pl

following issues fixed:
	CHECK: Alignment should match open parenthesis
	WARNING: line over 80 characters
	CHECK: Blank lines aren't necessary before a close brace '}'
	WARNING: networking block comments don't use an empty /* line, use /* Comment...
	WARNING: Missing a blank line after declarations
	WARNING: networking block comments start with * on subsequent lines
	CHECK: braces {} should be used on all arms of this statement

Signed-off-by: default avatarVarka Bhadram <varkab@cdac.in>
Tested-by: default avatarAlexander Aring <alex.aring@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 46c9521f
Loading
Loading
Loading
Loading
+52 −61
Original line number Diff line number Diff line
@@ -3,8 +3,7 @@
 * written by Alexander Smirnov <alex.bluesman.smirnov@gmail.com>
 */

/*
 * Based on patches from Jon Smirl <jonsmirl@gmail.com>
/* Based on patches from Jon Smirl <jonsmirl@gmail.com>
 * Copyright (c) 2011 Jon Smirl <jonsmirl@gmail.com>
 *
 * This program is free software; you can redistribute it and/or modify
@@ -58,8 +57,7 @@
#include <net/ipv6.h>
#include <net/af_ieee802154.h>

/*
 * Uncompress address function for source and
/* Uncompress address function for source and
 * destination address(non-multicast).
 *
 * address_mode is sam value or dam value.
@@ -140,8 +138,7 @@ static int uncompress_addr(struct sk_buff *skb,
	return 0;
}

/*
 * Uncompress address function for source context
/* Uncompress address function for source context
 * based address(non-multicast).
 */
static int uncompress_context_based_src_addr(struct sk_buff *skb,
@@ -180,8 +177,8 @@ static int skb_deliver(struct sk_buff *skb, struct ipv6hdr *hdr,
	struct sk_buff *new;
	int stat;

	new = skb_copy_expand(skb, sizeof(struct ipv6hdr), skb_tailroom(skb),
								GFP_ATOMIC);
	new = skb_copy_expand(skb, sizeof(struct ipv6hdr),
			      skb_tailroom(skb), GFP_ATOMIC);
	kfree_skb(skb);

	if (!new)
@@ -314,8 +311,7 @@ uncompress_udp_header(struct sk_buff *skb, struct udphdr *uh)
			fail |= lowpan_fetch_skb(skb, &uh->check, 2);
		}

		/*
		 * UDP lenght needs to be infered from the lower layers
		/* UDP lenght needs to be infered from the lower layers
		 * here, we obtain the hint from the remaining size of the
		 * frame
		 */
@@ -338,8 +334,9 @@ uncompress_udp_header(struct sk_buff *skb, struct udphdr *uh)
static const u8 lowpan_ttl_values[] = { 0, 1, 64, 255 };

int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
		const u8 *saddr, const u8 saddr_type, const u8 saddr_len,
		const u8 *daddr, const u8 daddr_type, const u8 daddr_len,
			const u8 *saddr, const u8 saddr_type,
			const u8 saddr_len, const u8 *daddr,
			const u8 daddr_type, const u8 daddr_len,
			u8 iphc0, u8 iphc1, skb_delivery_cb deliver_skb)
{
	struct ipv6hdr hdr = {};
@@ -360,8 +357,7 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,

	/* Traffic Class and Flow Label */
	switch ((iphc0 & LOWPAN_IPHC_TF) >> 3) {
	/*
	 * Traffic Class and FLow Label carried in-line
	/* Traffic Class and FLow Label carried in-line
	 * ECN + DSCP + 4-bit Pad + Flow Label (4 bytes)
	 */
	case 0: /* 00b */
@@ -374,8 +370,7 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
		hdr.flow_lbl[0] = ((tmp >> 2) & 0x30) | (tmp << 6) |
					(hdr.flow_lbl[0] & 0x0f);
		break;
	/*
	 * Traffic class carried in-line
	/* Traffic class carried in-line
	 * ECN + DSCP (1 byte), Flow Label is elided
	 */
	case 2: /* 10b */
@@ -385,8 +380,7 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
		hdr.priority = ((tmp >> 2) & 0x0f);
		hdr.flow_lbl[0] = ((tmp << 6) & 0xC0) | ((tmp >> 2) & 0x30);
		break;
	/*
	 * Flow Label carried in-line
	/* Flow Label carried in-line
	 * ECN + 2-bit Pad + Flow Label (3 bytes), DSCP is elided
	 */
	case 1: /* 01b */
@@ -415,9 +409,9 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
	}

	/* Hop Limit */
	if ((iphc0 & 0x03) != LOWPAN_IPHC_TTL_I)
	if ((iphc0 & 0x03) != LOWPAN_IPHC_TTL_I) {
		hdr.hop_limit = lowpan_ttl_values[iphc0 & 0x03];
	else {
	} else {
		if (lowpan_fetch_skb_u8(skb, &(hdr.hop_limit)))
			goto drop;
	}
@@ -468,11 +462,11 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
	if (iphc0 & LOWPAN_IPHC_NH_C) {
		struct udphdr uh;
		struct sk_buff *new;

		if (uncompress_udp_header(skb, &uh))
			goto drop;

		/*
		 * replace the compressed UDP head by the uncompressed UDP
		/* replace the compressed UDP head by the uncompressed UDP
		 * header
		 */
		new = skb_copy_expand(skb, sizeof(struct udphdr),
@@ -504,8 +498,8 @@ int lowpan_process_data(struct sk_buff *skb, struct net_device *dev,
		hdr.version, ntohs(hdr.payload_len), hdr.nexthdr,
		hdr.hop_limit, &hdr.daddr);

	raw_dump_table(__func__, "raw header dump", (u8 *)&hdr,
							sizeof(hdr));
	raw_dump_table(__func__, "raw header dump",
		       (u8 *)&hdr, sizeof(hdr));

	return skb_deliver(skb, &hdr, dev, deliver_skb);

@@ -622,8 +616,7 @@ int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
	raw_dump_table(__func__, "raw skb network header dump",
		       skb_network_header(skb), sizeof(struct ipv6hdr));

	/*
	 * As we copy some bit-length fields, in the IPHC encoding bytes,
	/* As we copy some bit-length fields, in the IPHC encoding bytes,
	 * we sometimes use |=
	 * If the field is 0, and the current bit value in memory is 1,
	 * this does not work. We therefore reset the IPHC encoding here
@@ -642,8 +635,7 @@ int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
		       "sending raw skb network uncompressed packet",
		       skb->data, skb->len);

	/*
	 * Traffic class, flow label
	/* Traffic class, flow label
	 * If flow label is 0, compress it. If traffic class is 0, compress it
	 * We have to process both in the same time as the offset of traffic
	 * class depends on the presence of version and flow label
@@ -695,8 +687,7 @@ int lowpan_header_compress(struct sk_buff *skb, struct net_device *dev,
		hc06_ptr += 1;
	}

	/*
	 * Hop limit
	/* Hop limit
	 * if 1:   compress, encoding is 01
	 * if 64:  compress, encoding is 10
	 * if 255: compress, encoding is 11
+10 −6
Original line number Diff line number Diff line
@@ -80,12 +80,12 @@ lowpan_dev_info *lowpan_dev_info(const struct net_device *dev)
static inline void lowpan_address_flip(u8 *src, u8 *dest)
{
	int i;

	for (i = 0; i < IEEE802154_ADDR_LEN; i++)
		(dest)[IEEE802154_ADDR_LEN - i - 1] = (src)[i];
}

static int lowpan_header_create(struct sk_buff *skb,
			   struct net_device *dev,
static int lowpan_header_create(struct sk_buff *skb, struct net_device *dev,
				unsigned short type, const void *_daddr,
				const void *_saddr, unsigned int len)
{
@@ -368,24 +368,28 @@ static netdev_tx_t lowpan_xmit(struct sk_buff *skb, struct net_device *dev)
static struct wpan_phy *lowpan_get_phy(const struct net_device *dev)
{
	struct net_device *real_dev = lowpan_dev_info(dev)->real_dev;

	return ieee802154_mlme_ops(real_dev)->get_phy(real_dev);
}

static __le16 lowpan_get_pan_id(const struct net_device *dev)
{
	struct net_device *real_dev = lowpan_dev_info(dev)->real_dev;

	return ieee802154_mlme_ops(real_dev)->get_pan_id(real_dev);
}

static __le16 lowpan_get_short_addr(const struct net_device *dev)
{
	struct net_device *real_dev = lowpan_dev_info(dev)->real_dev;

	return ieee802154_mlme_ops(real_dev)->get_short_addr(real_dev);
}

static u8 lowpan_get_dsn(const struct net_device *dev)
{
	struct net_device *real_dev = lowpan_dev_info(dev)->real_dev;

	return ieee802154_mlme_ops(real_dev)->get_dsn(real_dev);
}

+12 −14
Original line number Diff line number Diff line
@@ -40,9 +40,7 @@

#include "af802154.h"

/*
 * Utility function for families
 */
/* Utility function for families */
struct net_device*
ieee802154_get_dev(struct net *net, const struct ieee802154_addr *addr)
{
@@ -87,7 +85,7 @@ ieee802154_get_dev(struct net *net, const struct ieee802154_addr *addr)
		rtnl_unlock();
		break;
	default:
		pr_warning("Unsupported ieee802154 address type: %d\n",
		pr_warn("Unsupported ieee802154 address type: %d\n",
			addr->mode);
		break;
	}
@@ -238,8 +236,7 @@ static const struct proto_ops ieee802154_dgram_ops = {
};


/*
 * Create a socket. Initialise the socket, blank the addresses
/* Create a socket. Initialise the socket, blank the addresses
 * set the state.
 */
static int ieee802154_create(struct net *net, struct socket *sock,
@@ -307,7 +304,8 @@ static int ieee802154_rcv(struct sk_buff *skb, struct net_device *dev,
		goto drop;
	pr_debug("got frame, type %d, dev %p\n", dev->type, dev);
#ifdef DEBUG
	print_hex_dump_bytes("ieee802154_rcv ", DUMP_PREFIX_NONE, skb->data, skb->len);
	print_hex_dump_bytes("ieee802154_rcv ",
			     DUMP_PREFIX_NONE, skb->data, skb->len);
#endif

	if (!net_eq(dev_net(dev), &init_net))
+15 −13
Original line number Diff line number Diff line
@@ -149,8 +149,7 @@ static int dgram_ioctl(struct sock *sk, int cmd, unsigned long arg)
		spin_lock_bh(&sk->sk_receive_queue.lock);
		skb = skb_peek(&sk->sk_receive_queue);
		if (skb != NULL) {
			/*
			 * We will only return the amount
			/* We will only return the amount
			 * of this packet since that is all
			 * that will be read.
			 */
@@ -161,6 +160,7 @@ static int dgram_ioctl(struct sock *sk, int cmd, unsigned long arg)
	}

	}

	return -ENOIOCTLCMD;
}

@@ -262,7 +262,8 @@ static int dgram_sendmsg(struct kiocb *iocb, struct sock *sk,
	cb->ackreq = ro->want_ack;

	if (msg->msg_name) {
		DECLARE_SOCKADDR(struct sockaddr_ieee802154*, daddr, msg->msg_name);
		DECLARE_SOCKADDR(struct sockaddr_ieee802154*,
				 daddr, msg->msg_name);

		ieee802154_addr_from_sa(&dst_addr, &daddr->addr);
	} else {
@@ -304,8 +305,8 @@ static int dgram_sendmsg(struct kiocb *iocb, struct sock *sk,
}

static int dgram_recvmsg(struct kiocb *iocb, struct sock *sk,
		struct msghdr *msg, size_t len, int noblock, int flags,
		int *addr_len)
			 struct msghdr *msg, size_t len, int noblock,
			 int flags, int *addr_len)
{
	size_t copied = 0;
	int err = -EOPNOTSUPP;
@@ -398,6 +399,7 @@ int ieee802154_dgram_deliver(struct net_device *dev, struct sk_buff *skb)
					  dgram_sk(sk))) {
			if (prev) {
				struct sk_buff *clone;

				clone = skb_clone(skb, GFP_ATOMIC);
				if (clone)
					dgram_rcv_skb(prev, clone);
@@ -407,9 +409,9 @@ int ieee802154_dgram_deliver(struct net_device *dev, struct sk_buff *skb)
		}
	}

	if (prev)
	if (prev) {
		dgram_rcv_skb(prev, skb);
	else {
	} else {
		kfree_skb(skb);
		ret = NET_RX_DROP;
	}
+27 −21
Original line number Diff line number Diff line
@@ -60,7 +60,8 @@ static __le16 nla_get_shortaddr(const struct nlattr *nla)
}

int ieee802154_nl_assoc_indic(struct net_device *dev,
		struct ieee802154_addr *addr, u8 cap)
			      struct ieee802154_addr *addr,
			      u8 cap)
{
	struct sk_buff *msg;

@@ -119,7 +120,8 @@ int ieee802154_nl_assoc_confirm(struct net_device *dev, __le16 short_addr,
EXPORT_SYMBOL(ieee802154_nl_assoc_confirm);

int ieee802154_nl_disassoc_indic(struct net_device *dev,
		struct ieee802154_addr *addr, u8 reason)
				 struct ieee802154_addr *addr,
				 u8 reason)
{
	struct sk_buff *msg;

@@ -205,7 +207,8 @@ int ieee802154_nl_beacon_indic(struct net_device *dev, __le16 panid,
EXPORT_SYMBOL(ieee802154_nl_beacon_indic);

int ieee802154_nl_scan_confirm(struct net_device *dev,
		u8 status, u8 scan_type, u32 unscanned, u8 page,
			       u8 status, u8 scan_type,
			       u32 unscanned, u8 page,
			       u8 *edl/* , struct list_head *pan_desc_list */)
{
	struct sk_buff *msg;
@@ -330,14 +333,16 @@ static struct net_device *ieee802154_nl_get_dev(struct genl_info *info)

	if (info->attrs[IEEE802154_ATTR_DEV_NAME]) {
		char name[IFNAMSIZ + 1];

		nla_strlcpy(name, info->attrs[IEEE802154_ATTR_DEV_NAME],
			    sizeof(name));
		dev = dev_get_by_name(&init_net, name);
	} else if (info->attrs[IEEE802154_ATTR_DEV_INDEX])
	} else if (info->attrs[IEEE802154_ATTR_DEV_INDEX]) {
		dev = dev_get_by_index(&init_net,
			nla_get_u32(info->attrs[IEEE802154_ATTR_DEV_INDEX]));
	else
	} else {
		return NULL;
	}

	if (!dev)
		return NULL;
@@ -464,8 +469,7 @@ int ieee802154_disassociate_req(struct sk_buff *skb, struct genl_info *info)
	return ret;
}

/*
 * PANid, channel, beacon_order = 15, superframe_order = 15,
/* PANid, channel, beacon_order = 15, superframe_order = 15,
 * PAN_coordinator, battery_life_extension = 0,
 * coord_realignment = 0, security_enable = 0
*/
@@ -559,8 +563,8 @@ int ieee802154_scan_req(struct sk_buff *skb, struct genl_info *info)
		page = 0;


	ret = ieee802154_mlme_ops(dev)->scan_req(dev, type, channels, page,
			duration);
	ret = ieee802154_mlme_ops(dev)->scan_req(dev, type, channels,
						 page, duration);

out:
	dev_put(dev);
@@ -570,7 +574,8 @@ int ieee802154_scan_req(struct sk_buff *skb, struct genl_info *info)
int ieee802154_list_iface(struct sk_buff *skb, struct genl_info *info)
{
	/* Request for interface name, index, type, IEEE address,
	   PAN Id, short address */
	 * PAN Id, short address
	 */
	struct sk_buff *msg;
	struct net_device *dev = NULL;
	int rc = -ENOBUFS;
@@ -598,7 +603,6 @@ int ieee802154_list_iface(struct sk_buff *skb, struct genl_info *info)
out_dev:
	dev_put(dev);
	return rc;

}

int ieee802154_dump_iface(struct sk_buff *skb, struct netlink_callback *cb)
@@ -616,7 +620,8 @@ int ieee802154_dump_iface(struct sk_buff *skb, struct netlink_callback *cb)
			goto cont;

		if (ieee802154_nl_fill_iface(skb, NETLINK_CB(cb->skb).portid,
			cb->nlh->nlmsg_seq, NLM_F_MULTI, dev) < 0)
					     cb->nlh->nlmsg_seq,
					     NLM_F_MULTI, dev) < 0)
			break;
cont:
		idx++;
@@ -765,6 +770,7 @@ ieee802154_llsec_parse_key_id(struct genl_info *info,
	case IEEE802154_SCF_KEY_SHORT_INDEX:
	{
		u32 source = nla_get_u32(info->attrs[IEEE802154_ATTR_LLSEC_KEY_SOURCE_SHORT]);

		desc->short_source = cpu_to_le32(source);
		break;
	}
Loading