[Intel-gfx] [PATCH 8/9] drm/edid: constify struct edid passed around in callbacks and closure
Jani Nikula
jani.nikula at intel.com
Fri Mar 25 12:25:30 UTC 2022
Finalize detailed timing parsing constness by making struct edid also
const in callbacks and closure.
Cc: Ville Syrjälä <ville.syrjala at linux.intel.com>
Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
drivers/gpu/drm/drm_edid.c | 48 +++++++++++++++++++-------------------
1 file changed, 24 insertions(+), 24 deletions(-)
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index fad792ef2c79..fae6f39897c8 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -97,7 +97,7 @@ static int oui(u8 first, u8 second, u8 third)
struct detailed_mode_closure {
struct drm_connector *connector;
- struct edid *edid;
+ const struct edid *edid;
bool preferred;
u32 quirks;
int modes;
@@ -2419,7 +2419,7 @@ is_rb(const struct detailed_timing *timing, void *data)
/* EDID 1.4 defines this explicitly. For EDID 1.3, we guess, badly. */
static bool
-drm_monitor_supports_rb(struct edid *edid)
+drm_monitor_supports_rb(const struct edid *edid)
{
if (edid->revision >= 4) {
bool ret = false;
@@ -2447,7 +2447,7 @@ find_gtf2(const struct detailed_timing *timing, void *data)
/* Secondary GTF curve kicks in above some break frequency */
static int
-drm_gtf2_hbreak(struct edid *edid)
+drm_gtf2_hbreak(const struct edid *edid)
{
const struct detailed_timing *timing = NULL;
@@ -2459,7 +2459,7 @@ drm_gtf2_hbreak(struct edid *edid)
}
static int
-drm_gtf2_2c(struct edid *edid)
+drm_gtf2_2c(const struct edid *edid)
{
const struct detailed_timing *timing = NULL;
@@ -2471,7 +2471,7 @@ drm_gtf2_2c(struct edid *edid)
}
static int
-drm_gtf2_m(struct edid *edid)
+drm_gtf2_m(const struct edid *edid)
{
const struct detailed_timing *timing = NULL;
@@ -2483,7 +2483,7 @@ drm_gtf2_m(struct edid *edid)
}
static int
-drm_gtf2_k(struct edid *edid)
+drm_gtf2_k(const struct edid *edid)
{
const struct detailed_timing *timing = NULL;
@@ -2495,7 +2495,7 @@ drm_gtf2_k(struct edid *edid)
}
static int
-drm_gtf2_2j(struct edid *edid)
+drm_gtf2_2j(const struct edid *edid)
{
const struct detailed_timing *timing = NULL;
@@ -2510,7 +2510,7 @@ drm_gtf2_2j(struct edid *edid)
* standard_timing_level - get std. timing level(CVT/GTF/DMT)
* @edid: EDID block to scan
*/
-static int standard_timing_level(struct edid *edid)
+static int standard_timing_level(const struct edid *edid)
{
if (edid->revision >= 2) {
if (edid->revision >= 4 && (edid->features & DRM_EDID_FEATURE_DEFAULT_GTF))
@@ -2553,7 +2553,7 @@ static int drm_mode_hsync(const struct drm_display_mode *mode)
* and convert them into a real mode using CVT/GTF/DMT.
*/
static struct drm_display_mode *
-drm_mode_std(struct drm_connector *connector, struct edid *edid,
+drm_mode_std(struct drm_connector *connector, const struct edid *edid,
const struct std_timing *t)
{
struct drm_device *dev = connector->dev;
@@ -2715,7 +2715,7 @@ drm_mode_do_interlace_quirk(struct drm_display_mode *mode,
* return a new struct drm_display_mode.
*/
static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,
- struct edid *edid,
+ const struct edid *edid,
const struct detailed_timing *timing,
u32 quirks)
{
@@ -2815,7 +2815,7 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,
static bool
mode_in_hsync_range(const struct drm_display_mode *mode,
- struct edid *edid, const u8 *t)
+ const struct edid *edid, const u8 *t)
{
int hsync, hmin, hmax;
@@ -2832,7 +2832,7 @@ mode_in_hsync_range(const struct drm_display_mode *mode,
static bool
mode_in_vsync_range(const struct drm_display_mode *mode,
- struct edid *edid, const u8 *t)
+ const struct edid *edid, const u8 *t)
{
int vsync, vmin, vmax;
@@ -2848,7 +2848,7 @@ mode_in_vsync_range(const struct drm_display_mode *mode,
}
static u32
-range_pixel_clock(struct edid *edid, const u8 *t)
+range_pixel_clock(const struct edid *edid, const u8 *t)
{
/* unspecified */
if (t[9] == 0 || t[9] == 255)
@@ -2863,7 +2863,7 @@ range_pixel_clock(struct edid *edid, const u8 *t)
}
static bool
-mode_in_range(const struct drm_display_mode *mode, struct edid *edid,
+mode_in_range(const struct drm_display_mode *mode, const struct edid *edid,
const struct detailed_timing *timing)
{
u32 max_clock;
@@ -2909,7 +2909,7 @@ static bool valid_inferred_mode(const struct drm_connector *connector,
}
static int
-drm_dmt_modes_for_range(struct drm_connector *connector, struct edid *edid,
+drm_dmt_modes_for_range(struct drm_connector *connector, const struct edid *edid,
const struct detailed_timing *timing)
{
int i, modes = 0;
@@ -2944,7 +2944,7 @@ void drm_mode_fixup_1366x768(struct drm_display_mode *mode)
}
static int
-drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid,
+drm_gtf_modes_for_range(struct drm_connector *connector, const struct edid *edid,
const struct detailed_timing *timing)
{
int i, modes = 0;
@@ -2973,7 +2973,7 @@ drm_gtf_modes_for_range(struct drm_connector *connector, struct edid *edid,
}
static int
-drm_cvt_modes_for_range(struct drm_connector *connector, struct edid *edid,
+drm_cvt_modes_for_range(struct drm_connector *connector, const struct edid *edid,
const struct detailed_timing *timing)
{
int i, modes = 0;
@@ -3041,7 +3041,7 @@ do_inferred_modes(const struct detailed_timing *timing, void *c)
}
static int
-add_inferred_modes(struct drm_connector *connector, struct edid *edid)
+add_inferred_modes(struct drm_connector *connector, const struct edid *edid)
{
struct detailed_mode_closure closure = {
.connector = connector,
@@ -3103,7 +3103,7 @@ do_established_modes(const struct detailed_timing *timing, void *c)
* (defined above). Tease them out and add them to the global modes list.
*/
static int
-add_established_modes(struct drm_connector *connector, struct edid *edid)
+add_established_modes(struct drm_connector *connector, const struct edid *edid)
{
struct drm_device *dev = connector->dev;
unsigned long est_bits = edid->established_timings.t1 |
@@ -3140,7 +3140,7 @@ 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;
struct drm_connector *connector = closure->connector;
- struct edid *edid = closure->edid;
+ const struct edid *edid = closure->edid;
int i;
if (!is_display_descriptor(timing, EDID_DETAIL_STD_MODES))
@@ -3167,7 +3167,7 @@ do_standard_modes(const struct detailed_timing *timing, void *c)
* GTF or CVT. Grab them from @edid and add them to the list.
*/
static int
-add_standard_modes(struct drm_connector *connector, struct edid *edid)
+add_standard_modes(struct drm_connector *connector, const struct edid *edid)
{
int i, modes = 0;
struct detailed_mode_closure closure = {
@@ -3259,7 +3259,7 @@ do_cvt_mode(const struct detailed_timing *timing, void *c)
}
static int
-add_cvt_modes(struct drm_connector *connector, struct edid *edid)
+add_cvt_modes(struct drm_connector *connector, const struct edid *edid)
{
struct detailed_mode_closure closure = {
.connector = connector,
@@ -3313,7 +3313,7 @@ do_detailed_mode(const struct detailed_timing *timing, void *c)
* @quirks: quirks to apply
*/
static int
-add_detailed_modes(struct drm_connector *connector, struct edid *edid,
+add_detailed_modes(struct drm_connector *connector, const struct edid *edid,
u32 quirks)
{
struct detailed_mode_closure closure = {
@@ -4520,7 +4520,7 @@ monitor_name(const struct detailed_timing *timing, void *data)
*res = timing->data.other_data.data.str.str;
}
-static int get_monitor_name(struct edid *edid, char name[13])
+static int get_monitor_name(const struct edid *edid, char name[13])
{
const char *edid_name = NULL;
int mnl;
--
2.30.2
More information about the Intel-gfx
mailing list