mirror of
https://github.com/torvalds/linux.git
synced 2026-04-18 14:53:58 -04:00
drm/edid: add a helper for EDID sysfs property show
Add a helper to get the EDID property for sysfs property show. This hides all the edid_blob_ptr usage within drm_edid.c. Reviewed-by: Chaitanya Kumar Borah <chaitanya.kumar.borah@intel.com> Acked-by: Alex Deucher <alexander.deucher@amd.com> Link: https://patchwork.freedesktop.org/patch/msgid/902c8e09d25b99391fd9c92d95af07c01d7b7cbd.1715353572.git.jani.nikula@intel.com Signed-off-by: Jani Nikula <jani.nikula@intel.com>
This commit is contained in:
@@ -266,29 +266,9 @@ static ssize_t edid_show(struct file *filp, struct kobject *kobj,
|
||||
{
|
||||
struct device *connector_dev = kobj_to_dev(kobj);
|
||||
struct drm_connector *connector = to_drm_connector(connector_dev);
|
||||
unsigned char *edid;
|
||||
size_t size;
|
||||
ssize_t ret = 0;
|
||||
ssize_t ret;
|
||||
|
||||
mutex_lock(&connector->dev->mode_config.mutex);
|
||||
if (!connector->edid_blob_ptr)
|
||||
goto unlock;
|
||||
|
||||
edid = connector->edid_blob_ptr->data;
|
||||
size = connector->edid_blob_ptr->length;
|
||||
if (!edid)
|
||||
goto unlock;
|
||||
|
||||
if (off >= size)
|
||||
goto unlock;
|
||||
|
||||
if (off + count > size)
|
||||
count = size - off;
|
||||
memcpy(buf, edid + off, count);
|
||||
|
||||
ret = count;
|
||||
unlock:
|
||||
mutex_unlock(&connector->dev->mode_config.mutex);
|
||||
ret = drm_edid_connector_property_show(connector, buf, off, count);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user