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]
Date:	Wed, 2 Mar 2016 23:46:39 +0200
From:	Vladimir Zapolskiy <vz@...ia.com>
To:	Andrew Lunn <andrew@...n.ch>
Cc:	GregKH <greg@...ah.com>, srinivas.kandagatla@...aro.org,
	maxime.ripard@...e-electrons.com, wsa@...-dreams.de,
	broonie@...nel.org, linux-kernel@...r.kernel.org,
	pantelis.antoniou@...sulko.com, bgolaszewski@...libre.com
Subject: Re: [PATCHv7 3/7] eeprom: at24: extend driver to plug into the NVMEM
 framework

Hi Andrew,

On 26.02.2016 21:59, Andrew Lunn wrote:
> Add a regmap for accessing the EEPROM, and then use that with the
> NVMEM framework. Set the NVMEM config structure to enable backward, so
> that the 'eeprom' file in sys is provided by the framework.
> 
> Signed-off-by: Andrew Lunn <andrew@...n.ch>
> Acked-by: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
> Tested-by: Bartosz Golaszewski <bgolaszewski@...libre.com>
> ---

[snip]

> +static int at24_regmap_read(void *context, const void *reg, size_t reg_size,
> +			    void *val, size_t val_size)
> +{
> +	struct at24_data *at24 = context;
> +	off_t offset = *(u32 *)reg;
> +	int err;
> +
> +	err = at24_read(at24, val, offset, val_size);
> +	if (err)
> +		return err;
> +	return 0;

return at24_read(at24, val, offset, val_size);

Minus 5 LoC.

> +}
> +
> +static int at24_regmap_write(void *context, const void *data, size_t count)
> +{
> +	struct at24_data *at24 = context;
> +	const char *buf;
> +	u32 offset;
> +	size_t len;
> +	int err;
> +
> +	memcpy(&offset, data, sizeof(offset));
> +	buf = (const char *)data + sizeof(offset);
> +	len = count - sizeof(offset);
> +
> +	err = at24_write(at24, buf, offset, len);
> +	if (err)
> +		return err;
> +	return 0;

return at24_write(at24, buf, offset, len);

Minus another 5 LoC.

--
With best wishes,
Vladimir

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