Lines Matching full: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()
250 struct ff_device *ff = dev->ff; in input_ff_flush() local
255 mutex_lock(&ff->mutex); in input_ff_flush()
257 for (i = 0; i < ff->max_effects; i++) in input_ff_flush()
260 mutex_unlock(&ff->mutex); in input_ff_flush()
276 struct ff_device *ff = dev->ff; in input_ff_event() local
286 ff->set_gain(dev, value); in input_ff_event()
293 ff->set_autocenter(dev, value); in input_ff_event()
297 if (check_effect_access(ff, code, NULL) == 0) in input_ff_event()
298 ff->playback(dev, code, value); in input_ff_event()
314 * Once ff device is created you need to setup its upload, erase,
319 struct ff_device *ff; in input_ff_create() local
338 ff = kzalloc(ff_dev_size, GFP_KERNEL); in input_ff_create()
339 if (!ff) in input_ff_create()
342 ff->effects = kcalloc(max_effects, sizeof(struct ff_effect), in input_ff_create()
344 if (!ff->effects) { in input_ff_create()
345 kfree(ff); in input_ff_create()
349 ff->max_effects = max_effects; in input_ff_create()
350 mutex_init(&ff->mutex); in input_ff_create()
352 dev->ff = ff; in input_ff_create()
357 /* Copy "true" bits into ff device bitmap */ in input_ff_create()
359 __set_bit(i, ff->ffbit); in input_ff_create()
362 if (test_bit(FF_PERIODIC, ff->ffbit)) in input_ff_create()
379 struct ff_device *ff = dev->ff; in input_ff_destroy() local
382 if (ff) { in input_ff_destroy()
383 if (ff->destroy) in input_ff_destroy()
384 ff->destroy(ff); in input_ff_destroy()
385 kfree(ff->private); in input_ff_destroy()
386 kfree(ff->effects); in input_ff_destroy()
387 kfree(ff); in input_ff_destroy()
388 dev->ff = NULL; in input_ff_destroy()