259-regmap_dynamic.patch 3.2 KB

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