[PATCH] staging: r8188eu: fix too many leading tabs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Coding style fix. Fix too many leading tabs and line length. Convert
__constant_htons to htons

Signed-off-by: Joash Naidoo <joash.n09@xxxxxxxxx>
---
 drivers/staging/r8188eu/core/rtw_br_ext.c | 66 ++++++++++++-----------
 1 file changed, 35 insertions(+), 31 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_br_ext.c b/drivers/staging/r8188eu/core/rtw_br_ext.c
index bca20fe5c..8e951fc0e 100644
--- a/drivers/staging/r8188eu/core/rtw_br_ext.c
+++ b/drivers/staging/r8188eu/core/rtw_br_ext.c
@@ -604,37 +604,41 @@ void dhcp_flag_bcast(struct adapter *priv, struct sk_buff *skb)
 	if (!skb)
 		return;
 
-	if (!priv->ethBrExtInfo.dhcp_bcst_disable) {
-		__be16 protocol = *((__be16 *)(skb->data + 2 * ETH_ALEN));
-
-		if (protocol == __constant_htons(ETH_P_IP)) { /*  IP */
-			struct iphdr *iph = (struct iphdr *)(skb->data + ETH_HLEN);
-
-			if (iph->protocol == IPPROTO_UDP) { /*  UDP */
-				struct udphdr *udph = (struct udphdr *)((size_t)iph + (iph->ihl << 2));
-
-				if ((udph->source == __constant_htons(CLIENT_PORT)) &&
-				    (udph->dest == __constant_htons(SERVER_PORT))) { /*  DHCP request */
-					struct dhcpMessage *dhcph =
-						(struct dhcpMessage *)((size_t)udph + sizeof(struct udphdr));
-					u32 cookie = be32_to_cpu((__be32)dhcph->cookie);
-
-					if (cookie == DHCP_MAGIC) { /*  match magic word */
-						if (!(dhcph->flags & htons(BROADCAST_FLAG))) {
-							/*  if not broadcast */
-							register int sum = 0;
-
-							/*  or BROADCAST flag */
-							dhcph->flags |= htons(BROADCAST_FLAG);
-							/*  recalculate checksum */
-							sum = ~(udph->check) & 0xffff;
-							sum += be16_to_cpu(dhcph->flags);
-							while (sum >> 16)
-								sum = (sum & 0xffff) + (sum >> 16);
-							udph->check = ~sum;
-						}
-					}
-				}
+	if (priv->ethBrExtInfo.dhcp_bcst_disable)
+		return;
+
+	__be16 protocol = *((__be16 *)(skb->data + 2 * ETH_ALEN));
+
+	if (protocol != htons(ETH_P_IP)) /*  IP */
+		return;
+
+	struct iphdr *iph = (struct iphdr *)(skb->data + ETH_HLEN);
+
+	if (iph->protocol != IPPROTO_UDP) /*  UDP */
+		return;
+
+	struct udphdr *udph = (struct udphdr *)((size_t)iph + (iph->ihl << 2));
+
+	if ((udph->source == htons(CLIENT_PORT)) &&
+	    (udph->dest == htons(SERVER_PORT))) { /*  DHCP request */
+		struct dhcpMessage *dhcph =
+			(struct dhcpMessage *)((size_t)udph +
+						   sizeof(struct udphdr));
+		u32 cookie = be32_to_cpu((__be32)dhcph->cookie);
+
+		if (cookie == DHCP_MAGIC) { /*  match magic word */
+			if (!(dhcph->flags & htons(BROADCAST_FLAG))) {
+				/*  if not broadcast */
+				register int sum = 0;
+
+				/*  or BROADCAST flag */
+				dhcph->flags |= htons(BROADCAST_FLAG);
+				/*  recalculate checksum */
+				sum = ~(udph->check) & 0xffff;
+				sum += be16_to_cpu(dhcph->flags);
+				while (sum >> 16)
+					sum = (sum & 0xffff) + (sum >> 16);
+				udph->check = ~sum;
 			}
 		}
 	}
-- 
2.35.1





[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux