[PATCH] Staging: ks7010: ks7010_stio: Fixed several coding style issues

From: Manoj Sawai
Date: Fri Oct 28 2016 - 18:34:48 EST


Fixed all the "errors" reported by checkpath.pl in ks7010_stio.c
The "TODO" file ask to take the 80 character limit lightly, so
the file still has some warnings about character limit. All the
errors have been removed.

Signed-off-by: Manoj Sawai <mas@xxxxxxxxxxxx>
---
drivers/staging/ks7010/ks7010_sdio.c | 60 ++++++++++++++++++++----------------
1 file changed, 33 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/ks7010/ks7010_sdio.c b/drivers/staging/ks7010/ks7010_sdio.c
index 81c46f4..6bbfda4 100644
--- a/drivers/staging/ks7010/ks7010_sdio.c
+++ b/drivers/staging/ks7010/ks7010_sdio.c
@@ -35,18 +35,17 @@ MODULE_DEVICE_TABLE(sdio, ks7010_sdio_ids);
/* macro */

#define inc_txqhead(priv) \
- (priv->tx_dev.qhead = (priv->tx_dev.qhead + 1) % TX_DEVICE_BUFF_SIZE)
+ (priv->tx_dev.qhead = (priv->tx_dev.qhead + 1) % TX_DEVICE_BUFF_SIZE)
#define inc_txqtail(priv) \
- (priv->tx_dev.qtail = (priv->tx_dev.qtail + 1) % TX_DEVICE_BUFF_SIZE)
+ (priv->tx_dev.qtail = (priv->tx_dev.qtail + 1) % TX_DEVICE_BUFF_SIZE)
#define cnt_txqbody(priv) \
- (((priv->tx_dev.qtail + TX_DEVICE_BUFF_SIZE) - (priv->tx_dev.qhead)) % TX_DEVICE_BUFF_SIZE)
-
+ (((priv->tx_dev.qtail + TX_DEVICE_BUFF_SIZE) - (priv->tx_dev.qhead)) % TX_DEVICE_BUFF_SIZE)
#define inc_rxqhead(priv) \
- (priv->rx_dev.qhead = (priv->rx_dev.qhead + 1) % RX_DEVICE_BUFF_SIZE)
+ (priv->rx_dev.qhead = (priv->rx_dev.qhead + 1) % RX_DEVICE_BUFF_SIZE)
#define inc_rxqtail(priv) \
- (priv->rx_dev.qtail = (priv->rx_dev.qtail + 1) % RX_DEVICE_BUFF_SIZE)
+ (priv->rx_dev.qtail = (priv->rx_dev.qtail + 1) % RX_DEVICE_BUFF_SIZE)
#define cnt_rxqbody(priv) \
- (((priv->rx_dev.qtail + RX_DEVICE_BUFF_SIZE) - (priv->rx_dev.qhead)) % RX_DEVICE_BUFF_SIZE)
+ (((priv->rx_dev.qtail + RX_DEVICE_BUFF_SIZE) - (priv->rx_dev.qhead)) % RX_DEVICE_BUFF_SIZE)

static int ks7010_sdio_read(struct ks_wlan_private *priv, unsigned int address,
unsigned char *buffer, int length)
@@ -190,9 +189,9 @@ static int _ks_wlan_hw_power_save(struct ks_wlan_private *priv)
atomic_read(&priv->psstatus.snooze_guard),
cnt_txqbody(priv));

