All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] staging:iio: Header cleanup
@ 2021-06-11 15:26 Jonathan Cameron
  2021-06-11 15:26 ` [PATCH 1/7] staging:iio:adc: Cleanup includes Jonathan Cameron
                   ` (7 more replies)
  0 siblings, 8 replies; 13+ messages in thread
From: Jonathan Cameron @ 2021-06-11 15:26 UTC (permalink / raw)
  To: linux-iio
  Cc: Nuno Sa, Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

0-day recently started giving some reports from the include-what-you-use
tool (needs LLVM builds).

I was curious so decided to give it a spin.  It produces a wealth of
information, but the suggestions require a high degree of interpretation
and some choices are down to personal taste.

This set covers resulting changes that I think make sense for remaining
IIO drivers in staging (which I just noticed are all Analog devices ones :)

Jonathan Cameron (7):
  staging:iio:adc: Cleanup includes
  staging:iio:addac:adt7316: Cleanup includes
  staging:iio:cdc:ad7746: Cleanup includes
  staging:iio:frequency: Cleanup includes
  staging:iio:impedance-analyzer: Cleanup includes
  staging:iio:meter:ade7854: Cleanup includes
  staging:iio:resolver:ad2s1210: Cleanup includes

 drivers/staging/iio/adc/ad7280a.c               | 2 ++
 drivers/staging/iio/adc/ad7816.c                | 3 +--
 drivers/staging/iio/addac/adt7316.c             | 5 -----
 drivers/staging/iio/addac/adt7316.h             | 1 +
 drivers/staging/iio/cdc/ad7746.c                | 6 +++---
 drivers/staging/iio/frequency/ad9832.c          | 3 ++-
 drivers/staging/iio/frequency/ad9834.c          | 6 ++----
 drivers/staging/iio/impedance-analyzer/ad5933.c | 5 ++++-
 drivers/staging/iio/meter/ade7854-i2c.c         | 3 ++-
 drivers/staging/iio/meter/ade7854-spi.c         | 3 ++-
 drivers/staging/iio/meter/ade7854.c             | 4 ----
 drivers/staging/iio/meter/ade7854.h             | 5 +++++
 drivers/staging/iio/resolver/ad2s1210.c         | 5 +++--
 13 files changed, 27 insertions(+), 24 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH 1/7] staging:iio:adc: Cleanup includes
  2021-06-11 15:26 [PATCH 0/7] staging:iio: Header cleanup Jonathan Cameron
@ 2021-06-11 15:26 ` Jonathan Cameron
  2021-06-11 15:26 ` [PATCH 2/7] staging:iio:addac:adt7316: " Jonathan Cameron
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Jonathan Cameron @ 2021-06-11 15:26 UTC (permalink / raw)
  To: linux-iio
  Cc: Nuno Sa, Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Result of considering the output of the include-what-you-use tool.
Note that this is partly a case of taste and consistency.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/staging/iio/adc/ad7280a.c | 2 ++
 drivers/staging/iio/adc/ad7816.c  | 3 +--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/adc/ad7280a.c b/drivers/staging/iio/adc/ad7280a.c
index fef0055b8990..135fdf33c655 100644
--- a/drivers/staging/iio/adc/ad7280a.c
+++ b/drivers/staging/iio/adc/ad7280a.c
@@ -15,6 +15,8 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
+#include <linux/mutex.h>
 
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c
index 6c14d7bcdd67..0d943f99383b 100644
--- a/drivers/staging/iio/adc/ad7816.c
+++ b/drivers/staging/iio/adc/ad7816.c
@@ -9,11 +9,10 @@
 #include <linux/gpio/consumer.h>
 #include <linux/device.h>
 #include <linux/kernel.h>
-#include <linux/slab.h>
 #include <linux/sysfs.h>
