From patchwork Mon Sep 25 19:02:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring (Arm)" X-Patchwork-Id: 13398288 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 C610CCD4857 for ; Mon, 25 Sep 2023 19:03:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233201AbjIYTDG (ORCPT ); Mon, 25 Sep 2023 15:03:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34566 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbjIYTDF (ORCPT ); Mon, 25 Sep 2023 15:03:05 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E89495; Mon, 25 Sep 2023 12:02:59 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 50FA6C433C9; Mon, 25 Sep 2023 19:02:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1695668579; bh=fXjtOigHLEJ1WJtElTztBusz+atOZCq2/IkS7MCl4mI=; h=From:To:Cc:Subject:Date:From; b=MquU9wD8hYsuyJWG2dXdLxBp2tuZNIl4+TT9klhR9RxTVPdroNxfrbZhxKeimjh4Y JfrN6BpcD6a0DJu8IW9uLq9NwYfBWzgMfBLgIyJcbP8hrirGR8PpT3IuWlzM9yKWjf 7AjkLV1PsBQAep7IecnHVy7fJJebuBwDTHWGFxUPQYfzizjByavVoA4V+bNujsVAza rzwf0ZJyGALJUb0SHKewArrjJJOopNKS51TmvMLrVkQz0FWGknyWN9SYJY3D0v3h0+ HEwZcBOe3A0Bm4BmV44LbmkXA2yecvLWHmR6iyqMajxbX8NxN3BAlg3iOmhJqXOSIy FCAD5Dx2HQCmA== Received: (nullmailer pid 1712705 invoked by uid 1000); Mon, 25 Sep 2023 19:02:57 -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: Mon, 25 Sep 2023 14:02:35 -0500 Message-Id: <20230925190242.1712212-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;