- if (!atomic_read(&priv->psstatus.confirm_wait)
- && !atomic_read(&priv->psstatus.snooze_guard)
- && !cnt_txqbody(priv)) {
+ if (!atomic_read(&priv->psstatus.confirm_wait) &&
+ !atomic_read(&priv->psstatus.snooze_guard) &&
+ !cnt_txqbody(priv)) {
retval =
ks7010_sdio_read(priv, INT_PENDING,
&rw_data,
@@ -255,7 +254,7 @@ int ks_wlan_hw_power_save(struct ks_wlan_private *priv)

static int enqueue_txdev(struct ks_wlan_private *priv, unsigned char *p,
unsigned long size,
- void (*complete_handler) (void *arg1, void *arg2),
+ void (*complete_handler)(void *arg1, void *arg2),
void *arg1, void *arg2)
{
struct tx_device_buffer *sp;
@@ -294,6 +293,7 @@ static int write_to_device(struct ks_wlan_private *priv, unsigned char *buffer,
int retval;
unsigned char rw_data;
struct hostif_hdr *hdr;
+
hdr = (struct hostif_hdr *)buffer;

DPRINTK(4, "size=%d\n", hdr->size);
@@ -326,8 +326,8 @@ static void tx_device_task(void *dev)
int rc = 0;

DPRINTK(4, "\n");
- if (cnt_txqbody(priv) > 0
- && atomic_read(&priv->psstatus.status) != PS_SNOOZE) {
+ if (cnt_txqbody(priv) > 0 &&
+ atomic_read(&priv->psstatus.status) != PS_SNOOZE) {
sp = &priv->tx_dev.tx_dev_buff[priv->tx_dev.qhead];
if (priv->dev_state >= DEVICE_STATE_BOOT) {
rc = write_to_device(priv, sp->sendp, sp->size);
@@ -353,11 +353,12 @@ static void tx_device_task(void *dev)
}

int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, unsigned long size,
- void (*complete_handler) (void *arg1, void *arg2),
+ void (*complete_handler)(void *arg1, void *arg2),
void *arg1, void *arg2)
{
int result = 0;
struct hostif_hdr *hdr;
+
hdr = (struct hostif_hdr *)p;

if (hdr->event < HIF_DATA_REQ || HIF_REQ_MAX < hdr->event) {
@@ -412,7 +413,7 @@ static void ks_wlan_hw_rx(void *dev, uint16_t size)
/* receive data */
if (cnt_rxqbody(priv) >= (RX_DEVICE_BUFF_SIZE - 1)) {
/* in case of buffer overflow */
- DPRINTK(1, "rx buffer overflow \n");
+ DPRINTK(1, "rx buffer overflow\n");
goto error_out;
}
rx_buffer = &priv->rx_dev.rx_dev_buff[priv->rx_dev.qtail];
@@ -495,7 +496,8 @@ static void ks7010_rw_function(struct work_struct *work)
while (time_after(priv->last_wakeup + ((30 * HZ) / 1000), jiffies)) {
DPRINTK(4, "wait after WAKEUP\n");
/* queue_delayed_work(priv->ks_wlan_hw.ks7010sdio_wq,&priv->ks_wlan_hw.rw_wq,
- (priv->last_wakeup + ((30*HZ)/1000) - jiffies));*/
+ * (priv->last_wakeup + ((30*HZ)/1000) - jiffies));
+ */
dev_info(&priv->ks_wlan_hw.sdio_card->func->dev,
"wake: %lu %lu\n",
priv->last_wakeup + (30 * HZ) / 1000,
@@ -575,8 +577,8 @@ static void ks_sdio_interrupt(struct sdio_func *func)
/* read (General Communication B register) */
/* bit5 -> Write Status Idle */
/* bit2 -> Read Status Busy */
- if (status & INT_GCR_B
- || atomic_read(&priv->psstatus.status) == PS_SNOOZE) {
+ if (status & INT_GCR_B ||
+ atomic_read(&priv->psstatus.status) == PS_SNOOZE) {
retval =
ks7010_sdio_read(priv, GCR_B, &rw_data,
sizeof(rw_data));
@@ -614,8 +616,8 @@ static void ks_sdio_interrupt(struct sdio_func *func)
}
if (rw_data & WSTATUS_MASK) {
#if 0
- if (status & INT_WRITE_STATUS
- && !cnt_txqbody(priv)) {
+ if (status & INT_WRITE_STATUS &&
+ !cnt_txqbody(priv)) {
/* dummy write for interrupt clear */
rw_data = 0;
retval =
@@ -658,10 +660,12 @@ static void ks_sdio_interrupt(struct sdio_func *func)
static int trx_device_init(struct ks_wlan_private *priv)
{
/* initialize values (tx) */
- priv->tx_dev.qtail = priv->tx_dev.qhead = 0;
+ priv->tx_dev.qtail = 0;
+ priv->tx_dev.qhead = 0;

/* initialize values (rx) */
- priv->rx_dev.qtail = priv->rx_dev.qhead = 0;
+ priv->rx_dev.qtail = 0;
+ priv->rx_dev.qhead = 0;

/* initialize spinLock (tx,rx) */
spin_lock_init(&priv->tx_dev.tx_dev_lock);
@@ -718,7 +722,7 @@ static int ks7010_sdio_update_index(struct ks_wlan_private *priv, u32 index)
return rc;
}

-#define ROM_BUFF_SIZE (64*1024)
+#define ROM_BUFF_SIZE (64 * 1024)
static int ks7010_sdio_data_compare(struct ks_wlan_private *priv, u32 address,
unsigned char *data, unsigned int size)
{
@@ -881,7 +885,6 @@ static void ks7010_card_init(struct ks_wlan_private *priv)
if (priv->mac_address_valid && priv->version_size)
priv->dev_state = DEVICE_STATE_PREINIT;

-
hostif_sme_enqueue(priv, SME_GET_EEPROM_CKSUM);

/* load initial wireless parameter */
@@ -955,7 +958,7 @@ static int ks7010_sdio_probe(struct sdio_func *func,
priv = NULL;
netdev = NULL;

- /* initilize ks_sdio_card */
+ /* initialize ks_sdio_card */
card = kzalloc(sizeof(*card), GFP_KERNEL);
if (!card)
return -ENOMEM;
@@ -999,8 +1002,8 @@ static int ks7010_sdio_probe(struct sdio_func *func,

sdio_set_drvdata(func, card);

- DPRINTK(5, "class = 0x%X, vendor = 0x%X, "
- "device = 0x%X\n", func->class, func->vendor, func->device);
+ DPRINTK(5, "class = 0x%X, vendor = 0x%X, device = 0x%X\n"
+ , func->class, func->vendor, func->device);

/* private memory allocate */
netdev = alloc_etherdev(sizeof(*priv));
@@ -1115,8 +1118,10 @@ static int ks7010_sdio_probe(struct sdio_func *func,
static void ks7010_sdio_remove(struct sdio_func *func)
{
int ret;
+
struct ks_sdio_card *card;
struct ks_wlan_private *priv;
+
DPRINTK(1, "ks7010_sdio_remove()\n");

card = sdio_get_drvdata(func);
@@ -1142,6 +1147,7 @@ static void ks7010_sdio_remove(struct sdio_func *func)
/* send stop request to MAC */
{
struct hostif_stop_request_t *pp;
+
pp = kzalloc(hif_align_size(sizeof(*pp)), GFP_KERNEL);
if (!pp) {
DPRINTK(3, "allocate memory failed..\n");
--
2.7.4