Skip to contentSkip to conversation

staging: wilc1000: Improve code readability

PATCH Superseded Tamara Diaconita 2 participants 5 messages Mar 11, 2017 – Mar 12, 2017 Staging

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v3 cover staging: wilc1000: Improve code readability

Fix multiple issues found with checkpatch.pl to improve code readability.

Tamara Diaconita (4):
staging: wilc1000: wilc_wlan_cfg: Rearrange lines
staging: wilc1000: linux_mon: Rearrange the code
staging: wilc1000: Align the code
staging: wilc1000: wilc_wlan_cfg: Delete blank line

 drivers/staging/wilc1000/linux_mon.c     | 27 ++++++++++++++++++---------
 drivers/staging/wilc1000/linux_wlan.c    |  8 ++++----
 drivers/staging/wilc1000/wilc_wlan_cfg.c | 24 ++++++++++++++++--------
 3 files changed, 38 insertions(+), 21 deletions(-)
Signature · 10 lines
Changes since v2:
*Change the subject of the patch set by adding the 'staging' and
the name of the driver 'wilc1000'.
*Correct misspelled word in the description of the cover-letter:
from checkpath.pl to checkpatch.pl.
*Remove a patch from the set.

Organize the patches that clean up the same driver in a set.

2.9.3
#1 lore raw

PATCH v3 1/3 staging: wilc1000: Enhance code formatting

Trims line size at 80 characters wilc_wlan_cfg.c file by moving a part of the lines in a new line.

Fixed the checkpath.pl issue:
CHECK: line over 80 characters.

---
Changes since v2:
*Wrap log message lines at 72.

 drivers/staging/wilc1000/wilc_wlan_cfg.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/staging/wilc1000/wilc_wlan_cfg.c +16 -7
index 926fc16..fed66dcd 100644
@@ -217,7 +217,8 @@ static int wilc_wlan_cfg_set_word(u8 *frame, u32 offset, u16 id, u32 val32)
 	return 7;
 }
 
-static int wilc_wlan_cfg_set_str(u8 *frame, u32 offset, u16 id, u8 *str, u32 size)
+static int wilc_wlan_cfg_set_str(u8 *frame, u32 offset, u16 id, u8 *str,
+				 u32 size)
 {
 	u8 *buf;
 
@@ -298,7 +299,8 @@ static void wilc_wlan_parse_response_frame(u8 *info, int size)
 					break;
 
 				if (g_cfg_hword[i].id == wid) {
-					g_cfg_hword[i].val = cpu_to_le16(info[3] | (info[4] << 8));
+					g_cfg_hword[i].val =
+					cpu_to_le16(info[3] | (info[4] << 8));
 					break;
 				}
 				i++;
@@ -312,7 +314,10 @@ static void wilc_wlan_parse_response_frame(u8 *info, int size)
 					break;
 
 				if (g_cfg_word[i].id == wid) {
-					g_cfg_word[i].val = cpu_to_le32(info[3] | (info[4] << 8) | (info[5] << 16) | (info[6] << 24));
+					g_cfg_word[i].val = cpu_to_le32(info[3]
+						| (info[4] << 8)
+						| (info[5] << 16)
+						| (info[6] << 24));
 					break;
 				}
 				i++;
@@ -332,7 +337,8 @@ static void wilc_wlan_parse_response_frame(u8 *info, int size)
 						i += toggle;
 						toggle ^= 1;
 					}
-					memcpy(g_cfg_str[i].str, &info[2], (info[2] + 1));
+					memcpy(g_cfg_str[i].str, &info[2],
+					       (info[2] + 1));
 					break;
 				}
 				i++;
