All of lore.kernel.org
 help / color / mirror / Atom feed
From: James Hogan <james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
To: Sifan Naeem <sifan.naeem-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>,
	Wolfram Sang <wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org>,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: "Stable kernel (v3.19+)"
	<stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: [PATCH 3/8] i2c: img-scb: use DIV_ROUND_UP to round divisor values
Date: Tue, 28 Jul 2015 11:45:14 +0100	[thread overview]
Message-ID: <55B75D3A.40101@imgtec.com> (raw)
In-Reply-To: <1437997641-32575-4-git-send-email-sifan.naeem-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 1476 bytes --]

On 27/07/15 12:47, Sifan Naeem wrote:
> Using % can be slow depending on the architecture.
> 
> Using DIV_ROUND_UP is nicer and more efficient way to do it.
> 
> Fixes: 27bce4 ("i2c: img-scb: Add Imagination Technologies I2C SCB driver")
> Signed-off-by: Sifan Naeem <sifan.naeem-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
> Cc: Stable kernel (v3.19+) <stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>

Acked-by: James Hogan <james.hogan-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>

Cheers
James

> ---
>  drivers/i2c/busses/i2c-img-scb.c |    8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c
> index 0368d91..b4f59e1 100644
> --- a/drivers/i2c/busses/i2c-img-scb.c
> +++ b/drivers/i2c/busses/i2c-img-scb.c
> @@ -1179,9 +1179,7 @@ static int img_i2c_init(struct img_i2c *i2c)
>  		int_bitrate++;
>  
>  	/* Setup TCKH value */
> -	tckh = timing.tckh / clk_period;
> -	if (timing.tckh % clk_period)
> -		tckh++;
> +	tckh = DIV_ROUND_UP(timing.tckh, clk_period);
>  
>  	if (tckh > 0)
>  		data = tckh - 1;
> @@ -1201,9 +1199,7 @@ static int img_i2c_init(struct img_i2c *i2c)
>  	img_i2c_writel(i2c, SCB_TIME_TCKL_REG, data);
>  
>  	/* Setup TSDH value */
> -	tsdh = timing.tsdh / clk_period;
> -	if (timing.tsdh % clk_period)
> -		tsdh++;
> +	tsdh = DIV_ROUND_UP(timing.tsdh, clk_period);
>  
>  	if (tsdh > 1)
>  		data = tsdh - 1;
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: James Hogan <james.hogan@imgtec.com>
To: Sifan Naeem <sifan.naeem@imgtec.com>,
	Wolfram Sang <wsa@the-dreams.de>, <linux-i2c@vger.kernel.org>
Cc: "Stable kernel (v3.19+)" <stable@vger.kernel.org>
Subject: Re: [PATCH 3/8] i2c: img-scb: use DIV_ROUND_UP to round divisor values
Date: Tue, 28 Jul 2015 11:45:14 +0100	[thread overview]
Message-ID: <55B75D3A.40101@imgtec.com> (raw)
In-Reply-To: <1437997641-32575-4-git-send-email-sifan.naeem@imgtec.com>

