Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp1590099rdb; Sat, 10 Feb 2024 08:11:37 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV437xpTk8IQaeAxlpNazcjSet7pz5l8+PA38GF3HXhrHREuJ1unjqV2Q2k5TdA30MLejPf4yOWfQrcM5UAwjCDBpHGG48O0to5YNMI2A== X-Google-Smtp-Source: AGHT+IHRqQHfziG4djc+5fLLY6LTtdA480XjgDSsxkxRyYLZsaFXDi4rMeBlyh0WPEhqZ4r0ppa0 X-Received: by 2002:a05:622a:13d2:b0:42c:6103:13bc with SMTP id p18-20020a05622a13d200b0042c610313bcmr3213925qtk.38.1707581497638; Sat, 10 Feb 2024 08:11:37 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707581497; cv=pass; d=google.com; s=arc-20160816; b=gme7Vw7uAvNJ/HoBptWvYp2U/O/KGQq/3LApavMezg9/xgHvBoZEXH7qCE1xEHZzkJ 2xaJrwyTi0onxBXehyk1ElFfMY4t+Y63pSqIUe82/YfR9l885F2HcyEaYM62/Tt3y9I4 pOdkYet4VLdSn9iP/SiksXiExzPTf3gB5XFzl2Fz7gNaRVHKUXdWSIE7N7FKRZ0yR+/y jQvS0gE+xQkRQH3oL+L422GZ/Frtdrxsj7AeyLlEpoaLU3CeWMnJCbeQ1t4JU8IH9gkr ImC+rOHa+2KWrmdmRy/t2Ou4Bd5uuQebex61WjQWSM/ocrWZ4jH82svWQtskle7hbnaC PAew== 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=Mlor1mmvpMqI9E6x+U9JgFOSo56cVrWqmAjeIC512Vg=; fh=aHkE3oJSPufEFPQE+KsoTDaTXRg0lgtADHhhidP2HmE=; b=zgz45tztyNwq+LjzSj+kqH6kHXeSblWEWOuKKLHWhNE1QlfQeqiKa6bUwp/0tBT4Ue oqp4ZNLiMVT9BGkjNYDme+FU10gGiuAOE+ASSqBrcTQYIwlaOuZnLmgD1lyCSMK7e4b/ io+cspsFjMBUs6v1IpLGQIYPjqCKFbJ1NEVIs0EzvJUfO5HJSjO4CH3jVckDB4MDLHvR 1JP4IyY2yVhCK5J0B2YmXGCRfy6YCFVZyYA9xr9R+qrS2JjG5dNAFVDpvHbWSMnTK3I2 XouLLxid++ZA5LZJzUUv8hgfZzpIdRxj1ln659bI3waDsvEewYC9EqpFyPe6xEDVjPGm 9mUg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CKZCwunw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-60446-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60446-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=2; AJvYcCUTZdi20wL22bCSM0sxIrnXLg1jWtZfDzl8VtMnkCmbtAXW4omHwvB/TZ9PHBqEH0VgwDRuORxUHtPFRwNXSoxIjDSTUJgKGH/BHBHsRg== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h18-20020ac87d52000000b0042c3846d27dsi4591016qtb.166.2024.02.10.08.11.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Feb 2024 08:11:37 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-60446-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=CKZCwunw; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-60446-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-60446-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 6759C1C2122E for ; Sat, 10 Feb 2024 16:11:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 35E1E5C5E3; Sat, 10 Feb 2024 16:11:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="CKZCwunw" 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 5F71936AFB; Sat, 10 Feb 2024 16:11:30 +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=1707581490; cv=none; b=HSW5gHpGi55W6gOhWyHHxDvRixyoexyProHc4P8EzSvLRHwNVjyjdAGuycFrgZ8W2i87didZfxXhXjKK8v63jTo9gspaAAth+B7TICDozJgEc+wMZB3/IHrr2qhKTQrpZj3BbTA1x3lyh0+6I1M4gK0Q09Z1C++P5DBIu+Qn0PU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707581490; c=relaxed/simple; bh=54etm7OxNpF3pRXei+kIb6Yk6RYbXbxS/ugDHuCmZoQ=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=T6/IQsVcyxB7vMkTO7TY4c9y3IPQkmhAxmIU/ecObgFQL+q4m5wSmhp1KbBAHUZrvUQyXFUnY99uGfxH6HBdVOaRnAyv2TciPUn6LqE4hVMa8rpFHxVHJ8O5WaePME1uhPssGY5/rhxNSN+i0yCZYSsYsvdBR7OpsM9u9xBfv4E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CKZCwunw; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E9E63C433F1; Sat, 10 Feb 2024 16:11:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707581489; bh=54etm7OxNpF3pRXei+kIb6Yk6RYbXbxS/ugDHuCmZoQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=CKZCwunw2bFQPUOHKK4gMoee1PtbuhuPd/+hRKGkyQdgRpNA+rxImBqaXRu6B24Uj xiDQN5re3AtXmS3FFf3XFJ3DzmGuPt83kOaaKUIHu4wtwWVXtGMDj5Z8gwyhrDNJcS k+bwf74gXwwzdhJ+CqF9XSW3TQT+Z/glHt4pgdt1gaYI239Xw3n5l9xZt+rdUeBpzM V0ely5wqeHWAzxOyxINc/kOuA/yzYyDUDkPt7tc7oEZDhDtw6jb+Z9ZokxJgPFIDWJ eSj8/F4QrAwZQM1UPkcwVf4FU8DCivhDUCXZNP9liTr00YRRNmUd7Rvt0JtqO2m/wW yn/0eW7en1nHA== Date: Sat, 10 Feb 2024 16:11:17 +0000 From: Jonathan Cameron To: Dimitri Fedrau Cc: Jonathan Cameron , Javier Carrasco , Li peiyu <579lpy@gmail.com>, Lars-Peter Clausen , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] iio: humidity: hdc3020: add threshold events support Message-ID: <20240210161117.1bb3dd7f@jic23-huawei> In-Reply-To: <20240205095323.GA2323766@debian> References: <20240204103710.19212-1-dima.fedrau@gmail.com> <20240204144347.7f0eb822@jic23-huawei> <20240205070421.GA2264419@debian> <20240205093349.00003e10@Huawei.com> <20240205095323.GA2323766@debian> 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 > > > > > > > As I mention below, I'm unconvinced that it makes sense to handle > > > > these as pairs. > > > > > > > For the threshold I could convert it as it is for the heater registers: > > > > > > #define HDC3020_S_T_RH_THRESH_MSB 0x61 > > > #define HDC3020_S_T_RH_THRESH_LOW 0x00 > > > #define HDC3020_S_T_RH_THRESH_LOW_CLR 0x0B > > > #define HDC3020_S_T_RH_THRESH_HIGH_CLR 0x16 > > > #define HDC3020_S_T_RH_THRESH_HIGH 0x1D > > > > > > #define HDC3020_R_T_RH_THRESH_MSB 0xE1 > > > #define HDC3020_R_T_RH_THRESH_LOW 0x02 > > > #define HDC3020_R_T_RH_THRESH_LOW_CLR 0x09 > > > #define HDC3020_R_T_RH_THRESH_HIGH_CLR 0x14 > > > #define HDC3020_R_T_RH_THRESH_HIGH 0x1F > > > > > > or: > > > > > > #define HDC3020_S_T_RH_THRESH_LOW 0x6100 > > > #define HDC3020_S_T_RH_THRESH_LOW_CLR 0x610B > > > #define HDC3020_S_T_RH_THRESH_HIGH_CLR 0x6116 > > > #define HDC3020_S_T_RH_THRESH_HIGH 0x611D > > > > > > #define HDC3020_R_T_RH_THRESH_LOW 0x6102 > > > #define HDC3020_R_T_RH_THRESH_LOW_CLR 0x6109 > > > #define HDC3020_R_T_RH_THRESH_HIGH_CLR 0x6114 > > > #define HDC3020_R_T_RH_THRESH_HIGH 0x611F > > > > > > I don't know if it's a good idea, as we would need to make sure it is > > > big endian in the buffer. Probably with a function that handles this. > > I think this is the best plan with a > > put_unaligned_be16() to deal with the endianness. > > The compiler should be able to optimize that heavily. > > > I think that would require some refactoring. I would add patches that > are fixing this. Have there been reasons for using the pairs ? I'm just > curious. Not that I can think of. Maybe how they are represented on the dataheet? Often people just copy that stuff without thinking about it (I know I've been guilty of this ;) Jonathan