-#include <linux/list.h>
 #include <linux/spi/spi.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
 
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 2/7] staging:iio:addac:adt7316: Cleanup includes
  2021-06-11 15:26 [PATCH 0/7] staging:iio: Header cleanup Jonathan Cameron
  2021-06-11 15:26 ` [PATCH 1/7] staging:iio:adc: Cleanup includes Jonathan Cameron
@ 2021-06-11 15:26 ` Jonathan Cameron
  2021-06-11 17:40   ` Andy Shevchenko
  2021-06-11 15:26 ` [PATCH 3/7] staging:iio:cdc:ad7746: " Jonathan Cameron
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 13+ messages in thread
From: Jonathan Cameron @ 2021-06-11 15:26 UTC (permalink / raw)
  To: linux-iio
  Cc: Nuno Sa, Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Result of consideration of the output of the include-what-you-use
tool.  Also a forwards definition of device to avoid any
ordering of headers issues.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/staging/iio/addac/adt7316.c | 5 -----
 drivers/staging/iio/addac/adt7316.h | 1 +
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c
index ccbafcaaf27e..e81791ee182f 100644
--- a/drivers/staging/iio/addac/adt7316.c
+++ b/drivers/staging/iio/addac/adt7316.c
@@ -8,14 +8,9 @@
 #include <linux/interrupt.h>
 #include <linux/gpio/consumer.h>
 #include <linux/irq.h>
-#include <linux/workqueue.h>
 #include <linux/device.h>
 #include <linux/kernel.h>
-#include <linux/slab.h>
 #include <linux/sysfs.h>
-#include <linux/list.h>
-#include <linux/i2c.h>
-#include <linux/rtc.h>
 #include <linux/module.h>
 
 #include <linux/iio/iio.h>
diff --git a/drivers/staging/iio/addac/adt7316.h b/drivers/staging/iio/addac/adt7316.h
index 8c2a92ae7157..a1f6324ead59 100644
--- a/drivers/staging/iio/addac/adt7316.h
+++ b/drivers/staging/iio/addac/adt7316.h
@@ -10,6 +10,7 @@
 
 #include <linux/types.h>
 #include <linux/pm.h>
+struct device;
 
 #define ADT7316_REG_MAX_ADDR		0x3F
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 3/7] staging:iio:cdc:ad7746: Cleanup includes
  2021-06-11 15:26 [PATCH 0/7] staging:iio: Header cleanup Jonathan Cameron
  2021-06-11 15:26 ` [PATCH 1/7] staging:iio:adc: Cleanup includes Jonathan Cameron
  2021-06-11 15:26 ` [PATCH 2/7] staging:iio:addac:adt7316: " Jonathan Cameron
@ 2021-06-11 15:26 ` Jonathan Cameron
  2021-06-11 15:26 ` [PATCH 4/7] staging:iio:frequency: " Jonathan Cameron
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Jonathan Cameron @ 2021-06-11 15:26 UTC (permalink / raw)
  To: linux-iio
  Cc: Nuno Sa, Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Based on consideration of the output of the include-what-you-use tool.
Drop some unused includes + include some which probably should have
been there in the first place.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/staging/iio/cdc/ad7746.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/iio/cdc/ad7746.c b/drivers/staging/iio/cdc/ad7746.c
index 4221312f0a32..fbdf90604c0d 100644
--- a/drivers/staging/iio/cdc/ad7746.c
+++ b/drivers/staging/iio/cdc/ad7746.c
@@ -8,11 +8,11 @@
 #include <linux/delay.h>
 #include <linux/device.h>
 #include <linux/i2c.h>
-#include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
-#include <linux/slab.h>
-#include <linux/stat.h>
+#include <linux/mod_devicetable.h>
+#include <linux/mutex.h>
+#include <linux/property.h>
 #include <linux/sysfs.h>
 
 #include <linux/iio/iio.h>
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 4/7] staging:iio:frequency: Cleanup includes
  2021-06-11 15:26 [PATCH 0/7] staging:iio: Header cleanup Jonathan Cameron
                   ` (2 preceding siblings ...)
  2021-06-11 15:26 ` [PATCH 3/7] staging:iio:cdc:ad7746: " Jonathan Cameron
