kernel: split patches folder up into backport, pending and hack folders
[openwrt/openwrt.git] / target / linux / generic / hack-4.9 / 259-regmap_dynamic.patch
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
5
6 lede-commit: 96f39119815028073583e4fca3a9c5fe9141e998
7 Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 ---
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(-)
14
15 diff --git a/drivers/base/regmap/Kconfig b/drivers/base/regmap/Kconfig
16 index 48b3fc1ee514..c4cb7592392b 100644
17 --- a/drivers/base/regmap/Kconfig
18 +++ b/drivers/base/regmap/Kconfig
19 @@ -3,9 +3,8 @@
20 # subsystems should select the appropriate symbols.
21
22 config REGMAP
23 - default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ)
24 select IRQ_DOMAIN if REGMAP_IRQ
25 - bool
26 + tristate "Regmap"
27
28 config REGCACHE_COMPRESSED
29 select LZO_COMPRESS
30 @@ -16,19 +15,25 @@ config REGMAP_AC97
31 tristate
32
33 config REGMAP_I2C
34 - tristate
35 + tristate "Regmap I2C"
36 + select REGMAP
37 depends on I2C
38
39 config REGMAP_SPI
40 - tristate
41 + tristate "Regmap SPI"
42 + select REGMAP
43 + depends on SPI_MASTER
44 depends on SPI
45
46 config REGMAP_SPMI
47 + select REGMAP
48 tristate
49 depends on SPMI
50
51 config REGMAP_MMIO
52 - tristate
53 + tristate "Regmap MMIO"
54 + select REGMAP
55
56 config REGMAP_IRQ
57 + select REGMAP
58 bool
59 diff --git a/drivers/base/regmap/Makefile b/drivers/base/regmap/Makefile
60 index 6271ea9b758a..f23c58a050aa 100644
61 --- a/drivers/base/regmap/Makefile
62 +++ b/drivers/base/regmap/Makefile
63 @@ -1,10 +1,14 @@
64 # For include/trace/define_trace.h to include trace.h
65 CFLAGS_regmap.o := -I$(src)
66
67 -obj-$(CONFIG_REGMAP) += regmap.o regcache.o
68 -obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o
69 -obj-$(CONFIG_REGCACHE_COMPRESSED) += regcache-lzo.o
70 -obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o
71 +regmap-core-objs = regmap.o regcache.o regcache-rbtree.o regcache-flat.o
72 +ifdef CONFIG_DEBUG_FS
73 +regmap-core-objs += regmap-debugfs.o
74 +endif
75 +ifdef CONFIG_REGCACHE_COMPRESSED
76 +regmap-core-objs += regcache-lzo.o
77 +endif
78 +obj-$(CONFIG_REGMAP) += regmap-core.o
79 obj-$(CONFIG_REGMAP_AC97) += regmap-ac97.o
80 obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o
81 obj-$(CONFIG_REGMAP_SPI) += regmap-spi.o
82 diff --git a/drivers/base/regmap/regmap.c b/drivers/base/regmap/regmap.c
83 index ae63bb0875ea..2ac56b4f525e 100644
84 --- a/drivers/base/regmap/regmap.c
85 +++ b/drivers/base/regmap/regmap.c
86 @@ -13,6 +13,7 @@
87 #include <linux/device.h>
88 #include <linux/slab.h>
89 #include <linux/export.h>
90 +#include <linux/module.h>
91 #include <linux/mutex.h>
92 #include <linux/err.h>
93 #include <linux/of.h>
94 @@ -2913,3 +2914,5 @@ static int __init regmap_initcall(void)
95 return 0;
96 }
97 postcore_initcall(regmap_initcall);
98 +
99 +MODULE_LICENSE("GPL");
100 diff --git a/include/linux/regmap.h b/include/linux/regmap.h
101 index f6673132431d..95c7db29448b 100644
102 --- a/include/linux/regmap.h
103 +++ b/include/linux/regmap.h
104 @@ -135,7 +135,7 @@ struct reg_sequence {
105 pollret ?: ((cond) ? 0 : -ETIMEDOUT); \
106 })
107
108 -#ifdef CONFIG_REGMAP
109 +#if IS_ENABLED(CONFIG_REGMAP)
110
111 enum regmap_endian {
112 /* Unspecified -> 0 -> Backwards compatible default */
113 --
114 2.11.0
115