Re: [PATCH v3 3/7] OF: DT-Overlay configfs interface

2014-03-21 Thread Sebastian Hesselbarth

On 03/21/2014 02:39 PM, Rob Herring wrote:

On Tue, Mar 18, 2014 at 4:56 PM, Pantelis Antoniou
 wrote:

Add a runtime interface to using configfs for generic device tree overlay
usage.

A device-tree configfs entry is created in /config/device-tree/overlays

To create an overlay you mkdir the directory and then echo the overlay
firmware file to the path property file.

 # mkdir /config/device-tree/overlays/foo
 # echo foo.dtbo >/config/device-tree/overlays/foo/path

[...]

+static ssize_t cfs_overlay_item_status_show(struct cfs_overlay_item *overlay,
+   char *page)
+{
+   return sprintf(page, "%s\n",
+   overlay->applied ? "applied" : "unapplied");
+}


This needs to be added to the above mentioned documentation along with
any other files.


It is also terrible to grep for. Maybe just have the file named
"applied" and use a bool instead?

Sebastian


+
+CFS_OVERLAY_ITEM_ATTR(path, S_IRUGO | S_IWUSR, \
+   cfs_overlay_item_path_show, cfs_overlay_item_path_store);
+CFS_OVERLAY_ITEM_ATTR_RO(status, cfs_overlay_item_status_show);
+
+static struct configfs_attribute *cfs_overlay_attrs[] = {
+   _overlay_item_attr_path.attr,
+   _overlay_item_attr_status.attr,
+   NULL,
+};


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 3/7] OF: DT-Overlay configfs interface

2014-03-21 Thread Rob Herring
On Tue, Mar 18, 2014 at 4:56 PM, Pantelis Antoniou
 wrote:
> Add a runtime interface to using configfs for generic device tree overlay
> usage.
>
> A device-tree configfs entry is created in /config/device-tree/overlays
>
> To create an overlay you mkdir the directory and then echo the overlay
> firmware file to the path property file.
>
> # mkdir /config/device-tree/overlays/foo
> # echo foo.dtbo >/config/device-tree/overlays/foo/path

The purpose of 'path' and what determines its name is not really
clear. The documentation should be clear enough that a user knowing no
details of overlays can be handed a dtbo file and pointer to the
documentation and they can apply it without further information.

> The overlay file will be loaded using the standard firmware loader
> and will be applied.
>
> To remove it simply rmdir the directory.
>
> # rmdir /config/device-tree/overlays/foo

This description should be put into a file in Documentation/. Probably
Documentation/devicetree/ since it is a kernel interface and not a
bindings.

>
> Signed-off-by: Pantelis Antoniou 
> ---
>  drivers/of/Kconfig|   5 +
>  drivers/of/Makefile   |   1 +
>  drivers/of/configfs.c | 272 
> ++
>  3 files changed, 278 insertions(+)
>  create mode 100644 drivers/of/configfs.c
>
> diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
> index 7517be2..fc0e3ec 100644
> --- a/drivers/of/Kconfig
> +++ b/drivers/of/Kconfig
> @@ -77,6 +77,10 @@ config OF_RESERVED_MEM
> help
>   Helpers to allow for reservation of memory regions
>
> +config OF_CONFIGFS
> +   select CONFIGFS_FS
> +   def_bool n

Is it feasible to make this a module (perhaps all of the overlay support)?

