[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231011123336.642881b8@xps-13>
Date: Wed, 11 Oct 2023 12:33:36 +0200
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
Michael Walle <michael@...le.cc>,
Rafał Miłecki <rafal@...ecki.pl>,
Rob Herring <robh+dt@...nel.org>,
Frank Rowand <frowand.list@...il.com>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
Robert Marko <robert.marko@...tura.hr>,
Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
Luka Perkov <luka.perkov@...tura.hr>,
Randy Dunlap <rdunlap@...radead.org>,
Chen-Yu Tsai <wenst@...omium.org>,
Daniel Golle <daniel@...rotopia.org>
Subject: Re: [PATCH v12 5/7] nvmem: core: Rework layouts to become regular
devices
Hi Greg,
gregkh@...uxfoundation.org wrote on Sat, 7 Oct 2023 18:31:00 +0200:
> On Thu, Oct 05, 2023 at 05:59:05PM +0200, Miquel Raynal wrote:
> > --- a/drivers/nvmem/internals.h
> > +++ b/drivers/nvmem/internals.h
> > @@ -28,8 +28,30 @@ struct nvmem_device {
> > nvmem_reg_read_t reg_read;
> > nvmem_reg_write_t reg_write;
> > struct gpio_desc *wp_gpio;
> > + struct device *layout_dev;
> > struct nvmem_layout *layout;
> > void *priv;
> > };
>
> Wait, is this now 2 struct device in the same structure? Which one is
> the "real" owner of this structure? Why is a pointer to layout_dev
> needed here as a "struct device" and not a real "struct
> nvmem_layout_device" or whatever it's called?
>
> > struct nvmem_layout {
> > - const char *name;
> > - const struct of_device_id *of_match_table;
> > + struct device *dev;
>
> Shouldn't this be a "real" struct device and not just a pointer? If
> not, what does this point to? Who owns the reference to it?
Good point, I've initially tried to create the simplest possible bus,
but you're right it will be nicer if the layout device structure
carries the 'struct device'. I've added a bit of infrstracture but it
looks better, thanks for the suggestion.
Thanks,
Miquèl
Powered by blists - more mailing lists