From patchwork Wed Jan 10 17:22:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Petre Rodan X-Patchwork-Id: 186956 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:2411:b0:101:2151:f287 with SMTP id m17csp937391dyi; Wed, 10 Jan 2024 09:24:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IGpXwQ2mJvvxwfRXK1plE9UCijZzgpI6W5FqjaaaJnYBsbnhnSB0H1BuIvWZcQFnOQhYQeB X-Received: by 2002:a05:6a00:2d2a:b0:6d9:8453:1b55 with SMTP id fa42-20020a056a002d2a00b006d984531b55mr1661134pfb.0.1704907460666; Wed, 10 Jan 2024 09:24:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704907460; cv=none; d=google.com; s=arc-20160816; b=HQ+clPHEyWPyVoGlrQhgVALFranki77WRj3y94mwMqjftDwoOjxVIS3g3VUxstdfoM dtJN1z2J+5vXpWCPpkGZVIQeDnQhLU/wQdou6OICMmpjQ3PtkVbfHIZjEnD75r8vEFI9 NQOuC84Gm+4CY4z8Hc8uM4VfNdksBB73XpwynIDbsDKyjmJbtUB+R1yaedB6/Yo1qYmc zCwToMsLl8UUx50fg3CEMfqx+3KFd42/RXOsuvOemBkMTNNHWs5lzqPtAkPB8Fjgx42n mZ3R9VI2Y3CLdlysWOzLxfMJExRF1TQRrBAhbDQZP/sovWcdqyULYn9BUxq/+Pej0Vpl Wgkw== ARC-Message-Signature: i=1; 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 :date:subject:cc:to:from:dkim-signature; bh=yJ4L7DIDo5l8F6M5ECy3IgIJ/rr20wjKxds3USWhRi4=; fh=RpJjGiuDlOjmyoLhPwSzjbPbeK51vYo3I0V3BuRLNmU=; b=RsupCUh8YE8pnxqc7cU/gpCrsw7OAr6hy2CjE9t9aGebLF9KHHnGPmvXNcaui3nbbU DXRj6lhgL8z0L4dnjGh2u5YpEz+7yPBnLx47Lw0LxMvXwhH6iqm0UM/v1I9ndLSvpDvm J46WPD4V/1SElKdCOfZNMbykOAzzCzZrEgYbbovAUDaCsQesZ+JCyplhtj+zJm07wl+b kYDXMJS+jwqxvnOPpKzc1udND5W6nicrOAp6MgaobmCDYm3syXgBV3cNpvPYZ2CLEZYb H3r4u8Ty6NCz+V2OlW6guC7SGRhnjb3EL2Z4Pv8J3vhiEYL+IJ16YLJS7HGzojGRzBNg FYew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=QXRUqKUM; spf=pass (google.com: domain of linux-kernel+bounces-22523-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22523-ouuuleilei=gmail.com@vger.kernel.org" Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id cz3-20020aa79303000000b006da8b3df0desi4049155pfb.359.2024.01.10.09.24.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 09:24:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22523-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@subdimension.ro header.s=skycaves header.b=QXRUqKUM; spf=pass (google.com: domain of linux-kernel+bounces-22523-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22523-ouuuleilei=gmail.com@vger.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 7262328314B for ; Wed, 10 Jan 2024 17:24:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D55B14D5BA; Wed, 10 Jan 2024 17:23:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=subdimension.ro header.i=@subdimension.ro header.b="QXRUqKUM" Received: from mail.subdimension.ro (skycaves.subdimension.ro [172.104.132.142]) (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 78A6E4D100; Wed, 10 Jan 2024 17:23:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=subdimension.ro Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=subdimension.ro Received: from localhost.localdomain (unknown [188.24.94.216]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mail.subdimension.ro (Postfix) with ESMTPSA id 73A052997CD; Wed, 10 Jan 2024 17:23:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=subdimension.ro; s=skycaves; t=1704907393; bh=zZSi6xnStqinb9unKQaoLA9OH8LjSeJ51f1fcYz+zOQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=QXRUqKUMozz/FzNQ318X/xtt3o3MhygrvIzU4myhRfdf/Hj71wKILBz3s+lldDybh Tk3Gc2TWNVezvEzvaeFVIuuPKMjMiapP+IkZ/c20Ou/3Zr6YrSaFLYGDLguZm0QPV6 accir+3Ryq41R3RPYy/5ttjrZYNgT7AhKq9raZWQ= From: Petre Rodan To: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Petre Rodan , Jonathan Cameron , Lars-Peter Clausen Subject: [PATCH 3/6] iio: pressure: hsc030pa cleanup Date: Wed, 10 Jan 2024 19:22:38 +0200 Message-ID: <20240110172306.31273-4-petre.rodan@subdimension.ro> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20240110172306.31273-1-petre.rodan@subdimension.ro> References: <20240110172306.31273-1-petre.rodan@subdimension.ro> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787725045502896678 X-GMAIL-MSGID: 1787725045502896678 Use signed type to variable holding the result given by div_s64(). Add includes based on prior reviews from Andy. Provide bus-specific technical datasheet in the _i2c.c _spi.c headers instead of the generic one. Signed-off-by: Petre Rodan --- drivers/iio/pressure/hsc030pa.c | 2 +- drivers/iio/pressure/hsc030pa.h | 2 ++ drivers/iio/pressure/hsc030pa_i2c.c | 6 ++++-- drivers/iio/pressure/hsc030pa_spi.c | 5 ++++- 4 files changed, 11 insertions(+), 4 deletions(-) -- 2.41.0 diff --git a/drivers/iio/pressure/hsc030pa.c b/drivers/iio/pressure/hsc030pa.c index d6a51f0c335f..7e3f74d53b47 100644 --- a/drivers/iio/pressure/hsc030pa.c +++ b/drivers/iio/pressure/hsc030pa.c @@ -406,7 +406,7 @@ int hsc_common_probe(struct device *dev, hsc_recv_fn recv) struct hsc_data *hsc; struct iio_dev *indio_dev; const char *triplet; - u64 tmp; + s64 tmp; int ret; indio_dev = devm_iio_device_alloc(dev, sizeof(*hsc)); diff --git a/drivers/iio/pressure/hsc030pa.h b/drivers/iio/pressure/hsc030pa.h index d20420dba4f6..f1079a70799f 100644 --- a/drivers/iio/pressure/hsc030pa.h +++ b/drivers/iio/pressure/hsc030pa.h @@ -10,6 +10,8 @@ #include +#include + #define HSC_REG_MEASUREMENT_RD_SIZE 4 struct device; diff --git a/drivers/iio/pressure/hsc030pa_i2c.c b/drivers/iio/pressure/hsc030pa_i2c.c index e2b524b36417..b5810bafef40 100644 --- a/drivers/iio/pressure/hsc030pa_i2c.c +++ b/drivers/iio/pressure/hsc030pa_i2c.c @@ -4,14 +4,16 @@ * * Copyright (c) 2023 Petre Rodan * - * Datasheet: https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/board-mount-pressure-sensors/trustability-hsc-series/documents/sps-siot-trustability-hsc-series-high-accuracy-board-mount-pressure-sensors-50099148-a-en-ciid-151133.pdf [hsc] - * Datasheet: https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/board-mount-pressure-sensors/common/documents/sps-siot-i2c-comms-digital-output-pressure-sensors-tn-008201-3-en-ciid-45841.pdf [i2c related] + * Datasheet: https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/board-mount-pressure-sensors/common/documents/sps-siot-i2c-comms-digital-output-pressure-sensors-tn-008201-3-en-ciid-45841.pdf + * Datasheet: https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/common/documents/sps-siot-sleep-mode-technical-note-008286-1-en-ciid-155793.pdf */ +#include #include #include #include #include +#include #include diff --git a/drivers/iio/pressure/hsc030pa_spi.c b/drivers/iio/pressure/hsc030pa_spi.c index a719bade8326..8d3441f1dcf9 100644 --- a/drivers/iio/pressure/hsc030pa_spi.c +++ b/drivers/iio/pressure/hsc030pa_spi.c @@ -4,13 +4,16 @@ * * Copyright (c) 2023 Petre Rodan * - * Datasheet: https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/board-mount-pressure-sensors/trustability-hsc-series/documents/sps-siot-trustability-hsc-series-high-accuracy-board-mount-pressure-sensors-50099148-a-en-ciid-151133.pdf + * Datasheet: https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/common/documents/sps-siot-spi-comms-digital-ouptu-pressure-sensors-tn-008202-3-en-ciid-45843.pdf + * Datasheet: https://prod-edam.honeywell.com/content/dam/honeywell-edam/sps/siot/en-us/products/sensors/pressure-sensors/common/documents/sps-siot-sleep-mode-technical-note-008286-1-en-ciid-155793.pdf */ +#include #include #include #include #include +#include #include