1 From 811d9e2268a62b830cfe93cd8bc929afcb8b198b Mon Sep 17 00:00:00 2001
2 From: Felix Fietkau <nbd@nbd.name>
3 Date: Sat, 15 Jul 2017 21:12:38 +0200
4 Subject: kernel: move regmap bloat out of the kernel image if it is only being used in modules
6 lede-commit: 96f39119815028073583e4fca3a9c5fe9141e998
7 Signed-off-by: Felix Fietkau <nbd@nbd.name>
9 drivers/base/regmap/Kconfig | 15 ++++++++++-----
10 drivers/base/regmap/Makefile | 12 ++++++++----
11 drivers/base/regmap/regmap.c | 3 +++
12 include/linux/regmap.h | 2 +-
13 4 files changed, 22 insertions(+), 10 deletions(-)
15 --- a/drivers/base/regmap/Kconfig
16 +++ b/drivers/base/regmap/Kconfig
18 # subsystems should select the appropriate symbols.
21 - default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ)
22 select IRQ_DOMAIN if REGMAP_IRQ
26 config REGCACHE_COMPRESSED
28 @@ -17,23 +16,30 @@ config REGMAP_AC97
33 + tristate "Regmap I2C"
39 + tristate "Regmap SPI"
41 + depends on SPI_MASTER
56 + tristate "Regmap MMIO"
62 --- a/drivers/base/regmap/Makefile
63 +++ b/drivers/base/regmap/Makefile
65 # For include/trace/define_trace.h to include trace.h
66 CFLAGS_regmap.o := -I$(src)
68 -obj-$(CONFIG_REGMAP) += regmap.o regcache.o
69 -obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o
70 -obj-$(CONFIG_REGCACHE_COMPRESSED) += regcache-lzo.o
71 -obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o
72 +regmap-core-objs = regmap.o regcache.o regcache-rbtree.o regcache-flat.o
73 +ifdef CONFIG_DEBUG_FS
74 +regmap-core-objs += regmap-debugfs.o
76 +ifdef CONFIG_REGCACHE_COMPRESSED
77 +regmap-core-objs += regcache-lzo.o
79 +obj-$(CONFIG_REGMAP) += regmap-core.o
80 obj-$(CONFIG_REGMAP_AC97) += regmap-ac97.o
81 obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o
82 obj-$(CONFIG_REGMAP_SPI) += regmap-spi.o
83 --- a/drivers/base/regmap/regmap.c
84 +++ b/drivers/base/regmap/regmap.c
86 #include <linux/device.h>
87 #include <linux/slab.h>
88 #include <linux/export.h>
89 +#include <linux/module.h>
90 #include <linux/mutex.h>
91 #include <linux/err.h>
93 @@ -2926,3 +2927,5 @@ static int __init regmap_initcall(void)
96 postcore_initcall(regmap_initcall);
98 +MODULE_LICENSE("GPL");
99 --- a/include/linux/regmap.h
100 +++ b/include/linux/regmap.h
101 @@ -139,7 +139,7 @@ struct reg_sequence {
102 pollret ?: ((cond) ? 0 : -ETIMEDOUT); \
105 -#ifdef CONFIG_REGMAP
106 +#if IS_ENABLED(CONFIG_REGMAP)
109 /* Unspecified -> 0 -> Backwards compatible default */