From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE268C3DA78 for ; Tue, 17 Jan 2023 16:58:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232306AbjAQQ6V (ORCPT ); Tue, 17 Jan 2023 11:58:21 -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 ); 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 Cc: Michal Suchanek , Rob Herring , Frank Rowand , Thomas Zimmermann , Javier Martinez Canillas , 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 ." 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 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Suggested-by: Thomas Zimmermann Signed-off-by: Michal Suchanek --- 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