Commit 89fb7536 authored by Jani Nikula's avatar Jani Nikula

drm/edid: add typedef for block read function

Make the callback a bit easier on the eye.
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/10b8721bb7ea8c7df1fd0c1d97c5d446905abbf4.1649685475.git.jani.nikula@intel.com
parent 63cae081
...@@ -2037,10 +2037,11 @@ int drm_add_override_edid_modes(struct drm_connector *connector) ...@@ -2037,10 +2037,11 @@ int drm_add_override_edid_modes(struct drm_connector *connector)
} }
EXPORT_SYMBOL(drm_add_override_edid_modes); EXPORT_SYMBOL(drm_add_override_edid_modes);
typedef int read_block_fn(void *context, u8 *buf, unsigned int block, size_t len);
static struct edid *drm_do_get_edid_base_block(struct drm_connector *connector, static struct edid *drm_do_get_edid_base_block(struct drm_connector *connector,
int (*get_edid_block)(void *data, u8 *buf, unsigned int block, read_block_fn read_block,
size_t len), void *context)
void *data)
{ {
int *null_edid_counter = connector ? &connector->null_edid_counter : NULL; int *null_edid_counter = connector ? &connector->null_edid_counter : NULL;
bool *edid_corrupt = connector ? &connector->edid_corrupt : NULL; bool *edid_corrupt = connector ? &connector->edid_corrupt : NULL;
...@@ -2053,7 +2054,7 @@ static struct edid *drm_do_get_edid_base_block(struct drm_connector *connector, ...@@ -2053,7 +2054,7 @@ static struct edid *drm_do_get_edid_base_block(struct drm_connector *connector,
/* base block fetch */ /* base block fetch */
for (try = 0; try < 4; try++) { for (try = 0; try < 4; try++) {
if (get_edid_block(data, edid, 0, EDID_LENGTH)) if (read_block(context, edid, 0, EDID_LENGTH))
goto out; goto out;
if (drm_edid_block_valid(edid, 0, false, edid_corrupt)) if (drm_edid_block_valid(edid, 0, false, edid_corrupt))
break; break;
...@@ -2097,9 +2098,8 @@ static struct edid *drm_do_get_edid_base_block(struct drm_connector *connector, ...@@ -2097,9 +2098,8 @@ static struct edid *drm_do_get_edid_base_block(struct drm_connector *connector,
* Return: Pointer to valid EDID or NULL if we couldn't find any. * Return: Pointer to valid EDID or NULL if we couldn't find any.
*/ */
struct edid *drm_do_get_edid(struct drm_connector *connector, struct edid *drm_do_get_edid(struct drm_connector *connector,
int (*get_edid_block)(void *data, u8 *buf, unsigned int block, read_block_fn read_block,
size_t len), void *context)
void *data)
{ {
int j, invalid_blocks = 0; int j, invalid_blocks = 0;
struct edid *edid, *new, *override; struct edid *edid, *new, *override;
...@@ -2108,7 +2108,7 @@ struct edid *drm_do_get_edid(struct drm_connector *connector, ...@@ -2108,7 +2108,7 @@ struct edid *drm_do_get_edid(struct drm_connector *connector,
if (override) if (override)
return override; return override;
edid = drm_do_get_edid_base_block(connector, get_edid_block, data); edid = drm_do_get_edid_base_block(connector, read_block, context);
if (!edid) if (!edid)
return NULL; return NULL;
...@@ -2125,7 +2125,7 @@ struct edid *drm_do_get_edid(struct drm_connector *connector, ...@@ -2125,7 +2125,7 @@ struct edid *drm_do_get_edid(struct drm_connector *connector,
int try; int try;
for (try = 0; try < 4; try++) { for (try = 0; try < 4; try++) {
if (get_edid_block(data, block, j, EDID_LENGTH)) if (read_block(context, block, j, EDID_LENGTH))
goto out; goto out;
if (drm_edid_block_valid(block, j, false, NULL)) if (drm_edid_block_valid(block, j, false, NULL))
break; break;
......
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