Re: [PATCH v1 5/6] mt76: fix some checkpatch warnings

2019-08-20 Thread Felix Fietkau
On 2019-07-24 10:58, Ryder Lee wrote:
> --- a/drivers/net/wireless/mediatek/mt76/mt76.h
> +++ b/drivers/net/wireless/mediatek/mt76/mt76.h
> @@ -537,25 +537,25 @@ struct mt76_rx_status {
>   s8 chain_signal[IEEE80211_MAX_CHAINS];
>  };
>  
> -#define __mt76_rr(dev, ...)  (dev)->bus->rr((dev), __VA_ARGS__)
> -#define __mt76_wr(dev, ...)  (dev)->bus->wr((dev), __VA_ARGS__)
> -#define __mt76_rmw(dev, ...) (dev)->bus->rmw((dev), __VA_ARGS__)
> -#define __mt76_wr_copy(dev, ...) (dev)->bus->copy((dev), __VA_ARGS__)
> +#define __mt76_rr(dev, ...)  ((dev)->bus->rr((dev), __VA_ARGS__))
> +#define __mt76_wr(dev, ...)  ((dev)->bus->wr((dev), __VA_ARGS__))
> +#define __mt76_rmw(dev, ...) ((dev)->bus->rmw((dev), __VA_ARGS__))
> +#define __mt76_wr_copy(dev, ...) ((dev)->bus->copy((dev), __VA_ARGS__))
>  
>  #define __mt76_set(dev, offset, val) __mt76_rmw(dev, offset, 0, val)
>  #define __mt76_clear(dev, offset, val)   __mt76_rmw(dev, offset, val, 0)
>  
> -#define mt76_rr(dev, ...)(dev)->mt76.bus->rr(&((dev)->mt76), __VA_ARGS__)
> -#define mt76_wr(dev, ...)(dev)->mt76.bus->wr(&((dev)->mt76), __VA_ARGS__)
> -#define mt76_rmw(dev, ...)   (dev)->mt76.bus->rmw(&((dev)->mt76), 
> __VA_ARGS__)
> -#define mt76_wr_copy(dev, ...)   (dev)->mt76.bus->copy(&((dev)->mt76), 
> __VA_ARGS__)
> -#define mt76_wr_rp(dev, ...) (dev)->mt76.bus->wr_rp(&((dev)->mt76), 
> __VA_ARGS__)
> -#define mt76_rd_rp(dev, ...) (dev)->mt76.bus->rd_rp(&((dev)->mt76), 
> __VA_ARGS__)
> +#define mt76_rr(dev, ...)((dev)->mt76.bus->rr(&((dev)->mt76), 
> __VA_ARGS__))
> +#define mt76_wr(dev, ...)((dev)->mt76.bus->wr(&((dev)->mt76), 
> __VA_ARGS__))
> +#define mt76_rmw(dev, ...)   ((dev)->mt76.bus->rmw(&((dev)->mt76), 
> __VA_ARGS__))
> +#define mt76_wr_copy(dev, ...)   ((dev)->mt76.bus->copy(&((dev)->mt76), 
> __VA_ARGS__))
> +#define mt76_wr_rp(dev, ...) ((dev)->mt76.bus->wr_rp(&((dev)->mt76), 
> __VA_ARGS__))
> +#define mt76_rd_rp(dev, ...) ((dev)->mt76.bus->rd_rp(&((dev)->mt76), 
> __VA_ARGS__))
>  
> -#define mt76_mcu_send_msg(dev, ...)  
> (dev)->mt76.mcu_ops->mcu_send_msg(&((dev)->mt76), __VA_ARGS__)
> -#define __mt76_mcu_send_msg(dev, ...)
> (dev)->mcu_ops->mcu_send_msg((dev), __VA_ARGS__)
> -#define mt76_mcu_restart(dev, ...)   
> (dev)->mt76.mcu_ops->mcu_restart(&((dev)->mt76))
> -#define __mt76_mcu_restart(dev, ...) (dev)->mcu_ops->mcu_restart((dev))
> +#define mt76_mcu_send_msg(dev, ...)  
> ((dev)->mt76.mcu_ops->mcu_send_msg(&((dev)->mt76), __VA_ARGS__))
> +#define __mt76_mcu_send_msg(dev, ...)
> ((dev)->mcu_ops->mcu_send_msg((dev), __VA_ARGS__))
> +#define mt76_mcu_restart(dev, ...)   
> ((dev)->mt76.mcu_ops->mcu_restart(&((dev)->mt76)))
> +#define __mt76_mcu_restart(dev, ...) ((dev)->mcu_ops->mcu_restart((dev)))
>  
>  #define mt76_set(dev, offset, val)   mt76_rmw(dev, offset, 0, val)
>  #define mt76_clear(dev, offset, val) mt76_rmw(dev, offset, val, 0)
> @@ -569,7 +569,7 @@ struct mt76_rx_status {
>  #define __mt76_rmw_field(_dev, _reg, _field, _val)   \
>   __mt76_rmw(_dev, _reg, _field, FIELD_PREP(_field, _val))
>  
> -#define mt76_hw(dev) (dev)->mt76.hw
> +#define mt76_hw(dev) ((dev)->mt76.hw)
>  
>  bool __mt76_poll(struct mt76_dev *dev, u32 offset, u32 mask, u32 val,
>int timeout);
> @@ -596,13 +596,13 @@ static inline u16 mt76_rev(struct mt76_dev *dev)
>  #define mt76xx_chip(dev) mt76_chip(&((dev)->mt76))
>  #define mt76xx_rev(dev) mt76_rev(&((dev)->mt76))
>  
> -#define mt76_init_queues(dev)
> (dev)->mt76.queue_ops->init(&((dev)->mt76))
> -#define mt76_queue_alloc(dev, ...)   
> (dev)->mt76.queue_ops->alloc(&((dev)->mt76), __VA_ARGS__)
> -#define mt76_tx_queue_skb_raw(dev, ...)  
> (dev)->mt76.queue_ops->tx_queue_skb_raw(&((dev)->mt76), __VA_ARGS__)
> -#define mt76_tx_queue_skb(dev, ...)  
> (dev)->mt76.queue_ops->tx_queue_skb(&((dev)->mt76), __VA_ARGS__)
> -#define mt76_queue_rx_reset(dev, ...)
> (dev)->mt76.queue_ops->rx_reset(&((dev)->mt76), __VA_ARGS__)
> -#define mt76_queue_tx_cleanup(dev, ...)  
> (dev)->mt76.queue_ops->tx_cleanup(&((dev)->mt76), __VA_ARGS__)
> -#define mt76_queue_kick(dev, ...)
> (dev)->mt76.queue_ops->kick(&((dev)->mt76), __VA_ARGS__)
> +#define mt76_init_queues(dev)
> ((dev)->mt76.queue_ops->init(&((dev)->mt76)))
> +#define mt76_queue_alloc(dev, ...)   
> ((dev)->mt76.queue_ops->alloc(&((dev)->mt76), __VA_ARGS__))
> +#define mt76_tx_queue_skb_raw(dev, ...)  
> ((dev)->mt76.queue_ops->tx_queue_skb_raw(&((dev)->mt76), __VA_ARGS__))
> +#define mt76_tx_queue_skb(dev, ...)  
> ((dev)->mt76.queue_ops->tx_queue_skb(&((dev)->mt76), __VA_ARGS__))
> +#define mt76_queue_rx_reset(dev, ...)
> ((dev)->mt76.queue_ops->rx_reset(&((dev)->mt76), __VA_ARGS__))
> +#define mt76_queue_tx_cleanup(dev, ...)  
> ((dev)->mt76.queue_ops->tx_cleanup(&((dev)->mt76), __VA_ARGS__))
> +#define mt76_queue_kick(dev, ...)
> ((dev)->mt76.queue_ops->kick(&((dev)->mt76), __VA_ARGS__))
>  
>  static inline s

Re: [PATCH v1 5/6] mt76: fix some checkpatch warnings

2019-07-24 Thread Joe Perches
On Wed, 2019-07-24 at 16:58 +0800, Ryder Lee wrote:
> This fixes the following checkpatch warnings:
[]
> diff --git a/drivers/net/wireless/mediatek/mt76/agg-rx.c 
> b/drivers/net/wireless/mediatek/mt76/agg-rx.c
[]
> @@ -74,15 +75,14 @@ mt76_rx_aggr_check_release(struct mt76_rx_tid *tid, 
> struct sk_buff_head *frames)
>   for (idx = (tid->head + 1) % tid->size;
>idx != start && nframes;
>idx = (idx + 1) % tid->size) {
> -
>   skb = tid->reorder_buf[idx];
>   if (!skb)
>   continue;
>  
>   nframes--;
> - status = (struct mt76_rx_status *) skb->cb;
> + status = (struct mt76_rx_status *)skb->cb;
>   if (!time_after(jiffies, status->reorder_time +
> -  REORDER_TIMEOUT))
> + REORDER_TIMEOUT))