> +
>  config OF_RESOLVE
> bool "OF Dynamic resolution support"
> depends on OF
> @@ -92,6 +96,7 @@ config OF_OVERLAY
> select OF_DYNAMIC
> select OF_DEVICE
> select OF_RESOLVE
> +   select OF_CONFIGFS
> help
>   OpenFirmware overlay support. Allows you to modify on runtime the
>   live tree using overlays.
> diff --git a/drivers/of/Makefile b/drivers/of/Makefile
> index d2a6e0d..4efa17b 100644
> --- a/drivers/of/Makefile
> +++ b/drivers/of/Makefile
> @@ -12,3 +12,4 @@ obj-$(CONFIG_OF_MTD)  += of_mtd.o
>  obj-$(CONFIG_OF_RESERVED_MEM) += of_reserved_mem.o
>  obj-$(CONFIG_OF_RESOLVE)  += resolver.o
>  obj-$(CONFIG_OF_OVERLAY) += overlay.o
> +obj-$(CONFIG_OF_CONFIGFS) += configfs.o
> diff --git a/drivers/of/configfs.c b/drivers/of/configfs.c
> new file mode 100644
> index 000..a494643
> --- /dev/null
> +++ b/drivers/of/configfs.c
> @@ -0,0 +1,272 @@
> +/*
> + * Configfs entries for device-tree
> + *
> + * Copyright (C) 2013 - Pantelis Antoniou 

It's 2014 now. I assume you have made some changes in 2014.

> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of the GNU General Public License
> + * as published by the Free Software Foundation; either version
> + * 2 of the License, or (at your option) any later version.
> + */
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#include "of_private.h"
> +
> +#ifdef CONFIG_OF_OVERLAY

This file is only compiled with this defined, so it isn't needed.

