From b18d66f74946fe8a6abdd4c89e211b76ffcef014 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Mon, 5 Sep 2016 11:12:19 +0200 Subject: [PATCH] core: fix checkpatch errors Signed-off-by: Felix Fietkau --- debugfs.c | 3 ++- dma.c | 34 +++++++++++++++++++--------------- eeprom.c | 7 +++---- mac80211.c | 10 +++++----- mmio.c | 3 ++- mt76.h | 13 ++++++++----- tx.c | 11 +++++++---- util.c | 2 +- 8 files changed, 47 insertions(+), 36 deletions(-) diff --git a/debugfs.c b/debugfs.c index 83502aee..cfe32e53 100644 --- a/debugfs.c +++ b/debugfs.c @@ -64,7 +64,8 @@ struct dentry *mt76_register_debugfs(struct mt76_dev *dev) return NULL; debugfs_create_u32("regidx", S_IRUSR | S_IWUSR, dir, &dev->debugfs_reg); - debugfs_create_file("regval", S_IRUSR | S_IWUSR, dir, dev, &fops_regval); + debugfs_create_file("regval", S_IRUSR | S_IWUSR, dir, dev, + &fops_regval); debugfs_create_blob("eeprom", S_IRUSR, dir, &dev->eeprom); if (dev->otp.data) debugfs_create_blob("otp", S_IRUSR, dir, &dev->otp); diff --git a/dma.c b/dma.c index 60fe2797..ec4880cd 100644 --- a/dma.c +++ b/dma.c @@ -82,10 +82,10 @@ mt76_dma_add_buf(struct mt76_dev *dev, struct mt76_queue *q, desc = &q->desc[idx]; - ACCESS_ONCE(desc->buf0) = cpu_to_le32(buf0); - ACCESS_ONCE(desc->buf1) = cpu_to_le32(buf1); - ACCESS_ONCE(desc->info) = cpu_to_le32(info); - ACCESS_ONCE(desc->ctrl) = cpu_to_le32(ctrl); + WRITE_ONCE(desc->buf0, cpu_to_le32(buf0)); + WRITE_ONCE(desc->buf1, cpu_to_le32(buf1)); + WRITE_ONCE(desc->info, cpu_to_le32(info)); + WRITE_ONCE(desc->ctrl, cpu_to_le32(ctrl)); q->queued++; } @@ -101,25 +101,27 @@ mt76_dma_tx_cleanup_idx(struct mt76_dev *dev, struct mt76_queue *q, int idx, struct mt76_queue_entry *prev_e) { struct mt76_queue_entry *e = &q->entry[idx]; - __le32 __ctrl = ACCESS_ONCE(q->desc[idx].ctrl); + __le32 __ctrl = READ_ONCE(q->desc[idx].ctrl); u32 ctrl = le32_to_cpu(__ctrl); if (!e->txwi || !e->skb) { - __le32 addr = ACCESS_ONCE(q->desc[idx].buf0); + __le32 addr = READ_ONCE(q->desc[idx].buf0); u32 len = FIELD_GET(MT_DMA_CTL_SD_LEN0, ctrl); + dma_unmap_single(dev->dev, le32_to_cpu(addr), len, DMA_TO_DEVICE); } if (!(ctrl & MT_DMA_CTL_LAST_SEC0)) { - __le32 addr = ACCESS_ONCE(q->desc[idx].buf1); + __le32 addr = READ_ONCE(q->desc[idx].buf1); u32 len = FIELD_GET(MT_DMA_CTL_SD_LEN1, ctrl); + dma_unmap_single(dev->dev, le32_to_cpu(addr), len, DMA_TO_DEVICE); } if (e->txwi == DMA_DUMMY_TXWI) - e->txwi = NULL; + e->txwi = NULL; *prev_e = *e; memset(e, 0, sizeof(*e)); @@ -128,7 +130,8 @@ mt76_dma_tx_cleanup_idx(struct mt76_dev *dev, struct mt76_queue *q, int idx, static void mt76_dma_sync_idx(struct mt76_dev *dev, struct mt76_queue *q) { - q->tail = q->head = ioread32(&q->regs->dma_idx); + q->head = ioread32(&q->regs->dma_idx); + q->tail = q->head; iowrite32(q->head, &q->regs->cpu_idx); } @@ -166,7 +169,7 @@ mt76_dma_tx_cleanup(struct mt76_dev *dev, enum mt76_txq_id qid, bool flush) q->queued--; if (!flush && q->tail == last) - last = ioread32(&q->regs->dma_idx); + last = ioread32(&q->regs->dma_idx); } if (!flush) @@ -191,9 +194,9 @@ mt76_dma_get_buf(struct mt76_dev *dev, struct mt76_queue *q, int idx, void *buf = e->buf; int buf_len = SKB_WITH_OVERHEAD(q->buf_size); - buf_addr = ACCESS_ONCE(desc->buf0); + buf_addr = READ_ONCE(desc->buf0); if (len) { - u32 ctl = ACCESS_ONCE(desc->ctrl); + u32 ctl = READ_ONCE(desc->ctrl); *len = FIELD_GET(MT_DMA_CTL_SD_LEN0, ctl); *more = !(ctl & MT_DMA_CTL_LAST_SEC0); } @@ -310,7 +313,7 @@ mt76_dma_rx_reset(struct mt76_dev *dev, enum mt76_rxq_id qid) static void mt76_add_fragment(struct mt76_dev *dev, struct mt76_queue *q, void *data, - int len, bool more) + int len, bool more) { struct page *page = virt_to_head_page(data); int offset = data - page_address(page); @@ -361,7 +364,7 @@ mt76_dma_rx_process(struct mt76_dev *dev, struct mt76_queue *q, int budget) } if (q == &dev->q_rx[MT_RXQ_MCU]) { - u32 * rxfce = (u32 *) skb->cb; + u32 *rxfce = (u32 *) skb->cb; *rxfce = info; } @@ -407,7 +410,8 @@ mt76_dma_init(struct mt76_dev *dev) init_dummy_netdev(&dev->napi_dev); for (i = 0; i < ARRAY_SIZE(dev->q_rx); i++) { - netif_napi_add(&dev->napi_dev, &dev->napi[i], mt76_dma_rx_poll, 64); + netif_napi_add(&dev->napi_dev, &dev->napi[i], mt76_dma_rx_poll, + 64); mt76_dma_rx_fill(dev, &dev->q_rx[i], false); skb_queue_head_init(&dev->rx_skb[i]); napi_enable(&dev->napi[i]); diff --git a/eeprom.c b/eeprom.c index 0b121a1e..444865cb 100644 --- a/eeprom.c +++ b/eeprom.c @@ -102,11 +102,10 @@ mt76_eeprom_override(struct mt76_dev *dev) if (!is_valid_ether_addr(dev->macaddr)) { eth_random_addr(dev->macaddr); - dev_printk(KERN_INFO, dev->dev, - "Invalid MAC address, using random address %pM\n", - dev->macaddr); + dev_info(dev->dev, + "Invalid MAC address, using random address %pM\n", + dev->macaddr); } - } EXPORT_SYMBOL_GPL(mt76_eeprom_override); diff --git a/mac80211.c b/mac80211.c index 32ae365e..f6900f1e 100644 --- a/mac80211.c +++ b/mac80211.c @@ -120,7 +120,7 @@ mt76_init_sband(struct mt76_dev *dev, struct mt76_sband *msband, ht_cap->ampdu_density = IEEE80211_HT_MPDU_DENSITY_4; if (!vht) - return 0; + return 0; vht_cap = &sband->vht_cap; vht_cap->vht_supported = true; @@ -137,9 +137,9 @@ mt76_init_sband(struct mt76_dev *dev, struct mt76_sband *msband, vht_cap->vht_mcs.rx_mcs_map = cpu_to_le16(mcs_map); vht_cap->vht_mcs.tx_mcs_map = cpu_to_le16(mcs_map); vht_cap->cap |= IEEE80211_VHT_CAP_RXLDPC | - IEEE80211_VHT_CAP_TXSTBC | - IEEE80211_VHT_CAP_RXSTBC_1 | - IEEE80211_VHT_CAP_SHORT_GI_80; + IEEE80211_VHT_CAP_TXSTBC | + IEEE80211_VHT_CAP_RXSTBC_1 | + IEEE80211_VHT_CAP_SHORT_GI_80; return 0; } @@ -267,7 +267,7 @@ void mt76_set_channel(struct mt76_dev *dev) EXPORT_SYMBOL_GPL(mt76_set_channel); int mt76_get_survey(struct ieee80211_hw *hw, int idx, - struct survey_info *survey) + struct survey_info *survey) { struct mt76_dev *dev = hw->priv; struct mt76_sband *sband; diff --git a/mmio.c b/mmio.c index 79b17c9c..c3731e21 100644 --- a/mmio.c +++ b/mmio.c @@ -40,7 +40,8 @@ static u32 mt76_mmio_rmw(struct mt76_dev *dev, u32 offset, u32 mask, u32 val) return val; } -static void mt76_mmio_copy(struct mt76_dev *dev, u32 offset, const void *data, int len) +static void mt76_mmio_copy(struct mt76_dev *dev, u32 offset, const void *data, + int len) { __iowrite32_copy(dev->regs + offset, data, len >> 2); } diff --git a/mt76.h b/mt76.h index 65424456..f94f78a8 100644 --- a/mt76.h +++ b/mt76.h @@ -35,7 +35,8 @@ struct mt76_bus_ops { u32 (*rr)(struct mt76_dev *dev, u32 offset); void (*wr)(struct mt76_dev *dev, u32 offset, u32 val); u32 (*rmw)(struct mt76_dev *dev, u32 offset, u32 mask, u32 val); - void (*copy)(struct mt76_dev *dev, u32 offset, const void *data, int len); + void (*copy)(struct mt76_dev *dev, u32 offset, const void *data, + int len); }; enum mt76_txq_id { @@ -114,7 +115,8 @@ struct mt76_queue_ops { void (*rx_reset)(struct mt76_dev *dev, enum mt76_rxq_id qid); - void (*tx_cleanup)(struct mt76_dev *dev, enum mt76_txq_id qid, bool flush); + void (*tx_cleanup)(struct mt76_dev *dev, enum mt76_txq_id qid, + bool flush); void (*kick)(struct mt76_dev *dev, struct mt76_queue *q); }; @@ -170,7 +172,7 @@ struct mt76_driver_ops { struct ieee80211_sta *sta, u32 *tx_info); void (*tx_complete_skb)(struct mt76_dev *dev, struct mt76_queue *q, - struct mt76_queue_entry *e, bool flush); + struct mt76_queue_entry *e, bool flush); void (*rx_skb)(struct mt76_dev *dev, enum mt76_rxq_id q, struct sk_buff *skb); @@ -259,7 +261,7 @@ struct mt76_rate_power { #define mt76_hw(dev) (dev)->mt76.hw bool __mt76_poll(struct mt76_dev *dev, u32 offset, u32 mask, u32 val, - int timeout); + int timeout); #define mt76_poll(dev, ...) __mt76_poll(&((dev)->mt76), __VA_ARGS__) @@ -318,6 +320,7 @@ static inline struct ieee80211_txq * mtxq_to_txq(struct mt76_txq *mtxq) { void *ptr = mtxq; + return container_of(ptr, struct ieee80211_txq, drv_priv); } @@ -342,7 +345,7 @@ void mt76_release_buffered_frames(struct ieee80211_hw *hw, bool more_data); void mt76_set_channel(struct mt76_dev *dev); int mt76_get_survey(struct ieee80211_hw *hw, int idx, - struct survey_info *survey); + struct survey_info *survey); /* internal */ void mt76_tx_free(struct mt76_dev *dev); diff --git a/tx.c b/tx.c index bf90de69..45bf0b17 100644 --- a/tx.c +++ b/tx.c @@ -28,7 +28,8 @@ mt76_alloc_txwi(struct mt76_dev *dev) if (!t) return NULL; - addr = dma_map_single(dev->dev, &t->txwi, sizeof(t->txwi), DMA_TO_DEVICE); + addr = dma_map_single(dev->dev, &t->txwi, sizeof(t->txwi), + DMA_TO_DEVICE); t->dma_addr = addr; return t; @@ -135,7 +136,8 @@ int mt76_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q, if (n == ARRAY_SIZE(buf)) goto unmap; - addr = dma_map_single(dev->dev, iter->data, iter->len, DMA_TO_DEVICE); + addr = dma_map_single(dev->dev, iter->data, iter->len, + DMA_TO_DEVICE); if (dma_mapping_error(dev->dev, addr)) goto unmap; @@ -151,7 +153,8 @@ int mt76_tx_queue_skb(struct mt76_dev *dev, struct mt76_queue *q, unmap: ret = -ENOMEM; for (n--; n > 0; n--) - dma_unmap_single(dev->dev, buf[n].addr, buf[n].len, DMA_TO_DEVICE); + dma_unmap_single(dev->dev, buf[n].addr, buf[n].len, + DMA_TO_DEVICE); free: e.skb = skb; @@ -454,7 +457,7 @@ void mt76_stop_tx_queues(struct mt76_dev *dev, struct ieee80211_sta *sta, spin_lock_bh(&mtxq->hwq->lock); mtxq->send_bar = mtxq->aggr && send_bar; if (!list_empty(&mtxq->list)) - list_del_init(&mtxq->list); + list_del_init(&mtxq->list); spin_unlock_bh(&mtxq->hwq->lock); } } diff --git a/util.c b/util.c index 2d52f259..48c62687 100644 --- a/util.c +++ b/util.c @@ -46,7 +46,7 @@ bool __mt76_poll_msec(struct mt76_dev *dev, u32 offset, u32 mask, u32 val, if (cur == val) return true; - msleep(10); + usleep_range(10000, 20000); } while (timeout-- > 0); return false;