From patchwork Mon Mar 27 20:14:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 75666 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp1767733vqo; Mon, 27 Mar 2023 13:21:06 -0700 (PDT) X-Google-Smtp-Source: AKy350aUPQPG9YDMOFstxDg83kHeOKzLmvXSGDfaFWScNSUAjIHUpxKCGofV19MM+ItOZ4hV7FDc X-Received: by 2002:a17:906:6144:b0:930:28d6:4581 with SMTP id p4-20020a170906614400b0093028d64581mr13808990ejl.59.1679948466615; Mon, 27 Mar 2023 13:21:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679948466; cv=none; d=google.com; s=arc-20160816; b=AhnBl1Agwb1BbZoMf16emcfE78IduH+vGiuPXPGTW25CLQNdNDtfY6/NfYvlfiC3/w gjzmmEgB3xCygmPjS/OBWv5X4tSW6nXC4GDUmEPCTZafzsITgOO1gVt+/Cb4Pdns9zRj zVitmNG2dUHk45klPpjxv2ecD+/ppKG9hZLhzpHoVm8QmLjqxoHKqBTrd/OJntUtlym+ eZTpg/kLK+SN8nPD776f2/o72mMJvjfX29DCkTTV84GInpEkXuxjbis8CEJj0OfBzuZV OzJZYf+O/wfVs7qsdD122LQJLvuzOJNhc3+PC3wrH1b9ZF2d4/DQtRKJXNnGO69QtyGt 4IXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=FH+KWtses1ELBCX/gQ2si6h7qatJwS5KpqqqOPXEVFs=; b=IxMj6TvoZE+n0sWysfAAyuR4H3vpdO5am4+KvsI0WQyH6zjXP3JDwbBe2dMX3c8YwN a+SBOwam8+HguNs4KOf3AqeA+Cz6CqLsQKFY8Z2pAEQkNjfVoQYCOLpL89/O7Zz0Vqt0 laaufUxeD/mjINgM2s5po/+3/F3ib0x8y128G/KJ3MN0iyUbInjW9YwWOb7MvvtS0Whs DzKnqRw4YsokjjRoowM7F0gLIZken+S7Rarc8o5xN8oD+0k7atSpyOoVaKI+LDgg9bgw 8CamlYyJ+Ta+0BvDKEuSDU7sqsHv5KFtAVHqjmY87Y2R1AY2zcHlfSBLDTpQFO0EG1yM rPNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v17-20020a170906489100b0092bdd3273c5si21257008ejq.925.2023.03.27.13.20.42; Mon, 27 Mar 2023 13:21:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232300AbjC0UOa (ORCPT + 99 others); Mon, 27 Mar 2023 16:14:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232417AbjC0UO3 (ORCPT ); Mon, 27 Mar 2023 16:14:29 -0400 Received: from mail-oo1-f50.google.com (mail-oo1-f50.google.com [209.85.161.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F3F2D1BF9; Mon, 27 Mar 2023 13:14:22 -0700 (PDT) Received: by mail-oo1-f50.google.com with SMTP id f24-20020a4aeb18000000b0053b78077c9dso1537180ooj.12; Mon, 27 Mar 2023 13:14:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679948062; 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=FH+KWtses1ELBCX/gQ2si6h7qatJwS5KpqqqOPXEVFs=; b=DDi04BWVM52dH/EVde9Da5BHVvajmJmeC1FFSLRpOXawHKst5XMOesUBodmFZekeZO QL+oNZZHyJ383szMG8Hlw6gx3ACxHdONizl5Q18Gl258/5Dd9nYp+ZYIzrjKzYcSHLuh R/Vd7EPwgjPoTnrAAV6BlEngPCCM8Aq4CBhRL7P65i3F+AhQcSUqAH7/sRMPxjg3jew2 eqK60q+Kj3q5SLxtpUxbQkBiAwsdzc0hRc2nM7Mkpc4m/hdnMJaG/4xJN4rbhc3Qkt6v xG5hn1ByfAO4AMZPGWUvtQR1HKU8a+6/FAZ983NONtDy8aoEzIOCvj2cUQjcUBDDz6HJ TJgw== X-Gm-Message-State: AO0yUKUgRyKoNHkUEaqiKadEirEay8fTl8kfuZA1K/hny1KQ/owdHGZ4 /mecyah1Htlg+FcRrX1ZTg== X-Received: by 2002:a4a:370f:0:b0:53b:66a3:452a with SMTP id r15-20020a4a370f000000b0053b66a3452amr6472871oor.3.1679948062208; Mon, 27 Mar 2023 13:14:22 -0700 (PDT) Received: from robh_at_kernel.org (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id j41-20020a4a88ac000000b0053e3da7f810sm1565959ooa.25.2023.03.27.13.14.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Mar 2023 13:14:21 -0700 (PDT) Received: (nullmailer pid 530144 invoked by uid 1000); Mon, 27 Mar 2023 20:14:21 -0000 From: Rob Herring To: Dinh Nguyen , Borislav Petkov , Tony Luck , James Morse , Mauro Carvalho Chehab , Robert Richter , Tero Kristo Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] EDAC: Use of_address_to_resource() Date: Mon, 27 Mar 2023 15:14:11 -0500 Message-Id: <20230327201411.529948-1-robh@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=0.7 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761553643342391542?= X-GMAIL-MSGID: =?utf-8?q?1761553643342391542?= Replace of_get_address() and of_translate_address() calls with single call to of_address_to_resource(). Signed-off-by: Rob Herring Acked-by: Dinh Nguyen --- v2: - Fix compile error --- drivers/edac/altera_edac.c | 5 +++-- drivers/edac/ti_edac.c | 10 +++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/edac/altera_edac.c b/drivers/edac/altera_edac.c index e7e8e624a436..be33329c6f18 100644 --- a/drivers/edac/altera_edac.c +++ b/drivers/edac/altera_edac.c @@ -1096,6 +1096,7 @@ static int altr_s10_sdram_check_ecc_deps(struct altr_edac_device_dev *device) struct arm_smccc_res result; struct device_node *np; phys_addr_t sdram_addr; + struct resource res; u32 read_reg; int ret; @@ -1103,8 +1104,8 @@ static int altr_s10_sdram_check_ecc_deps(struct altr_edac_device_dev *device) if (!np) goto sdram_err; - sdram_addr = of_translate_address(np, of_get_address(np, 0, - NULL, NULL)); + of_address_to_resource(np, 0, &res); + sdram_addr = res.start; of_node_put(np); sdram_ecc_addr = (unsigned long)sdram_addr + prv->ecc_en_ofst; arm_smccc_smc(INTEL_SIP_SMC_REG_READ, sdram_ecc_addr, diff --git a/drivers/edac/ti_edac.c b/drivers/edac/ti_edac.c index 6971ded598de..7befcf6c6637 100644 --- a/drivers/edac/ti_edac.c +++ b/drivers/edac/ti_edac.c @@ -202,19 +202,19 @@ MODULE_DEVICE_TABLE(of, ti_edac_of_match); static int _emif_get_id(struct device_node *node) { struct device_node *np; - const __be32 *addrp; + struct resource res; u32 addr, my_addr; int my_id = 0; - addrp = of_get_address(node, 0, NULL, NULL); - my_addr = (u32)of_translate_address(node, addrp); + of_address_to_resource(node, 0, &res); + my_addr = (u32)res.start; for_each_matching_node(np, ti_edac_of_match) { if (np == node) continue; - addrp = of_get_address(np, 0, NULL, NULL); - addr = (u32)of_translate_address(np, addrp); + of_address_to_resource(np, 0, &res); + addr = (u32)res.start; edac_printk(KERN_INFO, EDAC_MOD_NAME, "addr=%x, my_addr=%x\n",