diff options
Diffstat (limited to 'drivers/gpu/drm/msm/msm_rd.c')
-rw-r--r-- | drivers/gpu/drm/msm/msm_rd.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/gpu/drm/msm/msm_rd.c b/drivers/gpu/drm/msm/msm_rd.c index 0366b8092f97..ec56794ad039 100644 --- a/drivers/gpu/drm/msm/msm_rd.c +++ b/drivers/gpu/drm/msm/msm_rd.c | |||
@@ -111,10 +111,14 @@ static void rd_write(struct msm_rd_state *rd, const void *buf, int sz) | |||
111 | 111 | ||
112 | wait_event(rd->fifo_event, circ_space(&rd->fifo) > 0); | 112 | wait_event(rd->fifo_event, circ_space(&rd->fifo) > 0); |
113 | 113 | ||
114 | /* Note that smp_load_acquire() is not strictly required | ||
115 | * as CIRC_SPACE_TO_END() does not access the tail more | ||
116 | * than once. | ||
117 | */ | ||
114 | n = min(sz, circ_space_to_end(&rd->fifo)); | 118 | n = min(sz, circ_space_to_end(&rd->fifo)); |
115 | memcpy(fptr, ptr, n); | 119 | memcpy(fptr, ptr, n); |
116 | 120 | ||
117 | fifo->head = (fifo->head + n) & (BUF_SZ - 1); | 121 | smp_store_release(&fifo->head, (fifo->head + n) & (BUF_SZ - 1)); |
118 | sz -= n; | 122 | sz -= n; |
119 | ptr += n; | 123 | ptr += n; |
120 | 124 | ||
@@ -145,13 +149,17 @@ static ssize_t rd_read(struct file *file, char __user *buf, | |||
145 | if (ret) | 149 | if (ret) |
146 | goto out; | 150 | goto out; |
147 | 151 | ||
152 | /* Note that smp_load_acquire() is not strictly required | ||
153 | * as CIRC_CNT_TO_END() does not access the head more than | ||
154 | * once. | ||
155 | */ | ||
148 | n = min_t(int, sz, circ_count_to_end(&rd->fifo)); | 156 | n = min_t(int, sz, circ_count_to_end(&rd->fifo)); |
149 | if (copy_to_user(buf, fptr, n)) { | 157 | if (copy_to_user(buf, fptr, n)) { |
150 | ret = -EFAULT; | 158 | ret = -EFAULT; |
151 | goto out; | 159 | goto out; |
152 | } | 160 | } |
153 | 161 | ||
154 | fifo->tail = (fifo->tail + n) & (BUF_SZ - 1); | 162 | smp_store_release(&fifo->tail, (fifo->tail + n) & (BUF_SZ - 1)); |
155 | *ppos += n; | 163 | *ppos += n; |
156 | 164 | ||
157 | wake_up_all(&rd->fifo_event); | 165 | wake_up_all(&rd->fifo_event); |