@ 2021-06-11 15:26 ` Jonathan Cameron
  2021-06-11 15:26 ` [PATCH 5/7] staging:iio:impedance-analyzer: " Jonathan Cameron
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Jonathan Cameron @ 2021-06-11 15:26 UTC (permalink / raw)
  To: linux-iio
  Cc: Nuno Sa, Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Based on consideration of the output of the include-what-you-use
tool.  Remove some unused headers and add some that should be
directly included.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/staging/iio/frequency/ad9832.c | 3 ++-
 drivers/staging/iio/frequency/ad9834.c | 6 ++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c
index 3f1981e287f5..2d78072ff4c3 100644
--- a/drivers/staging/iio/frequency/ad9832.c
+++ b/drivers/staging/iio/frequency/ad9832.c
@@ -12,8 +12,9 @@
 #include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
+#include <linux/mutex.h>
 #include <linux/regulator/consumer.h>
-#include <linux/slab.h>
 #include <linux/spi/spi.h>
 #include <linux/sysfs.h>
 
diff --git a/drivers/staging/iio/frequency/ad9834.c b/drivers/staging/iio/frequency/ad9834.c
index 94b131ef8a22..c163e91c1bc4 100644
--- a/drivers/staging/iio/frequency/ad9834.c
+++ b/drivers/staging/iio/frequency/ad9834.c
@@ -6,17 +6,15 @@
  */
 
 #include <linux/clk.h>
-#include <linux/interrupt.h>
-#include <linux/workqueue.h>
 #include <linux/device.h>
 #include <linux/kernel.h>
-#include <linux/slab.h>
 #include <linux/sysfs.h>
-#include <linux/list.h>
 #include <linux/spi/spi.h>
 #include <linux/regulator/consumer.h>
 #include <linux/err.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
+#include <linux/mutex.h>
 #include <asm/div64.h>
 
 #include <linux/iio/iio.h>
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 5/7] staging:iio:impedance-analyzer: Cleanup includes
  2021-06-11 15:26 [PATCH 0/7] staging:iio: Header cleanup Jonathan Cameron
                   ` (3 preceding siblings ...)
  2021-06-11 15:26 ` [PATCH 4/7] staging:iio:frequency: " Jonathan Cameron
@ 2021-06-11 15:26 ` Jonathan Cameron
  2021-06-11 15:26 ` [PATCH 6/7] staging:iio:meter:ade7854: " Jonathan Cameron
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 13+ messages in thread
From: Jonathan Cameron @ 2021-06-11 15:26 UTC (permalink / raw)
  To: linux-iio
  Cc: Nuno Sa, Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Based on consideration of the output of the include-what-you-use
tool.  Drop unused headers and include some that should probably
have always been included.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/staging/iio/impedance-analyzer/ad5933.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c b/drivers/staging/iio/impedance-analyzer/ad5933.c
index 793918e1c45f..33dc8b7eb37a 100644
--- a/drivers/staging/iio/impedance-analyzer/ad5933.c
+++ b/drivers/staging/iio/impedance-analyzer/ad5933.c
@@ -5,17 +5,20 @@
  * Copyright 2011 Analog Devices Inc.
  */
 
+#include <linux/bitmap.h>
 #include <linux/clk.h>
 #include <linux/delay.h>
 #include <linux/device.h>
 #include <linux/err.h>
 #include <linux/i2c.h>
-#include <linux/interrupt.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
+#include <linux/mutex.h>
 #include <linux/regulator/consumer.h>
 #include <linux/sysfs.h>
 #include <linux/types.h>
+#include <linux/workqueue.h>
 
 #include <linux/iio/buffer.h>
 #include <linux/iio/iio.h>
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 6/7] staging:iio:meter:ade7854: Cleanup includes
  2021-06-11 15:26 [PATCH 0/7] staging:iio: Header cleanup Jonathan Cameron
                   ` (4 preceding siblings ...)
  2021-06-11 15:26 ` [PATCH 5/7] staging:iio:impedance-analyzer: " Jonathan Cameron
