History

drm/edid: add more general struct edid constness in the interfaces

With this, the remaining non-const parts are the ones that actually modify the EDID, for example to fix corrupt EDID.

Jani Nikula committed 4 years ago

Commit f4e558e1 parent c14e7242 files · +16 −15Browse files

Unified · Split

2 files
  1. drivers/gpu/drm/drm_edid.c +11 −10
  2. include/drm/drm_edid.h +5 −5
drivers/gpu/drm/drm_edid.c+11−10
@@ -2150,7 +2150,7 @@ static u32 edid_extract_panel_id(const struct edid *edid) · 2149 unmodified lines
21502150
21512151 u32 drm_edid_get_panel_id(struct i2c_adapter *adapter)
21522152 {
2153− struct edid *edid;
2153+ const struct edid *edid;
21542154 u32 panel_id;
21552155
21562156 edid = drm_do_get_edid_base_block(NULL, drm_do_probe_ddc_edid, adapter);
@@ -3664,7 +3664,7 @@ static bool drm_valid_hdmi_vic(u8 vic) · 1507 unmodified lines
36643664 }
36653665
36663666 static int
3667−add_alternate_cea_modes(struct drm_connector *connector, struct edid *edid)
3667+add_alternate_cea_modes(struct drm_connector *connector, const struct edid *edid)
36683668 {
36693669 struct drm_device *dev = connector->dev;
36703670 struct drm_display_mode *mode, *tmp;
@@ -4345,7 +4345,7 @@ static void drm_parse_y420cmdb_bitmap(struct drm_connector *connector, · 674 unmodified lines
43454345 }
43464346
43474347 static int
4348−add_cea_modes(struct drm_connector *connector, struct edid *edid)
4348+add_cea_modes(struct drm_connector *connector, const struct edid *edid)
43494349 {
43504350 const u8 *cea = drm_find_cea_extension(edid);
43514351 const u8 *db, *hdmi = NULL, *video = NULL;
@@ -4551,7 +4551,7 @@ static int get_monitor_name(const struct edid *edid, char name[13]) · 199 unmodified lines
45514551 * @bufsize: The size of the name buffer (should be at least 14 chars.)
45524552 *
45534553 */
4554−void drm_edid_get_monitor_name(struct edid *edid, char *name, int bufsize)
4554+void drm_edid_get_monitor_name(const struct edid *edid, char *name, int bufsize)
45554555 {
45564556 int name_length;
45574557 char buf[13];
@@ -4585,7 +4585,8 @@ static void clear_eld(struct drm_connector *connector) · 27 unmodified lines
45854585 * Fill the ELD (EDID-Like Data) buffer for passing to the audio driver. The
45864586 * HDCP and Port_ID ELD fields are left for the graphics driver to fill in.
45874587 */
4588−static void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)
4588+static void drm_edid_to_eld(struct drm_connector *connector,
4589+ const struct edid *edid)
45894590 {
45904591 uint8_t *eld = connector->eld;
45914592 const u8 *cea;
@@ -4681,7 +4682,7 @@ static void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) · 89 unmodified lines
46814682 *
46824683 * Return: The number of found SADs or negative number on error.
46834684 */
4684−int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads)
4685+int drm_edid_to_sad(const struct edid *edid, struct cea_sad **sads)
46854686 {
46864687 int count = 0;
46874688 int i, start, end, dbl;
@@ -4743,7 +4744,7 @@ EXPORT_SYMBOL(drm_edid_to_sad); · 55 unmodified lines
47434744 * Return: The number of found Speaker Allocation Blocks or negative number on
47444745 * error.
47454746 */
4746−int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb)
4747+int drm_edid_to_speaker_allocation(const struct edid *edid, u8 **sadb)
47474748 {
47484749 int count = 0;
47494750 int i, start, end, dbl;
@@ -4838,7 +4839,7 @@ EXPORT_SYMBOL(drm_av_sync_delay); · 88 unmodified lines
48384839 *
48394840 * Return: True if the monitor is HDMI, false if not or unknown.
48404841 */
4841−bool drm_detect_hdmi_monitor(struct edid *edid)
4842+bool drm_detect_hdmi_monitor(const struct edid *edid)
48424843 {
48434844 const u8 *edid_ext;
48444845 int i;
@@ -4876,7 +4877,7 @@ EXPORT_SYMBOL(drm_detect_hdmi_monitor); · 31 unmodified lines
48764877 *
48774878 * Return: True if the monitor supports audio, false otherwise.
48784879 */
4879−bool drm_detect_monitor_audio(struct edid *edid)
4880+bool drm_detect_monitor_audio(const struct edid *edid)
48804881 {
48814882 const u8 *edid_ext;
48824883 int i, j;
@@ -5538,7 +5539,7 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector, · 655 unmodified lines
55385539 }
55395540
55405541 static int add_displayid_detailed_modes(struct drm_connector *connector,
5541− struct edid *edid)
5542+ const struct edid *edid)
55425543 {
55435544 const struct displayid_block *block;
55445545 struct displayid_iter iter;
include/drm/drm_edid.h+5−5
@@ -372,8 +372,8 @@ struct drm_connector; · 371 unmodified lines
372372 struct drm_connector_state;
373373 struct drm_display_mode;
374374
375−int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads);
376−int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb);
375+int drm_edid_to_sad(const struct edid *edid, struct cea_sad **sads);
376+int drm_edid_to_speaker_allocation(const struct edid *edid, u8 **sadb);
377377 int drm_av_sync_delay(struct drm_connector *connector,
378378 const struct drm_display_mode *mode);
379379
@@ -569,8 +569,8 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); · 189 unmodified lines
569569 int drm_add_override_edid_modes(struct drm_connector *connector);
570570
571571 u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
572−bool drm_detect_hdmi_monitor(struct edid *edid);
573−bool drm_detect_monitor_audio(struct edid *edid);
572+bool drm_detect_hdmi_monitor(const struct edid *edid);
573+bool drm_detect_monitor_audio(const struct edid *edid);
574574 enum hdmi_quantization_range
575575 drm_default_rgb_quant_range(const struct drm_display_mode *mode);
576576 int drm_add_modes_noedid(struct drm_connector *connector,
@@ -582,7 +582,7 @@ int drm_edid_header_is_valid(const u8 *raw_edid); · 5 unmodified lines
582582 bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid,
583583 bool *edid_corrupt);
584584 bool drm_edid_is_valid(struct edid *edid);
585−void drm_edid_get_monitor_name(struct edid *edid, char *name,
585+void drm_edid_get_monitor_name(const struct edid *edid, char *name,
586586 int buflen);
587587 struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
588588 int hsize, int vsize, int fresh,