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; }