1
0

259-regmap_dynamic.patch 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. From 811d9e2268a62b830cfe93cd8bc929afcb8b198b Mon Sep 17 00:00:00 2001
  2. From: Felix Fietkau <nbd@nbd.name>
  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 <nbd@nbd.name>
  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)
  19. select IRQ_DOMAIN if REGMAP_IRQ
  20. - bool
  21. + tristate "Regmap"
  22. config REGCACHE_COMPRESSED
  23. select LZO_COMPRESS
  24. @@ -17,23 +16,30 @@ config REGMAP_AC97
  25. tristate
  26. config REGMAP_I2C
  27. - tristate
  28. + tristate "Regmap I2C"
  29. + select REGMAP
  30. depends on I2C
  31. config REGMAP_SPI
  32. - tristate
  33. + tristate "Regmap SPI"
  34. + select REGMAP
  35. + depends on SPI_MASTER
  36. depends on SPI
  37. config REGMAP_SPMI
  38. + select REGMAP
  39. tristate
  40. depends on SPMI
  41. config REGMAP_W1
  42. + select REGMAP
  43. tristate
  44. depends on W1
  45. config REGMAP_MMIO
  46. - tristate
  47. + tristate "Regmap MMIO"
  48. + select REGMAP
  49. config REGMAP_IRQ
  50. + select REGMAP
  51. bool
  52. --- a/drivers/base/regmap/Makefile
  53. +++ b/drivers/base/regmap/Makefile
  54. @@ -2,10 +2,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. --- a/drivers/base/regmap/regmap.c
  73. +++ b/drivers/base/regmap/regmap.c
  74. @@ -13,6 +13,7 @@
  75. #include <linux/device.h>
  76. #include <linux/slab.h>
  77. #include <linux/export.h>
  78. +#include <linux/module.h>
  79. #include <linux/mutex.h>
  80. #include <linux/err.h>
  81. #include <linux/of.h>
  82. @@ -2926,3 +2927,5 @@ static int __init regmap_initcall(void)
  83. return 0;
  84. }
  85. postcore_initcall(regmap_initcall);
  86. +
  87. +MODULE_LICENSE("GPL");
  88. --- a/include/linux/regmap.h
  89. +++ b/include/linux/regmap.h
  90. @@ -139,7 +139,7 @@ struct reg_sequence {
  91. pollret ?: ((cond) ? 0 : -ETIMEDOUT); \
  92. })
  93. -#ifdef CONFIG_REGMAP
  94. +#if IS_REACHABLE(CONFIG_REGMAP)
  95. enum regmap_endian {
  96. /* Unspecified -> 0 -> Backwards compatible default */