From: "Nuno Sá" <noname.nuno@gmail.com>
To: "Jonathan Cameron" <jic23@kernel.org>,
"Nuno Sá via B4 Relay" <devnull+nuno.sa.analog.com@kernel.org>
Cc: nuno.sa@analog.com, linux-iio@vger.kernel.org,
David Lechner <dlechner@baylibre.com>,
Andy Shevchenko <andy@kernel.org>
Subject: Re: [PATCH v2 4/6] iio: buffer-dma: Fix coding style complains
Date: Mon, 22 Dec 2025 12:38:26 +0000 [thread overview]
Message-ID: <3cf8fa55396b520f0f933477b0e5ec723a79f406.camel@gmail.com> (raw)
In-Reply-To: <20251221115950.7cbb5848@jic23-huawei>
On Sun, 2025-12-21 at 11:59 +0000, Jonathan Cameron wrote:
> On Fri, 19 Dec 2025 15:28:15 +0000
> Nuno Sá via B4 Relay <devnull+nuno.sa.analog.com@kernel.org> wrote:
>
> > From: Nuno Sá <nuno.sa@analog.com>
> >
> > Just making sure checkpatch is happy. No functional change intended.
> >
> > Signed-off-by: Nuno Sá <nuno.sa@analog.com>
> I made a couple of small tweaks whilst applying this one. See below.
>
LGTM... Thanks!
- Nuno Sá
> Jonathan
>
> > ---
> > drivers/iio/buffer/industrialio-buffer-dma.c | 23 ++++++++++-------------
> > include/linux/iio/buffer-dma.h | 16 ++++++++++------
> > 2 files changed, 20 insertions(+), 19 deletions(-)
> >
> > diff --git a/drivers/iio/buffer/industrialio-buffer-dma.c b/drivers/iio/buffer/industrialio-
> > buffer-dma.c
> > index 3ab1349f9ea5..c5ee58effc92 100644
> > --- a/drivers/iio/buffer/industrialio-buffer-dma.c
> > +++ b/drivers/iio/buffer/industrialio-buffer-dma.c
> > @@ -169,8 +169,9 @@ static struct iio_dma_buffer_queue *iio_buffer_to_queue(struct iio_buffer
> > *buf)
> > return container_of(buf, struct iio_dma_buffer_queue, buffer);
> > }
> >
> > -static struct iio_dma_buffer_block *iio_dma_buffer_alloc_block(
> > - struct iio_dma_buffer_queue *queue, size_t size, bool fileio)
> > +static struct iio_dma_buffer_block *iio_dma_buffer_alloc_block(struct iio_dma_buffer_queue
> > *queue,
> > + size_t size,
> > + bool fileio)
> For this one I'd split it as:
>
> static struct iio_dma_buffer_block *
> iio_dma_buffer_alloc_block(struct iio_dma_buffer_queue *queue, size_t size,
> bool fileio)
>
> > {
> > struct iio_dma_buffer_block *block __free(kfree) =
> > kzalloc(sizeof(*block), GFP_KERNEL);
> > @@ -254,7 +255,7 @@ EXPORT_SYMBOL_NS_GPL(iio_dma_buffer_block_done, "IIO_DMA_BUFFER");
> > * hand the blocks back to the queue.
> > */
> > void iio_dma_buffer_block_list_abort(struct iio_dma_buffer_queue *queue,
> > - struct list_head *list)
> > + struct list_head *list)
> > {
> > struct iio_dma_buffer_block *block, *_block;
> > bool cookie;
> > @@ -434,7 +435,7 @@ static void iio_dma_buffer_fileio_free(struct iio_dma_buffer_queue *queue)
> > }
> >
> > static void iio_dma_buffer_submit_block(struct iio_dma_buffer_queue *queue,
> > - struct iio_dma_buffer_block *block)
> > + struct iio_dma_buffer_block *block)
> > {
> > int ret;
> >
> > @@ -478,8 +479,7 @@ static void iio_dma_buffer_submit_block(struct iio_dma_buffer_queue *queue,
> > *
> > * This will allocate the DMA buffers and start the DMA transfers.
> > */
> > -int iio_dma_buffer_enable(struct iio_buffer *buffer,
> > - struct iio_dev *indio_dev)
> > +int iio_dma_buffer_enable(struct iio_buffer *buffer, struct iio_dev *indio_dev)
> > {
> > struct iio_dma_buffer_queue *queue = iio_buffer_to_queue(buffer);
> > struct iio_dma_buffer_block *block, *_block;
> > @@ -503,8 +503,7 @@ EXPORT_SYMBOL_NS_GPL(iio_dma_buffer_enable, "IIO_DMA_BUFFER");
> > * Needs to be called when the device that the buffer is attached to stops
> > * sampling. Typically should be the iio_buffer_access_ops disable callback.
> > */
> > -int iio_dma_buffer_disable(struct iio_buffer *buffer,
> > - struct iio_dev *indio_dev)
> > +int iio_dma_buffer_disable(struct iio_buffer *buffer, struct iio_dev *indio_dev)
> > {
> > struct iio_dma_buffer_queue *queue = iio_buffer_to_queue(buffer);
> >
> > @@ -519,7 +518,7 @@ int iio_dma_buffer_disable(struct iio_buffer *buffer,
> > EXPORT_SYMBOL_NS_GPL(iio_dma_buffer_disable, "IIO_DMA_BUFFER");
> >
> > static void iio_dma_buffer_enqueue(struct iio_dma_buffer_queue *queue,
> > - struct iio_dma_buffer_block *block)
> > + struct iio_dma_buffer_block *block)
> > {
> > if (block->state == IIO_BLOCK_STATE_DEAD) {
> > iio_buffer_block_put(block);
> > @@ -531,8 +530,7 @@ static void iio_dma_buffer_enqueue(struct iio_dma_buffer_queue *queue,
> > }
> > }
> >
> > -static struct iio_dma_buffer_block *iio_dma_buffer_dequeue(
> > - struct iio_dma_buffer_queue *queue)
> > +static struct iio_dma_buffer_block *iio_dma_buffer_dequeue(struct iio_dma_buffer_queue *queue)
>
> static struct iio_dma_buffer_block *
> iio_dma_buffer_dequeue(struct iio_dma_buffer_queue *queue)
>
> is a bit nicer than that long line to my eyes and common enough style.
>
> > {
> > struct iio_dma_buffer_block *block;
> > unsigned int idx;
> > @@ -661,8 +659,7 @@ size_t iio_dma_buffer_usage(struct iio_buffer *buf)
> > for (i = 0; i < ARRAY_SIZE(queue->fileio.blocks); i++) {
> > block = queue->fileio.blocks[i];
> >
> > - if (block != queue->fileio.active_block
> > - && block->state == IIO_BLOCK_STATE_DONE)
> > + if (block != queue->fileio.active_block && block->state ==
> > IIO_BLOCK_STATE_DONE)
> > data_available += block->size;
> > }
> >
> > diff --git a/include/linux/iio/buffer-dma.h b/include/linux/iio/buffer-dma.h
> > index 91f678e5be71..f794af0970bd 100644
> > --- a/include/linux/iio/buffer-dma.h
> > +++ b/include/linux/iio/buffer-dma.h
> > @@ -119,7 +119,12 @@ struct iio_dma_buffer_queue {
> > struct device *dev;
> > const struct iio_dma_buffer_ops *ops;
> >
> > + /*
> > + * A mutex to protect accessing, configuring (eg: enqueuing DMA blocks)
> > + * and do file IO on struct iio_dma_buffer_queue objects.
> > + */
> > struct mutex lock;
> > + /* A spin lock to protect adding/removing blocks to the queue list */
> > spinlock_t list_lock;
> > struct list_head incoming;
> >
> > @@ -136,20 +141,19 @@ struct iio_dma_buffer_queue {
> > */
> > struct iio_dma_buffer_ops {
> > int (*submit)(struct iio_dma_buffer_queue *queue,
> > - struct iio_dma_buffer_block *block);
> > + struct iio_dma_buffer_block *block);
> > void (*abort)(struct iio_dma_buffer_queue *queue);
> > };
> >
> > void iio_dma_buffer_block_done(struct iio_dma_buffer_block *block);
> > void iio_dma_buffer_block_list_abort(struct iio_dma_buffer_queue *queue,
> > - struct list_head *list);
> > + struct list_head *list);
> >
> > -int iio_dma_buffer_enable(struct iio_buffer *buffer,
> > - struct iio_dev *indio_dev);
> > +int iio_dma_buffer_enable(struct iio_buffer *buffer, struct iio_dev *indio_dev);
> > int iio_dma_buffer_disable(struct iio_buffer *buffer,
> > - struct iio_dev *indio_dev);
> > + struct iio_dev *indio_dev);
> > int iio_dma_buffer_read(struct iio_buffer *buffer, size_t n,
> > - char __user *user_buffer);
> > + char __user *user_buffer);
> > int iio_dma_buffer_write(struct iio_buffer *buffer, size_t n,
> > const char __user *user_buffer);
> > size_t iio_dma_buffer_usage(struct iio_buffer *buffer);
> >
next prev parent reply other threads:[~2025-12-22 12:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-19 15:28 [PATCH v2 0/6] iio: buffer-dma: Minor cleanups and improvements Nuno Sá via B4 Relay
2025-12-19 15:28 ` [PATCH v2 1/6] iio: buffer-dma: Use lockdep for locking annotations Nuno Sá via B4 Relay
2025-12-19 15:28 ` [PATCH v2 2/6] iio: buffer-dma: Use the cleanup.h API Nuno Sá via B4 Relay
2025-12-19 15:28 ` [PATCH v2 3/6] iio: buffer-dma: Turn iio_dma_buffer_init() void Nuno Sá via B4 Relay
2025-12-19 15:28 ` [PATCH v2 4/6] iio: buffer-dma: Fix coding style complains Nuno Sá via B4 Relay
2025-12-21 11:59 ` Jonathan Cameron
2025-12-22 12:38 ` Nuno Sá [this message]
2025-12-19 15:28 ` [PATCH v2 5/6] iio: buffer-dmaengine: Use the cleanup.h API Nuno Sá via B4 Relay
2025-12-21 12:01 ` Jonathan Cameron
2025-12-22 12:40 ` Nuno Sá
2025-12-19 15:28 ` [PATCH v2 6/6] iio: buffer-dmaengine: Fix coding style complains Nuno Sá via B4 Relay
2025-12-21 12:02 ` [PATCH v2 0/6] iio: buffer-dma: Minor cleanups and improvements Jonathan Cameron
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=3cf8fa55396b520f0f933477b0e5ec723a79f406.camel@gmail.com \
--to=noname.nuno@gmail.com \
--cc=andy@kernel.org \
--cc=devnull+nuno.sa.analog.com@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=linux-iio@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