Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3527533pxb; Mon, 24 Jan 2022 11:27:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJzJlNOJCHCEXZ3nXg7GYnPebyfR0h7K9jpyoLBnlK12GskCSgygddUcDBGWsUu6kEVQzELM X-Received: by 2002:a63:8c49:: with SMTP id q9mr12666781pgn.425.1643052421732; Mon, 24 Jan 2022 11:27:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643052421; cv=none; d=google.com; s=arc-20160816; b=dmgDSMdzgBoXIRSYZkd2pP4ctC5CaaYKPZn/rszFrrfIBwT8KG5MuOY8XPUEnzTEDF V3pOy6xkAH3tcgvHR7vBS9+M+JkZLVrAr5jeqUbqT5DZRpqHQr4xxWVBR26dRAHQmmDH +RNTFVA6EbyzcH/c8AGQ3Yp25SiuCwSopCqLSEd6aqizvr6VLB4MJWEpPKlQYp5HAc2T Fbf9hv3gSyESmzNNqMR2hQNzSfBsId39MqH1auRwI5nPV6MSKhzMlGMpUkjO2HLWq1tv dVog6MYKz++EjI4XCQv1/rTM+3vSmJPLuJ1WNlLeCSosYuHAEOOkO4lIArX7VNM+pwbK Nq0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=k5j7zfjix+4RnpzZe8p7ICjZbPDHckuR6YpqZNgId/U=; b=jtDOzXLu4D2guQ0Dmc+TfIW+ABrAEmvHld/oQrICoYBMjMIzWD7cSPmkpkKAxFbs4c gF+gl/RoaHe5CgX2RwpNlWmqLEVfvLBQFEenYJdyEhM4U4+/4MytpfjpC6yoyTGE0sa3 BjLToUyD2dncQiOLOfFESTcNtQ0QYq8CESrDXGiWVeECFoOYk41dgHBIcf7pctj4qXpS 6rpjJKl7It6CPZxQ3QthbF95o3ZsVNFo//rfFfsEs1oQk56CIZmObaoZ0FJmz45aItpF o0ClyUjJVLuFxroaPwQrPcT2xl65DO8HYIsY4eEfmoz5uHdWAJdSpaGnbjlk7ZvFNvFp 0J+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GfYKP9R4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b5si12169491pgq.568.2022.01.24.11.26.47; Mon, 24 Jan 2022 11:27:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GfYKP9R4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240705AbiAXPTo (ORCPT + 99 others); Mon, 24 Jan 2022 10:19:44 -0500 Received: from mga05.intel.com ([192.55.52.43]:20520 "EHLO mga05.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238469AbiAXPTn (ORCPT ); Mon, 24 Jan 2022 10:19:43 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643037583; x=1674573583; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=mimpR4/W0b7KnV6xIlcXHDgxrwp8juuzVrZ3EPC/il0=; b=GfYKP9R41jkATZFfaQw61P926o/AhMsdIYmPsIgU79OXu9JLyQ5PLKfl aIU6C5jzXu/qtzsJgc3aHXRl5trO2ywDgPzNnkubqGK5EkHkX/jbQ+q7r 0czabm8rTKCa01rqhj5vwcHMNUxPk5/bnu1SVtvdJ+l05Nhp7QuIET7YI b/dSoZNPQArYuI7SlacEcR+D4Q4Uvi6ead/FQOz5CCiPK0yK/dY+6uXIL EF2V7yLYR4yPqQji53tjhY9Vl/Pz0mX3pJXHVkLJRcYn8CnZvJpP1HDWn MMfYoNvuNOGlxtmFnoIcSQC/Yfa/Bt+r8iYcnOZFdqJ3hPUJ4egK8BV2s g==; X-IronPort-AV: E=McAfee;i="6200,9189,10236"; a="332421382" X-IronPort-AV: E=Sophos;i="5.88,311,1635231600"; d="scan'208";a="332421382" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2022 07:19:43 -0800 X-IronPort-AV: E=Sophos;i="5.88,311,1635231600"; d="scan'208";a="479110611" Received: from smile.fi.intel.com ([10.237.72.61]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2022 07:19:39 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1nC173-00Dw23-53; Mon, 24 Jan 2022 17:18:33 +0200 Date: Mon, 24 Jan 2022 17:18:32 +0200 From: Andy Shevchenko To: Jonathan Cameron Cc: Dmitry Baryshkov , Jonathan Cameron , Andreas Kemnade , linux-arm-msm@vger.kernel.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Gross , Bjorn Andersson , Lars-Peter Clausen , Peter Rosin Subject: Re: [PATCH v2 5/5] iio: afe: iio-rescale: Re-use generic struct s32_fract Message-ID: References: <20220110193104.75225-1-andriy.shevchenko@linux.intel.com> <20220110193104.75225-5-andriy.shevchenko@linux.intel.com> <20220115185203.567780e8@jic23-huawei> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220115185203.567780e8@jic23-huawei> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jan 15, 2022 at 06:52:03PM +0000, Jonathan Cameron wrote: > On Mon, 10 Jan 2022 21:31:04 +0200 > Andy Shevchenko wrote: > > > Instead of custom data type re-use generic struct s32_fract. > > No changes intended. > > > > The new member is put to be the first one to avoid additional > > pointer arithmetic. Besides that one may switch to use fract > > member to perform container_of(), which will be no-op in this > > case, to get struct rescale. > > > > Signed-off-by: Andy Shevchenko > > I'm not totally sold on this series showing there is a strong case for > these macros so interested to hear what others think. So far no news :-) > Boiler plate removal is always nice of course... That's what I considered nice as well. ... > > I found this better in order how code is structurally (re)organized. > > I may rebase this on top of ongoing AFE series. > > > > Also reveals possibility to switch to rational best approximation. > > But this is another story... > > Now that may well justify introducing this shared infrastructure :) We also have mult_frac() macro which can be extended by mult_fract() for these structures. ... > > rescale = iio_priv(indio_dev); > > - > > + rescale->source = source; > > There seems to be more reorganizing going on in here than is necessary > for the function of this patch. At very least, description should > call it out. Why move setting source? Yeah, I agree that this may be in a separate change before of after the series. I will split. > > rescale->cfg = of_device_get_match_data(dev); > > - rescale->numerator = 1; > > - rescale->denominator = 1; > > > > - ret = rescale->cfg->props(dev, rescale); > > + fract = &rescale->fract; > > + fract->numerator = 1; > > + fract->denominator = 1; > > - rescale->source = source; > > - -- With Best Regards, Andy Shevchenko