Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp7258870rwp; Tue, 18 Jul 2023 12:26:25 -0700 (PDT) X-Google-Smtp-Source: APBJJlEIEHoF52jtwXoUcv7O27EFVHIbqWEEuBwqEqlt8mBZz45Ypy/oGW+jKUPe//W+jJBFBOe6 X-Received: by 2002:a17:902:d501:b0:1b8:5827:8763 with SMTP id b1-20020a170902d50100b001b858278763mr731617plg.4.1689708385405; Tue, 18 Jul 2023 12:26:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689708385; cv=none; d=google.com; s=arc-20160816; b=Fv9mS/VF2XmMAnrMcewADZxZqF2Fd/6OOxmTDSPA96rzft4JbBsdPy6BhMrzQeSImk 8ERcOE0numdWeuc/JqryL/KhCqXxzXu3SJshojGESEm+2qQkLGYpoSMjeGkaSZUGjmfp J+Nohdy9OhBjxwllhH5Iu4887oOjSztYelYcPR/bGB1lhmQX/DpWG15pRYWUHywbNWVc RRaV9DRSr12Rfto+AUBPmj0ICWO/H+Ois7QDpyepGGrX7bOTLxRsWmIqSPS1TEQuygyL qaZFcSQwR8QqVJG9irm39LT0R3LphBKqZxuv3RVe+DGBvIyXCg8TfrdGuvVK4WSvn9mB HxTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=yJfNbInljvanRuvkKx7HMHtCyQM1zEs/dX2s43XSPpU=; fh=2LaAsxf82lWfjE3jxR5liHwgHotoAlx5cXqi7P2hx1w=; b=DXCZ1im+F8Ix4aYi0/ZuxO3oIzxXzFtAQoxUcMn5Keu/fYrRdhPZr2wtWGQsot6Adk 8zc2Pzj3Ao4hfpbHHS/AXBNkePdfgyY3oCgHN0BlL0h63vQ+5gs8mNHgBPwQSs7GZ4Fq 2GLKMaN5mZ4eMCb4jWGjg833jkJPgAhtEeY5w4bRzGqFGvaYZW6AmBIn9METYdHmF97s YtPvW1MfJ9gh7aCO7ymd6ZxKkEfZA2a1nGHTvfXpQjiOkFpJEfoImNmzbLZwTdKUv4/N bB+G0pcL3GGQ7WCpkWgXzLOZbuZtanrFj1z5K5dH+dzc7Xkq5TdwFTgS47oQg1LVg27a ucaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=G5TCIPcW; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pf5-20020a17090b1d8500b00263ad259d9esi2141937pjb.0.2023.07.18.12.26.11; Tue, 18 Jul 2023 12:26:25 -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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=G5TCIPcW; 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 S230356AbjGRTDU (ORCPT + 99 others); Tue, 18 Jul 2023 15:03:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229541AbjGRTDT (ORCPT ); Tue, 18 Jul 2023 15:03:19 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D0FEF0 for ; Tue, 18 Jul 2023 12:03:18 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1E87B61549 for ; Tue, 18 Jul 2023 19:03:18 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 843E6C433CB for ; Tue, 18 Jul 2023 19:03:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1689706997; bh=R8QJXFnQbLJybVy/WRm+yC3t7Ld2l0V2RXkTonYfxa0=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=G5TCIPcW8BcvC5jbNzcPO6QKQt7WsxbnuYncE97G3IJwIOubmwZ8rqMYTBrY6NcgX a7BqGpPIfw58yii+50qQJ8cADhJjx+OcwzywWJCds+mc7Egnpi98ncewsHmoIjY/SG jWMz2QnW/PJ28Z5D6eHdRkzKE+PfMDB3RIsD0JmKd7SDGH1eL1KFh7jjArU0TftVkM +2lhfULd3UDW1oyiNi+vgaePQyQhKkWgyyf/Dq7EoFpfJcWuaI5qTh352HgrXStMVo TRL6Obe/bZEb6L6gWU0KZM9juuc1tspeYLW9HteSfgmAzDcYBYnqrItLvutSN7K6gM 7cwbI2n74jLVg== Received: by mail-lj1-f179.google.com with SMTP id 38308e7fff4ca-2b708e49059so95313291fa.3 for ; Tue, 18 Jul 2023 12:03:17 -0700 (PDT) X-Gm-Message-State: ABy/qLb3Ez8RKToeEZGmevA/b2Kz4LAqIkM0Hdm+xKGch7WJsvJ1BLjA bnbwXC9+OLYkInFPQWSpUFIc8RWy2TUzUIeM/Q== X-Received: by 2002:a2e:a410:0:b0:2b6:e13f:cfd7 with SMTP id p16-20020a2ea410000000b002b6e13fcfd7mr11445466ljn.4.1689706995524; Tue, 18 Jul 2023 12:03:15 -0700 (PDT) MIME-Version: 1.0 References: <20230609183056.1765183-1-robh@kernel.org> In-Reply-To: From: Rob Herring Date: Tue, 18 Jul 2023 13:03:03 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] fsi: Use of_property_read_reg() to parse "reg" To: Jeremy Kerr , Joel Stanley , Alistar Popple , Eddie James Cc: linux-fsi@lists.ozlabs.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 On Fri, Jun 30, 2023 at 3:02=E2=80=AFPM Rob Herring wrote= : > > On Fri, Jun 9, 2023 at 12:31=E2=80=AFPM Rob Herring wro= te: > > > > Use the recently added of_property_read_reg() helper to get the > > untranslated "reg" address value. > > > > Signed-off-by: Rob Herring > > --- > > drivers/fsi/fsi-core.c | 39 +++++++++------------------------------ > > 1 file changed, 9 insertions(+), 30 deletions(-) > > Ping! Is FSI still maintained or should we just remove it? > > > > > 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; > > > > - 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; > > > > - if (of_read_number(prop, 1) !=3D addr) > > + if (paddr !=3D addr) > > return false; > > > > - 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 0x%x)", > > + np, psize, size); > > } > > > > 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; > > > > - prop =3D of_get_property(np, "reg", &len); > > - if (!prop || len !=3D 8) > > + if (of_property_read_reg(np, 0, &addr, NULL)) > > return false; > > > > - 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); > > } > > > > /* Find a matching node for the slave at (link, id). Returns NULL if n= one > > -- > > 2.39.2 > >