- * [PATCH V4 1/4] dt-bindings: nvmem: layouts: add fixed-layout
  2023-03-17 13:26 [PATCH V4 0/4] nvmem: add fixed cells layout Rafał Miłecki
@ 2023-03-17 13:26 ` Rafał Miłecki
  2023-03-17 13:26 ` [PATCH V4 2/4] dt-bindings: nvmem: convert base example to use NVMEM fixed cells layout Rafał Miłecki
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 9+ messages in thread
From: Rafał Miłecki @ 2023-03-17 13:26 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Srinivas Kandagatla
  Cc: Greg Kroah-Hartman, Miquel Raynal, Michael Walle, devicetree,
	linux-kernel, Rafał Miłecki
From: Rafał Miłecki <rafal@milecki.pl>
With the introduction of NVMEM layouts, new NVMEM content structures
should be defined as such. We should also try to convert / migrate
existing NVMEM content bindings to layouts.
This commit handles fixed NVMEM cells. So far they had to be defined
directly - as device subnodes. With this change it's allowed to put them
in the DT node named "nvmem-layout".
Having NVMEM cells in separated node is prefered as it draws a nice line
between NVMEM device and its content. It results in cleaner bindings.
FWIW a very similiar situation has happened to MTD devices and their
partitions: see commit 5d96ea42eb63 ("dt-bindings: mtd: Clarify all
partition subnodes").
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 .../bindings/nvmem/layouts/fixed-cell.yaml    | 31 ++++++++++++
 .../bindings/nvmem/layouts/fixed-layout.yaml  | 49 +++++++++++++++++++
 .../bindings/nvmem/layouts/nvmem-layout.yaml  |  5 +-
 .../devicetree/bindings/nvmem/nvmem.yaml      | 19 +------
 4 files changed, 83 insertions(+), 21 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/nvmem/layouts/fixed-cell.yaml
 create mode 100644 Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml
diff --git a/Documentation/devicetree/bindings/nvmem/layouts/fixed-cell.yaml b/Documentation/devicetree/bindings/nvmem/layouts/fixed-cell.yaml
new file mode 100644
index 000000000000..e698098450e1
--- /dev/null
+++ b/Documentation/devicetree/bindings/nvmem/layouts/fixed-cell.yaml
@@ -0,0 +1,31 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/nvmem/layouts/fixed-cell.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Fixed offset & size NVMEM cell
+
+maintainers:
+  - Rafał Miłecki <rafal@milecki.pl>
+  - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
+
+properties:
+  reg:
+    maxItems: 1
+
+  bits:
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    items:
+      - minimum: 0
+        maximum: 7
+        description:
+          Offset in bit within the address range specified by reg.
+      - minimum: 1
+        description:
+          Size in bit within the address range specified by reg.
+
+required:
+  - reg
+
+additionalProperties: true
diff --git a/Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml b/Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml
new file mode 100644
index 000000000000..f7496ba28f33
--- /dev/null
+++ b/Documentation/devicetree/bindings/nvmem/layouts/fixed-layout.yaml
@@ -0,0 +1,49 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/nvmem/layouts/fixed-layout.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: NVMEM layout for fixed NVMEM cells
+
+description:
+  Many NVMEM devices have hardcoded cells layout (offset and size of defined
+  NVMEM content doesn't change).
+
+  This binding allows defining such NVMEM layout with its cells. It can be used
+  on top of any NVMEM device.
+
+maintainers:
+  - Rafał Miłecki <rafal@milecki.pl>
+
+properties:
+  compatible:
+    const: fixed-layout
+
+  "#address-cells":
+    const: 1
+
+  "#size-cells":
+    const: 1
+
+patternProperties:
+  "@[a-f0-9]+$":
+    type: object
+    $ref: fixed-cell.yaml
+
+required:
+  - compatible
+
+additionalProperties: false
+
+examples:
+  - |
+    nvmem-layout {
+        compatible = "fixed-layout";
+        #address-cells = <1>;
+        #size-cells = <1>;
+
+        calibration@4000 {
+            reg = <0x4000 0x100>;
+        };
+    };
diff --git a/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml b/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml
index 8512ee538c4c..3b40f7880774 100644
--- a/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml
+++ b/Documentation/devicetree/bindings/nvmem/layouts/nvmem-layout.yaml
@@ -18,16 +18,13 @@ description: |
   perform their parsing. The nvmem-layout container is here to describe these.
 
 oneOf:
+  - $ref: fixed-layout.yaml
   - $ref: kontron,sl28-vpd.yaml
   - $ref: onie,tlv-layout.yaml
 
 properties:
   compatible: true
 
-  '#address-cells': false
-
-  '#size-cells': false
-
 required:
   - compatible
 
diff --git a/Documentation/devicetree/bindings/nvmem/nvmem.yaml b/Documentation/devicetree/bindings/nvmem/nvmem.yaml
index 75bb93dda9df..b79f1bb795fb 100644
--- a/Documentation/devicetree/bindings/nvmem/nvmem.yaml
+++ b/Documentation/devicetree/bindings/nvmem/nvmem.yaml
@@ -49,23 +49,8 @@ properties:
 patternProperties:
   "@[0-9a-f]+(,[0-7])?$":
     type: object
-
-    properties:
-      reg:
-        maxItems: 1
-        description:
-          Offset and size in bytes within the storage device.
-
-      bits:
-        $ref: /schemas/types.yaml#/definitions/uint32-array
-        items:
-          - minimum: 0
-            maximum: 7
-            description:
-              Offset in bit within the address range specified by reg.
-          - minimum: 1
-            description:
-              Size in bit within the address range specified by reg.
+    $ref: layouts/fixed-cell.yaml
+    deprecated: true
 
 additionalProperties: true
 
-- 
2.34.1
^ permalink raw reply related	[flat|nested] 9+ messages in thread
- * [PATCH V4 2/4] dt-bindings: nvmem: convert base example to use NVMEM fixed cells layout
  2023-03-17 13:26 [PATCH V4 0/4] nvmem: add fixed cells layout Rafał Miłecki
  2023-03-17 13:26 ` [PATCH V4 1/4] dt-bindings: nvmem: layouts: add fixed-layout Rafał Miłecki
@ 2023-03-17 13:26 ` Rafał Miłecki
  2023-03-17 13:26 ` [PATCH V4 3/4] nvmem: core: export nvmem_add_cells_from_of() Rafał Miłecki
  2023-03-17 13:26 ` [PATCH V4 4/4] nvmem: layouts: add fixed cells layout Rafał Miłecki
  3 siblings, 0 replies; 9+ messages in thread
From: Rafał Miłecki @ 2023-03-17 13:26 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Srinivas Kandagatla
  Cc: Greg Kroah-Hartman, Miquel Raynal, Michael Walle, devicetree,
	linux-kernel, Rafał Miłecki
From: Rafał Miłecki <rafal@milecki.pl>
With support for the "fixed-layout" binding it's possible and preferred
now to define fixed NVMEM cells in the layout node. Do that for the
binding example binding.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 .../devicetree/bindings/nvmem/nvmem.yaml      | 42 +++++++++++--------
 1 file changed, 24 insertions(+), 18 deletions(-)
diff --git a/Documentation/devicetree/bindings/nvmem/nvmem.yaml b/Documentation/devicetree/bindings/nvmem/nvmem.yaml
index b79f1bb795fb..980244100690 100644
--- a/Documentation/devicetree/bindings/nvmem/nvmem.yaml
+++ b/Documentation/devicetree/bindings/nvmem/nvmem.yaml
@@ -68,24 +68,30 @@ examples:
 
           /* ... */
 
-          /* Data cells */
-          tsens_calibration: calib@404 {
-              reg = <0x404 0x10>;
-          };
-
-          tsens_calibration_bckp: calib_bckp@504 {
-              reg = <0x504 0x11>;
-              bits = <6 128>;
-          };
-
-          pvs_version: pvs-version@6 {
-              reg = <0x6 0x2>;
-              bits = <7 2>;
-          };
-
-          speed_bin: speed-bin@c{
-              reg = <0xc 0x1>;
-              bits = <2 3>;
+          nvmem-layout {
+              compatible = "fixed-layout";
+              #address-cells = <1>;
+              #size-cells = <1>;
+
+              /* Data cells */
+              tsens_calibration: calib@404 {
+                  reg = <0x404 0x10>;
+              };
+
+              tsens_calibration_bckp: calib_bckp@504 {
+                  reg = <0x504 0x11>;
+                  bits = <6 128>;
+              };
+
+              pvs_version: pvs-version@6 {
+                  reg = <0x6 0x2>;
+                  bits = <7 2>;
+              };
+
+              speed_bin: speed-bin@c{
+                  reg = <0xc 0x1>;
+                  bits = <2 3>;
+              };
           };
       };
 
-- 
2.34.1
^ permalink raw reply related	[flat|nested] 9+ messages in thread
- * [PATCH V4 3/4] nvmem: core: export nvmem_add_cells_from_of()
  2023-03-17 13:26 [PATCH V4 0/4] nvmem: add fixed cells layout Rafał Miłecki
  2023-03-17 13:26 ` [PATCH V4 1/4] dt-bindings: nvmem: layouts: add fixed-layout Rafał Miłecki
  2023-03-17 13:26 ` [PATCH V4 2/4] dt-bindings: nvmem: convert base example to use NVMEM fixed cells layout Rafał Miłecki
@ 2023-03-17 13:26 ` Rafał Miłecki
  2023-03-18  0:06   ` kernel test robot
  2023-03-20  8:23   ` Michael Walle
  2023-03-17 13:26 ` [PATCH V4 4/4] nvmem: layouts: add fixed cells layout Rafał Miłecki
  3 siblings, 2 replies; 9+ messages in thread
From: Rafał Miłecki @ 2023-03-17 13:26 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Srinivas Kandagatla
  Cc: Greg Kroah-Hartman, Miquel Raynal, Michael Walle, devicetree,
	linux-kernel, Rafał Miłecki
From: Rafał Miłecki <rafal@milecki.pl>
This symbol can be cleanly re-used by the fixed NVMEM layout driver.
Allow passing DT node as argument to make it a bit more generic.
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 drivers/nvmem/core.c           | 7 ++++---
 include/linux/nvmem-provider.h | 7 +++++++
 2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
index 212c5ba5789f..985a42cfb0a2 100644
--- a/drivers/nvmem/core.c
+++ b/drivers/nvmem/core.c
@@ -694,7 +694,7 @@ static int nvmem_validate_keepouts(struct nvmem_device *nvmem)
 	return 0;
 }
 
-static int nvmem_add_cells_from_of(struct nvmem_device *nvmem)
+int nvmem_add_cells_from_of(struct nvmem_device *nvmem, struct device_node *np)
 {
 	struct nvmem_layout *layout = nvmem->layout;
 	struct device *dev = &nvmem->dev;
@@ -702,7 +702,7 @@ static int nvmem_add_cells_from_of(struct nvmem_device *nvmem)
 	const __be32 *addr;
 	int len, ret;
 
-	for_each_child_of_node(dev->of_node, child) {
+	for_each_child_of_node(np, child) {
 		struct nvmem_cell_info info = {0};
 
 		addr = of_get_property(child, "reg", &len);
@@ -739,6 +739,7 @@ static int nvmem_add_cells_from_of(struct nvmem_device *nvmem)
 
 	return 0;
 }
+EXPORT_SYMBOL_GPL(nvmem_add_cells_from_of);
 
 int __nvmem_layout_register(struct nvmem_layout *layout, struct module *owner)
 {
@@ -970,7 +971,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
 	if (rval)
 		goto err_remove_cells;
 
-	rval = nvmem_add_cells_from_of(nvmem);
+	rval = nvmem_add_cells_from_of(nvmem, nvmem->dev.of_node);
 	if (rval)
 		goto err_remove_cells;
 
diff --git a/include/linux/nvmem-provider.h b/include/linux/nvmem-provider.h
index 3e97c8315c45..2b5410be2636 100644
--- a/include/linux/nvmem-provider.h
+++ b/include/linux/nvmem-provider.h
@@ -195,6 +195,8 @@ void nvmem_del_cell_table(struct nvmem_cell_table *table);
 int nvmem_add_one_cell(struct nvmem_device *nvmem,
 		       const struct nvmem_cell_info *info);
 
+int nvmem_add_cells_from_of(struct nvmem_device *nvmem, struct device_node *np);
+
 int __nvmem_layout_register(struct nvmem_layout *layout, struct module *owner);
 #define nvmem_layout_register(layout) \
 	__nvmem_layout_register(layout, THIS_MODULE)
@@ -226,6 +228,11 @@ static inline int nvmem_add_one_cell(struct nvmem_device *nvmem,
 	return -EOPNOTSUPP;
 }
 
+static int nvmem_add_cells_from_of(struct nvmem_device *nvmem, struct device_node *np)
+{
+	return -EOPNOTSUPP;
+}
+
 static inline int nvmem_layout_register(struct nvmem_layout *layout)
 {
 	return -EOPNOTSUPP;
-- 
2.34.1
^ permalink raw reply related	[flat|nested] 9+ messages in thread
- * Re: [PATCH V4 3/4] nvmem: core: export nvmem_add_cells_from_of()
  2023-03-17 13:26 ` [PATCH V4 3/4] nvmem: core: export nvmem_add_cells_from_of() Rafał Miłecki
@ 2023-03-18  0:06   ` kernel test robot
  2023-03-20  8:23   ` Michael Walle
  1 sibling, 0 replies; 9+ messages in thread
From: kernel test robot @ 2023-03-18  0:06 UTC (permalink / raw)
  To: Rafał Miłecki, Rob Herring, Krzysztof Kozlowski,
	Srinivas Kandagatla
  Cc: oe-kbuild-all, Greg Kroah-Hartman, Miquel Raynal, Michael Walle,
	devicetree, linux-kernel, Rafał Miłecki
Hi Rafał,
I love your patch! Yet something to improve:
[auto build test ERROR on next-20230317]
[cannot apply to robh/for-next krzk-dt/for-next char-misc/char-misc-testing char-misc/char-misc-next char-misc/char-misc-linus linus/master v6.3-rc2 v6.3-rc1 v6.2 v6.3-rc2]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url:    https://github.com/intel-lab-lkp/linux/commits/Rafa-Mi-ecki/dt-bindings-nvmem-layouts-add-fixed-layout/20230317-212948
patch link:    https://lore.kernel.org/r/20230317132620.31142-4-zajec5%40gmail.com
patch subject: [PATCH V4 3/4] nvmem: core: export nvmem_add_cells_from_of()
config: powerpc-allnoconfig (https://download.01.org/0day-ci/archive/20230318/202303180709.WSD6mSsu-lkp@intel.com/config)
compiler: powerpc-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/70d21b7988db0cad28a2cb4b0d7f5d77d587a51f
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Rafa-Mi-ecki/dt-bindings-nvmem-layouts-add-fixed-layout/20230317-212948
        git checkout 70d21b7988db0cad28a2cb4b0d7f5d77d587a51f
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=powerpc SHELL=/bin/bash arch/powerpc/kernel/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303180709.WSD6mSsu-lkp@intel.com/
All errors (new ones prefixed by >>):
   In file included from include/linux/rtc.h:18,
                    from arch/powerpc/kernel/time.c:48:
>> include/linux/nvmem-provider.h:230:12: error: 'nvmem_add_cells_from_of' defined but not used [-Werror=unused-function]
     230 | static int nvmem_add_cells_from_of(struct nvmem_device *nvmem, struct device_node *np)
         |            ^~~~~~~~~~~~~~~~~~~~~~~
   cc1: all warnings being treated as errors
vim +/nvmem_add_cells_from_of +230 include/linux/nvmem-provider.h
   229	
 > 230	static int nvmem_add_cells_from_of(struct nvmem_device *nvmem, struct device_node *np)
   231	{
   232		return -EOPNOTSUPP;
   233	}
   234	
-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply	[flat|nested] 9+ messages in thread
- * Re: [PATCH V4 3/4] nvmem: core: export nvmem_add_cells_from_of()
  2023-03-17 13:26 ` [PATCH V4 3/4] nvmem: core: export nvmem_add_cells_from_of() Rafał Miłecki
  2023-03-18  0:06   ` kernel test robot
@ 2023-03-20  8:23   ` Michael Walle
  1 sibling, 0 replies; 9+ messages in thread
From: Michael Walle @ 2023-03-20  8:23 UTC (permalink / raw)
  To: Rafał Miłecki
  Cc: Rob Herring, Krzysztof Kozlowski, Srinivas Kandagatla,
	Greg Kroah-Hartman, Miquel Raynal, devicetree, linux-kernel,
	Rafał Miłecki
Am 2023-03-17 14:26, schrieb Rafał Miłecki:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> This symbol can be cleanly re-used by the fixed NVMEM layout driver.
> Allow passing DT node as argument to make it a bit more generic.
> 
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
>  drivers/nvmem/core.c           | 7 ++++---
>  include/linux/nvmem-provider.h | 7 +++++++
>  2 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/nvmem/core.c b/drivers/nvmem/core.c
> index 212c5ba5789f..985a42cfb0a2 100644
> --- a/drivers/nvmem/core.c
> +++ b/drivers/nvmem/core.c
> @@ -694,7 +694,7 @@ static int nvmem_validate_keepouts(struct
> nvmem_device *nvmem)
>  	return 0;
>  }
> 
> -static int nvmem_add_cells_from_of(struct nvmem_device *nvmem)
> +int nvmem_add_cells_from_of(struct nvmem_device *nvmem, struct 
> device_node *np)
I'm not sure, how to feel about exposing an "internal" function to
the layouts module. I mean all these nvmem_add_cells_from_* are internal
to the core. Also the help text of the add_cells() callback tells you to
use nvmem_add_one_cell().
Although there is a bit of code duplication, I'd rather refactor
the nvmem_add_cells_from_of() to split it into parsing and adding.
Then re-use just the parsing from the fixed layout module and
call the appropriate nvmem_add_one_cell() yourself there.
-michael
^ permalink raw reply	[flat|nested] 9+ messages in thread 
 
- * [PATCH V4 4/4] nvmem: layouts: add fixed cells layout
  2023-03-17 13:26 [PATCH V4 0/4] nvmem: add fixed cells layout Rafał Miłecki
                   ` (2 preceding siblings ...)
  2023-03-17 13:26 ` [PATCH V4 3/4] nvmem: core: export nvmem_add_cells_from_of() Rafał Miłecki
@ 2023-03-17 13:26 ` Rafał Miłecki
  2023-03-17 15:54   ` kernel test robot
  3 siblings, 1 reply; 9+ messages in thread
From: Rafał Miłecki @ 2023-03-17 13:26 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Kozlowski, Srinivas Kandagatla
  Cc: Greg Kroah-Hartman, Miquel Raynal, Michael Walle, devicetree,
	linux-kernel, Rafał Miłecki
From: Rafał Miłecki <rafal@milecki.pl>
This adds a driver for the "fixed-layout" NVMEM layout binding. It
allows defining NVMEM cells in a layout DT node named "nvmem-layout".
Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 drivers/nvmem/layouts/Kconfig  |  8 +++++++
 drivers/nvmem/layouts/Makefile |  1 +
 drivers/nvmem/layouts/fixed.c  | 41 ++++++++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+)
 create mode 100644 drivers/nvmem/layouts/fixed.c
diff --git a/drivers/nvmem/layouts/Kconfig b/drivers/nvmem/layouts/Kconfig
index 7ff1ee1c1f05..2ebbde7b15b2 100644
--- a/drivers/nvmem/layouts/Kconfig
+++ b/drivers/nvmem/layouts/Kconfig
@@ -2,6 +2,14 @@
 
 menu "Layout Types"
 
+config NVMEM_LAYOUT_FIXED
+	tristate "Fixed cells layout support"
+	help
+	  Say Y here if you want to support layout with fixed cells (hardcoded
+	  offsets and sizes).
+
+	  If unsure, say N.
+
 config NVMEM_LAYOUT_SL28_VPD
 	tristate "Kontron sl28 VPD layout support"
 	select CRC8
diff --git a/drivers/nvmem/layouts/Makefile b/drivers/nvmem/layouts/Makefile
index 2974bd7d33ed..449dd893f968 100644
--- a/drivers/nvmem/layouts/Makefile
+++ b/drivers/nvmem/layouts/Makefile
@@ -3,5 +3,6 @@
 # Makefile for nvmem layouts.
 #
 
+obj-$(CONFIG_NVMEM_LAYOUT_FIXED) += fixed.o
 obj-$(CONFIG_NVMEM_LAYOUT_SL28_VPD) += sl28vpd.o
 obj-$(CONFIG_NVMEM_LAYOUT_ONIE_TLV) += onie-tlv.o
diff --git a/drivers/nvmem/layouts/fixed.c b/drivers/nvmem/layouts/fixed.c
new file mode 100644
index 000000000000..b8d2f141d272
--- /dev/null
+++ b/drivers/nvmem/layouts/fixed.c
@@ -0,0 +1,41 @@
+// SPDX-License-Identifier: GPL-2.0
+
+#include <linux/module.h>
+#include <linux/nvmem-consumer.h>
+#include <linux/nvmem-provider.h>
+#include <linux/of.h>
+
+static int fixed_add_cells(struct device *dev, struct nvmem_device *nvmem,
+			   struct nvmem_layout *layout)
+{
+	struct device_node *layout_np;
+	int err;
+
+	layout_np = of_nvmem_layout_get_container(nvmem);
+	if (!layout_np)
+		return -ENOENT;
+
+	err = nvmem_add_cells_from_of(nvmem, layout_np);
+
+	of_node_put(layout_np);
+
+	return err;
+}
+
+static const struct of_device_id fixed_of_match_table[] = {
+	{ .compatible = "fixed-layout" },
+	{},
+};
+MODULE_DEVICE_TABLE(of, fixed_of_match_table);
+
+struct nvmem_layout fixed_nvmem_layout = {
+	.name = "fixed-layout",
+	.of_match_table = fixed_of_match_table,
+	.add_cells = fixed_add_cells,
+};
+
+module_nvmem_layout_driver(fixed_nvmem_layout);
+
+MODULE_AUTHOR("Rafał Miłecki");
+MODULE_LICENSE("GPL");
+MODULE_DEVICE_TABLE(of, fixed_of_match_table);
-- 
2.34.1
^ permalink raw reply related	[flat|nested] 9+ messages in thread
- * Re: [PATCH V4 4/4] nvmem: layouts: add fixed cells layout
  2023-03-17 13:26 ` [PATCH V4 4/4] nvmem: layouts: add fixed cells layout Rafał Miłecki
@ 2023-03-17 15:54   ` kernel test robot
  2023-03-17 16:04     ` Rafał Miłecki
  0 siblings, 1 reply; 9+ messages in thread
From: kernel test robot @ 2023-03-17 15:54 UTC (permalink / raw)
  To: Rafał Miłecki, Rob Herring, Krzysztof Kozlowski,
	Srinivas Kandagatla
  Cc: oe-kbuild-all, Greg Kroah-Hartman, Miquel Raynal, Michael Walle,
	devicetree, linux-kernel, Rafał Miłecki
Hi Rafał,
I love your patch! Perhaps something to improve:
[auto build test WARNING on next-20230317]
[cannot apply to robh/for-next krzk-dt/for-next char-misc/char-misc-testing char-misc/char-misc-next char-misc/char-misc-linus linus/master v6.3-rc2 v6.3-rc1 v6.2 v6.3-rc2]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url:    https://github.com/intel-lab-lkp/linux/commits/Rafa-Mi-ecki/dt-bindings-nvmem-layouts-add-fixed-layout/20230317-212948
patch link:    https://lore.kernel.org/r/20230317132620.31142-5-zajec5%40gmail.com
patch subject: [PATCH V4 4/4] nvmem: layouts: add fixed cells layout
config: sparc-allyesconfig (https://download.01.org/0day-ci/archive/20230317/202303172348.sb4rePWl-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 12.1.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/intel-lab-lkp/linux/commit/7ffae9ad6cdb83ae60e3eacf96ab779e0b69a65b
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Rafa-Mi-ecki/dt-bindings-nvmem-layouts-add-fixed-layout/20230317-212948
        git checkout 7ffae9ad6cdb83ae60e3eacf96ab779e0b69a65b
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc olddefconfig
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash drivers/nvmem/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303172348.sb4rePWl-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/nvmem/layouts/fixed.c:37:1: warning: data definition has no type or storage class
      37 | module_nvmem_layout_driver(fixed_nvmem_layout);
         | ^~~~~~~~~~~~~~~~~~~~~~~~~~
   drivers/nvmem/layouts/fixed.c:37:1: error: type defaults to 'int' in declaration of 'module_nvmem_layout_driver' [-Werror=implicit-int]
>> drivers/nvmem/layouts/fixed.c:37:1: warning: parameter names (without types) in function declaration
   cc1: some warnings being treated as errors
vim +37 drivers/nvmem/layouts/fixed.c
    36	
  > 37	module_nvmem_layout_driver(fixed_nvmem_layout);
    38	
-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply	[flat|nested] 9+ messages in thread
- * Re: [PATCH V4 4/4] nvmem: layouts: add fixed cells layout
  2023-03-17 15:54   ` kernel test robot
@ 2023-03-17 16:04     ` Rafał Miłecki
  0 siblings, 0 replies; 9+ messages in thread
From: Rafał Miłecki @ 2023-03-17 16:04 UTC (permalink / raw)
  To: kernel test robot, Rafał Miłecki, Rob Herring,
	Krzysztof Kozlowski, Srinivas Kandagatla
  Cc: oe-kbuild-all, Greg Kroah-Hartman, Miquel Raynal, Michael Walle,
	devicetree, linux-kernel
On 17.03.2023 16:54, kernel test robot wrote:
> I love your patch! Perhaps something to improve:
> 
> [auto build test WARNING on next-20230317]
> [cannot apply to robh/for-next krzk-dt/for-next char-misc/char-misc-testing char-misc/char-misc-next char-misc/char-misc-linus linus/master v6.3-rc2 v6.3-rc1 v6.2 v6.3-rc2]
> [If your patch is applied to the wrong git tree, kindly drop us a note.
> And when submitting patch, we suggest to use '--base' as documented in
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Rafa-Mi-ecki/dt-bindings-nvmem-layouts-add-fixed-layout/20230317-212948
> patch link:    https://lore.kernel.org/r/20230317132620.31142-5-zajec5%40gmail.com
> patch subject: [PATCH V4 4/4] nvmem: layouts: add fixed cells layout
> config: sparc-allyesconfig (https://download.01.org/0day-ci/archive/20230317/202303172348.sb4rePWl-lkp@intel.com/config)
> compiler: sparc64-linux-gcc (GCC) 12.1.0
> reproduce (this is a W=1 build):
>          wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
>          chmod +x ~/bin/make.cross
>          # https://github.com/intel-lab-lkp/linux/commit/7ffae9ad6cdb83ae60e3eacf96ab779e0b69a65b
>          git remote add linux-review https://github.com/intel-lab-lkp/linux
>          git fetch --no-tags linux-review Rafa-Mi-ecki/dt-bindings-nvmem-layouts-add-fixed-layout/20230317-212948
>          git checkout 7ffae9ad6cdb83ae60e3eacf96ab779e0b69a65b
>          # save the config file
>          mkdir build_dir && cp config build_dir/.config
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc olddefconfig
>          COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=sparc SHELL=/bin/bash drivers/nvmem/
> 
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@intel.com>
> | Link: https://lore.kernel.org/oe-kbuild-all/202303172348.sb4rePWl-lkp@intel.com/
> 
> All warnings (new ones prefixed by >>):
> 
>>> drivers/nvmem/layouts/fixed.c:37:1: warning: data definition has no type or storage class
>        37 | module_nvmem_layout_driver(fixed_nvmem_layout);
>           | ^~~~~~~~~~~~~~~~~~~~~~~~~~
>     drivers/nvmem/layouts/fixed.c:37:1: error: type defaults to 'int' in declaration of 'module_nvmem_layout_driver' [-Werror=implicit-int]
>>> drivers/nvmem/layouts/fixed.c:37:1: warning: parameter names (without types) in function declaration
>     cc1: some warnings being treated as errors
I reported that to Miquel already, he's going to improve his patch:
https://lore.kernel.org/lkml/20230316173741.4f572068@xps-13/
> vim +37 drivers/nvmem/layouts/fixed.c
> 
>      36	
>    > 37	module_nvmem_layout_driver(fixed_nvmem_layout);
>      38	
> 
^ permalink raw reply	[flat|nested] 9+ messages in thread