mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-01 10:45:49 +00:00
HID: logitech-hidpp: Use 'atomic_inc_return' instead of hand-writing it
This function logs a warning if the workqueue gets too big. In order to save a few cycles, use 'atomic_inc_return()' instead of an 'atomic_inc()/atomic_read()' sequence. This axes a line of code and saves a 'atomic_read()' call. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
parent
df04fbe868
commit
46dcd1cc2b
@ -2240,11 +2240,10 @@ static int hidpp_ff_queue_work(struct hidpp_ff_private_data *data, int effect_id
|
||||
wd->size = size;
|
||||
memcpy(wd->params, params, size);
|
||||
|
||||
atomic_inc(&data->workqueue_size);
|
||||
s = atomic_inc_return(&data->workqueue_size);
|
||||
queue_work(data->wq, &wd->work);
|
||||
|
||||
/* warn about excessive queue size */
|
||||
s = atomic_read(&data->workqueue_size);
|
||||
if (s >= 20 && s % 20 == 0)
|
||||
hid_warn(data->hidpp->hid_dev, "Force feedback command queue contains %d commands, causing substantial delays!", s);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user