[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMpxmJVqEHBZRTxwK1Dviz2MH=MUpNbUdtkVLjn0E2BM_HiCbQ@mail.gmail.com>
Date: Thu, 24 Sep 2020 15:14:24 +0200
From: Bartosz Golaszewski <bgolaszewski@...libre.com>
To: Jon Hunter <jonathanh@...dia.com>
Cc: Rob Herring <robh+dt@...nel.org>,
Thierry Reding <thierry.reding@...il.com>,
linux-i2c <linux-i2c@...r.kernel.org>,
linux-devicetree <devicetree@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>, linux-tegra@...r.kernel.org
Subject: Re: [PATCH V2 1/5] misc: eeprom: at24: Initialise AT24 NVMEM ID field
On Wed, Sep 16, 2020 at 11:50 AM Jon Hunter <jonathanh@...dia.com> wrote:
>
> The AT24 EEPROM driver does not initialise the 'id' field of the
> nvmem_config structure and because the entire structure is not
> initialised, it ends up with a random value. This causes the NVMEM
> driver to append the device 'devid' value to name of the NVMEM
> device. Ideally for I2C devices such as the AT24 that already have a
> unique name, we would not bother to append the 'devid'. However, given
> that this has always been done for AT24 devices, we cannot remove the
> 'devid' as this will change the name of the userspace sysfs node for
> the NVMEM device. Nonetheless we should ensure that the 'id' field of
> the nvmem_config structure is initialised so that there is no chance of
> a random value causes problems in the future. Therefore, set the NVMEM
> config.id to NVMEM_DEVID_AUTO for AT24 EEPROMs so that the 'devid' is
> always appended.
>
> Signed-off-by: Jon Hunter <jonathanh@...dia.com>
> ---
> drivers/misc/eeprom/at24.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
> index e9df1ca251df..f76624b5c033 100644
> --- a/drivers/misc/eeprom/at24.c
> +++ b/drivers/misc/eeprom/at24.c
> @@ -715,6 +715,7 @@ static int at24_probe(struct i2c_client *client)
>
> nvmem_config.name = dev_name(dev);
> nvmem_config.dev = dev;
> + nvmem_config.id = NVMEM_DEVID_AUTO;
> nvmem_config.read_only = !writable;
> nvmem_config.root_only = !(flags & AT24_FLAG_IRUGO);
> nvmem_config.owner = THIS_MODULE;
> --
> 2.25.1
>
Ha! I only now noticed I already have a patch for this in my tree from
Vadym Kochan for this cycle. I'll drop this one.
Bartosz
Powered by blists - more mailing lists