Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3169326rwd; Sat, 10 Jun 2023 02:52:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4TrG5rLlOHQqtq3kUDveYZ3usUiC92PdsEUnsn2ZxMuJST/ekCaYxk1EK2cktbpvQ0lUC5 X-Received: by 2002:a17:90a:19c8:b0:256:1441:95b5 with SMTP id 8-20020a17090a19c800b00256144195b5mr3024484pjj.29.1686390760669; Sat, 10 Jun 2023 02:52:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686390760; cv=none; d=google.com; s=arc-20160816; b=Mdt2nIkFKz+PZrT8Yhx1XO23s1853Gu3v/YolN/vDnsLGgGAeL/6q3vcy37yHspPny 9tyv7Lvvx9bi2V5IhYnRjPwvzPeZjPcWuW2aerWfpH799VWjE7n51tYYzpLrEeCDDfac uDwuVEonN6+RujAhZjsuLKHeCxVJ90TWEH7YdhSXhR0/ybwl1KQKjUCeZx/TdZP/48nh SeFI3DAvNhzgf2HP1+oyh5aSz+q+Cfxql5C00FB1b/izLUoLLD3Gp1hcE5TD0TJmTHeD Sppa+WbokkTjl+04I00KFg5xoqE2oAFgcIeymq+k3sVjIz9VVN2PjYPWmN51cRgKo1Eq qctg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=HdzBoDbAU7zXzQ4JqtJCZHVBFR8ccxzzIDutVN4tqjo=; b=mmMfI2EXrMqrJviI/+PA+wZagL+rTlJoL1W/oCONVVdrhPCDU6MfyNOa4cFmjXOVIj F+JOws2THGvQ3Jqm+BhAtZ8Q5wifyitAwx/R5FrLYAW23ICcqST9zyUpPpAfM4BG1NxO cwmVZ9BgV2TaWbRkPL8G59vaYzUPKtYb3siVeMfKHvlnZbrcLYVsOK35F4prp/XyJwDC VyTL1LJIiOZhjbJ+GVoW+EN+ajx7cj4qAvARgHsAZCpDxc+egkUcUD5Kn8e5ykFzHpzu Eu0lccv1GcT6DpLNa+ZDXQBCJKDsijqz34C1lIdPoWfbY//6UWthCpeit0XzSWmVvyl5 iLEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=YiisBsLa; 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 i17-20020a17090a7e1100b0025357108059si5750014pjl.44.2023.06.10.02.52.26; Sat, 10 Jun 2023 02:52:40 -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=YiisBsLa; 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 S230403AbjFJJgb (ORCPT + 99 others); Sat, 10 Jun 2023 05:36:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229649AbjFJJga (ORCPT ); Sat, 10 Jun 2023 05:36:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B342D269A; Sat, 10 Jun 2023 02:36:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4D05B60DF2; Sat, 10 Jun 2023 09:36:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 15454C433EF; Sat, 10 Jun 2023 09:36:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1686389788; bh=dtFXjJ4EPNkKuSigVdaZavR/GvRvLG89WPfmQG7j23A=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YiisBsLa1TvYU9BRRZcCvo9zMkaQ3ebrIl3b2MLAfzSgze21+bFIK95RfvP4BXAg9 TwXv+Tu76n7jDnXc8z3TWCoJPsgoSm6CEro4VOFCCIh4QsqAjDCI15FLcQJvd++quX HfTwnU4OVjMWUyNe9xtWlDuuC7ICJsDZwaV//jFFf4KBYdAxfqQnKvd0We9cWGC1BY OuM8SYZXk6HPlHxf2ku5xxLU4MCl9MZGhoEPa91dRbLf2UxGkxi49DeU+HD1+TkZzb v9VLGjooSss/3jHckowVvBtDBukushLvidyrdquEdv6ZyRCMk+Y8iiPNw7bMtEZaUJ uBiY0a8FamOvw== Date: Sat, 10 Jun 2023 11:36:25 +0200 From: Andi Shyti To: Rob Herring Cc: Chris Packham , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] i2c: mpc: Use of_property_read_reg() to parse "reg" Message-ID: <20230610093625.gvgbt7g4xvnuuog6@intel.intel> References: <20230609183044.1764951-1-robh@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230609183044.1764951-1-robh@kernel.org> X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 Hi Rob, On Fri, Jun 09, 2023 at 12:30:44PM -0600, Rob Herring wrote: > Use the recently added of_property_read_reg() helper to get the > untranslated "reg" address value. > > Signed-off-by: Rob Herring > --- > drivers/i2c/busses/i2c-mpc.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c > index cfd074ee6d54..595dce9218ad 100644 > --- a/drivers/i2c/busses/i2c-mpc.c > +++ b/drivers/i2c/busses/i2c-mpc.c > @@ -316,9 +316,10 @@ static void mpc_i2c_setup_512x(struct device_node *node, > if (node_ctrl) { > ctrl = of_iomap(node_ctrl, 0); > if (ctrl) { > + u64 addr; > /* Interrupt enable bits for i2c-0/1/2: bit 24/26/28 */ > - pval = of_get_property(node, "reg", NULL); > - idx = (*pval & 0xff) / 0x20; > + of_property_read_reg(node, 0, &addr, NULL); because of_property_read_reg() can return error, can we check also the error value here? Thanks, Andi > + idx = (addr & 0xff) / 0x20; > setbits32(ctrl, 1 << (24 + idx * 2)); > iounmap(ctrl); > } > -- > 2.39.2 >