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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5311C8FB.4000301@kernel.org>
Date:	Sat, 01 Mar 2014 11:48:11 +0000
From:	Jonathan Cameron <jic23@...nel.org>
To:	Sebastian Reichel <sre@...ian.org>,
	Sebastian Reichel <sre@...g0.de>,
	Marek Belisko <marek@...delico.com>
CC:	Lee Jones <lee.jones@...aro.org>,
	Samuel Ortiz <sameo@...ux.intel.com>,
	Lars-Peter Clausen <lars@...afoo.de>,
	Rob Herring <robh+dt@...nel.org>,
	Pawel Moll <pawel.moll@....com>,
	Mark Rutland <mark.rutland@....com>,
	Ian Campbell <ijc+devicetree@...lion.org.uk>,
	Kumar Gala <galak@...eaurora.org>,
	Grant Likely <grant.likely@...aro.org>,
	linux-kernel@...r.kernel.org, devicetree@...r.kernel.org,
	linux-iio@...r.kernel.org
Subject: Re: [RFCv4 4/7] mfd: twl-core: Add twl_i2c_read/write_u16

On 26/02/14 20:03, Sebastian Reichel wrote:
> Add a simple twl_i2c_read/write_u16 wrapper over
> the twl_i2c_read/write, which is similar to the
> twl_i2c_read/write_u8 wrapper.
>
> Signed-off-by: Sebastian Reichel <sre@...ian.org>
> Acked-by: Lee Jones <lee.jones@...aro.org>
Acked-by: Jonathan Cameron <jic23@...nel.org>

(I'll start a separate conversation about who will take this series in a mo).

> ---
>   include/linux/i2c/twl.h | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
>
> diff --git a/include/linux/i2c/twl.h b/include/linux/i2c/twl.h
> index ade1c06..d2b1670 100644
> --- a/include/linux/i2c/twl.h
> +++ b/include/linux/i2c/twl.h
> @@ -195,6 +195,18 @@ static inline int twl_i2c_read_u8(u8 mod_no, u8 *val, u8 reg) {
>   	return twl_i2c_read(mod_no, val, reg, 1);
>   }
>
>
Hmm. This had me confused for a few mins given word rights in i2c are guaranteed
to be little endian unless the swapped versions are used.  I see that the twl
driver is using a generic i2c bulk write.  Ah well, I can see that simplifies
the regmap i2c code and works in most cases...
+static inline int twl_i2c_write_u16(u8 mod_no, u16 val, u8 reg) {
> +	val = cpu_to_le16(val);
> +	return twl_i2c_write(mod_no, (u8*) &val, reg, 2);
> +}
> +
> +static inline int twl_i2c_read_u16(u8 mod_no, u16 *val, u8 reg) {
> +	int ret;
> +	ret = twl_i2c_read(mod_no, (u8*) val, reg, 2);
> +	*val = le16_to_cpu(*val);
> +	return ret;
> +}
> +
>   int twl_get_type(void);
>   int twl_get_version(void);
>   int twl_get_hfclk_rate(void);
>

--
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