From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Retanubun Date: Fri, 14 Jun 2013 09:15:58 -0400 Subject: [U-Boot] [PATCH 1/2] spi: cf_qspi: Use DIV_ROUND_UP at appropriate place In-Reply-To: <1371215539.3888.1.camel@phoenix> References: <1371215539.3888.1.camel@phoenix> Message-ID: <51BB178E.9060803@ruggedcom.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 14/06/13 09:12 AM, Axel Lin wrote: > This change slightly improves readability. > > Signed-off-by: Axel Lin > --- > drivers/spi/cf_qspi.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/spi/cf_qspi.c b/drivers/spi/cf_qspi.c > index a37ac4e..06bcf91 100644 > --- a/drivers/spi/cf_qspi.c > +++ b/drivers/spi/cf_qspi.c > @@ -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. Signed-off-by: Richard Retanubun