The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Chen-Yu Tsai <wenst@chromium.org>
Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-kernel@vger.kernel.org,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	Robert Marko <robert.marko@sartura.hr>,
	Luka Perkov <luka.perkov@sartura.hr>,
	Michael Walle <michael@walle.cc>,
	Randy Dunlap <rdunlap@infradead.org>
Subject: Re: [PATCH v6 3/3] nvmem: core: Expose cells through sysfs
Date: Mon, 31 Jul 2023 18:05:31 +0200	[thread overview]
Message-ID: <20230731180531.7c616b3b@xps-13> (raw)
In-Reply-To: <20230718102617.GA982837@google.com>

Hi Chen-Yu,

> >  static int nvmem_sysfs_setup_compat(struct nvmem_device *nvmem,
> > @@ -1006,6 +1101,12 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
> >  	if (rval)
> >  		goto err_remove_cells;
> >  
> > +#ifdef CONFIG_NVMEM_SYSFS
> > +	rval = nvmem_populate_sysfs_cells(nvmem);
> > +	if (rval)
> > +		goto err_remove_cells;  
> 
> This breaks nvmem / efuse devices with multiple cells that share the
> same name. Something like this in DT:
> 
> 	efuse: efuse@11f10000 {
> 		compatible = "mediatek,mt8183-efuse",
> 			     "mediatek,efuse";
> 		reg = <0 0x11f10000 0 0x1000>;
> 		#address-cells = <1>;
> 		#size-cells = <1>;
> 		thermal_calibration: calib@180 {
> 			reg = <0x180 0xc>;
> 		};
> 
> 		mipi_tx_calibration: calib@190 {
> 			reg = <0x190 0xc>;
> 		};
> 
> 		svs_calibration: calib@580 {
> 			reg = <0x580 0x64>;
> 		};
> 	};
> 
> creates three cells, all named DT, and sysfs will complain:
> 
>     sysfs: cannot create duplicate filename '/devices/platform/soc/11f10000.efuse/nvmem1/cells/calib'
>     mediatek,efuse: probe of 11f10000.efuse failed with error -17
> 
> This causes the MT8183-based Chromebooks to lose display capability,
> among other things.

Sorry for the breakage, I did not identify this case, but you're right
this is incorrectly handled currently.

> The problem lies in the nvmem DT parsing code, where the cell name is
> derived from the node name, without including the address portion.
> However I'm not sure we can change that, since it could be considered
> ABI?

I would be in favor suffixing the cell names anyway as they have not
been exposed yet to userspace at all (well, not more than a couple of
days in -next).

Thanks,
Miquèl

      reply	other threads:[~2023-07-31 16:06 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-17  7:51 [PATCH v6 0/3] NVMEM cells in sysfs Miquel Raynal
2023-07-17  7:51 ` [PATCH v6 1/3] ABI: sysfs-nvmem-cells: Expose cells through sysfs Miquel Raynal
2023-07-23 19:39   ` John Thomson
2023-07-31 15:51     ` Miquel Raynal
2023-08-01  9:06       ` Srinivas Kandagatla
2023-08-01 16:50         ` Miquel Raynal
2023-07-17  7:51 ` [PATCH v6 2/3] nvmem: core: Create all cells before adding the nvmem device Miquel Raynal
2023-07-17  7:51 ` [PATCH v6 3/3] nvmem: core: Expose cells through sysfs Miquel Raynal
2023-07-17 12:24   ` Michael Walle
2023-07-17 16:41     ` Miquel Raynal
2023-07-17 14:32   ` Greg Kroah-Hartman
2023-07-17 16:33     ` Miquel Raynal
2023-07-17 16:59       ` Greg Kroah-Hartman
2023-07-31 15:33         ` Miquel Raynal
2023-08-01  9:56           ` Greg Kroah-Hartman
2023-08-01 16:54             ` Miquel Raynal
2023-07-18 10:26   ` Chen-Yu Tsai
2023-07-31 16:05     ` Miquel Raynal [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230731180531.7c616b3b@xps-13 \
    --to=miquel.raynal@bootlin.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luka.perkov@sartura.hr \
    --cc=michael@walle.cc \
    --cc=rdunlap@infradead.org \
    --cc=robert.marko@sartura.hr \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=wenst@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox