ramips: fix cd-poll sd card remove randomly
[openwrt/staging/wigyori.git] / target / linux / generic / patches-4.4 / 087-regmap-make-LZO-cache-optional.patch
1 From de88e9b0354c2e3ff8eae3f97afe43a34f5ed239 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jonas.gorski@gmail.com>
3 Date: Sat, 13 May 2017 13:03:21 +0200
4 Subject: [PATCH] regmap: make LZO cache optional
5
6 Commit 2cbbb579bcbe3 ("regmap: Add the LZO cache support") added support
7 for LZO compression in regcache, but there were never any users added
8 afterwards. Since LZO support itself has its own size, it currently is
9 rather a deoptimization.
10
11 So make it optional by introducing a symbol that can be selected by
12 drivers wanting to make use of it.
13
14 Saves e.g. ~46 kB on MIPS (size of LZO support + regcache LZO code).
15
16 Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
17 ---
18 I tried using google to find any users (even out-of-tree ones), but at
19 best I found a single driver submission that was switched to RBTREE in
20 subsequent resubmissions (MFD_SMSC).
21
22 One could maybe also just drop the code because of no users for 5 years,
23 but that would be up to the maintainer(s) to decide.
24
25 drivers/base/regmap/Kconfig | 5 ++++-
26 drivers/base/regmap/Makefile | 3 ++-
27 drivers/base/regmap/regcache.c | 2 ++
28 3 files changed, 8 insertions(+), 2 deletions(-)
29
30 --- a/drivers/base/regmap/Kconfig
31 +++ b/drivers/base/regmap/Kconfig
32 @@ -4,9 +4,12 @@
33
34 config REGMAP
35 default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ)
36 + select IRQ_DOMAIN if REGMAP_IRQ
37 + bool
38 +
39 +config REGCACHE_COMPRESSED
40 select LZO_COMPRESS
41 select LZO_DECOMPRESS
42 - select IRQ_DOMAIN if REGMAP_IRQ
43 bool
44
45 config REGMAP_AC97
46 --- a/drivers/base/regmap/Makefile
47 +++ b/drivers/base/regmap/Makefile
48 @@ -2,7 +2,8 @@
49 CFLAGS_regmap.o := -I$(src)
50
51 obj-$(CONFIG_REGMAP) += regmap.o regcache.o
52 -obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-lzo.o regcache-flat.o
53 +obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o
54 +obj-$(CONFIG_REGCACHE_COMPRESSED) += regcache-lzo.o
55 obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o
56 obj-$(CONFIG_REGMAP_AC97) += regmap-ac97.o
57 obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o
58 --- a/drivers/base/regmap/regcache.c
59 +++ b/drivers/base/regmap/regcache.c
60 @@ -21,7 +21,9 @@
61
62 static const struct regcache_ops *cache_types[] = {
63 &regcache_rbtree_ops,
64 +#if IS_ENABLED(CONFIG_REGCACHE_COMPRESSED)
65 &regcache_lzo_ops,
66 +#endif
67 &regcache_flat_ops,
68 };
69