Patch "of: Make OF framebuffer device names unique" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    of: Make OF framebuffer device names unique

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     of-make-of-framebuffer-device-names-unique.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit bd0632bb648270b8da4e85d7961e052c43c0600e
Author: Michal Suchanek <msuchanek@xxxxxxx>
Date:   Wed Feb 1 10:22:47 2023 -0600

    of: Make OF framebuffer device names unique
    
    [ Upstream commit 241d2fb56a18473af5f2ff0d512992a996eb64dd ]
    
    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 displays.
    
    Also, fix a node refcounting issue when exiting the boot display loop.
    
    cc: linuxppc-dev@xxxxxxxxxxxxxxxx
    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@xxxxxxxxxxx>
    Suggested-by: Thomas Zimmermann <tzimmermann@xxxxxxx>
    Signed-off-by: Michal Suchanek <msuchanek@xxxxxxx>
    Link: https://lore.kernel.org/r/20230201162247.3575506-1-robh@xxxxxxxxxx
    [robh: Rework to avoid node refcount leaks]
    Signed-off-by: Rob Herring <robh@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 3507095a69f69..6e93fd37ccd1a 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -526,6 +526,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 = 0;
 		int ret;
 
 		/* Check if we have a MacOS display without a node spec */
@@ -556,16 +557,23 @@ 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);
+			dev = of_platform_device_create(node, "of-display.0", NULL);
+			of_node_put(node);
 			if (WARN_ON(!dev))
 				return -ENOMEM;
 			boot_display = node;
+			display_number++;
 			break;
 		}
 		for_each_node_by_type(node, "display") {
+			char buf[14];
+			const char *of_display_format = "of-display.%d";
+
 			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))
+				of_platform_device_create(node, buf, NULL);
 		}
 
 	} else {



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux