Skip to contentSkip to conversation

mfd: arizona: Fix incorrect Makefile conditionals

PATCH In review Richard Fitzgerald 2 participants 2 messages May 5, 2015 – May 13, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mfd: arizona: Fix incorrect Makefile conditionals

The use of ifneq against 'n' to conditionally compile codec-specific parts is wrong and was resulting in all the codec tables being built even for deselected codecs.

For the WM5102 there is an extra dependency on wm5102_patch() so it is given an alternative empty version when deselected to avoid having to sprinkle #ifdefs around the code.

---
 drivers/mfd/Makefile             |    6 +++---
 include/linux/mfd/arizona/core.h |    8 ++++++++
 2 files changed, 11 insertions(+), 3 deletions(-)
drivers/mfd/Makefile +3 -3
index ca6d184..63743a7 100644
@@ -41,13 +41,13 @@ obj-$(CONFIG_MFD_ARIZONA)	+= arizona-core.o
 obj-$(CONFIG_MFD_ARIZONA)	+= arizona-irq.o
 obj-$(CONFIG_MFD_ARIZONA_I2C)	+= arizona-i2c.o
 obj-$(CONFIG_MFD_ARIZONA_SPI)	+= arizona-spi.o
-ifneq ($(CONFIG_MFD_WM5102),n)
+ifeq ($(CONFIG_MFD_WM5102),y)
 obj-$(CONFIG_MFD_ARIZONA)	+= wm5102-tables.o
 endif
-ifneq ($(CONFIG_MFD_WM5110),n)
+ifeq ($(CONFIG_MFD_WM5110),y)
 obj-$(CONFIG_MFD_ARIZONA)	+= wm5110-tables.o
 endif
-ifneq ($(CONFIG_MFD_WM8997),n)
+ifeq ($(CONFIG_MFD_WM8997),y)
 obj-$(CONFIG_MFD_ARIZONA)	+= wm8997-tables.o
 endif
 obj-$(CONFIG_MFD_WM8400)	+= wm8400-core.o
include/linux/mfd/arizona/core.h +8 -0
index 16a498f..7597164 100644
@@ -153,7 +153,15 @@ int arizona_request_irq(struct arizona *arizona, int irq, char *name,
 void arizona_free_irq(struct arizona *arizona, int irq, void *data);
 int arizona_set_irq_wake(struct arizona *arizona, int irq, int on);
 
+#ifdef CONFIG_MFD_WM5102
 int wm5102_patch(struct arizona *arizona);
+#else
+static inline int wm5102_patch(struct arizona *arizona)
+{
+	return 0;
+}
+#endif
+
 int wm5110_patch(struct arizona *arizona);
 int wm8997_patch(struct arizona *arizona);
 
Signature · 1 line
1.7.2.5
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Richard Fitzgerald

The use of ifneq against 'n' to conditionally compile codec-specific parts is wrong and was resulting in all the codec tables being built even for deselected codecs.

For the WM5102 there is an extra dependency on wm5102_patch() so it is given an alternative empty version when deselected to avoid having to sprinkle #ifdefs around the code.

Quoted 5 lines
---
 drivers/mfd/Makefile             |    6 +++---
 include/linux/mfd/arizona/core.h |    8 ++++++++
 2 files changed, 11 insertions(+), 3 deletions(-)

I think this patch should be split into 2.

You can add my:

... to both of them when you re-submit.

Quoted 41 lines
drivers/mfd/Makefile +3 -3
index ca6d184..63743a7 100644
@@ -41,13 +41,13 @@ obj-$(CONFIG_MFD_ARIZONA)	+= arizona-core.o
 obj-$(CONFIG_MFD_ARIZONA)	+= arizona-irq.o
 obj-$(CONFIG_MFD_ARIZONA_I2C)	+= arizona-i2c.o
 obj-$(CONFIG_MFD_ARIZONA_SPI)	+= arizona-spi.o
-ifneq ($(CONFIG_MFD_WM5102),n)
+ifeq ($(CONFIG_MFD_WM5102),y)
 obj-$(CONFIG_MFD_ARIZONA)	+= wm5102-tables.o
 endif
-ifneq ($(CONFIG_MFD_WM5110),n)
+ifeq ($(CONFIG_MFD_WM5110),y)
 obj-$(CONFIG_MFD_ARIZONA)	+= wm5110-tables.o
 endif
-ifneq ($(CONFIG_MFD_WM8997),n)
+ifeq ($(CONFIG_MFD_WM8997),y)
 obj-$(CONFIG_MFD_ARIZONA)	+= wm8997-tables.o
 endif
 obj-$(CONFIG_MFD_WM8400)	+= wm8400-core.o
include/linux/mfd/arizona/core.h +8 -0
index 16a498f..7597164 100644
@@ -153,7 +153,15 @@ int arizona_request_irq(struct arizona *arizona, int irq, char *name,
 void arizona_free_irq(struct arizona *arizona, int irq, void *data);
 int arizona_set_irq_wake(struct arizona *arizona, int irq, int on);
 
+#ifdef CONFIG_MFD_WM5102
 int wm5102_patch(struct arizona *arizona);
+#else
+static inline int wm5102_patch(struct arizona *arizona)
+{
+	return 0;
+}
+#endif
+
 int wm5110_patch(struct arizona *arizona);
 int wm8997_patch(struct arizona *arizona);
 
Signature · 4 lines
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog