From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 CCED62EB5CD for ; Sun, 19 Jul 2026 23:08:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784502495; cv=none; b=uMeW7AQdFG18CE3bZvQ1NNNWAuGbnSE9fj6IwBDWfgbZEH/9Wzknt3wMNlAykJ8eFG0W6Rv6/CY9711bMAAhgQmFD0ORJHKBt5ZzC6VQ4LxzA5ZrfXl5KpzdpOJTy2VK1cAyXYpFCMXAOBw1nDgZ2ru6+vKRUUdA12ViXwV2swo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784502495; c=relaxed/simple; bh=TBzIujEI5cVMShYnP0cIJc6bOwUwC0Ol7KBsn9W1f24=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=K/qdwoZLQSzJDdwe0Tvlr0HR6OqKJfA8+xeG/PgKVa/a/QPrTy6MZgLD/Vt/AHd0NNH65TPm5Pv/v7v0uOw0t7ihpC2qPcgdvT4EtXeexvAmYET/8QPA8cyhGlBDf8gVepmR10K71GSBFcGNaTtY+YTv2r4jMWmWgAvrFvxSzO4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=peIEerk4; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=AJkY0tXF; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="peIEerk4"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="AJkY0tXF" Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 66JKRE3T422645 for ; Sun, 19 Jul 2026 23:08:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= 7lEhViJTqWmDXZiB6V/knCwrtAyVIbdBJvhBeySb/5g=; b=peIEerk4WEn8qK3F XBqoZdd1yBOPB8SvJGhZ5P7ktzpkXO0WAPkxg07SVi6aOIQW1w9Ek/w7cIvUtSvZ s73BdK2LMVgAm8hcodE82mrDGLnxhyAX46BX097dizwQ9Gfk1rJwlT+BGNmp1jNE j6SRNk1wtGO7ozM/qF/J+6y2FhRFEPI8J6rCrK2V0fY/WAa/Cjk+XhfOm9VwZn1r ntlPaHGd+ARl22vu1ds9JCEUX6Ud4vJytJ0DWBTDO7cSJesB+zGaWwzFjfcdyIS8 WYBQR+9jnwCLS5MKz9yRjNWKy24cBI/T3LswT4Hg7VKoJQolCGw/QQHiVnIMTqoq aXKVXw== Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4fg2dc3ntk-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Sun, 19 Jul 2026 23:08:12 +0000 (GMT) Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-c892143db7fso5331298a12.1 for ; Sun, 19 Jul 2026 16:08:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1784502491; x=1785107291; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=7lEhViJTqWmDXZiB6V/knCwrtAyVIbdBJvhBeySb/5g=; b=AJkY0tXF1faZCmBgf511Sp//rN+XlAyNbw+elIukOl/EqxWRBYFWT94ZSx9D/LJzDe 0keugqVIWDhpX3JUbQjtmHfPANTUycgFmRISAeGVRb3nen4ZM3IIE1xmO16bFIPA3eWy m//iZip45oSueAuJshwRAEPtUOq+YIH+1BJG1WCtEGJJbqL7Qc0bxFeZh2y1EGEBSZWj q9ZuzRmjZglkuKKnFA/IolkqYJjIn4L9gOU/str9ddLNW1f0QdrZIjDvB4diAhCS3+hj 660AlmPQD0jlIs+7hESl6Cowe+GM4ECi58nD7aQxvEp7nUlXwCBU0ttd4xMChZ0wGSr7 CMsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784502491; x=1785107291; h=content-transfer-encoding:content-type:mime-version:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=7lEhViJTqWmDXZiB6V/knCwrtAyVIbdBJvhBeySb/5g=; b=nKqQkOxeuvTHqMh37d/jT1gTDM78v8xgkFfDZLpYfL19WP1xkykZxrZUh2vYYWdt6x KlhJK6G0TiVQolNJX0HW5HEVrwc5oOJD7JOR6MEZPtmch9/Qu426YFA5o9hDtSpdrb/w ZxdwQEyDgmgcdQbLGwM4MHWxhGqvUREUMWWyYrUvZddvuAkU0uq1e7bXCOMO0Hau7hsk yYxrN8S2niLZMHltgx3VAGFMpk2gBuDCG8QBNakIKupLE+n65NDpDqbAXNcv1OAA2eCC i+JThuqfv5h3Biki6KjFHi0ZlF2JSOgT9WGdak6GNvf3FldPGQ7nrcSNH6LoxTryiKXO VaSw== X-Forwarded-Encrypted: i=1; AHgh+Rq3k/Kj5OHZ3YvOBja0nb7thr95ixuY1ePndh2xculgYHR+UyMDUkRTXdOSIcP0k+Uq5BC/9XYu71UtJ5M=@vger.kernel.org X-Gm-Message-State: AOJu0YyVPRV8V05lviQVuJHC4w+3zw9U8R/1dQbXq7vHEUxOt89er+yg 5t6d3y3on2gu7ot+x0vsb17oNwmMg7rokLKoPkRrwkXXZ+Ro3UmCMPyzIBOSJzoUfz4KDu45T/8 gK2afa9rXqEvhwKP9aeuZOnBTNN1jjBhjzUDwPA3GB5BOda9eMURc/cZsWwcusAmNEwQ= X-Gm-Gg: AfdE7cnJXPVOstOzHeH9ieNY20fI69WFDZTo5H0nYRxiZW8V2hGZq1/gPaud2MYZr6G 9EQzhqVYz7n19GNAXibtO9Fzv1QesGf8FgC5LzoqP3fXs9/g+Y8PAAaNaMtIhSVmpF1gfOWFsD2 aUM5JgqjsMP+UCr6TY3sY+F+QSakJa4AlG1PLZ1qPhnO1HKhlnanorSWah6gfbk4VaUyTioackg QZwrMO6d3CTmHUMDVqe1cQgQ8kwL4BshhHH7WXphbOSFaynTPoVpX3XFgYT8aKgyG4B087UgKMR T3kylX1amgNBZQvh14+BhNoQ2NJSzSZbUrDij4/1Ih9+zLlI83Yr+YBOekGS1K4wUOh2m4CnqBL UCh6EbuQmZQpFdn0d X-Received: by 2002:a05:6a00:1826:b0:848:7997:cb23 with SMTP id d2e1a72fcca58-84c2945cda5mr11120739b3a.43.1784502491380; Sun, 19 Jul 2026 16:08:11 -0700 (PDT) X-Received: by 2002:a05:6a00:1826:b0:848:7997:cb23 with SMTP id d2e1a72fcca58-84c2945cda5mr11120723b3a.43.1784502490890; Sun, 19 Jul 2026 16:08:10 -0700 (PDT) Received: from jic23-huawei ([50.35.46.84]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cb519aeb6c2sm3616207a12.21.2026.07.19.16.08.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 19 Jul 2026 16:08:10 -0700 (PDT) Date: Mon, 20 Jul 2026 00:08:05 +0100 From: Jonathan Cameron To: "David Lechner (TI)" Cc: Nuno =?UTF-8?B?U8Oh?= , Andy Shevchenko , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Chris Hall , Patrick Edwards , Kurt Borja , Nguyen Minh Tien , linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 6/8] iio: adc: add ti-ads112c14 driver Message-ID: <20260720000805.41022604@jic23-huawei> In-Reply-To: <20260714-iio-adc-ti-ads122c14-v4-6-25f8e3084485@baylibre.com> References: <20260714-iio-adc-ti-ads122c14-v4-0-25f8e3084485@baylibre.com> <20260714-iio-adc-ti-ads122c14-v4-6-25f8e3084485@baylibre.com> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; 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 X-Proofpoint-Spam-Info: AW1haW4tMjYwNzE5MDI1OSBTYWx0ZWRfX7bnClnLO+mb4 /NotAaU6fqi6/s4j+Hdul4iidmdzXa6SvbX8yhuoqA49MkXnSSu1hCxozpKEcbae69SmaMskd2c jfq93J7I63zLJoU45ovNlePlCeHZi3k= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNzE5MDI1OSBTYWx0ZWRfX0eMW97F/2EKh S3fRqH4z11cL9Qf2kjoaBeRIcm1Xr81zclWWUTRcnl0rToUEe57kl8dkuoNA3cDTKcmJWSFa2ja V+iHqAMOwUoCDth0DePjMsHAGCxGLw/13I/isUMS3mxb1ewJYTM5Ef5mt9RIXnHydRDvxtSxC4z hJAUcWXYWdNeiC5IH3wbYScquNqgago2YF9d7HlUgUJ9mw6LKM8jiLZgno+atWucEi3Zij7XHVA 6AW4XIJePH9GzzRXhJE2x0xERkc/EYrFwhQgHoWOKmT269yOWux8UDYrwDWF7znqT3DNOe93gle hRySlcv94q7ziSinyfJhBszox8EJXurLkcLb6TaZjoXKBLw8XVV/7ebjD9BO7tG3nuQeg8wo/3H 6IW1VOGMxFQyexl3EEGZEDV1NjeRidQHrg/MgHXoBj306Z+z1b1uNDTr97fmZMPzMFTv8rU+1xr 4Ub9Yn8yHlgiHhSQ+vg== X-Proofpoint-ORIG-GUID: 6ioKYL_qjcDtwULzqBd-yq3KbiiYBTh0 X-Proofpoint-GUID: 6ioKYL_qjcDtwULzqBd-yq3KbiiYBTh0 X-Authority-Analysis: v=2.4 cv=FOQrAeos c=1 sm=1 tr=0 ts=6a5d58dc cx=c_pps a=Oh5Dbbf/trHjhBongsHeRQ==:117 a=qC1CW/w66vtJz1P9yTJxNA==:17 a=kj9zAlcOel0A:10 a=RAioF0-LDSMA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=IpJZQVW2AAAA:8 a=FPNj1WgbcA2tj7y3evEA:9 a=CjuIK1q_8ugA:10 a=_Vgx9l1VpLgwpw_dHYaR:22 a=IawgGOuG5U0WyFbmm1f5:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-07-19_07,2026-07-17_01,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 suspectscore=0 adultscore=0 bulkscore=0 spamscore=0 malwarescore=0 priorityscore=1501 lowpriorityscore=0 phishscore=0 clxscore=1015 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2606150000 definitions=main-2607190259 On Tue, 14 Jul 2026 18:21:28 -0500 "David Lechner (TI)" wrote: > Add a new driver for the TI ADS112C14/ADS122C14 ADC chips. > > This first step is adding a very basic driver that only supports power > on/reset and reading the system monitor channels. > > ADS112C14_SYS_MON_CHANNEL_SHORT is the last channel rather than being in > logical order by address to keep the voltage channels together and in > case we find we need to add variants of this channel with different > voltage reference later. > > Signed-off-by: David Lechner (TI) I think sashiko is sending us on a wild goose chase on this one. "When ads112c14_single_conversion() calls i2c_smbus_read_i2c_block_data(), it returns the number of bytes read upon success. A short read (e.g. 1 or 2 bytes) would return a positive value, bypassing the (ret < 0) error check in ads112c14_read_raw()." An i2c_smbus_read_i2c_block_data() response doesn't contain a length unlike i2c_smbus_read_block_data() which does. Maybe there is a controller driver out there that messes with block[0] rather than returning an error on failure to do the read part of the sequence. I checked a few and didn't find one. It might make sense to make it clear this doesn't happen by adding checks in the i2c core. One to consider after the other ones on my list! However, one small related comment inline about keeping postive return values meaning success as local as possible in the code! Jonathan > diff --git a/drivers/iio/adc/ti-ads112c14.c b/drivers/iio/adc/ti-ads112c14.c > new file mode 100644 > index 000000000000..a69c595ab518 > --- /dev/null > +++ b/drivers/iio/adc/ti-ads112c14.c ... > + > +static int ads112c14_single_conversion(struct ads112c14_data *data, > + const struct iio_chan_spec *chan, > + u8 *buf) > +{ > + struct i2c_client *client = to_i2c_client(regmap_get_device(data->regmap)); > + u32 reg_val; > + int ret; > + > + if (chan->channel < ADS112C14_SYS_MON_CHANNEL_BASE) { > + /* Not implemented yet. */ > + return -EINVAL; > + } else { > + ret = ads112c14_prepare_sys_mon_channel(data, chan); > + if (ret) > + return ret; > + } > + > + ret = regmap_write(data->regmap, ADS112C14_REG_CONVERSION_CTRL, > + ADS112C14_CONVERSION_CTRL_START); > + if (ret) > + return ret; > + > + ret = regmap_read_poll_timeout(data->regmap, > + ADS112C14_REG_STATUS_MSB, reg_val, > + FIELD_GET(ADS112C14_STATUS_MSB_DRDY, reg_val), > + 1 * USEC_PER_MSEC, 100 * USEC_PER_MSEC); > + if (ret) > + return ret; > + > + return i2c_smbus_read_i2c_block_data(client, ADS112C14_CMD_RDATA, > + BITS_TO_BYTES(data->chip_info->resolution_bits), > + buf); With all that stuff above about this not returning short, I'd still be tempted to do an if (ret < 0) return ret; return 0; sequence in here so we don't propogate confusing positive returns beyond where we can see their source. Having done that make the outer check if (ret) > +}