summaryrefslogtreecommitdiffstats
path: root/drivers/hid/hid-logitech-hidpp.c
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2021-07-23 17:41:52 +0200
committerJiri Kosina <jkosina@suse.cz>2021-08-20 14:20:34 +0200
commit46dcd1cc2b2fa43bd99f39c7c236d5cdb80522f0 (patch)
treebb01b4c683710cae8a5463a1ab62292f70647ed4 /drivers/hid/hid-logitech-hidpp.c
parentdf04fbe8680bfe07f3d7487eccff9f768bb02533 (diff)
downloadlinux-46dcd1cc2b2fa43bd99f39c7c236d5cdb80522f0.tar.bz2
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>
Diffstat (limited to 'drivers/hid/hid-logitech-hidpp.c')
-rw-r--r--drivers/hid/hid-logitech-hidpp.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c
index 61635e629469..a7fa35245c2e 100644
--- a/drivers/hid/hid-logitech-hidpp.c
+++ b/drivers/hid/hid-logitech-hidpp.c
@@ -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);