Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp3498894pxy; Mon, 26 Apr 2021 03:17:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz3NS+z2mKWVg9KY9RHDanX38HU04bg8Vmle6S9NZffqa191uWyD+TShxVNRJs8WwwHi/hc X-Received: by 2002:a17:906:eb43:: with SMTP id mc3mr17266378ejb.78.1619432257807; Mon, 26 Apr 2021 03:17:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619432257; cv=none; d=google.com; s=arc-20160816; b=eXOJTCNCPFQo16LsT2Y6KZTz3gFkuBCvCFyMXTNXhz9TNa1gwxFv7zIZFKwigyhmhv L0yZU8oN6Pnor9hurEMkxf4Q4bHXuFA1CofWN9DRY/OC9trvPm4QfO/xDzGk+8wbmME5 fXuBQrJZp9DLPIllyB2SffpBcywUciLYxpU6TdAQ4vnfYMchvkDtXHdjGv/dD9MIP/Xg d47mqvrvLwqhnjcsqKowd1tbrIkIA5Y4sKTAb7Z4gidqQ6qWKAdhlDNtTtjqO4p1jPNp /w2sDjKGTpwb13ZiUN2wse3NTGHYPmR4K/aBSPG6ZwI/KRIS7hgQItzigefthCU4Ofya LBtw== 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; bh=JwaiBoOVYpdbphGLRcopzUEv7uixeckc1MoZYMzBagY=; b=ycIwFNPFI1oXa7uxG1qcpo3Cxrl6+U1osvFNgQszB9O9wU7y8cleP0bjCOl9/hRvA/ pHxYn565aTwnQKkbCwP83+Vpz74bGezG/WXIGTJcO1P5+U8B4KX8tKroSLpphwc/nxsN 3OvSTRoS+7DcVeJ/uyUUurmwgC/Y1oCfajBukMi1xSBQqjEjG3hBhRz7AcIZmBzSSQ7I 3jc9JmdVFVnQZ1QebYhHy6Jhvsa8+0BZ8hIIN/IyZv0xtQwuxh6E77oVuWVRnmLzJtOc r78j5yjuYNbj70zDKH+RQs9tdNCNRDYoGZNhtWLPQaLXV8qj6pxkUEW3pBmSNU7l/hoI cLEw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gx22si12159588ejb.685.2021.04.26.03.17.13; Mon, 26 Apr 2021 03:17:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232995AbhDZKPC (ORCPT + 99 others); Mon, 26 Apr 2021 06:15:02 -0400 Received: from smtpout1.mo528.mail-out.ovh.net ([46.105.34.251]:38363 "EHLO smtpout1.mo528.mail-out.ovh.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232173AbhDZKPB (ORCPT ); Mon, 26 Apr 2021 06:15:01 -0400 Received: from pro2.mail.ovh.net (unknown [10.108.20.143]) by mo528.mail-out.ovh.net (Postfix) with ESMTPS id DDA44A25FE9F; Mon, 26 Apr 2021 12:14:18 +0200 (CEST) Received: from localhost (89.70.221.198) by DAG2EX1.emp2.local (172.16.2.11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.4; Mon, 26 Apr 2021 12:14:18 +0200 Date: Mon, 26 Apr 2021 12:10:13 +0200 From: Tomasz Duszynski To: Lars-Peter Clausen CC: Tomasz Duszynski , , , , , Subject: Re: [PATCH 1/3] iio: sps30: separate core and interface specific code Message-ID: References: <20210425135546.57343-1-tomasz.duszynski@octakon.com> <20210425135546.57343-2-tomasz.duszynski@octakon.com> <38d5438d-7e00-ed5d-ed33-01ff04e26f33@metafoo.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline In-Reply-To: <38d5438d-7e00-ed5d-ed33-01ff04e26f33@metafoo.de> X-Originating-IP: [89.70.221.198] X-ClientProxiedBy: DAG4EX1.emp2.local (172.16.2.31) To DAG2EX1.emp2.local (172.16.2.11) X-Ovh-Tracer-Id: 10555030155743353940 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduledrvddukedgvdeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhepfffhvffukfhfgggtuggjihesthdtredttddtjeenucfhrhhomhepvfhomhgrshiiucffuhhsiiihnhhskhhiuceothhomhgrshiirdguuhhsiiihnhhskhhisehotghtrghkohhnrdgtohhmqeenucggtffrrghtthgvrhhnpedtheevtefhffduteejfedtkeeuheejgeejvdetfffgveekffefgeffueeghefgjeenucfkpheptddrtddrtddrtddpkeelrdejtddrvddvuddrudelkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhhouggvpehsmhhtphdqohhuthdphhgvlhhopehprhhovddrmhgrihhlrdhovhhhrdhnvghtpdhinhgvtheptddrtddrtddrtddpmhgrihhlfhhrohhmpehtohhmrghsiidrughushiihihnshhkihesohgtthgrkhhonhdrtghomhdprhgtphhtthhopehrohgshhdoughtsehkvghrnhgvlhdrohhrgh Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Apr 25, 2021 at 05:16:14PM +0200, Lars-Peter Clausen wrote: > On 4/25/21 3:55 PM, Tomasz Duszynski wrote: > > Move code responsible for handling i2c communication to a separate file. > > Rationale for this change is preparation for adding support for serial > > communication. > > > > Signed-off-by: Tomasz Duszynski > > Hi, > > The whole series looks really great. Couple of small comments inline. > > > [...] > > diff --git a/drivers/iio/chemical/Kconfig b/drivers/iio/chemical/Kconfig > > index 10bb431bc3ce..82af5f62fbc6 100644 > > --- a/drivers/iio/chemical/Kconfig > > +++ b/drivers/iio/chemical/Kconfig > > @@ -133,8 +133,6 @@ config SENSIRION_SGP30 > > config SPS30 > > tristate "SPS30 particulate matter sensor" > > - depends on I2C > > - select CRC8 > > select IIO_BUFFER > > select IIO_TRIGGERED_BUFFER > > help > > @@ -144,6 +142,17 @@ config SPS30 > > To compile this driver as a module, choose M here: the module will > > be called sps30. > > +config SPS30_I2C > > + tristate "SPS30 particulate matter sensor I2C driver" > > + depends on SPS30 && I2C > > + select CRC8 > Since the base module is not very useful without any of the drivers enabled, > what you can do here is, make the base module non-user-selectable, e.g. > remove the description text after the tristate and then do a `select SPS30` > both here from he I2C module and the serial module. Right. Current form was helpful in debugging and eventually I forgot to change it to something reasonable. Thanks for catching this. > > + help > > + Say Y here to build support for the Sensirion SPS30 I2C interface > > + driver. > > + > > + To compile this driver as a module, choose M here: the module will > > + be called sps30_i2c. > > + > > config VZ89X > > tristate "SGX Sensortech MiCS VZ89X VOC sensor" > > depends on I2C > > diff --git a/drivers/iio/chemical/Makefile b/drivers/iio/chemical/Makefile > > index fef63dd5bf92..41c264a229c0 100644 > > --- a/drivers/iio/chemical/Makefile > > +++ b/drivers/iio/chemical/Makefile > > @@ -17,4 +17,5 @@ obj-$(CONFIG_SCD30_I2C) += scd30_i2c.o > > obj-$(CONFIG_SCD30_SERIAL) += scd30_serial.o > > obj-$(CONFIG_SENSIRION_SGP30) += sgp30.o > > obj-$(CONFIG_SPS30) += sps30.o > > +obj-$(CONFIG_SPS30_I2C) += sps30_i2c.o > > obj-$(CONFIG_VZ89X) += vz89x.o > > diff --git a/drivers/iio/chemical/sps30.c b/drivers/iio/chemical/sps30.c > > index 7486591588c3..ec9db99e324c 100644 > > --- a/drivers/iio/chemical/sps30.c > > +++ b/drivers/iio/chemical/sps30.c > > [...] > > +EXPORT_SYMBOL(sps30_probe); > EXPORT_SYMBOL_GPL() Ack. > > MODULE_AUTHOR("Tomasz Duszynski "); > > MODULE_DESCRIPTION("Sensirion SPS30 particulate matter sensor driver"); > > diff --git a/drivers/iio/chemical/sps30.h b/drivers/iio/chemical/sps30.h > > new file mode 100644 > > index 000000000000..d2b7140fdeb4 > > --- /dev/null > > +++ b/drivers/iio/chemical/sps30.h > > @@ -0,0 +1,73 @@ > > +/* SPDX-License-Identifier: GPL-2.0 */ > > +#ifndef _SPS30_H > > +#define _SPS30_H > > + > > +struct sps30_state; > > +struct sps30_ops { > > + int (*start_meas)(struct sps30_state *state); > > + int (*stop_meas)(struct sps30_state *state); > > + int (*read_meas)(struct sps30_state *state, int *meas, int num); > > + int (*reset)(struct sps30_state *state); > > + int (*clean_fan)(struct sps30_state *state); > > + int (*read_cleaning_period)(struct sps30_state *state, int *period); > > + int (*write_cleaning_period)(struct sps30_state *state, int period); > > The interface for {read,write}_cleaning_period() should use __be32, since > that is what is being passed around. > > I was a bit confused when reviewing the uart driver why we can just memcpy > an int into the output buffer without endianess problems. > Agree that indeed might be confusing at first read since as you said all endianess conversions are handled in core and other components just take everything verbatim - which isn't that obvious. > > + int (*show_info)(struct sps30_state *state); > > +}; > > + > [...]