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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. --- a/drivers/media/platform/atmel/Kconfig
  30. +++ b/drivers/media/platform/atmel/Kconfig
  31. @@ -8,6 +8,7 @@ config VIDEO_ATMEL_ISC
  32. select VIDEOBUF2_DMA_CONTIG
  33. select REGMAP_MMIO
  34. select V4L2_FWNODE
  35. + select VIDEO_ATMEL_ISC_BASE
  36. help
  37. This module makes the ATMEL Image Sensor Controller available
  38. as a v4l2 device.
  39. @@ -19,10 +20,17 @@ config VIDEO_ATMEL_XISC
  40. select VIDEOBUF2_DMA_CONTIG
  41. select REGMAP_MMIO
  42. select V4L2_FWNODE
  43. + select VIDEO_ATMEL_ISC_BASE
  44. help
  45. This module makes the ATMEL eXtended Image Sensor Controller
  46. available as a v4l2 device.
  47. +config VIDEO_ATMEL_ISC_BASE
  48. + tristate
  49. + default n
  50. + help
  51. + ATMEL ISC and XISC common code base.
  52. +
  53. config VIDEO_ATMEL_ISI
  54. tristate "ATMEL Image Sensor Interface (ISI) support"
  55. depends on VIDEO_V4L2 && OF
  56. --- a/drivers/media/platform/atmel/Makefile
  57. +++ b/drivers/media/platform/atmel/Makefile
  58. @@ -1,7 +1,8 @@
  59. # SPDX-License-Identifier: GPL-2.0-only
  60. -atmel-isc-objs = atmel-sama5d2-isc.o atmel-isc-base.o
  61. -atmel-xisc-objs = atmel-sama7g5-isc.o atmel-isc-base.o
  62. +atmel-isc-objs = atmel-sama5d2-isc.o
  63. +atmel-xisc-objs = atmel-sama7g5-isc.o
  64. obj-$(CONFIG_VIDEO_ATMEL_ISI) += atmel-isi.o
  65. +obj-$(CONFIG_VIDEO_ATMEL_ISC_BASE) += atmel-isc-base.o
  66. obj-$(CONFIG_VIDEO_ATMEL_ISC) += atmel-isc.o
  67. obj-$(CONFIG_VIDEO_ATMEL_XISC) += atmel-xisc.o
  68. --- a/drivers/media/platform/atmel/atmel-isc-base.c
  69. +++ b/drivers/media/platform/atmel/atmel-isc-base.c
  70. @@ -378,6 +378,7 @@ int isc_clk_init(struct isc_device *isc)
  71. return 0;
  72. }
  73. +EXPORT_SYMBOL_GPL(isc_clk_init);
  74. void isc_clk_cleanup(struct isc_device *isc)
  75. {
  76. @@ -392,6 +393,7 @@ void isc_clk_cleanup(struct isc_device *
  77. clk_unregister(isc_clk->clk);
  78. }
  79. }
  80. +EXPORT_SYMBOL_GPL(isc_clk_cleanup);
  81. static int isc_queue_setup(struct vb2_queue *vq,
  82. unsigned int *nbuffers, unsigned int *nplanes,
  83. @@ -1575,6 +1577,7 @@ irqreturn_t isc_interrupt(int irq, void
  84. return ret;
  85. }
  86. +EXPORT_SYMBOL_GPL(isc_interrupt);
  87. static void isc_hist_count(struct isc_device *isc, u32 *min, u32 *max)
  88. {
  89. @@ -2209,6 +2212,7 @@ const struct v4l2_async_notifier_operati
  90. .unbind = isc_async_unbind,
  91. .complete = isc_async_complete,
  92. };
  93. +EXPORT_SYMBOL_GPL(isc_async_ops);
  94. void isc_subdev_cleanup(struct isc_device *isc)
  95. {
  96. @@ -2221,6 +2225,7 @@ void isc_subdev_cleanup(struct isc_devic
  97. INIT_LIST_HEAD(&isc->subdev_entities);
  98. }
  99. +EXPORT_SYMBOL_GPL(isc_subdev_cleanup);
  100. int isc_pipeline_init(struct isc_device *isc)
  101. {
  102. @@ -2261,6 +2266,7 @@ int isc_pipeline_init(struct isc_device
  103. return 0;
  104. }
  105. +EXPORT_SYMBOL_GPL(isc_pipeline_init);
  106. /* regmap configuration */
  107. #define ATMEL_ISC_REG_MAX 0xd5c
  108. @@ -2270,4 +2276,9 @@ const struct regmap_config isc_regmap_co
  109. .val_bits = 32,
  110. .max_register = ATMEL_ISC_REG_MAX,
  111. };
  112. +EXPORT_SYMBOL_GPL(isc_regmap_config);
  113. +MODULE_AUTHOR("Songjun Wu");
  114. +MODULE_AUTHOR("Eugen Hristev");
  115. +MODULE_DESCRIPTION("Atmel ISC common code base");
  116. +MODULE_LICENSE("GPL v2");