Lines Matching refs:ff
23 static int check_effect_access(struct ff_device *ff, int effect_id, in check_effect_access() argument
26 if (effect_id < 0 || effect_id >= ff->max_effects || in check_effect_access()
27 !ff->effect_owners[effect_id]) in check_effect_access()
30 if (file && ff->effect_owners[effect_id] != file) in check_effect_access()
50 static int compat_effect(struct ff_device *ff, struct ff_effect *effect) in compat_effect() argument
56 if (!test_bit(FF_PERIODIC, ff->ffbit)) in compat_effect()
94 struct ff_device *ff = dev->ff; in input_ff_upload() local
116 if (!test_bit(effect->type, ff->ffbit)) { in input_ff_upload()
117 error = compat_effect(ff, effect); in input_ff_upload()
122 guard(mutex)(&ff->mutex); in input_ff_upload()
125 for (id = 0; id < ff->max_effects; id++) in input_ff_upload()
126 if (!ff->effect_owners[id]) in input_ff_upload()
129 if (id >= ff->max_effects) in input_ff_upload()
138 error = check_effect_access(ff, id, file); in input_ff_upload()
142 old = &ff->effects[id]; in input_ff_upload()
148 error = ff->upload(dev, effect, old); in input_ff_upload()
153 ff->effects[id] = *effect; in input_ff_upload()
154 ff->effect_owners[id] = file; in input_ff_upload()
168 struct ff_device *ff = dev->ff; in erase_effect() local
171 error = check_effect_access(ff, effect_id, file); in erase_effect()
176 ff->playback(dev, effect_id, 0); in erase_effect()
177 ff->effect_owners[effect_id] = NULL; in erase_effect()
180 if (ff->erase) { in erase_effect()
181 error = ff->erase(dev, effect_id); in erase_effect()
184 ff->effect_owners[effect_id] = file; in erase_effect()
205 struct ff_device *ff = dev->ff; in input_ff_erase() local
210 guard(mutex)(&ff->mutex); in input_ff_erase()
226 struct ff_device *ff = dev->ff; in input_ff_flush() local
231 guard(mutex)(&ff->mutex); in input_ff_flush()
233 for (i = 0; i < ff->max_effects; i++) in input_ff_flush()
250 struct ff_device *ff = dev->ff; in input_ff_event() local
260 ff->set_gain(dev, value); in input_ff_event()
267 ff->set_autocenter(dev, value); in input_ff_event()
271 if (check_effect_access(ff, code, NULL) == 0) in input_ff_event()
272 ff->playback(dev, code, value); in input_ff_event()
305 struct ff_device *ff __free(kfree) = in input_ff_create()
306 kzalloc_flex(*ff, effect_owners, max_effects); in input_ff_create()
307 if (!ff) in input_ff_create()
310 ff->effects = kzalloc_objs(*ff->effects, max_effects); in input_ff_create()
311 if (!ff->effects) in input_ff_create()
314 ff->max_effects = max_effects; in input_ff_create()
315 mutex_init(&ff->mutex); in input_ff_create()
323 __set_bit(i, ff->ffbit); in input_ff_create()
326 if (test_bit(FF_PERIODIC, ff->ffbit)) in input_ff_create()
329 dev->ff = no_free_ptr(ff); in input_ff_create()
345 struct ff_device *ff = dev->ff; in input_ff_destroy() local
348 if (ff) { in input_ff_destroy()
349 if (ff->destroy) in input_ff_destroy()
350 ff->destroy(ff); in input_ff_destroy()
351 kfree(ff->private); in input_ff_destroy()
352 kfree(ff->effects); in input_ff_destroy()
353 kfree(ff); in input_ff_destroy()
354 dev->ff = NULL; in input_ff_destroy()