Skip to contentSkip to conversation

net: fix braces and comments codestyle

PATCH In review Darya Litvintseva 2 participants 2 messages Dec 10, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: fix braces and comments codestyle

---
 net/ethernet/eth.c | 23 ++++++++---------------
 1 file changed, 8 insertions(+), 15 deletions(-)
net/ethernet/eth.c +8 -15
index fd8faa0dfa61..3b430e245d58 100644
@@ -90,9 +90,7 @@ int eth_header(struct sk_buff *skb, struct net_device *dev,
 	else
 		eth->h_proto = htons(len);
 
-	/*
-	 *      Set the source hardware address.
-	 */
+	/* Set the source hardware address.*/
 
 	if (!saddr)
 		saddr = dev->dev_addr;
@@ -103,9 +101,7 @@ int eth_header(struct sk_buff *skb, struct net_device *dev,
 		return ETH_HLEN;
 	}
 
-	/*
-	 *      Anyway, the loopback-device should never use this function...
-	 */
+	/* Anyway, the loopback-device should never use this function... */
 
 	if (dev->flags & (IFF_LOOPBACK | IFF_NOARP)) {
 		eth_zero_addr(eth->h_dest);
@@ -170,13 +166,11 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
 			skb->pkt_type = PACKET_BROADCAST;
 		else
 			skb->pkt_type = PACKET_MULTICAST;
-	}
-	else if (unlikely(!ether_addr_equal_64bits(eth->h_dest,
+	} else if (unlikely(!ether_addr_equal_64bits(eth->h_dest,
 						   dev->dev_addr)))
 		skb->pkt_type = PACKET_OTHERHOST;
 
-	/*
-	 * Some variants of DSA tagging don't have an ethertype field
+	/* Some variants of DSA tagging don't have an ethertype field
 	 * at all, so we check here whether one of those tagging
 	 * variants has been configured on the receiving interface,
 	 * and if so, set skb->protocol without looking at the packet.
@@ -187,8 +181,7 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
 	if (likely(eth_proto_is_802_3(eth->h_proto)))
 		return eth->h_proto;
 
-	/*
-	 *      This is a magic hack to spot IPX packets. Older Novell breaks
+	/*      This is a magic hack to spot IPX packets. Older Novell breaks
 	 *      the protocol design and runs IPX over 802.3 without an 802.2 LLC
 	 *      layer. We look for FFFF which isn't a used 802.2 SSAP/DSAP. This
 	 *      won't work for fault tolerant netware but does for the rest.
@@ -197,8 +190,7 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
 	if (sap && *sap == 0xFFFF)
 		return htons(ETH_P_802_3);
 
-	/*
-	 *      Real 802.2 LLC
+	/* Real 802.2 LLC
 	 */
 	return htons(ETH_P_802_2);
 }
@@ -212,6 +204,7 @@ EXPORT_SYMBOL(eth_type_trans);
 int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr)
 {
 	const struct ethhdr *eth = eth_hdr(skb);
+
 	memcpy(haddr, eth->h_source, ETH_ALEN);
 	return ETH_ALEN;
 }
@@ -355,7 +348,7 @@ void ether_setup(struct net_device *dev)
 {
 	dev->header_ops		= &eth_header_ops;
 	dev->type		= ARPHRD_ETHER;
-	dev->hard_header_len 	= ETH_HLEN;
+	dev->hard_header_len	= ETH_HLEN;
 	dev->min_header_len	= ETH_HLEN;
 	dev->mtu		= ETH_DATA_LEN;
 	dev->min_mtu		= ETH_MIN_MTU;
Signature · 1 line
2.19.1
#1 lore raw
Quoted 1 line · Darya Litvintseva

Hello.

Most maintainers want some patch description
and not a blank commit message.

Whitespace only changes are sometimes not taken.

First kernel patches are best done in drivers/staging.

And some additional comments below...

cheers, Joe

net/ethernet/eth.c

Quoted 1 line
net/ethernet/eth.c +0 -0

[]

net/ethernet/eth.c int eth_header(struct sk_buff *skb, struct net_device *dev, · line 93

Quoted 8 lines
net/ethernet/eth.c +1 -3
@@ -90,9 +90,7 @@ int eth_header(struct sk_buff *skb, struct net_device *dev,
 	else
 		eth->h_proto = htons(len);
 
-	/*
-	 *      Set the source hardware address.
-	 */
+	/* Set the source hardware address.*/

Most single line comments use a space before the */

net/ethernet/eth.c __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev) · line 170

Quoted 8 lines
net/ethernet/eth.c +1 -2
@@ -170,13 +166,11 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
 			skb->pkt_type = PACKET_BROADCAST;
 		else
 			skb->pkt_type = PACKET_MULTICAST;
-	}
-	else if (unlikely(!ether_addr_equal_64bits(eth->h_dest,
+	} else if (unlikely(!ether_addr_equal_64bits(eth->h_dest,
 						   dev->dev_addr)))

please realign multiline statements to the open parenthesis

net/ethernet/eth.c __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev) · line 187

Quoted 10 lines
net/ethernet/eth.c +1 -2
@@ -187,8 +181,7 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
 	if (likely(eth_proto_is_802_3(eth->h_proto)))
 		return eth->h_proto;
 
-	/*
-	 *      This is a magic hack to spot IPX packets. Older Novell breaks
+	/*      This is a magic hack to spot IPX packets. Older Novell breaks
 	 *      the protocol design and runs IPX over 802.3 without an 802.2 LLC
 	 *      layer. We look for FFFF which isn't a used 802.2 SSAP/DSAP. This
 	 *      won't work for fault tolerant netware but does for the rest.

Given the ipx protocol removal, perhaps this block should be revisited.

commit e02554e9a4338c58e75fdfb0ef908a5adc86cba5

Author: Stephen Hemminger <[email protected]>
Date:   Tue Nov 14 08:37:14 2017 -0800

ipx: move Novell IPX protocol support into staging

commit 7a2e838d28cff6718a0bdf66164465402f8e40ed

Author: Greg Kroah-Hartman <[email protected]>
Date:   Fri Jun 1 20:39:54 2018 +0200

staging: ipx: delete it from the tree

The ipx code moved into the staging tree back in November 2017 and no one has complained or even noticed it was gone. Because of that, let's just delete it.

net/ethernet/eth.c __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev) · line 194

Quoted 8 lines
net/ethernet/eth.c +1 -2
@@ -197,8 +190,7 @@ __be16 eth_type_trans(struct sk_buff *skb, struct net_device *dev)
 	if (sap && *sap == 0xFFFF)
 		return htons(ETH_P_802_3);
 
-	/*
-	 *      Real 802.2 LLC
+	/* Real 802.2 LLC
 	 */

better to move the closing */ up as a single line comment