259-regmap_dynamic.patch 3.2 KB

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