Skip to contentSkip to conversation

staging: vt6656: Correct checkpatch.pl warnings

PATCH New Simon Sandström 1 participant 5 messages Jun 30, 2017 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: vt6656: Correct checkpatch.pl warnings

Here are some minor checkpatch.pl corrections to staging/vt6656.

I was about to ask before sending these in if you rather see commits grouped on file or on type of warning, e.g. each commit fixes multiple types of warnings in a single file versus each commit fixes one type of warning in multiple files. It was easier to write commit messages when grouped on type of warning, so that's what I did :-)

- Simon

---

Simon Sandström (4):
staging: vt6656: Add spaces between operators
staging: vt6656: Remove unnecessary blank lines
staging: vt6656: Align function parameters
staging: vt6656: Use variable instead of its type in sizeof(...)

 drivers/staging/vt6656/device.h   | 2 +-
 drivers/staging/vt6656/firmware.c | 2 +-
 drivers/staging/vt6656/key.h      | 2 +-
 drivers/staging/vt6656/main_usb.c | 5 ++---
 drivers/staging/vt6656/power.c    | 6 ++----
 drivers/staging/vt6656/rf.c       | 6 +++---
 drivers/staging/vt6656/usbpipe.c  | 4 ++--
 7 files changed, 12 insertions(+), 15 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH 1/4 staging: vt6656: Add spaces between operators

Fixes checkpatch.pl warnings "spaces preferred around that <operator>".

---
 drivers/staging/vt6656/device.h   | 2 +-
 drivers/staging/vt6656/firmware.c | 2 +-
 drivers/staging/vt6656/rf.c       | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/vt6656/device.h +1 -1
index 4832666cc580..74715c854856 100644
@@ -83,7 +83,7 @@
 #define CONFIG_PATH			"/etc/vntconfiguration.dat"
 
 #define MAX_UINTS			8
-#define OPTION_DEFAULT			{ [0 ... MAX_UINTS-1] = -1}
+#define OPTION_DEFAULT			{ [0 ... MAX_UINTS - 1] = -1}
 
 #define DUPLICATE_RX_CACHE_LENGTH       5
 
drivers/staging/vt6656/firmware.c +1 -1
index 282f665aacfa..093a6048bd22 100644
@@ -65,7 +65,7 @@ int vnt_download_firmware(struct vnt_private *priv)
 
 		status = vnt_control_out(priv,
 					 0,
-					 0x1200+ii,
+					 0x1200 + ii,
 					 0x0000,
 					 length,
 					 buffer);
drivers/staging/vt6656/rf.c +2 -2
index 23581afb4211..42ac86747b30 100644
@@ -643,9 +643,9 @@ int vnt_rf_setpower(struct vnt_private *priv, u32 rate, u32 channel)
 	case RATE_48M:
 	case RATE_54M:
 		if (channel > CB_MAX_CHANNEL_24G)
-			power = priv->ofdm_a_pwr_tbl[channel-15];
+			power = priv->ofdm_a_pwr_tbl[channel - 15];
 		else
-			power = priv->ofdm_pwr_tbl[channel-1];
+			power = priv->ofdm_pwr_tbl[channel - 1];
 		break;
 	}
 
Signature · 1 line
2.11.0
#2 lore raw

PATCH 2/4 staging: vt6656: Remove unnecessary blank lines

In reply to Simon Sandström

Fixes checkpatch.pl warning "Blank lines aren't necessary after an open brace". Also adds braces to balance if-else statement.

---
 drivers/staging/vt6656/power.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/staging/vt6656/power.c +2 -4
index e322b7d8c617..c466e0614bc4 100644
@@ -74,16 +74,15 @@ void vnt_enable_power_saving(struct vnt_private *priv, u16 listen_interval)
 	vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_GO2DOZE);
 
 	if (listen_interval >= 2) {
-
 		/* clear always listen beacon */
 		vnt_mac_reg_bits_off(priv, MAC_REG_PSCTL, PSCTL_ALBCN);
 
 		/* first time set listen next beacon */
 		vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_LNBCN);
-	} else
-
+	} else {
 		/* always listen beacon */
 		vnt_mac_reg_bits_on(priv, MAC_REG_PSCTL, PSCTL_ALBCN);
+	}
 
 	dev_dbg(&priv->usb->dev,  "PS:Power Saving Mode Enable...\n");
 }