@ 2021-06-11 15:26 ` Jonathan Cameron
  2021-06-11 15:26 ` [PATCH 7/7] staging:iio:resolver:ad2s1210: " Jonathan Cameron
  2021-06-11 17:45 ` [PATCH 0/7] staging:iio: Header cleanup Andy Shevchenko
  7 siblings, 0 replies; 13+ messages in thread
From: Jonathan Cameron @ 2021-06-11 15:26 UTC (permalink / raw)
  To: linux-iio
  Cc: Nuno Sa, Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Based on consideration of the output of the include-what-you-use tool.
Drop some unused headers and some that should probably have always
been included.  Also a few forwards definitions to avoid any
future issues with header ordering.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/staging/iio/meter/ade7854-i2c.c | 3 ++-
 drivers/staging/iio/meter/ade7854-spi.c | 3 ++-
 drivers/staging/iio/meter/ade7854.c     | 4 ----
 drivers/staging/iio/meter/ade7854.h     | 5 +++++
 4 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/iio/meter/ade7854-i2c.c b/drivers/staging/iio/meter/ade7854-i2c.c
index a9a06e8dda51..c6b3e1418c84 100644
--- a/drivers/staging/iio/meter/ade7854-i2c.c
+++ b/drivers/staging/iio/meter/ade7854-i2c.c
@@ -8,8 +8,9 @@
 #include <linux/device.h>
 #include <linux/kernel.h>
 #include <linux/i2c.h>
-#include <linux/slab.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
+#include <linux/mutex.h>
 
 #include <linux/iio/iio.h>
 #include "ade7854.h"
diff --git a/drivers/staging/iio/meter/ade7854-spi.c b/drivers/staging/iio/meter/ade7854-spi.c
index f12a6c8b3e88..7ba7dc4cdbc9 100644
--- a/drivers/staging/iio/meter/ade7854-spi.c
+++ b/drivers/staging/iio/meter/ade7854-spi.c
@@ -8,8 +8,9 @@
 #include <linux/device.h>
 #include <linux/kernel.h>
 #include <linux/spi/spi.h>
-#include <linux/slab.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
+#include <linux/mutex.h>
 
 #include <linux/iio/iio.h>
 #include "ade7854.h"
diff --git a/drivers/staging/iio/meter/ade7854.c b/drivers/staging/iio/meter/ade7854.c
index 68da6ecde6a3..68a5e9c6b047 100644
--- a/drivers/staging/iio/meter/ade7854.c
+++ b/drivers/staging/iio/meter/ade7854.c
@@ -5,15 +5,11 @@
  * Copyright 2010 Analog Devices Inc.
  */
 
-#include <linux/interrupt.h>
-#include <linux/irq.h>
 #include <linux/delay.h>
 #include <linux/mutex.h>
 #include <linux/device.h>
 #include <linux/kernel.h>
-#include <linux/slab.h>
 #include <linux/sysfs.h>
-#include <linux/list.h>
 #include <linux/module.h>
 
 #include <linux/iio/iio.h>
diff --git a/drivers/staging/iio/meter/ade7854.h b/drivers/staging/iio/meter/ade7854.h
index a51e6e3183d3..620d3d075f95 100644
--- a/drivers/staging/iio/meter/ade7854.h
+++ b/drivers/staging/iio/meter/ade7854.h
@@ -1,4 +1,9 @@
 /* SPDX-License-Identifier: GPL-2.0 */
+
+#include <linux/mutex.h>
+struct device;
+struct iio_device;
+
 #ifndef _ADE7854_H
 #define _ADE7854_H
 
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* [PATCH 7/7] staging:iio:resolver:ad2s1210: Cleanup includes
  2021-06-11 15:26 [PATCH 0/7] staging:iio: Header cleanup Jonathan Cameron
                   ` (5 preceding siblings ...)
  2021-06-11 15:26 ` [PATCH 6/7] staging:iio:meter:ade7854: " Jonathan Cameron
@ 2021-06-11 15:26 ` Jonathan Cameron
  2021-06-11 16:09   ` Jonathan Cameron
  2021-06-11 17:45 ` [PATCH 0/7] staging:iio: Header cleanup Andy Shevchenko
  7 siblings, 1 reply; 13+ messages in thread