trivia/bikeshedding:  perhaps better slightly differently:

if (!time_after(jiffies,
status->reorder_time + REORDER_TIMEOUT))




[PATCH v1 5/6] mt76: fix some checkpatch warnings

2019-07-24 Thread Ryder Lee
This fixes the following checkpatch warnings:
ERROR: Macros with complex values should be enclosed in parentheses
CHECK: Alignment should match open parenthesis
CHECK: No space is necessary after a cast

Signed-off-by: Ryder Lee 
---
 drivers/net/wireless/mediatek/mt76/agg-rx.c   | 21 +
 drivers/net/wireless/mediatek/mt76/dma.c  |  2 +-
 drivers/net/wireless/mediatek/mt76/mac80211.c | 30 ++--
 drivers/net/wireless/mediatek/mt76/mt76.h | 46 +--
 drivers/net/wireless/mediatek/mt76/trace.h|  9 ++--
 drivers/net/wireless/mediatek/mt76/tx.c   | 18 
 drivers/net/wireless/mediatek/mt76/usb.c  | 31 +++--
 .../net/wireless/mediatek/mt76/usb_trace.h| 11 +++--
 drivers/net/wireless/mediatek/mt76/util.h |  4 +-
 9 files changed, 89 insertions(+), 83 deletions(-)

