Messages in this thread | | | Date | Mon, 7 Aug 2023 11:02:35 +0200 | From | Greg Kroah-Hartman <> | Subject | Re: [PATCH v8 4/8] nvmem: core: Track the registered devices |
| |
On Mon, Aug 07, 2023 at 10:24:15AM +0200, Miquel Raynal wrote: > Create a list with all the NVMEM devices registered in the > subsystem. This way we can iterate through them when needed (unused for > now). > > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> > --- > drivers/nvmem/core.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c > index 257328887263..4e81e0aaf433 100644 > --- a/drivers/nvmem/core.c > +++ b/drivers/nvmem/core.c > @@ -23,6 +23,7 @@ > struct nvmem_device { > struct module *owner; > struct device dev; > + struct list_head node; > int stride; > int word_size; > int id; > @@ -76,6 +77,9 @@ static LIST_HEAD(nvmem_cell_tables); > static DEFINE_MUTEX(nvmem_lookup_mutex); > static LIST_HEAD(nvmem_lookup_list); > > +static DEFINE_MUTEX(nvmem_devices_mutex); > +static LIST_HEAD(nvmem_devices_list);
But this list should already be in the driver core, why create yet-another-list-and-lock?
Why is "when needed" not sufficient to use the list already present?
And now note, you have the same structure on 2 different lists, watch out for device lifetime rules :(
thanks,
greg k-h
| |