190-media-atmel-fix-build-when-ISC-m-and-XISC-y.patch 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. From dfcc0395f5e838c0b5c3fb93c9335b6a8892178a Mon Sep 17 00:00:00 2001
  2. From: Eugen Hristev <[email protected]>
  3. Date: Mon, 5 Jul 2021 14:57:08 +0200
  4. Subject: [PATCH 190/247] media: atmel: fix build when ISC=m and XISC=y
  5. Building VIDEO_ATMEL_ISC as module and VIDEO_ATMEL_XISC as built-in
  6. (or viceversa) causes build errors:
  7. or1k-linux-ld: drivers/media/platform/atmel/atmel-isc-base.o: in function `isc_async_complete':
  8. atmel-isc-base.c:(.text+0x40d0): undefined reference to `__this_module'
  9. or1k-linux-ld: atmel-isc-base.c:(.text+0x40f0): undefined reference to `__this_module'
  10. or1k-linux-ld: drivers/media/platform/atmel/atmel-isc-base.o:(.rodata+0x390): undefined reference to `__this_module'
  11. or1k-linux-ld: drivers/media/platform/atmel/atmel-isc-base.o:(__param+0x4): undefined reference to `__this_module'
  12. or1k-linux-ld: drivers/media/platform/atmel/atmel-isc-base.o:(__param+0x18): undefined reference to `__this_module'
  13. This is caused by the file atmel-isc-base.c which is common code between
  14. the two drivers.
  15. The solution is to create another Kconfig symbol that is automatically
  16. selected and generates the module atmel-isc-base.ko. This module can be
  17. loaded when both drivers are modules, or built-in when at least one of them
  18. is built-in.
  19. Reported-by: kernel test robot <[email protected]>
  20. Fixes: c9aa973884a1 ("media: atmel: atmel-isc: add microchip-xisc driver")
  21. Signed-off-by: Eugen Hristev <[email protected]>
  22. Signed-off-by: Hans Verkuil <[email protected]>
  23. Signed-off-by: Mauro Carvalho Chehab <[email protected]>
  24. ---
  25. drivers/media/platform/atmel/Kconfig | 8 ++++++++
  26. drivers/media/platform/atmel/Makefile | 5 +++--
  27. drivers/media/platform/atmel/atmel-isc-base.c | 11 +++++++++++
  28. 3 files changed, 22 insertions(+), 2 deletions(-)
  29. diff --git a/drivers/media/platform/atmel/Kconfig b/drivers/media/platform/atmel/Kconfig
  30. index 99b51213f871..dda2f27da317 100644
  31. --- a/drivers/media/platform/atmel/Kconfig
  32. +++ b/drivers/media/platform/atmel/Kconfig
  33. @@ -8,6 +8,7 @@ config VIDEO_ATMEL_ISC
  34. select VIDEOBUF2_DMA_CONTIG
  35. select REGMAP_MMIO
  36. select V4L2_FWNODE
  37. + select VIDEO_ATMEL_ISC_BASE
  38. help
  39. This module makes the ATMEL Image Sensor Controller available
  40. as a v4l2 device.
  41. @@ -19,10 +20,17 @@ config VIDEO_ATMEL_XISC
  42. select VIDEOBUF2_DMA_CONTIG
  43. select REGMAP_MMIO
  44. select V4L2_FWNODE
  45. + select VIDEO_ATMEL_ISC_BASE
  46. help
  47. This module makes the ATMEL eXtended Image Sensor Controller
  48. available as a v4l2 device.
  49. +config VIDEO_ATMEL_ISC_BASE
  50. + tristate
  51. + default n
  52. + help
  53. + ATMEL ISC and XISC common code base.
  54. +
  55. config VIDEO_ATMEL_ISI
  56. tristate "ATMEL Image Sensor Interface (ISI) support"
  57. depends on VIDEO_V4L2 && OF
  58. diff --git a/drivers/media/platform/atmel/Makefile b/drivers/media/platform/atmel/Makefile
  59. index c5c01556c653..46d264ab7948 100644
  60. --- a/drivers/media/platform/atmel/Makefile
  61. +++ b/drivers/media/platform/atmel/Makefile
  62. @@ -1,7 +1,8 @@
  63. # SPDX-License-Identifier: GPL-2.0-only
  64. -atmel-isc-objs = atmel-sama5d2-isc.o atmel-isc-base.o
  65. -atmel-xisc-objs = atmel-sama7g5-isc.o atmel-isc-base.o
  66. +atmel-isc-objs = atmel-sama5d2-isc.o
  67. +atmel-xisc-objs = atmel-sama7g5-isc.o
  68. obj-$(CONFIG_VIDEO_ATMEL_ISI) += atmel-isi.o
  69. +obj-$(CONFIG_VIDEO_ATMEL_ISC_BASE) += atmel-isc-base.o
  70. obj-$(CONFIG_VIDEO_ATMEL_ISC) += atmel-isc.o
  71. obj-$(CONFIG_VIDEO_ATMEL_XISC) += atmel-xisc.o
  72. diff --git a/drivers/media/platform/atmel/atmel-isc-base.c b/drivers/media/platform/atmel/atmel-isc-base.c
  73. index 46c6e3e20f33..54168b72fd2f 100644
  74. --- a/drivers/media/platform/atmel/atmel-isc-base.c
  75. +++ b/drivers/media/platform/atmel/atmel-isc-base.c
  76. @@ -378,6 +378,7 @@ int isc_clk_init(struct isc_device *isc)
  77. return 0;
  78. }
  79. +EXPORT_SYMBOL_GPL(isc_clk_init);
  80. void isc_clk_cleanup(struct isc_device *isc)
  81. {
  82. @@ -392,6 +393,7 @@ void isc_clk_cleanup(struct isc_device *isc)
  83. clk_unregister(isc_clk->clk);
  84. }
  85. }
  86. +EXPORT_SYMBOL_GPL(isc_clk_cleanup);
  87. static int isc_queue_setup(struct vb2_queue *vq,
  88. unsigned int *nbuffers, unsigned int *nplanes,
  89. @@ -1575,6 +1577,7 @@ irqreturn_t isc_interrupt(int irq, void *dev_id)
  90. return ret;
  91. }
  92. +EXPORT_SYMBOL_GPL(isc_interrupt);
  93. static void isc_hist_count(struct isc_device *isc, u32 *min, u32 *max)
  94. {
  95. @@ -2209,6 +2212,7 @@ const struct v4l2_async_notifier_operations isc_async_ops = {
  96. .unbind = isc_async_unbind,
  97. .complete = isc_async_complete,
  98. };
  99. +EXPORT_SYMBOL_GPL(isc_async_ops);
  100. void isc_subdev_cleanup(struct isc_device *isc)
  101. {
  102. @@ -2221,6 +2225,7 @@ void isc_subdev_cleanup(struct isc_device *isc)
  103. INIT_LIST_HEAD(&isc->subdev_entities);
  104. }
  105. +EXPORT_SYMBOL_GPL(isc_subdev_cleanup);
  106. int isc_pipeline_init(struct isc_device *isc)
  107. {
  108. @@ -2261,6 +2266,7 @@ int isc_pipeline_init(struct isc_device *isc)
  109. return 0;
  110. }
  111. +EXPORT_SYMBOL_GPL(isc_pipeline_init);
  112. /* regmap configuration */
  113. #define ATMEL_ISC_REG_MAX 0xd5c
  114. @@ -2270,4 +2276,9 @@ const struct regmap_config isc_regmap_config = {
  115. .val_bits = 32,
  116. .max_register = ATMEL_ISC_REG_MAX,
  117. };
  118. +EXPORT_SYMBOL_GPL(isc_regmap_config);
  119. +MODULE_AUTHOR("Songjun Wu");
  120. +MODULE_AUTHOR("Eugen Hristev");
  121. +MODULE_DESCRIPTION("Atmel ISC common code base");
  122. +MODULE_LICENSE("GPL v2");
  123. --
  124. 2.32.0