Skip to content

Commit

Permalink
drm/atmel-hlcdc: always iterate over the first 4 output endpoints
Browse files Browse the repository at this point in the history
This enables more flexible devicetrees. You can e.g. have two output
nodes where one is not enabled, without the ordering affecting things.

Prior to this patch the active nodes had to have endpoint id zero and
upwards consecutively.

Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180825085620.10566-4-peda@axentia.se
  • Loading branch information
Peter Rosin authored and Boris Brezillon committed Aug 27, 2018
1 parent 2e7c04a commit 012877b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,23 @@ static int atmel_hlcdc_attach_endpoint(struct drm_device *dev, int endpoint)
int atmel_hlcdc_create_outputs(struct drm_device *dev)
{
int endpoint, ret = 0;
int attached = 0;

for (endpoint = 0; !ret; endpoint++)
/*
* Always scan the first few endpoints even if we get -ENODEV,
* but keep going after that as long as we keep getting hits.
*/
for (endpoint = 0; !ret || endpoint < 4; endpoint++) {
ret = atmel_hlcdc_attach_endpoint(dev, endpoint);
if (ret == -ENODEV)
continue;
if (ret)
break;
attached++;
}

/* At least one device was successfully attached.*/
if (ret == -ENODEV && endpoint)
if (ret == -ENODEV && attached)
return 0;

return ret;
Expand Down

0 comments on commit 012877b

Please sign in to comment.