Skip to contentSkip to conversation

IIO get to warning free for W=1 C=1

PATCH In review Jonathan Cameron 2 participants 10 messages Sep 13, 2020 – Sep 19, 2020

Subsystems (2)
lore
Share & tools
lore

Jonathan Cameron

author maintainer
#0 lore raw

cover IIO get to warning free for W=1 C=1

From: Jonathan Cameron <[email protected]>

Hi All,

Lee did most of the leg work for this last cycle, but there were a few things left. This set only gets us to warning free if we also have the half dozen more significant fixes on the mailing list, remains of Lee's early 2 patch sets and
[PATCH] kernel-doc: add support for ____cacheline_aligned attribute

I have a local version of the left over parts of Lee's series with the ____cacheline_aligned bits dropped but see no reason to waste review bandwidth by posting that again. Assuming the above patch is accepted I'll apply those directly to the togreg branch and reply to the original thread.

Note of course that this is warning free on my particular setup with gcc x86_64 10.2 on other peoples particular configurations there may still be warnings. If there are let me know or send a fix!

I have also deliberately not cleaned up the warnings in the drivers still in staging as they make good tasks for people new to sending patches.

Jonathan Cameron (3):
iio:imu:adis16400: Sort out missing kernel doc.
iio: Add __printf() attributes to various allocation functions iio:core: Tidy up kernel-doc.

 drivers/iio/imu/adis16400.c          | 2 ++
 drivers/iio/industrialio-core.c      | 3 ++-
 drivers/iio/industrialio-trigger.c   | 2 +-
 include/linux/iio/iio.h              | 4 ++--
 include/linux/iio/trigger_consumer.h | 2 +-
 5 files changed, 8 insertions(+), 5 deletions(-)
Signature · 1 line
2.28.0
author maintainer
#1 lore raw

PATCH 1/3 iio:imu:adis16400: Sort out missing kernel doc.

From: Jonathan Cameron <[email protected]>

I'd like to be enable W=1 for all IIO builds as it catches real issues as well as more minor documentation issues such as this (also good to fix though!)

drivers/iio/imu/adis16400.c:183: warning: Function parameter or member 'avail_scan_mask' not described in 'adis16400_state'

Cc Alexandru Ardelean <[email protected]>
---
 drivers/iio/imu/adis16400.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/iio/imu/adis16400.c +2 -0
