public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Darius <augulis.darius-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2] iMX/MXC support for I2C
Date: Mon, 12 Jan 2009 16:29:00 +0200	[thread overview]
Message-ID: <gkfnji$uo4$2@ger.gmane.org> (raw)
In-Reply-To: <20081216213455.GC8032-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org>

Ben Dooks wrote:

>> +static void __init i2c_imx_set_clk(struct imx_i2c_struct *i2c_imx,
>> +							unsigned int rate)
>> +{
>> +	unsigned int i2c_clk_rate;
>> +	unsigned int div;
>> +	int i;
>> +
>> +	/* Divider value calculation */
>> +	i2c_clk_rate = clk_get_rate(i2c_imx->clk);
>> +	div = (i2c_clk_rate + rate - 1) / rate;
>> +	if (div < i2c_clk_div[0][0])
>> +		i = 0;
>> +	else if (div > i2c_clk_div[ARRAY_SIZE(i2c_clk_div) - 1][0])
>> +		i = ARRAY_SIZE(i2c_clk_div) - 1;
>> +	else
>> +		for (i = 0; i2c_clk_div[i][0] < div; i++);
> 
> I'm not sure if I really like the use of
> 'i2c_clk_div[ARRAY_SIZE(i2c_clk_div) - 1]; a lot, I'll see if I
> can think of anything better.
> 

How about this? I think it's ok?
I'd like to prepare ready version for adding to mainline.

  parent reply	other threads:[~2009-01-12 14:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-08 10:08 [PATCH v2] iMX/MXC support for I2C Darius
     [not found] ` <493CF201.8030406-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2008-12-08 10:15   ` Darius
     [not found]     ` <493CF3D5.7010706-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2008-12-16 21:14       ` Ben Dooks
2008-12-16 21:34   ` Ben Dooks
     [not found]     ` <20081216213455.GC8032-elnMNo+KYs3pIgCt6eIbzw@public.gmane.org>
2009-01-12 14:29       ` Darius [this message]
2009-01-12 14:45   ` [PATCH] i2c: Platform data is optional for i2c-imx Mark Brown
     [not found]     ` <1231771521-3772-1-git-send-email-broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2009-01-12 13:54       ` Darius

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='gkfnji$uo4$2@ger.gmane.org' \
    --to=augulis.darius-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox