[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230117165804.18036-1-msuchanek@suse.de>
Date: Tue, 17 Jan 2023 17:58:04 +0100
From: Michal Suchanek <msuchanek@...e.de>
To: unlisted-recipients:; (no To-header on input)
Cc: Michal Suchanek <msuchanek@...e.de>,
Rob Herring <robh+dt@...nel.org>,
Frank Rowand <frowand.list@...il.com>,
Thomas Zimmermann <tzimmermann@...e.de>,
Javier Martinez Canillas <javierm@...hat.com>,
devicetree@...r.kernel.org (open list:OPEN FIRMWARE AND FLATTENED
DEVICE TREE), linux-kernel@...r.kernel.org (open list),
linuxppc-dev@...ts.ozlabs.org, "Erhard F ." <erhard_f@...lbox.org>
Subject: [PATCH] of: Make of framebuffer devices unique
Since Linux 5.19 this error is observed:
sysfs: cannot create duplicate filename '/devices/platform/of-display'
This is because multiple devices with the same name 'of-display' are
created on the same bus.
Update the code to create numbered device names for the non-boot
disaplay.
cc: linuxppc-dev@...ts.ozlabs.org
References: https://bugzilla.kernel.org/show_bug.cgi?id=216095
Fixes: 52b1b46c39ae ("of: Create platform devices for OF framebuffers")
Reported-by: Erhard F. <erhard_f@...lbox.org>
Suggested-by: Thomas Zimmermann <tzimmermann@...e.de>
Signed-off-by: Michal Suchanek <msuchanek@...e.de>
---
drivers/of/platform.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 81c8c227ab6b..f2a5d679a324 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -525,6 +525,7 @@ static int __init of_platform_default_populate_init(void)
if (IS_ENABLED(CONFIG_PPC)) {
struct device_node *boot_display = NULL;
struct platform_device *dev;
+ int display_number = 1;
int ret;
/* Check if we have a MacOS display without a node spec */
@@ -561,10 +562,15 @@ static int __init of_platform_default_populate_init(void)
boot_display = node;
break;
}
+
for_each_node_by_type(node, "display") {
+ char *buf[14];
if (!of_get_property(node, "linux,opened", NULL) || node == boot_display)
continue;
- of_platform_device_create(node, "of-display", NULL);
+ ret = snprintf(buf, "of-display-%d", display_number++);
+ if (ret >= sizeof(buf))
+ continue;
+ of_platform_device_create(node, buf, NULL);
}
} else {
--
2.35.3
Powered by blists - more mailing lists