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
2150 2150
2151u32 drm_edid_get_panel_id(struct i2c_adapter *adapter)2151u32 drm_edid_get_panel_id(struct i2c_adapter *adapter)
2152{2152{
2153 struct edid *edid;2153 const struct edid *edid;
2154 u32 panel_id;2154 u32 panel_id;
2155 2155
2156 edid = drm_do_get_edid_base_block(NULL, drm_do_probe_ddc_edid, adapter);2156 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
3664}3664}
3665 3665
3666static int3666static int
3667add_alternate_cea_modes(struct drm_connector *connector, struct edid *edid)3667add_alternate_cea_modes(struct drm_connector *connector, const struct edid *edid)
3668{3668{
3669 struct drm_device *dev = connector->dev;3669 struct drm_device *dev = connector->dev;
3670 struct drm_display_mode *mode, *tmp;3670 struct drm_display_mode *mode, *tmp;
@@ -4345,7 +4345,7 @@ static void drm_parse_y420cmdb_bitmap(struct drm_connector *connector, · 674 unmodified lines
4345}4345}
4346 4346
4347static int4347static int
4348add_cea_modes(struct drm_connector *connector, struct edid *edid)4348add_cea_modes(struct drm_connector *connector, const struct edid *edid)
4349{4349{
4350 const u8 *cea = drm_find_cea_extension(edid);4350 const u8 *cea = drm_find_cea_extension(edid);
4351 const u8 *db, *hdmi = NULL, *video = NULL;4351 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
4551 * @bufsize: The size of the name buffer (should be at least 14 chars.)4551 * @bufsize: The size of the name buffer (should be at least 14 chars.)
4552 *4552 *
4553 */4553 */
4554void drm_edid_get_monitor_name(struct edid *edid, char *name, int bufsize)4554void drm_edid_get_monitor_name(const struct edid *edid, char *name, int bufsize)
4555{4555{
4556 int name_length;4556 int name_length;
4557 char buf[13];4557 char buf[13];
@@ -4585,7 +4585,8 @@ static void clear_eld(struct drm_connector *connector) · 27 unmodified lines
4585 * Fill the ELD (EDID-Like Data) buffer for passing to the audio driver. The4585 * Fill the ELD (EDID-Like Data) buffer for passing to the audio driver. The
4586 * HDCP and Port_ID ELD fields are left for the graphics driver to fill in.4586 * HDCP and Port_ID ELD fields are left for the graphics driver to fill in.
4587 */4587 */
4588static void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid)4588static void drm_edid_to_eld(struct drm_connector *connector,
4589 const struct edid *edid)
4589{4590{
4590 uint8_t *eld = connector->eld;4591 uint8_t *eld = connector->eld;
4591 const u8 *cea;4592 const u8 *cea;
@@ -4681,7 +4682,7 @@ static void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) · 89 unmodified lines
4681 *4682 *
4682 * Return: The number of found SADs or negative number on error.4683 * Return: The number of found SADs or negative number on error.
4683 */4684 */
4684int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads)4685int drm_edid_to_sad(const struct edid *edid, struct cea_sad **sads)
4685{4686{
4686 int count = 0;4687 int count = 0;
4687 int i, start, end, dbl;4688 int i, start, end, dbl;
@@ -4743,7 +4744,7 @@ EXPORT_SYMBOL(drm_edid_to_sad); · 55 unmodified lines
4743 * Return: The number of found Speaker Allocation Blocks or negative number on4744 * Return: The number of found Speaker Allocation Blocks or negative number on
4744 * error.4745 * error.
4745 */4746 */
4746int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb)4747int drm_edid_to_speaker_allocation(const struct edid *edid, u8 **sadb)
4747{4748{
4748 int count = 0;4749 int count = 0;
4749 int i, start, end, dbl;4750 int i, start, end, dbl;
@@ -4838,7 +4839,7 @@ EXPORT_SYMBOL(drm_av_sync_delay); · 88 unmodified lines
4838 *4839 *
4839 * Return: True if the monitor is HDMI, false if not or unknown.4840 * Return: True if the monitor is HDMI, false if not or unknown.
4840 */4841 */
4841bool drm_detect_hdmi_monitor(struct edid *edid)4842bool drm_detect_hdmi_monitor(const struct edid *edid)
4842{4843{
4843 const u8 *edid_ext;4844 const u8 *edid_ext;
4844 int i;4845 int i;
@@ -4876,7 +4877,7 @@ EXPORT_SYMBOL(drm_detect_hdmi_monitor); · 31 unmodified lines
4876 *4877 *
4877 * Return: True if the monitor supports audio, false otherwise.4878 * Return: True if the monitor supports audio, false otherwise.
4878 */4879 */
4879bool drm_detect_monitor_audio(struct edid *edid)4880bool drm_detect_monitor_audio(const struct edid *edid)
4880{4881{
4881 const u8 *edid_ext;4882 const u8 *edid_ext;
4882 int i, j;4883 int i, j;
@@ -5538,7 +5539,7 @@ static int add_displayid_detailed_1_modes(struct drm_connector *connector, · 655 unmodified lines
5538}5539}
5539 5540
5540static int add_displayid_detailed_modes(struct drm_connector *connector,5541static int add_displayid_detailed_modes(struct drm_connector *connector,
5541 struct edid *edid)5542 const struct edid *edid)
5542{5543{
5543 const struct displayid_block *block;5544 const struct displayid_block *block;
5544 struct displayid_iter iter;5545 struct displayid_iter iter;
include/drm/drm_edid.h+5−5
@@ -372,8 +372,8 @@ struct drm_connector; · 371 unmodified lines
372struct drm_connector_state;372struct drm_connector_state;
373struct drm_display_mode;373struct drm_display_mode;
374 374
375int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads);375int drm_edid_to_sad(const struct edid *edid, struct cea_sad **sads);
376int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb);376int drm_edid_to_speaker_allocation(const struct edid *edid, u8 **sadb);
377int drm_av_sync_delay(struct drm_connector *connector,377int drm_av_sync_delay(struct drm_connector *connector,
378 const struct drm_display_mode *mode);378 const struct drm_display_mode *mode);
379 379
@@ -569,8 +569,8 @@ int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid); · 189 unmodified lines
569int drm_add_override_edid_modes(struct drm_connector *connector);569int drm_add_override_edid_modes(struct drm_connector *connector);
570 570
571u8 drm_match_cea_mode(const struct drm_display_mode *to_match);571u8 drm_match_cea_mode(const struct drm_display_mode *to_match);
572bool drm_detect_hdmi_monitor(struct edid *edid);572bool drm_detect_hdmi_monitor(const struct edid *edid);
573bool drm_detect_monitor_audio(struct edid *edid);573bool drm_detect_monitor_audio(const struct edid *edid);
574enum hdmi_quantization_range574enum hdmi_quantization_range
575drm_default_rgb_quant_range(const struct drm_display_mode *mode);575drm_default_rgb_quant_range(const struct drm_display_mode *mode);
576int drm_add_modes_noedid(struct drm_connector *connector,576int 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
582bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid,582bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid,
583 bool *edid_corrupt);583 bool *edid_corrupt);
584bool drm_edid_is_valid(struct edid *edid);584bool drm_edid_is_valid(struct edid *edid);
585void drm_edid_get_monitor_name(struct edid *edid, char *name,585void drm_edid_get_monitor_name(const struct edid *edid, char *name,
586 int buflen);586 int buflen);
587struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,587struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
588 int hsize, int vsize, int fresh,588 int hsize, int vsize, int fresh,