From: Michal Suchanek <msuchanek@suse.de>
To: Rob Herring <robh+dt@kernel.org>
Cc: "Erhard F." <erhard_f@mailbox.org>,
"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE"
<devicetree@vger.kernel.org>,
linuxppc-dev@lists.ozlabs.org,
open list <linux-kernel@vger.kernel.org>,
Javier Martinez Canillas <javierm@redhat.com>,
Thomas Zimmermann <tzimmermann@suse.de>,
Michal Suchanek <msuchanek@suse.de>,
Frank Rowand <frowand.list@gmail.com>
Subject: [PATCH v3] of: Make of framebuffer devices unique
Date: Fri, 20 Jan 2023 19:09:57 +0100 [thread overview]
Message-ID: <20230120180958.30798-1-msuchanek@suse.de> (raw)
In-Reply-To: <CAL_JsqKo+mdjA485KDb1ZauJcbOU-FR1G-Z2sYYNu7+Zn32wSA@mail.gmail.com>
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@lists.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@mailbox.org>
Suggested-by: Thomas Zimmermann <tzimmermann@suse.de>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
v3:
- merge fix into original patch
- Update the device name format
- add missing const
- do not continue with iterating display devices when formatting device
name fails
---
drivers/of/platform.c | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 81c8c227ab6b..4d3a4d9f79f2 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -525,6 +525,9 @@ 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 = 0;
+ char buf[14];
+ const char *of_display_format = "of-display.%d";
int ret;
/* Check if we have a MacOS display without a node spec */
@@ -555,7 +558,10 @@ static int __init of_platform_default_populate_init(void)
if (!of_get_property(node, "linux,opened", NULL) ||
!of_get_property(node, "linux,boot-display", NULL))
continue;
- dev = of_platform_device_create(node, "of-display", NULL);
+ ret = snprintf(buf, sizeof(buf), of_display_format, display_number++);
+ if (ret >= sizeof(buf))
+ return -EOVERFLOW;
+ dev = of_platform_device_create(node, buf, NULL);
if (WARN_ON(!dev))
return -ENOMEM;
boot_display = node;
@@ -564,7 +570,10 @@ static int __init of_platform_default_populate_init(void)
for_each_node_by_type(node, "display") {
if (!of_get_property(node, "linux,opened", NULL) || node == boot_display)
continue;
- of_platform_device_create(node, "of-display", NULL);
+ ret = snprintf(buf, sizeof(buf), of_display_format, display_number++);
+ if (ret >= sizeof(buf))
+ break;
+ of_platform_device_create(node, buf, NULL);
}
} else {
--
2.35.3
next prev parent reply other threads:[~2023-01-20 18:11 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-17 16:58 [PATCH] of: Make of framebuffer devices unique Michal Suchanek
2023-01-18 16:24 ` Rob Herring
2023-01-18 20:13 ` Erhard F.
2023-01-18 21:46 ` Michal Suchánek
2023-01-19 8:00 ` Thomas Zimmermann
2023-01-19 9:01 ` Michal Suchánek
2023-01-19 9:18 ` Thomas Zimmermann
2023-01-18 21:50 ` [PATCH] of: Fix of platform build on powerpc due to bad of disaply code Michal Suchanek
2023-01-19 9:53 ` [PATCH v2] " Michal Suchanek
2023-01-19 10:00 ` Thomas Zimmermann
2023-01-19 10:24 ` Christophe Leroy
2023-01-19 10:34 ` Michal Suchánek
2023-01-20 12:10 ` Michal Suchánek
2023-01-19 13:11 ` Thomas Zimmermann
2023-01-19 13:23 ` Michal Suchánek
2023-01-19 15:20 ` Thomas Zimmermann
2023-01-20 11:27 ` Michal Suchánek
2023-01-20 11:39 ` Thomas Zimmermann
2023-01-20 11:56 ` Michal Suchánek
2023-01-19 11:42 ` Erhard F.
2023-01-19 15:18 ` Rob Herring
2023-01-20 17:23 ` Rob Herring
2023-01-20 17:52 ` Michal Suchánek
2023-01-20 18:09 ` Michal Suchanek [this message]
2023-01-30 16:50 ` [PATCH v3] of: Make of framebuffer devices unique Rob Herring
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230120180958.30798-1-msuchanek@suse.de \
--to=msuchanek@suse.de \
--cc=devicetree@vger.kernel.org \
--cc=erhard_f@mailbox.org \
--cc=frowand.list@gmail.com \
--cc=javierm@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=robh+dt@kernel.org \
--cc=tzimmermann@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).