[-- Attachment #1: Type: text/plain, Size: 1394 bytes --]

On 27/07/15 12:47, Sifan Naeem wrote:
> Using % can be slow depending on the architecture.
> 
> Using DIV_ROUND_UP is nicer and more efficient way to do it.
> 
> Fixes: 27bce4 ("i2c: img-scb: Add Imagination Technologies I2C SCB driver")
> Signed-off-by: Sifan Naeem <sifan.naeem@imgtec.com>
> Cc: Stable kernel (v3.19+) <stable@vger.kernel.org>

Acked-by: James Hogan <james.hogan@imgtec.com>

Cheers
James

> ---
>  drivers/i2c/busses/i2c-img-scb.c |    8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-img-scb.c b/drivers/i2c/busses/i2c-img-scb.c
> index 0368d91..b4f59e1 100644
> --- a/drivers/i2c/busses/i2c-img-scb.c
> +++ b/drivers/i2c/busses/i2c-img-scb.c
> @@ -1179,9 +1179,7 @@ static int img_i2c_init(struct img_i2c *i2c)
>  		int_bitrate++;
>  
>  	/* Setup TCKH value */
> -	tckh = timing.tckh / clk_period;
> -	if (timing.tckh % clk_period)
> -		tckh++;
> +	tckh = DIV_ROUND_UP(timing.tckh, clk_period);
>  
>  	if (tckh > 0)
>  		data = tckh - 1;
> @@ -1201,9 +1199,7 @@ static int img_i2c_init(struct img_i2c *i2c)
>  	img_i2c_writel(i2c, SCB_TIME_TCKL_REG, data);
>  
>  	/* Setup TSDH value */
> -	tsdh = timing.tsdh / clk_period;
> -	if (timing.tsdh % clk_period)
> -		tsdh++;
> +	tsdh = DIV_ROUND_UP(timing.tsdh, clk_period);
>  
>  	if (tsdh > 1)
>  		data = tsdh - 1;
> 


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

  parent reply	other threads:[~2015-07-28 10:45 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-27 11:47 [PATCH 0/8] i2c: img-scb: fixes to support i2c on pistachio Sifan Naeem
2015-07-27 11:47 ` Sifan Naeem
2015-07-27 11:47 ` [PATCH 2/8] i2c: img-scb: do dummy writes before fifo access Sifan Naeem
2015-07-27 11:47   ` Sifan Naeem
2015-07-27 11:47 ` [PATCH 5/8] i2c: img-scb: reset interrupts in img_i2c_soft_reset Sifan Naeem
2015-07-27 11:47   ` Sifan Naeem
     [not found]   ` <1437997641-32575-6-git-send-email-sifan.naeem-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2015-07-28 11:35     ` James Hogan
2015-07-28 11:35       ` James Hogan
2015-07-28 11:46       ` Sifan Naeem
2015-07-28 11:51         ` James Hogan
2015-07-27 11:47 ` [PATCH 6/8] i2c: img-scb: remove start bit detected status after handling Sifan Naeem
2015-07-27 11:47   ` Sifan Naeem
2015-07-28 13:53   ` James Hogan
2015-07-28 13:53     ` James Hogan
2015-07-29 12:49     ` Sifan Naeem
2015-07-27 11:47 ` [PATCH 7/8] i2c: img-scb: improve transaction complete handle Sifan Naeem
2015-07-27 11:47   ` Sifan Naeem
     [not found]   ` <1437997641-32575-8-git-send-email-sifan.naeem-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2015-07-29 12:22     ` James Hogan
2015-07-29 12:22       ` James Hogan
     [not found]       ` <55B8C56A.7050102-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2015-07-29 13:35         ` Sifan Naeem
2015-07-29 13:35           ` Sifan Naeem
2015-07-27 11:47 ` [PATCH 8/8] i2c: img-scb: verify support for requested bit rate Sifan Naeem
2015-07-27 11:47   ` Sifan Naeem
2015-07-29 12:02   ` James Hogan
2015-07-29 12:02     ` James Hogan
2015-07-29 13:34     ` Sifan Naeem
     [not found] ` <1437997641-32575-1-git-send-email-sifan.naeem-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2015-07-27 11:47   ` [PATCH 1/8] i2c: img-scb: enable fencing for all versions of the ip Sifan Naeem
2015-07-27 11:47     ` Sifan Naeem
2015-07-27 20:20     ` James Hogan
2015-07-27 20:20       ` James Hogan
2015-07-28  9:26       ` Sifan Naeem
2015-07-28  9:38         ` James Hogan
2015-07-27 11:47   ` [PATCH 3/8] i2c: img-scb: use DIV_ROUND_UP to round divisor values Sifan Naeem
2015-07-27 11:47     ` Sifan Naeem
     [not found]     ` <1437997641-32575-4-git-send-email-sifan.naeem-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org>
2015-07-28 10:45       ` James Hogan [this message]
2015-07-28 10:45         ` James Hogan
2015-07-27 11:47   ` [PATCH 4/8] i2c: img-scb: fix LOW and HIGH period values for the SCL clock Sifan Naeem
2015-07-27 11:47     ` Sifan Naeem
2015-07-28 11:27     ` James Hogan
2015-07-28 11:27       ` James Hogan
2015-07-31 11:12   ` [PATCH 0/8] i2c: img-scb: fixes to support i2c on pistachio Wolfram Sang
2015-07-31 11:12     ` Wolfram Sang
2015-09-07 13:41     ` Ezequiel Garcia
     [not found]       ` <CAAEAJfCW9cEMDZwta5Q6VVEZfzxTDZ50Fx=YeW6bPMnrtKNcbw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-09-07 13:50         ` Wolfram Sang
2015-09-07 14:22           ` Ezequiel Garcia
     [not found]             ` <CAAEAJfBj+qdv58gzOnqMrmN0486Enzbn3G1L0KhMctMkEkXfTw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-09-07 21:13               ` i2ctransfer (Was: [PATCH 0/8] i2c: img-scb: fixes to support i2c on pistachio) Jean Delvare

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55B75D3A.40101@imgtec.com \
    --to=james.hogan-1axoqhu6uovqt0dzr+alfa@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sifan.naeem-1AXoQHu6uovQT0dZR+AlfA@public.gmane.org \
    --cc=stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.