2
0

259-regmap_dynamic.patch 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. @@ -3,9 +3,8 @@
  16. # subsystems should select the appropriate symbols.
  17. config REGMAP
  18. - default y if (REGMAP_I2C || REGMAP_SPI || REGMAP_SPMI || REGMAP_AC97 || REGMAP_MMIO || REGMAP_IRQ)
  19. select IRQ_DOMAIN if REGMAP_IRQ
  20. - bool
  21. + tristate
  22. config REGCACHE_COMPRESSED
  23. select LZO_COMPRESS
  24. @@ -17,18 +16,24 @@ config REGMAP_AC97
  25. config REGMAP_I2C
  26. tristate
  27. + select REGMAP
  28. depends on I2C
  29. config REGMAP_SPI
  30. tristate
  31. + select REGMAP
  32. + depends on SPI_MASTER
  33. depends on SPI
  34. config REGMAP_SPMI
  35. + select REGMAP
  36. tristate
  37. depends on SPMI
  38. config REGMAP_MMIO
  39. tristate
  40. + select REGMAP
  41. config REGMAP_IRQ
  42. + select REGMAP
  43. bool
  44. --- a/drivers/base/regmap/Makefile
  45. +++ b/drivers/base/regmap/Makefile
  46. @@ -1,10 +1,14 @@
  47. # For include/trace/define_trace.h to include trace.h
  48. CFLAGS_regmap.o := -I$(src)
  49. -obj-$(CONFIG_REGMAP) += regmap.o regcache.o
  50. -obj-$(CONFIG_REGMAP) += regcache-rbtree.o regcache-flat.o
  51. -obj-$(CONFIG_REGCACHE_COMPRESSED) += regcache-lzo.o
  52. -obj-$(CONFIG_DEBUG_FS) += regmap-debugfs.o
  53. +regmap-core-objs = regmap.o regcache.o regcache-rbtree.o regcache-flat.o
  54. +ifdef CONFIG_DEBUG_FS
  55. +regmap-core-objs += regmap-debugfs.o
  56. +endif
  57. +ifdef CONFIG_REGCACHE_COMPRESSED
  58. +regmap-core-objs += regcache-lzo.o
  59. +endif
  60. +obj-$(CONFIG_REGMAP) += regmap-core.o
  61. obj-$(CONFIG_REGMAP_AC97) += regmap-ac97.o
  62. obj-$(CONFIG_REGMAP_I2C) += regmap-i2c.o
  63. obj-$(CONFIG_REGMAP_SPI) += regmap-spi.o
  64. --- a/drivers/base/regmap/regmap.c
  65. +++ b/drivers/base/regmap/regmap.c
  66. @@ -13,6 +13,7 @@
  67. #include <linux/device.h>
  68. #include <linux/slab.h>
  69. #include <linux/export.h>
  70. +#include <linux/module.h>
  71. #include <linux/mutex.h>
  72. #include <linux/err.h>
  73. #include <linux/of.h>
  74. @@ -2913,3 +2914,5 @@ static int __init regmap_initcall(void)
  75. return 0;
  76. }
  77. postcore_initcall(regmap_initcall);
  78. +
  79. +MODULE_LICENSE("GPL");
  80. --- a/include/linux/regmap.h
  81. +++ b/include/linux/regmap.h
  82. @@ -135,7 +135,7 @@ struct reg_sequence {
  83. pollret ?: ((cond) ? 0 : -ETIMEDOUT); \
  84. })
  85. -#ifdef CONFIG_REGMAP
  86. +#if IS_ENABLED(CONFIG_REGMAP)
  87. enum regmap_endian {
  88. /* Unspecified -> 0 -> Backwards compatible default */