Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp3036611rwb; Fri, 20 Jan 2023 10:18:49 -0800 (PST) X-Google-Smtp-Source: AMrXdXsJ6YPHF/YGcco4RO0lVKmeuhJrI6NKiIbZAUnSXusWChRuWQtOD8tLWYN+jepZ/OZToGlP X-Received: by 2002:a05:6402:d4f:b0:49b:57f6:d9a with SMTP id ec15-20020a0564020d4f00b0049b57f60d9amr15378999edb.21.1674238729160; Fri, 20 Jan 2023 10:18:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674238729; cv=none; d=google.com; s=arc-20160816; b=pRe3pDWGc1/bKqtFXr1a70195wmzaJLjQaNHCjjRC6TEpis4ZqgkWcUy/gDK9sg3N/ M99gPj71/nPlEsPyJZf+nIVFIUs4XWPjo2dGHMNX10gDJKrzWTwofc9nqU8dRFvTSSgl PIYqLtx40E70sFb73l23jF61UJhxBn/KVFt96NO3NGscMc9PKI3hD4Yn6fzCLkE6YsBR hp9QQnzU2oMbOiwKWh8nkZVeiozscikFSfwvhQ1geQsvb1HKcgX8lRhCaurjfgeyQglU xlYNkfiypejSmGlXqyg1qE7556N7YgEDmmDf0lrotoWiQdQLXjtMPH1Vh9GyaAI2v4m/ mYqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=hkN6PpdG4Lfy4P3q90hNQcwHa4prP8EZfXIbP4VPT1k=; b=LabdwO8F0cwxcS/lklbDbU8zoYcP/LV4ZPAgHcERV/I7RkL4R9eMsmAh+T5ZPvnYNV eSs/6eEgA0kc8c8RZQMI1Gv4zFLkADeuioHuGZRuGQf+4jIrKzwkJnTfibT+TeR+qmYL QVzaPSEmc8k/eLJAvE0twtJVp6acDjJKT1AGgfqZhj612hc6t9/QVmyZafTu9kXr470l l9PBkuU6OZX8lVopt+UxKSZ0slCwnCpHdB9JrUUTN6DMpyXYrfLVPNgyge87ILZ3SXQ7 T9wiFlxAVyTH2cESSJwej7dE0p94O19EBq3oGsQji4hEbLhIxApimXWRUdOapTnxMT3z qZmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=0kWIhRlh; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=pMQoSUb2; 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=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z16-20020a05640240d000b0049e308dbbacsi17099750edb.277.2023.01.20.10.18.36; Fri, 20 Jan 2023 10:18:49 -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=pass header.i=@suse.de header.s=susede2_rsa header.b=0kWIhRlh; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b=pMQoSUb2; 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=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229577AbjATSKF (ORCPT + 50 others); Fri, 20 Jan 2023 13:10:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229524AbjATSKE (ORCPT ); Fri, 20 Jan 2023 13:10:04 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E6A97B2D9; Fri, 20 Jan 2023 10:10:03 -0800 (PST) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id C8FCB5FBEC; Fri, 20 Jan 2023 18:10:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1674238201; 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: in-reply-to:in-reply-to:references:references; bh=hkN6PpdG4Lfy4P3q90hNQcwHa4prP8EZfXIbP4VPT1k=; b=0kWIhRlhN7HnSu+SxpjJGtYLQu4XcH6zs4to/NIdHtBXBculzP4PLNMAV5+yc4d71dJUaG oadi+rIkwbUZxynl0J1hzyIy902XaC9+Ri33hyLzl6K3hX/R36Pv7Q5Mvm2wRfdy2Y3xE+ w77XGUvo5bAgyWquH5lxT++OBk4wtBQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1674238201; 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: in-reply-to:in-reply-to:references:references; bh=hkN6PpdG4Lfy4P3q90hNQcwHa4prP8EZfXIbP4VPT1k=; b=pMQoSUb2TTGqCwG6jJMv4mpI6i869ypvc5S+cATJNQF48NGzaXKIy5cpIl8JIQWeK4xXo0 FcS8/7i4aLHJ0eCA== Received: from kitsune.suse.cz (kitsune.suse.cz [10.100.12.127]) by relay2.suse.de (Postfix) with ESMTP id 9E25A2C141; Fri, 20 Jan 2023 18:10:01 +0000 (UTC) From: Michal Suchanek To: Rob Herring Cc: Michal Suchanek , "Erhard F." , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE" , Frank Rowand , open list , Javier Martinez Canillas , Thomas Zimmermann , linuxppc-dev@lists.ozlabs.org Subject: [PATCH v3] of: Make of framebuffer devices unique Date: Fri, 20 Jan 2023 19:09:57 +0100 Message-Id: <20230120180958.30798-1-msuchanek@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: References: 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 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 --- 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