From: Jonathan Cameron @ 2021-06-11 15:26 UTC (permalink / raw)
  To: linux-iio
  Cc: Nuno Sa, Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron

From: Jonathan Cameron <Jonathan.Cameron@huawei.com>

Based on consideration of the output of the include-what-you-use tool.
Drop unused includes and add some that should be there.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
---
 drivers/staging/iio/resolver/ad2s1210.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
index 74adb82f37c3..99dec73144ba 100644
--- a/drivers/staging/iio/resolver/ad2s1210.c
+++ b/drivers/staging/iio/resolver/ad2s1210.c
@@ -4,15 +4,16 @@
  *
  * Copyright (c) 2010-2010 Analog Devices Inc.
  */
+#include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/mutex.h>
 #include <linux/device.h>
 #include <linux/spi/spi.h>
-#include <linux/slab.h>
 #include <linux/sysfs.h>
-#include <linux/delay.h>
 #include <linux/gpio/consumer.h>
 #include <linux/module.h>
+#include <linux/mod_devicetable.h>
+#include <linux/of.h>
 
 #include <linux/iio/iio.h>
 #include <linux/iio/sysfs.h>
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 7/7] staging:iio:resolver:ad2s1210: Cleanup includes
  2021-06-11 15:26 ` [PATCH 7/7] staging:iio:resolver:ad2s1210: " Jonathan Cameron
@ 2021-06-11 16:09   ` Jonathan Cameron
  0 siblings, 0 replies; 13+ messages in thread
From: Jonathan Cameron @ 2021-06-11 16:09 UTC (permalink / raw)
  To: linux-iio
  Cc: Nuno Sa, Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron

On Fri, 11 Jun 2021 16:26:14 +0100
Jonathan Cameron <jic23@kernel.org> wrote:

> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> Based on consideration of the output of the include-what-you-use tool.
> Drop unused includes and add some that should be there.
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
>  drivers/staging/iio/resolver/ad2s1210.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/iio/resolver/ad2s1210.c b/drivers/staging/iio/resolver/ad2s1210.c
> index 74adb82f37c3..99dec73144ba 100644
> --- a/drivers/staging/iio/resolver/ad2s1210.c
> +++ b/drivers/staging/iio/resolver/ad2s1210.c
> @@ -4,15 +4,16 @@
>   *
>   * Copyright (c) 2010-2010 Analog Devices Inc.
>   */
> +#include <linux/kernel.h>
>  #include <linux/types.h>
>  #include <linux/mutex.h>
>  #include <linux/device.h>
>  #include <linux/spi/spi.h>
> -#include <linux/slab.h>
>  #include <linux/sysfs.h>
> -#include <linux/delay.h>

Let's pretend I didn't remove this one by accident as it is needed.
I don't want to resend the whole set for that however so will 
leave it for now.

>  #include <linux/gpio/consumer.h>
>  #include <linux/module.h>
> +#include <linux/mod_devicetable.h>
> +#include <linux/of.h>
>  
>  #include <linux/iio/iio.h>
>  #include <linux/iio/sysfs.h>


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 2/7] staging:iio:addac:adt7316: Cleanup includes
  2021-06-11 15:26 ` [PATCH 2/7] staging:iio:addac:adt7316: " Jonathan Cameron
@ 2021-06-11 17:40   ` Andy Shevchenko
  0 siblings, 0 replies; 13+ messages in thread
