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

staging: wilc1000: make use of ALIGN macro

Make use of 'ALIGN' macro to align the size data value.
Signed-off-by: default avatarAjay Singh <ajay.kathat@microchip.com>
Link: https://lore.kernel.org/r/20200214172250.13026-5-ajay.kathat@microchip.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent eda308be
...@@ -415,28 +415,12 @@ static int wilc_sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) ...@@ -415,28 +415,12 @@ static int wilc_sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
cmd.read_write = 1; cmd.read_write = 1;
if (addr > 0) { if (addr > 0) {
/**
* has to be word aligned...
**/
if (size & 0x3) {
size += 4;
size &= ~0x3;
}
/** /**
* func 0 access * func 0 access
**/ **/
cmd.function = 0; cmd.function = 0;
cmd.address = 0x10f; cmd.address = 0x10f;
} else { } else {
/**
* has to be word aligned...
**/
if (size & 0x3) {
size += 4;
size &= ~0x3;
}
/** /**
* func 1 access * func 1 access
**/ **/
...@@ -444,6 +428,7 @@ static int wilc_sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size) ...@@ -444,6 +428,7 @@ static int wilc_sdio_write(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
cmd.address = 0; cmd.address = 0;
} }
size = ALIGN(size, 4);
nblk = size / block_size; nblk = size / block_size;
nleft = size % block_size; nleft = size % block_size;
...@@ -551,28 +536,12 @@ static int wilc_sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) ...@@ -551,28 +536,12 @@ static int wilc_sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
cmd.read_write = 0; cmd.read_write = 0;
if (addr > 0) { if (addr > 0) {
/**
* has to be word aligned...
**/
if (size & 0x3) {
size += 4;
size &= ~0x3;
}
/** /**
* func 0 access * func 0 access
**/ **/
cmd.function = 0; cmd.function = 0;
cmd.address = 0x10f; cmd.address = 0x10f;
} else { } else {
/**
* has to be word aligned...
**/
if (size & 0x3) {
size += 4;
size &= ~0x3;
}
/** /**
* func 1 access * func 1 access
**/ **/
...@@ -580,6 +549,7 @@ static int wilc_sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size) ...@@ -580,6 +549,7 @@ static int wilc_sdio_read(struct wilc *wilc, u32 addr, u8 *buf, u32 size)
cmd.address = 0; cmd.address = 0;
} }
size = ALIGN(size, 4);
nblk = size / block_size; nblk = size / block_size;
nleft = size % block_size; nleft = size % block_size;
......
...@@ -508,9 +508,7 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count) ...@@ -508,9 +508,7 @@ int wilc_wlan_handle_txq(struct wilc *wilc, u32 *txq_count)
vmm_sz = HOST_HDR_OFFSET; vmm_sz = HOST_HDR_OFFSET;
vmm_sz += tqe->buffer_size; vmm_sz += tqe->buffer_size;
vmm_sz = ALIGN(vmm_sz, 4);
if (vmm_sz & 0x3)
vmm_sz = (vmm_sz + 4) & ~0x3;
if ((sum + vmm_sz) > WILC_TX_BUFF_SIZE) if ((sum + vmm_sz) > WILC_TX_BUFF_SIZE)
break; break;
......
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