diff options
author | Ajay Singh <ajay.kathat@microchip.com> | 2018-04-25 22:48:12 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-04-26 09:43:04 +0200 |
commit | eaa5f7befa1c8dcd9218c87ee78b6a34c156ea48 (patch) | |
tree | 470b8c510dafbe854198788cea2cec4a4cb4329f /drivers | |
parent | 73a75364c8de3ec8cba5687eecfa783892e03051 (diff) |
staging: wilc1000: simplified if conditions in spi_data_write()
Cleanup patch to simplify the if conditions logic in spi_data_write().
Signed-off-by: Ajay Singh <ajay.kathat@microchip.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/wilc1000/wilc_spi.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index 66ac7da4bb12..c17f5d206e06 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -617,28 +617,23 @@ static int spi_data_write(struct wilc *wilc, u8 *b, u32 sz) */ ix = 0; do { - if (sz <= DATA_PKT_SZ) + if (sz <= DATA_PKT_SZ) { nbytes = sz; - else + order = 0x3; + } else { nbytes = DATA_PKT_SZ; + if (ix == 0) + order = 0x1; + else + order = 0x02; + } /* * Write command */ cmd = 0xf0; - if (ix == 0) { - if (sz <= DATA_PKT_SZ) - - order = 0x3; - else - order = 0x1; - } else { - if (sz <= DATA_PKT_SZ) - order = 0x3; - else - order = 0x2; - } cmd |= order; + if (wilc_spi_tx(wilc, &cmd, 1)) { dev_err(&spi->dev, "Failed data block cmd write, bus error...\n"); |