From patchwork Tue Nov 9 16:46:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 12610911 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71D4DC433FE for ; Tue, 9 Nov 2021 16:46:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 59A7B610CF for ; Tue, 9 Nov 2021 16:46:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240412AbhKIQtn (ORCPT ); Tue, 9 Nov 2021 11:49:43 -0500 Received: from mail-ot1-f47.google.com ([209.85.210.47]:45568 "EHLO mail-ot1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239633AbhKIQtj (ORCPT ); Tue, 9 Nov 2021 11:49:39 -0500 Received: by mail-ot1-f47.google.com with SMTP id l7-20020a0568302b0700b0055ae988dcc8so28549936otv.12; Tue, 09 Nov 2021 08:46:53 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FuoNLU2ihR8xE4baLdLGuDw4e9lBu4yjMMhbdtSzI80=; b=uk/QLJozEPWj1/ZciXGl2qWe33XqvCuntAdihBgh5s7ziaVa7V/q9TUPFvZjJ0oVXA xWw9iNJTpZRrlfQVRUisbvTNGzATNaVQwMkwNQqjqRWLG/ARZXM8bktXsMUO2R7ezD4Q UFUYGpCDrYtCDxp3XsM0u5uKGPmszfq46TY3O5Q04HDPfenbZsQJMgM5YmfmRoEbLWiO Ma2BatV/3YsKEE8X88f/RNsLx/Vvp6Y1S4BwcCWxOJ5Ki+hDxyL8qI//cVy/j0XSIuOI JN7MIV74Q+CjZf9IpzM5ye0wHm9CnyxLT7o0RJEynnWYj3kfPNHA99JJXqwGYl6ifDk8 v+nA== X-Gm-Message-State: AOAM533iqCWSY47ZLDxhmsUIOoxkXzmPfqkEVTZVA0ec7ZF8VauOKOFs ZeZIpz/CzArQmZP19fH0XA== X-Google-Smtp-Source: ABdhPJxj8cu03iQliTA8pQk4Vf2vzLvExFYWnjGcmE/j6gl759ekZMmZWg/EJ3bfPdaCi9cn9QLPBQ== X-Received: by 2002:a9d:2923:: with SMTP id d32mr6834589otb.149.1636476413029; Tue, 09 Nov 2021 08:46:53 -0800 (PST) Received: from xps15.herring.priv (66-90-148-213.dyn.grandenetworks.net. [66.90.148.213]) by smtp.googlemail.com with ESMTPSA id w22sm7514338otp.50.2021.11.09.08.46.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Nov 2021 08:46:52 -0800 (PST) From: Rob Herring To: Linus Walleij , Stephen Boyd , Sudeep Holla Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Guenter Roeck , Lorenzo Pieralisi , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Frank Rowand Subject: [PATCH 1/2] of: Support using 'mask' in making device bus id Date: Tue, 9 Nov 2021 10:46:49 -0600 Message-Id: <20211109164650.2233507-2-robh@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211109164650.2233507-1-robh@kernel.org> References: <20211109164650.2233507-1-robh@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Commit 25b892b583cc ("ARM: dts: arm: Update register-bit-led nodes 'reg' and node names") added a 'reg' property to nodes. This change has the side effect of changing how the kernel generates the device name. The assumption was a translatable 'reg' address is unique. However, in the case of the register-bit-led binding (and a few others) that is not the case. The 'mask' property must also be used in this case to make a unique device name. Fixes: 25b892b583cc ("ARM: dts: arm: Update register-bit-led nodes 'reg' and node names") Reported-by: Guenter Roeck Cc: stable@vger.kernel.org Cc: Frank Rowand Cc: Linus Walleij Signed-off-by: Rob Herring Reviewed-by: Linus Walleij --- This should be applied to stable to minimize DT ABI breakage. --- drivers/of/platform.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/of/platform.c b/drivers/of/platform.c index 07813fb1ef37..b3faf89744aa 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -76,6 +76,7 @@ static void of_device_make_bus_id(struct device *dev) struct device_node *node = dev->of_node; const __be32 *reg; u64 addr; + u32 mask; /* Construct the name, using parent nodes if necessary to ensure uniqueness */ while (node->parent) { @@ -85,8 +86,13 @@ static void of_device_make_bus_id(struct device *dev) */ reg = of_get_property(node, "reg", NULL); if (reg && (addr = of_translate_address(node, reg)) != OF_BAD_ADDR) { - dev_set_name(dev, dev_name(dev) ? "%llx.%pOFn:%s" : "%llx.%pOFn", - addr, node, dev_name(dev)); + if (!of_property_read_u32(node, "mask", &mask)) + dev_set_name(dev, dev_name(dev) ? "%llx.%x.%pOFn:%s" : "%llx.%x.%pOFn", + addr, ffs(mask) - 1, node, dev_name(dev)); + + else + dev_set_name(dev, dev_name(dev) ? "%llx.%pOFn:%s" : "%llx.%pOFn", + addr, node, dev_name(dev)); return; } From patchwork Tue Nov 9 16:46:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 12610913 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2E74C43217 for ; Tue, 9 Nov 2021 16:46:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BBF8A610CF for ; Tue, 9 Nov 2021 16:46:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240345AbhKIQto (ORCPT ); Tue, 9 Nov 2021 11:49:44 -0500 Received: from mail-ot1-f50.google.com ([209.85.210.50]:36847 "EHLO mail-ot1-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240354AbhKIQtl (ORCPT ); Tue, 9 Nov 2021 11:49:41 -0500 Received: by mail-ot1-f50.google.com with SMTP id w6-20020a9d77c6000000b0055e804fa524so3355055otl.3; Tue, 09 Nov 2021 08:46:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QCdrW6y17rvAkzqtUwRB26cgRdpTc9nbRuh6smuG2g4=; b=h/iKgqB32rzFr7IgFCye1ql4O36+fY6og0lygCiAYTZNs5YEfVEPTEPmvOHICVVQC4 7WGG0pxv8VIxR712zXkBZgmmAW2oDdACX9vET4Hka6+rgNqB0kSsCwylSAjBfH7OY6HY d2EdNIp94bW9q5bujVhVDGTD5OdKvxEdlam9Y8RDKLtMrMmTxPQxSX+EMhwdySCYqxfs +tNlAibcwlObBriUU6lN+h13JAb0FDMxVYzdvidfqDWIfiB0FQlxNpsRPAeXGP/tesBM rQKeAsqVWR6pLgmLk74CTCITGxaJZTX0/GPmE0SPRMXtSyX9faV444H6mrBi0fsZdB7/ +g/w== X-Gm-Message-State: AOAM532oY6c+UvrSZAtFIk2VigqneP6d1fx+AeWsAPiO3eH1FERuoxxZ LfO60p458s43Dsc73pjlyftljrB3qQ== X-Google-Smtp-Source: ABdhPJxSAu+FQ6ljH9p3Bj1Mz+tnr8g+QT2ZzHNPysDfdOzlazvbmApXPmhaR1GAB/4u0MlYuICJmQ== X-Received: by 2002:a9d:a2b:: with SMTP id 40mr7366147otg.100.1636476414810; Tue, 09 Nov 2021 08:46:54 -0800 (PST) Received: from xps15.herring.priv (66-90-148-213.dyn.grandenetworks.net. [66.90.148.213]) by smtp.googlemail.com with ESMTPSA id w22sm7514338otp.50.2021.11.09.08.46.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Nov 2021 08:46:54 -0800 (PST) From: Rob Herring To: Linus Walleij , Stephen Boyd , Sudeep Holla Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Guenter Roeck , Lorenzo Pieralisi , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 2/2] clk: versatile: clk-icst: Ensure clock names are unique Date: Tue, 9 Nov 2021 10:46:50 -0600 Message-Id: <20211109164650.2233507-3-robh@kernel.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211109164650.2233507-1-robh@kernel.org> References: <20211109164650.2233507-1-robh@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-clk@vger.kernel.org Commit 2d3de197a818 ("ARM: dts: arm: Update ICST clock nodes 'reg' and node names") moved to using generic node names. That results in trying to register multiple clocks with the same name. Fix this by including the unit-address in the clock name. Fixes: 2d3de197a818 ("ARM: dts: arm: Update ICST clock nodes 'reg' and node names") Cc: stable@vger.kernel.org Cc: Linus Walleij Cc: Stephen Boyd Cc: linux-arm-kernel@lists.infradead.org Cc: linux-clk@vger.kernel.org Signed-off-by: Rob Herring Reviewed-by: Linus Walleij Reviewed-by: Stephen Boyd --- This should be applied to stable to minimize DT ABI breakage. --- drivers/clk/versatile/clk-icst.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/clk/versatile/clk-icst.c b/drivers/clk/versatile/clk-icst.c index 77fd0ecaf155..d52f976dc875 100644 --- a/drivers/clk/versatile/clk-icst.c +++ b/drivers/clk/versatile/clk-icst.c @@ -484,7 +484,7 @@ static void __init of_syscon_icst_setup(struct device_node *np) struct device_node *parent; struct regmap *map; struct clk_icst_desc icst_desc; - const char *name = np->name; + const char *name; const char *parent_name; struct clk *regclk; enum icst_control_type ctype; @@ -533,15 +533,17 @@ static void __init of_syscon_icst_setup(struct device_node *np) icst_desc.params = &icst525_apcp_cm_params; ctype = ICST_INTEGRATOR_CP_CM_MEM; } else { - pr_err("unknown ICST clock %s\n", name); + pr_err("unknown ICST clock %pOF\n", np); return; } /* Parent clock name is not the same as node parent */ parent_name = of_clk_get_parent_name(np, 0); + name = kasprintf(GFP_KERNEL, "%pOFP", np); regclk = icst_clk_setup(NULL, &icst_desc, name, parent_name, map, ctype); if (IS_ERR(regclk)) { + kfree(name); pr_err("error setting up syscon ICST clock %s\n", name); return; }