From patchwork Fri Sep 8 15:23:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 13377623 X-Patchwork-Delegate: viresh.linux@gmail.com 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 84BA1EE8016 for ; Fri, 8 Sep 2023 15:25:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236914AbjIHPZ3 (ORCPT ); Fri, 8 Sep 2023 11:25:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235484AbjIHPZ3 (ORCPT ); Fri, 8 Sep 2023 11:25:29 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E4C42125; Fri, 8 Sep 2023 08:24:58 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4C17C433CA; Fri, 8 Sep 2023 15:24:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1694186680; bh=fXjtOigHLEJ1WJtElTztBusz+atOZCq2/IkS7MCl4mI=; h=From:To:Cc:Subject:Date:From; b=hQ8JnI1QGiaOPzyQCrUAKYcKFiIfMtN+Z8YcXcMAyXuIXtViVyNsJdlscKqw9pUsS dVDADrj8VYVR3WNLRMd3q8liRxJvA2ocLp8kpZ/K55Y6wr6UnDmpEvStLhtrlPrmcN H3y21oFY09jV2qmCTLm3LLSHGyh0H0GZqjbtm1vVk6EOrrX+EoWJ666WVTq3nnh90m W3weEyPPg37eZuETSlOoZtu263MMF3eFfIH7ENpCH+My9xDSnz7cVJ2/Ne2nIBob8y DMLBRYkHQY0c/BOazlKE/2C9o+EemoDt8pSx4CVmMG19CiEhIIwqqDskiPtmgLvCIF /vfrerZDJqFKQ== Received: (nullmailer pid 3971375 invoked by uid 1000); Fri, 08 Sep 2023 15:24:38 -0000 From: Rob Herring To: "Rafael J. Wysocki" , Viresh Kumar , Michael Ellerman , Nicholas Piggin , Christophe Leroy Cc: linux-pm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] cpufreq: pmac32: Use of_property_read_reg() to parse "reg" Date: Fri, 8 Sep 2023 10:23:47 -0500 Message-Id: <20230908152429.3970492-1-robh@kernel.org> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org Use the recently added of_property_read_reg() helper to get the untranslated "reg" address value. Acked-by: Viresh Kumar Signed-off-by: Rob Herring --- v2: - Add missing include --- drivers/cpufreq/pmac32-cpufreq.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/cpufreq/pmac32-cpufreq.c b/drivers/cpufreq/pmac32-cpufreq.c index ec75e79659ac..df3567c1e93b 100644 --- a/drivers/cpufreq/pmac32-cpufreq.c +++ b/drivers/cpufreq/pmac32-cpufreq.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -378,10 +379,9 @@ static int pmac_cpufreq_cpu_init(struct cpufreq_policy *policy) static u32 read_gpio(struct device_node *np) { - const u32 *reg = of_get_property(np, "reg", NULL); - u32 offset; + u64 offset; - if (reg == NULL) + if (of_property_read_reg(np, 0, &offset, NULL) < 0) return 0; /* That works for all keylargos but shall be fixed properly * some day... The problem is that it seems we can't rely @@ -389,7 +389,6 @@ static u32 read_gpio(struct device_node *np) * relative to the base of KeyLargo or to the base of the * GPIO space, and the device-tree doesn't help. */ - offset = *reg; if (offset < KEYLARGO_GPIO_LEVELS0) offset += KEYLARGO_GPIO_LEVELS0; return offset;