@@ -100,7 +99,6 @@ void vnt_enable_power_saving(struct vnt_private *priv, u16 listen_interval)
 
 void vnt_disable_power_saving(struct vnt_private *priv)
 {
-
 	/* disable power saving hw function */
 	vnt_control_out(priv, MESSAGE_TYPE_DISABLE_PS, 0,
 			0, 0, NULL);
Signature · 1 line
2.11.0
#3 lore raw

PATCH 3/4 staging: vt6656: Align function parameters

In reply to Simon Sandström

Fixes checkpatch.pl warnings "Alignment should match open parenthesis".

---
 drivers/staging/vt6656/key.h     | 2 +-
 drivers/staging/vt6656/rf.c      | 2 +-
 drivers/staging/vt6656/usbpipe.c | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/vt6656/key.h +1 -1
index 906d3454591d..cfc6c2131536 100644
@@ -46,6 +46,6 @@
 int vnt_key_init_table(struct vnt_private *priv);
 
 int vnt_set_keys(struct ieee80211_hw *hw, struct ieee80211_sta *sta,
-		  struct ieee80211_vif *vif, struct ieee80211_key_conf *key);
+		 struct ieee80211_vif *vif, struct ieee80211_key_conf *key);
 
 #endif /* __KEY_H__ */
drivers/staging/vt6656/rf.c +1 -1
index 42ac86747b30..3a9d19a0b842 100644
@@ -611,7 +611,7 @@ int vnt_rf_write_embedded(struct vnt_private *priv, u32 data)
 	reg_data[3] = (u8)(data >> 24);
 
 	vnt_control_out(priv, MESSAGE_TYPE_WRITE_IFRF,
-				0, 0, ARRAY_SIZE(reg_data), reg_data);
+			0, 0, ARRAY_SIZE(reg_data), reg_data);
 
 	return true;
 }
drivers/staging/vt6656/usbpipe.c +2 -2
index dc11a05be8c4..23eaef458556 100644
@@ -44,7 +44,7 @@
 #define USB_CTL_WAIT	500 /* ms */
 
 int vnt_control_out(struct vnt_private *priv, u8 request, u16 value,
-		     u16 index, u16 length, u8 *buffer)
+		    u16 index, u16 length, u8 *buffer)
 {
 	int status = 0;
 	u8 *usb_buffer;
@@ -82,7 +82,7 @@ void vnt_control_out_u8(struct vnt_private *priv, u8 reg, u8 reg_off, u8 data)
 }
 
 int vnt_control_in(struct vnt_private *priv, u8 request, u16 value,
-		    u16 index, u16 length, u8 *buffer)
+		   u16 index, u16 length, u8 *buffer)
 {
 	int status;
 	u8 *usb_buffer;
Signature · 1 line
2.11.0
#4 lore raw

PATCH 4/4 staging: vt6656: Use variable instead of its type in sizeof(...)

In reply to Simon Sandström

Use sizeof(variable) instead of sizeof(type) in memory allocations to prevent problems if the variable type changes in the future.

---
 drivers/staging/vt6656/main_usb.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/staging/vt6656/main_usb.c +2 -3
index 095b85567306..cc6d8778fe5b 100644
@@ -419,8 +419,7 @@ static bool vnt_alloc_bufs(struct vnt_private *priv)
 	int ii;
 
 	for (ii = 0; ii < priv->num_tx_context; ii++) {
-		tx_context = kmalloc(sizeof(struct vnt_usb_send_context),
-				     GFP_KERNEL);
+		tx_context = kmalloc(sizeof(*tx_context), GFP_KERNEL);
 		if (!tx_context)
 			goto free_tx;
 
@@ -437,7 +436,7 @@ static bool vnt_alloc_bufs(struct vnt_private *priv)
 	}
 
 	for (ii = 0; ii < priv->num_rcb; ii++) {
-		priv->rcb[ii] = kzalloc(sizeof(struct vnt_rcb), GFP_KERNEL);
+		priv->rcb[ii] = kzalloc(sizeof(*priv->rcb[ii]), GFP_KERNEL);
 		if (!priv->rcb[ii]) {
 			dev_err(&priv->usb->dev,
 				"failed to allocate rcb no %d\n", ii);
Signature · 1 line
2.11.0