2019-04-13 15:14:12

by Paul Gortmaker

[permalink] [raw]
Subject: [PATCH] soundwire: intel: fix implicit header use of module.h/export.h

These two files are implicitly relying on an instance of including
module.h from <linux/acpi.h>.

Ideally, header files under include/linux shouldn't be adding
includes of other headers, in anticipation of their consumers,
but just the headers needed for the header itself to pass
parsing with CPP.

The module.h is particularly bad in this sense, as it itself does
include a whole bunch of other headers, due to the complexity of
module support.

Here, we make those includes explicit, in order to allow a future
removal of module.h from linux/acpi.h without causing build breakage.

Cc: Vinod Koul <[email protected]>
Cc: Sanyog Kale <[email protected]>
Cc: Pierre-Louis Bossart <[email protected]>
Signed-off-by: Paul Gortmaker <[email protected]>

diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c
index fd8d034cfec1..4a4a883f29f6 100644
--- a/drivers/soundwire/intel.c
+++ b/drivers/soundwire/intel.c
@@ -7,6 +7,7 @@

#include <linux/acpi.h>
#include <linux/delay.h>
+#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <sound/pcm_params.h>
diff --git a/drivers/soundwire/intel_init.c b/drivers/soundwire/intel_init.c
index 5c8a20d99878..e0f2903101c7 100644
--- a/drivers/soundwire/intel_init.c
+++ b/drivers/soundwire/intel_init.c
@@ -8,6 +8,8 @@
*/

#include <linux/acpi.h>
+#include <linux/export.h>
+#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/soundwire/sdw_intel.h>
#include "intel.h"
--
2.11.0


2019-04-14 10:24:11

by Vinod Koul

[permalink] [raw]
Subject: Re: [PATCH] soundwire: intel: fix implicit header use of module.h/export.h

On 13-04-19, 11:12, Paul Gortmaker wrote:
> These two files are implicitly relying on an instance of including
> module.h from <linux/acpi.h>.
>
> Ideally, header files under include/linux shouldn't be adding
> includes of other headers, in anticipation of their consumers,
> but just the headers needed for the header itself to pass
> parsing with CPP.
>
> The module.h is particularly bad in this sense, as it itself does
> include a whole bunch of other headers, due to the complexity of
> module support.
>
> Here, we make those includes explicit, in order to allow a future
> removal of module.h from linux/acpi.h without causing build breakage.

Applied, thanks

--
~Vinod