> +
> +struct cfs_overlay_item {
> +   struct config_item  item;
> +
> +   charpath[PATH_MAX];
> +

Remove the blank lines.

> +   const struct firmware   *fw;
> +   struct device_node  *overlay;
> +   int ovinfo_cnt;
> +   struct of_overlay_info  *ovinfo;
> +   unsigned intapplied : 1;

Do you plan to expand this? If not, just use bool.

> +};
> +
> +static inline struct cfs_overlay_item *to_cfs_overlay_item(struct 
> config_item *item)
> +{
> +   return item ? container_of(item, struct cfs_overlay_item, item) : 
> NULL;
> +}
> +
> +CONFIGFS_ATTR_STRUCT(cfs_overlay_item);
> +#define CFS_OVERLAY_ITEM_ATTR(_name, _mode, _show, _store) \
> +struct cfs_overlay_item_attribute cfs_overlay_item_attr_##_name = \
> +   __CONFIGFS_ATTR(_name, _mode, _show, _store)
> +#define CFS_OVERLAY_ITEM_ATTR_RO(_name, _show) \
> +struct cfs_overlay_item_attribute cfs_overlay_item_attr_##_name = \
> +   __CONFIGFS_ATTR_RO(_name, _show)
> +
> +static ssize_t cfs_overlay_item_path_show(struct cfs_overlay_item *overlay,
> +   char *page)
> +{
> +   return sprintf(page, "%s\n", overlay->path);
> +}
> +
> +static ssize_t cfs_overlay_item_path_store(struct cfs_overlay_item *overlay,
> +   const char *page, size_t count)
> +{
> +   const char *p = page;
> +   char *s;
> +   int err;
> +
> +   /* if it's set do not allow changes */
> +   if (overlay->path[0] != '\0')
> +   return -EPERM;
> 

Re: [PATCH v3 3/7] OF: DT-Overlay configfs interface

2014-03-21 Thread Rob Herring
On Tue, Mar 18, 2014 at 4:56 PM, Pantelis Antoniou
pantelis.anton...@konsulko.com wrote:
 Add a runtime interface to using configfs for generic device tree overlay
 usage.

 A device-tree configfs entry is created in /config/device-tree/overlays

 To create an overlay you mkdir the directory and then echo the overlay
 firmware file to the path property file.

 # mkdir /config/device-tree/overlays/foo
 # echo foo.dtbo /config/device-tree/overlays/foo/path

The purpose of 'path' and what determines its name is not really
clear. The documentation should be clear enough that a user knowing no
details of overlays can be handed a dtbo file and pointer to the
documentation and they can apply it without further information.

 The overlay file will be loaded using the standard firmware loader
 and will be applied.

 To remove it simply rmdir the directory.

 # rmdir /config/device-tree/overlays/foo

This description should be put into a file in Documentation/. Probably
Documentation/devicetree/ since it is a kernel interface and not a
bindings.


 Signed-off-by: Pantelis Antoniou pantelis.anton...@konsulko.com
 ---
  drivers/of/Kconfig|   5 +
  drivers/of/Makefile   |   1 +
  drivers/of/configfs.c | 272 
 ++
  3 files changed, 278 insertions(+)
  create mode 100644 drivers/of/configfs.c

 diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
 index 7517be2..fc0e3ec 100644
 --- a/drivers/of/Kconfig
 +++ b/drivers/of/Kconfig
 @@ -77,6 +77,10 @@ config OF_RESERVED_MEM
 help
   Helpers to allow for reservation of memory regions

 +config OF_CONFIGFS
 +   select CONFIGFS_FS
 +   def_bool n

Is it feasible to make this a module (perhaps all of the overlay support)?

 +
  config OF_RESOLVE
 bool OF Dynamic resolution support
 depends on OF
 @@ -92,6 +96,7 @@ config OF_OVERLAY
 select OF_DYNAMIC
 select OF_DEVICE
 select OF_RESOLVE
 +   select OF_CONFIGFS
 help
   OpenFirmware overlay support. Allows you to modify on runtime the
   live tree using overlays.
 diff --git a/drivers/of/Makefile b/drivers/of/Makefile
 index d2a6e0d..4efa17b 100644
 --- a/drivers/of/Makefile
 +++ b/drivers/of/Makefile
 @@ -12,3 +12,4 @@ obj-$(CONFIG_OF_MTD)  += of_mtd.o
  obj-$(CONFIG_OF_RESERVED_MEM) += of_reserved_mem.o
  obj-$(CONFIG_OF_RESOLVE)  += resolver.o
  obj-$(CONFIG_OF_OVERLAY) += overlay.o
 +obj-$(CONFIG_OF_CONFIGFS) += configfs.o
 diff --git a/drivers/of/configfs.c b/drivers/of/configfs.c
 new file mode 100644
 index 000..a494643
 --- /dev/null
 +++ b/drivers/of/configfs.c
 @@ -0,0 +1,272 @@
 +/*
 + * Configfs entries for device-tree
 + *
 + * Copyright (C) 2013 - Pantelis Antoniou pa...@antoniou-consulting.com

It's 2014 now. I assume you have made some changes in 2014.

 + *
 + * This program is free software; you can redistribute it and/or
 + * modify it under the terms of the GNU General Public License
 + * as published by the Free Software Foundation; either version
 + * 2 of the License, or (at your option) any later version.
 + */
 +#include linux/ctype.h
 +#include linux/cpu.h
 +#include linux/module.h
 +#include linux/of.h
 +#include linux/of_fdt.h
 +#include linux/spinlock.h
 +#include linux/slab.h
 +#include linux/proc_fs.h
 +#include linux/configfs.h
 +#include linux/types.h
 +#include linux/stat.h
 +#include linux/limits.h
 +#include linux/file.h
 +#include linux/vmalloc.h
 +#include linux/firmware.h
 +
 +#include of_private.h
 +
 +#ifdef CONFIG_OF_OVERLAY

This file is only compiled with this defined, so it isn't needed.

 +
 +struct cfs_overlay_item {
 +   struct config_item  item;
 +
 +   charpath[PATH_MAX];
 +

Remove the blank lines.

 +   const struct firmware   *fw;
 +   struct device_node  *overlay;
 +   int ovinfo_cnt;
 +   struct of_overlay_info  *ovinfo;
 +   unsigned intapplied : 1;

Do you plan to expand this? If not, just use bool.

 +};
 +
 +static inline struct cfs_overlay_item *to_cfs_overlay_item(struct 
 config_item *item)
 +{
 +   return item ? container_of(item, struct cfs_overlay_item, item) : 
 NULL;
 +}
 +
 +CONFIGFS_ATTR_STRUCT(cfs_overlay_item);
 +#define CFS_OVERLAY_ITEM_ATTR(_name, _mode, _show, _store) \
 +struct cfs_overlay_item_attribute cfs_overlay_item_attr_##_name = \
 +   __CONFIGFS_ATTR(_name, _mode, _show, _store)
 +#define CFS_OVERLAY_ITEM_ATTR_RO(_name, _show) \
 +struct cfs_overlay_item_attribute cfs_overlay_item_attr_##_name = \
 +   __CONFIGFS_ATTR_RO(_name, _show)
 +
 +static ssize_t cfs_overlay_item_path_show(struct cfs_overlay_item *overlay,
 +   char *page)
 +{
 +   return sprintf(page, %s\n, overlay-path);
 +}
 +
 +static ssize_t cfs_overlay_item_path_store(struct cfs_overlay_item *overlay,
 +   const char *page, size_t count)
 +{
 +   const char *p = page;
 +   char 

Re: [PATCH v3 3/7] OF: DT-Overlay configfs interface

2014-03-21 Thread Sebastian Hesselbarth

On 03/21/2014 02:39 PM, Rob Herring wrote:

On Tue, Mar 18, 2014 at 4:56 PM, Pantelis Antoniou
pantelis.anton...@konsulko.com wrote:

Add a runtime interface to using configfs for generic device tree overlay
usage.

A device-tree configfs entry is created in /config/device-tree/overlays

To create an overlay you mkdir the directory and then echo the overlay
firmware file to the path property file.

 # mkdir /config/device-tree/overlays/foo
 # echo foo.dtbo /config/device-tree/overlays/foo/path

[...]

+static ssize_t cfs_overlay_item_status_show(struct cfs_overlay_item *overlay,
+   char *page)
+{
+   return sprintf(page, %s\n,
+   overlay-applied ? applied : unapplied);
+}


This needs to be added to the above mentioned documentation along with
any other files.


It is also terrible to grep for. Maybe just have the file named
applied and use a bool instead?

Sebastian


+
+CFS_OVERLAY_ITEM_ATTR(path, S_IRUGO | S_IWUSR, \
+   cfs_overlay_item_path_show, cfs_overlay_item_path_store);
+CFS_OVERLAY_ITEM_ATTR_RO(status, cfs_overlay_item_status_show);
+
+static struct configfs_attribute *cfs_overlay_attrs[] = {
+   cfs_overlay_item_attr_path.attr,
+   cfs_overlay_item_attr_status.attr,
+   NULL,
+};


--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 3/7] OF: DT-Overlay configfs interface

2014-03-18 Thread Pantelis Antoniou
Add a runtime interface to using configfs for generic device tree overlay
usage.

A device-tree configfs entry is created in /config/device-tree/overlays

To create an overlay you mkdir the directory and then echo the overlay
firmware file to the path property file.

# mkdir /config/device-tree/overlays/foo
# echo foo.dtbo >/config/device-tree/overlays/foo/path

The overlay file will be loaded using the standard firmware loader
and will be applied.

To remove it simply rmdir the directory.

# rmdir /config/device-tree/overlays/foo

Signed-off-by: Pantelis Antoniou 
---
 drivers/of/Kconfig|   5 +
 drivers/of/Makefile   |   1 +
 drivers/of/configfs.c | 272 ++
 3 files changed, 278 insertions(+)
 create mode 100644 drivers/of/configfs.c

diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index 7517be2..fc0e3ec 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -77,6 +77,10 @@ config OF_RESERVED_MEM
help
  Helpers to allow for reservation of memory regions
 
+config OF_CONFIGFS
+   select CONFIGFS_FS
+   def_bool n
+
 config OF_RESOLVE
bool "OF Dynamic resolution support"
depends on OF
@@ -92,6 +96,7 @@ config OF_OVERLAY
select OF_DYNAMIC
select OF_DEVICE
select OF_RESOLVE
+   select OF_CONFIGFS
help
  OpenFirmware overlay support. Allows you to modify on runtime the
  live tree using overlays.
diff --git a/drivers/of/Makefile b/drivers/of/Makefile
index d2a6e0d..4efa17b 100644
--- a/drivers/of/Makefile
+++ b/drivers/of/Makefile
@@ -12,3 +12,4 @@ obj-$(CONFIG_OF_MTD)  += of_mtd.o
 obj-$(CONFIG_OF_RESERVED_MEM) += of_reserved_mem.o
 obj-$(CONFIG_OF_RESOLVE)  += resolver.o
 obj-$(CONFIG_OF_OVERLAY) += overlay.o
+obj-$(CONFIG_OF_CONFIGFS) += configfs.o
diff --git a/drivers/of/configfs.c b/drivers/of/configfs.c
new file mode 100644
index 000..a494643
--- /dev/null
+++ b/drivers/of/configfs.c
@@ -0,0 +1,272 @@
+/*
+ * Configfs entries for device-tree
+ *
+ * Copyright (C) 2013 - Pantelis Antoniou 
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "of_private.h"
+
+#ifdef CONFIG_OF_OVERLAY
+
+struct cfs_overlay_item {
+   struct config_item  item;
+
+   charpath[PATH_MAX];
+
+   const struct firmware   *fw;
+   struct device_node  *overlay;
+   int ovinfo_cnt;
+   struct of_overlay_info  *ovinfo;
+   unsigned intapplied : 1;
+};
+
+static inline struct cfs_overlay_item *to_cfs_overlay_item(struct config_item 
*item)
+{
+   return item ? container_of(item, struct cfs_overlay_item, item) : NULL;
+}
+
+CONFIGFS_ATTR_STRUCT(cfs_overlay_item);
+#define CFS_OVERLAY_ITEM_ATTR(_name, _mode, _show, _store) \
+struct cfs_overlay_item_attribute cfs_overlay_item_attr_##_name = \
+   __CONFIGFS_ATTR(_name, _mode, _show, _store)
+#define CFS_OVERLAY_ITEM_ATTR_RO(_name, _show) \
+struct cfs_overlay_item_attribute cfs_overlay_item_attr_##_name = \
+   __CONFIGFS_ATTR_RO(_name, _show)
+
+static ssize_t cfs_overlay_item_path_show(struct cfs_overlay_item *overlay,
+   char *page)
+{
+   return sprintf(page, "%s\n", overlay->path);
+}
+
+static ssize_t cfs_overlay_item_path_store(struct cfs_overlay_item *overlay,
+   const char *page, size_t count)
+{
+   const char *p = page;
+   char *s;
+   int err;
+
+   /* if it's set do not allow changes */
+   if (overlay->path[0] != '\0')
+   return -EPERM;
+
+   /* copy to path buffer (and make sure it's always zero terminated */
+   count = snprintf(overlay->path, sizeof(overlay->path) - 1, "%s", p);
+   overlay->path[sizeof(overlay->path) - 1] = '\0';
+
+   /* strip trailing newlines */
+   s = overlay->path + strlen(overlay->path);
+   while (s > overlay->path && *--s == '\n')
+   *s = '\0';
+
+   pr_debug("%s: path is '%s'\n", __func__, overlay->path);
+
+   err = request_firmware(>fw, overlay->path, NULL);
+   if (err != 0)
+   goto out_err;
+
+   /* unflatten the tree */
+   of_fdt_unflatten_tree((void *)overlay->fw->data, >overlay);
+   if (overlay->overlay == NULL) {
+   pr_err("%s: failed to unflatten tree\n", __func__);
+   err = -EINVAL;
+   goto out_err;
+   }
+   pr_debug("%s: unflattened OK\n", __func__);
+
+   /* mark it as detached */
+   of_node_set_flag(overlay->overlay, OF_DETACHED);
+
+   /* perform resolution */
+   

[PATCH v3 3/7] OF: DT-Overlay configfs interface

2014-03-18 Thread Pantelis Antoniou
Add a runtime interface to using configfs for generic device tree overlay
usage.

A device-tree configfs entry is created in /config/device-tree/overlays

To create an overlay you mkdir the directory and then echo the overlay
firmware file to the path property file.

# mkdir /config/device-tree/overlays/foo
# echo foo.dtbo /config/device-tree/overlays/foo/path

The overlay file will be loaded using the standard firmware loader
and will be applied.

To remove it simply rmdir the directory.

# rmdir /config/device-tree/overlays/foo

Signed-off-by: Pantelis Antoniou pantelis.anton...@konsulko.com
---
 drivers/of/Kconfig|   5 +
 drivers/of/Makefile   |   1 +
 drivers/of/configfs.c | 272 ++
 3 files changed, 278 insertions(+)
 create mode 100644 drivers/of/configfs.c

diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index 7517be2..fc0e3ec 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -77,6 +77,10 @@ config OF_RESERVED_MEM
help
  Helpers to allow for reservation of memory regions
 
+config OF_CONFIGFS
+   select CONFIGFS_FS
+   def_bool n
+
 config OF_RESOLVE
bool OF Dynamic resolution support
depends on OF
@@ -92,6 +96,7 @@ config OF_OVERLAY
select OF_DYNAMIC
select OF_DEVICE
select OF_RESOLVE
+   select OF_CONFIGFS
help
  OpenFirmware overlay support. Allows you to modify on runtime the
  live tree using overlays.
diff --git a/drivers/of/Makefile b/drivers/of/Makefile
index d2a6e0d..4efa17b 100644
--- a/drivers/of/Makefile
+++ b/drivers/of/Makefile
@@ -12,3 +12,4 @@ obj-$(CONFIG_OF_MTD)  += of_mtd.o
 obj-$(CONFIG_OF_RESERVED_MEM) += of_reserved_mem.o
 obj-$(CONFIG_OF_RESOLVE)  += resolver.o
 obj-$(CONFIG_OF_OVERLAY) += overlay.o
+obj-$(CONFIG_OF_CONFIGFS) += configfs.o
diff --git a/drivers/of/configfs.c b/drivers/of/configfs.c
new file mode 100644
index 000..a494643
--- /dev/null
+++ b/drivers/of/configfs.c
@@ -0,0 +1,272 @@
+/*
+ * Configfs entries for device-tree
+ *
+ * Copyright (C) 2013 - Pantelis Antoniou pa...@antoniou-consulting.com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+#include linux/ctype.h
+#include linux/cpu.h
+#include linux/module.h
+#include linux/of.h
+#include linux/of_fdt.h
+#include linux/spinlock.h
+#include linux/slab.h
+#include linux/proc_fs.h
+#include linux/configfs.h
+#include linux/types.h
+#include linux/stat.h
+#include linux/limits.h
+#include linux/file.h
+#include linux/vmalloc.h
+#include linux/firmware.h
+
+#include of_private.h
+
+#ifdef CONFIG_OF_OVERLAY
+
+struct cfs_overlay_item {
+   struct config_item  item;
+
+   charpath[PATH_MAX];
+
+   const struct firmware   *fw;
+   struct device_node  *overlay;
+   int ovinfo_cnt;
+   struct of_overlay_info  *ovinfo;
+   unsigned intapplied : 1;
+};
+
+static inline struct cfs_overlay_item *to_cfs_overlay_item(struct config_item 
*item)
+{
+   return item ? container_of(item, struct cfs_overlay_item, item) : NULL;
+}
+
+CONFIGFS_ATTR_STRUCT(cfs_overlay_item);
+#define CFS_OVERLAY_ITEM_ATTR(_name, _mode, _show, _store) \
+struct cfs_overlay_item_attribute cfs_overlay_item_attr_##_name = \
+   __CONFIGFS_ATTR(_name, _mode, _show, _store)
+#define CFS_OVERLAY_ITEM_ATTR_RO(_name, _show) \
+struct cfs_overlay_item_attribute cfs_overlay_item_attr_##_name = \
+   __CONFIGFS_ATTR_RO(_name, _show)
+
+static ssize_t cfs_overlay_item_path_show(struct cfs_overlay_item *overlay,
+   char *page)
+{
+   return sprintf(page, %s\n, overlay-path);
+}
+
+static ssize_t cfs_overlay_item_path_store(struct cfs_overlay_item *overlay,
+   const char *page, size_t count)
+{
+   const char *p = page;
+   char *s;
+   int err;
+
+   /* if it's set do not allow changes */
+   if (overlay-path[0] != '\0')
+   return -EPERM;
+
+   /* copy to path buffer (and make sure it's always zero terminated */
+   count = snprintf(overlay-path, sizeof(overlay-path) - 1, %s, p);
+   overlay-path[sizeof(overlay-path) - 1] = '\0';
+
+   /* strip trailing newlines */
+   s = overlay-path + strlen(overlay-path);
+   while (s  overlay-path  *--s == '\n')
+   *s = '\0';
+
+   pr_debug(%s: path is '%s'\n, __func__, overlay-path);
+
+   err = request_firmware(overlay-fw, overlay-path, NULL);
+   if (err != 0)
+   goto out_err;
+
+   /* unflatten the tree */
+   of_fdt_unflatten_tree((void *)overlay-fw-data, overlay-overlay);
+   if (overlay-overlay == NULL) {
+   pr_err(%s: failed to unflatten tree\n, __func__);
+