Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp323358pxb; Thu, 27 Jan 2022 23:11:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwZVHgcvypt+1y+A6tkwEHApLZ5yjxFPRLMucm/v8L+Jc1bpQTkab+SkwTPnEOgv1SAClDG X-Received: by 2002:a17:907:6089:: with SMTP id ht9mr5664923ejc.612.1643353904831; Thu, 27 Jan 2022 23:11:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643353904; cv=none; d=google.com; s=arc-20160816; b=ieUMyLaapNm89wk2z4Tq5Z4pvbyhI5ksWOuLlvsZBC4X84sqebpYTZdPdpztGhPiX7 nvQ+p8U7k1PF1YiX0jr0F0wKQsrZV08cUz4OpXEx/7btffWAlmzT077UJKiZeL62a30E sa2Suk4r3Fu6sWK3FrirSdZBNHQQ121xbjANxQEzh9xWE2c+DSBdMNTHCkalDPYxEPJ/ yVjl7bRCa24Q1U6tuuR96JbXwyUg/ILGKwIRioLtL9ScDw1jfeWqWk4PEhoD731f0GpF Of/rv5EKNsPdh5zgOI2FzMRCn6LljuxgLsHIa90YtWT/JvVQ8/rJhI2zCG6cIHPKSipx uBLA== 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=66Hnhl6a3Z80WpipWTQJWe5pfm2Kvu/pGW2fKQrbdyE=; b=ekS670z2A3pDrYiuJEeoGBPN/kO1qo3mU9e32nCESnzUHKpDMlaxOewMMU4SEx3Otf GsW8SGh6Ydy4U8f3B1/15N7V0bHsE6bp3L6fDigyPibJg87UbXpmJ+PM7Y5s0IO5SkzL EUz2GwUjjZGpUQl4VFoVOP7MdCqVLm7nf4Hm6p8shatCNlB3RwzVZZ+Hy7k3x4tDAPBg 9PETbc0d/LcX8xnrJ2+ftjnLFmD4bfHdu6dtbhFe7eUX4psVSEuThg237FIzPCoz10uz aiO0Vngqrpwk+GgpcbBOK0ndbUecKhIGhKG7hTmC/Taj+mexPbtUhSbeZjOrIx0GcDpz KUtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=lvUEeT+E; 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 e16si3375643edz.46.2022.01.27.23.11.20; Thu, 27 Jan 2022 23:11:44 -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=lvUEeT+E; 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 S242814AbiA0PJ1 (ORCPT + 99 others); Thu, 27 Jan 2022 10:09:27 -0500 Received: from mga14.intel.com ([192.55.52.115]:6532 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242794AbiA0PJX (ORCPT ); Thu, 27 Jan 2022 10:09:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643296163; x=1674832163; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=m03jHFTsmH0kl+SqiX5YOIzStgNgXmrl9679DYrvc54=; b=lvUEeT+EiN9OrHviiqLdOYjoWxfbiPe1wg7LiEZnsXUza4IC6IsQjQMD VwJQ3sowxyrM6iaRGmXSAvDXF4C748CVLRjZOBRst2357Nfovh3WWpyuX ldeTF3Myynm+WZykaMvQXM1O5rwfyGEp5nD9JsKPEd+nBl50ujo8YdzZb S6mEjWNG1N6fKItraAq4spQDzGhEoBo6bOTGCHadPExD9uHBBwMsJ6Owe wf/fWDU3YV9WMtiHK2n8ZkYuleUU+NOoiJxyzD6LFyZwGCU5BaOv/2TGD FLpvZsLI2+i+sqMOwDsuiKWOIWJv+ptVAQY9xNHx83TL3bvbzXmmCbtOf g==; X-IronPort-AV: E=McAfee;i="6200,9189,10239"; a="247099735" X-IronPort-AV: E=Sophos;i="5.88,321,1635231600"; d="scan'208";a="247099735" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jan 2022 07:09:22 -0800 X-IronPort-AV: E=Sophos;i="5.88,321,1635231600"; d="scan'208";a="618361102" Received: from smile.fi.intel.com ([10.237.72.61]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Jan 2022 07:09:19 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1nD6Nh-00F1CR-MI; Thu, 27 Jan 2022 17:08:13 +0200 Date: Thu, 27 Jan 2022 17:08:13 +0200 From: Andy Shevchenko To: Peter Rosin Cc: Liam Beguin , Jonathan Cameron , 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 Subject: Re: [PATCH v2 5/5] iio: afe: iio-rescale: Re-use generic struct s32_fract Message-ID: References: <34c121fa-2a3b-fb6b-f6d5-fc2be2a5c6b7@axentia.se> <7ed2cdb9-0719-3535-9e0a-fd9d393f1cd8@axentia.se> <7bae39d5-7a38-ebdd-074a-6c140dc3a519@axentia.se> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7bae39d5-7a38-ebdd-074a-6c140dc3a519@axentia.se> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 27, 2022 at 12:03:49PM +0100, Peter Rosin wrote: > On 2022-01-26 14:01, Andy Shevchenko wrote: > > On Wed, Jan 26, 2022 at 01:35:09PM +0100, Peter Rosin wrote: > >> On 2022-01-26 13:04, Andy Shevchenko wrote: > >>> On Wed, Jan 26, 2022 at 11:26:50AM +0100, Peter Rosin wrote: > >>>> It's easy to both remove and to add back "the bigger object". I just > >>>> don't see the point of the churn. Technically you can probably rearrange > >>>> stuff in probe and remove the 2nd argument to ->props() altogether and > >>>> chase pointers from the dev object instead. I don't see the point of > >>>> that either. It doesn't really make things simpler, it doesn't really > >>>> make things easier to read. To me, it's just pointless churn. > >>> > >>> Since you still haven't got a point the conclusions are wrong. > >>> The point is (I dunno how more clear to make it) is to have proper > >>> layering from the (current) design perspective. > >> > >> I think got the gist of it. I simply do not agree with your conclusion > >> about what the "proper layering" should be. > > > > And I see no real argument against it. With the patch applied I see > > a better structure of the code and exactly necessary data to be passed > > to the method. Which makes me think that current implementation is > > either a leftover or was something like "let's take a bigger object > > _just in case_", which I can't take as a proper layering. > > The bigger object, or the one and only object as the current code is > written, is given to ->props() by design. > > BTW, you don't seem to understand the ->props() functions. There is no > data "passed to" the ->props() functions. These functions instead fill > in properties. Currently this boils down to the scaling fraction, but I > can imagine other properties. Currently the object of the properties is the same as struct __Txx_fract. In the future it may indeed be expanded. In such case I see that the layering might look like struct ..._props { struct __Txx_fract fract; ... }; Of course it depends on the properties themselves, but at least that's how I believe the OOP paradigm works. Am I mistaken? > On 2022-01-25 19:17, Andy Shevchenko wrote: > > The bigger object would be needed > > in case of using data that is not fraction. Either way it would > > be easy to add a container_of() than supply unneeded data to > > the method. > > You argued that it is easy to "break out" to the bigger object in case > it's needed. Which in my book is a sign of poor layering. > It's way easier to *not* change things, it's perfectly fine as-is. > > The argument against making the change you propose is that it does not > make this small driver any easier to understand. It would still just > change things for the sake of changing them, and I do not see the point > of erasing the existing future-proofing when it has no cost. > > To sum up, I'm ok with introducing fract_s32 in this driver, but I > don't agree with the signature change of ->props(). Thanks for valuable comments! I postponed the change in any case, let Liam to finish his part first, which we agreed is more important. -- With Best Regards, Andy Shevchenko