From: Andy Shevchenko @ 2021-06-11 17:40 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Nuno Sa, Lars-Peter Clausen, Michael Hennerich,
	Jonathan Cameron

On Fri, Jun 11, 2021 at 6:25 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> Result of consideration of the output of the include-what-you-use
> tool.  Also a forwards definition of device to avoid any
> ordering of headers issues.
>
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> ---
>  drivers/staging/iio/addac/adt7316.c | 5 -----
>  drivers/staging/iio/addac/adt7316.h | 1 +
>  2 files changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/staging/iio/addac/adt7316.c b/drivers/staging/iio/addac/adt7316.c
> index ccbafcaaf27e..e81791ee182f 100644
> --- a/drivers/staging/iio/addac/adt7316.c
> +++ b/drivers/staging/iio/addac/adt7316.c
> @@ -8,14 +8,9 @@
>  #include <linux/interrupt.h>
>  #include <linux/gpio/consumer.h>
>  #include <linux/irq.h>
> -#include <linux/workqueue.h>
>  #include <linux/device.h>
>  #include <linux/kernel.h>
> -#include <linux/slab.h>
>  #include <linux/sysfs.h>
> -#include <linux/list.h>
> -#include <linux/i2c.h>
> -#include <linux/rtc.h>
>  #include <linux/module.h>
>
>  #include <linux/iio/iio.h>
> diff --git a/drivers/staging/iio/addac/adt7316.h b/drivers/staging/iio/addac/adt7316.h
> index 8c2a92ae7157..a1f6324ead59 100644
> --- a/drivers/staging/iio/addac/adt7316.h
> +++ b/drivers/staging/iio/addac/adt7316.h
> @@ -10,6 +10,7 @@
>
>  #include <linux/types.h>
>  #include <linux/pm.h>

+ blank line?

> +struct device;
>
>  #define ADT7316_REG_MAX_ADDR           0x3F
>
> --
> 2.31.1
>


-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/7] staging:iio: Header cleanup
  2021-06-11 15:26 [PATCH 0/7] staging:iio: Header cleanup Jonathan Cameron
                   ` (6 preceding siblings ...)
  2021-06-11 15:26 ` [PATCH 7/7] staging:iio:resolver:ad2s1210: " Jonathan Cameron
@ 2021-06-11 17:45 ` Andy Shevchenko
  2021-06-11 18:14   ` Jonathan Cameron
  7 siblings, 1 reply; 13+ messages in thread
From: Andy Shevchenko @ 2021-06-11 17:45 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Nuno Sa, Lars-Peter Clausen, Michael Hennerich,
	Jonathan Cameron

On Fri, Jun 11, 2021 at 6:25 PM Jonathan Cameron <jic23@kernel.org> wrote:
>
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
>
> 0-day recently started giving some reports from the include-what-you-use
> tool (needs LLVM builds).
>
> I was curious so decided to give it a spin.  It produces a wealth of
> information, but the suggestions require a high degree of interpretation
> and some choices are down to personal taste.
>
> This set covers resulting changes that I think make sense for remaining
> IIO drivers in staging (which I just noticed are all Analog devices ones :)

In general it's a good idea, but the tool doesn't know the project specifics.
I believe that half of what you have done is simply wrong. That is, we
have a lot of drivers that include kernel.h which is in its turn a
rabbit hole of all possible headers and (circular) dependencies. So,
for this and the other series, please double check that removed
headers are not removed due to kernel.h (I believe this is the case
for almost all if not all entries of slab.h, for example).

