Re: [PATCH v12 5/7] nvmem: core: Rework layouts to become regular devices

Greg Kroah-Hartman
2023-10-07T16:31:16Z

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?

thanks,

greg k-h