2017-06-30 21:39:05

by Simon Sandström

[permalink] [raw]
Subject: [PATCH 0/4] 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(-)

--
2.11.0


2017-06-30 21:39:07

by Simon Sandström

[permalink] [raw]
Subject: [PATCH 2/4] staging: vt6656: Remove unnecessary blank lines

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

Signed-off-by: Simon Sandström <[email protected]>
---
drivers/staging/vt6656/power.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/vt6656/power.c b/drivers/staging/vt6656/power.c
index e322b7d8c617..c466e0614bc4 100644
--- a/drivers/staging/vt6656/power.c
+++ b/drivers/staging/vt6656/power.c
@@ -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);
--
2.11.0

2017-06-30 21:39:12

by Simon Sandström

[permalink] [raw]
Subject: [PATCH 4/4] staging: vt6656: Use variable instead of its type in sizeof(...)

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

Signed-off-by: Simon Sandström <[email protected]>
---
drivers/staging/vt6656/main_usb.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c
index 095b85567306..cc6d8778fe5b 100644
--- a/drivers/staging/vt6656/main_usb.c
+++ b/drivers/staging/vt6656/main_usb.c
@@ -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);
--
2.11.0

2017-06-30 21:39:09

by Simon Sandström

[permalink] [raw]
Subject: [PATCH 3/4] staging: vt6656: Align function parameters

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

Signed-off-by: Simon Sandström <[email protected]>
---
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(-)

diff --git a/drivers/staging/vt6656/key.h b/drivers/staging/vt6656/key.h
index 906d3454591d..cfc6c2131536 100644
--- a/drivers/staging/vt6656/key.h
+++ b/drivers/staging/vt6656/key.h
@@ -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__ */
diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c
index 42ac86747b30..3a9d19a0b842 100644
--- a/drivers/staging/vt6656/rf.c
+++ b/drivers/staging/vt6656/rf.c
@@ -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;
}
diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c
index dc11a05be8c4..23eaef458556 100644
--- a/drivers/staging/vt6656/usbpipe.c
+++ b/drivers/staging/vt6656/usbpipe.c
@@ -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;
--
2.11.0

2017-06-30 21:39:52

by Simon Sandström

[permalink] [raw]
Subject: [PATCH 1/4] staging: vt6656: Add spaces between operators

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

Signed-off-by: Simon Sandström <[email protected]>
---
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(-)

diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h
index 4832666cc580..74715c854856 100644
--- a/drivers/staging/vt6656/device.h
+++ b/drivers/staging/vt6656/device.h
@@ -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

diff --git a/drivers/staging/vt6656/firmware.c b/drivers/staging/vt6656/firmware.c
index 282f665aacfa..093a6048bd22 100644
--- a/drivers/staging/vt6656/firmware.c
+++ b/drivers/staging/vt6656/firmware.c
@@ -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);
diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c
index 23581afb4211..42ac86747b30 100644
--- a/drivers/staging/vt6656/rf.c
+++ b/drivers/staging/vt6656/rf.c
@@ -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;
}

--
2.11.0