Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1028984lqh; Sun, 5 May 2024 12:35:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUb0UJsZwvvNm94hqM5vofDIvj3cmobSoy3ay6MssoPIlylP+kz/L2tRmcwiMjQo2mJom+pKVwwPxQzDjr7QGG2fzDtQ9FNCsn4CerL+w== X-Google-Smtp-Source: AGHT+IE8+aEbHqidengmZ7jQDyMWDFszEi4kCNwNTbgdLou6/ryB/4RUSbsB/dLnnucHsQkvfUdk X-Received: by 2002:a50:baa4:0:b0:572:a7fb:b6ad with SMTP id x33-20020a50baa4000000b00572a7fbb6admr5937656ede.5.1714937718651; Sun, 05 May 2024 12:35:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714937718; cv=pass; d=google.com; s=arc-20160816; b=GYTCef3AQa6ltBUcrAGFPZAsjbV6Kq6aNji7R+Nxe/s1RaOUtANWM93a2E5Ye2STAy iszi3LMMXxDuX9e6f9z3T//DoJvgmLH6lVPaOurtYGrIeTqUgvnIkds9tiiM4VjgNeaa IOJePaJ1Bz5kwR1n2efXCEdyRH8YDSgk8sLBqC6V3CVu11ShunrSIDdX+SELfvfmslw/ vvKzIDIqpStWcxh1kyY0PpdSFwiNO8o4+X02rEJAsRPJQa88anxvWPJsiKLj8tbXCJxn b9ZsH1l7/+QQz4B/3dKbAo5Is8RI3ndez5FBGVPv4uYcoTHRSfKqMg9ehl6e4tTI3CE7 LPiA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=24CiFrjHuHWprJagl9/lvBmJBTPob2QAmfxZ4S0DGUA=; fh=ULxNTxaaQIEX8Y9ih2rqqI9Lxn2bbvdaV8tkS1+QGD8=; b=R502R8+Kbfsuymh/9mVGeC0Fdf/YyJ9PkLEBKyJE9CZjPcSgbE6lSvv2hJH4e8m5BB BdfSdzkzgfxtAzzU/44elDHJJbfRi0JlyXx5bFpgPDKslzky/NfbdSGKNChRzGqr5lWi h9mRNTgZjT9WKbX1vOHkCN/21NNBT/UchgJiFxNWfJEM7HbFtS7LRenx8XYWJ64shqoq r4c9Ds33lmkhDu2CcSvZdZ312TKVxDnDG4kYceTFeuP6P7IydB+6kTNrB9mN2NFURP6Q UGupFG1HAC/KKDBnrpWk+qO0B1Q5qRE7nJj4Yv6tLtUlBlvkpzf4svrP/jriMMuR3D0f JPog==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dsTvxLrC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-169113-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169113-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id d11-20020aa7ce0b000000b00572aa510431si3988682edv.55.2024.05.05.12.35.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 May 2024 12:35:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169113-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dsTvxLrC; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-169113-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169113-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 630C41F217FD for ; Sun, 5 May 2024 19:35:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CCE576EB4A; Sun, 5 May 2024 19:35:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dsTvxLrC" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EFF76E54C; Sun, 5 May 2024 19:35:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714937711; cv=none; b=hgTTMuz2czw4HpO13c+kLbkvHUH1Fyj+XWHnvheJPrws755fnge8iCuCha3AQJgdszoIxMwF8UcRfR8el8yIfTfZBBfoYpqoD3BVPrw8km1xIKOBd+MTsBeYXiQplWCQUuXDNEMA18tR+FWics3UUlGKDVh4ElzbUrWjo0u2Cjs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714937711; c=relaxed/simple; bh=VkxMDtsny24XcJVYTcFBblK3g3hI+2cPLXzaBz3PeGE=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HiojWiuM0DhAAHBzu6TJXdTaALH3v0UfjQ0zBpzIrU5FnhDw83H20a/w4CO0j3iYeuW/zcSy3zZKkrxDrGJNgpRsWiZfqjZxtoYqkjqtsuxNVXGiemMUjWJawcKcy5WYetUlnTyqj+dTKGsN+KV7b77uMPV5I3Sx3w6xnbVB8K0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dsTvxLrC; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44587C113CC; Sun, 5 May 2024 19:35:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714937709; bh=VkxMDtsny24XcJVYTcFBblK3g3hI+2cPLXzaBz3PeGE=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=dsTvxLrCKnhUIzmfWZOGyRXiMXsggzwEaXK+xm+fXGCrvZ+MlTfjqpgZgw3O7a041 fl48q+3ST+nwbK38xAELnKKr2CkTxL05jns8yHcIuX98f2d5qp6hDT8WavsK4OBQAf M3uhe9pjVCnhgMB8NPt5ahGyWYWh6Ll5yfLO4QbIijH4CFA2OnFlsV7IT9IBMcCZsr FH4RlpTUNhqwcoCgldx6gYflTKVWT65AdH8J2mwqEAC5pSxrZOPT4Rr2qPRebfHu3b q+T/9kA3ls5YV9qVkyfhGoaRLW7FCkEEcXyohcrBUXWMLyGD6r8R6MSUPBGddd62AE 3Jpd4gQetL6xA== Date: Sun, 5 May 2024 20:34:56 +0100 From: Jonathan Cameron To: Vasileios Amoiridis Cc: lars@metafoo.de, andriy.shevchenko@linux.intel.com, ang.iglesiasg@gmail.com, mazziesaccount@gmail.com, ak@it-klinger.de, petre.rodan@subdimension.ro, phil@raspberrypi.com, 579lpy@gmail.com, linus.walleij@linaro.org, semen.protsenko@linaro.org, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 10/10] iio: pressure: bmp280: Add triggered buffer support Message-ID: <20240505203456.0c4c0c90@jic23-huawei> In-Reply-To: <20240429190046.24252-11-vassilisamir@gmail.com> References: <20240429190046.24252-1-vassilisamir@gmail.com> <20240429190046.24252-11-vassilisamir@gmail.com> X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Mon, 29 Apr 2024 21:00:46 +0200 Vasileios Amoiridis wrote: > BMP2xx, BME280, BMP3xx, and BMP5xx use continuous buffers for their > temperature, pressure and humidity readings. This facilitates the > use of burst/bulk reads in order to acquire data faster. The > approach is different from the one used in oneshot captures. > > BMP085 & BMP1xx devices use a completely different measurement > process that is well defined and is used in their buffer_handler(). > > Suggested-by: Angel Iglesias > Signed-off-by: Vasileios Amoiridis Hi Vasileois, Just one question on this inline. (patches 8 and 9 look good to me) For v6, only need to send the patches that I haven't already applied. Thanks, Jonathan > > +static irqreturn_t bmp180_buffer_handler(int irq, void *p) > +{ > + struct iio_poll_func *pf = p; > + struct iio_dev *indio_dev = pf->indio_dev; > + struct bmp280_data *data = iio_priv(indio_dev); > + int ret, chan_value; > + > + guard(mutex)(&data->lock); > + > + ret = bmp180_read_temp(data, &chan_value); > + if (ret < 0) > + return IRQ_HANDLED; > + > + data->sensor_data[1] = chan_value; > + > + ret = bmp180_read_press(data, &chan_value); So I 'think' that after all the refactoring you end up reading the temperature twice. To avoid that you need to pull the read_temp() and read_press() function implementations here and only do the (currently duplicated) steps once. You seem to have done this for the other case, but missed the bmp180? Maybe I'm missing some reason it doesn't work for this one! > + if (ret < 0) > + return IRQ_HANDLED; > + > + data->sensor_data[0] = chan_value; > + > + iio_push_to_buffers_with_timestamp(indio_dev, &data->sensor_data, > + iio_get_time_ns(indio_dev)); > + > + iio_trigger_notify_done(indio_dev->trig); > + > + return IRQ_HANDLED; > +}