Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp2170850rwb; Sun, 4 Sep 2022 09:46:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR4RCZiafkTJ7T0J3Sf0OAZMDj7luZnunzL40WTc25QgH+PZpMfwUVWqsDw9xMnaxTBRPpMN X-Received: by 2002:a17:906:c150:b0:751:2181:87a6 with SMTP id dp16-20020a170906c15000b00751218187a6mr7620606ejc.692.1662309982053; Sun, 04 Sep 2022 09:46:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662309982; cv=none; d=google.com; s=arc-20160816; b=hYEEADGzCoH3njKEMUqZXs2DdqrJ6GcnrGc2l1ST7ekwcNvJaNcAeK/Gaj2Qb/+TES Ec1DIKU6W7FSwIS09KUH9Ll+wgrpu+ciF+NYk5JDPIbFLL8eDf5NnjIuV/hJ255NOhWa ivezMtpsBccix5aYe+9iD/Kxerwzl19ZZZWZOpzpGCo3rUUjO7fMJH9uqZxmorDgjFxU dsjMD6eipnJKxCM+onwvHTMHviQ7GyflrQeZgzfnCYC5FUaFZB7UWiXmnjqUUWVfnLP7 NDRqktVcJF1tLQXwv32XG4rN2Ji4N6ysZOnuBKiM59ZQx2/mqw+z8IHplcEjV+H27ezr t3pg== 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:subject:cc:to:from:date :dkim-signature; bh=DNmpaifVA0l3BkEXXvQLHOKdGKMpkAC2XWh+tUxFAxo=; b=j/4QRB8qGvWeYdGSG8s8mJCu4evUbwKC39+z9ZzOl2usVSYpDG5TQZNutWDDc8gHU4 EWZMCvETfkClPJ5jut26Pw9MPltjN69EJmSxY+4KrQRCDBr0gRaTNj3fUsDxk4KztST9 axbXOLlWl3Bq19KJq8pN7M8ikXW0MIOA0S/tGu9Uo10GonYhafSodjcYtDrWxdwEyZjD tPiy2YK7vYz7hkX7gzEz6L8ogJFcpdoGe8YyiUsxLNJ9I+A5p7ClRhjbij4Ixp7s3ZqJ vTVmwbJuPycMLJzb6XoWGnLixZTbiY8rcl2oVmJ1qjlEQMIGAIAdUjdiIYKTWa494b+j +RtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k5itcawl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q4-20020a056402248400b0044e6a188fb8si1757962eda.77.2022.09.04.09.45.55; Sun, 04 Sep 2022 09:46:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=k5itcawl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233794AbiIDQar (ORCPT + 99 others); Sun, 4 Sep 2022 12:30:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233768AbiIDQap (ORCPT ); Sun, 4 Sep 2022 12:30:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CED362B27F; Sun, 4 Sep 2022 09:30:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 525D1B80D70; Sun, 4 Sep 2022 16:30:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 11B97C433C1; Sun, 4 Sep 2022 16:30:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662309041; bh=mdq9aBpeeejzTVkU2nNEaKiUz49Bwldf5MKVl3rvX/U=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=k5itcawlyRhCLB0n3UVKz/qVPjFOUb7lQlkG0KVIeMRD2TCdHkLcvzqMZFNVaMZXH 5l/looaKOtiIPuQlAGIfFNB2UOiDJHRpUcg5zppw7oW9mlS8EH04HKir+G2Bdvb8Ay fSsd4w20witVcY6BxO5lTU+eYleBQasC5yN6Gx9zYSqJ//qvpKSdSBU+3wyEvOoDZd Ee/7k0AyT4MrXKy3IHvghekciIT+ef8Lo+yEsX6Z8ogNcucy5FjZOU4aMA7Hk8A3gb selX/HwTmiV9mZOEJvFdGALUgaPt3qCVDNlWs72myjedK8LeXfpfBYALu8x6m+CVbE NQCvb45fnbsvA== Date: Sun, 4 Sep 2022 16:56:34 +0100 From: Jonathan Cameron To: Crt Mori Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, Andy Shevchenko Subject: Re: [PATCH v2 3/3] iio: temperature: mlx90632 Change return value of sensor measurement channel Message-ID: <20220904165634.5cde87fd@jic23-huawei> In-Reply-To: References: <20220903222422.3426156-1-cmo@melexis.com> <20220904154923.33b79d83@jic23-huawei> X-Mailer: Claws Mail 4.1.0 (GTK 3.24.34; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 4 Sep 2022 17:27:28 +0200 Crt Mori wrote: > On Sun, 4 Sept 2022 at 17:23, Jonathan Cameron wrote: > > > > On Sun, 4 Sep 2022 00:24:22 +0200 > > cmo@melexis.com wrote: > > > > > From: Crt Mori > > > > > > The current EINVAL value is more applicable to embedded library, where > > > user can actually put the fixed value to the sensor. In case of the > > > driver if the value of the channel is invalid it is better in inform > > > userspace that Channel was out of range as that implies more to internal > > > driver error than invalid input. It also makes for easier debugging of > > > where the error comes from during the development. > > > > > > Signed-off-by: Crt Mori > > Hmm. That's an obscure return value - I think it's mostly going to confuse > > anyone who ever gets it. So not sure this change is wise even though the > > descriptive text for that one does seem very much suited to this usecase. > > > I did get it few times during the development due to read when sensor > is not busy, but the measurement data not yet updated correctly due to > powermode switch. I think I added enough delays all around to avoid > hitting it and with proper power mode switching, but there might be a > case, so it will be easier to spot in the source code in future. I > would not remove it, if that is what you are proposing. I meant leave it as EINVAL. The users of ECHRNG are very very few in number, so I don't have a good understanding of it's expected uses.. > > > > --- > > > drivers/iio/temperature/mlx90632.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/iio/temperature/mlx90632.c b/drivers/iio/temperature/mlx90632.c > > > index 37edd324d6a1..d511d36942d3 100644 > > > --- a/drivers/iio/temperature/mlx90632.c > > > +++ b/drivers/iio/temperature/mlx90632.c > > > @@ -435,7 +435,7 @@ static int mlx90632_channel_new_select(int perform_ret, uint8_t *channel_new, > > > *channel_old = 1; > > > break; > > > default: > > > - return -EINVAL; > > > + return -ECHRNG; > > > } > > > > > > return 0; > >