diff options
author | Jules Irenge <jbi.octave@gmail.com> | 2019-11-13 11:00:52 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-11-14 11:10:48 +0800 |
commit | 8c7128c4cf4e0e6eb67bd65b4dbe619c3d297bb6 (patch) | |
tree | 13aa03e37fb2cb7898ba982983ceb09d2b42cee5 /drivers | |
parent | 7a3674898de30ede4a1fa1724016b5bc4f14604c (diff) |
staging: align to fix warnings of line over 80 characters
Align to fix multiple warnings of line over 80 characters.
Issue detected by checkpatch tool.
Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
Link: https://lore.kernel.org/r/20191113110052.14855-1-jbi.octave@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/wfx/bus_sdio.c | 4 | ||||
-rw-r--r-- | drivers/staging/wfx/data_rx.h | 3 | ||||
-rw-r--r-- | drivers/staging/wfx/debug.c | 15 | ||||
-rw-r--r-- | drivers/staging/wfx/fwio.c | 65 | ||||
-rw-r--r-- | drivers/staging/wfx/hif_rx.c | 78 | ||||
-rw-r--r-- | drivers/staging/wfx/hif_tx.c | 66 | ||||
-rw-r--r-- | drivers/staging/wfx/hif_tx_mib.h | 11 | ||||
-rw-r--r-- | drivers/staging/wfx/hwio.c | 42 | ||||
-rw-r--r-- | drivers/staging/wfx/hwio.h | 9 | ||||
-rw-r--r-- | drivers/staging/wfx/key.c | 24 | ||||
-rw-r--r-- | drivers/staging/wfx/main.c | 61 | ||||
-rw-r--r-- | drivers/staging/wfx/queue.c | 31 | ||||
-rw-r--r-- | drivers/staging/wfx/queue.h | 6 | ||||
-rw-r--r-- | drivers/staging/wfx/scan.c | 15 | ||||
-rw-r--r-- | drivers/staging/wfx/sta.c | 133 | ||||
-rw-r--r-- | drivers/staging/wfx/sta.h | 6 | ||||
-rw-r--r-- | drivers/staging/wfx/traces.h | 27 | ||||
-rw-r--r-- | drivers/staging/wfx/wfx.h | 6 |
18 files changed, 407 insertions, 195 deletions
diff --git a/drivers/staging/wfx/bus_sdio.c b/drivers/staging/wfx/bus_sdio.c index 375e07d6d9ae..f8901164c206 100644 --- a/drivers/staging/wfx/bus_sdio.c +++ b/drivers/staging/wfx/bus_sdio.c @@ -188,7 +188,9 @@ static int wfx_sdio_probe(struct sdio_func *func, bus->func = func; sdio_set_drvdata(func, bus); - func->card->quirks |= MMC_QUIRK_LENIENT_FN0 | MMC_QUIRK_BLKSZ_FOR_BYTE_MODE | MMC_QUIRK_BROKEN_BYTE_MODE_512; + func->card->quirks |= MMC_QUIRK_LENIENT_FN0 | + MMC_QUIRK_BLKSZ_FOR_BYTE_MODE | + MMC_QUIRK_BROKEN_BYTE_MODE_512; sdio_claim_host(func); ret = sdio_enable_func(func); diff --git a/drivers/staging/wfx/data_rx.h b/drivers/staging/wfx/data_rx.h index b44d15268f83..a50ce352bc5e 100644 --- a/drivers/staging/wfx/data_rx.h +++ b/drivers/staging/wfx/data_rx.h @@ -13,6 +13,7 @@ struct wfx_vif; struct sk_buff; -void wfx_rx_cb(struct wfx_vif *wvif, struct hif_ind_rx *arg, struct sk_buff *skb); +void wfx_rx_cb(struct wfx_vif *wvif, struct hif_ind_rx *arg, + struct sk_buff *skb); #endif /* WFX_DATA_RX_H */ diff --git a/drivers/staging/wfx/debug.c b/drivers/staging/wfx/debug.c index 0a9ca109039c..d17a75242365 100644 --- a/drivers/staging/wfx/debug.c +++ b/drivers/staging/wfx/debug.c @@ -72,7 +72,8 @@ static int wfx_counters_show(struct seq_file *seq, void *v) return -EIO; #define PUT_COUNTER(name) \ - seq_printf(seq, "%24s %d\n", #name ":", le32_to_cpu(counters.count_##name)) + seq_printf(seq, "%24s %d\n", #name ":",\ + le32_to_cpu(counters.count_##name)) PUT_COUNTER(tx_packets); PUT_COUNTER(tx_multicast_frames); @@ -211,7 +212,8 @@ struct dbgfs_hif_msg { int ret; }; -static ssize_t wfx_send_hif_msg_write(struct file *file, const char __user *user_buf, +static ssize_t wfx_send_hif_msg_write(struct file *file, + const char __user *user_buf, size_t count, loff_t *ppos) { struct dbgfs_hif_msg *context = file->private_data; @@ -236,7 +238,8 @@ static ssize_t wfx_send_hif_msg_write(struct file *file, const char __user *user kfree(request); return -EINVAL; } - context->ret = wfx_cmd_send(wdev, request, context->reply, sizeof(context->reply), false); + context->ret = wfx_cmd_send(wdev, request, context->reply, + sizeof(context->reply), false); kfree(request); complete(&context->complete); @@ -299,8 +302,10 @@ int wfx_debug_init(struct wfx_dev *wdev) debugfs_create_file("counters", 0444, d, wdev, &wfx_counters_fops); debugfs_create_file("rx_stats", 0444, d, wdev, &wfx_rx_stats_fops); debugfs_create_file("send_pds", 0200, d, wdev, &wfx_send_pds_fops); - debugfs_create_file("burn_slk_key", 0200, d, wdev, &wfx_burn_slk_key_fops); - debugfs_create_file("send_hif_msg", 0600, d, wdev, &wfx_send_hif_msg_fops); + debugfs_create_file("burn_slk_key", 0200, d, wdev, + &wfx_burn_slk_key_fops); + debugfs_create_file("send_hif_msg", 0600, d, wdev, + &wfx_send_hif_msg_fops); return 0; } diff --git a/drivers/staging/wfx/fwio.c b/drivers/staging/wfx/fwio.c index 6d82c6244c7f..dbf8bda71ff7 100644 --- a/drivers/staging/wfx/fwio.c +++ b/drivers/staging/wfx/fwio.c @@ -107,11 +107,14 @@ int get_firmware(struct wfx_dev *wdev, u32 keyset_chip, const char *data; int ret; - snprintf(filename, sizeof(filename), "%s_%02X.sec", wdev->pdata.file_fw, keyset_chip); + snprintf(filename, sizeof(filename), "%s_%02X.sec", wdev->pdata.file_fw, + keyset_chip); ret = firmware_request_nowarn(fw, filename, wdev->dev); if (ret) { - dev_info(wdev->dev, "can't load %s, falling back to %s.sec\n", filename, wdev->pdata.file_fw); - snprintf(filename, sizeof(filename), "%s.sec", wdev->pdata.file_fw); + dev_info(wdev->dev, "can't load %s, falling back to %s.sec\n", + filename, wdev->pdata.file_fw); + snprintf(filename, sizeof(filename), "%s.sec", + wdev->pdata.file_fw); ret = request_firmware(fw, filename, wdev->dev); if (ret) { dev_err(wdev->dev, "can't load %s\n", filename); @@ -164,7 +167,8 @@ static int wait_ncp_status(struct wfx_dev *wdev, u32 status) return -ETIMEDOUT; } if (ktime_compare(now, start)) - dev_dbg(wdev->dev, "chip answer after %lldus\n", ktime_us_delta(now, start)); + dev_dbg(wdev->dev, "chip answer after %lldus\n", + ktime_us_delta(now, start)); else dev_dbg(wdev->dev, "chip answer immediately\n"); return 0; @@ -188,15 +192,18 @@ static int upload_firmware(struct wfx_dev *wdev, const u8 *data, size_t len) if (ret < 0) return ret; now = ktime_get(); - if (offs + DNLD_BLOCK_SIZE - bytes_done < DNLD_FIFO_SIZE) + if (offs + + DNLD_BLOCK_SIZE - bytes_done < DNLD_FIFO_SIZE) break; if (ktime_after(now, ktime_add_ms(start, DCA_TIMEOUT))) return -ETIMEDOUT; } if (ktime_compare(now, start)) - dev_dbg(wdev->dev, "answer after %lldus\n", ktime_us_delta(now, start)); + dev_dbg(wdev->dev, "answer after %lldus\n", + ktime_us_delta(now, start)); - ret = sram_write_dma_safe(wdev, WFX_DNLD_FIFO + (offs % DNLD_FIFO_SIZE), + ret = sram_write_dma_safe(wdev, WFX_DNLD_FIFO + + (offs % DNLD_FIFO_SIZE), data + offs, DNLD_BLOCK_SIZE); if (ret < 0) return ret; @@ -220,10 +227,14 @@ static void print_boot_status(struct wfx_dev *wdev) dev_info(wdev->dev, "no error reported by secure boot\n"); } else { sram_reg_read(wdev, WFX_ERR_INFO, &val32); - if (val32 < ARRAY_SIZE(fwio_error_strings) && fwio_error_strings[val32]) - dev_info(wdev->dev, "secure boot error: %s\n", fwio_error_strings[val32]); + if (val32 < ARRAY_SIZE(fwio_error_strings) && + fwio_error_strings[val32]) + dev_info(wdev->dev, "secure boot error: %s\n", + fwio_error_strings[val32]); else - dev_info(wdev->dev, "secure boot error: Unknown (0x%02x)\n", val32); + dev_info(wdev->dev, + "secure boot error: Unknown (0x%02x)\n", + val32); } } @@ -262,9 +273,13 @@ static int load_firmware_secure(struct wfx_dev *wdev) goto error; sram_reg_write(wdev, WFX_DNLD_FIFO, 0xFFFFFFFF); // Fifo init - sram_write_dma_safe(wdev, WFX_DCA_FW_VERSION, "\x01\x00\x00\x00", FW_VERSION_SIZE); - sram_write_dma_safe(wdev, WFX_DCA_FW_SIGNATURE, fw->data + fw_offset, FW_SIGNATURE_SIZE); - sram_write_dma_safe(wdev, WFX_DCA_FW_HASH, fw->data + fw_offset + FW_SIGNATURE_SIZE, FW_HASH_SIZE); + sram_write_dma_safe(wdev, WFX_DCA_FW_VERSION, "\x01\x00\x00\x00", + FW_VERSION_SIZE); + sram_write_dma_safe(wdev, WFX_DCA_FW_SIGNATURE, fw->data + fw_offset, + FW_SIGNATURE_SIZE); + sram_write_dma_safe(wdev, WFX_DCA_FW_HASH, + fw->data + fw_offset + FW_SIGNATURE_SIZE, + FW_HASH_SIZE); sram_reg_write(wdev, WFX_DCA_IMAGE_SIZE, fw->size - header_size); sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_UPLOAD_PENDING); ret = wait_ncp_status(wdev, NCP_DOWNLOAD_PENDING); @@ -272,10 +287,12 @@ static int load_firmware_secure(struct wfx_dev *wdev) goto error; start = ktime_get(); - ret = upload_firmware(wdev, fw->data + header_size, fw->size - header_size); + ret = upload_firmware(wdev, fw->data + header_size, + fw->size - header_size); if (ret) goto error; - dev_dbg(wdev->dev, "firmware load after %lldus\n", ktime_us_delta(ktime_get(), start)); + dev_dbg(wdev->dev, "firmware load after %lldus\n", + ktime_us_delta(ktime_get(), start)); sram_reg_write(wdev, WFX_DCA_HOST_STATUS, HOST_UPLOAD_COMPLETE); ret = wait_ncp_status(wdev, NCP_AUTH_OK); @@ -310,10 +327,12 @@ static int init_gpr(struct wfx_dev *wdev) }; for (i = 0; i < ARRAY_SIZE(gpr_init); i++) { - ret = igpr_reg_write(wdev, gpr_init[i].index, gpr_init[i].value); + ret = igpr_reg_write(wdev, gpr_init[i].index, + gpr_init[i].value); if (ret < 0) return ret; - dev_dbg(wdev->dev, " index %02x: %08x\n", gpr_init[i].index, gpr_init[i].value); + dev_dbg(wdev->dev, " index %02x: %08x\n", gpr_init[i].index, + gpr_init[i].value); } return 0; } @@ -348,7 +367,8 @@ int wfx_init_device(struct wfx_dev *wdev) hw_revision = FIELD_GET(CFG_DEVICE_ID_MAJOR, reg); if (hw_revision == 0 || hw_revision > 2) { - dev_err(wdev->dev, "bad hardware revision number: %d\n", hw_revision); + dev_err(wdev->dev, "bad hardware revision number: %d\n", + hw_revision); return -ENODEV; } hw_type = FIELD_GET(CFG_DEVICE_ID_TYPE, reg); @@ -375,7 +395,8 @@ int wfx_init_device(struct wfx_dev *wdev) return -ETIMEDOUT; } } - dev_dbg(wdev->dev, "chip wake up after %lldus\n", ktime_us_delta(now, start)); + dev_dbg(wdev->dev, "chip wake up after %lldus\n", + ktime_us_delta(now, start)); ret = config_reg_write_bits(wdev, CFG_CPU_RESET, 0); if (ret < 0) @@ -383,6 +404,10 @@ int wfx_init_device(struct wfx_dev *wdev) ret = load_firmware_secure(wdev); if (ret < 0) return ret; - ret = config_reg_write_bits(wdev, CFG_DIRECT_ACCESS_MODE | CFG_IRQ_ENABLE_DATA | CFG_IRQ_ENABLE_WRDY, CFG_IRQ_ENABLE_DATA); + ret = config_reg_write_bits(wdev, + CFG_DIRECT_ACCESS_MODE | + CFG_IRQ_ENABLE_DATA | + CFG_IRQ_ENABLE_WRDY, + CFG_IRQ_ENABLE_DATA); return ret; } diff --git a/drivers/staging/wfx/hif_rx.c b/drivers/staging/wfx/hif_rx.c index 36e171b27ae2..820de216be0c 100644 --- a/drivers/staging/wfx/hif_rx.c +++ b/drivers/staging/wfx/hif_rx.c @@ -18,7 +18,8 @@ #include "secure_link.h" #include "hif_api_cmd.h" -static int hif_generic_confirm(struct wfx_dev *wdev, struct hif_msg *hif, void *buf) +static int hif_generic_confirm(struct wfx_dev *wdev, struct hif_msg *hif, + void *buf) { // All confirm messages start with status int status = le32_to_cpu(*((__le32 *) buf)); @@ -33,7 +34,8 @@ static int hif_generic_confirm(struct wfx_dev *wdev, struct hif_msg *hif, void * } if (cmd != wdev->hif_cmd.buf_send->id) { - dev_warn(wdev->dev, "chip response mismatch request: 0x%.2x vs 0x%.2x\n", + dev_warn(wdev->dev, + "chip response mismatch request: 0x%.2x vs 0x%.2x\n", cmd, wdev->hif_cmd.buf_send->id); return -EINVAL; } @@ -70,7 +72,8 @@ static int hif_tx_confirm(struct wfx_dev *wdev, struct hif_msg *hif, void *buf) return 0; } -static int hif_multi_tx_confirm(struct wfx_dev *wdev, struct hif_msg *hif, void *buf) +static int hif_multi_tx_confirm(struct wfx_dev *wdev, struct hif_msg *hif, + void *buf) { struct hif_cnf_multi_transmit *body = buf; struct hif_cnf_tx *buf_loc = (struct hif_cnf_tx *) &body->tx_conf_payload; @@ -90,7 +93,8 @@ static int hif_multi_tx_confirm(struct wfx_dev *wdev, struct hif_msg *hif, void return 0; } -static int hif_startup_indication(struct wfx_dev *wdev, struct hif_msg *hif, void *buf) +static int hif_startup_indication(struct wfx_dev *wdev, struct hif_msg *hif, + void *buf) { struct hif_ind_startup *body = buf; @@ -108,7 +112,8 @@ static int hif_startup_indication(struct wfx_dev *wdev, struct hif_msg *hif, voi return 0; } -static int hif_wakeup_indication(struct wfx_dev *wdev, struct hif_msg *hif, void *buf) +static int hif_wakeup_indication(struct wfx_dev *wdev, struct hif_msg *hif, + void *buf) { if (!wdev->pdata.gpio_wakeup || !gpiod_get_value(wdev->pdata.gpio_wakeup)) { @@ -118,7 +123,8 @@ static int hif_wakeup_indication(struct wfx_dev *wdev, struct hif_msg *hif, void return 0; } -static int hif_keys_indication(struct wfx_dev *wdev, struct hif_msg *hif, void *buf) +static int hif_keys_indication(struct wfx_dev *wdev, struct hif_msg *hif, + void *buf) { struct hif_ind_sl_exchange_pub_keys *body = buf; @@ -131,13 +137,15 @@ static int hif_keys_indication(struct wfx_dev *wdev, struct hif_msg *hif, void * return 0; } -static int hif_receive_indication(struct wfx_dev *wdev, struct hif_msg *hif, void *buf, struct sk_buff *skb) +static int hif_receive_indication(struct wfx_dev *wdev, struct hif_msg *hif, + void *buf, struct sk_buff *skb) { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); struct hif_ind_rx *body = buf; if (!wvif) { - dev_warn(wdev->dev, "ignore rx data for non-existent vif %d\n", hif->interface); + dev_warn(wdev->dev, "ignore rx data for non-existent vif %d\n", + hif->interface); return 0; } skb_pull(skb, sizeof(struct hif_msg) + sizeof(struct hif_ind_rx)); @@ -146,7 +154,8 @@ static int hif_receive_indication(struct wfx_dev *wdev, struct hif_msg *hif, voi return 0; } -static int hif_event_indication(struct wfx_dev *wdev, struct hif_msg *hif, void *buf) +static int hif_event_indication(struct wfx_dev *wdev, struct hif_msg *hif, + void *buf) { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); struct hif_ind_event *body = buf; @@ -173,7 +182,8 @@ static int hif_event_indication(struct wfx_dev *wdev, struct hif_msg *hif, void return 0; } -static int hif_pm_mode_complete_indication(struct wfx_dev *wdev, struct hif_msg *hif, void *buf) +static int hif_pm_mode_complete_indication(struct wfx_dev *wdev, + struct hif_msg *hif, void *buf) { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); @@ -183,7 +193,8 @@ static int hif_pm_mode_complete_indication(struct wfx_dev *wdev, struct hif_msg return 0; } -static int hif_scan_complete_indication(struct wfx_dev *wdev, struct hif_msg *hif, void *buf) +static int hif_scan_complete_indication(struct wfx_dev *wdev, + struct hif_msg *hif, void *buf) { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); struct hif_ind_scan_cmpl *body = buf; @@ -194,7 +205,8 @@ static int hif_scan_complete_indication(struct wfx_dev *wdev, struct hif_msg *hi return 0; } -static int hif_join_complete_indication(struct wfx_dev *wdev, struct hif_msg *hif, void *buf) +static int hif_join_complete_indication(struct wfx_dev *wdev, + struct hif_msg *hif, void *buf) { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); @@ -204,7 +216,8 @@ static int hif_join_complete_indication(struct wfx_dev *wdev, struct hif_msg *hi return 0; } -static int hif_suspend_resume_indication(struct wfx_dev *wdev, struct hif_msg *hif, void *buf) +static int hif_suspend_resume_indication(struct wfx_dev *wdev, + struct hif_msg *hif, void *buf) { struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface); struct hif_ind_suspend_resume_tx *body = buf; @@ -215,7 +228,8 @@ static int hif_suspend_resume_indication(struct wfx_dev *wdev, struct hif_msg *h return 0; } -static int hif_error_indication(struct wfx_dev *wdev, struct hif_msg *hif, void *buf) +static int hif_error_indication(struct wfx_dev *wdev, struct hif_msg *hif, + void *buf) { struct hif_ind_error *body = buf; u8 *pRollback = (u8 *) body->data; @@ -223,31 +237,39 @@ static int hif_error_indication(struct wfx_dev *wdev, struct hif_msg *hif, void switch (body->type) { case HIF_ERROR_FIRMWARE_ROLLBACK: - dev_err(wdev->dev, "asynchronous error: firmware rollback error %d\n", *pRollback); + dev_err(wdev->dev, + "asynchronous error: firmware rollback error %d\n", + *pRollback); break; case HIF_ERROR_FIRMWARE_DEBUG_ENABLED: dev_err(wdev->dev, "asynchronous error: firmware debug feature enabled\n"); break; case HIF_ERROR_OUTDATED_SESSION_KEY: - dev_err(wdev->dev, "asynchronous error: secure link outdated key: %#.8x\n", *pStatus); + dev_err(wdev->dev, "asynchronous error: secure link outdated key: %#.8x\n", + *pStatus); break; case HIF_ERROR_INVALID_SESSION_KEY: dev_err(wdev->dev, "asynchronous error: invalid session key\n"); break; case HIF_ERROR_OOR_VOLTAGE: - dev_err(wdev->dev, "asynchronous error: out-of-range overvoltage: %#.8x\n", *pStatus); + dev_err(wdev->dev, "asynchronous error: out-of-range overvoltage: %#.8x\n", + *pStatus); break; case HIF_ERROR_PDS_VERSION: - dev_err(wdev->dev, "asynchronous error: wrong PDS payload or version: %#.8x\n", *pStatus); + dev_err(wdev->dev, + "asynchronous error: wrong PDS payload or version: %#.8x\n", + *pStatus); break; default: - dev_err(wdev->dev, "asynchronous error: unknown (%d)\n", body->type); + dev_err(wdev->dev, "asynchronous error: unknown (%d)\n", + body->type); break; } return 0; } -static int hif_generic_indication(struct wfx_dev *wdev, struct hif_msg *hif, void *buf) +static int hif_generic_indication(struct wfx_dev *wdev, struct hif_msg *hif, + void *buf) { struct hif_ind_generic *body = buf; @@ -255,23 +277,29 @@ static int hif_generic_indication(struct wfx_dev *wdev, struct hif_msg *hif, voi case HIF_GENERIC_INDICATION_TYPE_RAW: return 0; case HIF_GENERIC_INDICATION_TYPE_STRING: - dev_info(wdev->dev, "firmware says: %s\n", (char *) body->indication_data.raw_data); + dev_info(wdev->dev, "firmware says: %s\n", + (char *) body->indication_data.raw_data); return 0; case HIF_GENERIC_INDICATION_TYPE_RX_STATS: mutex_lock(&wdev->rx_stats_lock); // Older firmware send a generic indication beside RxStats if (!wfx_api_older_than(wdev, 1, 4)) - dev_info(wdev->dev, "Rx test ongoing. Temperature: %d°C\n", body->indication_data.rx_stats.current_temp); - memcpy(&wdev->rx_stats, &body->indication_data.rx_stats, sizeof(wdev->rx_stats)); + dev_info(wdev->dev, "Rx test ongoing. Temperature: %d°C\n", + body->indication_data.rx_stats.current_temp); + memcpy(&wdev->rx_stats, &body->indication_data.rx_stats, + sizeof(wdev->rx_stats)); mutex_unlock(&wdev->rx_stats_lock); return 0; default: - dev_err(wdev->dev, "generic_indication: unknown indication type: %#.8x\n", body->indication_type); + dev_err(wdev->dev, + "generic_indication: unknown indication type: %#.8x\n", + body->indication_type); return -EIO; } } -static int hif_exception_indication(struct wfx_dev *wdev, struct hif_msg *hif, void *buf) +static int hif_exception_indication(struct wfx_dev *wdev, + struct hif_msg *hif, void *buf) { size_t len = hif->len - 4; // drop header dev_err(wdev->dev, "firmware exception\n"); diff --git a/drivers/staging/wfx/hif_tx.c b/drivers/staging/wfx/hif_tx.c index 2f5dadff0660..cb7cddcb9815 100644 --- a/drivers/staging/wfx/hif_tx.c +++ b/drivers/staging/wfx/hif_tx.c @@ -24,7 +24,8 @@ void wfx_init_hif_cmd(struct wfx_hif_cmd *hif_cmd) mutex_init(&hif_cmd->key_renew_lock); } -static void wfx_fill_header(struct hif_msg *hif, int if_id, unsigned int cmd, size_t size) +static void wfx_fill_header(struct hif_msg *hif, int if_id, unsigned int cmd, + size_t size) { if (if_id == -1) if_id = 2; @@ -47,7 +48,8 @@ static void *wfx_alloc_hif(size_t body_len, struct hif_msg **hif) return NULL; } -int wfx_cmd_send(struct wfx_dev *wdev, struct hif_msg *request, void *reply, size_t reply_len, bool async) +int wfx_cmd_send(struct wfx_dev *wdev, struct hif_msg *request, void *reply, + size_t reply_len, bool async) { const char *mib_name = ""; const char *mib_sep = ""; @@ -100,7 +102,8 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct hif_msg *request, void *reply, siz wdev->hif_cmd.buf_send = NULL; mutex_unlock(&wdev->hif_cmd.lock); - if (ret && (cmd == HIF_REQ_ID_READ_MIB || cmd == HIF_REQ_ID_WRITE_MIB)) { + if (ret && + (cmd == HIF_REQ_ID_READ_MIB || cmd == HIF_REQ_ID_WRITE_MIB)) { mib_name = get_mib_name(((u16 *) request)[2]); mib_sep = "/"; } @@ -170,7 +173,8 @@ int hif_reset(struct wfx_vif *wvif, bool reset_stat) return ret; } -int hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *val, size_t val_len) +int hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *val, + size_t val_len) { int ret; struct hif_msg *hif; @@ -183,11 +187,13 @@ int hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *val, size_t ret = wfx_cmd_send(wdev, hif, reply, buf_len, false); if (!ret && mib_id != reply->mib_id) { - dev_warn(wdev->dev, "%s: confirmation mismatch request\n", __func__); + dev_warn(wdev->dev, + "%s: confirmation mismatch request\n", __func__); ret = -EIO; } if (ret == -ENOMEM) - dev_err(wdev->dev, "buffer is too small to receive %s (%zu < %d)\n", + dev_err(wdev->dev, + "buffer is too small to receive %s (%zu < %d)\n", get_mib_name(mib_id), val_len, reply->length); if (!ret) memcpy(val, &reply->mib_data, reply->length); @@ -198,7 +204,8 @@ int hif_read_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *val, size_t return ret; } -int hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *val, size_t val_len) +int hif_write_mib(struct wfx_dev *wdev, int vif_id, u16 mib_id, void *val, + size_t val_len) { int ret; struct hif_msg *hif; @@ -236,7 +243,8 @@ int hif_scan(struct wfx_vif *wvif, const struct wfx_scan_params *arg) cpu_to_le32s(&body->min_channel_time); cpu_to_le32s(&body->max_channel_time); cpu_to_le32s(&body->tx_power_level); - memcpy(ptr, arg->ssids, arg->scan_req.num_of_ssi_ds * sizeof(struct hif_ssid_def)); + memcpy(ptr, arg->ssids, + arg->scan_req.num_of_ssi_ds * sizeof(struct hif_ssid_def)); ssids = (struct hif_ssid_def *) ptr; for (i = 0; i < body->num_of_ssi_ds; ++i) cpu_to_le32s(&ssids[i].ssid_length); @@ -281,16 +289,19 @@ int hif_join(struct wfx_vif *wvif, const struct hif_req_join *arg) return ret; } -int hif_set_bss_params(struct wfx_vif *wvif, const struct hif_req_set_bss_params *arg) +int hif_set_bss_params(struct wfx_vif *wvif, + const struct hif_req_set_bss_params *arg) { int ret; struct hif_msg *hif; - struct hif_req_set_bss_params *body = wfx_alloc_hif(sizeof(*body), &hif); + struct hif_req_set_bss_params *body = wfx_alloc_hif(sizeof(*body), + &hif); memcpy(body, arg, sizeof(*body)); cpu_to_le16s(&body->aid); cpu_to_le32s(&body->operational_rate_set); - wfx_fill_header(hif, wvif->id, HIF_REQ_ID_SET_BSS_PARAMS, sizeof(*body)); + wfx_fill_header(hif, wvif->id, HIF_REQ_ID_SET_BSS_PARAMS, + sizeof(*body)); ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); kfree(hif); return ret; @@ -308,7 +319,8 @@ int hif_add_key(struct wfx_dev *wdev, const struct hif_req_add_key *arg) if (wfx_api_older_than(wdev, 1, 5)) // Legacy firmwares expect that add_key to be sent on right // interface. - wfx_fill_header(hif, arg->int_id, HIF_REQ_ID_ADD_KEY, sizeof(*body)); + wfx_fill_header(hif, arg->int_id, HIF_REQ_ID_ADD_KEY, + sizeof(*body)); else wfx_fill_header(hif, -1, HIF_REQ_ID_ADD_KEY, sizeof(*body)); ret = wfx_cmd_send(wdev, hif, NULL, 0, false); @@ -329,18 +341,21 @@ int hif_remove_key(struct wfx_dev *wdev, int idx) return ret; } -int hif_set_edca_queue_params(struct wfx_vif *wvif, const struct hif_req_edca_queue_params *arg) +int hif_set_edca_queue_params(struct wfx_vif *wvif, + const struct hif_req_edca_queue_params *arg) { int ret; struct hif_msg *hif; - struct hif_req_edca_queue_params *body = wfx_alloc_hif(sizeof(*body), &hif); + struct hif_req_edca_queue_params *body = wfx_alloc_hif(sizeof(*body), + &hif); // NOTE: queues numerotation are not the same between WFx and Linux memcpy(body, arg, sizeof(*body)); cpu_to_le16s(&body->cw_min); cpu_to_le16s(&body->cw_max); cpu_to_le16s(&body->tx_op_limit); - wfx_fill_header(hif, wvif->id, HIF_REQ_ID_EDCA_QUEUE_PARAMS, sizeof(*body)); + wfx_fill_header(hif, wvif->id, HIF_REQ_ID_EDCA_QUEUE_PARAMS, + sizeof(*body)); ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); kfree(hif); return ret; @@ -379,10 +394,12 @@ int hif_beacon_transmit(struct wfx_vif *wvif, bool enable_beaconing) { int ret; struct hif_msg *hif; - struct hif_req_beacon_transmit *body = wfx_alloc_hif(sizeof(*body), &hif); + struct hif_req_beacon_transmit *body = wfx_alloc_hif(sizeof(*body), + &hif); body->enable_beaconing = enable_beaconing ? 1 : 0; - wfx_fill_header(hif, wvif->id, HIF_REQ_ID_BEACON_TRANSMIT, sizeof(*body)); + wfx_fill_header(hif, wvif->id, HIF_REQ_ID_BEACON_TRANSMIT, + sizeof(*body)); ret = wfx_cmd_send(wvif->wdev, hif, NULL, 0, false); kfree(hif); return ret; @@ -421,16 +438,20 @@ int hif_update_ie(struct wfx_vif *wvif, const struct hif_ie_flags *target_frame, return ret; } -int hif_sl_send_pub_keys(struct wfx_dev *wdev, const uint8_t *pubkey, const uint8_t *pubkey_hmac) +int hif_sl_send_pub_keys(struct wfx_dev *wdev, const uint8_t *pubkey, + const uint8_t *pubkey_hmac) { int ret; struct hif_msg *hif; - struct hif_req_sl_exchange_pub_keys *body = wfx_alloc_hif(sizeof(*body), &hif); + struct hif_req_sl_exchange_pub_keys *body = wfx_alloc_hif(sizeof(*body), + &hif); body->algorithm = HIF_SL_CURVE25519; memcpy(body->host_pub_key, pubkey, sizeof(body->host_pub_key)); - memcpy(body->host_pub_key_mac, pubkey_hmac, sizeof(body->host_pub_key_mac)); - wfx_fill_header(hif, -1, HIF_REQ_ID_SL_EXCHANGE_PUB_KEYS, sizeof(*body)); + memcpy(body->host_pub_key_mac, pubkey_hmac, + sizeof(body->host_pub_key_mac)); + wfx_fill_header(hif, -1, HIF_REQ_ID_SL_EXCHANGE_PUB_KEYS, + sizeof(*body)); ret = wfx_cmd_send(wdev, hif, NULL, 0, false); kfree(hif); // Compatibility with legacy secure link @@ -457,7 +478,8 @@ int hif_sl_set_mac_key(struct wfx_dev *wdev, const u8 *slk_key, { int ret; struct hif_msg *hif; - struct hif_req_set_sl_mac_key *body = wfx_alloc_hif(sizeof(*body), &hif); + struct hif_req_set_sl_mac_key *body = wfx_alloc_hif(sizeof(*body), + &hif); memcpy(body->key_value, slk_key, sizeof(body->key_value)); body->otp_or_ram = destination; diff --git a/drivers/staging/wfx/hif_tx_mib.h b/drivers/staging/wfx/hif_tx_mib.h index d1cabd697205..bb091e395ff5 100644 --- a/drivers/staging/wfx/hif_tx_mib.h +++ b/drivers/staging/wfx/hif_tx_mib.h @@ -57,8 +57,9 @@ static inline int hif_get_counters_table(struct wfx_dev *wdev, return hif_read_mib(wdev, 0, HIF_MIB_ID_COUNTERS_TABLE, arg, sizeof(struct hif_mib_count_table)); } else { - return hif_read_mib(wdev, 0, HIF_MIB_ID_EXTENDED_COUNTERS_TABLE, - arg, sizeof(struct hif_mib_extended_count_table)); + return hif_read_mib(wdev, 0, + HIF_MIB_ID_EXTENDED_COUNTERS_TABLE, arg, + sizeof(struct hif_mib_extended_count_table)); } } @@ -112,7 +113,8 @@ static inline int hif_beacon_filter_control(struct wfx_vif *wvif, .bcn_count = cpu_to_le32(beacon_count), }; return hif_write_mib(wvif->wdev, wvif->id, - HIF_MIB_ID_BEACON_FILTER_ENABLE, &arg, sizeof(arg)); + HIF_MIB_ID_BEACON_FILTER_ENABLE, + &arg, sizeof(arg)); } static inline int hif_set_operational_mode(struct wfx_dev *wdev, @@ -173,7 +175,8 @@ static inline int hif_set_association_mode(struct wfx_vif *wvif, static inline int hif_set_tx_rate_retry_policy(struct wfx_vif *wvif, struct hif_mib_set_tx_rate_retry_policy *arg) { - size_t size = struct_size(arg, tx_rate_retry_policy, arg->num_tx_rate_policies); + size_t size = struct_size(arg, tx_rate_retry_policy, + arg->num_tx_rate_policies); return hif_write_mib(wvif->wdev, wvif->id, HIF_MIB_ID_SET_TX_RATE_RETRY_POLICY, arg, size); diff --git a/drivers/staging/wfx/hwio.c b/drivers/staging/wfx/hwio.c index 0cf52aee10e7..47e04c59ed93 100644 --- a/drivers/staging/wfx/hwio.c +++ b/drivers/staging/wfx/hwio.c @@ -34,12 +34,14 @@ static int read32(struct wfx_dev *wdev, int reg, u32 *val) *val = ~0; // Never return undefined value if (!tmp) return -ENOMEM; - ret = wdev->hwbus_ops->copy_from_io(wdev->hwbus_priv, reg, tmp, sizeof(u32)); + ret = wdev->hwbus_ops->copy_from_io(wdev->hwbus_priv, reg, tmp, + sizeof(u32)); if (ret >= 0) *val = le32_to_cpu(*tmp); kfree(tmp); if (ret) - dev_err(wdev->dev, "%s: bus communication error: %d\n", __func__, ret); + dev_err(wdev->dev, "%s: bus communication error: %d\n", + __func__, ret); return ret; } @@ -51,10 +53,12 @@ static int write32(struct wfx_dev *wdev, int reg, u32 val) if (!tmp) return -ENOMEM; *tmp = cpu_to_le32(val); - ret = wdev->hwbus_ops->copy_to_io(wdev->hwbus_priv, reg, tmp, sizeof(u32)); + ret = wdev->hwbus_ops->copy_to_io(wdev->hwbus_priv, reg, tmp, + sizeof(u32)); kfree(tmp); if (ret) - dev_err(wdev->dev, "%s: bus communication error: %d\n", __func__, ret); + dev_err(wdev->dev, "%s: bus communication error: %d\n", + __func__, ret); return ret; } @@ -102,7 +106,8 @@ err: return ret; } -static int indirect_read(struct wfx_dev *wdev, int reg, u32 addr, void *buf, size_t len) +static int indirect_read(struct wfx_dev *wdev, int reg, u32 addr, void *buf, + size_t len) { int ret; int i; @@ -152,7 +157,8 @@ err: return ret; } -static int indirect_write(struct wfx_dev *wdev, int reg, u32 addr, const void *buf, size_t len) +static int indirect_write(struct wfx_dev *wdev, int reg, u32 addr, + const void *buf, size_t len) { int ret; @@ -165,7 +171,8 @@ static int indirect_write(struct wfx_dev *wdev, int reg, u32 addr, const void *b return wdev->hwbus_ops->copy_to_io(wdev->hwbus_priv, reg, buf, len); } -static int indirect_read_locked(struct wfx_dev *wdev, int reg, u32 addr, void *buf, size_t len) +static int indirect_read_locked(struct wfx_dev *wdev, int reg, u32 addr, + void *buf, size_t len) { int ret; @@ -176,7 +183,8 @@ static int indirect_read_locked(struct wfx_dev *wdev, int reg, u32 addr, void *b return ret; } -static int indirect_write_locked(struct wfx_dev *wdev, int reg, u32 addr, const void *buf, size_t len) +static int indirect_write_locked(struct wfx_dev *wdev, int reg, u32 addr, + const void *buf, size_t len) { int ret; @@ -187,7 +195,8 @@ static int indirect_write_locked(struct wfx_dev *wdev, int reg, u32 addr, const return ret; } -static int indirect_read32_locked(struct wfx_dev *wdev, int reg, u32 addr, u32 *val) +static int indirect_read32_locked(struct wfx_dev *wdev, int reg, u32 addr, + u32 *val) { int ret; __le32 *tmp = kmalloc(sizeof(u32), GFP_KERNEL); @@ -203,7 +212,8 @@ static int indirect_read32_locked(struct wfx_dev *wdev, int reg, u32 addr, u32 * return ret; } -static int indirect_write32_locked(struct wfx_dev *wdev, int reg, u32 addr, u32 val) +static int indirect_write32_locked(struct wfx_dev *wdev, int reg, u32 addr, + u32 val) { int ret; __le32 *tmp = kmalloc(sizeof(u32), GFP_KERNEL); @@ -225,11 +235,13 @@ int wfx_data_read(struct wfx_dev *wdev, void *buf, size_t len) WARN((long) buf & 3, "%s: unaligned buffer", __func__); wdev->hwbus_ops->lock(wdev->hwbus_priv); - ret = wdev->hwbus_ops->copy_from_io(wdev->hwbus_priv, WFX_REG_IN_OUT_QUEUE, buf, len); + ret = wdev->hwbus_ops->copy_from_io(wdev->hwbus_priv, + WFX_REG_IN_OUT_QUEUE, buf, len); _trace_io_read(WFX_REG_IN_OUT_QUEUE, buf, len); wdev->hwbus_ops->unlock(wdev->hwbus_priv); if (ret) - dev_err(wdev->dev, "%s: bus communication error: %d\n", __func__, ret); + dev_err(wdev->dev, "%s: bus communication error: %d\n", + __func__, ret); return ret; } @@ -239,11 +251,13 @@ int wfx_data_write(struct wfx_dev *wdev, const void *buf, size_t len) WARN((long) buf & 3, "%s: unaligned buffer", __func__); wdev->hwbus_ops->lock(wdev->hwbus_priv); - ret = wdev->hwbus_ops->copy_to_io(wdev->hwbus_priv, WFX_REG_IN_OUT_QUEUE, buf, len); + ret = wdev->hwbus_ops->copy_to_io(wdev->hwbus_priv, + WFX_REG_IN_OUT_QUEUE, buf, len); _trace_io_write(WFX_REG_IN_OUT_QUEUE, buf, len); wdev->hwbus_ops->unlock(wdev->hwbus_priv); if (ret) - dev_err(wdev->dev, "%s: bus communication error: %d\n", __func__, ret); + dev_err(wdev->dev, "%s: bus communication error: %d\n", + __func__, ret); return ret; } diff --git a/drivers/staging/wfx/hwio.h b/drivers/staging/wfx/hwio.h index 906524f71fd1..b2c1a66de963 100644 --- a/drivers/staging/wfx/hwio.h +++ b/drivers/staging/wfx/hwio.h @@ -37,8 +37,13 @@ int ahb_reg_write(struct wfx_dev *wdev, u32 addr, u32 val); #define CFG_ERR_HOST_NO_IN_QUEUE 0x00000040 #define CFG_ERR_HOST_CRC_MISS 0x00000080 // only with SDIO #define CFG_SPI_IGNORE_CS 0x00000080 // only with SPI -#define CFG_WORD_MODE_MASK 0x00000300 // Bytes ordering (only writable in SPI): -#define CFG_WORD_MODE0 0x00000000 // |