Skip to content
Snippets Groups Projects
Commit 9675fed4 authored by Axel Lin's avatar Axel Lin Committed by Jagannadha Sutradharudu Teki
Browse files

spi: mxc_spi: Use DIV_ROUND_UP at appropriate places


This change slightly improves readability.

Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Reviewed-by: default avatarJagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
parent 0cb8394f
No related branches found
No related tags found
No related merge requests found
...@@ -224,7 +224,7 @@ int spi_xchg_single(struct spi_slave *slave, unsigned int bitlen, ...@@ -224,7 +224,7 @@ int spi_xchg_single(struct spi_slave *slave, unsigned int bitlen,
const u8 *dout, u8 *din, unsigned long flags) const u8 *dout, u8 *din, unsigned long flags)
{ {
struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave); struct mxc_spi_slave *mxcs = to_mxc_spi_slave(slave);
int nbytes = (bitlen + 7) / 8; int nbytes = DIV_ROUND_UP(bitlen, 8);
u32 data, cnt, i; u32 data, cnt, i;
struct cspi_regs *regs = (struct cspi_regs *)mxcs->base; struct cspi_regs *regs = (struct cspi_regs *)mxcs->base;
...@@ -294,7 +294,7 @@ int spi_xchg_single(struct spi_slave *slave, unsigned int bitlen, ...@@ -294,7 +294,7 @@ int spi_xchg_single(struct spi_slave *slave, unsigned int bitlen,
/* Transfer completed, clear any pending request */ /* Transfer completed, clear any pending request */
reg_write(&regs->stat, MXC_CSPICTRL_TC | MXC_CSPICTRL_RXOVF); reg_write(&regs->stat, MXC_CSPICTRL_TC | MXC_CSPICTRL_RXOVF);
nbytes = (bitlen + 7) / 8; nbytes = DIV_ROUND_UP(bitlen, 8);
cnt = nbytes % 32; cnt = nbytes % 32;
...@@ -330,7 +330,7 @@ int spi_xchg_single(struct spi_slave *slave, unsigned int bitlen, ...@@ -330,7 +330,7 @@ int spi_xchg_single(struct spi_slave *slave, unsigned int bitlen,
int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
void *din, unsigned long flags) void *din, unsigned long flags)
{ {
int n_bytes = (bitlen + 7) / 8; int n_bytes = DIV_ROUND_UP(bitlen, 8);
int n_bits; int n_bits;
int ret; int ret;
u32 blk_size; u32 blk_size;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment