Commit 8c7128c4 authored by Jules Irenge's avatar Jules Irenge Committed by Greg Kroah-Hartman

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: default avatarJules Irenge <jbi.octave@gmail.com>
Link: https://lore.kernel.org/r/20191113110052.14855-1-jbi.octave@gmail.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7a367489
......@@ -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);
......
......@@ -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 */
......@@ -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;
}
......@@ -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;
}
......@@ -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");
......
......@@ -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;
......
......@@ -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);
......
......@@ -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 @@ static int write32_bits_locked(struct wfx_dev *wdev, int reg, u32 mask, u32 val)
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 @@ static int indirect_read(struct wfx_dev *wdev, int reg, u32 addr, void *buf, siz
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;
}
......
......@@ -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 // B1,B0,B3,B2 (In SPI, register address and CONFIG data always use this mode)
/* Bytes ordering (only writable in SPI): */
#define CFG_WORD_MODE_MASK 0x00000300
/*
* B1,B0,B3,B2 (In SPI, register address and
* CONFIG data always use this mode)
*/
#define CFG_WORD_MODE0 0x00000000
#define CFG_WORD_MODE1 0x00000100 // B3,B2,B1,B0
#define CFG_WORD_MODE2 0x00000200 // B0,B1,B2,B3 (SDIO)
#define CFG_DIRECT_ACCESS_MODE 0x00000400 // Direct or queue access mode
......
......@@ -171,28 +171,36 @@ static int wfx_add_key(struct wfx_vif *wvif, struct ieee80211_sta *sta,
return -EINVAL;
k = &wdev->keys[idx];
k->int_id = wvif->id;
if (key->cipher == WLAN_CIPHER_SUITE_WEP40 || key->cipher == WLAN_CIPHER_SUITE_WEP104) {
if (key->cipher == WLAN_CIPHER_SUITE_WEP40 ||
key->cipher == WLAN_CIPHER_SUITE_WEP104) {
if (pairwise)
k->type = fill_wep_pair(&k->key.wep_pairwise_key, key, sta->addr);
k->type = fill_wep_pair(&k->key.wep_pairwise_key, key,
sta->addr);
else
k->type = fill_wep_group(&k->key.wep_group_key, key);
} else if (key->cipher == WLAN_CIPHER_SUITE_TKIP) {
if (pairwise)
k->type = fill_tkip_pair(&k->key.tkip_pairwise_key, key, sta->addr);
k->type = fill_tkip_pair(&k->key.tkip_pairwise_key, key,
sta->addr);
else
k->type = fill_tkip_group(&k->key.tkip_group_key, key, &seq, wvif->vif->type);
k->type = fill_tkip_group(&k->key.tkip_group_key, key,
&seq, wvif->vif->type);
} else if (key->cipher == WLAN_CIPHER_SUITE_CCMP) {
if (pairwise)
k->type = fill_ccmp_pair(&k->key.aes_pairwise_key, key, sta->addr);
k->type = fill_ccmp_pair(&k->key.aes_pairwise_key, key,
sta->addr);
else
k->type = fill_ccmp_group(&k->key.aes_group_key, key, &seq);
k->type = fill_ccmp_group(&k->key.aes_group_key, key,
&seq);
} else if (key->cipher == WLAN_CIPHER_SUITE_SMS4) {
if (pairwise)
k->type = fill_sms4_pair(&k->key.wapi_pairwise_key, key, sta->addr);
k->type = fill_sms4_pair(&k->key.wapi_pairwise_key, key,
sta->addr);
else
k->type = fill_sms4_group(&k->key.wapi_group_key, key);
} else if (key->cipher == WLAN_CIPHER_SUITE_AES_CMAC) {
k->type = fill_aes_cmac_group(&k->key.igtk_group_key, key, &seq);
k->type = fill_aes_cmac_group(&k->key.igtk_group_key, key,
&seq);
} else {
dev_warn(wdev->dev, "unsupported key type %d\n", key->cipher);
wfx_free_key(wdev, idx);
......
......@@ -99,7 +99,8 @@ static const struct ieee80211_supported_band wfx_band_2ghz = {
.ht_cap = {
// Receive caps
.cap = IEEE80211_HT_CAP_GRN_FLD | IEEE80211_HT_CAP_SGI_20 |
IEEE80211_HT_CAP_MAX_AMSDU | (1 << IEEE80211_HT_CAP_RX_STBC_SHIFT),
IEEE80211_HT_CAP_MAX_AMSDU |
(1 << IEEE80211_HT_CAP_RX_STBC_SHIFT),
.ht_supported = 1,
.ampdu_factor = IEEE80211_HT_MAX_AMPDU_16K,
.ampdu_density = IEEE80211_HT_MPDU_DENSITY_NONE,
......@@ -163,14 +164,17 @@ bool wfx_api_older_than(struct wfx_dev *wdev, int major, int minor)
return false;
}
struct gpio_desc *wfx_get_gpio(struct device *dev, int override, const char *label)
struct gpio_desc *wfx_get_gpio(struct device *dev, int override,
const char *label)
{
struct gpio_desc *ret;
char label_buf[256];
if (override >= 0) {
snprintf(label_buf, sizeof(label_buf), "wfx_%s", label);
ret = ERR_PTR(devm_gpio_request_one(dev, override, GPIOF_OUT_INIT_LOW, label_buf));
ret = ERR_PTR(devm_gpio_request_one(dev, override,
GPIOF_OUT_INIT_LOW,
label_buf));
if (!ret)
ret = gpio_to_desc(override);
} else if (override == -1) {
......@@ -182,10 +186,12 @@ struct gpio_desc *wfx_get_gpio(struct device *dev, int override, const char *lab
if (!ret || PTR_ERR(ret) == -ENOENT)
dev_warn(dev, "gpio %s is not defined\n", label);
else
dev_warn(dev, "error while requesting gpio %s\n", label);
dev_warn(dev,
"error while requesting gpio %s\n", label);
ret = NULL;
} else {
dev_dbg(dev, "using gpio %d for %s\n", desc_to_gpio(ret), label);
dev_dbg(dev,
"using gpio %d for %s\n", desc_to_gpio(ret), label);
}
return ret;
}
......@@ -215,7 +221,8 @@ int wfx_send_pds(struct wfx_dev *wdev, unsigned char *buf, size_t len)
buf[i] = 0;
dev_dbg(wdev->dev, "send PDS '%s}'\n", buf + start);
buf[i] = '}';
ret = hif_configuration(wdev, buf + start, i - start + 1);
ret = hif_configuration(wdev, buf + start,
i - start + 1);
if (ret == HIF_STATUS_FAILURE) {
dev_err(wdev->dev, "PDS bytes %d to %d: invalid data (unsupported options?)\n", start, i);
return -EINVAL;
......@@ -243,7 +250,8 @@ static int wfx_send_pdata_pds(struct wfx_dev *wdev)
ret = request_firmware(&pds, wdev->pdata.file_pds, wdev->dev);
if (ret) {
dev_err(wdev->dev, "can't load PDS file %s\n", wdev->pdata.file_pds);
dev_err(wdev->dev, "can't load PDS file %s\n",
wdev->pdata.file_pds);
return ret;
}
tmp_buf = kmemdup(pds->data, pds->size, GFP_KERNEL);
......@@ -282,7 +290,8 @@ struct wfx_dev *wfx_init_common(struct device *dev,
hw->queues = 4;
hw->max_rates = 8;
hw->max_rate_tries = 15;
hw->extra_tx_headroom = sizeof(struct hif_sl_msg_hdr) + sizeof(struct hif_msg)
hw->extra_tx_headroom = sizeof(struct hif_sl_msg_hdr) +
sizeof(struct hif_msg)
+ sizeof(struct hif_req_tx)
+ 4 /* alignment */ + 8 /* TKIP IV */;
hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
......@@ -297,7 +306,8 @@ struct wfx_dev *wfx_init_common(struct device *dev,
hw->wiphy->iface_combinations = wfx_iface_combinations;
hw->wiphy->bands[NL80211_BAND_2GHZ] = devm_kmalloc(dev, sizeof(wfx_band_2ghz), GFP_KERNEL);
// FIXME: also copy wfx_rates and wfx_2ghz_chantable
memcpy(hw->wiphy->bands[NL80211_BAND_2GHZ], &wfx_band_2ghz, sizeof(wfx_band_2ghz));
memcpy(hw->wiphy->bands[NL80211_BAND_2GHZ], &wfx_band_2ghz,
sizeof(wfx_band_2ghz));
wdev = hw->priv;
wdev->hw = hw;
......@@ -305,7 +315,8 @@ struct wfx_dev *wfx_init_common(struct device *dev,
wdev->hwbus_ops = hwbus_ops;
wdev->hwbus_priv = hwbus_priv;
memcpy(&wdev->pdata, pdata, sizeof(*pdata));
of_property_read_string(dev->of_node, "config-file", &wdev->pdata.file_pds);
of_property_read_string(dev->of_node, "config-file",
&wdev->pdata.file_pds);
wdev->pdata.gpio_wakeup = wfx_get_gpio(dev, gpio_wakeup, "wakeup");
wfx_sl_fill_pdata(dev, &wdev->pdata);
......@@ -344,7 +355,8 @@ int wfx_probe(struct wfx_dev *wdev)
if (err)
goto err1;
err = wait_for_completion_interruptible_timeout(&wdev->firmware_ready, 10 * HZ);
err = wait_for_completion_interruptible_timeout(&wdev->firmware_ready,
10 * HZ);
if (err <= 0) {
if (err == 0) {
dev_err(wdev->dev, "timeout while waiting for startup indication. IRQ configuration error?\n");
......@@ -359,16 +371,19 @@ int wfx_probe(struct wfx_dev *wdev)
dev_info(wdev->dev, "started firmware %d.%d.%d \"%s\" (API: %d.%d, keyset: %02X, caps: 0x%.8X)\n",
wdev->hw_caps.firmware_major, wdev->hw_caps.firmware_minor,
wdev->hw_caps.firmware_build, wdev->hw_caps.firmware_label,
wdev->hw_caps.api_version_major, wdev->hw_caps.api_version_minor,
wdev->hw_caps.api_version_major,
wdev->hw_caps.api_version_minor,
wdev->keyset, *((u32 *) &wdev->hw_caps.capabilities));
snprintf(wdev->hw->wiphy->fw_version, sizeof(wdev->hw->wiphy->fw_version),
snprintf(wdev->hw->wiphy->fw_version,
sizeof(wdev->hw->wiphy->fw_version),
"%d.%d.%d",
wdev->hw_caps.firmware_major,
wdev->hw_caps.firmware_minor,
wdev->hw_caps.firmware_build);
if (wfx_api_older_than(wdev, 1, 0)) {
dev_err(wdev->dev, "unsupported firmware API version (expect 1 while firmware returns %d)\n",
dev_err(wdev->dev,
"unsupported firmware API version (expect 1 while firmware returns %d)\n",
wdev->hw_caps.api_version_major);
err = -ENOTSUPP;
goto err1;
......@@ -376,7 +391,8 @@ int wfx_probe(struct wfx_dev *wdev)
err = wfx_sl_init(wdev);
if (err && wdev->hw_caps.capabilities.link_mode == SEC_LINK_ENFORCED) {
dev_err(wdev->dev, "chip require secure_link, but can't negociate it\n");
dev_err(wdev->dev,
"chip require secure_link, but can't negociate it\n");
goto err1;
}
......@@ -386,15 +402,18 @@ int wfx_probe(struct wfx_dev *wdev)
wdev->hw->wiphy->bands[NL80211_BAND_2GHZ]->channels[13].flags |= IEEE80211_CHAN_DISABLED;
}
dev_dbg(wdev->dev, "sending configuration file %s\n", wdev->pdata.file_pds);
dev_dbg(wdev->dev, "sending configuration file %s\n",
wdev->pdata.file_pds);
err = wfx_send_pdata_pds(wdev);
if (err < 0)
goto err1;
wdev->pdata.gpio_wakeup = gpio_saved;
if (wdev->pdata.gpio_wakeup) {
dev_dbg(wdev->dev, "enable 'quiescent' power mode with gpio %d and PDS file %s\n",
desc_to_gpio(wdev->pdata.gpio_wakeup), wdev->pdata.file_pds);
dev_dbg(wdev->dev,
"enable 'quiescent' power mode with gpio %d and PDS file %s\n",
desc_to_gpio(wdev->pdata.gpio_wakeup),
wdev->pdata.file_pds);
gpiod_set_value(wdev->pdata.gpio_wakeup, 1);
control_reg_write(wdev, 0);
hif_set_operational_mode(wdev, HIF_OP_POWER_MODE_QUIESCENT);
......@@ -411,13 +430,15 @@ int wfx_probe(struct wfx_dev *wdev)
ether_addr_copy(wdev->addresses[i].addr, macaddr);
wdev->addresses[i].addr[ETH_ALEN - 1] += i;
} else {
ether_addr_copy(wdev->addresses[i].addr, wdev->hw_caps.mac_addr[i]);
ether_addr_copy(wdev->addresses[i].addr,
wdev->hw_caps.mac_addr[i]);
}
if (!is_valid_ether_addr(wdev->addresses[i].addr)) {
dev_warn(wdev->dev, "using random MAC address\n");
eth_random_addr(wdev->addresses[i].addr);
}
dev_info(wdev->dev, "MAC address %d: %pM\n", i, wdev->addresses[i].addr);
dev_info(wdev->dev, "MAC address %d: %pM\n", i,
wdev->addresses[i].addr);
}
wdev->hw->wiphy->n_addresses = ARRAY_SIZE(wdev->addresses);
wdev->hw->wiphy->addresses = wdev->addresses;
......
......@@ -42,7 +42,8 @@ void wfx_tx_flush(struct wfx_dev *wdev)
!wdev->hif.tx_buffers_used,
msecs_to_jiffies(3000));
if (!ret) {
dev_warn(wdev->dev, "cannot flush tx buffers (%d still busy)\n", wdev->hif.tx_buffers_used);
dev_warn(wdev->dev, "cannot flush tx buffers (%d still busy)\n",
wdev->hif.tx_buffers_used);
wfx_pending_dump_old_frames(wdev, 3000);
// FIXME: drop pending frames here
wdev->chip_frozen = 1;
......@@ -121,7 +122,8 @@ void wfx_tx_queues_wait_empty_vif(struct wfx_vif *wvif)
} while (!done);
}
static void wfx_tx_queue_clear(struct wfx_dev *wdev, struct wfx_queue *queue, struct sk_buff_head *gc_list)
static void wfx_tx_queue_clear(struct wfx_dev *wdev, struct wfx_queue *queue,
struct sk_buff_head *gc_list)
{
int i;
struct sk_buff *item;
......@@ -189,7 +191,8 @@ size_t wfx_tx_queue_get_num_queued(struct wfx_queue *queue,
ret = skb_queue_len(&queue->queue);
} else {
ret = 0;
for (i = 0, bit = 1; i < ARRAY_SIZE(queue->link_map_cache); ++i, bit <<= 1) {
for (i = 0, bit = 1; i < ARRAY_SIZE(queue->link_map_cache);
++i, bit <<= 1) {
if (link_id_map & bit)
ret += queue->link_map_cache[i];
}
......@@ -198,7 +201,8 @@ size_t wfx_tx_queue_get_num_queued(struct wfx_queue *queue,
return ret;
}
void wfx_tx_queue_put(struct wfx_dev *wdev, struct wfx_queue *queue, struct sk_buff *skb)
void wfx_tx_queue_put(struct wfx_dev *wdev, struct wfx_queue *queue,
struct sk_buff *skb)
{
struct wfx_queue_stats *stats = &wdev->tx_queue_stats;
struct wfx_tx_priv *tx_priv = wfx_skb_tx_priv(skb);
......@@ -315,7 +319,8 @@ void wfx_pending_dump_old_frames(struct wfx_dev *wdev, unsigned int limit_ms)
skb_queue_walk(&stats->pending, skb) {
tx_priv = wfx_skb_tx_priv(skb);
req = wfx_skb_txreq(skb);
if (ktime_after(now, ktime_add_ms(tx_priv->xmit_timestamp, limit_ms))) {
if (ktime_after(now, ktime_add_ms(tx_priv->xmit_timestamp,
limit_ms))) {
if (first) {
dev_info(wdev->dev, "frames stuck in firmware since %dms or more:\n",
limit_ms);
......@@ -329,7 +334,8 @@ void wfx_pending_dump_old_frames(struct wfx_dev *wdev, unsigned int limit_ms)
spin_unlock_bh(&stats->pending.lock);
}
unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev, struct sk_buff *skb)
unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev,
struct sk_buff *skb)
{
ktime_t now = ktime_get();
struct wfx_tx_priv *tx_priv = wfx_skb_tx_priv(skb);
......@@ -376,7 +382,8 @@ static bool hif_handle_tx_data(struct wfx_vif *wvif, struct sk_buff *skb,
case NL80211_IFTYPE_AP:
if (!wvif->state) {
action = do_drop;
} else if (!(BIT(tx_priv->raw_link_id) & (BIT(0) | wvif->link_id_map))) {
} else if (!(BIT(tx_priv->raw_link_id) &
(BIT(0) | wvif->link_id_map))) {
dev_warn(wvif->wdev->dev, "a frame with expired link-id is dropped\n");
action = do_drop;
}
......@@ -462,7 +469,8 @@ static int wfx_get_prio_queue(struct wfx_vif *wvif,
/* override winner if bursting */
if (winner >= 0 && wvif->wdev->tx_burst_idx >= 0 &&
winner != wvif->wdev->tx_burst_idx &&
!wfx_tx_queue_get_num_queued(&wvif->wdev->tx_queue[winner], tx_allowed_mask & urgent) &&
!wfx_tx_queue_get_num_queued(&wvif->wdev->tx_queue[winner],
tx_allowed_mask & urgent) &&
wfx_tx_queue_get_num_queued(&wvif->wdev->tx_queue[wvif->wdev->tx_burst_idx], tx_allowed_mask))
winner = wvif->wdev->tx_burst_idx;
......@@ -536,10 +544,13 @@ struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev)
while ((wvif = wvif_iterate(wdev, wvif)) != NULL) {
spin_lock_bh(&wvif->ps_state_lock);
not_found = wfx_tx_queue_mask_get(wvif, &vif_queue, &vif_tx_allowed_mask, &vif_more);
not_found = wfx_tx_queue_mask_get(wvif, &vif_queue,
&vif_tx_allowed_mask,
&vif_more);
if (wvif->mcast_buffered && (not_found || !vif_more) &&
(wvif->mcast_tx || !wvif->sta_asleep_mask)) {
(wvif->mcast_tx ||
!wvif->sta_asleep_mask)) {
wvif->mcast_buffered = false;
if (wvif->mcast_tx) {
wvif->mcast_tx = false;
......
......@@ -47,13 +47,15 @@ bool wfx_tx_queues_is_empty(struct wfx_dev *wdev);
void wfx_tx_queues_wait_empty_vif(struct wfx_vif *wvif);
struct hif_msg *wfx_tx_queues_get(struct wfx_dev *wdev);
void wfx_tx_queue_put(struct wfx_dev *wdev, struct wfx_queue *queue, struct sk_buff *skb);
void wfx_tx_queue_put(struct wfx_dev *wdev, struct wfx_queue *queue,
struct sk_buff *skb);
size_t wfx_tx_queue_get_num_queued(struct wfx_queue *queue, u32 link_id_map);
struct sk_buff *wfx_pending_get(struct wfx_dev *wdev, u32 packet_id);
int wfx_pending_remove(struct wfx_dev *wdev, struct sk_buff *skb);
int wfx_pending_requeue(struct wfx_dev *wdev, struct sk_buff *skb);
unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev, struct sk_buff *skb);
unsigned int wfx_pending_get_pkt_us_delay(struct wfx_dev *wdev,
struct sk_buff *skb);
void wfx_pending_dump_old_frames(struct wfx_dev *wdev, unsigned int limit_ms);
#endif /* WFX_QUEUE_H */
......@@ -12,7 +12,8 @@
#include "sta.h"
#include "hif_tx_mib.h"
static void __ieee80211_scan_completed_compat(struct ieee80211_hw *hw, bool aborted)
static void __ieee80211_scan_completed_compat(struct ieee80211_hw *hw,
bool aborted)
{
struct cfg80211_scan_info info = {
.aborted = aborted ? 1 : 0,
......@@ -159,7 +160,8 @@ void wfx_scan_work(struct work_struct *work)
if (!wvif->scan.req || wvif->scan.curr == wvif->scan.end) {
if (wvif->scan.output_power != wvif->wdev->output_power)
hif_set_output_power(wvif, wvif->wdev->output_power * 10);
hif_set_output_power(wvif,
wvif->wdev->output_power * 10);
if (wvif->scan.status < 0)
dev_warn(wvif->wdev->dev, "scan failed\n");
......@@ -172,7 +174,8 @@ void wfx_scan_work(struct work_struct *work)
wfx_scan_restart_delayed(wvif);
wfx_tx_unlock(wvif->wdev);
mutex_unlock(&wvif->wdev->conf_mutex);
__ieee80211_scan_completed_compat(wvif->wdev->hw, wvif->scan.status ? 1 : 0);
__ieee80211_scan_completed_compat(wvif->wdev->hw,
wvif->scan.status ? 1 : 0);
up(&wvif->scan.lock);
if (wvif->state == WFX_STATE_STA &&
!(wvif->powersave_mode.pm_mode.enter_psm))
......@@ -211,7 +214,8 @@ void wfx_scan_work(struct work_struct *work)
scan.scan_req.scan_flags.fbg = 1;
}
scan.ch = kcalloc(scan.scan_req.num_of_channels, sizeof(u8), GFP_KERNEL);
scan.ch = kcalloc(scan.scan_req.num_of_channels,
sizeof(u8), GFP_KERNEL);
if (!scan.ch) {
wvif->scan.status = -ENOMEM;
......@@ -273,7 +277,8 @@ void wfx_scan_complete_cb(struct wfx_vif *wvif, struct hif_ind_scan_cmpl *arg)
void wfx_scan_timeout(struct work_struct *work)
{
struct wfx_vif *wvif = container_of(work, struct wfx_vif, scan.timeout.work);
struct wfx_vif *wvif = container_of(work, struct wfx_vif,
scan.timeout.work);
if (atomic_xchg(&wvif->scan.in_progress, 0)) {
if (wvif->scan.status > 0) {
......
This diff is collapsed.
......@@ -86,11 +86,13 @@ void wfx_change_chanctx(struct ieee80211_hw *hw,
struct ieee80211_chanctx_conf *conf, u32 changed);
int wfx_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
struct ieee80211_chanctx_conf *conf);
void wfx_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
void wfx_unassign_vif_chanctx(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
struct ieee80211_chanctx_conf *conf);
// WSM Callbacks
void wfx_suspend_resume(struct wfx_vif *wvif, struct hif_ind_suspend_resume_tx *arg);
void wfx_suspend_resume(struct wfx_vif *wvif,
struct hif_ind_suspend_resume_tx *arg);
// Other Helpers
void wfx_cqm_bssloss_sm(struct wfx_vif *wvif, int init, int good, int bad);
......
......@@ -177,14 +177,16 @@ DECLARE_EVENT_CLASS(hif_data,
else
__entry->msg_type = "REQ";
if (!is_recv &&
(__entry->msg_id == HIF_REQ_ID_READ_MIB || __entry->msg_id == HIF_REQ_ID_WRITE_MIB)) {
(__entry->msg_id == HIF_REQ_ID_READ_MIB ||
__entry->msg_id == HIF_REQ_ID_WRITE_MIB)) {
__entry->mib = le16_to_cpup((u16 *) hif->body);
header_len = 4;
} else {
__entry->mib = -1;
header_len = 0;
}
__entry->buf_len = min_t(int, __entry->msg_len, sizeof(__entry->buf))
__entry->buf_len = min_t(int, __entry->msg_len,
sizeof(__entry->buf))
- sizeof(struct hif_msg) - header_len;
memcpy(__entry->buf, hif->body + header_len, __entry->buf_len);
),
......@@ -203,11 +205,13 @@ DECLARE_EVENT_CLASS(hif_data,
DEFINE_EVENT(hif_data, hif_send,
TP_PROTO(struct hif_msg *hif, int tx_fill_level, bool is_recv),
TP_ARGS(hif, tx_fill_level, is_recv));
#define _trace_hif_send(hif, tx_fill_level) trace_hif_send(hif, tx_fill_level, false)
#define _trace_hif_send(hif, tx_fill_level)\
trace_hif_send(hif, tx_fill_level, false)
DEFINE_EVENT(hif_data, hif_recv,
TP_PROTO(struct hif_msg *hif, int tx_fill_level, bool is_recv),
TP_ARGS(hif, tx_fill_level, is_recv));
#define _trace_hif_recv(hif, tx_fill_level) trace_hif_recv(hif, tx_fill_level, true)
#define _trace_hif_recv(hif, tx_fill_level)\
trace_hif_recv(hif, tx_fill_level, true)
#define wfx_reg_list_enum \
wfx_reg_name(WFX_REG_CONFIG, "CONFIG") \
......@@ -241,7 +245,8 @@ DECLARE_EVENT_CLASS(io_data,
__entry->reg = reg;
__entry->addr = addr;
__entry->msg_len = len;
__entry->buf_len = min_t(int, sizeof(__entry->buf), __entry->msg_len);
__entry->buf_len = min_t(int, sizeof(__entry->buf),
__entry->msg_len);
memcpy(__entry->buf, io_buf, __entry->buf_len);
if (addr >= 0)
snprintf(__entry->addr_str, 10, "/%08x", addr);
......@@ -259,12 +264,14 @@ DECLARE_EVENT_CLASS(io_data,
DEFINE_EVENT(io_data, io_write,
TP_PROTO(int reg, int addr, const void *io_buf, size_t len),
TP_ARGS(reg, addr, io_buf, len));
#define _trace_io_ind_write(reg, addr, io_buf, len) trace_io_write(reg, addr, io_buf, len)
#define _trace_io_ind_write(reg, addr, io_buf, len)\
trace_io_write(reg, addr, io_buf, len)
#define _trace_io_write(reg, io_buf, len) trace_io_write(reg, -1, io_buf, len)
DEFINE_EVENT(io_data, io_read,
TP_PROTO(int reg, int addr, const void *io_buf, size_t len),
TP_ARGS(reg, addr, io_buf, len));
#define _trace_io_ind_read(reg, addr, io_buf, len) trace_io_read(reg, addr, io_buf, len)
#define _trace_io_ind_read(reg, addr, io_buf, len)\
trace_io_read(reg, addr, io_buf, len)
#define _trace_io_read(reg, io_buf, len) trace_io_read(reg, -1, io_buf, len)
DECLARE_EVENT_CLASS(io_data32,
......@@ -348,7 +355,8 @@ TRACE_EVENT(bh_stats,
__entry->release ? "release" : "keep"
)
);
#define _trace_bh_stats(ind, req, cnf, busy, release) trace_bh_stats(ind, req, cnf, busy, release)
#define _trace_bh_stats(ind, req, cnf, busy, release)\
trace_bh_stats(ind, req, cnf, busy, release)
TRACE_EVENT(tx_stats,
TP_PROTO(struct hif_cnf_tx *tx_cnf, struct sk_buff *skb, int delay),
......@@ -365,7 +373,8 @@ TRACE_EVENT(tx_stats,
),
TP_fast_assign(
// Keep sync with wfx_rates definition in main.c
static const int hw_rate[] = { 0, 1, 2, 3, 6, 7, 8, 9, 10, 11, 12, 13 };
static const int hw_rate[] = { 0, 1, 2, 3, 6, 7, 8, 9,
10, 11, 12, 13 };
struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb);
struct ieee80211_tx_rate *rates = tx_info->driver_rates;
int i;
......
......@@ -141,13 +141,15 @@ static inline struct wfx_vif *wdev_to_wvif(struct wfx_dev *wdev, int vif_id)
}
vif_id = array_index_nospec(vif_id, ARRAY_SIZE(wdev->vif));
if (!wdev->vif[vif_id]) {
dev_dbg(wdev->dev, "requesting non-allocated vif: %d\n", vif_id);
dev_dbg(wdev->dev, "requesting non-allocated vif: %d\n",
vif_id);
return NULL;
}
return (struct wfx_vif *) wdev->vif[vif_id]->drv_priv;
}
static inline struct wfx_vif *wvif_iterate(struct wfx_dev *wdev, struct wfx_vif *cur)
static inline struct wfx_vif *wvif_iterate(struct wfx_dev *wdev,
struct wfx_vif *cur)
{
int i;
int mark = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment