mirror of
https://github.com/torvalds/linux.git
synced 2024-09-20 06:53:04 +00:00
drm/amdgpu: convert bios_hardcoded_edid to drm_edid
Instead of manually passing around 'struct edid *' and its size, use 'struct drm_edid', which encapsulates a validated combination of both. As the drm_edid_ can handle NULL gracefully, the explicit checks can be dropped. Also save a few characters by transforming '&array[0]' to the equivalent 'array' and using 'max_t(int, ...)' instead of manual casts. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
608d886c97
commit
aeb81b62c7
|
@ -249,11 +249,7 @@ amdgpu_connector_find_encoder(struct drm_connector *connector,
|
|||
static struct edid *
|
||||
amdgpu_connector_get_hardcoded_edid(struct amdgpu_device *adev)
|
||||
{
|
||||
if (adev->mode_info.bios_hardcoded_edid) {
|
||||
return kmemdup((unsigned char *)adev->mode_info.bios_hardcoded_edid,
|
||||
adev->mode_info.bios_hardcoded_edid_size, GFP_KERNEL);
|
||||
}
|
||||
return NULL;
|
||||
return drm_edid_duplicate(drm_edid_raw(adev->mode_info.bios_hardcoded_edid));
|
||||
}
|
||||
|
||||
static void amdgpu_connector_get_edid(struct drm_connector *connector)
|
||||
|
|
|
@ -51,6 +51,7 @@ struct amdgpu_encoder;
|
|||
struct amdgpu_router;
|
||||
struct amdgpu_hpd;
|
||||
struct edid;
|
||||
struct drm_edid;
|
||||
|
||||
#define to_amdgpu_crtc(x) container_of(x, struct amdgpu_crtc, base)
|
||||
#define to_amdgpu_connector(x) container_of(x, struct amdgpu_connector, base)
|
||||
|
@ -326,8 +327,7 @@ struct amdgpu_mode_info {
|
|||
/* FMT dithering */
|
||||
struct drm_property *dither_property;
|
||||
/* hardcoded DFP edid from BIOS */
|
||||
struct edid *bios_hardcoded_edid;
|
||||
int bios_hardcoded_edid_size;
|
||||
const struct drm_edid *bios_hardcoded_edid;
|
||||
|
||||
/* firmware flags */
|
||||
u32 firmware_flags;
|
||||
|
|
|
@ -549,7 +549,7 @@ static int amdgpu_vkms_sw_fini(void *handle)
|
|||
|
||||
adev->mode_info.mode_config_initialized = false;
|
||||
|
||||
kfree(adev->mode_info.bios_hardcoded_edid);
|
||||
drm_edid_free(adev->mode_info.bios_hardcoded_edid);
|
||||
kfree(adev->amdgpu_vkms_output);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2064,23 +2064,18 @@ amdgpu_atombios_encoder_get_lcd_info(struct amdgpu_encoder *encoder)
|
|||
case LCD_FAKE_EDID_PATCH_RECORD_TYPE:
|
||||
fake_edid_record = (ATOM_FAKE_EDID_PATCH_RECORD *)record;
|
||||
if (fake_edid_record->ucFakeEDIDLength) {
|
||||
struct edid *edid;
|
||||
const struct drm_edid *edid;
|
||||
int edid_size;
|
||||
|
||||
if (fake_edid_record->ucFakeEDIDLength == 128)
|
||||
edid_size = fake_edid_record->ucFakeEDIDLength;
|
||||
else
|
||||
edid_size = fake_edid_record->ucFakeEDIDLength * 128;
|
||||
edid = kmemdup(&fake_edid_record->ucFakeEDIDString[0],
|
||||
edid_size, GFP_KERNEL);
|
||||
if (edid) {
|
||||
if (drm_edid_is_valid(edid)) {
|
||||
adev->mode_info.bios_hardcoded_edid = edid;
|
||||
adev->mode_info.bios_hardcoded_edid_size = edid_size;
|
||||
} else {
|
||||
kfree(edid);
|
||||
}
|
||||
}
|
||||
edid = drm_edid_alloc(fake_edid_record->ucFakeEDIDString, edid_size);
|
||||
if (drm_edid_valid(edid))
|
||||
adev->mode_info.bios_hardcoded_edid = edid;
|
||||
else
|
||||
drm_edid_free(edid);
|
||||
record += struct_size(fake_edid_record,
|
||||
ucFakeEDIDString,
|
||||
edid_size);
|
||||
|
|
|
@ -2846,7 +2846,7 @@ static int dce_v10_0_sw_fini(void *handle)
|
|||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
|
||||
kfree(adev->mode_info.bios_hardcoded_edid);
|
||||
drm_edid_free(adev->mode_info.bios_hardcoded_edid);
|
||||
|
||||
drm_kms_helper_poll_fini(adev_to_drm(adev));
|
||||
|
||||
|
|
|
@ -2973,7 +2973,7 @@ static int dce_v11_0_sw_fini(void *handle)
|
|||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
|
||||
kfree(adev->mode_info.bios_hardcoded_edid);
|
||||
drm_edid_free(adev->mode_info.bios_hardcoded_edid);
|
||||
|
||||
drm_kms_helper_poll_fini(adev_to_drm(adev));
|
||||
|
||||
|
|
|
@ -2745,7 +2745,7 @@ static int dce_v6_0_sw_fini(void *handle)
|
|||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
|
||||
kfree(adev->mode_info.bios_hardcoded_edid);
|
||||
drm_edid_free(adev->mode_info.bios_hardcoded_edid);
|
||||
|
||||
drm_kms_helper_poll_fini(adev_to_drm(adev));
|
||||
|
||||
|
|
|
@ -2766,7 +2766,7 @@ static int dce_v8_0_sw_fini(void *handle)
|
|||
{
|
||||
struct amdgpu_device *adev = (struct amdgpu_device *)handle;
|
||||
|
||||
kfree(adev->mode_info.bios_hardcoded_edid);
|
||||
drm_edid_free(adev->mode_info.bios_hardcoded_edid);
|
||||
|
||||
drm_kms_helper_poll_fini(adev_to_drm(adev));
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user