diff --git a/drivers/net/wireless/mediatek/mt76/agg-rx.c 
b/drivers/net/wireless/mediatek/mt76/agg-rx.c
index 27e3ff039c48..4d33efdb3555 100644
--- a/drivers/net/wireless/mediatek/mt76/agg-rx.c
+++ b/drivers/net/wireless/mediatek/mt76/agg-rx.c
@@ -34,8 +34,9 @@ mt76_aggr_release(struct mt76_rx_tid *tid, struct 
sk_buff_head *frames, int idx)
 }
 
 static void
-mt76_rx_aggr_release_frames(struct mt76_rx_tid *tid, struct sk_buff_head 
*frames,
-u16 head)
+mt76_rx_aggr_release_frames(struct mt76_rx_tid *tid,
+   struct sk_buff_head *frames,
+   u16 head)
 {
int idx;
 
@@ -74,15 +75,14 @@ mt76_rx_aggr_check_release(struct mt76_rx_tid *tid, struct 
sk_buff_head *frames)
for (idx = (tid->head + 1) % tid->size;
 idx != start && nframes;
 idx = (idx + 1) % tid->size) {
-
skb = tid->reorder_buf[idx];
if (!skb)
continue;
 
nframes--;
-   status = (struct mt76_rx_status *) skb->cb;
+   status = (struct mt76_rx_status *)skb->cb;
if (!time_after(jiffies, status->reorder_time +
-REORDER_TIMEOUT))
+   REORDER_TIMEOUT))
continue;
 
mt76_rx_aggr_release_frames(tid, frames, status->seqno);
@@ -122,8 +122,8 @@ mt76_rx_aggr_reorder_work(struct work_struct *work)
 static void
 mt76_rx_aggr_check_ctl(struct sk_buff *skb, struct sk_buff_head *frames)
 {
-   struct mt76_rx_status *status = (struct mt76_rx_status *) skb->cb;
-   struct ieee80211_bar *bar = (struct ieee80211_bar *) skb->data;
+   struct mt76_rx_status *status = (struct mt76_rx_status *)skb->cb;
+   struct ieee80211_bar *bar = (struct ieee80211_bar *)skb->data;
struct mt76_wcid *wcid = status->wcid;
struct mt76_rx_tid *tid;
u16 seqno;
@@ -148,8 +148,8 @@ mt76_rx_aggr_check_ctl(struct sk_buff *skb, struct 
sk_buff_head *frames)
 
 void mt76_rx_aggr_reorder(struct sk_buff *skb, struct sk_buff_head *frames)
 {
-   struct mt76_rx_status *status = (struct mt76_rx_status *) skb->cb;
-   struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
+   struct mt76_rx_status *status = (struct mt76_rx_status *)skb->cb;
+   struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
struct mt76_wcid *wcid = status->wcid;
struct ieee80211_sta *sta;
struct mt76_rx_tid *tid;
@@ -233,7 +233,8 @@ void mt76_rx_aggr_reorder(struct sk_buff *skb, struct 
sk_buff_head *frames)
tid->nframes++;
mt76_rx_aggr_release_head(tid, frames);
 
-   ieee80211_queue_delayed_work(tid->dev->hw, &tid->reorder_work, 
REORDER_TIMEOUT);
+   ieee80211_queue_delayed_work(tid->dev->hw, &tid->reorder_work,
+REORDER_TIMEOUT);
 
 out:
spin_unlock_bh(&tid->lock);
diff --git a/drivers/net/wireless/mediatek/mt76/dma.c 
b/drivers/net/wireless/mediatek/mt76/dma.c
index d8f61e540bfd..bb223faa740f 100644
--- a/drivers/net/wireless/mediatek/mt76/dma.c
+++ b/drivers/net/wireless/mediatek/mt76/dma.c
@@ -504,7 +504,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue 
*q, int budget)
skb_reserve(skb, q->buf_offset);
 
if (q == &dev->q_rx[MT_RXQ_MCU]) {
-   u32 *rxfce = (u32 *) skb->cb;
+   u32 *rxfce = (u32 *)skb->cb;
*rxfce = info;
}
 
diff --git a/drivers/net/wireless/mediatek/mt76/mac80211.c 
b/drivers/net/wireless/mediatek/mt76/mac80211.c
index ec9efb79985f..20b8c0f9048e 100644
--- a/drivers/net/wireless/mediatek/mt76/mac80211.c
+++ b/drivers/net/wireless/mediatek/mt76/mac80211.c
@@ -502,7 +502,7 @@ struct ieee80211_sta *mt76_rx_convert(struct sk_buff *skb)
struct ieee80211_rx_status *status = IEEE80211_SKB_RXCB(skb);
struct mt76_rx_status mstat;
 
-   mstat = *((struct mt76_rx_status *) skb->cb);
+   mstat = *((struct mt76_rx_status *)skb->cb);
memset(status, 0, siz