diff mbox series

[v3,1/5] drm: Move EXPORT_SYMBOL_FOR_TESTS_ONLY under a separate Kconfig

Message ID 20191106142432.14022-2-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series [v3,1/5] drm: Move EXPORT_SYMBOL_FOR_TESTS_ONLY under a separate Kconfig | expand

Commit Message

Chris Wilson Nov. 6, 2019, 2:24 p.m. UTC
Currently, we only export symbols for drm-selftests which are either
compiled as modules or into the main drm builtin. However, if we want to
export symbols from drm.ko for the drivers' selftests, we require a
means of controlling that export separately. So we add a new Kconfig to
determine whether or not the EXPORT_SYMBOL_FOR_TESTS_ONLY() takes
effect.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/Kconfig | 4 ++++
 include/drm/drm_util.h  | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Daniel Vetter Nov. 7, 2019, 8:35 a.m. UTC | #1
On Wed, Nov 06, 2019 at 02:24:28PM +0000, Chris Wilson wrote:
> Currently, we only export symbols for drm-selftests which are either
> compiled as modules or into the main drm builtin. However, if we want to
> export symbols from drm.ko for the drivers' selftests, we require a
> means of controlling that export separately. So we add a new Kconfig to
> determine whether or not the EXPORT_SYMBOL_FOR_TESTS_ONLY() takes
> effect.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>

Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> ---
>  drivers/gpu/drm/Kconfig | 4 ++++
>  include/drm/drm_util.h  | 2 +-
>  2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
> index 617d9c3a86c3..d3560afe34d3 100644
> --- a/drivers/gpu/drm/Kconfig
> +++ b/drivers/gpu/drm/Kconfig
> @@ -54,6 +54,9 @@ config DRM_DEBUG_MM
>  
>  	  If in doubt, say "N".
>  
> +config DRM_EXPORT_FOR_TESTS
> +	bool
> +
>  config DRM_DEBUG_SELFTEST
>  	tristate "kselftests for DRM"
>  	depends on DRM
> @@ -61,6 +64,7 @@ config DRM_DEBUG_SELFTEST
>  	select PRIME_NUMBERS
>  	select DRM_LIB_RANDOM
>  	select DRM_KMS_HELPER
> +	select DRM_EXPORT_FOR_TESTS if m
>  	default n
>  	help
>  	  This option provides kernel modules that can be used to run
> diff --git a/include/drm/drm_util.h b/include/drm/drm_util.h
> index 07b8e9f04599..79952d8c4bba 100644
> --- a/include/drm/drm_util.h
> +++ b/include/drm/drm_util.h
> @@ -41,7 +41,7 @@
>   * Use EXPORT_SYMBOL_FOR_TESTS_ONLY() for functions that shall
>   * only be visible for drmselftests.
>   */
> -#if defined(CONFIG_DRM_DEBUG_SELFTEST_MODULE)
> +#if defined(CONFIG_DRM_EXPORT_FOR_TESTS)
>  #define EXPORT_SYMBOL_FOR_TESTS_ONLY(x) EXPORT_SYMBOL(x)
>  #else
>  #define EXPORT_SYMBOL_FOR_TESTS_ONLY(x)
> -- 
> 2.24.0
>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig
index 617d9c3a86c3..d3560afe34d3 100644
--- a/drivers/gpu/drm/Kconfig
+++ b/drivers/gpu/drm/Kconfig
@@ -54,6 +54,9 @@  config DRM_DEBUG_MM
 
 	  If in doubt, say "N".
 
+config DRM_EXPORT_FOR_TESTS
+	bool
+
 config DRM_DEBUG_SELFTEST
 	tristate "kselftests for DRM"
 	depends on DRM
@@ -61,6 +64,7 @@  config DRM_DEBUG_SELFTEST
 	select PRIME_NUMBERS
 	select DRM_LIB_RANDOM
 	select DRM_KMS_HELPER
+	select DRM_EXPORT_FOR_TESTS if m
 	default n
 	help
 	  This option provides kernel modules that can be used to run
diff --git a/include/drm/drm_util.h b/include/drm/drm_util.h
index 07b8e9f04599..79952d8c4bba 100644
--- a/include/drm/drm_util.h
+++ b/include/drm/drm_util.h
@@ -41,7 +41,7 @@ 
  * Use EXPORT_SYMBOL_FOR_TESTS_ONLY() for functions that shall
  * only be visible for drmselftests.
  */
-#if defined(CONFIG_DRM_DEBUG_SELFTEST_MODULE)
+#if defined(CONFIG_DRM_EXPORT_FOR_TESTS)
 #define EXPORT_SYMBOL_FOR_TESTS_ONLY(x) EXPORT_SYMBOL(x)
 #else
 #define EXPORT_SYMBOL_FOR_TESTS_ONLY(x)