aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-5.4/950-0116-of-configfs-Use-of_overlay_fdt_apply-API-call.patch
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2020-02-29 09:25:20 +0100
committerÁlvaro Fernández Rojas <noltari@gmail.com>2020-02-29 12:50:51 +0100
commita1383655cfaa71609d6236ae0fcf3b6047462b98 (patch)
treec6f123859e0dfcfaa6c1063eda26f27e208d3cac /target/linux/bcm27xx/patches-5.4/950-0116-of-configfs-Use-of_overlay_fdt_apply-API-call.patch
parenta8aa974a9dfb4cba484dc4c1e4207fd9ec803410 (diff)
downloadupstream-a1383655cfaa71609d6236ae0fcf3b6047462b98.tar.gz
upstream-a1383655cfaa71609d6236ae0fcf3b6047462b98.tar.bz2
upstream-a1383655cfaa71609d6236ae0fcf3b6047462b98.zip
bcm27xx: add linux 5.4 support
Tested on bcm2710 (Raspberry Pi 3B). Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/bcm27xx/patches-5.4/950-0116-of-configfs-Use-of_overlay_fdt_apply-API-call.patch')
-rw-r--r--target/linux/bcm27xx/patches-5.4/950-0116-of-configfs-Use-of_overlay_fdt_apply-API-call.patch114
1 files changed, 114 insertions, 0 deletions
diff --git a/target/linux/bcm27xx/patches-5.4/950-0116-of-configfs-Use-of_overlay_fdt_apply-API-call.patch b/target/linux/bcm27xx/patches-5.4/950-0116-of-configfs-Use-of_overlay_fdt_apply-API-call.patch
new file mode 100644
index 0000000000..8f71b2dbd8
--- /dev/null
+++ b/target/linux/bcm27xx/patches-5.4/950-0116-of-configfs-Use-of_overlay_fdt_apply-API-call.patch
@@ -0,0 +1,114 @@
+From acb49b81500dd9d65027587767db25ead0b457af Mon Sep 17 00:00:00 2001
+From: Phil Elwell <phil@raspberrypi.org>
+Date: Thu, 14 Jun 2018 15:07:26 +0100
+Subject: [PATCH] of: configfs: Use of_overlay_fdt_apply API call
+
+The published API to the dynamic overlay application mechanism now
+takes a Flattened Device Tree blob as input so that it can manage the
+lifetime of the unflattened tree. Conveniently, the new API call -
+of_overlay_fdt_apply - is virtually a drop-in replacement for
+create_overlay, which can now be deleted.
+
+Signed-off-by: Phil Elwell <phil@raspberrypi.org>
+---
+ drivers/of/configfs.c | 47 +++++++------------------------------------
+ 1 file changed, 7 insertions(+), 40 deletions(-)
+
+--- a/drivers/of/configfs.c
++++ b/drivers/of/configfs.c
+@@ -40,41 +40,6 @@ struct cfs_overlay_item {
+ int dtbo_size;
+ };
+
+-static int create_overlay(struct cfs_overlay_item *overlay, void *blob)
+-{
+- int err;
+-
+- /* unflatten the tree */
+- of_fdt_unflatten_tree(blob, NULL, &overlay->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 */
+- err = of_resolve_phandles(overlay->overlay);
+- if (err != 0) {
+- pr_err("%s: Failed to resolve tree\n", __func__);
+- goto out_err;
+- }
+- pr_debug("%s: resolved OK\n", __func__);
+-
+- err = of_overlay_apply(overlay->overlay, &overlay->ov_id);
+- if (err < 0) {
+- pr_err("%s: Failed to create overlay (err=%d)\n",
+- __func__, err);
+- goto out_err;
+- }
+-
+-out_err:
+- return err;
+-}
+-
+ static inline struct cfs_overlay_item *to_cfs_overlay_item(
+ struct config_item *item)
+ {
+@@ -115,7 +80,8 @@ static ssize_t cfs_overlay_item_path_sto
+ if (err != 0)
+ goto out_err;
+
+- err = create_overlay(overlay, (void *)overlay->fw->data);
++ err = of_overlay_fdt_apply((void *)overlay->fw->data,
++ (u32)overlay->fw->size, &overlay->ov_id);
+ if (err != 0)
+ goto out_err;
+
+@@ -136,7 +102,7 @@ static ssize_t cfs_overlay_item_status_s
+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item);
+
+ return sprintf(page, "%s\n",
+- overlay->ov_id >= 0 ? "applied" : "unapplied");
++ overlay->ov_id > 0 ? "applied" : "unapplied");
+ }
+
+ CONFIGFS_ATTR(cfs_overlay_item_, path);
+@@ -188,7 +154,8 @@ ssize_t cfs_overlay_item_dtbo_write(stru
+
+ overlay->dtbo_size = count;
+
+- err = create_overlay(overlay, overlay->dtbo);
++ err = of_overlay_fdt_apply(overlay->dtbo, overlay->dtbo_size,
++ &overlay->ov_id);
+ if (err != 0)
+ goto out_err;
+
+@@ -198,6 +165,7 @@ out_err:
+ kfree(overlay->dtbo);
+ overlay->dtbo = NULL;
+ overlay->dtbo_size = 0;
++ overlay->ov_id = 0;
+
+ return err;
+ }
+@@ -213,7 +181,7 @@ static void cfs_overlay_release(struct c
+ {
+ struct cfs_overlay_item *overlay = to_cfs_overlay_item(item);
+
+- if (overlay->ov_id >= 0)
++ if (overlay->ov_id > 0)
+ of_overlay_remove(&overlay->ov_id);
+ if (overlay->fw)
+ release_firmware(overlay->fw);
+@@ -241,7 +209,6 @@ static struct config_item *cfs_overlay_g
+ overlay = kzalloc(sizeof(*overlay), GFP_KERNEL);
+ if (!overlay)
+ return ERR_PTR(-ENOMEM);
+- overlay->ov_id = -1;
+
+ config_item_init_type_name(&overlay->item, name, &cfs_overlay_type);
+ return &overlay->item;