diff mbox series

[leds,v2,03/50] leds: fsg: compile if COMPILE_TEST=y

Message ID 20200917223338.14164-4-marek.behun@nic.cz
State New
Headers show
Series None | expand

Commit Message

Marek Behún Sept. 17, 2020, 10:32 p.m. UTC
This driver can be compiled on other platforms with small change if
COMPILE_TEST=y.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Dan Murphy <dmurphy@ti.com>
Cc: Rod Whitby <rod@whitby.id.au>
---
 drivers/leds/Kconfig    | 2 +-
 drivers/leds/leds-fsg.c | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

Comments

Pavel Machek Sept. 19, 2020, 9:56 a.m. UTC | #1
On Fri 2020-09-18 00:32:51, Marek Behún wrote:
> This driver can be compiled on other platforms with small change if
> COMPILE_TEST=y.
> 
> Signed-off-by: Marek Behún <marek.behun@nic.cz>

> +++ b/drivers/leds/leds-fsg.c
> @@ -16,7 +16,13 @@
>  #include <linux/leds.h>
>  #include <linux/module.h>
>  #include <linux/io.h>
> +
> +#if IS_ENABLED(MACH_FSG)
>  #include <mach/hardware.h>
> +#else
> +/* for COMPILE_TEST */
> +#define IXP4XX_EXP_BUS_BASE(x) (0x12345678 + (x))
> +#endif

This is _way_ too ugly and I'd have to read the driver to understand
what prevents it from using this address and corrupting something, somewhere.

									Pavel
Marek Behún Sept. 19, 2020, 3:54 p.m. UTC | #2
On Sat, 19 Sep 2020 11:56:16 +0200
Pavel Machek <pavel@ucw.cz> wrote:

> #include <mach/hardware.h>

It can't include this header on other platforms...
diff mbox series

Patch

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index a008170e73cd8..7f3d16d4f0652 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -290,7 +290,7 @@  config LEDS_NET48XX
 config LEDS_FSG
 	tristate "LED Support for the Freecom FSG-3"
 	depends on LEDS_CLASS
-	depends on MACH_FSG
+	depends on MACH_FSG || COMPILE_TEST
 	help
 	  This option enables support for the LEDs on the Freecom FSG-3.
 
diff --git a/drivers/leds/leds-fsg.c b/drivers/leds/leds-fsg.c
index bc6b420637d61..1ffb34baee341 100644
--- a/drivers/leds/leds-fsg.c
+++ b/drivers/leds/leds-fsg.c
@@ -16,7 +16,13 @@ 
 #include <linux/leds.h>
 #include <linux/module.h>
 #include <linux/io.h>
+
+#if IS_ENABLED(MACH_FSG)
 #include <mach/hardware.h>
+#else
+/* for COMPILE_TEST */
+#define IXP4XX_EXP_BUS_BASE(x) (0x12345678 + (x))
+#endif
 
 #define FSG_LED_WLAN_BIT	0
 #define FSG_LED_WAN_BIT		1