087-regmap-make-LZO-cache-optional.patch 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. Commit 2cbbb579bcbe3 ("regmap: Add the LZO cache support") added support
  6. for LZO compression in regcache, but there were never any users added
  7. afterwards. Since LZO support itself has its own size, it currently is
  8. rather a deoptimization.
  9. So make it optional by introducing a symbol that can be selected by
  10. drivers wanting to make use of it.
  11. Saves e.g. ~46 kB on MIPS (size of LZO support + regcache LZO code).
  12. Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
  13. ---
  14. I tried using google to find any users (even out-of-tree ones), but at
  15. best I found a single driver submission that was switched to RBTREE in
  16. subsequent resubmissions (MFD_SMSC).
  17. One could maybe also just drop the code because of no users for 5 years,
  18. but that would be up to the maintainer(s) to decide.
  19. drivers/base/regmap/Kconfig | 5 ++++-
  20. drivers/base/regmap/Makefile | 3 ++-
  21. drivers/base/regmap/regcache.c | 2 ++
  22. 3 files changed, 8 insertions(+), 2 deletions(-)
  23. --- a/drivers/base/regmap/Kconfig
  24. +++ b/drivers/base/regmap/Kconfig
  25. @@ -4,9 +4,12 @@
  26. config REGMAP
  27. default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_MMIO || REGMAP_IRQ)
  28. + select IRQ_DOMAIN if REGMAP_IRQ
  29. + bool
  30. +
  31. +config REGCACHE_COMPRESSED
  32. select LZO_COMPRESS
  33. select LZO_DECOMPRESS
  34. - select IRQ_DOMAIN if REGMAP_IRQ
  35. bool
  36. config REGMAP_I2C
  37. --- a/drivers/base/regmap/Makefile
  38. +++ b/drivers/base/regmap/Makefile
  39. @@ -1,5 +1,6 @@
  40. obj-$(CONFIG_REGMAP) += regmap.o regcache.o
  41. -obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-lzo.o regcache-flat.o
  42. +obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o
  43. +obj-$(CONFIG_REGCACHE_COMPRESSED) += regcache-lzo.o
  44. obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o
  45. obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o
  46. obj-$(CONFIG_REGMAP_SPI) += regmap-spi.o
  47. --- a/drivers/base/regmap/regcache.c
  48. +++ b/drivers/base/regmap/regcache.c
  49. @@ -21,7 +21,9 @@
  50. static const struct regcache_ops *cache_types[] = {
  51. &regcache_rbtree_ops,
  52. +#if IS_ENABLED(CONFIG_REGCACHE_COMPRESSED)
  53. &regcache_lzo_ops,
  54. +#endif
  55. &regcache_flat_ops,
  56. };