2
0

259-regmap_dynamic.patch 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  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. help
  22. Enable support for the Register Map (regmap) access API.
  23. @@ -17,7 +16,7 @@ config REGMAP
  24. config REGMAP_KUNIT
  25. tristate "KUnit tests for regmap"
  26. - depends on KUNIT && REGMAP
  27. + depends on KUNIT
  28. default KUNIT_ALL_TESTS
  29. select REGMAP_RAM
  30. @@ -32,62 +31,78 @@ config REGMAP_BUILD
  31. normally enabled.
  32. config REGMAP_AC97
  33. + select REGMAP
  34. tristate
  35. config REGMAP_I2C
  36. + select REGMAP
  37. tristate
  38. depends on I2C
  39. config REGMAP_SLIMBUS
  40. + select REGMAP
  41. tristate
  42. depends on SLIMBUS
  43. config REGMAP_SPI
  44. + select REGMAP
  45. tristate
  46. depends on SPI
  47. config REGMAP_SPMI
  48. + select REGMAP
  49. tristate
  50. depends on SPMI
  51. config REGMAP_W1
  52. + select REGMAP
  53. tristate
  54. depends on W1
  55. config REGMAP_MDIO
  56. + select REGMAP
  57. tristate
  58. select MDIO_BUS
  59. config REGMAP_MMIO
  60. + select REGMAP
  61. tristate
  62. config REGMAP_IRQ
  63. + select REGMAP
  64. bool
  65. select IRQ_DOMAIN
  66. config REGMAP_RAM
  67. + select REGMAP
  68. tristate
  69. config REGMAP_SOUNDWIRE
  70. + select REGMAP
  71. tristate
  72. depends on SOUNDWIRE
  73. config REGMAP_SOUNDWIRE_MBQ
  74. + select REGMAP
  75. tristate
  76. depends on SOUNDWIRE
  77. config REGMAP_SCCB
  78. + select REGMAP
  79. tristate
  80. depends on I2C
  81. config REGMAP_I3C
  82. + select REGMAP
  83. tristate
  84. depends on I3C
  85. config REGMAP_SPI_AVMM
  86. + select REGMAP
  87. tristate
  88. depends on SPI
  89. config REGMAP_FSI
  90. + select REGMAP
  91. tristate
  92. depends on FSI
  93. --- a/drivers/base/regmap/Makefile
  94. +++ b/drivers/base/regmap/Makefile
  95. @@ -2,9 +2,11 @@
  96. # For include/trace/define_trace.h to include trace.h
  97. CFLAGS_regmap.o := -I$(src)
  98. -obj-$(CONFIG_REGMAP) += regmap.o regcache.o
  99. -obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o regcache-maple.o
  100. -obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o
  101. +regmap-core-objs = regmap.o regcache.o regcache-rbtree.o regcache-flat.o regcache-maple.o
  102. +ifdef CONFIG_DEBUG_FS
  103. +regmap-core-objs += regmap-debugfs.o
  104. +endif
  105. +obj-$(CONFIG_REGMAP) += regmap-core.o
  106. obj-$(CONFIG_REGMAP_KUNIT) += regmap-kunit.o
  107. obj-$(CONFIG_REGMAP_AC97) += regmap-ac97.o
  108. obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.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. @@ -3547,3 +3548,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. @@ -204,7 +204,7 @@ struct reg_sequence {
  128. __ret ?: __tmp; \
  129. })
  130. -#ifdef CONFIG_REGMAP
  131. +#if IS_REACHABLE(CONFIG_REGMAP)
  132. enum regmap_endian {
  133. /* Unspecified -> 0 -> Backwards compatible default */