generic: 5.15: copy config and patch from 5.10
[openwrt/staging/mkresin.git] / target / linux / generic / hack-5.15 / 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 --- a/drivers/base/regmap/Kconfig
16 +++ b/drivers/base/regmap/Kconfig
17 @@ -4,9 +4,8 @@
18 # subsystems should select the appropriate symbols.
19
20 config REGMAP
21 - default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_W1 || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ || REGMAP_SOUNDWIRE || REGMAP_SCCB || REGMAP_I3C || REGMAP_SPI_AVMM)
22 select IRQ_DOMAIN if REGMAP_IRQ
23 - bool
24 + tristate
25
26 config REGCACHE_COMPRESSED
27 select LZO_COMPRESS
28 @@ -14,46 +13,59 @@ config REGCACHE_COMPRESSED
29 bool
30
31 config REGMAP_AC97
32 + select REGMAP
33 tristate
34
35 config REGMAP_I2C
36 tristate
37 + select REGMAP
38 depends on I2C
39
40 config REGMAP_SLIMBUS
41 tristate
42 + select REGMAP
43 depends on SLIMBUS
44
45 config REGMAP_SPI
46 tristate
47 + select REGMAP
48 + depends on SPI_MASTER
49 depends on SPI
50
51 config REGMAP_SPMI
52 tristate
53 + select REGMAP
54 depends on SPMI
55
56 config REGMAP_W1
57 tristate
58 + select REGMAP
59 depends on W1
60
61 config REGMAP_MMIO
62 tristate
63 + select REGMAP
64
65 config REGMAP_IRQ
66 bool
67 + select REGMAP
68
69 config REGMAP_SOUNDWIRE
70 tristate
71 + select REGMAP
72 depends on SOUNDWIRE
73
74 config REGMAP_SCCB
75 tristate
76 + select REGMAP
77 depends on I2C
78
79 config REGMAP_I3C
80 tristate
81 + select REGMAP
82 depends on I3C
83
84 config REGMAP_SPI_AVMM
85 tristate
86 + select REGMAP
87 depends on SPI
88 --- a/drivers/base/regmap/Makefile
89 +++ b/drivers/base/regmap/Makefile
90 @@ -2,10 +2,14 @@
91 # For include/trace/define_trace.h to include trace.h
92 CFLAGS_regmap.o := -I$(src)
93
94 -obj-$(CONFIG_REGMAP) += regmap.o regcache.o
95 -obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o
96 -obj-$(CONFIG_REGCACHE_COMPRESSED) += regcache-lzo.o
97 -obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o
98 +regmap-core-objs = regmap.o regcache.o regcache-rbtree.o regcache-flat.o
99 +ifdef CONFIG_DEBUG_FS
100 +regmap-core-objs += regmap-debugfs.o
101 +endif
102 +ifdef CONFIG_REGCACHE_COMPRESSED
103 +regmap-core-objs += regcache-lzo.o
104 +endif
105 +obj-$(CONFIG_REGMAP) += regmap-core.o
106 obj-$(CONFIG_REGMAP_AC97) += regmap-ac97.o
107 obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o
108 obj-$(CONFIG_REGMAP_SLIMBUS) += regmap-slimbus.o
109 --- a/drivers/base/regmap/regmap.c
110 +++ b/drivers/base/regmap/regmap.c
111 @@ -9,6 +9,7 @@
112 #include <linux/device.h>
113 #include <linux/slab.h>
114 #include <linux/export.h>
115 +#include <linux/module.h>
116 #include <linux/mutex.h>
117 #include <linux/err.h>
118 #include <linux/property.h>
119 @@ -3298,3 +3299,5 @@ static int __init regmap_initcall(void)
120 return 0;
121 }
122 postcore_initcall(regmap_initcall);
123 +
124 +MODULE_LICENSE("GPL");
125 --- a/include/linux/regmap.h
126 +++ b/include/linux/regmap.h
127 @@ -179,7 +179,7 @@ struct reg_sequence {
128 __ret ?: __tmp; \
129 })
130
131 -#ifdef CONFIG_REGMAP
132 +#if IS_REACHABLE(CONFIG_REGMAP)
133
134 enum regmap_endian {
135 /* Unspecified -> 0 -> Backwards compatible default */