Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795987144; b=v2X7rD8Q1tR5T7OFqLthYlopBu2jpiaAX+xao+2Z6VNleeQOUqU3JR3bm76wmRHrDP+J C0zytP21zO2cp5+f/1ga0iQas/yLxM5MjHrdAHSS9cn4KP4QtsryH4th/RYSTVIKqcZR4 8mHjTz0D/tpDmMut4lG9DFno/arEDSjV25xaGTySejJ2StjUZjohnCxA+0fXpi6QKIan1 PS7XxUUT1vQvha7WTTjrQCwlDAMGbZIPwoXZTSL9VhZekXycM6sAKPkelgxdaZVWejMih zGav42DGMKe9S8FAduEx1zXUuwAoRwqGytD0GkEjkliPssg6MFSeU2jzPRNB/FHwm/g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795987144; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: In-Reply-To:References:X-Mailer:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=O7DeSJKRSVkElLduW0eqJbvnM2n82h7luzNipRQKex8=; b=OzFwvKtPN9tS0kP9gVeDpY+B5iOJjYPDxEtoY6wYpd5y1pHYIy37Mpmk6CFiOMoBhPLt nCFU1HLYmvAKLfX1fvyfMGx6egH2g78x6n1ctdJIeavqB0+imnE+ytBJBWigGRyx3ZE5L Kog5W0WimPp7jRy07qzEoBeWoY8Y/FavIvls+/+9cZW3/PEvaqA1Gpsgv5Vi6czNx5kax b7jliIDEAQPmgJhVlvCIkci2eZLTw+t+5eWleV3XIhiPMolmf0EtNFOgyymfUpLiANRuE GozzOKzm96gQe1VUUpdduOW5XcaCc9PVjTtwoTbOuPVdqN8lQPUVAXXLF9gT6qcFDrA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gpAbhy5x; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A118E606A327 for ; Sun, 29 Nov 2026 21:19:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gpAbhy5x Received: by smtp.kernel.org (Postfix) with ESMTPSA id 98E711F00896; Sun, 29 Nov 2026 21:19:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795987144; bh=O7DeSJKRSVkElLduW0eqJbvnM2n82h7luzNipRQKex8=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=gpAbhy5x0i7ohGvsDTw6iyJBiAO5wCm3q9V1QOjqgo/8nKKQvp1NrRlPTOEMqbR6m YxP+E8qex2aTrJQ+SkgOu9oAD+L4x+GmBeMYv09leZGtL65kt+doDwO1+46MnMavzJ jyGE2/xaXbtov2uSQ6jOMRHrmLZDeF9YSMd4kCOv7lG5tX4SueFvDOOytYE9Svlg/y BVUEx9JrBZbK7OIpYiBHmjJVU1rxjht284bqWQFxR0LP0G1/mHPZsZbiLjfCRUpqjg u6yCILdI2Rzav6bNZmyk9pZRUkdBM3QZfJf899t9zPOeE1nzyPnF5pTMDN1cdBHh3o HSlrelUBpU+7Q== Date: Sun, 29 Nov 2026 21:18:56 +0000 From: Jonathan Cameron To: srinivas pandruvada Cc: linux-iio@vger.kernel.org, David Lechner , Nuno =?UTF-8?B?U8Oh?= , Andy Shevchenko , Jiri Kosina , Zhang Lixu Subject: Re: [PATCH 05/39] iio: hid-sensors: use iio_push_to_buffers_with_ts() Message-ID: <20261129211856.492e8e2f@jic23-hlaptop> In-Reply-To: <20261115202359.1b4724d5@jic23-hlaptop> References: <20261026-iio-v1-0-8b136778eedf@oss.qualcomm.com> <20261026-iio-v1-5-8b136778eedf@oss.qualcomm.com> <60eab26805ad63d1b39d80fb9a47b0ba9bb5789d.camel@linux.intel.com> <20261108203306.1599d000@jic23-hlaptop> <20261115202359.1b4724d5@jic23-hlaptop> X-Mailer: Claws Mail 4.4.0 (GTK 3.24.52; x86_64-pc-linux-gnu) X-Mailing-List: linux-iio@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Sun, 15 Nov 2026 20:23:59 +0000 Jonathan Cameron wrote: > On Sun, 15 Nov 2026 12:06:03 -0800 > srinivas pandruvada wrote: >=20 > > Hi Jonathan, > > On Sun, 2026-11-08 at 20:33 +0000, Jonathan Cameron wrote: =20 > > > On Mon, 26 Oct 2026 17:06:23 -0700 > > > srinivas pandruvada wrote: > > > =20 > > > > On Mon, 2026-10-26 at 16:05 -0700, Jonathan Cameron wrote: =20 > > > > > Replace the deprecated iio_push_to_buffers_with_timestamp() with > > > > > iio_push_to_buffers_with_ts(), passing the size of the pushed > > > > > buffer. > > > > >=20 > > > > > For hid-sensor-magn-3d, use IIO_DECLARE_BUFFER_WITH_TS() to suize > > > > > the > > > > > buffer for the maximum number of channels supported avoiding need > > > > > for separate allocation. > > > > >=20 > > > > > Signed-off-by: Jonathan Cameron > > > > > =C2=A0 =20 > > > >=20 > > > > LGTM. > > > > I will do some quick test on this and let you know. =20 > > >=20 > > > No huge rush.=C2=A0 This is the only one I'm going to leave unapplied > > > that doesn't need changes (as far as I know!) for now. > > > =20 > >=20 > > Tested-by: Srinivas Pandruvada > > =20 > Thanks. Applied. Huh. I lost it somehow. Might be have side effect of rebase given the devm_kzalloc_objs() mass conversion. Applied now. >=20 > > Thanks, > > Srinivas > >=20 > > =20 > > > Thanks, > > >=20 > > > Jonathan > > > =20 > > > >=20 > > > > Thanks, > > > > Srinivas > > > > =20 > > > > > --- > > > > > Cc: Jiri Kosina > > > > > Cc: Srinivas Pandruvada > > > > > Cc: Zhang Lixu > > > > > --- > > > > > =C2=A0drivers/iio/gyro/hid-sensor-gyro-3d.c=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 5 += ++-- > > > > > =C2=A0drivers/iio/humidity/hid-sensor-humidity.c=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 5 +++-- > > > > > =C2=A0drivers/iio/magnetometer/hid-sensor-magn-3d.c=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 | 21 ++++++- > > > > > ---- > > > > > ---------- > > > > > =C2=A0drivers/iio/orientation/hid-sensor-incl-3d.c=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 7 ++++--- > > > > > =C2=A0.../iio/position/hid-sensor-custom-intel-hinge.c=C2=A0=C2= =A0=C2=A0 |=C2=A0 4 ++-- > > > > > =C2=A05 files changed, 18 insertions(+), 24 deletions(-) > > > > >=20 > > > > > diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c > > > > > b/drivers/iio/gyro/hid-sensor-gyro-3d.c > > > > > index 66778315e86d..083e82cf561c 100644 > > > > > --- a/drivers/iio/gyro/hid-sensor-gyro-3d.c > > > > > +++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c > > > > > @@ -182,8 +182,9 @@ static int gyro_3d_proc_event(struct > > > > > hid_sensor_hub_device *hsdev, > > > > > =C2=A0 if (!gyro_state->timestamp) > > > > > =C2=A0 gyro_state->timestamp =3D > > > > > iio_get_time_ns(indio_dev); > > > > > =C2=A0 > > > > > - iio_push_to_buffers_with_timestamp(indio_dev, > > > > > &gyro_state->scan, > > > > > - =C2=A0=C2=A0 gyro_state-=C2=A0 =20 > > > > > > timestamp);=C2=A0 =20 > > > > > + iio_push_to_buffers_with_ts(indio_dev, > > > > > &gyro_state-=C2=A0 =20 > > > > > > scan,=C2=A0 =20 > > > > > + =C2=A0=C2=A0=C2=A0 sizeof(gyro_state-=C2=A0 =20 > > > > > > scan),=C2=A0 =20 > > > > > + =C2=A0=C2=A0=C2=A0 gyro_state- =20 > > > > > >timestamp); =20 > > > > > =C2=A0 > > > > > =C2=A0 gyro_state->timestamp =3D 0; > > > > > =C2=A0 } > > > > > diff --git a/drivers/iio/humidity/hid-sensor-humidity.c > > > > > b/drivers/iio/humidity/hid-sensor-humidity.c > > > > > index 12c88efe66be..c09986346c8f 100644 > > > > > --- a/drivers/iio/humidity/hid-sensor-humidity.c > > > > > +++ b/drivers/iio/humidity/hid-sensor-humidity.c > > > > > @@ -132,8 +132,9 @@ static int humidity_proc_event(struct > > > > > hid_sensor_hub_device *hsdev, > > > > > =C2=A0 struct hid_humidity_state *humid_st =3D > > > > > iio_priv(indio_dev); > > > > > =C2=A0 > > > > > =C2=A0 if (atomic_read(&humid_st- =20 > > > > > >common_attributes.data_ready)) =20 > > > > > - iio_push_to_buffers_with_timestamp(indio_dev, > > > > > &humid_st->scan, > > > > > - =C2=A0=C2=A0 > > > > > iio_get_time_ns(indio_dev)); > > > > > + iio_push_to_buffers_with_ts(indio_dev, > > > > > &humid_st-=C2=A0 =20 > > > > > > scan,=C2=A0 =20 > > > > > + =C2=A0=C2=A0=C2=A0 sizeof(humid_st- =20 > > > > > >scan), =20 > > > > > + =C2=A0=C2=A0=C2=A0 > > > > > iio_get_time_ns(indio_dev)); > > > > > =C2=A0 > > > > > =C2=A0 return 0; > > > > > =C2=A0} > > > > > diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c > > > > > b/drivers/iio/magnetometer/hid-sensor-magn-3d.c > > > > > index c8b4fa7785c9..f869560b47fc 100644 > > > > > --- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c > > > > > +++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c > > > > > @@ -37,8 +37,8 @@ struct magn_3d_state { > > > > > =C2=A0 struct hid_sensor_common rot_attributes; > > > > > =C2=A0 struct hid_sensor_hub_attribute_info > > > > > magn[MAGN_3D_CHANNEL_MAX]; > > > > > =C2=A0 > > > > > - /* dynamically sized array to hold sensor values */ > > > > > - u32 *iio_vals; > > > > > + /* array sized to hold maximum set of sensor values */ > > > > > + IIO_DECLARE_BUFFER_WITH_TS(u32, iio_vals, > > > > > MAGN_3D_CHANNEL_MAX); > > > > > =C2=A0 /* array of pointers to sensor value */ > > > > > =C2=A0 u32 *magn_val_addr[MAGN_3D_CHANNEL_MAX]; > > > > > =C2=A0 > > > > > @@ -275,9 +275,10 @@ static int magn_3d_proc_event(struct > > > > > hid_sensor_hub_device *hsdev, > > > > > =C2=A0 if (!magn_state->timestamp) > > > > > =C2=A0 magn_state->timestamp =3D > > > > > iio_get_time_ns(indio_dev); > > > > > =C2=A0 > > > > > - iio_push_to_buffers_with_timestamp(indio_dev, > > > > > - =C2=A0=C2=A0 magn_state-=C2=A0 =20 > > > > > > iio_vals,=C2=A0 =20 > > > > > - =C2=A0=C2=A0 magn_state-=C2=A0 =20 > > > > > > timestamp);=C2=A0 =20 > > > > > + iio_push_to_buffers_with_ts(indio_dev, > > > > > + =C2=A0=C2=A0=C2=A0 magn_state- =20 > > > > > >iio_vals, =20 > > > > > + =C2=A0=C2=A0=C2=A0 sizeof(magn_state-=C2=A0 =20 > > > > > > iio_vals),=C2=A0 =20 > > > > > + =C2=A0=C2=A0=C2=A0 magn_state- =20 > > > > > >timestamp); =20 > > > > > =C2=A0 magn_state->timestamp =3D 0; > > > > > =C2=A0 } > > > > > =C2=A0 > > > > > @@ -379,16 +380,6 @@ static int magn_3d_parse_report(struct > > > > > platform_device *pdev, > > > > > =C2=A0 return -ENOMEM; > > > > > =C2=A0 } > > > > > =C2=A0 > > > > > - /* attr_count include timestamp channel, and the > > > > > iio_vals > > > > > should be aligned to 8byte */ > > > > > - st->iio_vals =3D devm_kcalloc(&pdev->dev, > > > > > - =C2=A0=C2=A0=C2=A0 ((attr_count + 1) % 2 + > > > > > (attr_count + 1) / 2) * 2, > > > > > - =C2=A0=C2=A0=C2=A0 sizeof(u32), GFP_KERNEL); > > > > > - if (!st->iio_vals) { > > > > > - dev_err(&pdev->dev, > > > > > - "failed to allocate space for iio values > > > > > array\n"); > > > > > - return -ENOMEM; > > > > > - } > > > > > - > > > > > =C2=A0 for (i =3D 0, *chan_count =3D 0; > > > > > =C2=A0 i < MAGN_3D_CHANNEL_MAX && *chan_count < attr_count; > > > > > =C2=A0 i++){ > > > > > diff --git a/drivers/iio/orientation/hid-sensor-incl-3d.c > > > > > b/drivers/iio/orientation/hid-sensor-incl-3d.c > > > > > index b5f70732d035..3880e479a499 100644 > > > > > --- a/drivers/iio/orientation/hid-sensor-incl-3d.c > > > > > +++ b/drivers/iio/orientation/hid-sensor-incl-3d.c > > > > > @@ -194,9 +194,10 @@ static int incl_3d_proc_event(struct > > > > > hid_sensor_hub_device *hsdev, > > > > > =C2=A0 if (!incl_state->timestamp) > > > > > =C2=A0 incl_state->timestamp =3D > > > > > iio_get_time_ns(indio_dev); > > > > > =C2=A0 > > > > > - iio_push_to_buffers_with_timestamp(indio_dev, > > > > > - =C2=A0=C2=A0 &incl_state-=C2=A0 =20 > > > > > > scan,=C2=A0 =20 > > > > > - =C2=A0=C2=A0 incl_state-=C2=A0 =20 > > > > > > timestamp);=C2=A0 =20 > > > > > + iio_push_to_buffers_with_ts(indio_dev, > > > > > + =C2=A0=C2=A0=C2=A0 &incl_state->scan, > > > > > + =C2=A0=C2=A0=C2=A0 sizeof(incl_state-=C2=A0 =20 > > > > > > scan),=C2=A0 =20 > > > > > + =C2=A0=C2=A0=C2=A0 incl_state- =20 > > > > > >timestamp); =20 > > > > > =C2=A0 > > > > > =C2=A0 incl_state->timestamp =3D 0; > > > > > =C2=A0 } > > > > > diff --git a/drivers/iio/position/hid-sensor-custom-intel-hinge.c > > > > > b/drivers/iio/position/hid-sensor-custom-intel-hinge.c > > > > > index 101d84b533c9..98a5e3e03bba 100644 > > > > > --- a/drivers/iio/position/hid-sensor-custom-intel-hinge.c > > > > > +++ b/drivers/iio/position/hid-sensor-custom-intel-hinge.c > > > > > @@ -198,8 +198,8 @@ static int hinge_proc_event(struct > > > > > hid_sensor_hub_device *hsdev, > > > > > =C2=A0 if (!st->timestamp) > > > > > =C2=A0 st->timestamp =3D > > > > > iio_get_time_ns(indio_dev); > > > > > =C2=A0 > > > > > - iio_push_to_buffers_with_timestamp(indio_dev, > > > > > &st-=C2=A0 =20 > > > > > > scan,=C2=A0 =20 > > > > > - =C2=A0=C2=A0 st- =20 > > > > > >timestamp); =20 > > > > > + iio_push_to_buffers_with_ts(indio_dev, &st- =20 > > > > > >scan, =20 > > > > > + =C2=A0=C2=A0=C2=A0 sizeof(st->scan), > > > > > st-=C2=A0 =20 > > > > > > timestamp);=C2=A0 =20 > > > > > =C2=A0 > > > > > =C2=A0 st->timestamp =3D 0; > > > > > =C2=A0 }=C2=A0 =20 > > > > =20 >=20 >=20