All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH v3 08/12] drm/edid: constify struct detailed_timing in parsing callbacks
Date: Mon, 28 Mar 2022 20:37:49 +0300	[thread overview]
Message-ID: <YkHybf6vPaLCT+Tt@intel.com> (raw)
In-Reply-To: <9b617068d2349a574a837ad6207b1d45c4d79eb5.1648477901.git.jani.nikula@intel.com>

On Mon, Mar 28, 2022 at 05:34:29PM +0300, Jani Nikula wrote:
> Moving one level higher, constify struct detailed_timing pointers in
> callbacks.
> 
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/drm_edid.c | 40 ++++++++++++++++++++------------------
>  1 file changed, 21 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 6d1461991ba4..47234cf211ca 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -2349,7 +2349,7 @@ static bool is_detailed_timing_descriptor(const struct detailed_timing *descript
>  	return descriptor->pixel_clock != 0;
>  }
>  
> -typedef void detailed_cb(struct detailed_timing *timing, void *closure);
> +typedef void detailed_cb(const struct detailed_timing *timing, void *closure);
>  
>  static void
>  cea_for_each_detailed_block(u8 *ext, detailed_cb *cb, void *closure)
> @@ -2408,7 +2408,7 @@ drm_for_each_detailed_block(u8 *raw_edid, detailed_cb *cb, void *closure)
>  }
>  
>  static void
> -is_rb(struct detailed_timing *descriptor, void *data)
> +is_rb(const struct detailed_timing *descriptor, void *data)
>  {
>  	bool *res = data;
>  
> @@ -2438,9 +2438,9 @@ drm_monitor_supports_rb(struct edid *edid)
>  }
>  
>  static void
> -find_gtf2(struct detailed_timing *descriptor, void *data)
> +find_gtf2(const struct detailed_timing *descriptor, void *data)
>  {
> -	struct detailed_timing **res = data;
> +	const struct detailed_timing **res = data;
>  
>  	if (!is_display_descriptor(descriptor, EDID_DETAIL_MONITOR_RANGE))
>  		return;
> @@ -2455,7 +2455,7 @@ find_gtf2(struct detailed_timing *descriptor, void *data)
>  static int
>  drm_gtf2_hbreak(struct edid *edid)
>  {
> -	struct detailed_timing *descriptor = NULL;
> +	const struct detailed_timing *descriptor = NULL;
>  
>  	drm_for_each_detailed_block((u8 *)edid, find_gtf2, &descriptor);
>  
> @@ -2467,7 +2467,7 @@ drm_gtf2_hbreak(struct edid *edid)
>  static int
>  drm_gtf2_2c(struct edid *edid)
>  {
> -	struct detailed_timing *descriptor = NULL;
> +	const struct detailed_timing *descriptor = NULL;
>  
>  	drm_for_each_detailed_block((u8 *)edid, find_gtf2, &descriptor);
>  
> @@ -2479,7 +2479,7 @@ drm_gtf2_2c(struct edid *edid)
>  static int
>  drm_gtf2_m(struct edid *edid)
>  {
> -	struct detailed_timing *descriptor = NULL;
> +	const struct detailed_timing *descriptor = NULL;
>  
>  	drm_for_each_detailed_block((u8 *)edid, find_gtf2, &descriptor);
>  
> @@ -2491,7 +2491,7 @@ drm_gtf2_m(struct edid *edid)
>  static int
>  drm_gtf2_k(struct edid *edid)
>  {
> -	struct detailed_timing *descriptor = NULL;
> +	const struct detailed_timing *descriptor = NULL;
>  
>  	drm_for_each_detailed_block((u8 *)edid, find_gtf2, &descriptor);
>  
> @@ -2503,7 +2503,7 @@ drm_gtf2_k(struct edid *edid)
>  static int
>  drm_gtf2_2j(struct edid *edid)
>  {
> -	struct detailed_timing *descriptor = NULL;
> +	const struct detailed_timing *descriptor = NULL;
>  
>  	drm_for_each_detailed_block((u8 *)edid, find_gtf2, &descriptor);
>  
> @@ -3009,7 +3009,7 @@ drm_cvt_modes_for_range(struct drm_connector *connector, struct edid *edid,
>  }
>  
>  static void
> -do_inferred_modes(struct detailed_timing *timing, void *c)
> +do_inferred_modes(const struct detailed_timing *timing, void *c)
>  {
>  	struct detailed_mode_closure *closure = c;
>  	const struct detailed_non_pixel *data = &timing->data.other_data;
> @@ -3091,7 +3091,7 @@ drm_est3_modes(struct drm_connector *connector, const struct detailed_timing *ti
>  }
>  
>  static void
> -do_established_modes(struct detailed_timing *timing, void *c)
> +do_established_modes(const struct detailed_timing *timing, void *c)
>  {
>  	struct detailed_mode_closure *closure = c;
>  
> @@ -3142,7 +3142,7 @@ add_established_modes(struct drm_connector *connector, struct edid *edid)
>  }
>  
>  static void
> -do_standard_modes(struct detailed_timing *timing, void *c)
> +do_standard_modes(const struct detailed_timing *timing, void *c)
>  {
>  	struct detailed_mode_closure *closure = c;
>  	const struct detailed_non_pixel *data = &timing->data.other_data;
> @@ -3255,7 +3255,7 @@ static int drm_cvt_modes(struct drm_connector *connector,
>  }
>  
>  static void
> -do_cvt_mode(struct detailed_timing *timing, void *c)
> +do_cvt_mode(const struct detailed_timing *timing, void *c)
>  {
>  	struct detailed_mode_closure *closure = c;
>  
> @@ -3284,7 +3284,7 @@ add_cvt_modes(struct drm_connector *connector, struct edid *edid)
>  static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode);
>  
>  static void
> -do_detailed_mode(struct detailed_timing *timing, void *c)
> +do_detailed_mode(const struct detailed_timing *timing, void *c)
>  {
>  	struct detailed_mode_closure *closure = c;
>  	struct drm_display_mode *newmode;
> @@ -4517,17 +4517,19 @@ drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const u8 *db)
>  }
>  
>  static void
> -monitor_name(struct detailed_timing *t, void *data)
> +monitor_name(const struct detailed_timing *timing, void *data)
>  {
> -	if (!is_display_descriptor(t, EDID_DETAIL_MONITOR_NAME))
> +	const char **res = data;
> +
> +	if (!is_display_descriptor(timing, EDID_DETAIL_MONITOR_NAME))
>  		return;
>  
> -	*(u8 **)data = t->data.other_data.data.str.str;
> +	*res = timing->data.other_data.data.str.str;
>  }
>  
>  static int get_monitor_name(struct edid *edid, char name[13])
>  {
> -	char *edid_name = NULL;
> +	const char *edid_name = NULL;
>  	int mnl;
>  
>  	if (!edid || !name)
> @@ -5247,7 +5249,7 @@ static void drm_parse_cea_ext(struct drm_connector *connector,
>  }
>  
>  static
> -void get_monitor_range(struct detailed_timing *timing,
> +void get_monitor_range(const struct detailed_timing *timing,
>  		       void *info_monitor_range)
>  {
>  	struct drm_monitor_range_info *monitor_range = info_monitor_range;
> -- 
> 2.30.2

-- 
Ville Syrjälä
Intel

WARNING: multiple messages have this Message-ID (diff)
From: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
To: Jani Nikula <jani.nikula@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 08/12] drm/edid: constify struct detailed_timing in parsing callbacks
Date: Mon, 28 Mar 2022 20:37:49 +0300	[thread overview]
Message-ID: <YkHybf6vPaLCT+Tt@intel.com> (raw)
In-Reply-To: <9b617068d2349a574a837ad6207b1d45c4d79eb5.1648477901.git.jani.nikula@intel.com>

On Mon, Mar 28, 2022 at 05:34:29PM +0300, Jani Nikula wrote:
> Moving one level higher, constify struct detailed_timing pointers in
> callbacks.
> 
> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
>  drivers/gpu/drm/drm_edid.c | 40 ++++++++++++++++++++------------------
>  1 file changed, 21 insertions(+), 19 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
> index 6d1461991ba4..47234cf211ca 100644
> --- a/drivers/gpu/drm/drm_edid.c
> +++ b/drivers/gpu/drm/drm_edid.c
> @@ -2349,7 +2349,7 @@ static bool is_detailed_timing_descriptor(const struct detailed_timing *descript
>  	return descriptor->pixel_clock != 0;
>  }
>  
> -typedef void detailed_cb(struct detailed_timing *timing, void *closure);
> +typedef void detailed_cb(const struct detailed_timing *timing, void *closure);
>  
>  static void
>  cea_for_each_detailed_block(u8 *ext, detailed_cb *cb, void *closure)
> @@ -2408,7 +2408,7 @@ drm_for_each_detailed_block(u8 *raw_edid, detailed_cb *cb, void *closure)
>  }
>  
>  static void
> -is_rb(struct detailed_timing *descriptor, void *data)
> +is_rb(const struct detailed_timing *descriptor, void *data)
>  {
>  	bool *res = data;
>  
> @@ -2438,9 +2438,9 @@ drm_monitor_supports_rb(struct edid *edid)
>  }
>  
>  static void
> -find_gtf2(struct detailed_timing *descriptor, void *data)
> +find_gtf2(const struct detailed_timing *descriptor, void *data)
>  {
> -	struct detailed_timing **res = data;
> +	const struct detailed_timing **res = data;
>  
>  	if (!is_display_descriptor(descriptor, EDID_DETAIL_MONITOR_RANGE))
>  		return;
> @@ -2455,7 +2455,7 @@ find_gtf2(struct detailed_timing *descriptor, void *data)
>  static int
>  drm_gtf2_hbreak(struct edid *edid)
>  {
> -	struct detailed_timing *descriptor = NULL;
> +	const struct detailed_timing *descriptor = NULL;
>  
>  	drm_for_each_detailed_block((u8 *)edid, find_gtf2, &descriptor);
>  
> @@ -2467,7 +2467,7 @@ drm_gtf2_hbreak(struct edid *edid)
>  static int
>  drm_gtf2_2c(struct edid *edid)
>  {
> -	struct detailed_timing *descriptor = NULL;
> +	const struct detailed_timing *descriptor = NULL;
>  
>  	drm_for_each_detailed_block((u8 *)edid, find_gtf2, &descriptor);
>  
> @@ -2479,7 +2479,7 @@ drm_gtf2_2c(struct edid *edid)
>  static int
>  drm_gtf2_m(struct edid *edid)
>  {
> -	struct detailed_timing *descriptor = NULL;
> +	const struct detailed_timing *descriptor = NULL;
>  
>  	drm_for_each_detailed_block((u8 *)edid, find_gtf2, &descriptor);
>  
> @@ -2491,7 +2491,7 @@ drm_gtf2_m(struct edid *edid)
>  static int
>  drm_gtf2_k(struct edid *edid)
>  {
> -	struct detailed_timing *descriptor = NULL;
> +	const struct detailed_timing *descriptor = NULL;
>  
>  	drm_for_each_detailed_block((u8 *)edid, find_gtf2, &descriptor);
>  
> @@ -2503,7 +2503,7 @@ drm_gtf2_k(struct edid *edid)
>  static int
>  drm_gtf2_2j(struct edid *edid)
>  {
> -	struct detailed_timing *descriptor = NULL;
> +	const struct detailed_timing *descriptor = NULL;
>  
>  	drm_for_each_detailed_block((u8 *)edid, find_gtf2, &descriptor);
>  
> @@ -3009,7 +3009,7 @@ drm_cvt_modes_for_range(struct drm_connector *connector, struct edid *edid,
>  }
>  
>  static void
> -do_inferred_modes(struct detailed_timing *timing, void *c)
> +do_inferred_modes(const struct detailed_timing *timing, void *c)
>  {
>  	struct detailed_mode_closure *closure = c;
>  	const struct detailed_non_pixel *data = &timing->data.other_data;
> @@ -3091,7 +3091,7 @@ drm_est3_modes(struct drm_connector *connector, const struct detailed_timing *ti
>  }
>  
>  static void
> -do_established_modes(struct detailed_timing *timing, void *c)
> +do_established_modes(const struct detailed_timing *timing, void *c)
>  {
>  	struct detailed_mode_closure *closure = c;
>  
> @@ -3142,7 +3142,7 @@ add_established_modes(struct drm_connector *connector, struct edid *edid)
>  }
>  
>  static void
> -do_standard_modes(struct detailed_timing *timing, void *c)
> +do_standard_modes(const struct detailed_timing *timing, void *c)
>  {
>  	struct detailed_mode_closure *closure = c;
>  	const struct detailed_non_pixel *data = &timing->data.other_data;
> @@ -3255,7 +3255,7 @@ static int drm_cvt_modes(struct drm_connector *connector,
>  }
>  
>  static void
> -do_cvt_mode(struct detailed_timing *timing, void *c)
> +do_cvt_mode(const struct detailed_timing *timing, void *c)
>  {
>  	struct detailed_mode_closure *closure = c;
>  
> @@ -3284,7 +3284,7 @@ add_cvt_modes(struct drm_connector *connector, struct edid *edid)
>  static void fixup_detailed_cea_mode_clock(struct drm_display_mode *mode);
>  
>  static void
> -do_detailed_mode(struct detailed_timing *timing, void *c)
> +do_detailed_mode(const struct detailed_timing *timing, void *c)
>  {
>  	struct detailed_mode_closure *closure = c;
>  	struct drm_display_mode *newmode;
> @@ -4517,17 +4517,19 @@ drm_parse_hdmi_vsdb_audio(struct drm_connector *connector, const u8 *db)
>  }
>  
>  static void
> -monitor_name(struct detailed_timing *t, void *data)
> +monitor_name(const struct detailed_timing *timing, void *data)
>  {
> -	if (!is_display_descriptor(t, EDID_DETAIL_MONITOR_NAME))
> +	const char **res = data;
> +
> +	if (!is_display_descriptor(timing, EDID_DETAIL_MONITOR_NAME))
>  		return;
>  
> -	*(u8 **)data = t->data.other_data.data.str.str;
> +	*res = timing->data.other_data.data.str.str;
>  }
>  
>  static int get_monitor_name(struct edid *edid, char name[13])
>  {
> -	char *edid_name = NULL;
> +	const char *edid_name = NULL;
>  	int mnl;
>  
>  	if (!edid || !name)
> @@ -5247,7 +5249,7 @@ static void drm_parse_cea_ext(struct drm_connector *connector,
>  }
>  
>  static
> -void get_monitor_range(struct detailed_timing *timing,
> +void get_monitor_range(const struct detailed_timing *timing,
>  		       void *info_monitor_range)
>  {
>  	struct drm_monitor_range_info *monitor_range = info_monitor_range;
> -- 
> 2.30.2

-- 
Ville Syrjälä
Intel

  reply	other threads:[~2022-03-28 17:37 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-28 14:34 [PATCH v3 00/12] drm/edid: constify EDID parsing, with fixes Jani Nikula
2022-03-28 14:34 ` [Intel-gfx] " Jani Nikula
2022-03-28 14:34 ` [PATCH v3 01/12] drm/edid: don't modify EDID while parsing Jani Nikula
2022-03-28 14:34   ` [Intel-gfx] " Jani Nikula
2022-03-28 14:34 ` [PATCH v3 02/12] drm/edid: fix reduced blanking support check Jani Nikula
2022-03-28 14:34   ` [Intel-gfx] " Jani Nikula
2022-03-28 17:27   ` Ville Syrjälä
2022-03-28 17:27     ` Ville Syrjälä
2022-03-28 14:34 ` [PATCH v3 03/12] drm/edid: pass a timing pointer to is_display_descriptor() Jani Nikula
2022-03-28 14:34   ` [Intel-gfx] " Jani Nikula
2022-03-28 17:28   ` Ville Syrjälä
2022-03-28 17:28     ` [Intel-gfx] " Ville Syrjälä
2022-03-28 14:34 ` [PATCH v3 04/12] drm/edid: pass a timing pointer to is_detailed_timing_descriptor() Jani Nikula
2022-03-28 14:34   ` [Intel-gfx] " Jani Nikula
2022-03-28 17:29   ` Ville Syrjälä
2022-03-28 17:29     ` Ville Syrjälä
2022-03-28 14:34 ` [PATCH v3 05/12] drm/edid: use struct detailed_timing member access in is_rb() Jani Nikula
2022-03-28 14:34   ` [Intel-gfx] " Jani Nikula
2022-03-28 17:29   ` Ville Syrjälä
2022-03-28 17:29     ` [Intel-gfx] " Ville Syrjälä
2022-03-28 14:34 ` [PATCH v3 06/12] drm/edid: use struct detailed_timing member access in gtf2 functions Jani Nikula
2022-03-28 14:34   ` [Intel-gfx] " Jani Nikula
2022-03-28 17:34   ` Ville Syrjälä
2022-03-28 17:34     ` [Intel-gfx] " Ville Syrjälä
2022-03-28 14:34 ` [PATCH v3 07/12] drm/edid: constify struct detailed_timing in lower level parsing Jani Nikula
2022-03-28 14:34   ` [Intel-gfx] " Jani Nikula
2022-03-28 17:35   ` Ville Syrjälä
2022-03-28 17:35     ` [Intel-gfx] " Ville Syrjälä
2022-03-28 14:34 ` [PATCH v3 08/12] drm/edid: constify struct detailed_timing in parsing callbacks Jani Nikula
2022-03-28 14:34   ` [Intel-gfx] " Jani Nikula
2022-03-28 17:37   ` Ville Syrjälä [this message]
2022-03-28 17:37     ` Ville Syrjälä
2022-03-28 14:34 ` [PATCH v3 09/12] drm/edid: constify struct edid passed to detailed blocks Jani Nikula
2022-03-28 14:34   ` [Intel-gfx] " Jani Nikula
2022-03-28 17:39   ` Ville Syrjälä
2022-03-28 17:39     ` [Intel-gfx] " Ville Syrjälä
2022-03-28 14:34 ` [PATCH v3 10/12] drm/edid: constify struct edid passed around in callbacks and closure Jani Nikula
2022-03-28 14:34   ` [Intel-gfx] " Jani Nikula
2022-03-28 17:40   ` Ville Syrjälä
2022-03-28 17:40     ` Ville Syrjälä
2022-03-28 14:34 ` [PATCH v3 11/12] drm/edid: add more general struct edid constness in the interfaces Jani Nikula
2022-03-28 14:34   ` [Intel-gfx] " Jani Nikula
2022-03-28 17:41   ` Ville Syrjälä
2022-03-28 17:41     ` [Intel-gfx] " Ville Syrjälä
2022-03-28 14:34 ` [PATCH v3 12/12] drm/edid: split drm_add_edid_modes() to two Jani Nikula
2022-03-28 14:34   ` [Intel-gfx] " Jani Nikula
2022-03-28 17:48   ` Ville Syrjälä
2022-03-28 17:48     ` Ville Syrjälä
2022-03-28 18:35     ` Jani Nikula
2022-03-28 18:35       ` [Intel-gfx] " Jani Nikula
2022-03-28 18:00 ` [PATCH v3 00/12] drm/edid: constify EDID parsing, with fixes Emil Velikov
2022-03-28 18:00   ` [Intel-gfx] " Emil Velikov
2022-03-28 18:36   ` Jani Nikula
2022-03-28 18:36     ` [Intel-gfx] " Jani Nikula
2022-03-29  1:28 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/edid: constify EDID parsing, with fixes (rev2) Patchwork
2022-03-29  1:30 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-03-29  1:34 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2022-03-29  1:59 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-03-29  4:35 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork
2022-03-29  9:21 ` [Intel-gfx] ✗ Fi.CI.CHECKPATCH: warning for drm/edid: constify EDID parsing, with fixes (rev3) Patchwork
2022-03-29  9:23 ` [Intel-gfx] ✗ Fi.CI.SPARSE: " Patchwork
2022-03-29  9:27 ` [Intel-gfx] ✗ Fi.CI.DOCS: " Patchwork
2022-03-29  9:59 ` [Intel-gfx] ✓ Fi.CI.BAT: success " Patchwork
2022-03-29 12:55 ` [Intel-gfx] ✓ Fi.CI.IGT: " Patchwork

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=YkHybf6vPaLCT+Tt@intel.com \
    --to=ville.syrjala@linux.intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    /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.