All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maxime Ripard <maxime@cerno.tech>
To: Daniel Vetter <daniel.vetter@intel.com>,
	David Airlie <airlied@linux.ie>,
	Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
	Thomas Zimmermann <tzimmermann@suse.de>,
	Maxime Ripard <maxime@cerno.tech>
Cc: dri-devel@lists.freedesktop.org
Subject: [PATCH] drm/client: Convert to VISIBLE_IF_KUNIT
Date: Thu,  2 Feb 2023 12:03:12 +0100	[thread overview]
Message-ID: <20230202110312.808607-1-maxime@cerno.tech> (raw)

Commit 8fc0380f6ba7 ("drm/client: Add some tests for
drm_connector_pick_cmdline_mode()") was meant to introduce unit tests
for the static drm_connector_pick_cmdline_mode() function.

In such a case, the kunit documentation recommended to import the tests
source file directly from the source file with the static function to
test.

While it was working, it's generally frowned upon. Fortunately, commit
9c988fae6f6a ("kunit: add macro to allow conditionally exposing static
symbols to tests") introduced macros to easily deal with that case. We
can thus remove our include and use those macros instead.

Signed-off-by: Maxime Ripard <maxime@cerno.tech>
---
 drivers/gpu/drm/drm_client_modeset.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c
index 1b12a3c201a3..f48882941852 100644
--- a/drivers/gpu/drm/drm_client_modeset.c
+++ b/drivers/gpu/drm/drm_client_modeset.c
@@ -8,6 +8,9 @@
  */
 
 #include "drm/drm_modeset_lock.h"
+
+#include <kunit/visibility.h>
+
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/slab.h>
@@ -159,7 +162,8 @@ drm_connector_has_preferred_mode(struct drm_connector *connector, int width, int
 	return NULL;
 }
 
-static struct drm_display_mode *drm_connector_pick_cmdline_mode(struct drm_connector *connector)
+VISIBLE_IF_KUNIT struct drm_display_mode *
+drm_connector_pick_cmdline_mode(struct drm_connector *connector)
 {
 	struct drm_cmdline_mode *cmdline_mode;
 	struct drm_display_mode *mode;
@@ -215,6 +219,7 @@ static struct drm_display_mode *drm_connector_pick_cmdline_mode(struct drm_conne
 
 	return NULL;
 }
+EXPORT_SYMBOL_IF_KUNIT(drm_connector_pick_cmdline_mode);
 
 static bool drm_connector_enabled(struct drm_connector *connector, bool strict)
 {
@@ -1233,7 +1238,3 @@ int drm_client_modeset_dpms(struct drm_client_dev *client, int mode)
 	return ret;
 }
 EXPORT_SYMBOL(drm_client_modeset_dpms);
-
-#ifdef CONFIG_DRM_KUNIT_TEST
-#include "tests/drm_client_modeset_test.c"
-#endif
-- 
2.39.1


             reply	other threads:[~2023-02-02 11:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-02 11:03 Maxime Ripard [this message]
2023-02-02 11:31 ` [PATCH] drm/client: Convert to VISIBLE_IF_KUNIT Maíra Canal
2023-02-02 12:36   ` Maxime Ripard
2023-02-02 12:22 ` Thomas Zimmermann
2023-02-02 12:35   ` Maxime Ripard
2023-02-02 13:05     ` Thomas Zimmermann
2023-02-09  9:30       ` Maxime Ripard
2023-02-02 13:07 ` kernel test robot
2023-02-02 13:07   ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230202110312.808607-1-maxime@cerno.tech \
    --to=maxime@cerno.tech \
    --cc=airlied@linux.ie \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.