Commit 169ed7ee authored by Ajay Singh's avatar Ajay Singh Committed by Greg Kroah-Hartman

staging: wilc1000: fix line over 80 characters in spi_cmd_complete()

Refactor spi_cmd_complete() to fix the line over 80 char issues reported
by checkpatch.pl script.
Signed-off-by: default avatarAjay Singh <ajay.kathat@microchip.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 89f3091d
...@@ -287,6 +287,8 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, ...@@ -287,6 +287,8 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
u8 rsp; u8 rsp;
int len = 0; int len = 0;
int result = N_OK; int result = N_OK;
int retry;
u8 crc[2];
wb[0] = cmd; wb[0] = cmd;
switch (cmd) { switch (cmd) {
...@@ -306,21 +308,21 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, ...@@ -306,21 +308,21 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
len = 5; len = 5;
break; break;
case CMD_TERMINATE: /* termination */ case CMD_TERMINATE:
wb[1] = 0x00; wb[1] = 0x00;
wb[2] = 0x00; wb[2] = 0x00;
wb[3] = 0x00; wb[3] = 0x00;
len = 5; len = 5;
break; break;
case CMD_REPEAT: /* repeat */ case CMD_REPEAT:
wb[1] = 0x00; wb[1] = 0x00;
wb[2] = 0x00; wb[2] = 0x00;
wb[3] = 0x00; wb[3] = 0x00;
len = 5; len = 5;
break; break;
case CMD_RESET: /* reset */ case CMD_RESET:
wb[1] = 0xff; wb[1] = 0xff;
wb[2] = 0xff; wb[2] = 0xff;
wb[3] = 0xff; wb[3] = 0xff;
...@@ -395,13 +397,12 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, ...@@ -395,13 +397,12 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
cmd == CMD_REPEAT) { cmd == CMD_REPEAT) {
len2 = len + (NUM_SKIP_BYTES + NUM_RSP_BYTES + NUM_DUMMY_BYTES); len2 = len + (NUM_SKIP_BYTES + NUM_RSP_BYTES + NUM_DUMMY_BYTES);
} else if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ) { } else if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ) {
if (!g_spi.crc_off) { int tmp = NUM_RSP_BYTES + NUM_DATA_HDR_BYTES + NUM_DATA_BYTES
len2 = len + (NUM_RSP_BYTES + NUM_DATA_HDR_BYTES + NUM_DATA_BYTES + NUM_DUMMY_BYTES;
+ NUM_CRC_BYTES + NUM_DUMMY_BYTES); if (!g_spi.crc_off)
} else { len2 = len + tmp + NUM_CRC_BYTES;
len2 = len + (NUM_RSP_BYTES + NUM_DATA_HDR_BYTES + NUM_DATA_BYTES else
+ NUM_DUMMY_BYTES); len2 = len + tmp;
}
} else { } else {
len2 = len + (NUM_RSP_BYTES + NUM_DUMMY_BYTES); len2 = len + (NUM_RSP_BYTES + NUM_DUMMY_BYTES);
} }
...@@ -425,11 +426,8 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, ...@@ -425,11 +426,8 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
/* /*
* Command/Control response * Command/Control response
*/ */
if (cmd == CMD_RESET || if (cmd == CMD_RESET || cmd == CMD_TERMINATE || cmd == CMD_REPEAT)
cmd == CMD_TERMINATE ||
cmd == CMD_REPEAT) {
rix++; /* skip 1 byte */ rix++; /* skip 1 byte */
}
rsp = rb[rix++]; rsp = rb[rix++];
...@@ -452,8 +450,6 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, ...@@ -452,8 +450,6 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ || if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ ||
cmd == CMD_DMA_READ || cmd == CMD_DMA_EXT_READ) { cmd == CMD_DMA_READ || cmd == CMD_DMA_EXT_READ) {
int retry;
u8 crc[2];
/* /*
* Data Respnose header * Data Respnose header
*/ */
...@@ -478,6 +474,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, ...@@ -478,6 +474,7 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
"Error, data read response (%02x)\n", rsp); "Error, data read response (%02x)\n", rsp);
return N_RESET; return N_RESET;
} }
}
if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ) { if (cmd == CMD_INTERNAL_READ || cmd == CMD_SINGLE_READ) {
/* /*
...@@ -502,7 +499,8 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, ...@@ -502,7 +499,8 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
crc[0] = rb[rix++]; crc[0] = rb[rix++];
crc[1] = rb[rix++]; crc[1] = rb[rix++];
} else { } else {
dev_err(&spi->dev, "buffer overrun when reading crc.\n"); dev_err(&spi->dev,
"buffer overrun when reading crc.\n");
return N_FAIL; return N_FAIL;
} }
} }
...@@ -527,7 +525,8 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, ...@@ -527,7 +525,8 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
* Read bytes * Read bytes
*/ */
if (wilc_spi_rx(wilc, &b[ix], nbytes)) { if (wilc_spi_rx(wilc, &b[ix], nbytes)) {
dev_err(&spi->dev, "Failed data block read, bus error...\n"); dev_err(&spi->dev,
"Failed block read, bus err\n");
result = N_FAIL; result = N_FAIL;
goto _error_; goto _error_;
} }
...@@ -535,13 +534,12 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, ...@@ -535,13 +534,12 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
/* /*
* Read Crc * Read Crc
*/ */
if (!g_spi.crc_off) { if (!g_spi.crc_off && wilc_spi_rx(wilc, crc, 2)) {
if (wilc_spi_rx(wilc, crc, 2)) { dev_err(&spi->dev,
dev_err(&spi->dev, "Failed data block crc read, bus error...\n"); "Failed block crc read, bus err\n");
result = N_FAIL; result = N_FAIL;
goto _error_; goto _error_;
} }
}
ix += nbytes; ix += nbytes;
sz -= nbytes; sz -= nbytes;
...@@ -570,7 +568,8 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, ...@@ -570,7 +568,8 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
retry = 10; retry = 10;
do { do {
if (wilc_spi_rx(wilc, &rsp, 1)) { if (wilc_spi_rx(wilc, &rsp, 1)) {
dev_err(&spi->dev, "Failed data response read, bus error...\n"); dev_err(&spi->dev,
"Failed resp read, bus err\n");
result = N_FAIL; result = N_FAIL;
break; break;
} }
...@@ -585,7 +584,8 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, ...@@ -585,7 +584,8 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
* Read bytes * Read bytes
*/ */
if (wilc_spi_rx(wilc, &b[ix], nbytes)) { if (wilc_spi_rx(wilc, &b[ix], nbytes)) {
dev_err(&spi->dev, "Failed data block read, bus error...\n"); dev_err(&spi->dev,
"Failed block read, bus err\n");
result = N_FAIL; result = N_FAIL;
break; break;
} }
...@@ -593,19 +593,17 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz, ...@@ -593,19 +593,17 @@ static int spi_cmd_complete(struct wilc *wilc, u8 cmd, u32 adr, u8 *b, u32 sz,
/* /*
* Read Crc * Read Crc
*/ */
if (!g_spi.crc_off) { if (!g_spi.crc_off && wilc_spi_rx(wilc, crc, 2)) {
if (wilc_spi_rx(wilc, crc, 2)) { dev_err(&spi->dev,
dev_err(&spi->dev, "Failed data block crc read, bus error...\n"); "Failed block crc read, bus err\n");
result = N_FAIL; result = N_FAIL;
break; break;
} }
}
ix += nbytes; ix += nbytes;
sz -= nbytes; sz -= nbytes;
} }
} }
}
_error_: _error_:
return result; return result;
} }
......
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