From: "Nuno Sá" <noname.nuno@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>,
Robert Budai <robert.budai@analog.com>
Cc: Nuno Sa <nuno.sa@analog.com>,
Ramona Gradinariu <ramona.gradinariu@analog.com>,
Antoniu Miclaus <antoniu.miclaus@analog.com>,
Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
Jonathan Corbet <corbet@lwn.net>,
Alex Lanzano <lanzano.alex@gmail.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Subject: Re: [PATCH v4 5/6] iio: imu: adis16550: add adis16550 support
Date: Mon, 13 Jan 2025 09:36:38 +0000 [thread overview]
Message-ID: <c5bbfd1555a8a141caca944f2bb1b6eccb88fd67.camel@gmail.com> (raw)
In-Reply-To: <20250112161141.563064c2@jic23-huawei>
On Sun, 2025-01-12 at 16:11 +0000, Jonathan Cameron wrote:
> On Fri, 10 Jan 2025 09:42:53 +0200
> Robert Budai <robert.budai@analog.com> wrote:
>
> > The ADIS16550 is a complete inertial system that includes a triaxis
> > gyroscope and a triaxis accelerometer. Each inertial sensor in
> > the ADIS16550 combines industry leading MEMS only technology
> > with signal conditioning that optimizes dynamic performance. The
> > factory calibration characterizes each sensor for sensitivity, bias,
> > and alignment. As a result, each sensor has its own dynamic com-
> > pensation formulas that provide accurate sensor measurements
> >
> > Co-developed-by: Ramona Gradinariu <ramona.gradinariu@analog.com>
> > Signed-off-by: Ramona Gradinariu <ramona.gradinariu@analog.com>
> > Co-developed-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
> > Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
> > Signed-off-by: Nuno Sá <nuno.sa@analog.com>
> > Signed-off-by: Robert Budai <robert.budai@analog.com>
> > ---
> >
> > 4:
> > - reorganized channels to match the order in the datasheet
> > - removed extra checks and goto statements
> > - for buffer memory allocation used only kfree, since adis library already
> > takes care of freeing the buffer
>
> That last bit makes for a mess wrt to who owns the buffer and lifetime
> management. Suggestions inline.
>
>
...
> > +
> > + /*
> > + * Allocate the xfer and buffer for the burst read operation. The
> > buffer
> > + * is used to store the burst data and the xfer is used to send the
> > burst
> > + * command and receive the data. On device remove the adis libraary
> > is going
>
> library.
>
> > + * to free the xfer and buffer.
>
> That is a horrible lifetime control. They should either be allocated in the
> library
> and freed in the library or allocated and freed in the driver. Mixing that
> doesn't
> make sense.
Agreed. TBH, I did not remembered at all to suggest ignoring the library and let
it call kfree() on NULL. I also don't like that much of how things are done in
the lib but I don't think it would be that straight to change things for the non
'burst mode' cases. For the devices implementing 'burst mode' doing the free +
allocation on every update_scan_modes seems unnecessary. Anyways, maybe
something worth looking at in the future.
- Nuno Sá
next prev parent reply other threads:[~2025-01-13 9:36 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 7:42 [PATCH v4 0/6] Add support for ADIS16550 and ADIS16550W Robert Budai
2025-01-10 7:42 ` [PATCH v4 1/6] iio: imu: adis: Add custom ops struct Robert Budai
2025-01-10 7:42 ` [PATCH v4 2/6] iio: imu: adis: Add reset to custom ops Robert Budai
2025-01-12 15:35 ` Jonathan Cameron
2025-01-10 7:42 ` [PATCH v4 3/6] iio: imu: adis: Add DIAG_STAT register size Robert Budai
2025-01-12 15:39 ` Jonathan Cameron
2025-01-10 7:42 ` [PATCH v4 4/6] dt-bindings: iio: Add adis16550 bindings Robert Budai
2025-01-12 15:48 ` Jonathan Cameron
2025-01-13 9:29 ` Nuno Sá
2025-01-13 14:22 ` Budai, Robert
2025-01-14 8:19 ` Nuno Sá
2025-01-13 8:43 ` Krzysztof Kozlowski
2025-01-15 13:35 ` Budai, Robert
2025-01-10 7:42 ` [PATCH v4 5/6] iio: imu: adis16550: add adis16550 support Robert Budai
2025-01-11 12:03 ` kernel test robot
2025-01-12 15:33 ` Jonathan Cameron
2025-01-12 4:20 ` kernel test robot
2025-01-12 16:11 ` Jonathan Cameron
2025-01-13 9:36 ` Nuno Sá [this message]
2025-01-13 9:48 ` Nuno Sá
2025-01-10 7:42 ` [PATCH v4 6/6] docs: iio: add documentation for adis16550 driver Robert Budai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c5bbfd1555a8a141caca944f2bb1b6eccb88fd67.camel@gmail.com \
--to=noname.nuno@gmail.com \
--cc=Michael.Hennerich@analog.com \
--cc=antoniu.miclaus@analog.com \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lanzano.alex@gmail.com \
--cc=lars@metafoo.de \
--cc=linux-doc@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=ramona.gradinariu@analog.com \
--cc=robert.budai@analog.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox