Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4589460rdh; Wed, 29 Nov 2023 05:52:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IHBRQ0Cf0NXgL5H4cip+/Rf3W4z3fXYPwYov0vglT/83Wq3BPIFKJm66h9nbkgW6PvtrGix X-Received: by 2002:a17:902:ea84:b0:1cf:5543:a96 with SMTP id x4-20020a170902ea8400b001cf55430a96mr17463751plb.51.1701265932621; Wed, 29 Nov 2023 05:52:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701265932; cv=none; d=google.com; s=arc-20160816; b=Hwh7xiLu70CCWjaiJDPQ3rvpjf8wgUAPn+FghIqMXMc2UokV6OMmv647ak3Aes5LFH xzJC80NPrcKD0PrpM0dJQi9KA6/M6NrZ+hyBuC7NSGKR5UoJr2EbQvH5KrbIEZx8KUpG Lu4kPTJl1ALDXaG5Fu+NSHPIzCLBJWsW4Ff7kdBiT8xwdcnONKX0kVhLzO10ScF1zXY1 b7nw5jsy/AIGpAdYPkv29WHkaHDu2l0kMZu5F8e842Cq8uEjYQmvqR+UpjQ7Jn2KrT2l ogghsdIM9ODMj73YKEyeE5zDdmmr3f3whGxqeMJ0IwDrhyGKQqqdF9MFPoY6TmO5Nja8 eDrQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/+w5Eu12xacSqnRR/FQkOyAwWzH/TSjgLxBtShid1qk=; fh=CalxqnSLS88wzVzIAabzKUkNEkFzm2JQdM+g5DNvClM=; b=qO0RonDp4NYL0Z/Wp8Ro3mS8gtARZeQVbHZ9JbLQ8WWdGCNhfIsbFQL8+Zrg9gFY38 vB6drQHMVjA6BJ5ZvwJaLGq+6GYM2c7dk8fxZsXW8TIt0qyqupth6Ocw+XIIjcqasHNP 34vWcmkYGEn+LAeiCyJM79T7CQVo9Eh7sJDQKNkT/VdkxnfSsDXnjSFtpWDy2Cc19pPm GS80g2d3J19SHLVYKkmR92tsvYh/tExEFbWXdKZVVYQx75BCucERNrWRRCCKLjEHOxdM 06o2XjqakBrrObiPs+tHJMgj3CaPjctgtjnzRCnQWjagPrPuVDwGtpw8icoeHMTN866J XQCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=FNI4lN1j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=subdimension.ro Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id bc3-20020a170902930300b001cfc4194cb7si7768980plb.634.2023.11.29.05.52.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 05:52:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=FNI4lN1j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=subdimension.ro Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id BD82C8049118; Wed, 29 Nov 2023 05:52:09 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234105AbjK2Nvw (ORCPT + 99 others); Wed, 29 Nov 2023 08:51:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230343AbjK2Nvv (ORCPT ); Wed, 29 Nov 2023 08:51:51 -0500 Received: from mail.subdimension.ro (skycaves.subdimension.ro [172.104.132.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C28B7CE; Wed, 29 Nov 2023 05:51:57 -0800 (PST) Received: from sunspire (unknown [188.24.94.216]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mail.subdimension.ro (Postfix) with ESMTPSA id 69B1828EE6F; Wed, 29 Nov 2023 13:51:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=subdimension.ro; s=skycaves; t=1701265915; bh=uvNPKH/HkMehqSkicatMT25AWwf9jXqH853dzUzJVoA=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=FNI4lN1jDG9U/Ou85SXKAxLh+wUsuBGK+zDp14jamvc8hzBWfFBVGCLwH+dQfK3QM w48RmsNERSN3A4drgjPrKsZqebogbEp1XiEUOaA07kgr1KW0O4aRHhNYOrvWNY5tsJ ctbLeJN9J+m2SyWBLmXOrAUVA5Ikn/wlVv0WKxMY= Date: Wed, 29 Nov 2023 15:51:54 +0200 From: Petre Rodan To: Andy Shevchenko Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, Jonathan Cameron , Lars-Peter Clausen , Angel Iglesias , Matti Vaittinen , Andreas Klinger , Rob Herring , Krzysztof Kozlowski Subject: Re: [PATCH v5 2/2] iio: pressure: driver for Honeywell HSC/SSC series pressure sensors Message-ID: References: <20231129070452.1521-1-petre.rodan@subdimension.ro> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email 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 (howler.vger.email [0.0.0.0]); Wed, 29 Nov 2023 05:52:09 -0800 (PST) Hello, thank you for the code review. On Wed, Nov 29, 2023 at 12:36:46PM +0200, Andy Shevchenko wrote: > On Wed, Nov 29, 2023 at 09:04:49AM +0200, Petre Rodan wrote: > ... > > > + for (index = 0; index < ARRAY_SIZE(hsc_range_config); index++) { > > + if (strncmp(hsc_range_config[index].triplet, > > + triplet, > > + HSC_PRESSURE_TRIPLET_LEN - 1) == 0) { > > + hsc->pmin = hsc_range_config[index].pmin; > > + hsc->pmax = hsc_range_config[index].pmax; > > + found = 1; > > + break; > > + } > > + } > > + if (hsc->pmin == hsc->pmax || !found) > > + return dev_err_probe(dev, -EINVAL, > > + "honeywell,pressure-triplet is invalid\n"); > > This one is important. I think I told already twice that this is NIH > device_property_match_property_string(). Please, use this API directly. let me see if we are on the same frequency. you told me to use match_string/sysfs_match_string. using any of those assume having the strings in an array, which means I have to clutter the code with 242 extra lines in order to split up hsc_range_config: enum hsc_variants { HSC001BA = 0, HSC1_6BA = 1, [ .. 115 lines skipped ] HSC150PG = 117, } static const char * const hsc_triplet_variants[] = { [HSC001BA] = "001BA", [HSC1_6BA] = "1.6BA", [ .. 115 lines skipped ] [HSC150PG] = "150PG", }; and change my structure to static const struct hsc_range_config hsc_range_config[] = { [HSC001BA] = { .pmin = 0, .pmax = 100000 }, [ .. 117 lines skipped ] }; just to have the privilege of using match_string() on hsc_triplet_variants. now, which is worse for maintenance? a handful of lines of code that do a loop of strncmp or the clutter depicted above? I can go either way, but I want to make sure you see where this leads. > > +#ifndef _HSC030PA_H > > +#define _HSC030PA_H > > > +#include > > > +#include > > Is not used here. ok. since we are here, can you please tell me how is mutex.h used outside of hsc030pa.c where it was included previously? cheers, peter -- petre rodan