Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10649052imu; Thu, 6 Dec 2018 04:42:49 -0800 (PST) X-Google-Smtp-Source: AFSGD/VtVMnfKMN9/3IsmGfm6dTgbXOjJYHYzV6Z3zhp1Zyu3dp0BNbpYTS0LGpqhUZSYA4tJz/O X-Received: by 2002:a62:4b4d:: with SMTP id y74mr28083912pfa.186.1544100169496; Thu, 06 Dec 2018 04:42:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544100169; cv=none; d=google.com; s=arc-20160816; b=Ow7fRwqMFh7381aXa4vcdMoT95glBxrBGnb6SmCyTLiBZl58sRcCJ73UFJi3O7Gpfa d3BHQkP8k0J02K5XbjFnkbUvRIHI6+U4d+FuiHRWmFNL7mBKBYC+bATW78vEMKea30B8 wNLep4LK3xomS3zerk5wILTwjwiWWLgJ7Fo5BhpiwuPO37vc91tDBdJkGweSQX+pS0SC 0aP6/W6YF/97BoN2YIfhu8VE/2CPkSQTgGvQZGRtcG2sZFZrv8Vm8DKApr9H6fu44KGb v6SNCBnPIx6k27g04gSryYldhxSYQNTGCe4npSYRBPDOLMWIPyvGbmGdfNNINUtV+cyz a4sA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=L4+uKWKf0GfoG4mbTgvZPP6iRW6WZ376ArCNhULER6s=; b=BwSdzFamSc945VwE/hA876OW6eAkXW34coVOzsYvuQpZwOndt4M0m5S9U381QTLKhE MfA6cfJLvwrhLQy3C31fgxGhw2FHPBlPBwGrUy88Ow5pFoVTt5q033W07Q+S9TYVc4TS YYjtbWGRu3CFdimn682d/95EcEK0q+4Bt+EkwikO2FqchhY0UUm5hUSVu1vT32FPd5Vf +Mu+omtiUDrnIgxUN98e+nDS472GK7dAL4deXFI2NGeNIkWIeYyegx+suyP1i/jBjRvv 4tdcMRwePbR5NwV89tmgFmFq0QHdF8P/ZdK3lfAoVsJG7XbRkbInPuE2ei2eg43FMYlA eQDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=T5PwOyCS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m9si186780pll.349.2018.12.06.04.42.33; Thu, 06 Dec 2018 04:42:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2018-07-02 header.b=T5PwOyCS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729444AbeLFMlf (ORCPT + 99 others); Thu, 6 Dec 2018 07:41:35 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:54244 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727832AbeLFMle (ORCPT ); Thu, 6 Dec 2018 07:41:34 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id wB6Cd6nm106248; Thu, 6 Dec 2018 12:41:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=L4+uKWKf0GfoG4mbTgvZPP6iRW6WZ376ArCNhULER6s=; b=T5PwOyCSH8jB6SDuqC6YqsE0G/JUxIZz/MygYdf+0MQbvzkVsSyyIr9ANEty4NA/GjKY wCqiaiCgmGpSjyMP5IMk7oWr839hdn1ns40OBK8+mO6MhSxAD55v7MAtwQQdnS1614T/ mX5Y8ukjqLoPI9+w9cZd/HhBqCFB1u9+xj04VwJyo6QGsX5eo2yvmDJb2JqyhP210F6m yNaH2UTWodDBxVpnRcCamSvySfc/JTr2kpDCVGyVDjdIER2W43euxXliKawtj9XxvAtt goK1UGHICHXm+uY8ldQ6mzq0Rkezgs6PMwHUvQrY2+6tatMRY6DxvIAbEwRgriiqQZ2S Yw== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp2130.oracle.com with ESMTP id 2p3ftfbx9n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 06 Dec 2018 12:41:02 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id wB6Cf1Xd007647 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 6 Dec 2018 12:41:01 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id wB6CewTE020412; Thu, 6 Dec 2018 12:40:59 GMT Received: from unbuntlaptop (/197.157.0.47) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 06 Dec 2018 04:40:58 -0800 Date: Thu, 6 Dec 2018 15:40:47 +0300 From: Dan Carpenter To: Jeremy Fertic Cc: Shreeya Patel , devel@driverdev.osuosl.org, lars@metafoo.de, Michael.Hennerich@analog.com, linux-iio@vger.kernel.org, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, pmeerw@pmeerw.net, knaack.h@gmx.de, jic23@kernel.org Subject: Re: [PATCH] Revert "Staging: iio: adt7316: Add an extra check for 'ret' equals to 0" Message-ID: <20181206124047.GH3095@unbuntlaptop> References: <20181205014900.4827-1-jeremyfertic@gmail.com> <20181205215953.GA2365@r2700x.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181205215953.GA2365@r2700x.localdomain> User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=9098 signatures=668679 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812060113 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 05, 2018 at 02:59:53PM -0700, Jeremy Fertic wrote: > On Thu, Dec 06, 2018 at 01:25:55AM +0530, Shreeya Patel wrote: > > On Tue, 2018-12-04 at 18:49 -0700, Jeremy Fertic wrote: > > > This reverts commit 00426e99789357dbff7e719a092ce36a3ce49d94. > > > > > > i2c_smbus_read_byte() returns 0 when a byte with the value 0 is read > > > from > > > the device. This is a valid read so revert the check for 0. > > > > > > Signed-off-by: Jeremy Fertic > > > --- > > > > Hi Jeremy, > > > > As per my understanding, 0 value indicates no error but no data read. > > Then how can this be a valid case? > > > > Can you please make me understand that how can we consider this as a > > valid case even when no data has been read? It's not reading no data. It's reading one byte of data and returning it. > > > > > > Thanks > > I'm not sure I understand why the value 0 would indicate no data read. > Doesn't that just mean a byte was read with the value 0. Yes. It does mean that. Please don't ask rhetorical questions... :( This list is full of people who can't resist answering every question. > For instance, if the input to the adc is 0V. Can you point me to where > you're seeing that this would indicate no data read? drivers/i2c/i2c-core-smbus.c 88 /** 89 * i2c_smbus_read_byte - SMBus "receive byte" protocol 90 * @client: Handle to slave device 91 * 92 * This executes the SMBus "receive byte" protocol, returning negative errno 93 * else the byte received from the device. 94 */ 95 s32 i2c_smbus_read_byte(const struct i2c_client *client) 96 { 97 union i2c_smbus_data data; 98 int status; 99 100 status = i2c_smbus_xfer(client->adapter, client->addr, client->flags, 101 I2C_SMBUS_READ, 0, 102 I2C_SMBUS_BYTE, &data); 103 return (status < 0) ? status : data.byte; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 104 } 105 EXPORT_SYMBOL(i2c_smbus_read_byte); You are right. Commit 00426e997893 ("Staging: iio: adt7316: Add an extra check for 'ret' equals to 0") needs to be reverted... regards, dan carpenter