spi: cf_qspi: Use DIV_ROUND_UP at appropriate place
Subsystems (2)
PATCH 1/2 spi: cf_qspi: Use DIV_ROUND_UP at appropriate place
This change slightly improves readability.
--- drivers/spi/cf_qspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/cf_qspi.c +1 -1
@@ -171,7 +171,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,volatile qspi_t *qspi = dev->regs;u8 *txbuf = (u8 *)dout;u8 *rxbuf = (u8 *)din; -u32 count = ((bitlen /8 ) + (bitlen %8 ?1 :0 )); +u32 count =DIV_ROUND_UP (bitlen,8 );u32 n, i =0 ;/* Sanitize arguments */
Signature · 1 line
1.8.1.2
PATCH 2/2 spi: mxc_spi: Use DIV_ROUND_UP at appropriate places
This change slightly improves readability.
--- drivers/spi/mxc_spi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/spi/mxc_spi.c +3 -3
@@ -224,7 +224,7 @@ int spi_xchg_single(struct spi_slave *slave, unsigned int bitlen, const u8 *dout, u8 *din, unsigned long flags) { 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;struct cspi_regs *regs = (struct cspi_regs *)mxcs->base;
@@ -294,7 +294,7 @@ int spi_xchg_single(struct spi_slave *slave, unsigned int bitlen,/* Transfer completed, clear any pending request */ reg_write (®s->stat,MXC_CSPICTRL_TC |MXC_CSPICTRL_RXOVF ); - nbytes = (bitlen +7 ) /8 ; + nbytes =DIV_ROUND_UP (bitlen,8 ); cnt = nbytes %32 ;
@@ -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,void *din,unsigned long flags) { -int n_bytes = (bitlen +7 ) /8 ; +int n_bytes =DIV_ROUND_UP (bitlen,8 );int n_bits;int ret;u32 blk_size;
Signature · 1 line
1.8.1.2
PATCH 2/2 spi: mxc_spi: Use DIV_ROUND_UP at appropriate places
Quoted 31 lines · Axel Lin
This change slightly improves readability.
Signed-off-by Axel Lin <[email protected]>--- drivers/spi/mxc_spi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/spi/mxc_spi.c +2
-2@@ -224,7 +224,7 @@ int spi_xchg_single(struct spi_slave *slave, unsigned int bitlen, const u8 *dout, u8 *din, unsigned long flags) { 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;struct cspi_regs *regs = (struct cspi_regs *)mxcs->base;@@ -294,7 +294,7 @@ int spi_xchg_single(struct spi_slave *slave, unsigned int bitlen,/* Transfer completed, clear any pending request */ reg_write (®s->stat,MXC_CSPICTRL_TC |MXC_CSPICTRL_RXOVF ); - nbytes = (bitlen +7 ) /8 ; + nbytes =DIV_ROUND_UP (bitlen,8 ); cnt = nbytes %32 ;
drivers/spi/mxc_spi.c int spi_xchg_single(struct spi_slave *slave, unsigned int bitlen, · line 336
Quoted 8 lines
drivers/spi/mxc_spi.c +1
-1@@ -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,void *din,unsigned long flags) { -int n_bytes = (bitlen +7 ) /8 ; +int n_bytes =DIV_ROUND_UP (bitlen,8 );int n_bits;int ret;u32 blk_size;
--
Thanks,
Jagan.
PATCH 2/2 spi: mxc_spi: Use DIV_ROUND_UP at appropriate places
Quoted 32 lines · Jagan Teki
Quoted 31 lines · Axel Lin
This change slightly improves readability.
Signed-off-by Axel Lin <[email protected]>--- drivers/spi/mxc_spi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/spi/mxc_spi.c +2
-2@@ -224,7 +224,7 @@ int spi_xchg_single(struct spi_slave *slave,unsigned int bitlen, const u8 *dout, u8 *din, unsigned long flags) { 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;struct cspi_regs *regs = (struct cspi_regs *)mxcs->base;@@ -294,7 +294,7 @@ int spi_xchg_single(struct spi_slave *slave,unsigned int bitlen,/* Transfer completed, clear any pending request */ reg_write(®s->stat, MXC_CSPICTRL_TC | MXC_CSPICTRL_RXOVF); - nbytes = (bitlen +7 ) /8 ; + nbytes =DIV_ROUND_UP (bitlen,8 ); cnt = nbytes %32 ;
Quoted 14 lines
Quoted 9 lines
drivers/spi/mxc_spi.c +1
-1@@ -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, void *din, unsigned long flags) { - int n_bytes = (bitlen + 7) / 8; + int n_bytes = DIV_ROUND_UP(bitlen, 8);int n_bits;Quoted 3 lines
int ret; u32 blk_size;Reviewed-by Jagannadha Sutradharudu Teki <[email protected]>
Applied to u-boot-spi/master
--
Thanks,
Jagan.
PATCH 1/2 spi: cf_qspi: Use DIV_ROUND_UP at appropriate place
In reply to Axel LinQuoted 12 lines · Axel Lin
This change slightly improves readability.
Signed-off-by Axel Lin<[email protected]>--- drivers/spi/cf_qspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/spi/cf_qspi.c +0
-0
drivers/spi/cf_qspi.c int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, · line 177
Quoted 8 lines
drivers/spi/cf_qspi.c +1
-1@@ -171,7 +171,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,volatile qspi_t *qspi = dev->regs;u8 *txbuf = (u8 *)dout;u8 *rxbuf = (u8 *)din; -u32 count = ((bitlen /8 ) + (bitlen %8 ?1 :0 )); +u32 count =DIV_ROUND_UP (bitlen,8 );u32 n, i =0 ;/* Sanitize arguments */
ACK. Thanks for the cleanup.
PATCH 1/2 spi: cf_qspi: Use DIV_ROUND_UP at appropriate place
Quoted 21 lines · Richard Retanubun
Quoted 20 lines · Axel Lin
This change slightly improves readability.
Signed-off-by Axel Lin<[email protected]>--- drivers/spi/cf_qspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/spi/cf_qspi.c +1
-1@@ -171,7 +171,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, volatile qspi_t *qspi = dev->regs;u8 *txbuf = (u8 *)dout;u8 *rxbuf = (u8 *)din; -u32 count = ((bitlen /8 ) + (bitlen %8 ?1 :0 )); +u32 count =DIV_ROUND_UP (bitlen,8 );u32 n, i =0 ;
Quoted 4 lines
Quoted 1 line
/* Sanitize arguments */ACK. Thanks for the cleanup.
Signed-off-by Richard Retanubun<[email protected]>
--
Thanks,
Jagan.
PATCH 1/2 spi: cf_qspi: Use DIV_ROUND_UP at appropriate place
Quoted 22 lines · Jagan Teki
Quoted 21 lines · Richard Retanubun
Quoted 20 lines · Axel Lin
This change slightly improves readability.
Signed-off-by Axel Lin<[email protected]>--- drivers/spi/cf_qspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/spi/cf_qspi.c +1
-1@@ -171,7 +171,7 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, volatile qspi_t *qspi = dev->regs;u8 *txbuf = (u8 *)dout;u8 *rxbuf = (u8 *)din; -u32 count = ((bitlen /8 ) + (bitlen %8 ?1 :0 )); +u32 count =DIV_ROUND_UP (bitlen,8 );u32 n, i =0 ;
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
/* Sanitize arguments */ACK. Thanks for the cleanup.
Signed-off-by Richard Retanubun<[email protected]>Reviewed-by Jagannadha Sutradharudu Teki <[email protected]>
Applied to u-boot-spi/master
--
Thanks,
Jagan.