summaryrefslogtreecommitdiff
path: root/drivers/staging/csr
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/csr')
-rw-r--r--drivers/staging/csr/bh.c2
-rw-r--r--drivers/staging/csr/csr_log.h6
-rw-r--r--drivers/staging/csr/csr_sdio.h24
-rw-r--r--drivers/staging/csr/csr_time.c8
-rw-r--r--drivers/staging/csr/csr_wifi_fsm.h6
-rw-r--r--drivers/staging/csr/csr_wifi_hip_card_sdio.c8
-rw-r--r--drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c10
-rw-r--r--drivers/staging/csr/csr_wifi_hip_chiphelper.h4
-rw-r--r--drivers/staging/csr/csr_wifi_hip_udi.c353
-rw-r--r--drivers/staging/csr/csr_wifi_hip_unifi.h20
-rw-r--r--drivers/staging/csr/csr_wifi_hip_unifi_udi.h17
-rw-r--r--drivers/staging/csr/drv.c8
-rw-r--r--drivers/staging/csr/io.c151
-rw-r--r--drivers/staging/csr/netdev.c2
-rw-r--r--drivers/staging/csr/sdio_mmc.c3
-rw-r--r--drivers/staging/csr/sme_native.c2
-rw-r--r--drivers/staging/csr/sme_wext.c3
-rw-r--r--drivers/staging/csr/unifi_pdu_processing.c20
-rw-r--r--drivers/staging/csr/unifi_sme.c2
19 files changed, 252 insertions, 397 deletions
diff --git a/drivers/staging/csr/bh.c b/drivers/staging/csr/bh.c
index 7b133597e923..b53a9e29a97c 100644
--- a/drivers/staging/csr/bh.c
+++ b/drivers/staging/csr/bh.c
@@ -373,7 +373,7 @@ CsrResult unifi_run_bh(void *ospriv)
unifi_priv_t *priv = ospriv;
/*
- * If an error has occured, we discard silently all messages from the bh
+ * If an error has occurred, we discard silently all messages from the bh
* until the error has been processed and the unifi has been reinitialised.
*/
if (priv->bh_thread.block_thread == 1) {
diff --git a/drivers/staging/csr/csr_log.h b/drivers/staging/csr/csr_log.h
index 5de5650767de..982941043ddc 100644
--- a/drivers/staging/csr/csr_log.h
+++ b/drivers/staging/csr/csr_log.h
@@ -34,7 +34,7 @@ typedef u32 CsrLogLevelEnvironment;
#define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_START ((CsrLogLevelEnvironment) 0x00000100) /* Background Interrupt start events are logged */
#define CSR_LOG_LEVEL_ENVIRONMENT_BGINT_DONE ((CsrLogLevelEnvironment) 0x00000200) /* Background Interrupt done events are logged */
#define CSR_LOG_LEVEL_ENVIRONMENT_PROTO ((CsrLogLevelEnvironment) 0x00000400) /* Transport protocol events are logged */
-#define CSR_LOG_LEVEL_ENVIRONMENT_PROTO_LOC ((CsrLogLevelEnvironment) 0x00000800) /* The Location where the transport protocol event occured are logged NB: This is a supplement to CSR_LOG_LEVEL_ENVIRONMENT_PROTO, it has no effect without it */
+#define CSR_LOG_LEVEL_ENVIRONMENT_PROTO_LOC ((CsrLogLevelEnvironment) 0x00000800) /* The Location where the transport protocol event occurred are logged NB: This is a supplement to CSR_LOG_LEVEL_ENVIRONMENT_PROTO, it has no effect without it */
/* The bit masks between here are reserved for future usage */
#define CSR_LOG_LEVEL_ENVIRONMENT_ALL ((CsrLogLevelEnvironment) 0xFFFFFFFF) /* All possible environment data/events are logged WARNING: By using this define the application also accepts future possible environment data/events in the logs */
@@ -44,10 +44,10 @@ typedef u32 CsrLogLevelEnvironment;
typedef u32 CsrLogLevelTask;
#define CSR_LOG_LEVEL_TASK_OFF ((CsrLogLevelTask) 0x00000000) /* No events are logged for this task */
#define CSR_LOG_LEVEL_TASK_TEXT ((CsrLogLevelTask) 0x00000001) /* Text strings printed by a task are logged NB: This bit does not affect the CSR_LOG_TEXT_LEVEL interface. This has to be configured separately */
-#define CSR_LOG_LEVEL_TASK_TEXT_LOC ((CsrLogLevelTask) 0x00000002) /* The locaction where the text string call occured are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_TEXT, it has no effect without it */
+#define CSR_LOG_LEVEL_TASK_TEXT_LOC ((CsrLogLevelTask) 0x00000002) /* The locaction where the text string call occurred are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_TEXT, it has no effect without it */
#define CSR_LOG_LEVEL_TASK_STATE ((CsrLogLevelTask) 0x00000004) /* FSM state transitions in a task are logged */
#define CSR_LOG_LEVEL_TASK_STATE_NAME ((CsrLogLevelTask) 0x00000008) /* The name of each state in a FSM state transition are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_STATE, it has no effect without it */
-#define CSR_LOG_LEVEL_TASK_STATE_LOC ((CsrLogLevelTask) 0x00000010) /* The location where the FSM state transition occured are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_STATE, it has no effect without it */
+#define CSR_LOG_LEVEL_TASK_STATE_LOC ((CsrLogLevelTask) 0x00000010) /* The location where the FSM state transition occurred are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_STATE, it has no effect without it */
#define CSR_LOG_LEVEL_TASK_TASK_SWITCH ((CsrLogLevelTask) 0x00000020) /* Activation and deactiation of a task are logged */
#define CSR_LOG_LEVEL_TASK_MESSAGE_PUT ((CsrLogLevelTask) 0x00000080) /* Message put operations are logged */
#define CSR_LOG_LEVEL_TASK_MESSAGE_PUT_LOC ((CsrLogLevelTask) 0x00000100) /* The location where a message was sent are logged. NB: This is a supplement to CSR_LOG_LEVEL_TASK_MESSAGE_PUT, it has no effect without it */
diff --git a/drivers/staging/csr/csr_sdio.h b/drivers/staging/csr/csr_sdio.h
index 624a53fa1d7e..0971d135abf6 100644
--- a/drivers/staging/csr/csr_sdio.h
+++ b/drivers/staging/csr/csr_sdio.h
@@ -257,7 +257,7 @@ void CsrSdioFunctionDriverUnregister(CsrSdioFunctionDriver *functionDriver);
* CSR_RESULT_SUCCESS - The specified function was enabled/disabled.
* CSR_RESULT_FAILURE - Unspecified/unknown error.
* CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
- * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. The state of the
+ * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred. The state of the
* related bit in the I/O Enable register is
* undefined.
* CSR_SDIO_RESULT_TIMEOUT - No response from the device, or the related
@@ -295,7 +295,7 @@ CsrResult CsrSdioFunctionDisable(CsrSdioFunction *function);
* CSR_RESULT_SUCCESS - The specified function was enabled/disabled.
* CSR_RESULT_FAILURE - Unspecified/unknown error.
* CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
- * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. The state of the
+ * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred. The state of the
* related bit in the INT Enable register is
* unchanged.
* CSR_SDIO_RESULT_INVALID_VALUE - The specified function cannot be
@@ -408,7 +408,7 @@ void CsrSdioResumeAcknowledge(CsrSdioFunction *function, CsrResult result);
* CSR_RESULT_FAILURE - Unspecified/unknown error.
* CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid.
* CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
- * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. The configured block
+ * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred. The configured block
* size is undefined.
* CSR_SDIO_RESULT_TIMEOUT - No response from the device.
*
@@ -456,7 +456,7 @@ CsrResult CsrSdioBlockSizeSet(CsrSdioFunction *function, u16 blockSize);
* maxFrequency - The maximum clock frequency for the function in Hertz.
*
* RETURNS
- * CSR_RESULT_SUCCESS - The maximum clock frequency was succesfully
+ * CSR_RESULT_SUCCESS - The maximum clock frequency was successfully
* set for the function.
* CSR_RESULT_FAILURE - Unspecified/unknown error.
* CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid.
@@ -494,7 +494,7 @@ CsrResult CsrSdioMaxBusClockFrequencySet(CsrSdioFunction *function, u32 maxFrequ
* CSR_RESULT_FAILURE - Unspecified/unknown error.
* CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid.
* CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
- * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. No data read/written.
+ * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred. No data read/written.
* CSR_SDIO_RESULT_TIMEOUT - No response from the device.
*
* NOTE: If the SDIO R5 response is available, and either of the
@@ -537,7 +537,7 @@ void CsrSdioWrite8Async(CsrSdioFunction *function, u32 address, u8 data, CsrSdio
* CSR_RESULT_FAILURE - Unspecified/unknown error.
* CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid.
* CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
- * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. Data may have been
+ * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred. Data may have been
* partially read/written.
* CSR_SDIO_RESULT_TIMEOUT - No response from the device.
*
@@ -583,7 +583,7 @@ void CsrSdioWrite16Async(CsrSdioFunction *function, u32 address, u16 data, CsrSd
* CSR_RESULT_FAILURE - Unspecified/unknown error.
* CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid.
* CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
- * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. No data read/written.
+ * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred. No data read/written.
* CSR_SDIO_RESULT_TIMEOUT - No response from the device.
*
* NOTE: If the SDIO R5 response is available, and either of the
@@ -628,7 +628,7 @@ void CsrSdioF0Write8Async(CsrSdioFunction *function, u32 address, u8 data, CsrSd
* CSR_RESULT_FAILURE - Unspecified/unknown error.
* CSR_SDIO_RESULT_INVALID_VALUE - One or more arguments were invalid.
* CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
- * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured. Data may have been
+ * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred. Data may have been
* partially read/written.
* CSR_SDIO_RESULT_TIMEOUT - No response from the device.
*
@@ -666,11 +666,11 @@ void CsrSdioWriteAsync(CsrSdioFunction *function, u32 address, const void *data,
* the device to power on/off.
*
* RETURNS (only CsrSdioPowerOn)
- * CSR_RESULT_SUCCESS - Power was succesfully reapplied and the device
+ * CSR_RESULT_SUCCESS - Power was successfully reapplied and the device
* has been reinitialised.
* CSR_RESULT_FAILURE - Unspecified/unknown error.
* CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
- * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured during reinitialisation.
+ * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred during reinitialisation.
* CSR_SDIO_RESULT_TIMEOUT - No response from the device during
* reinitialisation.
* CSR_SDIO_RESULT_NOT_RESET - The power was not removed by the
@@ -693,11 +693,11 @@ void CsrSdioPowerOff(CsrSdioFunction *function);
* the device to hard reset.
*
* RETURNS
- * CSR_RESULT_SUCCESS - Reset was succesfully performed and the device
+ * CSR_RESULT_SUCCESS - Reset was successfully performed and the device
* has been reinitialised.
* CSR_RESULT_FAILURE - Unspecified/unknown error.
* CSR_SDIO_RESULT_NO_DEVICE - The device does not exist anymore.
- * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occured during reinitialisation.
+ * CSR_SDIO_RESULT_CRC_ERROR - A CRC error occurred during reinitialisation.
* CSR_SDIO_RESULT_TIMEOUT - No response from the device during
* reinitialisation.
* CSR_SDIO_RESULT_NOT_RESET - The reset was not applied because it is not
diff --git a/drivers/staging/csr/csr_time.c b/drivers/staging/csr/csr_time.c
index f3f4a9c9c67a..01179e46f47d 100644
--- a/drivers/staging/csr/csr_time.c
+++ b/drivers/staging/csr/csr_time.c
@@ -1,10 +1,10 @@
/*****************************************************************************
- (c) Cambridge Silicon Radio Limited 2010
- All rights reserved and confidential information of CSR
+ (c) Cambridge Silicon Radio Limited 2010
+ All rights reserved and confidential information of CSR
- Refer to LICENSE.txt included with this source for details
- on the license terms.
+ Refer to LICENSE.txt included with this source for details
+ on the license terms.
*****************************************************************************/
diff --git a/drivers/staging/csr/csr_wifi_fsm.h b/drivers/staging/csr/csr_wifi_fsm.h
index fde1508c1eae..fc5c5aa6a3c4 100644
--- a/drivers/staging/csr/csr_wifi_fsm.h
+++ b/drivers/staging/csr/csr_wifi_fsm.h
@@ -70,7 +70,7 @@ extern CsrWifiFsmContext* CsrWifiFsmInit(void *applicationContext, void *externa
* This function is used to free any dynamic resources allocated for the
* given context by CsrWifiFsmInit().
* The FSM's reset function is called to cleanup any fsm specific memory
- * The reset funtion does NOT need to free the fsm data pointer as
+ * The reset function does NOT need to free the fsm data pointer as
* CsrWifiFsmShutdown() will do it.
* the FSM's init function is call again to reinitialise the FSM context.
* CsrWifiFsmReset() should NEVER be called when CsrWifiFsmExecute() is running.
@@ -91,7 +91,7 @@ extern void CsrWifiFsmReset(CsrWifiFsmContext *context);
* given context by CsrWifiFsmInit(), prior to complete termination of
* the program.
* The FSM's reset function is called to cleanup any fsm specific memory.
- * The reset funtion does NOT need to free the fsm data pointer as
+ * The reset function does NOT need to free the fsm data pointer as
* CsrWifiFsmShutdown() will do it.
* CsrWifiFsmShutdown() should NEVER be called when CsrWifiFsmExecute() is running.
*
@@ -203,7 +203,7 @@ extern void CsrWifiFsmFastForward(CsrWifiFsmContext *context, u16 ms);
* shift the current time of day by ms amount
*
* @par Description
- * usefull to speed up tests where time needs to pass
+ * useful to speed up tests where time needs to pass
*
* @param[in] context : FSM context
* @param[in] ms : ms to adjust time by
diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio.c b/drivers/staging/csr/csr_wifi_hip_card_sdio.c
index 25cabf3234c2..d5425325894c 100644
--- a/drivers/staging/csr/csr_wifi_hip_card_sdio.c
+++ b/drivers/staging/csr/csr_wifi_hip_card_sdio.c
@@ -559,7 +559,7 @@ static void _build_sdio_config_data(sdio_config_data_t *cfg_data,
* padding bytes. Every read from this memory has to be transformed in
* host (cpu specific) format, before it is stored in driver's parameters
* or/and structures. Athough unifi_card_read16() and unifi_read32() do perform
- * the convertion internally, unifi_readn() does not.
+ * the conversion internally, unifi_readn() does not.
* ---------------------------------------------------------------------------
*/
static CsrResult card_hw_init(card_t *card)
@@ -1332,7 +1332,7 @@ static CsrResult card_access_panic(card_t *card)
s32 i;
CsrResult r, sr;
- /* A chip version of zero means that the version never got succesfully read
+ /* A chip version of zero means that the version never got successfully read
* during reset. In this case give up because it will not be possible to
* verify the chip version.
*/
@@ -2446,7 +2446,7 @@ static CsrResult unifi_prepare_hw(card_t *card)
if (old_state == UNIFI_HOST_STATE_TORPID)
{
- /* Ensure the initial clock rate is set; if a reset occured when the chip was
+ /* Ensure the initial clock rate is set; if a reset occurred when the chip was
* TORPID, unifi_set_host_state() may have raised it to MAX.
*/
csrResult = CsrSdioMaxBusClockFrequencySet(card->sdio_if, UNIFI_SDIO_CLOCK_INIT_HZ);
@@ -2567,7 +2567,7 @@ static CsrResult unifi_reset_hardware(card_t *card)
csrResult = CsrSdioHardReset(card->sdio_if);
if (csrResult == CSR_RESULT_SUCCESS)
{
- unifi_info(card->ospriv, "CsrSdioHardReset succeeded on reseting UniFi\n");
+ unifi_info(card->ospriv, "CsrSdioHardReset succeeded on resetting UniFi\n");
r = unifi_prepare_hw(card);
if (r == CSR_WIFI_HIP_RESULT_NO_DEVICE)
{
diff --git a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c
index 97f645c06818..cfe186e07071 100644
--- a/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c
+++ b/drivers/staging/csr/csr_wifi_hip_card_sdio_intr.c
@@ -883,7 +883,7 @@ static CsrResult handle_host_protocol(card_t *card, u8 *processed_something)
r = read_to_host_signals(card, &done);
if (r != CSR_RESULT_SUCCESS)
{
- unifi_error(card->ospriv, "Error occured reading to-host signals\n");
+ unifi_error(card->ospriv, "Error occurred reading to-host signals\n");
return r;
}
if (done > 0)
@@ -899,7 +899,7 @@ static CsrResult handle_host_protocol(card_t *card, u8 *processed_something)
r = process_to_host_signals(card, &done);
if (r != CSR_RESULT_SUCCESS)
{
- unifi_error(card->ospriv, "Error occured processing to-host signals\n");
+ unifi_error(card->ospriv, "Error occurred processing to-host signals\n");
return r;
}
@@ -908,7 +908,7 @@ static CsrResult handle_host_protocol(card_t *card, u8 *processed_something)
r = process_fh_cmd_queue(card, &done);
if (r != CSR_RESULT_SUCCESS)
{
- unifi_error(card->ospriv, "Error occured processing from-host signals\n");
+ unifi_error(card->ospriv, "Error occurred processing from-host signals\n");
return r;
}
if (done > 0)
@@ -919,7 +919,7 @@ static CsrResult handle_host_protocol(card_t *card, u8 *processed_something)
r = process_fh_traffic_queue(card, &done);
if (r != CSR_RESULT_SUCCESS)
{
- unifi_error(card->ospriv, "Error occured processing from-host data signals\n");
+ unifi_error(card->ospriv, "Error occurred processing from-host data signals\n");
return r;
}
if (done > 0)
@@ -1953,7 +1953,7 @@ static CsrResult check_fh_sig_slots(card_t *card, u16 needed, s32 *space_fh)
* in the from-host queue using the wire-format structures, as they arrive.
* All other requests are stored in the from-host queue using the host
* (cpu specific) structures. We use the is_packed member of the card_signal_t
- * structure that describes the queue to make the distiction.
+ * structure that describes the queue to make the distinction.
* ---------------------------------------------------------------------------
*/
static CsrResult process_fh_cmd_queue(card_t *card, s32 *processed)
diff --git a/drivers/staging/csr/csr_wifi_hip_chiphelper.h b/drivers/staging/csr/csr_wifi_hip_chiphelper.h
index b6b67ee11db8..09b3aefcbced 100644
--- a/drivers/staging/csr/csr_wifi_hip_chiphelper.h
+++ b/drivers/staging/csr/csr_wifi_hip_chiphelper.h
@@ -354,7 +354,7 @@ CHIP_HELPER_LIST(C_DEC)
map that is part of the window and the size is the number of
visible words.
- Some of the windows have thier lowest portion covered by
+ Some of the windows have their lowest portion covered by
registers. For these windows address is the first address
after the registers and size is the siave excluding the part
covered by registers.
@@ -375,7 +375,7 @@ CHIP_HELPER_LIST(C_DEC)
will be needed if the device is being booted from cold. These
register writes enable the clocks and setup the PLL to a basic
working state. SPI access might be unreliable until these writes
- have occured (And they may take mulitple goes).
+ have occurred (And they may take mulitple goes).
*/
/* HostResetSequence
diff --git a/drivers/staging/csr/csr_wifi_hip_udi.c b/drivers/staging/csr/csr_wifi_hip_udi.c
index a65b822db698..a6b006b0e983 100644
--- a/drivers/staging/csr/csr_wifi_hip_udi.c
+++ b/drivers/staging/csr/csr_wifi_hip_udi.c
@@ -24,10 +24,50 @@
*
* ---------------------------------------------------------------------------
*/
+#include <linux/seq_file.h>
#include "csr_wifi_hip_unifi.h"
#include "csr_wifi_hip_card.h"
+static void unifi_print_unsafe_sdio_status(card_t *card, struct seq_file *m)
+{
+#ifdef CSR_UNSAFE_SDIO_ACCESS
+ s32 iostate;
+ CsrResult r;
+ static const char *const states[] = {
+ "AWAKE", "DROWSY", "TORPID"
+ };
+#define SHARED_READ_RETRY_LIMIT 10
+ u8 b;
+
+ seq_printf(m, "Host State: %s\n", states[card->host_state]);
+
+ r = unifi_check_io_status(card, &iostate);
+ if (iostate == 1) {
+ seq_puts(m, remaining, "I/O Check: F1 disabled\n");
+ } else {
+ if (iostate == 1) {
+ seq_puts(m, "I/O Check: pending interrupt\n");
+
+ seq_printf(m, "BH reason interrupt = %d\n", card->bh_reason_unifi);
+ seq_printf(m, "BH reason host = %d\n", card->bh_reason_host);
+
+ for (i = 0; i < SHARED_READ_RETRY_LIMIT; i++) {
+ r = unifi_read_8_or_16(card, card->sdio_ctrl_addr + 2, &b);
+ if (r == CSR_RESULT_SUCCESS && !(b & 0x80)) {
+ seq_printf(m, "fhsr: %u (driver thinks is %u)\n",
+ b, card->from_host_signals_r);
+ break;
+ }
+ }
+
+ iostate = unifi_read_shared_count(card, card->sdio_ctrl_addr + 4);
+ seq_printf(m, "thsw: %u (driver thinks is %u)\n",
+ iostate, card->to_host_signals_w);
+ }
+#endif
+}
+
/*
* ---------------------------------------------------------------------------
* unifi_print_status
@@ -41,228 +81,93 @@
* None.
* ---------------------------------------------------------------------------
*/
-s32 unifi_print_status(card_t *card, char *str, s32 *remain)
+s32 unifi_print_status(card_t *card, struct seq_file *m)
{
- char *p = str;
- sdio_config_data_t *cfg;
- u16 i, n;
- s32 remaining = *remain;
- s32 written;
-#ifdef CSR_UNSAFE_SDIO_ACCESS
- s32 iostate;
- CsrResult r;
- static const char *const states[] = {
- "AWAKE", "DROWSY", "TORPID"
- };
- #define SHARED_READ_RETRY_LIMIT 10
- u8 b;
-#endif
-
- if (remaining <= 0)
- {
- return 0;
- }
-
- i = n = 0;
- written = scnprintf(p, remaining, "Chip ID %u\n",
- (u16)card->chip_id);
- UNIFI_SNPRINTF_RET(p, remaining, written);
- written = scnprintf(p, remaining, "Chip Version %04X\n",
- card->chip_version);
- UNIFI_SNPRINTF_RET(p, remaining, written);
- written = scnprintf(p, remaining, "HIP v%u.%u\n",
- (card->config_data.version >> 8) & 0xFF,
- card->config_data.version & 0xFF);
- UNIFI_SNPRINTF_RET(p, remaining, written);
- written = scnprintf(p, remaining, "Build %u: %s\n",
- card->build_id, card->build_id_string);
- UNIFI_SNPRINTF_RET(p, remaining, written);
-
- cfg = &card->config_data;
-
- written = scnprintf(p, remaining, "sdio ctrl offset %u\n",
- cfg->sdio_ctrl_offset);
- UNIFI_SNPRINTF_RET(p, remaining, written);
- written = scnprintf(p, remaining, "fromhost sigbuf handle %u\n",
- cfg->fromhost_sigbuf_handle);
- UNIFI_SNPRINTF_RET(p, remaining, written);
- written = scnprintf(p, remaining, "tohost_sigbuf_handle %u\n",
- cfg->tohost_sigbuf_handle);
- UNIFI_SNPRINTF_RET(p, remaining, written);
- written = scnprintf(p, remaining, "num_fromhost_sig_frags %u\n",
- cfg->num_fromhost_sig_frags);
- UNIFI_SNPRINTF_RET(p, remaining, written);
- written = scnprintf(p, remaining, "num_tohost_sig_frags %u\n",
- cfg->num_tohost_sig_frags);
- UNIFI_SNPRINTF_RET(p, remaining, written);
- written = scnprintf(p, remaining, "num_fromhost_data_slots %u\n",
- cfg->num_fromhost_data_slots);
- UNIFI_SNPRINTF_RET(p, remaining, written);
- written = scnprintf(p, remaining, "num_tohost_data_slots %u\n",
- cfg->num_tohost_data_slots);
- UNIFI_SNPRINTF_RET(p, remaining, written);
- written = scnprintf(p, remaining, "data_slot_size %u\n",
- cfg->data_slot_size);
- UNIFI_SNPRINTF_RET(p, remaining, written);
-
- /* Added by protocol version 0x0001 */
- written = scnprintf(p, remaining, "overlay_size %u\n",
- (u16)cfg->overlay_size);
- UNIFI_SNPRINTF_RET(p, remaining, written);
-
- /* Added by protocol version 0x0300 */
- written = scnprintf(p, remaining, "data_slot_round %u\n",
- cfg->data_slot_round);
- UNIFI_SNPRINTF_RET(p, remaining, written);
- written = scnprintf(p, remaining, "sig_frag_size %u\n",
- cfg->sig_frag_size);
- UNIFI_SNPRINTF_RET(p, remaining, written);
-
- /* Added by protocol version 0x0300 */
- written = scnprintf(p, remaining, "tohost_sig_pad %u\n",
- cfg->tohost_signal_padding);
- UNIFI_SNPRINTF_RET(p, remaining, written);
-
- written = scnprintf(p, remaining, "\nInternal state:\n");
- UNIFI_SNPRINTF_RET(p, remaining, written);
-
- written = scnprintf(p, remaining, "Last PHY PANIC: %04x:%04x\n",
- card->last_phy_panic_code, card->last_phy_panic_arg);
- UNIFI_SNPRINTF_RET(p, remaining, written);
- written = scnprintf(p, remaining, "Last MAC PANIC: %04x:%04x\n",
- card->last_mac_panic_code, card->last_mac_panic_arg);
- UNIFI_SNPRINTF_RET(p, remaining, written);
-
- written = scnprintf(p, remaining, "fhsr: %u\n",
- (u16)card->from_host_signals_r);
- UNIFI_SNPRINTF_RET(p, remaining, written);
- written = scnprintf(p, remaining, "fhsw: %u\n",
- (u16)card->from_host_signals_w);
- UNIFI_SNPRINTF_RET(p, remaining, written);
- written = scnprintf(p, remaining, "thsr: %u\n",
- (u16)card->to_host_signals_r);
- UNIFI_SNPRINTF_RET(p, remaining, written);
- written = scnprintf(p, remaining, "thsw: %u\n",
- (u16)card->to_host_signals_w);
- UNIFI_SNPRINTF_RET(p, remaining, written);
- written = scnprintf(p, remaining,
- "fh buffer contains: %d signals, %td bytes\n",
- card->fh_buffer.count,
- card->fh_buffer.ptr - card->fh_buffer.buf);
- UNIFI_SNPRINTF_RET(p, remaining, written);
-
- written = scnprintf(p, remaining, "paused: ");
- UNIFI_SNPRINTF_RET(p, remaining, written);
- for (i = 0; i < sizeof(card->tx_q_paused_flag) / sizeof(card->tx_q_paused_flag[0]); i++)
- {
- written = scnprintf(p, remaining, card->tx_q_paused_flag[i]?"1" : "0");
- UNIFI_SNPRINTF_RET(p, remaining, written);
- }
- written = scnprintf(p, remaining, "\n");
- UNIFI_SNPRINTF_RET(p, remaining, written);
-
- written = scnprintf(p, remaining,
- "fh command q: %u waiting, %u free of %u:\n",
- CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_command_queue),
- CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_command_queue),
- UNIFI_SOFT_COMMAND_Q_LENGTH);
- UNIFI_SNPRINTF_RET(p, remaining, written);
- for (i = 0; i < UNIFI_NO_OF_TX_QS; i++)
- {
- written = scnprintf(p, remaining,
- "fh traffic q[%u]: %u waiting, %u free of %u:\n",
- i,
- CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_traffic_queue[i]),
- CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_traffic_queue[i]),
- UNIFI_SOFT_TRAFFIC_Q_LENGTH);
- UNIFI_SNPRINTF_RET(p, remaining, written);
- }
-
- written = scnprintf(p, remaining, "fh data slots free: %u\n",
- card->from_host_data?CardGetFreeFromHostDataSlots(card) : 0);
- UNIFI_SNPRINTF_RET(p, remaining, written);
-
-
- written = scnprintf(p, remaining, "From host data slots:");
- UNIFI_SNPRINTF_RET(p, remaining, written);
- n = card->config_data.num_fromhost_data_slots;
- for (i = 0; i < n && card->from_host_data; i++)
- {
- written = scnprintf(p, remaining, " %u",
- (u16)card->from_host_data[i].bd.data_length);
- UNIFI_SNPRINTF_RET(p, remaining, written);
- }
- written = scnprintf(p, remaining, "\n");
- UNIFI_SNPRINTF_RET(p, remaining, written);
-
- written = scnprintf(p, remaining, "To host data slots:");
- UNIFI_SNPRINTF_RET(p, remaining, written);
- n = card->config_data.num_tohost_data_slots;
- for (i = 0; i < n && card->to_host_data; i++)
- {
- written = scnprintf(p, remaining, " %u",
- (u16)card->to_host_data[i].data_length);
- UNIFI_SNPRINTF_RET(p, remaining, written);
- }
-
- written = scnprintf(p, remaining, "\n");
- UNIFI_SNPRINTF_RET(p, remaining, written);
-
-#ifdef CSR_UNSAFE_SDIO_ACCESS
- written = scnprintf(p, remaining, "Host State: %s\n", states[card->host_state]);
- UNIFI_SNPRINTF_RET(p, remaining, written);
-
- r = unifi_check_io_status(card, &iostate);
- if (iostate == 1)
- {
- written = scnprintf(p, remaining, "I/O Check: F1 disabled\n");
- UNIFI_SNPRINTF_RET(p, remaining, written);
- }
- else
- {
- if (iostate == 1)
- {
- written = scnprintf(p, remaining, "I/O Check: pending interrupt\n");
- UNIFI_SNPRINTF_RET(p, remaining, written);
- }
-
- written = scnprintf(p, remaining, "BH reason interrupt = %d\n",
- card->bh_reason_unifi);
- UNIFI_SNPRINTF_RET(p, remaining, written);
- written = scnprintf(p, remaining, "BH reason host = %d\n",
- card->bh_reason_host);
- UNIFI_SNPRINTF_RET(p, remaining, written);
-
- for (i = 0; i < SHARED_READ_RETRY_LIMIT; i++)
- {
- r = unifi_read_8_or_16(card, card->sdio_ctrl_addr + 2, &b);
- if ((r == CSR_RESULT_SUCCESS) && (!(b & 0x80)))
- {
- written = scnprintf(p, remaining, "fhsr: %u (driver thinks is %u)\n",
- b, card->from_host_signals_r);
- UNIFI_SNPRINTF_RET(p, remaining, written);
- break;
- }
- }
- iostate = unifi_read_shared_count(card, card->sdio_ctrl_addr + 4);
- written = scnprintf(p, remaining, "thsw: %u (driver thinks is %u)\n",
- iostate, card->to_host_signals_w);
- UNIFI_SNPRINTF_RET(p, remaining, written);
- }
-#endif
-
- written = scnprintf(p, remaining, "\nStats:\n");
- UNIFI_SNPRINTF_RET(p, remaining, written);
- written = scnprintf(p, remaining, "Total SDIO bytes: R=%u W=%u\n",
- card->sdio_bytes_read, card->sdio_bytes_written);
-
- UNIFI_SNPRINTF_RET(p, remaining, written);
- written = scnprintf(p, remaining, "Interrupts generated on card: %u\n",
- card->unifi_interrupt_seq);
- UNIFI_SNPRINTF_RET(p, remaining, written);
-
- *remain = remaining;
- return (p - str);
-} /* unifi_print_status() */
-
-
+ sdio_config_data_t *cfg;
+ u16 i, n;
+
+ i = n = 0;
+ seq_printf(m, "Chip ID %u\n", card->chip_id);
+ seq_printf(m, "Chip Version %04X\n", card->chip_version);
+ seq_printf(m, "HIP v%u.%u\n",
+ (card->config_data.version >> 8) & 0xFF,
+ card->config_data.version & 0xFF);
+ seq_printf(m, "Build %u: %s\n", card->build_id, card->build_id_string);
+
+ cfg = &card->config_data;
+
+ seq_printf(m, "sdio ctrl offset %u\n", cfg->sdio_ctrl_offset);
+ seq_printf(m, "fromhost sigbuf handle %u\n", cfg->fromhost_sigbuf_handle);
+ seq_printf(m, "tohost_sigbuf_handle %u\n", cfg->tohost_sigbuf_handle);
+ seq_printf(m, "num_fromhost_sig_frags %u\n", cfg->num_fromhost_sig_frags);
+ seq_printf(m, "num_tohost_sig_frags %u\n", cfg->num_tohost_sig_frags);
+ seq_printf(m, "num_fromhost_data_slots %u\n", cfg->num_fromhost_data_slots);
+ seq_printf(m, "num_tohost_data_slots %u\n", cfg->num_tohost_data_slots);
+ seq_printf(m, "data_slot_size %u\n", cfg->data_slot_size);
+
+ /* Added by protocol version 0x0001 */
+ seq_printf(m, "overlay_size %u\n", cfg->overlay_size);
+
+ /* Added by protocol version 0x0300 */
+ seq_printf(m, "data_slot_round %u\n", cfg->data_slot_round);
+ seq_printf(m, "sig_frag_size %u\n", cfg->sig_frag_size);
+
+ /* Added by protocol version 0x0300 */
+ seq_printf(m, "tohost_sig_pad %u\n", cfg->tohost_signal_padding);
+
+ seq_puts(m, "\nInternal state:\n");
+
+ seq_printf(m, "Last PHY PANIC: %04x:%04x\n",
+ card->last_phy_panic_code, card->last_phy_panic_arg);
+ seq_printf(m, "Last MAC PANIC: %04x:%04x\n",
+ card->last_mac_panic_code, card->last_mac_panic_arg);
+
+ seq_printf(m, "fhsr: %hu\n", (u16)card->from_host_signals_r);
+ seq_printf(m, "fhsw: %hu\n", (u16)card->from_host_signals_w);
+ seq_printf(m, "thsr: %hu\n", (u16)card->to_host_signals_r);
+ seq_printf(m, "thsw: %hu\n", (u16)card->to_host_signals_w);
+ seq_printf(m, "fh buffer contains: %d signals, %td bytes\n",
+ card->fh_buffer.count,
+ card->fh_buffer.ptr - card->fh_buffer.buf);
+
+ seq_puts(m, "paused: ");
+ for (i = 0; i < ARRAY_SIZE(card->tx_q_paused_flag); i++)
+ seq_printf(m, card->tx_q_paused_flag[i] ? "1" : "0");
+ seq_putc(m, '\n');
+
+ seq_printf(m, "fh command q: %u waiting, %u free of %u:\n",
+ CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_command_queue),
+ CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_command_queue),
+ UNIFI_SOFT_COMMAND_Q_LENGTH);
+
+ for (i = 0; i < UNIFI_NO_OF_TX_QS; i++)
+ seq_printf(m, "fh traffic q[%u]: %u waiting, %u free of %u:\n",
+ i,
+ CSR_WIFI_HIP_Q_SLOTS_USED(&card->fh_traffic_queue[i]),
+ CSR_WIFI_HIP_Q_SLOTS_FREE(&card->fh_traffic_queue[i]),
+ UNIFI_SOFT_TRAFFIC_Q_LENGTH);
+
+ seq_printf(m, "fh data slots free: %u\n",
+ card->from_host_data ? CardGetFreeFromHostDataSlots(card) : 0);
+
+ seq_puts(m, "From host data slots:");
+ n = card->config_data.num_fromhost_data_slots;
+ for (i = 0; i < n && card->from_host_data; i++)
+ seq_printf(m, " %hu", (u16)card->from_host_data[i].bd.data_length);
+ seq_putc(m, '\n');
+
+ seq_puts(m, "To host data slots:");
+ n = card->config_data.num_tohost_data_slots;
+ for (i = 0; i < n && card->to_host_data; i++)
+ seq_printf(m, " %hu", (u16)card->to_host_data[i].data_length);
+ seq_putc(m, '\n');
+
+ unifi_print_unsafe_sdio_status(card, m);
+
+ seq_puts(m, "\nStats:\n");
+ seq_printf(m, "Total SDIO bytes: R=%u W=%u\n",
+ card->sdio_bytes_read, card->sdio_bytes_written);
+
+ seq_printf(m, "Interrupts generated on card: %u\n", card->unifi_interrupt_seq);
+ return 0;
+}
diff --git a/drivers/staging/csr/csr_wifi_hip_unifi.h b/drivers/staging/csr/csr_wifi_hip_unifi.h
index c2a2231680f5..1160a0e25c7d 100644
--- a/drivers/staging/csr/csr_wifi_hip_unifi.h
+++ b/drivers/staging/csr/csr_wifi_hip_unifi.h
@@ -117,9 +117,9 @@ typedef enum
UNIFI_TRAFFIC_Q_BE,
UNIFI_TRAFFIC_Q_VI,
UNIFI_TRAFFIC_Q_VO,
- UNIFI_TRAFFIC_Q_EAPOL, /* Non existant in HIP */
- UNIFI_TRAFFIC_Q_MAX, /* Non existant */
- UNIFI_TRAFFIC_Q_MLME /* Non existant */
+ UNIFI_TRAFFIC_Q_EAPOL, /* Non existent in HIP */
+ UNIFI_TRAFFIC_Q_MAX, /* Non existent */
+ UNIFI_TRAFFIC_Q_MLME /* Non existent */
} unifi_TrafficQueue;
/*
@@ -263,7 +263,7 @@ card_t* unifi_alloc_card(CsrSdioFunction *sdiopriv, void *ospriv);
*
* @return \b 0 if UniFi is initialized.
*
- * @return \b -CSR_EIO if an I/O error occured while initializing UniFi
+ * @return \b -CSR_EIO if an I/O error occurred while initializing UniFi
*
* @return \b -CSR_ENODEV if the card is no longer present.
*
@@ -311,7 +311,7 @@ void unifi_cancel_pending_signals(card_t *card);
*
* @return \b 0 signal is sent.
*
- * @return \b -CSR_EIO if an error occured while sending the signal
+ * @return \b -CSR_EIO if an error occurred while sending the signal
*
* @return \b -CSR_ENODEV if the card is no longer present.
*
@@ -361,7 +361,7 @@ void unifi_card_info(card_t *card, card_info_t *card_info);
*
* @return \b 0 if the check was performed.
*
- * @return \b -CSR_EIO if an error occured while checking the status.
+ * @return \b -CSR_EIO if an error occurred while checking the status.
*
* @return \b -CSR_ENODEV if the card is no longer present.
*
@@ -383,11 +383,11 @@ CsrResult unifi_check_io_status(card_t *card, s32 *status);
* is required. If unifi_bh() is called before the timeout expires,
* the caller must pass in the remaining time.
*
- * @return \b 0 if no error occured.
+ * @return \b 0 if no error occurred.
*
* @return \b -CSR_ENODEV if the card is no longer present.
*
- * @return \b -CSR_E* if an error occured while running the bottom half.
+ * @return \b -CSR_E* if an error occurred while running the bottom half.
*
* @ingroup upperedge
*/
@@ -439,7 +439,7 @@ enum unifi_periodic_wake_mode
*
* @param periodic_wake_mode the Periodic Wake Mode.
*
- * @return \b 0 if no error occured.
+ * @return \b 0 if no error occurred.
*
* @return \b -CSR_E* if the request failed.
*
@@ -458,7 +458,7 @@ CsrResult unifi_configure_low_power_mode(card_t *card,
*
* @param card the HIP core lib API context.
*
- * @return \b 0 if no error occured.
+ * @return \b 0 if no error occurred.
*
* @return \b -CSR_ENODEV if the card is no longer present.
*
diff --git a/drivers/staging/csr/csr_wifi_hip_unifi_udi.h b/drivers/staging/csr/csr_wifi_hip_unifi_udi.h
index 9d85cfd57616..4126e85bfe9b 100644
--- a/drivers/staging/csr/csr_wifi_hip_unifi_udi.h
+++ b/drivers/staging/csr/csr_wifi_hip_unifi_udi.h
@@ -47,21 +47,6 @@ CsrResult unifi_remove_udi_hook(card_t *card, udi_func_t udi_fn);
* This is used in the linux /proc interface and might be useful
* in other systems.
*/
-s32 unifi_print_status(card_t *card, char *str, s32 *remain);
-
-#define UNIFI_SNPRINTF_RET(buf_p, remain, written) \
- do { \
- if (written >= remain) { \
- if (remain >= 2) { \
- buf_p[remain - 2] = '\n'; \
- buf_p[remain - 1] = 0; \
- } \
- buf_p += remain; \
- remain = 0; \
- } else if (written > 0) { \
- buf_p += written; \
- remain -= written; \
- } \
- } while (0)
+s32 unifi_print_status(card_t *card, struct seq_file *m);
#endif /* __CSR_WIFI_HIP_UNIFI_UDI_H__ */
diff --git a/drivers/staging/csr/drv.c b/drivers/staging/csr/drv.c
index 3bd52fdeac3b..bdc25236ab00 100644
--- a/drivers/staging/csr/drv.c
+++ b/drivers/staging/csr/drv.c
@@ -1815,7 +1815,7 @@ udi_log_event(ul_client_t *pcli,
}
/* Allocate log structure plus actual signal. */
- logptr = (udi_log_t *)kmalloc(sizeof(udi_log_t) + total_len, GFP_KERNEL);
+ logptr = kmalloc(sizeof(udi_log_t) + total_len, GFP_KERNEL);
if (logptr == NULL) {
printk(KERN_ERR
@@ -1890,7 +1890,7 @@ uf_sme_queue_message(unifi_priv_t *priv, u8 *buffer, int length)
}
/* Allocate log structure plus actual signal. */
- logptr = (udi_log_t *)kmalloc(sizeof(udi_log_t) + length, GFP_ATOMIC);
+ logptr = kmalloc(sizeof(udi_log_t) + length, GFP_ATOMIC);
if (logptr == NULL) {
unifi_error(priv, "Failed to allocate %d bytes for an SME message\n",
sizeof(udi_log_t) + length);
@@ -1941,7 +1941,7 @@ uf_sme_queue_message(unifi_priv_t *priv, u8 *buffer, int length)
*
****************************************************************************
*/
-static struct file_operations unifi_fops = {
+static const struct file_operations unifi_fops = {
.owner = THIS_MODULE,
.open = unifi_open,
.release = unifi_release,
@@ -2041,7 +2041,7 @@ void uf_destroy_device_nodes(unifi_priv_t *priv)
* ----------------------------------------------------------------
*/
static int
-uf_create_debug_device(struct file_operations *fops)
+uf_create_debug_device(const struct file_operations *fops)
{
int ret;
diff --git a/drivers/staging/csr/io.c b/drivers/staging/csr/io.c
index af9c28f073b9..f9b5c22c00b8 100644
--- a/drivers/staging/csr/io.c
+++ b/drivers/staging/csr/io.c
@@ -31,6 +31,7 @@
* ---------------------------------------------------------------------------
*/
#include <linux/proc_fs.h>
+#include <linux/seq_file.h>
#include "csr_wifi_hip_unifi.h"
#include "csr_wifi_hip_unifiversion.h"
@@ -76,9 +77,28 @@ DEFINE_SEMAPHORE(Unifi_instance_mutex);
*/
DECLARE_WAIT_QUEUE_HEAD(Unifi_cleanup_wq);
+#ifdef CONFIG_PROC_FS
+/*
+ * seq_file wrappers for procfile show routines.
+ */
+static int uf_proc_show(struct seq_file *m, void *v);
+
+#define UNIFI_DEBUG_TXT_BUFFER (8 * 1024)
+
+static int uf_proc_open(struct inode *inode, struct file *file)
+{
+ return single_open_size(file, uf_proc_show, PDE_DATA(inode),
+ UNIFI_DEBUG_TXT_BUFFER);
+}
+
+static const struct file_operations uf_proc_fops = {
+ .open = uf_proc_open,
+ .read = seq_read,
+ .llseek = seq_lseek,
+ .release = seq_release,
+};
-static int uf_read_proc(char *page, char **start, off_t offset, int count,
- int *eof, void *data);
+#endif /* CONFIG_PROC_FS */
#ifdef CSR_WIFI_RX_PATH_SPLIT
@@ -327,8 +347,8 @@ register_unifi_sdio(CsrSdioFunction *sdio_dev, int bus_id, struct device *dev)
* The following complex casting is in place in order to eliminate 64-bit compilation warning
* "cast to/from pointer from/to integer of different size"
*/
- if (!create_proc_read_entry(priv->proc_entry_name, 0, 0,
- uf_read_proc, (void *)(long)priv->instance))
+ if (!proc_create_data(priv->proc_entry_name, 0, NULL,
+ &uf_proc_fops, (void *)(long)priv->instance))
{
unifi_error(priv, "unifi: can't create /proc/driver/unifi\n");
}
@@ -827,7 +847,7 @@ uf_put_instance(int inst)
/*
* ---------------------------------------------------------------------------
- * uf_read_proc
+ * uf_proc_show
*
* Read method for driver node in /proc/driver/unifi0
*
@@ -844,107 +864,54 @@ uf_put_instance(int inst)
* ---------------------------------------------------------------------------
*/
#ifdef CONFIG_PROC_FS
-static int
-uf_read_proc(char *page, char **start, off_t offset, int count,
- int *eof, void *data)
+static int uf_proc_show(struct seq_file *m, void *v)
{
-#define UNIFI_DEBUG_TXT_BUFFER 8*1024
- unifi_priv_t *priv;
- int actual_amount_to_copy;
- char *p, *orig_p;
- s32 remain = UNIFI_DEBUG_TXT_BUFFER;
- s32 written;
- int i;
-
- /*
- * The following complex casting is in place in order to eliminate 64-bit compilation warning
- * "cast to/from pointer from/to integer of different size"
- */
- priv = uf_find_instance((int)(long)data);
- if (!priv) {
- return 0;
- }
-
- p = kmalloc( UNIFI_DEBUG_TXT_BUFFER, GFP_KERNEL );
-
- orig_p = p;
-
- written = scnprintf(p, remain, "UniFi SDIO Driver: %s %s %s\n",
- CSR_WIFI_VERSION, __DATE__, __TIME__);
- UNIFI_SNPRINTF_RET(p, remain, written);
+ unifi_priv_t *priv;
+ int i;
+
+ /*
+ * The following complex casting is in place in order to eliminate
+ * 64-bit compilation warning "cast to/from pointer from/to integer of
+ * different size"
+ */
+ priv = uf_find_instance((long)m->private);
+ if (!priv)
+ return 0;
+
+ seq_printf(m, "UniFi SDIO Driver: %s %s %s\n",
+ CSR_WIFI_VERSION, __DATE__, __TIME__);
#ifdef CSR_SME_USERSPACE
- written = scnprintf(p, remain, "SME: CSR userspace ");
- UNIFI_SNPRINTF_RET(p, remain, written);
+ seq_puts(m, "SME: CSR userspace ");
#ifdef CSR_SUPPORT_WEXT
- written = scnprintf(p, remain, "with WEXT support\n");
+ seq_puts(m, "with WEXT support\n");
#else
- written = scnprintf(p, remain, "\n");
+ seq_putc(m, '\n');
#endif /* CSR_SUPPORT_WEXT */
- UNIFI_SNPRINTF_RET(p, remain, written);
#endif /* CSR_SME_USERSPACE */
#ifdef CSR_NATIVE_LINUX
- written = scnprintf(p, remain, "SME: native\n");
- UNIFI_SNPRINTF_RET(p, remain, written);
+ seq_puts(m, "SME: native\n");
#endif
#ifdef CSR_SUPPORT_SME
- written = scnprintf(p, remain,
- "Firmware (ROM) build:%u, Patch:%u\n",
- priv->card_info.fw_build,
- priv->sme_versions.firmwarePatch);
- UNIFI_SNPRINTF_RET(p, remain, written);
+ seq_printf(m, "Firmware (ROM) build:%u, Patch:%u\n",
+ priv->card_info.fw_build,
+ priv->sme_versions.firmwarePatch);
#endif
- p += unifi_print_status(priv->card, p, &remain);
-
- written = scnprintf(p, remain, "Last dbg str: %s\n",
- priv->last_debug_string);
- UNIFI_SNPRINTF_RET(p, remain, written);
-
- written = scnprintf(p, remain, "Last dbg16:");
- UNIFI_SNPRINTF_RET(p, remain, written);
- for (i = 0; i < 8; i++) {
- written = scnprintf(p, remain, " %04X",
- priv->last_debug_word16[i]);
- UNIFI_SNPRINTF_RET(p, remain, written);
- }
- written = scnprintf(p, remain, "\n");
- UNIFI_SNPRINTF_RET(p, remain, written);
- written = scnprintf(p, remain, " ");
- UNIFI_SNPRINTF_RET(p, remain, written);
- for (; i < 16; i++) {
- written = scnprintf(p, remain, " %04X",
- priv->last_debug_word16[i]);
- UNIFI_SNPRINTF_RET(p, remain, written);
- }
- written = scnprintf(p, remain, "\n");
- UNIFI_SNPRINTF_RET(p, remain, written);
- *start = page;
-
- written = UNIFI_DEBUG_TXT_BUFFER - remain;
-
- if( offset >= written )
- {
- *eof = 1;
- kfree( orig_p );
- return(0);
- }
-
- if( offset + count > written )
- {
- actual_amount_to_copy = written - offset;
- *eof = 1;
- }
- else
- {
- actual_amount_to_copy = count;
- }
- memcpy( page, &(orig_p[offset]), actual_amount_to_copy );
+ unifi_print_status(priv->card, m);
- kfree( orig_p );
+ seq_printf(m, "Last dbg str: %s\n", priv->last_debug_string);
- return( actual_amount_to_copy );
-} /* uf_read_proc() */
+ seq_puts(m, "Last dbg16:");
+ for (i = 0; i < 8; i++)
+ seq_printf(m, " %04X", priv->last_debug_word16[i]);
+ seq_putc(m, '\n');
+ seq_puts(m, " ");
+ for (; i < 16; i++)
+ seq_printf(m, " %04X", priv->last_debug_word16[i]);
+ seq_putc(m, '\n');
+ return 0;
+}
#endif
diff --git a/drivers/staging/csr/netdev.c b/drivers/staging/csr/netdev.c
index 7dad26f70175..a0177d998978 100644
--- a/drivers/staging/csr/netdev.c
+++ b/drivers/staging/csr/netdev.c
@@ -2365,7 +2365,7 @@ unifi_rx(unifi_priv_t *priv, CSR_SIGNAL *signal, bulk_data_param_t *bulkdata)
rx_buffered_packets_t *rx_q_item;
struct list_head *rx_list;
- rx_q_item = (rx_buffered_packets_t *)kmalloc(sizeof(rx_buffered_packets_t),
+ rx_q_item = kmalloc(sizeof(rx_buffered_packets_t),
GFP_KERNEL);
if (rx_q_item == NULL) {
unifi_error(priv, "%s: Failed to allocate %d bytes for rx packet record\n",
diff --git a/drivers/staging/csr/sdio_mmc.c b/drivers/staging/csr/sdio_mmc.c
index b6a16de08f4e..30271d35af55 100644
--- a/drivers/staging/csr/sdio_mmc.c
+++ b/drivers/staging/csr/sdio_mmc.c
@@ -1031,8 +1031,7 @@ uf_glue_sdio_probe(struct sdio_func *func,
sdio_func_id(func), instance);
/* Allocate context */
- sdio_ctx = (CsrSdioFunction *)kmalloc(sizeof(CsrSdioFunction),
- GFP_KERNEL);
+ sdio_ctx = kmalloc(sizeof(CsrSdioFunction), GFP_KERNEL);
if (sdio_ctx == NULL) {
sdio_release_host(func);
return -ENOMEM;
diff --git a/drivers/staging/csr/sme_native.c b/drivers/staging/csr/sme_native.c
index 525fe1bce0e6..ca55249bde3e 100644
--- a/drivers/staging/csr/sme_native.c
+++ b/drivers/staging/csr/sme_native.c
@@ -273,7 +273,7 @@ sme_native_log_event(ul_client_t *pcli,
}
/* Allocate log structure plus actual signal. */
- logptr = (udi_log_t *)kmalloc(sizeof(udi_log_t) + total_len, GFP_KERNEL);
+ logptr = kmalloc(sizeof(udi_log_t) + total_len, GFP_KERNEL);
if (logptr == NULL) {
unifi_error(priv,
diff --git a/drivers/staging/csr/sme_wext.c b/drivers/staging/csr/sme_wext.c
index 5e06a380b40a..4129a6436b76 100644
--- a/drivers/staging/csr/sme_wext.c
+++ b/drivers/staging/csr/sme_wext.c
@@ -1273,7 +1273,6 @@ unifi_siwscan(struct net_device *dev, struct iw_request_info *info,
{
netInterface_priv_t *interfacePriv = (netInterface_priv_t *)netdev_priv(dev);
unifi_priv_t *priv = interfacePriv->privPtr;
- int scantype;
int r;
CsrWifiSsid scan_ssid;
unsigned char *channel_list = NULL;
@@ -1293,8 +1292,6 @@ unifi_siwscan(struct net_device *dev, struct iw_request_info *info,
}
- scantype = UNIFI_SCAN_ACTIVE;
-
#if WIRELESS_EXT > 17
/* Providing a valid channel list will force an active scan */
if (req) {
diff --git a/drivers/staging/csr/unifi_pdu_processing.c b/drivers/staging/csr/unifi_pdu_processing.c
index 95efc360cc2d..f9b421b5aa35 100644
--- a/drivers/staging/csr/unifi_pdu_processing.c
+++ b/drivers/staging/csr/unifi_pdu_processing.c
@@ -403,7 +403,7 @@ CsrResult enque_tx_data_pdu(unifi_priv_t *priv, bulk_data_param_t *bulkdata,
- tx_q_item = (tx_buffered_packets_t *)kmalloc(sizeof(tx_buffered_packets_t), GFP_ATOMIC);
+ tx_q_item = kmalloc(sizeof(tx_buffered_packets_t), GFP_ATOMIC);
if (tx_q_item == NULL) {
unifi_error(priv,
"Failed to allocate %d bytes for tx packet record\n",
@@ -1468,7 +1468,7 @@ static int update_macheader(unifi_priv_t *priv, struct sk_buff *skb,
}
}
- /* prepare the complete skb, by pushing the MAC header to the begining of the skb->data */
+ /* prepare the complete skb, by pushing the MAC header to the beginning of the skb->data */
unifi_trace(priv, UDBG5, "updated Mac Header: %d \n",macHeaderLengthInBytes);
memcpy(bufPtr, macHeaderBuf, macHeaderLengthInBytes);
@@ -1546,7 +1546,7 @@ uf_ap_process_data_pdu(unifi_priv_t *priv, struct sk_buff *skb,
return -1;
}
- /* fetch the destination record from staion record database */
+ /* fetch the destination record from station record database */
dstStaInfo = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, ehdr->h_dest, interfaceTag);
/* AP mode processing, & if packet is unicast */
@@ -1878,13 +1878,13 @@ CsrResult uf_process_ma_packet_req(unifi_priv_t *priv,
}
else if ((pktType == CSR_WIFI_MULTICAST_PDU) && (!status))
{
- /* If broadcast Tim is set && queuing is successfull, then only update TIM */
+ /* If broadcast Tim is set && queuing is successful, then only update TIM */
spin_lock_irqsave(&priv->staRecord_lock,lock_flags);
interfacePriv->noOfbroadcastPktQueued++;
spin_unlock_irqrestore(&priv->staRecord_lock,lock_flags);
}
}
- /* If broadcast Tim is set && queuing is successfull, then only update TIM */
+ /* If broadcast Tim is set && queuing is successful, then only update TIM */
if(setBcTim && !status) {
unifi_trace(priv, UDBG3, "tim set due to broadcast pkt\n");
if (!interfacePriv->bcTimSetReqPendingFlag)
@@ -1995,7 +1995,7 @@ s8 uf_get_protection_bit_from_interfacemode(unifi_priv_t *priv, u16 interfaceTag
*/
protection = interfacePriv->protect;
} else {
- /* fetch the destination record from staion record database */
+ /* fetch the destination record from station record database */
dstStaInfo = CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(priv, daddr, interfaceTag);
if (!dstStaInfo) {
unifi_trace(priv, UDBG3, "peer not found in station record in send_ma_pkt_request\n");
@@ -3170,7 +3170,7 @@ void uf_process_ps_poll(unifi_priv_t *priv,u8* sa,u8* da,u8 pmBit,u16 interfaceT
/*Send Data From Management Frames*/
/* Priority orders for delivering the buffered packets are
* 1. Deliver the Management frames if there
- * 2. Other access catagory frames which are non deliver enable including UNIFI_TRAFFIC_Q_VO
+ * 2. Other access category frames which are non deliver enable including UNIFI_TRAFFIC_Q_VO
* priority is from VO->BK
*/
@@ -3282,7 +3282,7 @@ void add_to_send_cfm_list(unifi_priv_t * priv,
{
tx_buffered_packets_t *send_cfm_list_item = NULL;
- send_cfm_list_item = (tx_buffered_packets_t *) kmalloc(sizeof(tx_buffered_packets_t), GFP_ATOMIC);
+ send_cfm_list_item = kmalloc(sizeof(tx_buffered_packets_t), GFP_ATOMIC);
if(send_cfm_list_item == NULL){
unifi_warning(priv, "%s: Failed to allocate memory for new list item \n");
@@ -3439,7 +3439,7 @@ CsrWifiRouterCtrlStaInfo_t *CsrWifiRouterCtrlGetStationRecordFromPeerMacAddress(
interfacePriv = priv->interfacePriv[interfaceTag];
- /* disable the preemption untill station record is fetched */
+ /* disable the preemption until station record is fetched */
spin_lock_irqsave(&priv->staRecord_lock,lock_flags);
for (i = 0; i < UNIFI_MAX_CONNECTIONS; i++) {
@@ -3665,7 +3665,7 @@ void update_eosp_to_head_of_broadcast_list_head(unifi_priv_t *priv,u16 interface
if (interfacePriv->noOfbroadcastPktQueued) {
/* Update the EOSP to the HEAD of b/c list
- * beacuse we have received any mgmt packet so it should not hold for long time
+ * because we have received any mgmt packet so it should not hold for long time
* peer may time out.
*/
spin_lock_irqsave(&priv->tx_q_lock,lock_flags);
diff --git a/drivers/staging/csr/unifi_sme.c b/drivers/staging/csr/unifi_sme.c
index 7d19e632a5e4..90295035621f 100644
--- a/drivers/staging/csr/unifi_sme.c
+++ b/drivers/staging/csr/unifi_sme.c
@@ -876,6 +876,8 @@ int unifi_cfg_get_info(unifi_priv_t *priv, unsigned char *arg)
{
#ifdef CSR_SUPPORT_WEXT_AP
uf_cfg_ap_config_t cfg_ap_config;
+
+ memset(&cfg_ap_config, 0, sizeof(cfg_ap_config));
cfg_ap_config.channel = priv->ap_config.channel;
cfg_ap_config.beaconInterval = priv->ap_mac_config.beaconInterval;
cfg_ap_config.wmmEnabled = priv->ap_mac_config.wmmEnabled;