@@ -478,14 +484,16 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size)
 				u32 size =  g_cfg_str[i].str[0];
 
 				if (buffer_size >= size) {
-					if (g_cfg_str[i].id == WID_SITE_SURVEY_RESULTS)	{
+					if (g_cfg_str[i].id ==
+					    WID_SITE_SURVEY_RESULTS){
 						static int toggle;
 
 						i += toggle;
 						toggle ^= 1;
 
 					}
-					memcpy(buffer,  &g_cfg_str[i].str[1], size);
+					memcpy(buffer,  &g_cfg_str[i].str[1],
+					       size);
 					ret = size;
 				}
 				break;
@@ -510,7 +518,8 @@ int wilc_wlan_cfg_indicate_rx(struct wilc *wilc, u8 *frame, int size,
 	size -= 4;
 
 	/**
-	 *      The  valid types of response messages are 'R' (Response), 'I' (Information), and 'N' (Network Information)
+	 *      The  valid types of response messages are 'R' (Response),
+	 *      'I' (Information), and 'N' (Network Information)
 	 **/
 
 	switch (msg_type) {
Signature · 1 line
2.9.3
maintainer
#2 lore raw

Re: [PATCH v3 1/3] staging: wilc1000: Enhance code formatting

Quoted 10 lines · Tamara Diaconita

Trims line size at 80 characters wilc_wlan_cfg.c file by moving a part of the lines in a new line.

Fixed the checkpath.pl issue:
CHECK: line over 80 characters.

---
Changes since v2:
*Wrap log message lines at 72.

You have two patches in this series with the identical subject line, yet they do different things. Totally confusing, please fix up and resend.

thanks,

greg k-h

#3 lore raw

PATCH v3 2/3 staging: wilc1000: Enhance code formatting

In reply to Tamara Diaconita

Trims line size at 80 characters in linux_mon.c file by moving parts of some lines in new lines.

Fixed the checkpath.pl issue:
CHECK: Line over 80 characters.

---
Changes since v2:
*Wrap log message lines at 72.

Changes since v1:
*Deleted linux_mon.c from the subject.

 drivers/staging/wilc1000/linux_mon.c | 27 ++++++++++++++++++---------
 1 file changed, 18 insertions(+), 9 deletions(-)
drivers/staging/wilc1000/linux_mon.c +18 -9
index f328d75..6897a51 100644
@@ -68,18 +68,21 @@ void WILC_WFI_monitor_rx(u8 *buff, u32 size)
 	if (pkt_offset & IS_MANAGMEMENT_CALLBACK) {
 		/* hostapd callback mgmt frame */
 
-		skb = dev_alloc_skb(size + sizeof(struct wilc_wfi_radiotap_cb_hdr));
+		skb = dev_alloc_skb(size +
+			sizeof(struct wilc_wfi_radiotap_cb_hdr));
 		if (!skb)
 			return;
 
 		memcpy(skb_put(skb, size), buff, size);
 
-		cb_hdr = (struct wilc_wfi_radiotap_cb_hdr *)skb_push(skb, sizeof(*cb_hdr));
+		cb_hdr = (struct wilc_wfi_radiotap_cb_hdr *)skb_push(skb,
+			  sizeof(*cb_hdr));
 		memset(cb_hdr, 0, sizeof(struct wilc_wfi_radiotap_cb_hdr));
 
 		cb_hdr->hdr.it_version = 0; /* PKTHDR_RADIOTAP_VERSION; */
 
-		cb_hdr->hdr.it_len = cpu_to_le16(sizeof(struct wilc_wfi_radiotap_cb_hdr));
+		cb_hdr->hdr.it_len =
+			cpu_to_le16(sizeof(struct wilc_wfi_radiotap_cb_hdr));
 
 		cb_hdr->hdr.it_present = cpu_to_le32(
 				(1 << IEEE80211_RADIOTAP_RATE) |
@@ -95,16 +98,19 @@ void WILC_WFI_monitor_rx(u8 *buff, u32 size)
 		}
 
 	} else {
-		skb = dev_alloc_skb(size + sizeof(struct wilc_wfi_radiotap_hdr));
+		skb = dev_alloc_skb(size +
+			sizeof(struct wilc_wfi_radiotap_hdr));
 
 		if (!skb)
 			return;
 
 		memcpy(skb_put(skb, size), buff, size);
-		hdr = (struct wilc_wfi_radiotap_hdr *)skb_push(skb, sizeof(*hdr));
+		hdr = (struct wilc_wfi_radiotap_hdr *)skb_push(skb,
+		       sizeof(*hdr));
 		memset(hdr, 0, sizeof(struct wilc_wfi_radiotap_hdr));
 		hdr->hdr.it_version = 0; /* PKTHDR_RADIOTAP_VERSION; */
-		hdr->hdr.it_len = cpu_to_le16(sizeof(struct wilc_wfi_radiotap_hdr));
+		hdr->hdr.it_len =
+			cpu_to_le16(sizeof(struct wilc_wfi_radiotap_hdr));
 		hdr->hdr.it_present = cpu_to_le32
 				(1 << IEEE80211_RADIOTAP_RATE); /* | */
 		hdr->rate = 5; /* txrate->bitrate / 5; */
@@ -196,16 +202,19 @@ static netdev_tx_t WILC_WFI_mon_xmit(struct sk_buff *skb,
 	skb_pull(skb, rtap_len);
 
 	if (skb->data[0] == 0xc0 && (!(memcmp(broadcast, &skb->data[4], 6)))) {
-		skb2 = dev_alloc_skb(skb->len + sizeof(struct wilc_wfi_radiotap_cb_hdr));
+		skb2 = dev_alloc_skb(skb->len +
+			sizeof(struct wilc_wfi_radiotap_cb_hdr));
 
 		memcpy(skb_put(skb2, skb->len), skb->data, skb->len);
 
-		cb_hdr = (struct wilc_wfi_radiotap_cb_hdr *)skb_push(skb2, sizeof(*cb_hdr));
+		cb_hdr = (struct wilc_wfi_radiotap_cb_hdr *)skb_push(skb2,
+			sizeof(*cb_hdr));
 		memset(cb_hdr, 0, sizeof(struct wilc_wfi_radiotap_cb_hdr));
 
 		cb_hdr->hdr.it_version = 0; /* PKTHDR_RADIOTAP_VERSION; */
 
-		cb_hdr->hdr.it_len = cpu_to_le16(sizeof(struct wilc_wfi_radiotap_cb_hdr));
+		cb_hdr->hdr.it_len =
+			cpu_to_le16(sizeof(struct wilc_wfi_radiotap_cb_hdr));
 
 		cb_hdr->hdr.it_present = cpu_to_le32(
 				(1 << IEEE80211_RADIOTAP_RATE) |
Signature · 1 line
2.9.3
#4 lore raw

PATCH v3 3/3 staging: wilc1000: Delete blank line

In reply to Tamara Diaconita

Delete blank line before a '}' to match the kernel coding style and improve code readability in wilc_wlan_cfg.c file.

Fix the checkpath.pl issue:
CHECK: Blank lines aren't necessary before '}'.

---
Changes since v2:
*Wrap log message lines at 72.

 drivers/staging/wilc1000/wilc_wlan_cfg.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/wilc1000/wilc_wlan_cfg.c +0 -1
index fed66dcd..f442e6f 100644
@@ -490,7 +490,6 @@ int wilc_wlan_cfg_get_wid_value(u16 wid, u8 *buffer, u32 buffer_size)
 
 						i += toggle;
 						toggle ^= 1;
-
 					}
 					memcpy(buffer,  &g_cfg_str[i].str[1],
 					       size);
Signature · 1 line
2.9.3