From nobody Sat Feb 7 23:23:24 2026 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 05574C7EE29 for ; Fri, 9 Jun 2023 18:31:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230081AbjFISbL (ORCPT ); Fri, 9 Jun 2023 14:31:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229536AbjFISbH (ORCPT ); Fri, 9 Jun 2023 14:31:07 -0400 Received: from mail-io1-f53.google.com (mail-io1-f53.google.com [209.85.166.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8133435B7 for ; Fri, 9 Jun 2023 11:31:05 -0700 (PDT) Received: by mail-io1-f53.google.com with SMTP id ca18e2360f4ac-77acb944bdfso92160039f.0 for ; Fri, 09 Jun 2023 11:31:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686335465; x=1688927465; 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=XOkAktt4g0nx6LcgW7gCWAzTqQNaJuKZ2Hioy4cVgxI=; b=K5soMjKJqC7j+Qh8Hg22hmQRFyROcrQ6kwFOlqfgKFIGK0a3tay5vChR3mTzgINafv abefyvXFd0LudToK7acJJmbCJVfpLTBYgulU0S1b/pQfD1dyIzSd/5362ammvUhURO46 MVFu7w1iiHn9ZAZV7td5CwjW9qofpJgjQRtK5fUG1nFlO6NycD5+kOIi1Tdt0sfa9NKM kiaLJVCsS647bUJBGxVjfUQXYDgFLjjDEvTJ8yVpfIw5E3E24UXnOnRj0XYIHMbNoakn gICJNpx3HuxHVwDO+veJeT69JDcTXXDcSdwb63mPFqGbEEO2qREvHxXFcwHrs8qr9tKr 63Mw== X-Gm-Message-State: AC+VfDxOMur5Aa/vMzJEWI19bcm+I3mWj6owoqUzGj0DCGejMRIEPRLR aHyt1L+fkRQmIfMDlcsyR6S83fr0GA== X-Google-Smtp-Source: ACHHUZ7nTbRNJnOsOtHprZKubwHVeXF1QQw+95j/zccwXR3WE8Axvi3A8qsmXX2tP4aRcDxo8aJaTw== X-Received: by 2002:a5e:dc45:0:b0:778:65fb:5e25 with SMTP id s5-20020a5edc45000000b0077865fb5e25mr2134840iop.4.1686335464768; Fri, 09 Jun 2023 11:31:04 -0700 (PDT) Received: from robh_at_kernel.org ([64.188.179.250]) by smtp.gmail.com with ESMTPSA id x6-20020a5e8306000000b0077a1b6f73b9sm1221722iom.41.2023.06.09.11.31.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Jun 2023 11:31:04 -0700 (PDT) Received: (nullmailer pid 1765318 invoked by uid 1000); Fri, 09 Jun 2023 18:31:02 -0000 From: Rob Herring To: Jeremy Kerr , Joel Stanley , Alistar Popple , Eddie James Cc: linux-fsi@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH] fsi: Use of_property_read_reg() to parse "reg" Date: Fri, 9 Jun 2023 12:30:56 -0600 Message-Id: <20230609183056.1765183-1-robh@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Use the recently added of_property_read_reg() helper to get the untranslated "reg" address value. Signed-off-by: Rob Herring Reviewed-by: Eddie James --- drivers/fsi/fsi-core.c | 39 +++++++++------------------------------ 1 file changed, 9 insertions(+), 30 deletions(-) diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index 0b927c9f4267..19c4d5b3bde9 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -415,28 +416,18 @@ EXPORT_SYMBOL_GPL(fsi_slave_release_range); static bool fsi_device_node_matches(struct device *dev, struct device_node= *np, uint32_t addr, uint32_t size) { - unsigned int len, na, ns; - const __be32 *prop; - uint32_t psize; + u64 paddr, psize; =20 - na =3D of_n_addr_cells(np); - ns =3D of_n_size_cells(np); - - if (na !=3D 1 || ns !=3D 1) - return false; - - prop =3D of_get_property(np, "reg", &len); - if (!prop || len !=3D 8) + if (of_property_read_reg(np, 0, &paddr, &psize)) return false; =20 - if (of_read_number(prop, 1) !=3D addr) + if (paddr !=3D addr) return false; =20 - psize =3D of_read_number(prop + 1, 1); if (psize !=3D size) { dev_warn(dev, - "node %s matches probed address, but not size (got 0x%x, expected 0x%x)= ", - of_node_full_name(np), psize, size); + "node %pOF matches probed address, but not size (got 0x%llx, expected 0= x%x)", + np, psize, size); } =20 return true; @@ -653,24 +644,12 @@ static void fsi_slave_release(struct device *dev) static bool fsi_slave_node_matches(struct device_node *np, int link, uint8_t id) { - unsigned int len, na, ns; - const __be32 *prop; - - na =3D of_n_addr_cells(np); - ns =3D of_n_size_cells(np); - - /* Ensure we have the correct format for addresses and sizes in - * reg properties - */ - if (na !=3D 2 || ns !=3D 0) - return false; + u64 addr; =20 - prop =3D of_get_property(np, "reg", &len); - if (!prop || len !=3D 8) + if (of_property_read_reg(np, 0, &addr, NULL)) return false; =20 - return (of_read_number(prop, 1) =3D=3D link) && - (of_read_number(prop + 1, 1) =3D=3D id); + return addr =3D=3D (((u64)link << 32) | id); } =20 /* Find a matching node for the slave at (link, id). Returns NULL if none --=20 2.39.2