All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] of: Make of framebuffer devices unique
@ 2023-01-17 16:58 ` Michal Suchanek
  0 siblings, 0 replies; 49+ messages in thread
From: Michal Suchanek @ 2023-01-17 16:58 UTC (permalink / raw)
  Cc: open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE, Erhard F .,
	linuxppc-dev, Javier Martinez Canillas, open list, Rob Herring,
	Thomas Zimmermann, Michal Suchanek, Frank Rowand

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>
---
 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


^ permalink raw reply related	[flat|nested] 49+ messages in thread

end of thread, other threads:[~2023-01-30 16:51 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-17 16:58 [PATCH] of: Make of framebuffer devices unique Michal Suchanek
2023-01-17 16:58 ` Michal Suchanek
2023-01-18 16:24 ` Rob Herring
2023-01-18 16:24   ` Rob Herring
2023-01-18 20:13 ` Erhard F.
2023-01-18 20:13   ` Erhard F.
2023-01-18 21:46   ` Michal Suchánek
2023-01-18 21:46     ` Michal Suchánek
2023-01-19  8:00     ` Thomas Zimmermann
2023-01-19  8:00       ` Thomas Zimmermann
2023-01-19  9:01       ` Michal Suchánek
2023-01-19  9:01         ` Michal Suchánek
2023-01-19  9:18         ` Thomas Zimmermann
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-18 21:50     ` Michal Suchanek
2023-01-19  9:53     ` [PATCH v2] " Michal Suchanek
2023-01-19  9:53       ` Michal Suchanek
2023-01-19 10:00       ` Thomas Zimmermann
2023-01-19 10:00         ` Thomas Zimmermann
2023-01-19 10:24       ` Christophe Leroy
2023-01-19 10:34         ` Michal Suchánek
2023-01-19 10:34           ` Michal Suchánek
2023-01-20 12:10           ` Michal Suchánek
2023-01-20 12:10             ` Michal Suchánek
2023-01-19 13:11         ` Thomas Zimmermann
2023-01-19 13:11           ` Thomas Zimmermann
2023-01-19 13:23           ` Michal Suchánek
2023-01-19 13:23             ` Michal Suchánek
2023-01-19 15:20             ` Thomas Zimmermann
2023-01-19 15:20               ` Thomas Zimmermann
2023-01-20 11:27               ` Michal Suchánek
2023-01-20 11:27                 ` Michal Suchánek
2023-01-20 11:39                 ` Thomas Zimmermann
2023-01-20 11:39                   ` Thomas Zimmermann
2023-01-20 11:56                   ` Michal Suchánek
2023-01-20 11:56                     ` Michal Suchánek
2023-01-19 11:42       ` Erhard F.
2023-01-19 11:42         ` Erhard F.
2023-01-19 15:18       ` Rob Herring
2023-01-19 15:18         ` Rob Herring
2023-01-20 17:23       ` Rob Herring
2023-01-20 17:23         ` Rob Herring
2023-01-20 17:52         ` Michal Suchánek
2023-01-20 17:52           ` Michal Suchánek
2023-01-20 18:09         ` [PATCH v3] of: Make of framebuffer devices unique Michal Suchanek
2023-01-20 18:09           ` Michal Suchanek
2023-01-30 16:50           ` Rob Herring
2023-01-30 16:50             ` Rob Herring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.