[PATCH i-g-t v7 13/48] lib/igt_kms: Add const when make sense

Louis Chauvet
2026-02-23T12:09:00Z

Const qualifier helps to avoid unwanted modification of a pointer.
To help avoiding those errors, modify the function signature to
use const.

Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com>
Reviewed-by: Kory Maincent <kory.maincent@bootlin.com>
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
---
lib/igt_kms.c | 2 +-
lib/igt_kms.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index ae85d06a9b51..05d07ece6d9b 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -5137,7 +5137,7 @@ int igt_display_drop_events(igt_display_t *display)
*
* Returns: String representing a connector's name, e.g. "DP-1".
*/
-const char *igt_output_name(igt_output_t *output)
+const char *igt_output_name(const igt_output_t *output)
{
return output->name;
}
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 568d863f2dc4..2399ec3069f4 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -590,7 +590,7 @@ igt_pipe_crc_t *igt_crtc_crc_new(igt_crtc_t *crtc, const char *source);
igt_pipe_crc_t *igt_crtc_crc_new_nonblock(igt_crtc_t *crtc, const char *source);

igt_crtc_t *igt_output_get_driving_crtc(igt_output_t *output);
-const char *igt_output_name(igt_output_t *output);
+const char *igt_output_name(const igt_output_t *output);
bool kmstest_mode_is_valid(const drmModeModeInfo *mode);
drmModeModeInfo *igt_output_get_mode(igt_output_t *output);
drmModeModeInfo *igt_output_get_highres_mode(igt_output_t *output);

--
2.52.0