Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3001707lqp; Mon, 25 Mar 2024 16:24:27 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWVGiuH31qnfNK3CbtfqGp9qLLGt7U69Udf0EKF/cbHPPW7SRRaVGNz3hEBlvv+HbZR0t7wd35HDYxe+kkrwZe8vmGmzywbNtSIzf9J6A== X-Google-Smtp-Source: AGHT+IH1/S705zDY8szTqSIyozK2IwUpx7+qcwTlxO3PuKrTKMdcVvqV6nU8C7MpxhndGhr0qR+H X-Received: by 2002:a17:90a:6801:b0:2a0:3b1d:7c5 with SMTP id p1-20020a17090a680100b002a03b1d07c5mr10935502pjj.3.1711409067371; Mon, 25 Mar 2024 16:24:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711409067; cv=pass; d=google.com; s=arc-20160816; b=c9dNXFjOcX9FABZyv5VpLKpzRXSEmfgvxeXgoBk0bwa/Ewv4S77g1GhFRrAMN3EHtD /dPJqe/HbqmOmGTRGBSJDDWuI0WdXIf/7eAkXWVEQ9V3yKuwhBQt2e9O2sOnzf0KQULi geMicD+Nm+hC00RzVhgV+sglmK4+yOQyfPwdglE488ZCe1n7T+Zcmf4nH9SlhL6IRIoL wlVrrlGYmuga+fOq63+yVh7Hl/+z0xf5g4AJgNnKb2z4829FsT6iN+o9BeBynojRzMsW ove07MQZvBEhxmHkSXMw1831sAOk8ErNU2TTCaN9Yfyvb2IiPZce8eth+lWBhn5T8HZJ KLOg== 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=XW5sZFci8yo7zpANH8Bw5kH3ZKGtlDSAxg39DA+ZBh8=; fh=nJs2A9xTy9ZoGEMbHAv5KVfqX6L8BbbvlMuN5SmjGPk=; b=n8eTlvjbnDZhBn4wZqWi4X2vSvScxtALxpEsSu96EHr1fiekZyibtNfU7JeNiajUnV u2uE7kTVOPSbtkZ9NFirRFA7GcBeixquySN1T9cK0aoOrB/lWh4sxYvnLuAk9oM1Vtek qYPHgJ6pVO18UEeDPax47XUq8wIldufP1uqnDMrDuZd01I1hXmunJawtzUvrte1pIWDi 0Yqv41B84ai3Ki3yCfVi3DCxHr72S2NjWHIRleTlH2yBJ9hWttsWiJdp4luKs2wf6+Zz 1ssIi0+6Z79We2xlbLXxiU6hO5UzyuiohM5JSTVvoR21XgT8qonNART12GGNoDO4vYrr z2pw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Z1ROJjS2; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-117775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117775-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id gq9-20020a17090b104900b002a049762b98si6325448pjb.157.2024.03.25.16.24.26 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 16:24:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-117775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Z1ROJjS2; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-117775-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-117775-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 150B1B33E9F for ; Mon, 25 Mar 2024 19:11:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0D54E12B6C; Mon, 25 Mar 2024 19:10:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Z1ROJjS2" 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 2233F10940; Mon, 25 Mar 2024 19:10:55 +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=1711393856; cv=none; b=OwioBDKHJfchDZTqzt25utYXXdlCskUwTEmhVDeBRn17wxX2PTahMASFM/7CCh9PcpWZ/Ta22paX2GLCuYUxEMCuSJ8eZ/acB6Kp0s4mpFyuqNjbM+5xMojuh7V6ilJDAwtx64DqsWw+8hehlK3EL2Q/Pd3K1500ZYtGVWuHy58= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711393856; c=relaxed/simple; bh=Acg0P6AHCvwEDQelG6mbWObj6GUgihKlFCeUtBlOkuw=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=V4pEORIWtRrHmxDIkCFpEOSccCtDi+lPsOA5GOQEW8CJCB4l0BFwX/WrCYxWVVgMpDaH7QM2EHHj+Sn+n8IEWQtbzC9CycBj+sg54E3GpKCFdpo5/A4N1zvDvLYrQ1KOsYlIinhojJGFYt6u4rKJPPbFav+B0UPjTc0iz1yjK4Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Z1ROJjS2; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0B701C433F1; Mon, 25 Mar 2024 19:10:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711393855; bh=Acg0P6AHCvwEDQelG6mbWObj6GUgihKlFCeUtBlOkuw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Z1ROJjS2wfitCIoVCEDPjtOEzHQJT0uiW4XAkfhJGVsq0eIJPR3HFqfqxRBSEQQrE ot6UYgldEy44NAtGF25VtzyH+Rp9hr0E1dJwYo7yOHh3qyyKfyl+HIzi4lIKqQdsDk ztNbvHxwbB0f5hvdCfce/KM+gtfpUKuiIYoRSJsRfDaY8aogS/I0KFw2ukxSMrz0cW 5GJ9fSIe3JSyaIK2HTd+8sMZlDq/UB9mmNTtd+obfbhn430C/1XFSpegURmurrM7Ek J9c+YsNRpOq23e6+R1Sa2c/eNd/RqwvFqGaH8q612iyzRASCPzF9Meq1v/ygCadU9M f6ctZt892CJ5Q== Date: Mon, 25 Mar 2024 19:10:43 +0000 From: Jonathan Cameron To: Harald Geyer Cc: George Stark , lars@metafoo.de, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@salutedevices.com Subject: Re: [PATCH] iio: dht11: set debug log level for parsing error messages Message-ID: <20240325191043.4acd6532@jic23-huawei> In-Reply-To: References: <20240325165406.226916-1-gnstark@salutedevices.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=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, 25 Mar 2024 19:48:00 +0100 Harald Geyer wrote: > Hi George! >=20 > I'm torn on this: >=20 > Am Montag, dem 25.03.2024 um 19:54 +0300 schrieb George Stark: > > Protocol parsing errors could happen due to several reasons like > > noise > > environment, heavy load on system etc. If to poll the sensor > > frequently > > and/or for a long period kernel log will become polluted with error > > messages if their log level is err (i.e. on by default). =20 >=20 > Yes, these error are often recoverable. (As are many other HW errors, > that typically are logged. Eg USB bus resets due to EMI) >=20 > However they are still genuine errors of the HW. >=20 > > Also some types > > of those messages already have dbg level so use unified log level for > > all such cases. =20 >=20 > My take so far has been: Debug level messages are for debugging the > code (ie adding/testing support of new device variants etc). Users > aren't expected to know about or enable debug output. OTOH anything > actually going wrong is an error and should be logged as such. >=20 > The idea is, that these messages help users understand issues with > their HW (like too long cables, broken cables etc). But it is true, > that they will slowly accumulate in many real world scenarios without > anything being truly wrong. >=20 > I don't consider the dmesg buffer being rotated after a month or two a > bug. But I suppose this is a corner case. I'll happily accept whatever > Jonathan thinks is reasonable. My take: If the errors are eaten with no user visibility then they should be logged (errors in interrupt handlers etc) but for errors in code that returns an error code to the userspace read or similar there is info that 'something went wrong' available via that then it's fine to use dev_dbg() with expectation anyone who is looking into issues can turn them on. However, I defer to driver maintainers on whether they prefer dev_err() or dev_dbg() for these sorts of cases. Far as I'm concerned either choice is fine and it's a judgement on the expected rates of error and impact. Jonathan >=20 > Best regards, > Harald >=20 >=20 > > Signed-off-by: George Stark > > --- > > I use DHT22 sensor with Raspberry Pi Zero W as a simple home meteo > > station. > > Even if to poll the sensor once per tens of seconds after month or > > two dmesg > > may become full of useless parsing error messages. Anyway those > > errors are caught > > in the user software thru return values. > >=20 > > =C2=A0drivers/iio/humidity/dht11.c | 4 ++-- > > =C2=A01 file changed, 2 insertions(+), 2 deletions(-) > >=20 > > diff --git a/drivers/iio/humidity/dht11.c > > b/drivers/iio/humidity/dht11.c > > index c97e25448772..e2cbc442177b 100644 > > --- a/drivers/iio/humidity/dht11.c > > +++ b/drivers/iio/humidity/dht11.c > > @@ -156,7 +156,7 @@ static int dht11_decode(struct dht11 *dht11, int > > offset) > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0dht11->temperature =3D temp_int * 1000; > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0dht11->humidity =3D hum_int * 1000; > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0} else { > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0dev_err(dht11->dev, > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0dev_dbg(dht11->dev, > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= "Don't know how to decode data: %d %d %d > > %d\n", > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= hum_int, hum_dec, temp_int, temp_dec); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0return -EIO; > > @@ -239,7 +239,7 @@ static int dht11_read_raw(struct iio_dev > > *iio_dev, > > =C2=A0#endif > >=20 > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0if (ret =3D=3D 0 && dht11->num_edges < > > DHT11_EDGES_PER_READ - 1) { > > -=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0dev_er= r(dht11->dev, "Only %d signal edges > > detected\n", > > +=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0dev_db= g(dht11->dev, "Only %d signal edges > > detected\n", > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0dht11->num_edges); > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= ret =3D -ETIMEDOUT; > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0} > > -- > > 2.25.1 > > =20 >=20