From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6C07DC2D0E8 for ; Thu, 26 Mar 2020 12:05:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 404D220714 for ; Thu, 26 Mar 2020 12:05:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728249AbgCZMFS (ORCPT ); Thu, 26 Mar 2020 08:05:18 -0400 Received: from mga12.intel.com ([192.55.52.136]:55934 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728001AbgCZMFS (ORCPT ); Thu, 26 Mar 2020 08:05:18 -0400 IronPort-SDR: J+Ugs1EyZSk51dsu3pP4+sSD1XJPwzeZ85GSoqC5bVRoPjZGTEi3qZWhRczKP30rHh0+WDoOcW T+VBr3n2boGA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2020 05:05:18 -0700 IronPort-SDR: WNd680x+3yR7O9UQOXuYCW9ptLjBJO5Ar2yJ7lwfzfl4cmgWmuptR0XvyfgSRWX/kCnx+I0jJM P1wRi+b//h7A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,308,1580803200"; d="scan'208";a="293614158" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by FMSMGA003.fm.intel.com with ESMTP; 26 Mar 2020 05:05:16 -0700 Received: from andy by smile with local (Exim 4.93) (envelope-from ) id 1jHRGB-00D72B-C8; Thu, 26 Mar 2020 14:05:19 +0200 Date: Thu, 26 Mar 2020 14:05:19 +0200 From: Andy Shevchenko To: Geert Uytterhoeven Cc: Wolfram Sang , Wolfram Sang , Linux I2C , Linux-Renesas Subject: Re: [RFC PATCH] i2c: refactor parsing of timings Message-ID: <20200326120519.GS1922688@smile.fi.intel.com> References: <20200326101647.1756-1-wsa+renesas@sang-engineering.com> <20200326105241.GA1538@ninjato> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org On Thu, Mar 26, 2020 at 12:15:22PM +0100, Geert Uytterhoeven wrote: > On Thu, Mar 26, 2020 at 11:52 AM Wolfram Sang wrote: > > > > +{ > > > > + int ret; > > > > + > > > > + ret = device_property_read_u32(dev, prop_name, cur_val_p); > > > > + if (ret && use_def) > > > > + *cur_val_p = def_val; > > > > > > Alternatively, you could just preinitialize the value with the default value > > > before calling this function, and ignoring ret. > > > That would remove the need for both the def_val and use_def parameters. > > > > I can't do that because if !use_def and ret, then the value must not be > > changed. > > Of course the preinitialization must still be done conditionally: > > if (use_defaults) > t->foo = DEFAULT_FOO; > i2c_parse_timing(dev, "foo-name", &t->foo); If the default *is* coming from timings structure? Care to look at rcar case? -- With Best Regards, Andy Shevchenko