Message ID | 20230117165804.18036-1-msuchanek@suse.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1874701wrn; Tue, 17 Jan 2023 09:09:27 -0800 (PST) X-Google-Smtp-Source: AMrXdXu7uObNfW/HOTUJMR3c5PIRFiE+ZBT3q4a8cDILVtxdkNvgNMEERZ6AfNjNyWOnIS6GuW/r X-Received: by 2002:a17:906:40e:b0:873:4311:d30c with SMTP id d14-20020a170906040e00b008734311d30cmr1955090eja.13.1673975367599; Tue, 17 Jan 2023 09:09:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673975367; cv=none; d=google.com; s=arc-20160816; b=CRmlrU1xvETZeboK4P+2auoG5aPEPfnP8lpeJAfXaA1VCQY9/MHTChXz6ddCFW4rk0 wz6SQzk2DwRqKil9DFfA1eDlKUYzbJN/TyerkkKc57FxpJDH1oepXjp5pm8FrVS0Uzrg 9PM/I/ZU7c0k+So3RYQl4M/RYDgpcPtLDAOVh1jmCK65OkQqqWPbFWZgnCorvMN3ChHq IFdyzxaZC2Wc8ukm9luebWl/V23230Wz6Eg62TFPdBVXbupSarFAgT3PQiLWr8B2i9e7 ZujUqOTYQrB7/0xO2W5OKzY0KYrZ+f8IMvdaLeTWFp+Slt/D+o/mTUo9fMuVUKbG6dnh bwOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :message-id:date:subject:cc:from:dkim-signature:dkim-signature; bh=LPaYt3U/+H6P7eBulHoAyo/q+calGwfFAzTXNU5KimU=; b=lBr1wfeXmAX6YikmMOgtXF5htQDZK+y1jMaEZNZsImQikQw5QXl8clfBgTjFQSgOip IaSjaUi/XZdqm+oDw69TtNWRKiUZdtCh3TKGkEvr+s9OzWGMGen4S9D2Hg9+LIhnPveW 855eNhP/zJf4VE7qtbrOkEsk6Besk+7jrzmDLG5xRc/XN3wGhjm0dq2S+jhLOrzCXJ1L bMfTRwFdXEVqYiDovTYNuWGjnu2ThBhWWXoSaUXe2glKv/F51pr9KDG/nLQiVxJ1U5xM 0GmLDv0MAet1meTUmmMDgZmTdwYW5QOM4k5+6S42spS+SSBXG8SCQAw4VjLiuvEVWG6O KEVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@suse.de header.s=susede2_rsa header.b=JUbOFdVF; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hs27-20020a1709073e9b00b0086d23c33ea5si11994853ejc.110.2023.01.17.09.09.03; Tue, 17 Jan 2023 09:09:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail header.i=@suse.de header.s=susede2_rsa header.b=JUbOFdVF; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230503AbjAQQ6U (ORCPT <rfc822;pfffrao@gmail.com> + 99 others); Tue, 17 Jan 2023 11:58:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233616AbjAQQ6R (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 17 Jan 2023 11:58:17 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2CE104390A; Tue, 17 Jan 2023 08:58:16 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id C82ED1F74D; Tue, 17 Jan 2023 16:58:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1673974694; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=LPaYt3U/+H6P7eBulHoAyo/q+calGwfFAzTXNU5KimU=; b=JUbOFdVFaKmrVOvq3sVHVsHhZME515FfjfYS7VHGzK5iYuLYMfMS6XuVdEFSaC0O6qpq3Q vD1FYrqYADCWjNkGT4UKaY4wFwccoT86mCEXTJmmSh2x0JjDlcR1RT2FUCgRnNlzxX170d ZcKLPiEXMhIFVsSNZKqEz0NNPOVa7Mc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1673974694; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=LPaYt3U/+H6P7eBulHoAyo/q+calGwfFAzTXNU5KimU=; b=6lqQPt2RsGNeAnbw/9nYXIXLKwIjFo1wjbBxGc33WOcfLKrlQtQ0VUgSK1Qb87xIA/hf/f nU/JiqL58TrC/9Cw== Received: from kitsune.suse.cz (kitsune.suse.cz [10.100.12.127]) by relay2.suse.de (Postfix) with ESMTP id 879F62C141; Tue, 17 Jan 2023 16:58:14 +0000 (UTC) From: Michal Suchanek <msuchanek@suse.de> Cc: Michal Suchanek <msuchanek@suse.de>, Rob Herring <robh+dt@kernel.org>, Frank Rowand <frowand.list@gmail.com>, Thomas Zimmermann <tzimmermann@suse.de>, Javier Martinez Canillas <javierm@redhat.com>, devicetree@vger.kernel.org (open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE), linux-kernel@vger.kernel.org (open list), linuxppc-dev@lists.ozlabs.org, "Erhard F ." <erhard_f@mailbox.org> Subject: [PATCH] of: Make of framebuffer devices unique Date: Tue, 17 Jan 2023 17:58:04 +0100 Message-Id: <20230117165804.18036-1-msuchanek@suse.de> X-Mailer: git-send-email 2.35.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755290395066652615?= X-GMAIL-MSGID: =?utf-8?q?1755290395066652615?= |
Series |
of: Make of framebuffer devices unique
|
|
Commit Message
Michal Suchánek
Jan. 17, 2023, 4:58 p.m. UTC
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(-)
Comments
On Tue, 17 Jan 2023 17:58:04 +0100, Michal Suchanek wrote: > 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(-) > Applied, thanks!
On Tue, 17 Jan 2023 17:58:04 +0100 Michal Suchanek <msuchanek@suse.de> wrote: > 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 > Thank you for the patch Michal! It applies on 6.2-rc4 but I get this build error with my config: # make CALL scripts/checksyscalls.sh CC drivers/of/platform.o drivers/of/platform.c: In function 'of_platform_default_populate_init': drivers/of/platform.c:570:40: error: passing argument 1 of 'snprintf' from incompatible pointer type [-Werror=incompatible-pointer-types] 570 | ret = snprintf(buf, "of-display-%d", display_number++); | ^~~ | | | char ** In file included from ./arch/powerpc/include/asm/page.h:11, from ./arch/powerpc/include/asm/thread_info.h:13, from ./include/linux/thread_info.h:60, from ./arch/powerpc/include/asm/ptrace.h:342, from ./arch/powerpc/include/asm/hw_irq.h:12, from ./arch/powerpc/include/asm/irqflags.h:12, from ./include/linux/irqflags.h:16, from ./include/asm-generic/cmpxchg-local.h:6, from ./arch/powerpc/include/asm/cmpxchg.h:755, from ./arch/powerpc/include/asm/atomic.h:11, from ./include/linux/atomic.h:7, from ./include/linux/mm_types_task.h:13, from ./include/linux/mm_types.h:5, from ./include/linux/buildid.h:5, from ./include/linux/module.h:14, from drivers/of/platform.c:13: ./include/linux/kernel.h:213:20: note: expected 'char *' but argument is of type 'char **' 213 | int snprintf(char *buf, size_t size, const char *fmt, ...); | ~~~~~~^~~ drivers/of/platform.c:570:45: warning: passing argument 2 of 'snprintf' makes integer from pointer without a cast [-Wint-conversion] 570 | ret = snprintf(buf, "of-display-%d", display_number++); | ^~~~~~~~~~~~~~~ | | | char * ./include/linux/kernel.h:213:32: note: expected 'size_t' {aka 'unsigned int'} but argument is of type 'char *' 213 | int snprintf(char *buf, size_t size, const char *fmt, ...); | ~~~~~~~^~~~ drivers/of/platform.c:570:76: warning: passing argument 3 of 'snprintf' makes pointer from integer without a cast [-Wint-conversion] 570 | ret = snprintf(buf, "of-display-%d", display_number++); | ~~~~~~~~~~~~~~^~ | | | int ./include/linux/kernel.h:213:50: note: expected 'const char *' but argument is of type 'int' 213 | int snprintf(char *buf, size_t size, const char *fmt, ...); | ~~~~~~~~~~~~^~~ drivers/of/platform.c:573:57: error: passing argument 2 of 'of_platform_device_create' from incompatible pointer type [-Werror=incompatible-pointer-types] 573 | of_platform_device_create(node, buf, NULL); | ^~~ | | | char ** drivers/of/platform.c:211:57: note: expected 'const char *' but argument is of type 'char **' 211 | const char *bus_id, | ~~~~~~~~~~~~^~~~~~ cc1: some warnings being treated as errors make[3]: *** [scripts/Makefile.build:252: drivers/of/platform.o] Fehler 1 make[2]: *** [scripts/Makefile.build:504: drivers/of] Fehler 2 make[1]: *** [scripts/Makefile.build:504: drivers] Fehler 2 make: *** [Makefile:2008: .] Error 2 Regards, Erhard
On Wed, Jan 18, 2023 at 09:13:05PM +0100, Erhard F. wrote: > On Tue, 17 Jan 2023 17:58:04 +0100 > Michal Suchanek <msuchanek@suse.de> wrote: > > > 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 > > > > Thank you for the patch Michal! > > It applies on 6.2-rc4 but I get this build error with my config: Indeed, it's doubly bad. Where is the kernel test robot when you need it? It should not be that easy to miss this file but clearly it can happen. I will send a fixup. Sorry about the mess. Thanks Michal
Hi Michal, thanks for fixing this issue. But the review time was way too short. Please see my comments below. Am 18.01.23 um 22:46 schrieb Michal Suchánek: > On Wed, Jan 18, 2023 at 09:13:05PM +0100, Erhard F. wrote: >> On Tue, 17 Jan 2023 17:58:04 +0100 >> Michal Suchanek <msuchanek@suse.de> wrote: >> >>> 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++); Platform devices use a single dot (.) as separator before the index. Counting starts at zero. See /sys/bus/platform/ for examples. Can we please stick with that scheme? Generated names would then be of-display.0, of-display.1, etc. Best regards Thomas >>> + if (ret >= sizeof(buf)) >>> + continue; >>> + of_platform_device_create(node, buf, NULL); >>> } >>> >>> } else { >>> -- >>> 2.35.3 >>> >> >> Thank you for the patch Michal! >> >> It applies on 6.2-rc4 but I get this build error with my config: > > Indeed, it's doubly bad. > > Where is the kernel test robot when you need it? > > It should not be that easy to miss this file but clearly it can happen. > > I will send a fixup. > > Sorry about the mess. > > Thanks > > Michal -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
On Thu, Jan 19, 2023 at 09:00:44AM +0100, Thomas Zimmermann wrote: > Hi Michal, > > thanks for fixing this issue. But the review time was way too short. Please > see my comments below. > > Am 18.01.23 um 22:46 schrieb Michal Suchánek: > > On Wed, Jan 18, 2023 at 09:13:05PM +0100, Erhard F. wrote: > > > On Tue, 17 Jan 2023 17:58:04 +0100 > > > Michal Suchanek <msuchanek@suse.de> wrote: > > > > > > > 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++); > > Platform devices use a single dot (.) as separator before the index. > Counting starts at zero. See /sys/bus/platform/ for examples. Can we please > stick with that scheme? Generated names would then be of-display.0, > of-display.1, etc. Yes, there was surprisingly no bikeshedding. Do we also want to change the name of the device that did manage to instantiate before? This scheme changes the name only for those that did not in the past, hence "of-display" and "of-display-%d", starting from 1. Sure, replacing '-' with '.' is easy enough, and using the same format for both as well. Thanks Michal > > Best regards > Thomas > > > > > > > + if (ret >= sizeof(buf)) > > > > + continue; > > > > + of_platform_device_create(node, buf, NULL); > > > > } > > > > } else { > > > > -- > > > > 2.35.3 > > > > > > > > > > Thank you for the patch Michal! > > > > > > It applies on 6.2-rc4 but I get this build error with my config: > > > > Indeed, it's doubly bad. > > > > Where is the kernel test robot when you need it? > > > > It should not be that easy to miss this file but clearly it can happen. > > > > I will send a fixup. > > > > Sorry about the mess. > > > > Thanks > > > > Michal > > -- > Thomas Zimmermann > Graphics Driver Developer > SUSE Software Solutions Germany GmbH > Maxfeldstr. 5, 90409 Nürnberg, Germany > (HRB 36809, AG Nürnberg) > Geschäftsführer: Ivo Totev
Hi Am 19.01.23 um 10:01 schrieb Michal Suchánek: > On Thu, Jan 19, 2023 at 09:00:44AM +0100, Thomas Zimmermann wrote: >> Hi Michal, >> >> thanks for fixing this issue. But the review time was way too short. Please >> see my comments below. >> >> Am 18.01.23 um 22:46 schrieb Michal Suchánek: >>> On Wed, Jan 18, 2023 at 09:13:05PM +0100, Erhard F. wrote: >>>> On Tue, 17 Jan 2023 17:58:04 +0100 >>>> Michal Suchanek <msuchanek@suse.de> wrote: >>>> >>>>> 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]; Another issue here: This should simply be buf[14]; not a pointer. Is 14 chars enough for the string plus a full number? >>>>> 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++); The second argument to snprintf() is sizeof(buf); the number of characters in buf. >> >> Platform devices use a single dot (.) as separator before the index. >> Counting starts at zero. See /sys/bus/platform/ for examples. Can we please >> stick with that scheme? Generated names would then be of-display.0, >> of-display.1, etc. > > Yes, there was surprisingly no bikeshedding. > > Do we also want to change the name of the device that did manage to > instantiate before? > > This scheme changes the name only for those that did not in the past, > hence "of-display" and "of-display-%d", starting from 1. I find that very confusing. It is is better to count all devices from 0. I don't expect this to be an issue for userspace. But if necessary, devfs can create softlinks to of-display.0. Best regards Thomas > > Sure, replacing '-' with '.' is easy enough, and using the same format > for both as well. > > Thanks > > Michal > >> >> Best regards >> Thomas >> >> >> >>>>> + if (ret >= sizeof(buf)) >>>>> + continue; >>>>> + of_platform_device_create(node, buf, NULL); >>>>> } >>>>> } else { >>>>> -- >>>>> 2.35.3 >>>>> >>>> >>>> Thank you for the patch Michal! >>>> >>>> It applies on 6.2-rc4 but I get this build error with my config: >>> >>> Indeed, it's doubly bad. >>> >>> Where is the kernel test robot when you need it? >>> >>> It should not be that easy to miss this file but clearly it can happen. >>> >>> I will send a fixup. >>> >>> Sorry about the mess. >>> >>> Thanks >>> >>> Michal >> >> -- >> Thomas Zimmermann >> Graphics Driver Developer >> SUSE Software Solutions Germany GmbH >> Maxfeldstr. 5, 90409 Nürnberg, Germany >> (HRB 36809, AG Nürnberg) >> Geschäftsführer: Ivo Totev > > > -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
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 {