diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-11-03 20:17:32 +0200 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2025-11-03 20:17:32 +0200 |
| commit | 5095d47320c36e2346d41eb7e35dcbd215886557 (patch) | |
| tree | a57f13d05f80e284967c2b3af4fb47f6404d83d1 /src/tmt300rs | |
| parent | 438a3e1407565dbd1d8ceb3981f4830a723a3c3c (diff) | |
| download | hid-tmff2-5095d47320c36e2346d41eb7e35dcbd215886557.tar.gz hid-tmff2-5095d47320c36e2346d41eb7e35dcbd215886557.zip | |
minimize critical section in work handler
+ Effects handlers were being called in a locked context,
which in this case happened to work due to how `hid_hw_request`
is implemented. Now, only the selected state is updated and the heavy
lifting of making the wheel aware of the requested changes is done
after the critical section.
Diffstat (limited to 'src/tmt300rs')
| -rw-r--r-- | src/tmt300rs/hid-tmt300rs.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/tmt300rs/hid-tmt300rs.c b/src/tmt300rs/hid-tmt300rs.c index 3966530..c247bd7 100644 --- a/src/tmt300rs/hid-tmt300rs.c +++ b/src/tmt300rs/hid-tmt300rs.c @@ -488,7 +488,7 @@ static void t300rs_fill_header(struct t300rs_packet_header *packet_header, packet_header->code = code; } -int t300rs_play_effect(void *data, struct tmff2_effect_state *state) +int t300rs_play_effect(void *data, const struct tmff2_effect_state *state) { struct t300rs_device_entry *t300rs = data; struct __packed t300rs_packet_play { @@ -515,7 +515,7 @@ int t300rs_play_effect(void *data, struct tmff2_effect_state *state) return ret; } -int t300rs_stop_effect(void *data, struct tmff2_effect_state *state) +int t300rs_stop_effect(void *data, const struct tmff2_effect_state *state) { struct t300rs_device_entry *t300rs = data; struct __packed t300rs_packet_stop { @@ -566,7 +566,7 @@ static void t300rs_fill_timing(struct t300rs_packet_timing *packet_timing, } static int t300rs_update_constant(struct t300rs_device_entry *t300rs, - struct tmff2_effect_state *state) + const struct tmff2_effect_state *state) { struct ff_effect effect = state->effect; struct ff_effect old = state->old; @@ -616,7 +616,7 @@ static int t300rs_update_constant(struct t300rs_device_entry *t300rs, } static int t300rs_update_ramp(struct t300rs_device_entry *t300rs, - struct tmff2_effect_state *state) + const struct tmff2_effect_state *state) { struct ff_effect effect = state->effect; struct ff_effect old = state->old; @@ -676,7 +676,7 @@ static int t300rs_update_ramp(struct t300rs_device_entry *t300rs, } static int t300rs_update_condition(struct t300rs_device_entry *t300rs, - struct tmff2_effect_state *state) + const struct tmff2_effect_state *state) { struct ff_effect effect = state->effect; struct ff_effect old = state->old; @@ -754,7 +754,7 @@ static int t300rs_update_condition(struct t300rs_device_entry *t300rs, } static int t300rs_update_periodic(struct t300rs_device_entry *t300rs, - struct tmff2_effect_state *state) + const struct tmff2_effect_state *state) { struct ff_effect effect = state->effect; struct ff_effect old = state->old; @@ -816,7 +816,7 @@ static int t300rs_update_periodic(struct t300rs_device_entry *t300rs, } static int t300rs_upload_constant(struct t300rs_device_entry *t300rs, - struct tmff2_effect_state *state) + const struct tmff2_effect_state *state) { struct ff_effect effect = state->effect; struct ff_constant_effect constant = state->effect.u.constant; @@ -853,7 +853,7 @@ static int t300rs_upload_constant(struct t300rs_device_entry *t300rs, } static int t300rs_upload_ramp(struct t300rs_device_entry *t300rs, - struct tmff2_effect_state *state) + const struct tmff2_effect_state *state) { struct ff_effect effect = state->effect; struct ff_ramp_effect ramp = state->effect.u.ramp; @@ -900,7 +900,7 @@ static int t300rs_upload_ramp(struct t300rs_device_entry *t300rs, } static int t300rs_upload_condition(struct t300rs_device_entry *t300rs, - struct tmff2_effect_state *state) + const struct tmff2_effect_state *state) { struct ff_effect effect = state->effect; /* we only care about the first axis */ @@ -965,7 +965,7 @@ static int t300rs_upload_condition(struct t300rs_device_entry *t300rs, } static int t300rs_upload_periodic(struct t300rs_device_entry *t300rs, - struct tmff2_effect_state *state) + const struct tmff2_effect_state *state) { struct ff_effect effect = state->effect; struct __packed t300rs_packet_periodic { @@ -1016,7 +1016,7 @@ static int t300rs_upload_periodic(struct t300rs_device_entry *t300rs, return ret; } -int t300rs_update_effect(void *data, struct tmff2_effect_state *state) +int t300rs_update_effect(void *data, const struct tmff2_effect_state *state) { struct t300rs_device_entry *t300rs = data; switch (state->effect.type) { @@ -1038,7 +1038,7 @@ int t300rs_update_effect(void *data, struct tmff2_effect_state *state) } } -int t300rs_upload_effect(void *data, struct tmff2_effect_state *state) +int t300rs_upload_effect(void *data, const struct tmff2_effect_state *state) { struct t300rs_device_entry *t300rs = data; switch (state->effect.type) { |
