lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAD=FV=XHOuQZPOrVRtoTGN2Yq6E7fuKSa+AM6U_MYKAoZ+nKBA@mail.gmail.com>
Date:	Sun, 12 Oct 2014 14:24:06 -0700
From:	Doug Anderson <dianders@...omium.org>
To:	Max Schwarz <max.schwarz@...ine.de>
Cc:	Addy Ke <addy.ke@...k-chips.com>, Wolfram Sang <wsa@...-dreams.de>,
	Heiko Stübner <heiko@...ech.de>,
	Olof Johansson <olof@...om.net>,
	"linux-i2c@...r.kernel.org" <linux-i2c@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	linux-rockchip@...ts.infradead.org, Eddie Cai <cf@...k-chips.com>,
	Jianqun Xu <xjq@...k-chips.com>,
	Tao Huang <huangtao@...k-chips.com>,
	Chris <zyw@...k-chips.com>,
	姚智情 <yzq@...k-chips.com>,
	han jiang <hj@...k-chips.com>,
	Kever Yang <kever.yang@...k-chips.com>,
	Lin Huang <hl@...k-chips.com>,
	晓腾王 <caesar.wang@...k-chips.com>,
	Shunqian Zheng <zhengsq@...k-chips.com>
Subject: Re: [PATCH v4] i2c: rk3x: adjust the LOW divison based on
 characteristics of SCL

Max,

On Sun, Oct 12, 2014 at 5:10 AM, Max Schwarz <max.schwarz@...ine.de> wrote:
>> +     /* Adjust to avoid overflow */
>> +     i2c_rate_khz = DIV_ROUND_UP(i2c_rate, 1000);
>> +     scl_rate_khz = DIV_ROUND_UP(scl_rate, 1000);
>
> I'm not really comfortable with using DIV_ROUND_UP on the last line, since
> this may violate the user's set SCL rate. Rounding up 1.1kHz SCL rate to 2kHz
> is not good.

Ah, good point.  So we round up for i2c_rate and down for scl_rate:

  i2c_rate_khz = DIV_ROUND_UP(i2c_rate, 1000);
  scl_rate_khz = scl_rate / 1000;


> I suggest using scl_rate / 1000 and placing a
>
> if(WARN_ON(scl_rate < 1000))
>   scl_rate = 1000;
>
> somewhere to prevent scl_rate_khz from becoming 0.

Ah, makes sense.  Yeah, that should be at the top.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