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]
Date:   Wed, 5 Sep 2018 16:21:35 +0200
From:   Boris Brezillon <boris.brezillon@...tlin.com>
To:     Bartosz Golaszewski <brgl@...ev.pl>
Cc:     Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
        Joachim Eastwood <manabian@...il.com>,
        "David S . Miller" <davem@...emloft.net>,
        Mauro Carvalho Chehab <mchehab+samsung@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Arnd Bergmann <arnd@...db.de>,
        Jonathan Corbet <corbet@....net>, Sekhar Nori <nsekhar@...com>,
        Kevin Hilman <khilman@...nel.org>,
        David Lechner <david@...hnology.com>,
        Andrew Lunn <andrew@...n.ch>, Alban Bedel <albeu@...e.fr>,
        Maxime Ripard <maxime.ripard@...tlin.com>,
        linux-doc <linux-doc@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Linux ARM <linux-arm-kernel@...ts.infradead.org>,
        Bartosz Golaszewski <bgolaszewski@...libre.com>
Subject: Re: [PATCH 11/13] nvmem: add support for cell lookups from machine
 code

On Wed, 5 Sep 2018 16:00:36 +0200
Bartosz Golaszewski <brgl@...ev.pl> wrote:

> 2018-09-05 15:57 GMT+02:00 Boris Brezillon <boris.brezillon@...tlin.com>:
> > On Wed,  5 Sep 2018 11:57:36 +0200
> > Bartosz Golaszewski <brgl@...ev.pl> wrote:
> >  
> >>
> >> +struct nvmem_cell_lookup {
> >> +     const char              *nvmem_name;
> >> +     const char              *dev_id;  
> >
> > Shouldn't we have a con_id here?
> >  
> >> +     const char              *cell_id;
> >> +     struct list_head        node;
> >> +};  
> 
> I wanted to stay in line with the current API - nvmem_cell_get() takes
> as argument a string called cell_id. I wanted to reflect that here.

Actually, you need both. con_id is the name you would have in your DT
in the nvmem-cell-names property, cell_id is the name of the cell
you'd find under the nvmem device node.

Let's take an example:

	mydev {
		#nvmem-cell-names = "mac-address", "revision";
		#nvmem-cells = <&cell1>, <&cell2>;
	};

	mynvmemdev {
		#size-cells = <1>;
		#address-cells = <1>;

		cell1: foo@0 {
			reg = <0x0 0x6>;
		};

		cell2: bar@6 {
			reg = <0x6 0x10>;
		};
	};

this can be described the same way using a consumer lookup table:

struct nvmem_cell_lookup_entry {
	const char *con_id;
	const char *nvmem_name;
	const char *cell_name;
};

struct nvmem_cell_lookup_table {
	struct list_head node;
	const char *dev_id;
	unsigned int nentries;
	const struct nvmem_cell_lookup_entry *entries;
}

static const struct nvmem_cell_lookup_entry mydev_nvmem_cells[] = {
	{
		.con_id = "mac-address",
		.nvmem_name = "mynvmemdev",
		.cell_name = "foo",
	},
	{
		.con_id = "revision",
		.nvmem_name = "mynvmemdev",
		.cell_name = "bar",
	},
}

static const struct nvmem_cell_lookup_table mydev_nvmem_lookup = {
	.dev_id = "mydev.0",
	.nentries = ARRAY_SIZE(mydev_nvmem_cells),
	.entries = mydev_nvmem_cells,
};


...

	nvmem_add_cell_lookups(&mydev_nvmem_lookup);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