Received: by 2002:a05:7412:419a:b0:f3:1519:9f41 with SMTP id i26csp3989213rdh; Tue, 28 Nov 2023 08:54:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IGecyqiTEtcY6G1CYTFZKf2f4zqL7lbTTyfQHgPTpspHZmRgK1bkL+7GvIOCYU1/TulkkdY X-Received: by 2002:a05:6808:6548:b0:3b6:dc6f:2741 with SMTP id fn8-20020a056808654800b003b6dc6f2741mr22960705oib.19.1701190466043; Tue, 28 Nov 2023 08:54:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701190466; cv=none; d=google.com; s=arc-20160816; b=La6V3WFL+aHWMevosQYm12nU0OIbtyIUQhQvadx3boGm3j4MsyGvmlQXqQw7u4pDvd Xb2zYiC3LYjsR/2V7uggeKtkpdxhCVVxiwqJD0VS8/XaCbMO7SSjqxu282/6B+xSU6cZ z0frxWLRB4O4C0+zDmc7jROP19lZr9jfHkZqSwTO4ZGHSl70xbbLyWG8fVawDPJr965K bC1/6Ty8vvexhIw6YeqszL0rqnaz0cpnZd8hNCw0orcDDfZykSqlXsBv1ZZzKnBxMITS 0Kuz8GS3GQRUZ1RGRtR5ZiCiEn/ttcdihyGQKXA2CuhdoY54+59elWoOaOl33fK2vAR7 NLSQ== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=BZehgPg25HQzUkDSqLdPrNPrYJq0kFy9Byangex9TdE=; fh=NLsHMCkW9oUPGVAUwi4YjxY06qY4Y90bV6UHFXN6ohE=; b=aovrIAUMs/0HNPk56vjjRTDb2lzow/vB8ReFAag0/pDLope6BUACBPwZpnypo/1nNe 8AqiiEYuAdqiMSIT98xpPJunAegLQ6dEnTmj/5agkiNMvf7XSG1j5pHErgMK/UvQTJfp AFke0ZHXER7i0IXealk8wzCmzfVTe+j1M5cnoHalGoQ/HU/40/MfIDVeOD07GefDv5gP ztJTNj4PqWR/UmGW9EuINl+1MxAhfj2dKQcXT8u8EYYRPkDIJKtA+1KkiFb7n8esdOix 3BHmQc8+z0WYdT4yBnIq+1SkDScVOGswiXUMZ3n08hCJ3oyKZa7Z/jPAj5tZJiqGz6gT 0bbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=LPvN2BhZ; 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=NONE dis=NONE) header.from=intel.com Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id e192-20020a6369c9000000b005b7160263efsi12189104pgc.489.2023.11.28.08.54.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 08:54:25 -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=@intel.com header.s=Intel header.b=LPvN2BhZ; 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=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 66357807590C; Tue, 28 Nov 2023 08:54:24 -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 S229716AbjK1QyO (ORCPT + 99 others); Tue, 28 Nov 2023 11:54:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229671AbjK1QyL (ORCPT ); Tue, 28 Nov 2023 11:54:11 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 14DE9D4B; Tue, 28 Nov 2023 08:54:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701190458; x=1732726458; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=rBLBZwxnwboOcGZ4yYzLMiS1WGPL9Qxe1NKjYqK/J1k=; b=LPvN2BhZiVKBbfz2LNVQfTAzlginOXjDmUqAoEHZ4MNGmPlggcJAehyN Nn1UhJCQrG4yYVpDqmrj0edjNlMDCpLw3lNYMcGcHEou813i/3PDoW/Ls 9VV5In49z1kdivfRo5jIeHgYp6eb7U+6iyq22YbHkKcFO8qjPRCGTSkSf fmxxcMFiEAPlt2BDx9iOBUJ+CRSwLiM+r24MKEpX3DHgMOnPYM8JKbo5A Bh/T6N7YFe1yT+cn4S3bcUaMdqaKMb2/MvFQ2yAYO378FGM5qNpcsmV9m UvulclWskwm7NSDUUabMxx5b0dfn3IsgUqgAeqMRkg9Kuj6+QE7kUeAm7 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10908"; a="457294935" X-IronPort-AV: E=Sophos;i="6.04,234,1695711600"; d="scan'208";a="457294935" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Nov 2023 08:54:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10908"; a="859480364" X-IronPort-AV: E=Sophos;i="6.04,234,1695711600"; d="scan'208";a="859480364" Received: from smile.fi.intel.com ([10.237.72.54]) by FMSMGA003.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Nov 2023 08:54:14 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.97) (envelope-from ) id 1r81Lf-00000000DKX-15Dq; Tue, 28 Nov 2023 18:54:11 +0200 Date: Tue, 28 Nov 2023 18:54:10 +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 v4 2/2] iio: pressure: driver for Honeywell HSC/SSC series pressure sensors Message-ID: References: <20231128124103.22765-1-petre.rodan@subdimension.ro> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20231128124103.22765-1-petre.rodan@subdimension.ro> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,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]); Tue, 28 Nov 2023 08:54:24 -0800 (PST) On Tue, Nov 28, 2023 at 02:40:58PM +0200, Petre Rodan wrote: > Adds driver for digital Honeywell TruStability HSC and SSC series > pressure and temperature sensors. Trailing white space. > Communication is one way. The sensor only requires 4 bytes worth of > clock pulses on both i2c and spi in order to push the data out. > The i2c address is hardcoded and depends on the part number. > There is no additional GPIO control. ... > + default: > + return -EINVAL; > + } > + return -EINVAL; Dead code. ... > +int hsc_common_probe(struct device *dev, void *client, > + int (*recv_fct)(struct hsc_data *data), const char *name) Make it a typedef typedef int (*hsc_recv_fn)(struct hsc_data *); (note the fn suffix as standard in such cases). ... > + ret = device_property_read_u32(dev, > + "honeywell,transfer-function", > + &hsc->function); Strange indentation. > + if (ret) > + return dev_err_probe(dev, ret, > + "honeywell,transfer-function could not be read\n"); ... > + ret = device_property_read_string(dev, > + "honeywell,pressure-triplet", &triplet); Strange indentation. > + if (ret) > + return dev_err_probe(dev, ret, > + "honeywell,pressure-triplet could not be read\n"); ... > + if (strncmp(triplet, "NA", 2) == 0) { > + /* "not available" in the nomenclature > + we got a custom-range chip so extract pmin, pmax from dt */ Wrong comment style. And I believe I already said, respect English grammar and punctuation! Ditto for other multi-line comments in this patch. > + ret = device_property_read_u32(dev, > + "honeywell,pmin-pascal", > + &hsc->pmin); Strange indentation. > + if (ret) > + return dev_err_probe(dev, ret, > + "honeywell,pmin-pascal could not be read\n"); > + ret = device_property_read_u32(dev, > + "honeywell,pmax-pascal", Strange indentation. > + &hsc->pmax); > + if (ret) > + return dev_err_probe(dev, ret, > + "honeywell,pmax-pascal could not be read\n"); > + } else { > + /* chip should be defined in the nomenclature */ > + 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"); > + } ... > + tmp = div_s64(((s64)(hsc->pmax - hsc->pmin)) * MICRO, > + (hsc->outmax - hsc->outmin)); Too many parentheses (denominator). ... > +#include > +#include Missing mutex.h (in the common header file). ... > + int (*recv)(struct hsc_data *data); See about typedef above. ... > +int hsc_common_probe(struct device *dev, void *client, > + int (*recv_fct)(struct hsc_data *data), const char *name); Ditto. ... > +#include > +#include Missing mod_devicetable.h, errno.h (I?C driver). ... > +#include > +#include Missing mod_devicetable.h (SPI driver). See below as well. ... > + .tx_buf = NULL, NULL is defined via types.h IIRC. ... > +static struct spi_driver hsc_spi_driver = { > + .driver = { > + .name = "hsc030pa", > + .of_match_table = hsc_spi_match, > + }, Wrong indentation. > + .probe = hsc_spi_probe, > + .id_table = hsc_spi_id, > +}; -- With Best Regards, Andy Shevchenko