Linux IIO development
 help / color / mirror / Atom feed
From: Atul Raut <rauji.raut@gmail.com>
To: cosmin.tanislav@analog.com, lars@metafoo.de,
	Michael.Hennerich@analog.com, jic23@kernel.org
Cc: linux-iio@vger.kernel.org,
	linux-kernel-mentees@lists.linuxfoundation.org
Subject: [PATCH] iio: accel: Replace zero-length arrays with DECLARE_FLEX_ARRAY() helper
Date: Sun, 30 Jul 2023 18:44:06 -0700	[thread overview]
Message-ID: <20230731014406.22810-1-rauji.raut@gmail.com> (raw)

Replacing zero-length arrays with C99 flexible-array
members since they are obsolete.
Use the new DECLARE_FLEX_ARRAY() auxiliary macro instead
of defining a zero-length array.

This fixes warnings such as:
./drivers/iio/accel/adxl367_spi.c:38:6-17: WARNING use flexible-array member instead (https://www.kernel.org/doc/html/latest/process/deprecated.html#zero-length-and-one-element-arrays)

Signed-off-by: Atul Raut <rauji.raut@gmail.com>
---
 drivers/iio/accel/adxl367_spi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/accel/adxl367_spi.c b/drivers/iio/accel/adxl367_spi.c
index 118c894015a5..9dc61cb45fc5 100644
--- a/drivers/iio/accel/adxl367_spi.c
+++ b/drivers/iio/accel/adxl367_spi.c
@@ -35,7 +35,7 @@ struct adxl367_spi_state {
 	 */
 	u8			reg_write_tx_buf[1] __aligned(IIO_DMA_MINALIGN);
 	u8			reg_read_tx_buf[2];
-	u8			fifo_tx_buf[1];
+	DECLARE_FLEX_ARRAY(u8,			fifo_tx_buf);
 };
 
 static int adxl367_read_fifo(void *context, __be16 *fifo_buf,
-- 
2.34.1


             reply	other threads:[~2023-07-31  1:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-31  1:44 Atul Raut [this message]
2023-07-31 10:08 ` [PATCH] iio: accel: Replace zero-length arrays with DECLARE_FLEX_ARRAY() helper 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=20230731014406.22810-1-rauji.raut@gmail.com \
    --to=rauji.raut@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=cosmin.tanislav@analog.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.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