Skip to contentSkip to conversation

staging: wfx: replace uint32_t with u32

PATCH In review Jules Irenge 3 participants 5 messages Nov 6, 2019 – Nov 7, 2019 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 staging: wfx: replace uint32_t with u32

Replace kernel type uint32_t with u32.
As per recommendation of checkpatch tool.

---
 drivers/staging/wfx/bh.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wfx/bh.c +1 -1
index 955ed3a1dd73..337af22b0150 100644
@@ -239,7 +239,7 @@ static int bh_work_tx(struct wfx_dev *wdev, int max_msg)
  */
 static void ack_sdio_data(struct wfx_dev *wdev)
 {
-	uint32_t cfg_reg;
+	u32  cfg_reg;
 
 	config_reg_read(wdev, &cfg_reg);
 	if (cfg_reg & 0xFF) {
Signature · 1 line
2.23.0
#1 lore raw

PATCH 2/3 staging: wfx: replace uint8_t with u8

Replace kernel type uint8_t with u8.
As per recommendation of checkpatch tool.

---
 drivers/staging/wfx/data_tx.c |  4 ++--
 drivers/staging/wfx/data_tx.h | 18 +++++++++---------
 2 files changed, 11 insertions(+), 11 deletions(-)
drivers/staging/wfx/data_tx.c +2 -2
index ea4205ac2149..76a474bf2e85 100644
@@ -107,7 +107,7 @@ static void wfx_tx_policy_build(struct wfx_vif *wvif, struct tx_policy *policy,
 
 	for (i = 0; i < IEEE80211_TX_MAX_RATES; ++i) {
 		int rateid;
-		uint8_t count;
+		u8 count;
 
 		if (rates[i].idx < 0)
 			break;
@@ -546,7 +546,7 @@ static uint8_t wfx_tx_get_rate_id(struct wfx_vif *wvif,
 				  struct ieee80211_tx_info *tx_info)
 {
 	bool tx_policy_renew = false;
-	uint8_t rate_id;
+	u8 rate_id;
 
 	rate_id = wfx_tx_policy_get(wvif,
 				    tx_info->driver_rates, &tx_policy_renew);
drivers/staging/wfx/data_tx.h +9 -9
index f74d1988925d..f203697a9617 100644
@@ -31,17 +31,17 @@ enum wfx_link_status {
 struct wfx_link_entry {
 	unsigned long		timestamp;
 	enum wfx_link_status	status;
-	uint8_t			mac[ETH_ALEN];
-	uint8_t			old_mac[ETH_ALEN];
-	uint8_t			buffered[WFX_MAX_TID];
+	u8			mac[ETH_ALEN];
+	u8			old_mac[ETH_ALEN];
+	u8			buffered[WFX_MAX_TID];
 	struct sk_buff_head	rx_queue;
 };
 
 struct tx_policy {
 	struct list_head link;
-	uint8_t rates[12];
-	uint8_t usage_count;
-	uint8_t uploaded;
+	u8     rates[12];
+	u8     usage_count;
+	u8     uploaded;
 };
 
 struct tx_policy_cache {
@@ -55,9 +55,9 @@ struct tx_policy_cache {
 struct wfx_tx_priv {
 	ktime_t xmit_timestamp;
 	struct ieee80211_key_conf *hw_key;
-	uint8_t link_id;
-	uint8_t raw_link_id;
-	uint8_t tid;
+	u8     link_id;
+	u8     raw_link_id;
+	u8     tid;
 } __packed;
 
 void wfx_tx_policy_init(struct wfx_vif *wvif);
Signature · 1 line
2.23.0
#2 lore raw

PATCH 3/3 staging: wfx: remove space after a cast

In reply to Jules Irenge

Remove a space after a cast to fix an issue
raised by checkpatch tool.
"CHECK: No space is necessary after a cast."

---
 drivers/staging/wfx/data_rx.c | 2 +-
 drivers/staging/wfx/data_tx.c | 4 ++--
 drivers/staging/wfx/data_tx.h | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/wfx/data_rx.c +1 -1
index e7fcce8d0cc4..1d26c1b77725 100644
@@ -50,7 +50,7 @@ static int wfx_handle_pspoll(struct wfx_vif *wvif, struct sk_buff *skb)
 
 static int wfx_drop_encrypt_data(struct wfx_dev *wdev, struct hif_ind_rx *arg, struct sk_buff *skb)
 {
-	struct ieee80211_hdr *frame = (struct ieee80211_hdr *) skb->data;
+	struct ieee80211_hdr *frame = (struct ieee80211_hdr *)skb->data;
 	size_t hdrlen = ieee80211_hdrlen(frame->frame_control);
 	size_t iv_len, icv_len;
 
drivers/staging/wfx/data_tx.c +2 -2
index 76a474bf2e85..ee01eaa8ae86 100644
@@ -482,7 +482,7 @@ static uint8_t wfx_tx_get_raw_link_id(struct wfx_vif *wvif,
 				      struct ieee80211_hdr *hdr)
 {
 	struct wfx_sta_priv *sta_priv =
-		sta ? (struct wfx_sta_priv *) &sta->drv_priv : NULL;
+		sta ? (struct wfx_sta_priv *)&sta->drv_priv : NULL;
 	const u8 *da = ieee80211_get_DA(hdr);
 	int ret;
 
@@ -615,7 +615,7 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta,
 	struct ieee80211_key_conf *hw_key = tx_info->control.hw_key;
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
 	int queue_id = tx_info->hw_queue;
-	size_t offset = (size_t) skb->data & 3;
+	size_t offset = (size_t)skb->data & 3;
 	int wmsg_len = sizeof(struct hif_msg) +
 			sizeof(struct hif_req_tx) + offset;
 
drivers/staging/wfx/data_tx.h +1 -1
index f203697a9617..a8323d60d909 100644
@@ -85,7 +85,7 @@ static inline struct wfx_tx_priv *wfx_skb_tx_priv(struct sk_buff *skb)
 static inline struct hif_req_tx *wfx_skb_txreq(struct sk_buff *skb)
 {
 	struct hif_msg *hif = (struct hif_msg *)skb->data;
-	struct hif_req_tx *req = (struct hif_req_tx *) hif->body;
+	struct hif_req_tx *req = (struct hif_req_tx *)hif->body;
 
 	return req;
 }
Signature · 1 line
2.23.0
#3 lore raw
In reply to Jules Irenge

Hello Jules,

Quoted 13 lines · On Wednesday 6 November 2019 02:09:09 CET Jules Irenge wrote:

Replace kernel type uint32_t with u32.
As per recommendation of checkpatch tool.

---
 drivers/staging/wfx/bh.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wfx/bh.c +0 -0
index 955ed3a1dd73..337af22b0150 100644

drivers/staging/wfx/bh.c static int bh_work_tx(struct wfx_dev *wdev, int max_msg) · line 242

Quoted 5 lines
drivers/staging/wfx/bh.c +1 -1
@@ -239,7 +239,7 @@ static int bh_work_tx(struct wfx_dev *wdev, int max_msg)
  */
 static void ack_sdio_data(struct wfx_dev *wdev)
 {
-       uint32_t cfg_reg;
+       u32  cfg_reg;

Why there are two spaces between u32 and cfg_reg?

Quoted 5 lines
drivers/staging/wfx/bh.c +0 -1
        config_reg_read(wdev, &cfg_reg);
        if (cfg_reg & 0xFF) {
--

2.23.0

There are plenty of other occurrences of uintXX_t:

   $ git grep '\buint[0-9]*_t\b' drivers/staging/wfx | wc -l
   628

Why do you solve this one particularly?

In add, the driver use more often uintXX_t than uXX:

   $ git grep '\bu[0-9]\+\b' drivers/staging/wfx | wc -l  
   171

In other parts of kernel, uintXX_t are not rare:

   $ git grep '\buint[0-9]*_t\b' | grep -v staging | wc -l 
   94005

I have a slight preference for uintXX_t, because it is less specific to kernel (and because vim highlights uintXX_t but does not highlight uXX).

Anyway, I am agree to uniformize these types.

Thanks for your contribution.

Signature · 1 line
Jérôme Pouiller
#4 lore raw
Quoted 11 lines · Jerome Pouiller

Hello Jules,

Quoted 8 lines · On Wednesday 6 November 2019 02:09:09 CET Jules Irenge wrote:

Replace kernel type uint32_t with u32.
As per recommendation of checkpatch tool.

---
 drivers/staging/wfx/bh.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 11 lines

drivers/staging/wfx/bh.c static int bh_work_tx(struct wfx_dev *wdev, int max_msg) · line 242

Quoted 10 lines
drivers/staging/wfx/bh.c +1 -1
index 955ed3a1dd73..337af22b0150 100644
@@ -239,7 +239,7 @@ static int bh_work_tx(struct wfx_dev *wdev, int max_msg)
  */
 static void ack_sdio_data(struct wfx_dev *wdev)
 {
-       uint32_t cfg_reg;
+       u32  cfg_reg;

Why there are two spaces between u32 and cfg_reg?

Yes, that's not ok, I can't take this patch as-is for that reason alone.

Quoted 20 lines
Quoted 6 lines
drivers/staging/wfx/bh.c +0 -1
        config_reg_read(wdev, &cfg_reg);
        if (cfg_reg & 0xFF) {
--

2.23.0

There are plenty of other occurrences of uintXX_t:

   $ git grep '\buint[0-9]*_t\b' drivers/staging/wfx | wc -l
   628

Why do you solve this one particularly?

In add, the driver use more often uintXX_t than uXX:

   $ git grep '\bu[0-9]\+\b' drivers/staging/wfx | wc -l  
   171
Quoted 7 lines

In other parts of kernel, uintXX_t are not rare:

   $ git grep '\buint[0-9]*_t\b' | grep -v staging | wc -l 
   94005

I have a slight preference for uintXX_t, because it is less specific to kernel (and because vim highlights uintXX_t but does not highlight uXX).

uintXX_t really doesn't make sense in the kernel, as the "namespace" is wrong, but we tolerate it. Ideally you will use the right types.

Also, use the vim-addon-linux-coding-style pluging, makes writing kernel code using vim much easier.

thanks,

greg k-h