From patchwork Sun Mar 19 16:31: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: 13180462 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D139EC76195 for ; Sun, 19 Mar 2023 16:32:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=YY1gRa0b/Cj1aulYqCvr6E4hSJst/yOIozV5PPJKa8Q=; b=dcgCe5uz7FtwAs Sv6Tr3b4ZTGJL1T7VJPCjnkM1Ytnwo59YyJPzlJtppfs6+W3CSFH3EX/4qzvYw/pjBtSd7LtD/Y+G 1l7ffCXmvlut+ePBlw+TuZfUCzsRhdHWOVkAjoZ0I7yyFDcTe3j+OVd59Bmb+jZZyZ7tb4M7l/Dtx pvjUCHWBLhC8sEkHUDxR3f+6jucMAkxG9tNvHCRh+9Pk7zXuxFTR6TTfDDX9t7W4a82YuEGnxs1mz 59DS/d9ugihMNnDw3OY+QtRzmGbV5119FoU35f3bVKhdWovXhJuEbyna20HgKq4ncyCbyLD35J0gV XRSIldMSBlZN4SIK9zSQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pdvwl-0071Ut-1x; Sun, 19 Mar 2023 16:31:51 +0000 Received: from mail-io1-f47.google.com ([209.85.166.47]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pdvwi-0071UJ-2O for linux-arm-kernel@lists.infradead.org; Sun, 19 Mar 2023 16:31:49 +0000 Received: by mail-io1-f47.google.com with SMTP id m22so4468421ioy.4 for ; Sun, 19 Mar 2023 09:31:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679243507; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=9hSX5ZPGb2yPp6ZpbFyBngnXqKXKCG97zLl53DNRvOI=; b=jPy0hI1z65YHQNFWPaKo4nYFhEuRCN0ukioVXSNuwIpjANmPrvCz96kMRLM1tmlhMV vWdUQ0oy9G7V/odzXw1SpspwUCDHWAFfk2QnHdliD3vyn3ojNBGkYROKjGWt27rTYESq QiqWTORNkkLjMpmeSpFwqJ/UBg8TrZfEcP5nPy8ZAyAIU5Gfp/xKVBmCiCabnArlgO+d uegYgy5uLJMAoQx/HaQzXkVxUWz2qTuoV9ZJ6qESs7mBFmuOIrvKMfCf6IgAVQWljhJy 9qV6cJrbG1TKCxm9TIz+mYnU13A819WNT8rJursfH+Sz+DlgZnzi9JCI/LqKizspbXSP 7w5A== X-Gm-Message-State: AO0yUKXzjtIBOlxnLkWU+BKF8H89y2cQfjH5Q3nfiFrprRQUqch6jtff 50zp/wQ1AsSIZJ9tnZtTHnM5kD7Onw== X-Google-Smtp-Source: AK7set9HV7q7rvAjTiYs9B/VtfzoC5vf+dG2d//y81dBAIqiozn35gr6aS3op9YITmU61jPJrk6WDg== X-Received: by 2002:a5e:da4b:0:b0:74c:b180:c5db with SMTP id o11-20020a5eda4b000000b0074cb180c5dbmr3971680iop.20.1679243507334; Sun, 19 Mar 2023 09:31:47 -0700 (PDT) Received: from robh_at_kernel.org ([2605:ef80:80c7:2689:137d:d795:47e4:3de1]) by smtp.gmail.com with ESMTPSA id d65-20020a026244000000b004062d749099sm2498783jac.51.2023.03.19.09.31.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Mar 2023 09:31:46 -0700 (PDT) Received: (nullmailer pid 225260 invoked by uid 1000); Sun, 19 Mar 2023 16:31:44 -0000 From: Rob Herring To: =?utf-8?q?Beno=C3=AEt_Cousson?= , Paul Walmsley , Tony Lindgren , Russell King Cc: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] ARM: omap: Use of_address_to_resource() Date: Sun, 19 Mar 2023 11:31:35 -0500 Message-Id: <20230319163135.225076-1-robh@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230319_093148_777189_525CA63F X-CRM114-Status: GOOD ( 12.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Replace open coded parsing of "reg" with of_address_to_resource(). Signed-off-by: Rob Herring --- arch/arm/mach-omap2/omap_hwmod.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c index 5a2a9b8e61ed..37ae8ba41ddd 100644 --- a/arch/arm/mach-omap2/omap_hwmod.c +++ b/arch/arm/mach-omap2/omap_hwmod.c @@ -706,9 +706,7 @@ static const struct of_device_id ti_clkctrl_match_table[] __initconst = { static int __init _setup_clkctrl_provider(struct device_node *np) { - const __be32 *addrp; struct clkctrl_provider *provider; - u64 size; int i; provider = memblock_alloc(sizeof(*provider), SMP_CACHE_BYTES); @@ -717,8 +715,7 @@ static int __init _setup_clkctrl_provider(struct device_node *np) provider->node = np; - provider->num_addrs = - of_property_count_elems_of_size(np, "reg", sizeof(u32)) / 2; + provider->num_addrs = of_address_count(np); provider->addr = memblock_alloc(sizeof(void *) * provider->num_addrs, @@ -733,11 +730,11 @@ static int __init _setup_clkctrl_provider(struct device_node *np) return -ENOMEM; for (i = 0; i < provider->num_addrs; i++) { - addrp = of_get_address(np, i, &size, NULL); - provider->addr[i] = (u32)of_translate_address(np, addrp); - provider->size[i] = size; - pr_debug("%s: %pOF: %x...%x\n", __func__, np, provider->addr[i], - provider->addr[i] + provider->size[i]); + struct resource res; + of_address_to_resource(np, i, &res); + provider->addr[i] = res.start; + provider->size[i] = resource_size(&res); + pr_debug("%s: %pOF: %pR\n", __func__, np, &res); } list_add(&provider->link, &clkctrl_providers);