The other half seems correct. But due to the above I can't give any
tag on these...

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/7] staging:iio: Header cleanup
  2021-06-11 17:45 ` [PATCH 0/7] staging:iio: Header cleanup Andy Shevchenko
@ 2021-06-11 18:14   ` Jonathan Cameron
  2021-06-11 18:36     ` Andy Shevchenko
  0 siblings, 1 reply; 13+ messages in thread
From: Jonathan Cameron @ 2021-06-11 18:14 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: linux-iio, Nuno Sa, Lars-Peter Clausen, Michael Hennerich,
	Jonathan Cameron

On Fri, 11 Jun 2021 20:45:03 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Fri, Jun 11, 2021 at 6:25 PM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> >
> > 0-day recently started giving some reports from the include-what-you-use
> > tool (needs LLVM builds).
> >
> > I was curious so decided to give it a spin.  It produces a wealth of
> > information, but the suggestions require a high degree of interpretation
> > and some choices are down to personal taste.
> >
> > This set covers resulting changes that I think make sense for remaining
> > IIO drivers in staging (which I just noticed are all Analog devices ones :)  
> 
> In general it's a good idea, but the tool doesn't know the project specifics.
> I believe that half of what you have done is simply wrong. That is, we
> have a lot of drivers that include kernel.h which is in its turn a
> rabbit hole of all possible headers and (circular) dependencies. So,
> for this and the other series, please double check that removed
> headers are not removed due to kernel.h (I believe this is the case
> for almost all if not all entries of slab.h, for example).

The tool seems to go rather the other way and suggest including things
that are 'obviously' included via another header that we need.

The reason for kernel.h includes when being added is almost always ARRAY_SIZE
or container_of as you identified.

The drivers where I'm removing slab.h don't actually make any direct
allocate or free calls, they are all wrapped up in various IIO core function
(devm_iio_device_alloc etc.)

Jonathan


> 
> The other half seems correct. But due to the above I can't give any
> tag on these...
> 


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 0/7] staging:iio: Header cleanup
  2021-06-11 18:14   ` Jonathan Cameron
@ 2021-06-11 18:36     ` Andy Shevchenko
  0 siblings, 0 replies; 13+ messages in thread
From: Andy Shevchenko @ 2021-06-11 18:36 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, Nuno Sa, Lars-Peter Clausen, Michael Hennerich,
	Jonathan Cameron

On Fri, Jun 11, 2021 at 9:12 PM Jonathan Cameron <jic23@kernel.org> wrote:
> On Fri, 11 Jun 2021 20:45:03 +0300
> Andy Shevchenko <andy.shevchenko@gmail.com> wrote:
> > On Fri, Jun 11, 2021 at 6:25 PM Jonathan Cameron <jic23@kernel.org> wrote:

...

> The reason for kernel.h includes when being added is almost always ARRAY_SIZE
> or container_of as you identified.

Give me some time. I will cook a couple of patches for ya to test
(splitting those from kernel.h).

-- 
With Best Regards,
Andy Shevchenko

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2021-06-11 18:38 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-11 15:26 [PATCH 0/7] staging:iio: Header cleanup Jonathan Cameron
2021-06-11 15:26 ` [PATCH 1/7] staging:iio:adc: Cleanup includes Jonathan Cameron
2021-06-11 15:26 ` [PATCH 2/7] staging:iio:addac:adt7316: " Jonathan Cameron
2021-06-11 17:40   ` Andy Shevchenko
2021-06-11 15:26 ` [PATCH 3/7] staging:iio:cdc:ad7746: " Jonathan Cameron
2021-06-11 15:26 ` [PATCH 4/7] staging:iio:frequency: " Jonathan Cameron
2021-06-11 15:26 ` [PATCH 5/7] staging:iio:impedance-analyzer: " Jonathan Cameron
2021-06-11 15:26 ` [PATCH 6/7] staging:iio:meter:ade7854: " Jonathan Cameron
2021-06-11 15:26 ` [PATCH 7/7] staging:iio:resolver:ad2s1210: " Jonathan Cameron
2021-06-11 16:09   ` Jonathan Cameron
2021-06-11 17:45 ` [PATCH 0/7] staging:iio: Header cleanup Andy Shevchenko
2021-06-11 18:14   ` Jonathan Cameron
2021-06-11 18:36     ` Andy Shevchenko

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.