From: Jonathan Cameron <jic23@kernel.org>
To: David Lechner <dlechner@baylibre.com>
Cc: "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: proximity: sx9500: use stack allocated buffer for scan data
Date: Mon, 14 Jul 2025 19:26:03 +0100 [thread overview]
Message-ID: <20250714192603.5ed6ebdf@jic23-huawei> (raw)
In-Reply-To: <c4d143f1-0649-4f64-ac71-419a4b2b0fca@baylibre.com>
On Sun, 13 Jul 2025 11:47:56 -0500
David Lechner <dlechner@baylibre.com> wrote:
> On 7/13/25 8:58 AM, Jonathan Cameron wrote:
> > On Sun, 13 Jul 2025 14:55:33 +0100
> > Jonathan Cameron <jic23@kernel.org> wrote:
> >
> >> On Fri, 11 Jul 2025 19:42:25 +0300
> >> Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> >>
> >>> On Fri, Jul 11, 2025 at 10:47:57AM -0500, David Lechner wrote:
> >>>> Use IIO_DECLARE_BUFFER_WITH_TS() to declare a stack allocated buffer
> >>>> in sx9500_trigger_handler(). Since the scan buffer isn't used outside
> >>>> of this function, it doesn't need to be in struct sx9500_data.
> >>>>
> >>>> By always allocating enough space for the maximum number of channels,
> >>>> we can avoid having to reallocate the buffer each time buffered reads
> >>>> are enabled.
> >>>
> >>> Ag ood one!
> >>>
> >>> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> >>>
> >>
> >> Applied.
> >>
> >
> > Actually on second thoughts - why not a more descriptive structure?
> > There are only a max of 4 channels and so the timestamp is always
> > in the same location.
> >
> > Dropped for now.
> >
> > Jonathan
>
> I didn't do that on this one since a variable number of scan
> elements are used. But if you prefer structs for anything up
> to 8 bytes, we can go with that.
I think that makes sense as we don't really care 'what' is in the
holes when fewer channels are enabled.
Jonathan
prev parent reply other threads:[~2025-07-14 18:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-11 15:47 [PATCH] iio: proximity: sx9500: use stack allocated buffer for scan data David Lechner
2025-07-11 16:42 ` Andy Shevchenko
2025-07-13 13:55 ` Jonathan Cameron
2025-07-13 13:58 ` Jonathan Cameron
2025-07-13 16:47 ` David Lechner
2025-07-14 18:26 ` Jonathan Cameron [this message]
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=20250714192603.5ed6ebdf@jic23-huawei \
--to=jic23@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
/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