Commit 10b566f2 authored by Jani Nikula's avatar Jani Nikula Committed by Inki Dae

drm/exynos/vidi: simplify fake edid handling

Avoid assigning fake_edid_info to ctx->raw_edid. Always keep
ctx->raw_edid either an allocated pointer or NULL. Defer fake_edid_info
handling to .get_modes().

This should be functionally equivalent but slightly easier to follow.
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarInki Dae <inki.dae@samsung.com>
parent 679ca523
...@@ -195,12 +195,11 @@ static ssize_t vidi_store_connection(struct device *dev, ...@@ -195,12 +195,11 @@ static ssize_t vidi_store_connection(struct device *dev,
if (ctx->connected > 1) if (ctx->connected > 1)
return -EINVAL; return -EINVAL;
/* use fake edid data for test. */ /*
if (!ctx->raw_edid) * Use fake edid data for test. If raw_edid is set then it can't be
ctx->raw_edid = (struct edid *)fake_edid_info; * tested.
*/
/* if raw_edid isn't same as fake data then it can't be tested. */ if (ctx->raw_edid) {
if (ctx->raw_edid != (struct edid *)fake_edid_info) {
DRM_DEV_DEBUG_KMS(dev, "edid data is not fake data.\n"); DRM_DEV_DEBUG_KMS(dev, "edid data is not fake data.\n");
return -EINVAL; return -EINVAL;
} }
...@@ -261,15 +260,9 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data, ...@@ -261,15 +260,9 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data,
return -ENOMEM; return -ENOMEM;
} }
} else { } else {
/* /* with connection = 0, free raw_edid */
* with connection = 0, free raw_edid kfree(ctx->raw_edid);
* only if raw edid data isn't same as fake data. ctx->raw_edid = NULL;
*/
if (ctx->raw_edid && ctx->raw_edid !=
(struct edid *)fake_edid_info) {
kfree(ctx->raw_edid);
ctx->raw_edid = NULL;
}
} }
ctx->connected = vidi->connection; ctx->connected = vidi->connection;
...@@ -310,16 +303,7 @@ static int vidi_get_modes(struct drm_connector *connector) ...@@ -310,16 +303,7 @@ static int vidi_get_modes(struct drm_connector *connector)
struct edid *edid; struct edid *edid;
int count; int count;
/* edid = drm_edid_duplicate(ctx->raw_edid ?: fake_edid_info);
* the edid data comes from user side and it would be set
* to ctx->raw_edid through specific ioctl.
*/
if (!ctx->raw_edid) {
DRM_DEV_DEBUG_KMS(ctx->dev, "raw_edid is null.\n");
return 0;
}
edid = drm_edid_duplicate(ctx->raw_edid);
if (!edid) if (!edid)
return 0; return 0;
...@@ -467,10 +451,8 @@ static void vidi_remove(struct platform_device *pdev) ...@@ -467,10 +451,8 @@ static void vidi_remove(struct platform_device *pdev)
{ {
struct vidi_context *ctx = platform_get_drvdata(pdev); struct vidi_context *ctx = platform_get_drvdata(pdev);
if (ctx->raw_edid != (struct edid *)fake_edid_info) { kfree(ctx->raw_edid);
kfree(ctx->raw_edid); ctx->raw_edid = NULL;
ctx->raw_edid = NULL;
}
component_del(&pdev->dev, &vidi_component_ops); component_del(&pdev->dev, &vidi_component_ops);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment