259-regmap_dynamic.patch 3.6 KB

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