lkml.org 
[lkml]   [2019]   [Oct]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 1/2] i2c: slave-eeprom: initialize empty eeprom properly
From
Date
Hi,


I sent in another patch earlier that added support for specifying a file
in devicetree to initilize the eeprom from, corresponding to the case of
pre-flashed eeprom. Maybe these two patches should be merged so this
initialization is only done if no file is specified?


/BA

On 10/1/19 6:40 PM, Patrick Williams wrote:
> The i2c-slave-eeprom driver emulates at24 class eeprom devices,
> which come initialized with all 1s. Do the same in the software
> emulation.
>
> Signed-off-by: Patrick Williams <alpawi@amazon.com>
> ---
> drivers/i2c/i2c-slave-eeprom.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/i2c/i2c-slave-eeprom.c b/drivers/i2c/i2c-slave-eeprom.c
> index db9763cb4dae..efee56106251 100644
> --- a/drivers/i2c/i2c-slave-eeprom.c
> +++ b/drivers/i2c/i2c-slave-eeprom.c
> @@ -131,6 +131,8 @@ static int i2c_slave_eeprom_probe(struct i2c_client *client, const struct i2c_de
> if (!eeprom)
> return -ENOMEM;
>
> + memset(eeprom->buffer, 0xFF, size);
> +
> eeprom->idx_write_cnt = 0;
> eeprom->num_address_bytes = flag_addr16 ? 2 : 1;
> eeprom->address_mask = size - 1;

\
 
 \ /
  Last update: 2019-10-02 08:21    [W:0.093 / U:0.592 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site