Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2318566rdb; Mon, 20 Nov 2023 07:57:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IFuLrrYNMZP+yqt/MV5iGnJbGAMVn1fyC6o0VoQYf4PFucrsYcFWOpf5vozUu1Yvn9Nq6rx X-Received: by 2002:a05:6a20:12cd:b0:154:b4cb:2e8c with SMTP id v13-20020a056a2012cd00b00154b4cb2e8cmr6547718pzg.24.1700495839236; Mon, 20 Nov 2023 07:57:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700495839; cv=none; d=google.com; s=arc-20160816; b=oV7jMxdV7BoQjQRPCQKgHu8LtvqosSt8CJmhocSx+kIQ6aL2mlddjs5Z4sbTpBjWEt txXfsPnTcMbpXjDTQbSHdZ1p99LVjccGWULburtvwXE/MN4wvhHRFKeNy3NzYea7eryh bMGDN+hMJIwVNXWEu4VrG3mNrFRzEV8cRWChAzjJGKyJa/7vCx09e47vmxuQmGayqKyl OhtpjrUukMjcdRylb4EC3iJtAxf7+2CwsPLHYb2xXX/djeNdLsfe7dtpEeMH8TT91+7i w/N+79RxaqlTKbWSkiIwCTeXB1aCwXMqgTLJdM3qeQsfh4zmVMrFl9sHJBJUSAqqV8GC rn2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=bmiqxT90YVFrOlPlqhujIZF2WAbgKxIymaxdbEcrsTk=; fh=BGWPup9pQEPuzc7wRpj8/AOlqamPTM7v3TjTez+c4LM=; b=oKugn0+YBUUsTLWLbSUAYbg+GUly0QZWUOtFyBaFT3zf7XxsUgUoEsA9X0Yof0zEoM gYiJQB5eWYnMWOBsEZUFq0QCiZwymHK6JJwSvwLhcWgBKNW4Q5bxnMESktSKKJZFHX/j 238lAt8td9A3XuxEUY/6D+kxBcBQvXwDhoPsaoJHOMMm0z/lo8g5PbzRLc/qNh1skG40 HAZBQ6Qru1HwMX0tKSg9oS5yE+3HHvEVMoMfWHjNjDu967BCvsiUJBfRt6kILKGO3JFg qj3KCGY1bExq+GZq0mD17BGpkdb2OYg9HidkEFx4wlr9okFMseyoHWNQ8DZPh7y+N+ij l2oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Ispji2Yt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id k30-20020aa7999e000000b006c339539752si8005793pfh.363.2023.11.20.07.56.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 07:57:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Ispji2Yt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C4CCA806A434; Mon, 20 Nov 2023 07:55:25 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232515AbjKTPzW (ORCPT + 99 others); Mon, 20 Nov 2023 10:55:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55468 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232186AbjKTPzV (ORCPT ); Mon, 20 Nov 2023 10:55:21 -0500 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 889D7E3; Mon, 20 Nov 2023 07:55:17 -0800 (PST) Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-507a0907896so6400834e87.2; Mon, 20 Nov 2023 07:55:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1700495716; x=1701100516; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=bmiqxT90YVFrOlPlqhujIZF2WAbgKxIymaxdbEcrsTk=; b=Ispji2YtUWGY0fMQjhsXzUezOL18fprLv3zds3N0sqq53L6PV001ePiNvPozuMbWNv +kpun5IkFDW4zQwGcGGsxKayWxyVEAau4rlo1reA0SKk2zBSxwzxT0yNvIrfOBZxLtMg 3ynH8IMVxJN/PRDBJgjfJlTHic1aUfbo7vHMP17vzxiDPM2tJngkCGUbDhbigJJvgkjT Iy9/PHdbotLEa8imkZhho3OAqorzMZqYYhE57/mea/FS4rTo426S0aP6Ts54yfrboNFg wrcMmZHQj9/BvCzrF9LviVHAxqX/4o6ha3kAR9ZCl5H/92pwi4J3a9/pETk6sxM75nWy oYDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700495716; x=1701100516; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bmiqxT90YVFrOlPlqhujIZF2WAbgKxIymaxdbEcrsTk=; b=Chez6Byj8/5ido35unxZqxugWotLRkI0rBwmeg3pNBLjWu78BRmLihckSrFoRyGoAx UJWMi0AUOQS5iEDKGm8KPu70Itq8BJCiTH5ElBqYzWKXvz7uDa6T0p0SWO8K7rYgXUNX /q7H2b6ruWulNzx3rfCSor2RaU+CTiblFtv34MnOLgGjX5OrZXEqQBfdT+3LU2THNXnO /PDeJDmqrPPhV7M9SUyOQhWL9fcoHe75HP/FKm6SwHfxS8LqZJyK54Qxh2ezDFPUBBlk D7Ks/Y8DWjTfhcNm3evYBZ4gJY8zhdnjaSsCYjfAIwQvfFNhAOVZ8yIZxo8DxMJfui7Z +jtw== X-Gm-Message-State: AOJu0YybfyPdaz5rp6rTlXrs195BfTGvWaMLaoUulIyVyEy1m+yPLxDO ZWrsioGud9QjCNpu78t6fiwZua28kn8qfu0xiwY= X-Received: by 2002:a19:5514:0:b0:509:4c8a:525d with SMTP id n20-20020a195514000000b005094c8a525dmr5251624lfe.35.1700495715385; Mon, 20 Nov 2023 07:55:15 -0800 (PST) Received: from [172.25.98.130] ([5.2.194.157]) by smtp.gmail.com with ESMTPSA id a2-20020adffb82000000b0032dba85ea1bsm11629737wrr.75.2023.11.20.07.55.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 20 Nov 2023 07:55:14 -0800 (PST) Message-ID: <5cf3824f-6375-4c76-86ff-c5389ddf4196@gmail.com> Date: Mon, 20 Nov 2023 17:55:12 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 2/2] iio: adc: ad7173: add AD7173 driver Content-Language: en-US To: Andy Shevchenko Cc: linus.walleij@linaro.org, brgl@bgdev.pl, linux-gpio@vger.kernel.org, Lars-Peter Clausen , Jonathan Cameron , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Michael Walle , Arnd Bergmann , ChiaEn Wu , Niklas Schnelle , =?UTF-8?Q?Leonard_G=C3=B6hrs?= , Mike Looijmans , Haibo Chen , Hugo Villeneuve , Ceclan Dumitru , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20231116134655.21052-1-user@HYB-hhAwRlzzMZb> <20231116134655.21052-2-user@HYB-hhAwRlzzMZb> From: Ceclan Dumitru In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Mon, 20 Nov 2023 07:55:25 -0800 (PST) On 11/20/23 15:00, Andy Shevchenko wrote: > On Thu, Nov 16, 2023 at 03:46:55PM +0200, mitrutzceclan wrote: >> +struct ad7173_channel_config { >> + bool live; >> + u8 cfg_slot; >> + /* Following fields are used to compare equality. Bipolar must be first */ >> + bool bipolar; >> + bool input_buf; >> + u8 odr; >> + u8 ref_sel; > > If you group better by types, it might save a few bytes on the architectures / > compilers where bool != byte. > Grouping by type will result in not being able to use memcmp() for comparing configs. But then there is the issue that I was under the assumption that bool=byte. If that is not the case, the config equality check might be comparing padding bytes. In this case what do you suggest: - using the packed attribute - using only u8 - drop memcmp, manually compare fields ... >> + cmp_size = sizeof(*cfg) - offset; > > sizeof_field() from the above mentioned header? This computes the size of multiple fields, following cfg_slot. Better to group the fields that need to be compared into another struct then use sizeof_field()? ... > >> + return vref / (MICRO/MILLI); > > What does the denominator mean and why you can't simply use MILL? > Original vref values are in micro, I considered that it was adequate to represent the conversion from MICRO to MILLI as a fraction. >> + *val = st->info->sinc5_data_rates[reg] / (MICRO/MILLI); >> + *val2 = (st->info->sinc5_data_rates[reg] % MILLI) * (MICRO/MILLI); > > Same Q about denominator. > Here, a misunderstanding on my part of a suggestion from Jonathan in V2, will be removed.