index 1ebe3e50d3e6..140cfc65ee8c 100644
@@ -173,6 +173,8 @@ struct adis16400_chip_info {
  * @variant:	chip variant info
  * @filt_int:	integer part of requested filter frequency
  * @adis:	adis device
+ * @avail_scan_mask:	NULL terminated array of bitmaps of channels
+ *			that must be enabled together
  **/
 struct adis16400_state {
 	struct adis16400_chip_info	*variant;
Signature · 1 line
2.28.0
Acked-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] iio:imu:adis16400: Sort out missing kernel doc.

Quoted 8 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

I'd like to be enable W=1 for all IIO builds as it catches real issues as well as more minor documentation issues such as this (also good to fix though!)

drivers/iio/imu/adis16400.c:183: warning: Function parameter or member 'avail_scan_mask' not described in 'adis16400_state'

Quoted 22 lines
Cc Alexandru Ardelean <[email protected]>
---
 drivers/iio/imu/adis16400.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/iio/imu/adis16400.c +2 -1
index 1ebe3e50d3e6..140cfc65ee8c 100644
@@ -173,6 +173,8 @@ struct adis16400_chip_info {
  * @variant:   chip variant info
  * @filt_int:  integer part of requested filter frequency
  * @adis:      adis device
+ * @avail_scan_mask:   NULL terminated array of bitmaps of channels
+ *                     that must be enabled together
  **/
 struct adis16400_state {
        struct adis16400_chip_info      *variant;
--

2.28.0

author maintainer Applied
#3 lore raw

Re: [PATCH 1/3] iio:imu:adis16400: Sort out missing kernel doc.

Quoted 4 lines · On Mon, 14 Sep 2020 08:52:34 +0300 Alexandru Ardelean <[email protected]>…
Quoted 3 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

Quoted 10 lines
Quoted 5 lines

I'd like to be enable W=1 for all IIO builds as it catches real issues as well as more minor documentation issues such as this (also good to fix though!)

drivers/iio/imu/adis16400.c:183: warning: Function parameter or member 'avail_scan_mask' not described in 'adis16400_state'

Quoted 2 lines
Cc Alexandru Ardelean <[email protected]>

Applied to the togreg branch of iio.git
Thanks,

Jonathan

Quoted 20 lines
Quoted 20 lines
---
 drivers/iio/imu/adis16400.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/iio/imu/adis16400.c +2 -1
index 1ebe3e50d3e6..140cfc65ee8c 100644
@@ -173,6 +173,8 @@ struct adis16400_chip_info {
  * @variant:   chip variant info
  * @filt_int:  integer part of requested filter frequency
  * @adis:      adis device
+ * @avail_scan_mask:   NULL terminated array of bitmaps of channels
+ *                     that must be enabled together
  **/
 struct adis16400_state {
        struct adis16400_chip_info      *variant;
--

2.28.0

author maintainer
#4 lore raw

PATCH 2/3 iio: Add __printf() attributes to various allocation functions

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

A partial set of these was added to IIO a long time back. This fills in some gaps in coverage highlighted by building with W=1

---
 drivers/iio/industrialio-trigger.c   | 2 +-
 include/linux/iio/iio.h              | 4 ++--
 include/linux/iio/trigger_consumer.h | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/iio/industrialio-trigger.c +1 -1
index 6f16357fd732..adfe023cad48 100644
@@ -516,7 +516,7 @@ static void iio_trig_subirqunmask(struct irq_data *d)
 	trig->subirqs[d->irq - trig->subirq_base].enabled = true;
 }
 
-static struct iio_trigger *viio_trigger_alloc(const char *fmt, va_list vargs)
+__printf(1, 0) static struct iio_trigger *viio_trigger_alloc(const char *fmt, va_list vargs)
 {
 	struct iio_trigger *trig;
 	int i;
include/linux/iio/iio.h +2 -2
index e2df67a3b9ab..a02a3efad794 100644
@@ -691,8 +691,8 @@ static inline void *iio_priv(const struct iio_dev *indio_dev)
 
 void iio_device_free(struct iio_dev *indio_dev);
 struct iio_dev *devm_iio_device_alloc(struct device *parent, int sizeof_priv);
-struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
-						const char *fmt, ...);
+__printf(2, 3) struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
+							  const char *fmt, ...);
 /**
  * iio_buffer_enabled() - helper function to test if the buffer is enabled
  * @indio_dev:		IIO device structure for device
include/linux/iio/trigger_consumer.h +1 -1
index 3aa2f132dd67..2c05dfad88d7 100644
@@ -38,7 +38,7 @@ struct iio_poll_func {
 };
 
 
-struct iio_poll_func
+__printf(5, 6) struct iio_poll_func
 *iio_alloc_pollfunc(irqreturn_t (*h)(int irq, void *p),
 		    irqreturn_t (*thread)(int irq, void *p),
 		    int type,
Signature · 1 line
2.28.0
Reviewed-by on v1 2/3
#5 lore raw

Re: [PATCH 2/3] iio: Add __printf() attributes to various allocation functions

Quoted 7 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

A partial set of these was added to IIO a long time back. This fills in some gaps in coverage highlighted by building with W=1

Stylistically, it looks like plenty of these attributes are specified on a separate line before the function definition. Example:

__printf(1, 0)
static struct iio_trigger *viio_trigger_alloc(const char *fmt, va_list vargs)

It doesn't make much difference to me how it's placed.

Quoted 51 lines
---
 drivers/iio/industrialio-trigger.c   | 2 +-
 include/linux/iio/iio.h              | 4 ++--
 include/linux/iio/trigger_consumer.h | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/iio/industrialio-trigger.c +1 -1
index 6f16357fd732..adfe023cad48 100644
@@ -516,7 +516,7 @@ static void iio_trig_subirqunmask(struct irq_data *d)
        trig->subirqs[d->irq - trig->subirq_base].enabled = true;
 }
 
-static struct iio_trigger *viio_trigger_alloc(const char *fmt, va_list vargs)
+__printf(1, 0) static struct iio_trigger *viio_trigger_alloc(const char *fmt, va_list vargs)
 {
        struct iio_trigger *trig;
        int i;
include/linux/iio/iio.h +2 -2
index e2df67a3b9ab..a02a3efad794 100644
@@ -691,8 +691,8 @@ static inline void *iio_priv(const struct iio_dev *indio_dev)
 
 void iio_device_free(struct iio_dev *indio_dev);
 struct iio_dev *devm_iio_device_alloc(struct device *parent, int sizeof_priv);
-struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
-                                               const char *fmt, ...);
+__printf(2, 3) struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
+                                                         const char *fmt, ...);
 /**
  * iio_buffer_enabled() - helper function to test if the buffer is enabled
  * @indio_dev:         IIO device structure for device
include/linux/iio/trigger_consumer.h +1 -2
index 3aa2f132dd67..2c05dfad88d7 100644
@@ -38,7 +38,7 @@ struct iio_poll_func {
 };
 
 
-struct iio_poll_func
+__printf(5, 6) struct iio_poll_func
 *iio_alloc_pollfunc(irqreturn_t (*h)(int irq, void *p),
                    irqreturn_t (*thread)(int irq, void *p),
                    int type,
--

2.28.0

author maintainer
#6 lore raw

Re: [PATCH 2/3] iio: Add __printf() attributes to various allocation functions

Quoted 13 lines · On Fri, 18 Sep 2020 16:25:05 +0300 Alexandru Ardelean <[email protected]>…
Quoted 7 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

A partial set of these was added to IIO a long time back. This fills in some gaps in coverage highlighted by building with W=1

Stylistically, it looks like plenty of these attributes are specified on a separate line before the function definition. Example:

Quoted 6 lines

__printf(1, 0)
static struct iio_trigger *viio_trigger_alloc(const char *fmt, va_list vargs)

It doesn't make much difference to me how it's placed.

Thanks. I've tweaked it wrt to both the feedback you gave and that which Andy gave in the request to review thread.

So on this example we end up with
static printf(..)
struct

Thanks!

Jonathan

Quoted 52 lines
Quoted 52 lines
---
 drivers/iio/industrialio-trigger.c   | 2 +-
 include/linux/iio/iio.h              | 4 ++--
 include/linux/iio/trigger_consumer.h | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/iio/industrialio-trigger.c +1 -1
index 6f16357fd732..adfe023cad48 100644
@@ -516,7 +516,7 @@ static void iio_trig_subirqunmask(struct irq_data *d)
        trig->subirqs[d->irq - trig->subirq_base].enabled = true;
 }
 
-static struct iio_trigger *viio_trigger_alloc(const char *fmt, va_list vargs)
+__printf(1, 0) static struct iio_trigger *viio_trigger_alloc(const char *fmt, va_list vargs)
 {
        struct iio_trigger *trig;
        int i;
include/linux/iio/iio.h +2 -2
index e2df67a3b9ab..a02a3efad794 100644
@@ -691,8 +691,8 @@ static inline void *iio_priv(const struct iio_dev *indio_dev)
 
 void iio_device_free(struct iio_dev *indio_dev);
 struct iio_dev *devm_iio_device_alloc(struct device *parent, int sizeof_priv);
-struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
-                                               const char *fmt, ...);
+__printf(2, 3) struct iio_trigger *devm_iio_trigger_alloc(struct device *dev,
+                                                         const char *fmt, ...);
 /**
  * iio_buffer_enabled() - helper function to test if the buffer is enabled
  * @indio_dev:         IIO device structure for device
include/linux/iio/trigger_consumer.h +1 -2
index 3aa2f132dd67..2c05dfad88d7 100644
@@ -38,7 +38,7 @@ struct iio_poll_func {
 };
 
 
-struct iio_poll_func
+__printf(5, 6) struct iio_poll_func
 *iio_alloc_pollfunc(irqreturn_t (*h)(int irq, void *p),
                    irqreturn_t (*thread)(int irq, void *p),
                    int type,
--

2.28.0

author maintainer
#7 lore raw

PATCH 3/3 iio:core: Tidy up kernel-doc.

In reply to Jonathan Cameron

From: Jonathan Cameron <[email protected]>

One comment isn't kernel-doc at all, but starts with /** and another is simply missing a parameter that was introduced recently.

---
 drivers/iio/industrialio-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/industrialio-core.c +2 -1
index 8ddc6dfc8ed4..6e388293c828 100644
@@ -170,7 +170,7 @@ static const char * const iio_chan_info_postfix[] = {
 };
 
 #if defined(CONFIG_DEBUG_FS)
-/**
+/*
  * There's also a CONFIG_DEBUG_FS guard in include/linux/iio/iio.h for
  * iio_get_debugfs_dentry() to make it inline if CONFIG_DEBUG_FS is undefined
  */
@@ -1525,6 +1525,7 @@ struct device_type iio_device_type = {
 
 /**
  * iio_device_alloc() - allocate an iio_dev from a driver
+ * @parent:		Parent device.
  * @sizeof_priv:	Space to allocate for private structure.
  **/
 struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv)
Signature · 1 line
2.28.0
Acked-by on v1 3/3
#8 lore raw

Re: [PATCH 3/3] iio:core: Tidy up kernel-doc.

Quoted 6 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

One comment isn't kernel-doc at all, but starts with /** and another is simply missing a parameter that was introduced recently.

Apologies for missing this earlier.

Quoted 29 lines
---
 drivers/iio/industrialio-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/industrialio-core.c +2 -2
index 8ddc6dfc8ed4..6e388293c828 100644
@@ -170,7 +170,7 @@ static const char * const iio_chan_info_postfix[] = {
 };
 
 #if defined(CONFIG_DEBUG_FS)
-/**
+/*
  * There's also a CONFIG_DEBUG_FS guard in include/linux/iio/iio.h for
  * iio_get_debugfs_dentry() to make it inline if CONFIG_DEBUG_FS is undefined
  */
@@ -1525,6 +1525,7 @@ struct device_type iio_device_type = {
 
 /**
  * iio_device_alloc() - allocate an iio_dev from a driver
+ * @parent:            Parent device.
  * @sizeof_priv:       Space to allocate for private structure.
  **/
 struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv)
--

2.28.0

author maintainer
#9 lore raw

Re: [PATCH 3/3] iio:core: Tidy up kernel-doc.

Quoted 9 lines · On Fri, 18 Sep 2020 15:48:02 +0300 Alexandru Ardelean <[email protected]>…
Quoted 6 lines · Jonathan Cameron

From: Jonathan Cameron <[email protected]>

One comment isn't kernel-doc at all, but starts with /** and another is simply missing a parameter that was introduced recently.

Apologies for missing this earlier.

No problem. This one is you being nice rather than an ADI driver :)

Quoted 2 lines

Thanks. Applied with yours and Andy's tag (from the request for review email).

Jonathan

Quoted 30 lines
Quoted 30 lines
---
 drivers/iio/industrialio-core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/iio/industrialio-core.c +2 -2
index 8ddc6dfc8ed4..6e388293c828 100644
@@ -170,7 +170,7 @@ static const char * const iio_chan_info_postfix[] = {
 };
 
 #if defined(CONFIG_DEBUG_FS)
-/**
+/*
  * There's also a CONFIG_DEBUG_FS guard in include/linux/iio/iio.h for
  * iio_get_debugfs_dentry() to make it inline if CONFIG_DEBUG_FS is undefined
  */
@@ -1525,6 +1525,7 @@ struct device_type iio_device_type = {
 
 /**
  * iio_device_alloc() - allocate an iio_dev from a driver
+ * @parent:            Parent device.
  * @sizeof_priv:       Space to allocate for private structure.
  **/
 struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv)
--

2.28.0