Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp4608000rdh; Wed, 29 Nov 2023 06:15:27 -0800 (PST) X-Google-Smtp-Source: AGHT+IFzzYIvyxDU8Ru4VOdts/4PgnF3+uZyBirvb2gzMJ8AP+4+Baw8oBGxMbYxFJ9hUGyt+vgI X-Received: by 2002:a05:6870:d14e:b0:1f5:cd37:34e with SMTP id f14-20020a056870d14e00b001f5cd37034emr22152068oac.20.1701267325814; Wed, 29 Nov 2023 06:15:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701267325; cv=none; d=google.com; s=arc-20160816; b=iaCx0CdaB+IFP91T0nSiblnvolGoWxjeEOF+Rihrlx9DAVUPDot1ePQeUO4fyDR2p/ A7d3/K/qT60xEinSIOWRDcqTBm7M/7h1H8VOO2UhOG28qv6oVa5JdI2X6qGvYbaRVga9 xVVrqxi64xv9vL45PsPSQW19nBqKWp0/mJAa8Fc06TN8bT6Iq94ZyQQBSvE7mRzyA4LV trCUrWZkEuvPgE9OmjSdSE1U3fCExDmLf6BXf61qYGanjsw78L3yQbu/13znmiclNAbY H5rb79m3HaGJ6MhjfQYtp+WQDz+D8VXx6hpeHrZhy+ns1vUSFzvFKlKtV9hQMgNrr8+G 3xCA== 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=b20uydgzp5ZeeIOfuX9XOQtRfmjD44QyrHaTN8hg29g=; fh=NLsHMCkW9oUPGVAUwi4YjxY06qY4Y90bV6UHFXN6ohE=; b=SH7BNIYNv8gg0ZtvJ+KcL2YIgtM3dFtLsNXn3WiUqIHVR/2UW/truprBcDiMbcoWT0 ZY9K+6FIRURwmuQIC/dnJGLVRkuEANzYW1uEQHqxzEJtP0K4yvcq7LDMaqOYLhEiApFF m+lfNQCXaYQ9sDvHBNoOIyCtJFCb8FzBk/ETtuaBYcwoMccIrDjgFa5zqgs3TR/9JO24 SMvK/sKJD5wmVv/PckUAzeOsR6ar48MOgN4XW1QARCf3ru+90tH2SJb9btm9tw1csMn9 JkFIXikW0+vZW1qa6GeF9q5lggHksnlnOBDfm2WeQIurUaSaRBo+52lPAJoCm1ZLq2BR XiOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BlBU7unB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 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 fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id ht30-20020a056871521e00b001fa451d3dcfsi2947271oac.177.2023.11.29.06.15.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Nov 2023 06:15:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=BlBU7unB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 04540804C6DE; Wed, 29 Nov 2023 06:15:23 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230514AbjK2OPB (ORCPT + 99 others); Wed, 29 Nov 2023 09:15:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230490AbjK2OPA (ORCPT ); Wed, 29 Nov 2023 09:15:00 -0500 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A3383AF for ; Wed, 29 Nov 2023 06:15:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701267307; x=1732803307; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=WucPZjtsdY3mwPYiDeb29kvKCxSfqM2GO2HiwiDGwIw=; b=BlBU7unBSYK/w1FkOzqm/zv3PuOoUG0lGrT8u5U8TqLmKAnNGZwxxO1j A9NqeiTchLapl1ecKGcR0SzFC7TiRv9DqA/XeQqqdqI29QCgMqi3OsJ44 +Ee/t8at/a04GMtUKHUY4dyjBZaBNB06zxoeLbGWXOeTgJLSiJr+0lRwx Oq/81TcOv/6kMnNsUs2/DnjIHwmvb4ZMkls6yOJaYvFJSyeYhz51nuJu8 ph8UQ2td1ol+mGdSBXMippJxR6D1eCZHoKTZ5krd99hIdILs4CH0NfwPZ ZtFHDBXNtWw7fN3A992uDRE0nVtcyBtp2NA/XtVunbIQurAxYX+iIzwMP w==; X-IronPort-AV: E=McAfee;i="6600,9927,10909"; a="153891" X-IronPort-AV: E=Sophos;i="6.04,235,1695711600"; d="scan'208";a="153891" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2023 06:15:06 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10909"; a="803310349" X-IronPort-AV: E=Sophos;i="6.04,235,1695711600"; d="scan'208";a="803310349" Received: from smile.fi.intel.com ([10.237.72.54]) by orsmga001.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Nov 2023 06:15:01 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1r8LL9-00000000SSw-0kod; Wed, 29 Nov 2023 16:14:59 +0200 Date: Wed, 29 Nov 2023 16:14:58 +0200 From: Andy Shevchenko To: Petre Rodan 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: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,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 fry.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 (fry.vger.email [0.0.0.0]); Wed, 29 Nov 2023 06:15:23 -0800 (PST) On Wed, Nov 29, 2023 at 03:51:54PM +0200, Petre Rodan wrote: > 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, HSC_VARIANTS_MAX > } > > static const char * const hsc_triplet_variants[] = { static const char * const hsc_triplet_variants[HSC_VARIANTS_MAX] = { > [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[] = { static const struct hsc_range_config hsc_range_config[HSC_VARIANTS_MAX] = { > [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. That's the suggestion, yes. ... > > > +#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? I'm not sure I understand you. Maybe I was unclear, sorry for that. I meant the property.h is not used in the _header_ file. Am I mistaken? -- With Best Regards, Andy Shevchenko