[1/2] hwmon: (aquacomputer_d5next) Check if temp sensors of legacy devices are connected
Message ID | 20231016083559.139341-2-savicaleksa83@gmail.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:2908:b0:403:3b70:6f57 with SMTP id ib8csp3318323vqb; Mon, 16 Oct 2023 01:38:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFHHwgq5AEWdLCTSRAdWH8OLwfGfGf/xjygnrqkGbBAm7UK/tsD2uK/J/j9TJhmfaXr+n2s X-Received: by 2002:a05:6808:13c5:b0:3ae:24bb:381a with SMTP id d5-20020a05680813c500b003ae24bb381amr37632017oiw.3.1697445536779; Mon, 16 Oct 2023 01:38:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697445536; cv=none; d=google.com; s=arc-20160816; b=vJHydkkNOtccQRJLDPXUBaTx6L5N4KENUH6bhs/KAXa3op7NqjYvGAp1t2TPg9CwfF 4mK1ECTAQPdvTvTroRr3Cgz8FllN//HVqRgXHabreRWsWWwIJNqjcUv+lWKVBytZYN1E JfRu/OkfTWMfwXHD3sAAjZT+7xGkvGeVZ9mNdrIP3/i2WhPjqzs9wn8b13l1Q6AmPYIG 5v5LyeSNAQ84EwZOV5l7+aWyYWfypQtQ/O7hAKXKsWA2sbrQb+86WYg63hsKhZ9pIXWq gCvYQ34+EmoAjzGb/E6H/lfO8o9SocBkQr1K+V9x/AEdGaD7MfWtX6P9LNLHErHa0tPj pIug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uLWwUsKeJ2H5tqYiWTlrMLno6gfKUXxQsmHCjrzmZcs=; fh=jVfC5y9HvxUpPXsjgEUzN6Gy1m3u5D6D9dKX/OObWJE=; b=MTfz6XK3ZjvKbyjVLZguO1NQwPn0RcOLolp+sHlsyCEoQ92W8Eq8kDPdLjE6MUBIs1 no6FG67/1TM+Xg05XqpqupFuwGLig2D5W/xE2gG8BInpSdEfCd7FzvWuMpo3mTqPNRm9 h+FRD5Muif/Hpx9pjN+ctlwcY8gpiBWGCJZ90EhZ5HVcPe4mmnvDszSkYXMaZiyzKaCN 3n8M9wv/4q+aaYuzpRv+XyBl7yIj170+MfY95v2rgJr+D/1xVP9aF67r7orpvZ/8EK8d Dps2Pf0Ec98/wlNBLPvspnr019jj5y6ZHaK0oI3pjcwzWf3JZf6YH5VSft4gj1Dpoixv 33TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Bb9oERYk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id i131-20020a636d89000000b005aaaedab29fsi7206608pgc.190.2023.10.16.01.38.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 01:38:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Bb9oERYk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 1D047805259C; Mon, 16 Oct 2023 01:38:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232266AbjJPIiZ (ORCPT <rfc822;hjfbswb@gmail.com> + 18 others); Mon, 16 Oct 2023 04:38:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232087AbjJPIiU (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 16 Oct 2023 04:38:20 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47AD8DC; Mon, 16 Oct 2023 01:38:18 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40651a72807so40696495e9.1; Mon, 16 Oct 2023 01:38:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697445496; x=1698050296; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=uLWwUsKeJ2H5tqYiWTlrMLno6gfKUXxQsmHCjrzmZcs=; b=Bb9oERYk9qVUBsFJrz7IiRKMATCNzokIXXJr/gtVkOsoLl00sLmva8QQYXY79EWkTK Fe2akupNvDf3taw6zjpweUx0rsxZ0qEBYB3ywosoWy3YZ4PHuTEkSmxagmBdGITTMn0s ++h8PDTh5mQc/U6Owu/TlQvYdAd27AFznef0BLP9HcbBZjGWs9XoIRwPs6EwvXs0v8bV zoQ03ajGESiw8TmaRGkQWM0uoysJhBG82A4DraPvaCifsHTtBRQcUDXBNjhJf8QFPpve JmW8s/+zs+/wmedBfmeuMkVSJTKcQbtNC69FGziJGycHHVVXIdCwzGFCTSyu8HXcGa+y F9VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697445496; x=1698050296; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=uLWwUsKeJ2H5tqYiWTlrMLno6gfKUXxQsmHCjrzmZcs=; b=KyFqdM6KQsOV0ar5f5loXuDHFxoG2/tmqvtyDHjlexTy5qAJZElm0KEu0pvEkYMGF0 qTxGkQ0Kulyb2KgiyjbCqq0CkAwGj0pQyUnidgTfvPWi/MnSnvSGwI/NtqSKxKYU7tsC zOvhndjVIbmIazef0DGkCTJsxnbMckvjpUyn3ZRGWzIUJQSBWypKRjvHC7XEBiNfcEKq dIEyh9JiqHEU1let78JtRKPpdtPIkE776FK+eo8xEbqjKXm8sKIVu4d6K8/2Ry4nE7js iYvbD1SSvmCucG++LYFHfqXBiNHGkW83sWgshHO5VF8w18MQYEcfh4AV9E1P4uayH2lr GExQ== X-Gm-Message-State: AOJu0YztjPxtLrOGqlm+7DFgOmE+gEWVbUzevieqM134NNIZ/n59e4wR 3RIDEzAXF0WKPF/YHXR/vDmdUfmNPYy8yA== X-Received: by 2002:a7b:c387:0:b0:3f9:b430:199b with SMTP id s7-20020a7bc387000000b003f9b430199bmr28779907wmj.15.1697445496139; Mon, 16 Oct 2023 01:38:16 -0700 (PDT) Received: from fedora.. (cable-178-148-234-71.dynamic.sbb.rs. [178.148.234.71]) by smtp.gmail.com with ESMTPSA id p20-20020a05600c469400b004067e905f44sm6633554wmo.9.2023.10.16.01.38.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 01:38:15 -0700 (PDT) From: Aleksa Savic <savicaleksa83@gmail.com> To: linux-hwmon@vger.kernel.org Cc: leonard.anderweit@gmail.com, Aleksa Savic <savicaleksa83@gmail.com>, Jack Doan <me@jackdoan.com>, Jean Delvare <jdelvare@suse.com>, Guenter Roeck <linux@roeck-us.net>, Jonathan Corbet <corbet@lwn.net>, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] hwmon: (aquacomputer_d5next) Check if temp sensors of legacy devices are connected Date: Mon, 16 Oct 2023 10:35:57 +0200 Message-ID: <20231016083559.139341-2-savicaleksa83@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231016083559.139341-1-savicaleksa83@gmail.com> References: <20231016083559.139341-1-savicaleksa83@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 16 Oct 2023 01:38:52 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779900650804946559 X-GMAIL-MSGID: 1779900650804946559 |
Series |
hwmon: (aquacomputer_d5next) Add support for Aquacomputer High Flow USB and MPS Flow
|
|
Commit Message
Aleksa Savic
Oct. 16, 2023, 8:35 a.m. UTC
Return -ENODATA if a temp sensor of a legacy device
does not contain a reading.
Originally-from: Leonard Anderweit <leonard.anderweit@gmail.com>
Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com>
---
drivers/hwmon/aquacomputer_d5next.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Comments
On Mon, Oct 16, 2023 at 10:35:57AM +0200, Aleksa Savic wrote: > Return -ENODATA if a temp sensor of a legacy device > does not contain a reading. > Why is the sensor instantiated in the first place ? Returning -ENODATA for every reading is not desirable. If this can happen, the is_visible function should check for it and skip affected sensors. Guenter > Originally-from: Leonard Anderweit <leonard.anderweit@gmail.com> > Signed-off-by: Aleksa Savic <savicaleksa83@gmail.com> > --- > drivers/hwmon/aquacomputer_d5next.c | 5 ++++- > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/hwmon/aquacomputer_d5next.c b/drivers/hwmon/aquacomputer_d5next.c > index 023807859be7..46ff4fd4f87d 100644 > --- a/drivers/hwmon/aquacomputer_d5next.c > +++ b/drivers/hwmon/aquacomputer_d5next.c > @@ -926,7 +926,10 @@ static int aqc_legacy_read(struct aqc_data *priv) > for (i = 0; i < priv->num_temp_sensors; i++) { > sensor_value = get_unaligned_le16(priv->buffer + priv->temp_sensor_start_offset + > i * AQC_SENSOR_SIZE); > - priv->temp_input[i] = sensor_value * 10; > + if (sensor_value == AQC_SENSOR_NA) > + priv->temp_input[i] = -ENODATA; > + else > + priv->temp_input[i] = sensor_value * 10; > } > > /* Special-case sensor readings */
On 2023-10-25 21:41:00 GMT+02:00, Guenter Roeck wrote: > > Why is the sensor instantiated in the first place ? > Returning -ENODATA for every reading is not desirable. > If this can happen, the is_visible function should check > for it and skip affected sensors. > > Guenter > The external temp sensor(s) are hot-swappable and can be plugged or unplugged anytime. Similar logic already exists in aqc_raw_event() for the sensors. Thanks, Aleksa
diff --git a/drivers/hwmon/aquacomputer_d5next.c b/drivers/hwmon/aquacomputer_d5next.c index 023807859be7..46ff4fd4f87d 100644 --- a/drivers/hwmon/aquacomputer_d5next.c +++ b/drivers/hwmon/aquacomputer_d5next.c @@ -926,7 +926,10 @@ static int aqc_legacy_read(struct aqc_data *priv) for (i = 0; i < priv->num_temp_sensors; i++) { sensor_value = get_unaligned_le16(priv->buffer + priv->temp_sensor_start_offset + i * AQC_SENSOR_SIZE); - priv->temp_input[i] = sensor_value * 10; + if (sensor_value == AQC_SENSOR_NA) + priv->temp_input[i] = -ENODATA; + else + priv->temp_input[i] = sensor_value * 10; } /* Special-case sensor readings */