Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp3745654rwb; Sat, 3 Dec 2022 09:58:36 -0800 (PST) X-Google-Smtp-Source: AA0mqf7E76mel5M0YcypXzD8Gyq0dcG2OuxdqJhkK3YYW4WNRUpqq1hl++xmg4zkwoCVwWBC5qDj X-Received: by 2002:a63:e74a:0:b0:478:42f:5a3d with SMTP id j10-20020a63e74a000000b00478042f5a3dmr30654761pgk.3.1670090316101; Sat, 03 Dec 2022 09:58:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670090316; cv=none; d=google.com; s=arc-20160816; b=zniWSJaLVOgRHqNKGQ0MOkQd0xqlQr9XPIAY+x7R+NopTTnLiuW4zj4yqBbSTsf9aE /ZjqWm156fJ6tXPTRy4bG3GkAPfSesFlIAh4tr6mIlsEymQgTVlgzULkuWtFxr/PExs9 bI31C6Ql41/vWqDSWbqatPZU3i+phGDqKOHIgFYR8GySsKsjiInllEupEZvVFccq68sh SYJ0HNDMdCb3uPDnnXcdlOUgfPRV88KruEwTkzroZbMqpdHbO5O8/EG3Z38R/cdRZXaE 4Ox1i4NnM072r+YJxtM6IMuuppCYgq4BF/VARSApVZuOhEoTO4HXh7u9+yEupkXp6uC6 1Vrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=ZQ5kUYxQatiZreBOSKclGpezuvxhFBRVt5ZU2xRJrzM=; b=Gbiix+MVyqgpmGGrXdb5Zsfw+p3hqIMBI+hk86WOSwN8rP7Dy1gtN8ORE6ndHzinkJ kC+7Au4oxwU2x6q4cnDn0aN6VoOkH/sufINLV820EqWMUA7LutI+AXworWpMUvK8+p16 7LIFuMZEP/StDjY+70vHJMFRjupI18afRcsVYDVeXkJV1wHDYS7vTe0SP6C88Ypyw5wY b23mMM2ucN9F8rGDDKXCrbUUXEt3U+ZM6+r4YNadCQQJTP+JlR1dmRVslu9zbutsG2O0 Z+NTnPHYeRPEictzieTTZvB5r1YgGhA9Au6hY5Ax3WqlW5SP+j8wqYWyQG1qpD0smf8E q6cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=nRVt5Zko; 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 g14-20020a65580e000000b00476c6b9cf69si10308193pgr.856.2022.12.03.09.58.22; Sat, 03 Dec 2022 09:58:36 -0800 (PST) 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=nRVt5Zko; 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 S229498AbiLCQ6v (ORCPT + 82 others); Sat, 3 Dec 2022 11:58:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229540AbiLCQ6t (ORCPT ); Sat, 3 Dec 2022 11:58:49 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 532031AF36; Sat, 3 Dec 2022 08:58:48 -0800 (PST) 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 C55ED60CA0; Sat, 3 Dec 2022 16:58:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 107BEC433D7; Sat, 3 Dec 2022 16:58:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670086727; bh=iWh2UI3d2eVdkhHsEtxuowy62D6hweHEheaMfQIiPGQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=nRVt5ZkovxmoP3SscT6h8w6Mb0YCHL9mKuNjV64jVGDEv++PNuONvT6tx0Ls7PgGI paC2O338Wp1q3Sdueumthu4Fcm6C+2hW/UHls6j8s9wJKdasZwJs6XQxkhlVAA4Sx0 jsIgZ3ZMZKFkQmaJ+JZhQ7guBAqcTb0KG+NY0/tLykNi29elb6e65G3C/Esn0MHuf3 QAD2c7FMA4vDYdLpK7aiuUXGmdolrm7dZRaC+Om1RzBPCNhQRKb0ORRCRBMZRgpGKs SSAB57mko0vd8YA5RapplU+7uq1aHDs+X7Mq2bpdBEGmp+B6Ihpqi7H4tGQOiVKSLw VqI419aMTdq5g== Date: Sat, 3 Dec 2022 17:11:31 +0000 From: Jonathan Cameron To: Michael Riesch Cc: Andy Shevchenko , Gerald Loacker , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Lars-Peter Clausen , Rob Herring , Krzysztof Kozlowski , Jakob Hauser , Linus Walleij , Nikita Yushchenko Subject: Re: [PATCH v3 1/3] iio: add struct declarations for iio types Message-ID: <20221203171131.6d096078@jic23-huawei> In-Reply-To: References: <20221125083526.2422900-1-gerald.loacker@wolfvision.net> <20221125083526.2422900-2-gerald.loacker@wolfvision.net> <4d1b0054-efd4-e10e-17a6-d236052afa49@wolfvision.net> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 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 Mon, 28 Nov 2022 15:26:51 +0100 Michael Riesch wrote: > Hi Andy, > > On 11/28/22 15:05, Andy Shevchenko wrote: > > On Mon, Nov 28, 2022 at 02:48:48PM +0100, Michael Riesch wrote: > >> On 11/28/22 14:27, Andy Shevchenko wrote: > >>> On Mon, Nov 28, 2022 at 01:18:04PM +0100, Gerald Loacker wrote: > >>>> Am 25.11.2022 um 12:01 schrieb Andy Shevchenko: > > > > ... > > > >>> It's a rule to use _t for typedef:s in the kernel. That's why > >>> I suggested to leave struct definition and only typedef the same structures > >>> (existing) to new names (if needed). > >> > >> Andy, excuse our ignorance but we are not sure how this typedef approach > >> is supposed to look like... > >> > >>>> or > >>> > >>>> typedef iio_val_int_plus_micro iio_val_int_plus_micro_db; > >> > >> ... because > >> > >> #include > >> > >> struct iio_val_int_plus_micro { > >> int integer; > >> int micro; > >> }; > >> > >> typedef iio_val_int_plus_micro iio_val_int_plus_micro_db; > >> > >> int main() > >> { > >> struct iio_val_int_plus_micro a = { .integer = 100, .micro = 10, }; > >> struct iio_val_int_plus_micro_db b = { .integer = 20, .micro = 10, }; > >> return 0; > >> } > >> > >> won't compile. > > > > I see. Thanks for pointing this out. > > > > Then the question is why do we need the two same structures with different > > names? > > Most probably we don't need "struct iio_val_int_plus_micro_db" at all > since IIO_VAL_INT_PLUS_MICRO_DB and IIO_VAL_INT_PLUS_MICRO get the same > treatment in industrialio-core.c. At least it should not be introduced > in the scope of this series. In the end this is up to whoever writes the > first driver using the common data structures and IIO_VAL_INT_PLUS_MICRO_DB. They get same treatment today because we don't attempt to deal with IIO_VAL_INT_PLUS_MICRO_DB in conjunction with any of the analog circuit type front ends yet. Mind you, even though the handling in iio-rescale.c will be different if anyone ever adds support for the DB form (I shudder at the maths of combining this with other scale factors), I don't see the possibility meaning we need a different structure. Jonathan > > Best regards, > Michael >