From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422980AbcBQN11 (ORCPT ); Wed, 17 Feb 2016 08:27:27 -0500 Received: from vps0.lunn.ch ([178.209.37.122]:50100 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422680AbcBQN1Z (ORCPT ); Wed, 17 Feb 2016 08:27:25 -0500 Date: Wed, 17 Feb 2016 14:27:18 +0100 From: Andrew Lunn To: Srinivas Kandagatla Cc: GregKH , maxime.ripard@free-electrons.com, wsa@the-dreams.de, broonie@kernel.org, vz@mleia.com, fd@ti.com, linux-kernel@vger.kernel.org, pantelis.antoniou@konsulko.com, bgolaszewski@baylibre.com Subject: Re: [PATCHv4 2/7] nvmem: Add backwards compatibility support for older EEPROM drivers. Message-ID: <20160217132718.GA17326@lunn.ch> References: <1455666097-9115-1-git-send-email-andrew@lunn.ch> <1455666097-9115-3-git-send-email-andrew@lunn.ch> <56C448BE.30303@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56C448BE.30303@linaro.org> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 17, 2016 at 10:17:34AM +0000, Srinivas Kandagatla wrote: > > > On 16/02/16 23:41, Andrew Lunn wrote: > >Older drivers made an 'eeprom' file available in the /sys device > >directory. Have the NVMEM core provide this to retain backwards > >compatibility. > > > >Signed-off-by: Andrew Lunn > >--- > >v4: Add lockdep support > >--- > > drivers/nvmem/core.c | 84 ++++++++++++++++++++++++++++++++++++++---- > > include/linux/nvmem-provider.h | 4 +- > > 2 files changed, 79 insertions(+), 9 deletions(-) > > > >diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c > >index 4ccf03da6467..9ad1c2cf75ac 100644 > >--- a/drivers/nvmem/core.c > >+++ b/drivers/nvmem/core.c > >@@ -38,8 +38,13 @@ struct nvmem_device { > > int users; > > size_t size; > > bool read_only; > >+ int flags; > >+ struct bin_attribute eeprom; > >+ struct device *base_dev; > > Any reason why should this base_dev be any different to the dev in > the nvmem_config? > Should we just not reuse dev? unless am missing something obvious. Hi Srinivas For backwards compatibility, we need the 'eeprom' file to be in the i2c or spi device directory under /sys. This is the base_dev. The nvmem file should be in the /sys/class/nvmem directory. This is the dev in nvmem_device structure. I don't think you can merge them. e.g. consider: nvmem->dev.type = &nvmem_provider_type; nvmem->dev.bus = &nvmem_bus_type; nvmem->dev.parent = config->dev; np = config->dev->of_node; The base device is an i2c device on an i2c bus. Would it work if it suddenly became an nvmem_provider on an nvmem_bus? Thanks Andrew