Skip to content

Commit

Permalink
drm/sysfs: Annote lockless show functions with READ_ONCE
Browse files Browse the repository at this point in the history
For documentation and paranoia.

Acked-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1459331120-27864-4-git-send-email-daniel.vetter@ffwll.ch
  • Loading branch information
Daniel Vetter committed Apr 26, 2016
1 parent 5ff18e4 commit 4eb9b94
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions drivers/gpu/drm/drm_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -208,9 +208,12 @@ static ssize_t status_show(struct device *device,
char *buf)
{
struct drm_connector *connector = to_drm_connector(device);
enum drm_connector_status status;

status = READ_ONCE(connector->status);

return snprintf(buf, PAGE_SIZE, "%s\n",
drm_get_connector_status_name(connector->status));
drm_get_connector_status_name(status));
}

static ssize_t dpms_show(struct device *device,
Expand All @@ -231,9 +234,11 @@ static ssize_t enabled_show(struct device *device,
char *buf)
{
struct drm_connector *connector = to_drm_connector(device);
bool enabled;

enabled = READ_ONCE(connector->encoder);

return snprintf(buf, PAGE_SIZE, "%s\n", connector->encoder ? "enabled" :
"disabled");
return snprintf(buf, PAGE_SIZE, enabled ? "enabled\n" : "disabled\n");
}

static ssize_t edid_show(struct file *filp, struct kobject *kobj,
Expand Down

0 comments on commit 4eb9b94

Please sign in to comment.