From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: DRI Development <dri-devel@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: [PATCH 1/3] drm/sysfs: Annote lockless show functions with READ_ONCE
Date: Tue, 29 Sep 2015 10:06:31 +0200 [thread overview]
Message-ID: <1443513993-5228-1-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1443512228-10764-1-git-send-email-daniel.vetter@ffwll.ch>
For documentation and paranoia.
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
drivers/gpu/drm/drm_sysfs.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index 615b7e667320..7506de0a75b4 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -220,9 +220,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,
@@ -243,9 +246,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,
--
2.5.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2015-09-29 8:03 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-29 7:37 [PATCH] drm: Fix locking for sysfs dpms file Daniel Vetter
2015-09-29 7:37 ` Daniel Vetter
2015-09-29 7:56 ` Daniel Vetter
2015-09-29 7:56 ` Daniel Vetter
2015-09-29 13:30 ` Jani Nikula
2015-09-29 13:30 ` Jani Nikula
2015-09-29 14:37 ` Jens Axboe
2015-09-29 14:37 ` Jens Axboe
2015-09-29 8:06 ` Daniel Vetter [this message]
2015-09-29 8:06 ` [PATCH 2/3] drm/sysfs: Grab lock for edid/modes_show Daniel Vetter
2015-10-02 8:39 ` [PATCH] " Daniel Vetter
2015-10-02 11:01 ` Daniel Vetter
2015-10-02 12:08 ` Emil Velikov
2015-11-19 16:22 ` Daniel Vetter
2015-10-02 15:02 ` Julia Lawall
2015-09-29 8:06 ` [PATCH 3/3] drm/sysfs: Nuke TV/DVI property files Daniel Vetter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1443513993-5228-1-git-send-email-daniel.vetter@ffwll.ch \
--to=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.