Commit f545b23d authored by Jérôme Pouiller's avatar Jérôme Pouiller Committed by Greg Kroah-Hartman

staging: wfx: reformat comments on 100 columns

Until now, this driver was written in 80 columns style. However, since
all the functions are prefixed with "wfx_", this constraint is no more
respected in the last patches.

From the perspective of kernel Coding Style, it is not a problem since
it is now allowed to write code on 100 columns.

This patch just unify the code to use 100 columns in every comments.
Signed-off-by: default avatarJérôme Pouiller <jerome.pouiller@silabs.com>
Link: https://lore.kernel.org/r/20220113085524.1110708-22-Jerome.Pouiller@silabs.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 381d3295
......@@ -32,18 +32,15 @@ static void device_wakeup(struct wfx_dev *wdev)
}
for (;;) {
gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 1);
/* completion.h does not provide any function to wait
* completion without consume it (a kind of
* wait_for_completion_done_timeout()). So we have to emulate
* it.
/* completion.h does not provide any function to wait completion without consume it
* (a kind of wait_for_completion_done_timeout()). So we have to emulate it.
*/
if (wait_for_completion_timeout(&wdev->hif.ctrl_ready, msecs_to_jiffies(2))) {
complete(&wdev->hif.ctrl_ready);
return;
} else if (max_retry-- > 0) {
/* Older firmwares have a race in sleep/wake-up process.
* Redo the process is sufficient to unfreeze the
* chip.
/* Older firmwares have a race in sleep/wake-up process. Redo the process
* is sufficient to unfreeze the chip.
*/
dev_err(wdev->dev, "timeout while wake up chip\n");
gpiod_set_value_cansleep(wdev->pdata.gpio_wakeup, 0);
......@@ -219,9 +216,9 @@ static int bh_work_tx(struct wfx_dev *wdev, int max_msg)
return i;
}
/* In SDIO mode, it is necessary to make an access to a register to acknowledge
* last received message. It could be possible to restrict this acknowledge to
* SDIO mode and only if last operation was rx.
/* In SDIO mode, it is necessary to make an access to a register to acknowledge last received
* message. It could be possible to restrict this acknowledge to SDIO mode and only if last
* operation was rx.
*/
static void ack_sdio_data(struct wfx_dev *wdev)
{
......@@ -287,12 +284,11 @@ void wfx_bh_request_tx(struct wfx_dev *wdev)
queue_work(system_highpri_wq, &wdev->hif.bh);
}
/* If IRQ is not available, this function allow to manually poll the control
* register and simulate an IRQ ahen an event happened.
/* If IRQ is not available, this function allow to manually poll the control register and simulate
* an IRQ ahen an event happened.
*
* Note that the device has a bug: If an IRQ raise while host read control
* register, the IRQ is lost. So, use this function carefully (only duing
* device initialisation).
* Note that the device has a bug: If an IRQ raise while host read control register, the IRQ is
* lost. So, use this function carefully (only duing device initialisation).
*/
void wfx_bh_poll_irq(struct wfx_dev *wdev)
{
......
......@@ -38,13 +38,12 @@ struct wfx_spi_priv {
bool need_swab;
};
/* The chip reads 16bits of data at time and place them directly into (little
* endian) CPU register. So, the chip expects bytes order to be "B1 B0 B3 B2"
* (while LE is "B0 B1 B2 B3" and BE is "B3 B2 B1 B0")
/* The chip reads 16bits of data at time and place them directly into (little endian) CPU register.
* So, the chip expects bytes order to be "B1 B0 B3 B2" (while LE is "B0 B1 B2 B3" and BE is
* "B3 B2 B1 B0")
*
* A little endian host with bits_per_word == 16 should do the right job
* natively. The code below to support big endian host and commonly used SPI
* 8bits.
* A little endian host with bits_per_word == 16 should do the right job natively. The code below to
* support big endian host and commonly used SPI 8bits.
*/
static int wfx_spi_copy_from_io(void *priv, unsigned int addr, void *dst, size_t count)
{
......@@ -160,8 +159,7 @@ static int wfx_spi_irq_unsubscribe(void *priv)
static size_t wfx_spi_align_size(void *priv, size_t size)
{
/* Most of SPI controllers avoid DMA if buffer size is not 32bit aligned
*/
/* Most of SPI controllers avoid DMA if buffer size is not 32bit aligned */
return ALIGN(size, 4);
}
......
......@@ -74,8 +74,8 @@ void wfx_rx_cb(struct wfx_vif *wvif, const struct wfx_hif_ind_rx *arg, struct sk
if (arg->encryp)
hdr->flag |= RX_FLAG_DECRYPTED;
/* Block ack negotiation is offloaded by the firmware. However,
* re-ordering must be done by the mac80211.
/* Block ack negotiation is offloaded by the firmware. However, re-ordering must be done by
* the mac80211.
*/
if (ieee80211_is_action(frame->frame_control) &&
mgmt->u.action.category == WLAN_CATEGORY_BACK &&
......
......@@ -30,8 +30,8 @@ static int wfx_get_hw_rate(struct wfx_dev *wdev, const struct ieee80211_tx_rate
}
return rate->idx + 14;
}
/* The device only support 2GHz, else band information should be
* retrieved from ieee80211_tx_info
/* The device only support 2GHz, else band information should be retrieved from
* ieee80211_tx_info
*/
band = wdev->hw->wiphy->bands[NL80211_BAND_2GHZ];
if (rate->idx >= band->n_bitrates) {
......@@ -356,9 +356,8 @@ static int wfx_tx_inner(struct wfx_vif *wvif, struct ieee80211_sta *sta, struct
/* Fill tx request */
req = (struct wfx_hif_req_tx *)hif_msg->body;
/* packet_id just need to be unique on device. 32bits are more than
* necessary for that task, so we tae advantage of it to add some extra
* data for debug.
/* packet_id just need to be unique on device. 32bits are more than necessary for that task,
* so we take advantage of it to add some extra data for debug.
*/
req->packet_id = atomic_add_return(1, &wvif->wdev->packet_id) & 0xFFFF;
req->packet_id |= IEEE80211_SEQ_TO_SN(le16_to_cpu(hdr->seq_ctrl)) << 16;
......@@ -402,8 +401,8 @@ void wfx_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *control, struc
wvif = wvif_iterate(wdev, NULL);
if (WARN_ON(!wvif))
goto drop;
/* Because of TX_AMPDU_SETUP_IN_HW, mac80211 does not try to send any
* BlockAck session management frame. The check below exist just in case.
/* Because of TX_AMPDU_SETUP_IN_HW, mac80211 does not try to send any BlockAck session
* management frame. The check below exist just in case.
*/
if (wfx_is_action_back(hdr)) {
dev_info(wdev->dev, "drop BA action\n");
......
......@@ -250,9 +250,9 @@ static ssize_t wfx_send_hif_msg_write(struct file *file, const char __user *user
if (count < sizeof(struct wfx_hif_msg))
return -EINVAL;
/* wfx_cmd_send() checks that reply buffer is wide enough, but does not
* return precise length read. User have to know how many bytes should
* be read. Filling reply buffer with a memory pattern may help user.
/* wfx_cmd_send() checks that reply buffer is wide enough, but does not return precise
* length read. User have to know how many bytes should be read. Filling reply buffer with a
* memory pattern may help user.
*/
memset(context->reply, 0xFF, sizeof(context->reply));
request = memdup_user(user_buf, count);
......@@ -282,9 +282,7 @@ static ssize_t wfx_send_hif_msg_read(struct file *file, char __user *user_buf,
return ret;
if (context->ret < 0)
return context->ret;
/* Be careful, write() is waiting for a full message while read()
* only returns a payload
*/
/* Be careful, write() is waiting for a full message while read() only returns a payload */
if (copy_to_user(user_buf, context->reply, count))
return -EFAULT;
......
......@@ -69,15 +69,13 @@ static const char * const fwio_errors[] = {
[ERR_MAC_KEY] = "MAC key not initialized",
};
/* request_firmware() allocate data using vmalloc(). It is not compatible with
* underlying hardware that use DMA. Function below detect this case and
* allocate a bounce buffer if necessary.
/* request_firmware() allocate data using vmalloc(). It is not compatible with underlying hardware
* that use DMA. Function below detect this case and allocate a bounce buffer if necessary.
*
* Notice that, in doubt, you can enable CONFIG_DEBUG_SG to ask kernel to
* detect this problem at runtime (else, kernel silently fail).
* Notice that, in doubt, you can enable CONFIG_DEBUG_SG to ask kernel to detect this problem at
* runtime (else, kernel silently fail).
*
* NOTE: it may also be possible to use 'pages' from struct firmware and avoid
* bounce buffer
* NOTE: it may also be possible to use 'pages' from struct firmware and avoid bounce buffer
*/
static int wfx_sram_write_dma_safe(struct wfx_dev *wdev, u32 addr, const u8 *buf, size_t len)
{
......@@ -202,9 +200,7 @@ static int upload_firmware(struct wfx_dev *wdev, const u8 *data, size_t len)
if (ret < 0)
return ret;
/* The device seems to not support writing 0 in this register
* during first loop
*/
/* The device seems to not support writing 0 in this register during first loop */
offs += DNLD_BLOCK_SIZE;
ret = wfx_sram_reg_write(wdev, WFX_DCA_PUT, offs);
if (ret < 0)
......
......@@ -174,8 +174,8 @@ enum wfx_hif_frame_format {
};
struct wfx_hif_req_tx {
/* packet_id is not interpreted by the device, so it is not necessary to
* declare it little endian
/* packet_id is not interpreted by the device, so it is not necessary to declare it little
* endian
*/
u32 packet_id;
u8 max_tx_rate;
......@@ -212,8 +212,8 @@ enum wfx_hif_qos_ackplcy {
struct wfx_hif_cnf_tx {
__le32 status;
/* packet_id is copied from struct wfx_hif_req_tx without been interpreted
* by the device, so it is not necessary to declare it little endian
/* packet_id is copied from struct wfx_hif_req_tx without been interpreted by the device, so
* it is not necessary to declare it little endian
*/
u32 packet_id;
u8 txed_rate;
......
......@@ -371,9 +371,7 @@ void wfx_handle_rx(struct wfx_dev *wdev, struct sk_buff *skb)
wfx_hif_receive_indication(wdev, hif, hif->body, skb);
return;
}
/* Note: mutex_is_lock cause an implicit memory barrier that protect
* buf_send
*/
/* Note: mutex_is_lock cause an implicit memory barrier that protect buf_send */
if (mutex_is_locked(&wdev->hif_cmd.lock) &&
wdev->hif_cmd.buf_send && wdev->hif_cmd.buf_send->id == hif_id) {
wfx_hif_generic_confirm(wdev, hif, hif->body);
......
......@@ -61,8 +61,8 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct wfx_hif_msg *request,
mutex_lock(&wdev->hif_cmd.lock);
WARN(wdev->hif_cmd.buf_send, "data locking error");
/* Note: call to complete() below has an implicit memory barrier that
* hopefully protect buf_send
/* Note: call to complete() below has an implicit memory barrier that hopefully protect
* buf_send
*/
wdev->hif_cmd.buf_send = request;
wdev->hif_cmd.buf_recv = reply;
......@@ -72,9 +72,7 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct wfx_hif_msg *request,
wfx_bh_request_tx(wdev);
if (no_reply) {
/* Chip won't reply. Give enough time to the wq to send the
* buffer.
*/
/* Chip won't reply. Give enough time to the wq to send the buffer. */
msleep(100);
wdev->hif_cmd.buf_send = NULL;
mutex_unlock(&wdev->hif_cmd.lock);
......@@ -118,8 +116,8 @@ int wfx_cmd_send(struct wfx_dev *wdev, struct wfx_hif_msg *request,
return ret;
}
/* This function is special. After HIF_REQ_ID_SHUT_DOWN, chip won't reply to any
* request anymore. Obviously, only call this function during device unregister.
/* This function is special. After HIF_REQ_ID_SHUT_DOWN, chip won't reply to any request anymore.
* Obviously, only call this function during device unregister.
*/
int wfx_hif_shutdown(struct wfx_dev *wdev)
{
......@@ -340,9 +338,7 @@ int wfx_hif_add_key(struct wfx_dev *wdev, const struct wfx_hif_req_add_key *arg)
/* FIXME: swap bytes as necessary in body */
memcpy(body, arg, sizeof(*body));
if (wfx_api_older_than(wdev, 1, 5))
/* Legacy firmwares expect that add_key to be sent on right
* interface.
*/
/* 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));
else
wfx_fill_header(hif, -1, HIF_REQ_ID_ADD_KEY, sizeof(*body));
......
......@@ -12,9 +12,8 @@
struct wfx_dev;
/* Caution: in the functions below, 'buf' will used with a DMA. So, it must be
* kmalloc'd (do not use stack allocated buffers). In doubt, enable
* CONFIG_DEBUG_SG to detect badly located buffer.
/* Caution: in the functions below, 'buf' will used with a DMA. So, it must be kmalloc'd (do not use
* stack allocated buffers). In doubt, enable CONFIG_DEBUG_SG to detect badly located buffer.
*/
int wfx_data_read(struct wfx_dev *wdev, void *buf, size_t buf_len);
int wfx_data_write(struct wfx_dev *wdev, const void *buf, size_t buf_len);
......
......@@ -162,19 +162,17 @@ bool wfx_api_older_than(struct wfx_dev *wdev, int major, int minor)
return false;
}
/* The device needs data about the antenna configuration. This information in
* provided by PDS (Platform Data Set, this is the wording used in WF200
* documentation) files. For hardware integrators, the full process to create
* PDS files is described here:
/* The device needs data about the antenna configuration. This information in provided by PDS
* (Platform Data Set, this is the wording used in WF200 documentation) files. For hardware
* integrators, the full process to create PDS files is described here:
* https:github.com/SiliconLabs/wfx-firmware/blob/master/PDS/README.md
*
* So this function aims to send PDS to the device. However, the PDS file is
* often bigger than Rx buffers of the chip, so it has to be sent in multiple
* parts.
* So this function aims to send PDS to the device. However, the PDS file is often bigger than Rx
* buffers of the chip, so it has to be sent in multiple parts.
*
* In add, the PDS data cannot be split anywhere. The PDS files contains tree
* structures. Braces are used to enter/leave a level of the tree (in a JSON
* fashion). PDS files can only been split between root nodes.
* In add, the PDS data cannot be split anywhere. The PDS files contains tree structures. Braces are
* used to enter/leave a level of the tree (in a JSON fashion). PDS files can only been split
* between root nodes.
*/
int wfx_send_pds(struct wfx_dev *wdev, u8 *buf, size_t len)
{
......@@ -341,8 +339,8 @@ int wfx_probe(struct wfx_dev *wdev)
int err;
struct gpio_desc *gpio_saved;
/* During first part of boot, gpio_wakeup cannot yet been used. So
* prevent bh() to touch it.
/* During first part of boot, gpio_wakeup cannot yet been used. So prevent bh() to touch
* it.
*/
gpio_saved = wdev->pdata.gpio_wakeup;
wdev->pdata.gpio_wakeup = NULL;
......
......@@ -23,8 +23,8 @@ struct wfx_platform_data {
const char *file_fw;
const char *file_pds;
struct gpio_desc *gpio_wakeup;
/* if true HIF D_out is sampled on the rising edge of the clock
* (intended to be used in 50Mhz SDIO)
/* if true HIF D_out is sampled on the rising edge of the clock (intended to be used in
* 50Mhz SDIO)
*/
bool use_rising_clk;
};
......
......@@ -59,9 +59,8 @@ void wfx_tx_lock_flush(struct wfx_dev *wdev)
void wfx_tx_queues_init(struct wfx_vif *wvif)
{
/* The device is in charge to respect the details of the QoS parameters.
* The driver just ensure that it roughtly respect the priorities to
* avoid any shortage.
/* The device is in charge to respect the details of the QoS parameters. The driver just
* ensure that it roughtly respect the priorities to avoid any shortage.
*/
const int priorities[IEEE80211_NUM_ACS] = { 1, 2, 64, 128 };
int i;
......
......@@ -107,8 +107,8 @@ void wfx_configure_filter(struct ieee80211_hw *hw, unsigned int changed_flags,
* - PS-Poll (FIF_PSPOLL) are never filtered
* - RTS, CTS and Ack (FIF_CONTROL) are always filtered
* - Broken frames (FIF_FCSFAIL and FIF_PLCPFAIL) are always filtered
* - Firmware does (yet) allow to forward unicast traffic sent to
* other stations (aka. promiscuous mode)
* - Firmware does (yet) allow to forward unicast traffic sent to other stations (aka.
* promiscuous mode)
*/
*total_flags &= FIF_BCN_PRBRESP_PROMISC | FIF_ALLMULTI | FIF_OTHER_BSS |
FIF_PROBE_REQ | FIF_PSPOLL;
......@@ -168,9 +168,7 @@ static int wfx_get_ps_timeout(struct wfx_vif *wvif, bool *enable_ps)
dev_info(wvif->wdev->dev, "ignoring requested PS mode");
return -1;
}
/* It is necessary to enable PS if channels
* are different.
*/
/* It is necessary to enable PS if channels are different. */
if (enable_ps)
*enable_ps = true;
if (wvif->wdev->force_ps_timeout > -1)
......@@ -429,10 +427,9 @@ static void wfx_join(struct wfx_vif *wvif)
ieee80211_connection_loss(wvif->vif);
wfx_reset(wvif);
} else {
/* Due to beacon filtering it is possible that the
* AP's beacon is not known for the mac80211 stack.
* Disable filtering temporary to make sure the stack
* receives at least one
/* Due to beacon filtering it is possible that the AP's beacon is not known for the
* mac80211 stack. Disable filtering temporary to make sure the stack receives at
* least one
*/
wfx_filter_beacon(wvif, false);
}
......@@ -459,9 +456,7 @@ static void wfx_join_finalize(struct wfx_vif *wvif,
wvif->join_in_progress = false;
wfx_hif_set_association_mode(wvif, ampdu_density, greenfield, info->use_short_preamble);
wfx_hif_keep_alive_period(wvif, 0);
/* beacon_loss_count is defined to 7 in net/mac80211/mlme.c. Let's use
* the same value.
*/
/* beacon_loss_count is defined to 7 in net/mac80211/mlme.c. Let's use the same value. */
wfx_hif_set_bss_params(wvif, info->aid, 7);
wfx_hif_set_beacon_wakeup_period(wvif, 1, 1);
wfx_update_pm(wvif);
......@@ -485,10 +480,9 @@ void wfx_leave_ibss(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
static void wfx_enable_beacon(struct wfx_vif *wvif, bool enable)
{
/* Driver has Content After DTIM Beacon in queue. Driver is waiting for
* a signal from the firmware. Since we are going to stop to send
* beacons, this signal will never happens. See also
* wfx_suspend_resume_mc()
/* Driver has Content After DTIM Beacon in queue. Driver is waiting for a signal from the
* firmware. Since we are going to stop to send beacons, this signal will never happens. See
* also wfx_suspend_resume_mc()
*/
if (!enable && wfx_tx_queues_has_cab(wvif)) {
wvif->after_dtim_tx_allowed = true;
......@@ -527,9 +521,7 @@ void wfx_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
if (vif->type != NL80211_IFTYPE_STATION)
dev_warn(wdev->dev, "%s: misunderstood change: BEACON_INFO\n", __func__);
wfx_hif_set_beacon_wakeup_period(wvif, info->dtim_period, info->dtim_period);
/* We temporary forwarded beacon for join process. It is now no
* more necessary.
*/
/* We temporary forwarded beacon for join process. It is now no more necessary. */
wfx_filter_beacon(wvif, true);
}
......@@ -629,8 +621,8 @@ void wfx_suspend_resume_mc(struct wfx_vif *wvif, enum sta_notify_cmd notify_cmd)
if (notify_cmd != STA_NOTIFY_AWAKE)
return;
/* Device won't be able to honor CAB if a scan is in progress on any
* interface. Prefer to skip this DTIM and wait for the next one.
/* Device won't be able to honor CAB if a scan is in progress on any interface. Prefer to
* skip this DTIM and wait for the next one.
*/
wvif_it = NULL;
while ((wvif_it = wvif_iterate(wvif->wdev, wvif_it)) != NULL)
......
......@@ -18,8 +18,8 @@
#include "hif_api_cmd.h"
#include "hif_api_mib.h"
/* The hell below need some explanations. For each symbolic number, we need to
* define it with TRACE_DEFINE_ENUM() and in a list for __print_symbolic.
/* The hell below need some explanations. For each symbolic number, we need to define it with
* TRACE_DEFINE_ENUM() and in a list for __print_symbolic.
*
* 1. Define a new macro that call TRACE_DEFINE_ENUM():
*
......@@ -41,9 +41,8 @@
* #undef xxx_name
* #define xxx_name(msg) { msg, #msg },
*
* 5. list_name can now nearly be used with __print_symbolic() but,
* __print_symbolic() dislike last comma of list. So we define a new list
* with a dummy element:
* 5. list_name can now nearly be used with __print_symbolic() but, __print_symbolic() dislike
* last comma of list. So we define a new list with a dummy element:
*
* #define list_for_print_symbolic list_names { -1, NULL }
*/
......
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