* [U-Boot] [PATCH 1/2] spi: cf_qspi: Use DIV_ROUND_UP at appropriate place
@ 2013-06-14 13:12 Axel Lin
2013-06-14 13:13 ` [U-Boot] [PATCH 2/2] spi: mxc_spi: Use DIV_ROUND_UP at appropriate places Axel Lin
2013-06-14 13:15 ` [U-Boot] [PATCH 1/2] spi: cf_qspi: Use DIV_ROUND_UP at appropriate place Richard Retanubun
0 siblings, 2 replies; 7+ messages in thread
From: Axel Lin @ 2013-06-14 13:12 UTC (permalink / raw)
To: u-boot
This change slightly improves readability.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
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 */
--
1.8.1.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 2/2] spi: mxc_spi: Use DIV_ROUND_UP at appropriate places
2013-06-14 13:12 [U-Boot] [PATCH 1/2] spi: cf_qspi: Use DIV_ROUND_UP at appropriate place Axel Lin
@ 2013-06-14 13:13 ` Axel Lin
2013-06-14 15:11 ` Jagan Teki
2013-06-14 13:15 ` [U-Boot] [PATCH 1/2] spi: cf_qspi: Use DIV_ROUND_UP at appropriate place Richard Retanubun
1 sibling, 1 reply; 7+ messages in thread
From: Axel Lin @ 2013-06-14 13:13 UTC (permalink / raw)
To: u-boot
This change slightly improves readability.
Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
drivers/spi/mxc_spi.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
index 5bed858..2ea3228 100644
--- a/drivers/spi/mxc_spi.c
+++ b/drivers/spi/mxc_spi.c
@@ -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;
--
1.8.1.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 1/2] spi: cf_qspi: Use DIV_ROUND_UP at appropriate place
2013-06-14 13:12 [U-Boot] [PATCH 1/2] spi: cf_qspi: Use DIV_ROUND_UP at appropriate place Axel Lin
2013-06-14 13:13 ` [U-Boot] [PATCH 2/2] spi: mxc_spi: Use DIV_ROUND_UP at appropriate places Axel Lin
@ 2013-06-14 13:15 ` Richard Retanubun
2013-06-14 15:10 ` Jagan Teki
1 sibling, 1 reply; 7+ messages in thread
From: Richard Retanubun @ 2013-06-14 13:15 UTC (permalink / raw)
To: u-boot
On 14/06/13 09:12 AM, Axel Lin wrote:
> This change slightly improves readability.
>
> Signed-off-by: Axel Lin<axel.lin@ingics.com>
> ---
> 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<richardretanubun@ruggedcom.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 1/2] spi: cf_qspi: Use DIV_ROUND_UP at appropriate place
2013-06-14 13:15 ` [U-Boot] [PATCH 1/2] spi: cf_qspi: Use DIV_ROUND_UP at appropriate place Richard Retanubun
@ 2013-06-14 15:10 ` Jagan Teki
2013-06-14 17:05 ` Jagan Teki
0 siblings, 1 reply; 7+ messages in thread
From: Jagan Teki @ 2013-06-14 15:10 UTC (permalink / raw)
To: u-boot
On 14-06-2013 18:45, Richard Retanubun wrote:
> On 14/06/13 09:12 AM, Axel Lin wrote:
>> This change slightly improves readability.
>>
>> Signed-off-by: Axel Lin<axel.lin@ingics.com>
>> ---
>> 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<richardretanubun@ruggedcom.com>
Reviewed-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
--
Thanks,
Jagan.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 2/2] spi: mxc_spi: Use DIV_ROUND_UP at appropriate places
2013-06-14 13:13 ` [U-Boot] [PATCH 2/2] spi: mxc_spi: Use DIV_ROUND_UP at appropriate places Axel Lin
@ 2013-06-14 15:11 ` Jagan Teki
2013-06-14 17:05 ` Jagan Teki
0 siblings, 1 reply; 7+ messages in thread
From: Jagan Teki @ 2013-06-14 15:11 UTC (permalink / raw)
To: u-boot
On 14-06-2013 18:43, Axel Lin wrote:
> This change slightly improves readability.
>
> Signed-off-by: Axel Lin <axel.lin@ingics.com>
> ---
> drivers/spi/mxc_spi.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
> index 5bed858..2ea3228 100644
> --- a/drivers/spi/mxc_spi.c
> +++ b/drivers/spi/mxc_spi.c
> @@ -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;
>
Reviewed-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
--
Thanks,
Jagan.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 1/2] spi: cf_qspi: Use DIV_ROUND_UP at appropriate place
2013-06-14 15:10 ` Jagan Teki
@ 2013-06-14 17:05 ` Jagan Teki
0 siblings, 0 replies; 7+ messages in thread
From: Jagan Teki @ 2013-06-14 17:05 UTC (permalink / raw)
To: u-boot
On 14-06-2013 20:40, Jagan Teki wrote:
> On 14-06-2013 18:45, Richard Retanubun wrote:
>> On 14/06/13 09:12 AM, Axel Lin wrote:
>>> This change slightly improves readability.
>>>
>>> Signed-off-by: Axel Lin<axel.lin@ingics.com>
>>> ---
>>> 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<richardretanubun@ruggedcom.com>
>
> Reviewed-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
Applied to u-boot-spi/master
--
Thanks,
Jagan.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 2/2] spi: mxc_spi: Use DIV_ROUND_UP at appropriate places
2013-06-14 15:11 ` Jagan Teki
@ 2013-06-14 17:05 ` Jagan Teki
0 siblings, 0 replies; 7+ messages in thread
From: Jagan Teki @ 2013-06-14 17:05 UTC (permalink / raw)
To: u-boot
On 14-06-2013 20:41, Jagan Teki wrote:
> On 14-06-2013 18:43, Axel Lin wrote:
>> This change slightly improves readability.
>>
>> Signed-off-by: Axel Lin <axel.lin@ingics.com>
>> ---
>> drivers/spi/mxc_spi.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/spi/mxc_spi.c b/drivers/spi/mxc_spi.c
>> index 5bed858..2ea3228 100644
>> --- a/drivers/spi/mxc_spi.c
>> +++ b/drivers/spi/mxc_spi.c
>> @@ -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;
>>
>
> Reviewed-by: Jagannadha Sutradharudu Teki <jagannadh.teki@gmail.com>
Applied to u-boot-spi/master
--
Thanks,
Jagan.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-06-14 17:05 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-14 13:12 [U-Boot] [PATCH 1/2] spi: cf_qspi: Use DIV_ROUND_UP at appropriate place Axel Lin
2013-06-14 13:13 ` [U-Boot] [PATCH 2/2] spi: mxc_spi: Use DIV_ROUND_UP at appropriate places Axel Lin
2013-06-14 15:11 ` Jagan Teki
2013-06-14 17:05 ` Jagan Teki
2013-06-14 13:15 ` [U-Boot] [PATCH 1/2] spi: cf_qspi: Use DIV_ROUND_UP at appropriate place Richard Retanubun
2013-06-14 15:10 ` Jagan Teki
2013-06-14 17:05 ` Jagan Teki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox