259-regmap_dynamic.patch 3.4 KB

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