lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2023080732-gulp-pancake-93a5@gregkh>
Date:   Mon, 7 Aug 2023 11:02:35 +0200
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Miquel Raynal <miquel.raynal@...tlin.com>
Cc:     Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
        Thomas Petazzoni <thomas.petazzoni@...tlin.com>,
        Robert Marko <robert.marko@...tura.hr>,
        Luka Perkov <luka.perkov@...tura.hr>,
        Michael Walle <michael@...le.cc>, linux-kernel@...r.kernel.org,
        Randy Dunlap <rdunlap@...radead.org>,
        Chen-Yu Tsai <wenst@...omium.org>,
        Daniel Golle <daniel@...rotopia.org>,
        Rafał Miłecki <rafal@...ecki.pl>
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@...tlin.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