Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/vc4: hdmi: switch to struct drm_edid

Prefer struct drm_edid based functions over struct edid.

Acked-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/eabece3ca7fae28395dcad0d2c221113cd924180.1713273659.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>

+25 -21
+25 -21
drivers/gpu/drm/vc4/vc4_hdmi.c
··· 412 412 enum drm_connector_status status) 413 413 { 414 414 struct drm_connector *connector = &vc4_hdmi->connector; 415 - struct edid *edid; 415 + const struct drm_edid *drm_edid; 416 416 int ret; 417 417 418 418 /* 419 - * NOTE: This function should really be called with 420 - * vc4_hdmi->mutex held, but doing so results in reentrancy 421 - * issues since cec_s_phys_addr_from_edid might call 422 - * .adap_enable, which leads to that funtion being called with 423 - * our mutex held. 419 + * NOTE: This function should really be called with vc4_hdmi->mutex 420 + * held, but doing so results in reentrancy issues since 421 + * cec_s_phys_addr() might call .adap_enable, which leads to that 422 + * funtion being called with our mutex held. 424 423 * 425 424 * A similar situation occurs with vc4_hdmi_reset_link() that 426 425 * will call into our KMS hooks if the scrambling was enabled. ··· 434 435 return; 435 436 } 436 437 437 - edid = drm_get_edid(connector, vc4_hdmi->ddc); 438 - if (!edid) 438 + drm_edid = drm_edid_read_ddc(connector, vc4_hdmi->ddc); 439 + 440 + drm_edid_connector_update(connector, drm_edid); 441 + cec_s_phys_addr(vc4_hdmi->cec_adap, 442 + connector->display_info.source_physical_address, false); 443 + 444 + if (!drm_edid) 439 445 return; 440 446 441 - cec_s_phys_addr_from_edid(vc4_hdmi->cec_adap, edid); 442 - kfree(edid); 447 + drm_edid_free(drm_edid); 443 448 444 449 for (;;) { 445 450 ret = vc4_hdmi_reset_link(connector, ctx); ··· 495 492 { 496 493 struct vc4_hdmi *vc4_hdmi = connector_to_vc4_hdmi(connector); 497 494 struct vc4_dev *vc4 = to_vc4_dev(connector->dev); 495 + const struct drm_edid *drm_edid; 498 496 int ret = 0; 499 - struct edid *edid; 500 497 501 498 /* 502 - * NOTE: This function should really take vc4_hdmi->mutex, but 503 - * doing so results in reentrancy issues since 504 - * cec_s_phys_addr_from_edid might call .adap_enable, which 505 - * leads to that funtion being called with our mutex held. 499 + * NOTE: This function should really take vc4_hdmi->mutex, but doing so 500 + * results in reentrancy issues since cec_s_phys_addr() might call 501 + * .adap_enable, which leads to that funtion being called with our mutex 502 + * held. 506 503 * 507 504 * Concurrency isn't an issue at the moment since we don't share 508 505 * any state with any of the other frameworks so we can ignore 509 506 * the lock for now. 510 507 */ 511 508 512 - edid = drm_get_edid(connector, vc4_hdmi->ddc); 513 - cec_s_phys_addr_from_edid(vc4_hdmi->cec_adap, edid); 514 - if (!edid) 509 + drm_edid = drm_edid_read_ddc(connector, vc4_hdmi->ddc); 510 + drm_edid_connector_update(connector, drm_edid); 511 + cec_s_phys_addr(vc4_hdmi->cec_adap, 512 + connector->display_info.source_physical_address, false); 513 + if (!drm_edid) 515 514 return 0; 516 515 517 - drm_connector_update_edid_property(connector, edid); 518 - ret = drm_add_edid_modes(connector, edid); 519 - kfree(edid); 516 + ret = drm_edid_connector_add_modes(connector); 517 + drm_edid_free(drm_edid); 520 518 521 519 if (!vc4->hvs->vc5_hdmi_enable_hdmi_20) { 522 520 struct drm_device *drm = connector->dev;