.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
---|
1 | 2 | /* |
---|
2 | 3 | * Roccat driver for Linux |
---|
3 | 4 | * |
---|
.. | .. |
---|
5 | 6 | */ |
---|
6 | 7 | |
---|
7 | 8 | /* |
---|
8 | | - * This program is free software; you can redistribute it and/or modify it |
---|
9 | | - * under the terms of the GNU General Public License as published by the Free |
---|
10 | | - * Software Foundation; either version 2 of the License, or (at your option) |
---|
11 | | - * any later version. |
---|
12 | 9 | */ |
---|
13 | 10 | |
---|
14 | 11 | /* |
---|
.. | .. |
---|
260 | 257 | if (!new_value) |
---|
261 | 258 | return -ENOMEM; |
---|
262 | 259 | |
---|
| 260 | + mutex_lock(&device->cbuf_lock); |
---|
| 261 | + |
---|
263 | 262 | report = &device->cbuf[device->cbuf_end]; |
---|
264 | 263 | |
---|
265 | 264 | /* passing NULL is safe */ |
---|
.. | .. |
---|
279 | 278 | reader->cbuf_start = (reader->cbuf_start + 1) % ROCCAT_CBUF_SIZE; |
---|
280 | 279 | } |
---|
281 | 280 | |
---|
| 281 | + mutex_unlock(&device->cbuf_lock); |
---|
| 282 | + |
---|
282 | 283 | wake_up_interruptible(&device->wait); |
---|
283 | 284 | return 0; |
---|
284 | 285 | } |
---|