From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 11B6D221F1C for ; Tue, 2 Dec 2025 15:04:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764687874; cv=none; b=WS8+62iECwJ8OY89EHBVeFzURPQutJbP11DdpvmZH/V8kEVlc4qOgidNDMevDiQo//DQ2J7c4FI91X+mj9b7aCOVp2rLgslcO1xMyyAfkzobZBSLlzTFUAS9TPMQIAIEnrOcOk+lSGEZFp6GiNhUySj2ATAC9S939rCnCb2G7/s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764687874; c=relaxed/simple; bh=HYijSUSn0hro0W1A1dG1mFj3T4wSkeDuYzLRP1HYDMU=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=I4Gv0G0O/IrnaU9GaqfxIDB8he3DeVBEfkgHoxXGjHGJEWZQ3mTUidUwTVDJvjQDKduDTQ1j/zO7K/i0ICd4EkrzYa2yCQHa/m0TRaHFNIpdPJI2k2XOcdMZWbd6UikxFNJ0K+u+Wu4Xwhk68pUgkga+oDf6GxkFX0A9WNaKTdM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=aNdpYtev; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="aNdpYtev" Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-477b1cc8fb4so34295885e9.1 for ; Tue, 02 Dec 2025 07:04:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1764687870; x=1765292670; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=WGSsYT5bkGCIa+dpPiHT5SiBWMh8trrXZ1WS3t4AGnk=; b=aNdpYtevsnPjeIgwZMlixD+1BL6U7zqEH9mgvG25JwxHb+BtnCFaXYjT20JrkgABdA euo5JcYSK0Cs1dlAF71C/RXrBQSTGRxAX190sJwGXKHNYG+/yUxMpIRb6+dJhsd6IEFS LNUYYY+8JpEcmTNSqBWGPL7fyufR5eUQsImImualXE9/1wsF6FE4jfwC/ZkIEjqzMceX 7f9b5OedWNI1JX72aUG2300n2KX93t+Q49rERWqDDXuQKgF2f34H102hooitNwNMvJft 4V2QzYRoetg/R8cy0D6fTU1Mf6vILmqNH8DnVYHu1OxG5cE54pxbNGbFCF9wtAypKXs0 Pmpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764687870; x=1765292670; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=WGSsYT5bkGCIa+dpPiHT5SiBWMh8trrXZ1WS3t4AGnk=; b=Yk3GHmvrE6774jmVnKexsmplMB08aU49dB3tUrD1dRjdwwrHPCODQxi7HfrBMqEmbc kdCOg57im6qlKFJ+kMhabvOiCpyTNuaRVODoHg/5eGQbHQ+DmjsRQXtfSA2WgPKYbLTE yR1QGpnuS+cE9IgzzQK3ZLPZiHsdwEgRZ25ij/py+p2LR+qQ9UHD2IODYoGeUtYBD9Xp o8/NE+ETSxOgYVnKHUNm4kgn6nP7uUPZeARxh0cYEDTVhwKKqpvlfV+Yley0dZkuh6bm JOZPj4Ijo6dqKhewCipNXaAC2STjUgqqJ671dt0JCd2rQlWmbeUbDDlkMBXbXAOV6Mo9 ejrQ== X-Forwarded-Encrypted: i=1; AJvYcCV/UG97XINlnl87sssdqAIRD2op49y3mevDQ2c2ffqnYBdLw1SBz4Rj6dfy6pUy0shNdMpn+97flw/qlaY=@vger.kernel.org X-Gm-Message-State: AOJu0YxMV/uG6t1Xaej3sCgrVsnBvvtF5c63mByFvROOeBqbFLN9xm1L xoPrsuZve+qf9yyXzbD6FHXNSFBYjcrsEdeP+SdA1OSfeePhMrG+zI1n X-Gm-Gg: ASbGncvYJQbW2DZfXNXJOV1vaz+WZvDTKxkC7BIe9hRAFODi4r8RT9vhPP+nRfYE1a4 NYhPX8fvlAMNu1e4FPHkb3LsLVZTwZ8fBlUDSY0pNlMCxbgyYRiBddhJ8zspQQHnDCmswXA45HU 4/29Ka0lFvZOUdP1NW9SbjyWNngLJYNwkODn8Kr4vcIApAmmDJ2NeJpDtLcd/GiQA23dBwyw2rB RejAMcbpCcJjZNkCp5J8CskpuKy4iSChkS24eqBu2Jm2sJLeUmAySpnbsJCOxX6MAMorE+1Q1kQ Bu0YnDl6GqLOyM84ULLyIF8s75PMnnScKM0lgK9v34Uakc0dyQcJTokaqXjlcMfHUYO7f0Lskrv 4cZ61GYsH7LdKAjiR1uCHyK49UHaQSijE76/VgN5l2enrJ1lOHYyKccFeEwgRkrDnj8ZL068EBs aif1jO+fH+A81fy4ojd5E= X-Google-Smtp-Source: AGHT+IEBxiosM0ynntLWUxK9nKTH8YYNh2WJL8ba42XGeLyM+oQGqPneX/yA9YKSPCog6q5WrCrr6Q== X-Received: by 2002:a05:600c:3152:b0:458:a7fa:211d with SMTP id 5b1f17b1804b1-47904b24282mr314250375e9.29.1764687870109; Tue, 02 Dec 2025 07:04:30 -0800 (PST) Received: from [192.168.1.187] ([161.230.67.253]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47927808a3esm18576935e9.1.2025.12.02.07.04.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Dec 2025 07:04:29 -0800 (PST) Message-ID: Subject: Re: [PATCH v2 2/2] iio: adc: ad9467: support write/read offset From: Nuno =?ISO-8859-1?Q?S=E1?= To: Tomas Melin , Lars-Peter Clausen , Michael Hennerich , Nuno Sa , Jonathan Cameron , David Lechner , Andy Shevchenko , Alexandru Ardelean Cc: Jonathan Cameron , linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org Date: Tue, 02 Dec 2025 15:05:09 +0000 In-Reply-To: <8edcbe15-b3cf-4259-9d07-87c07f1f400e@vaisala.com> References: <20251202-ad9434-fixes-v2-0-fa73d4eabbea@vaisala.com> <20251202-ad9434-fixes-v2-2-fa73d4eabbea@vaisala.com> <5d343af235c499382bd2eac987357e857865b457.camel@gmail.com> <8edcbe15-b3cf-4259-9d07-87c07f1f400e@vaisala.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.58.2 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Tue, 2025-12-02 at 16:52 +0200, Tomas Melin wrote: > Hi, >=20 > On 02/12/2025 15:47, Nuno S=C3=A1 wrote: > > On Tue, 2025-12-02 at 12:53 +0000, Tomas Melin wrote: >=20 > > > =C2=A0static const struct iio_chan_spec ad9434_channels[] =3D { > > > - AD9467_CHAN(0, BIT(IIO_CHAN_INFO_SCALE), 0, 12, 's'), > > > + { > > > + .type =3D IIO_VOLTAGE, > > > + .indexed =3D 1, > > > + .channel =3D 0, > > > + .info_mask_shared_by_type =3D > > > + BIT(IIO_CHAN_INFO_SCALE) | > > > + BIT(IIO_CHAN_INFO_SAMP_FREQ) | > > > + BIT(IIO_CHAN_INFO_CALIBBIAS), > > > + .info_mask_shared_by_type_available =3D > > > + BIT(IIO_CHAN_INFO_SCALE) | > > > + BIT(IIO_CHAN_INFO_CALIBBIAS), > >=20 > > Odd style for info_mask_shared_by_type_available and info_mask_shared_b= y_type. Seems we have > > more line breaks than needed. > >=20 > Looking at existing code, there seems to many different ways to indent > these kind of lines. Can you please provide your preferred style? >=20 Looking at the same driver I would expect something like: https://elixir.bootlin.com/linux/v6.18/source/drivers/iio/adc/ad9467.c#L289 So, just break the line when the col limit is reached. >=20 > >=20 > > > + .scan_index =3D 0, > > > + .scan_type =3D { > > > + .sign =3D 's', > > > + .realbits =3D 12, > > > + .storagebits =3D 16, > > > + }, > > > + }, > > > =C2=A0}; > > > =C2=A0 > > > =C2=A0static const struct iio_chan_spec ad9467_channels[] =3D { > > > @@ -367,6 +389,7 @@ static const struct ad9467_chip_info ad9434_chip_= tbl =3D { > > > =C2=A0 .default_output_mode =3D AD9434_DEF_OUTPUT_MODE, > > > =C2=A0 .vref_mask =3D AD9434_REG_VREF_MASK, > > > =C2=A0 .num_lanes =3D 6, > > > + .offset_range =3D ad9434_offset_range, > > > =C2=A0}; > > > =C2=A0 > > > =C2=A0static const struct ad9467_chip_info ad9265_chip_tbl =3D { > > > @@ -499,6 +522,33 @@ static int ad9467_set_scale(struct ad9467_state = *st, int val, int val2) > > > =C2=A0 return -EINVAL; > > > =C2=A0} > > > =C2=A0 > > > +static int ad9467_get_offset(struct ad9467_state *st, int *val) > > > +{ > > > + int ret; > > > + > > > + ret =3D ad9467_spi_read(st, AN877_ADC_REG_OFFSET); > > > + if (ret < 0) > > > + return ret; > > > + *val =3D ret; > > > + > > > + return IIO_VAL_INT; > > > +} > > > + > > > +static int ad9467_set_offset(struct ad9467_state *st, int val) > > > +{ > > > + int ret; > > > + > > > + if (val < st->info->offset_range[0] || val > st->info->offset_range= [2]) > > > + return -EINVAL; > > > + > > > + ret =3D ad9467_spi_write(st, AN877_ADC_REG_OFFSET, val); > > > + if (ret < 0) > > > + return ret; > > > + /* Sync registers */ > >=20 > > I think this is not what David meant by adding a comment. IMHO, the com= ment as-is does not > > bring any added value. > The sync operation is needed in several places and is not commented in > other locations either. Do you prefer no comment or even more elaborate > comment for this particular sync operation? >=20 I know. I'm just stating the comment, as is, does not bring much value. But= I was not the one asking for it so I guess you should ask David :) - Nuno S=C3=A1