Lines Matching refs:ff
36 static int check_effect_access(struct ff_device *ff, int effect_id, in check_effect_access() argument
39 if (effect_id < 0 || effect_id >= ff->max_effects || in check_effect_access()
40 !ff->effect_owners[effect_id]) in check_effect_access()
43 if (file && ff->effect_owners[effect_id] != file) in check_effect_access()
63 static int compat_effect(struct ff_device *ff, struct ff_effect *effect) in compat_effect() argument
69 if (!test_bit(FF_PERIODIC, ff->ffbit)) in compat_effect()
107 struct ff_device *ff = dev->ff; in input_ff_upload() local
129 if (!test_bit(effect->type, ff->ffbit)) { in input_ff_upload()
130 ret = compat_effect(ff, effect); in input_ff_upload()
135 mutex_lock(&ff->mutex); in input_ff_upload()
138 for (id = 0; id < ff->max_effects; id++) in input_ff_upload()
139 if (!ff->effect_owners[id]) in input_ff_upload()
142 if (id >= ff->max_effects) { in input_ff_upload()
153 ret = check_effect_access(ff, id, file); in input_ff_upload()
157 old = &ff->effects[id]; in input_ff_upload()
165 ret = ff->upload(dev, effect, old); in input_ff_upload()
170 ff->effects[id] = *effect; in input_ff_upload()
171 ff->effect_owners[id] = file; in input_ff_upload()
175 mutex_unlock(&ff->mutex); in input_ff_upload()
187 struct ff_device *ff = dev->ff; in erase_effect() local
190 error = check_effect_access(ff, effect_id, file); in erase_effect()
195 ff->playback(dev, effect_id, 0); in erase_effect()
196 ff->effect_owners[effect_id] = NULL; in erase_effect()
199 if (ff->erase) { in erase_effect()
200 error = ff->erase(dev, effect_id); in erase_effect()
203 ff->effect_owners[effect_id] = file; in erase_effect()
225 struct ff_device *ff = dev->ff; in input_ff_erase() local
231 mutex_lock(&ff->mutex); in input_ff_erase()
233 mutex_unlock(&ff->mutex); in input_ff_erase()
244 struct ff_device *ff = dev->ff; in flush_effects() local
249 mutex_lock(&ff->mutex); in flush_effects()
251 for (i = 0; i < ff->max_effects; i++) in flush_effects()
254 mutex_unlock(&ff->mutex); in flush_effects()
269 struct ff_device *ff = dev->ff; in input_ff_event() local
279 ff->set_gain(dev, value); in input_ff_event()
286 ff->set_autocenter(dev, value); in input_ff_event()
290 if (check_effect_access(ff, code, NULL) == 0) in input_ff_event()
291 ff->playback(dev, code, value); in input_ff_event()
312 struct ff_device *ff; in input_ff_create() local
331 ff = kzalloc(ff_dev_size, GFP_KERNEL); in input_ff_create()
332 if (!ff) in input_ff_create()
335 ff->effects = kcalloc(max_effects, sizeof(struct ff_effect), in input_ff_create()
337 if (!ff->effects) { in input_ff_create()
338 kfree(ff); in input_ff_create()
342 ff->max_effects = max_effects; in input_ff_create()
343 mutex_init(&ff->mutex); in input_ff_create()
345 dev->ff = ff; in input_ff_create()
352 __set_bit(i, ff->ffbit); in input_ff_create()
355 if (test_bit(FF_PERIODIC, ff->ffbit)) in input_ff_create()
372 struct ff_device *ff = dev->ff; in input_ff_destroy() local
375 if (ff) { in input_ff_destroy()
376 if (ff->destroy) in input_ff_destroy()
377 ff->destroy(ff); in input_ff_destroy()
378 kfree(ff->private); in input_ff_destroy()
379 kfree(ff->effects); in input_ff_destroy()
380 kfree(ff); in input_ff_destroy()
381 dev->ff = NULL; in input_ff_destroy()