Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp305080lqp; Mon, 10 Jun 2024 05:02:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWk8Qdb2JSL+UlLGfk3GKX30HWdhYxMNsCBE6qzzjys+NEFhK4Bra1CJ1pYNkPUMunVMfjIntjDdtT64hNW05PzAEPU3os8zSeF365wmw== X-Google-Smtp-Source: AGHT+IFl99qbxC2D8+rJuxjs64102Twtn3o4x7rerRki/DETwRGp9pNK+NCrgDCeBcVn5UZ/9XAX X-Received: by 2002:a05:6358:430c:b0:19f:4d27:fb7e with SMTP id e5c5f4694b2df-19f4d27fe9bmr461947955d.5.1718020927506; Mon, 10 Jun 2024 05:02:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718020927; cv=pass; d=google.com; s=arc-20160816; b=H7EubkICU5ukE4DsovyqJbmxAQM5uBLPiOn8y3pk4QGHZEcYP3gtTx9xk4vVMW7jIa 8htp08Ppxit1VPKVSJ+JBm4h6UtKnAUb3G7fnQTY+mja2UWE/mn6mU+GP4LN078RECQ8 7Fh2I+JhCv3vuBWAPOsKHqvfN7xuJlTDzdfDZgp8nq6ywQpOPFII+SJyf3hoDXVRLTe4 u+59rRK1McOnrYFnpZPxIIqu9J6aoDWZm0r5UxEWSP6qR4VKhrovU5/GaBKc2kWwwwTs ajnXdSQGt1pOk8IxvBLOLp33ZFZNi6a0k5pZrbnimApUfxDlt1H6Y2IeGklHS6oYZ3Ci DsqQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/q4vYPFqxBCRHYZkSp6vEtxYFhA1GVHtEgKxwdr8R3w=; fh=y7DU5Iel5vYNtRHP1Jy0wqXReH9fxlfsOeMMK8hc9Ik=; b=CRH1N3WW5SUNnZNCX7lTpR7I6nXp3hHo05E4q4rqbrKoUQCBgFHZzwKOtb2bkTIEiS RgkAVTkw9yga6eFajluH9RD0kbY/7g1NlXbI8b0/W6YrzEP2dVwiy5/DJZ346sPPkgJ0 T0S4aBcy5kneBMuC1PjrADrriUuldud4ZgqFDbRMpgw3RDMQPw+cdHo/T6i49QNorhQb Sez5nrLXcPxYEeMzO4QRaosTs7g2C75kX9X/XjT+uFSBF/QPFPOHWvzradXmkecxI1Xe yz0EKjeoF1KxdFJcoO/Mtvr0awzs3RmjSpUC5toHQ6HSqoefmE79rKidzAcVa01mHSoN ncTQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@dolcini.it header.s=default header.b=WJJso2M2; arc=pass (i=1 spf=pass spfdomain=dolcini.it dkim=pass dkdomain=dolcini.it dmarc=pass fromdomain=dolcini.it); spf=pass (google.com: domain of linux-kernel+bounces-208121-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208121-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=dolcini.it Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-6ea6e277927si2973116a12.69.2024.06.10.05.02.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 05:02:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208121-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@dolcini.it header.s=default header.b=WJJso2M2; arc=pass (i=1 spf=pass spfdomain=dolcini.it dkim=pass dkdomain=dolcini.it dmarc=pass fromdomain=dolcini.it); spf=pass (google.com: domain of linux-kernel+bounces-208121-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208121-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=dolcini.it 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id A704B28743D for ; Mon, 10 Jun 2024 12:00:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 56E567F7E3; Mon, 10 Jun 2024 11:59:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=dolcini.it header.i=@dolcini.it header.b="WJJso2M2" Received: from mail11.truemail.it (mail11.truemail.it [217.194.8.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0285770FF; Mon, 10 Jun 2024 11:59:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.194.8.81 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718020766; cv=none; b=MbhW1EAEBMzphYtF+71YYZq6KNyvxd2TKrGC9WBtfIQGQOS+0kFIS/K0jVaqV7YdHAcHx03ZvULAlq72+iTl/43rrVwm2aJNWm7hCYuXSywfGZcTQapm8ysxyIu9qTzfB/BA11VXLsmW7ynGplQntRqv7yd+LocVRqEAzYQLeEY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718020766; c=relaxed/simple; bh=AQW3KRBl3PqmimCKD4Is8cPSYUyDWKvNDQSE5lbUNX0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=efNULUkFUXbDlVGY/94lh3N7VwaicOZ5ewohFsuQHZooTCldHfUzkcQW2ZrDSaKpvD/vTadEueNrZx/Khu1Li36N01BUKi/1s5DQrx7SWaYVVzmJQm0jIaeenhP4DRWj73pLxOEVuMlWbrwTr3ymAmRFcQbpTWXa+U3rxWxE12I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=dolcini.it; spf=pass smtp.mailfrom=dolcini.it; dkim=pass (2048-bit key) header.d=dolcini.it header.i=@dolcini.it header.b=WJJso2M2; arc=none smtp.client-ip=217.194.8.81 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=dolcini.it Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=dolcini.it Received: from francesco-nb (93-49-2-63.ip317.fastwebnet.it [93.49.2.63]) by mail11.truemail.it (Postfix) with ESMTPA id 546AF1FB6C; Mon, 10 Jun 2024 13:59:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dolcini.it; s=default; t=1718020753; bh=/q4vYPFqxBCRHYZkSp6vEtxYFhA1GVHtEgKxwdr8R3w=; h=From:To:Subject; b=WJJso2M2zwVpu1htsxWWK7DbUfEaHQNtxGfSDiAyfXhsVBAuvNvC08u27I+mCVTjX mw0lnayu6JcRsK3W+hfBx9ld2ClCCTDlPVXcptX7H0NcPgTxPKGUSaTUPXxNaRHKCO I93CMRcL6maNOv/9TanGNXsiZrmkT553j5FZI74YZITfOhD0Rg8Pbs2XRxFiVaHcIK UIlgcsfunswz2T0ws7qD0xSVo6Z9+141Psd8tYpal6rfNO1Ck+P0PtDCrHdoJikPYs o09gzMxF3iVVRD1pc9XpdgnW65FKg+ko1XBMtHVfcGeuvV8AkEhLcYvuWbqdxrVyOR tyq9BllrV2VIw== Date: Mon, 10 Jun 2024 13:59:09 +0200 From: Francesco Dolcini To: Jonathan Cameron Cc: Francesco Dolcini , Lars-Peter Clausen , =?iso-8859-1?Q?Jo=E3o_Paulo_Gon=E7alves?= , Liam Girdwood , Mark Brown , =?iso-8859-1?Q?Jo=E3o_Paulo_Gon=E7alves?= , linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org, Francesco Dolcini Subject: Re: [PATCH v2 2/2] iio: adc: ti-ads1119: Add driver Message-ID: <20240610115909.GA27057@francesco-nb> References: <20240606163529.87528-1-francesco@dolcini.it> <20240606163529.87528-3-francesco@dolcini.it> <20240609115234.20e08840@jic23-huawei> 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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240609115234.20e08840@jic23-huawei> Hello Jonathan, thanks for the review. On Sun, Jun 09, 2024 at 11:52:34AM +0100, Jonathan Cameron wrote: > On Thu, 6 Jun 2024 18:35:29 +0200 > Francesco Dolcini wrote: > > > From: Jo?o Paulo Gon?alves > > > > The ADS1119 is a precision, 16-bit, analog-to-digital converter (ADC) > > that features two differential or four single-ended inputs through a > > flexible input multiplexer (MUX), rail-to-rail input > > buffers, a programmable gain stage, a voltage reference, and an > > oscillator. > > > > Apart from normal single conversion, the driver also supports > > continuous conversion mode using a triggered buffer. However, in this > > mode only one channel can be scanned at a time, and it only uses the data > > ready interrupt as a trigger. This is because the device channels are > > multiplexed, and using its own data ready interrupt as a trigger guarantees > > the signal sampling frequency. > > > > Datasheet: https://www.ti.com/lit/gpn/ads1119 > > Signed-off-by: Jo?o Paulo Gon?alves > > Signed-off-by: Francesco Dolcini > > A few more comments inline. Some of these I missed in the first > versions - sorry about that. Takes a few passes to pick up > on everything unfortunately. > > > diff --git a/drivers/iio/adc/ti-ads1119.c b/drivers/iio/adc/ti-ads1119.c > > new file mode 100644 > > index 000000000000..ea0573f07279 > > --- /dev/null > > +++ b/drivers/iio/adc/ti-ads1119.c > > @@ -0,0 +1,850 @@ ... > > + > > +static int ads1119_cmd(struct ads1119_state *st, unsigned int cmd) > > +{ > > + dev_dbg(&st->client->dev, "cmd: %#x\n", cmd); > > + > > + return i2c_smbus_write_byte(st->client, cmd); > I'm not a fan of tiny wrappers to add debug info. > The i2c core has trace points that let you get to the relevant data. Better > to use those for debug and flatten this code so we > see the actual bus accesses inline. Fine on removing the debug prints, we'll do. However ads1119_cmd_rdata() and ads1119_update_config_reg() wrappers are making the error handling in the caller easier. Either we remove only ads1119_cmd/ads1119_cmd_wreg or we keep them all for orthogonality. Both works for me, just let me know if you agree and which option do you prefer. Personally I would keep them all without debug prints. > > + > > + return read_poll_timeout(ads1119_data_ready, > > + data_ready, > > + (data_ready == true), > > + wait_time, > > + ADS1119_MAX_DRDY_TIMEOUT, > > + false, > > + st); > Over wrapped. Aim for closer to 80 chars. I'll do. Do you have any rules on the IIO subsystem driver? IOW is it fine to have line slightly longer than 80chars if this improves readability ? Francesco