Lines Matching refs:ff

21 static int check_effect_access(struct ff_device *ff, int effect_id,  in check_effect_access()  argument
24 if (effect_id < 0 || effect_id >= ff->max_effects || in check_effect_access()
25 !ff->effect_owners[effect_id]) in check_effect_access()
28 if (file && ff->effect_owners[effect_id] != file) in check_effect_access()
48 static int compat_effect(struct ff_device *ff, struct ff_effect *effect) in compat_effect() argument
54 if (!test_bit(FF_PERIODIC, ff->ffbit)) in compat_effect()
92 struct ff_device *ff = dev->ff; in input_ff_upload() local
114 if (!test_bit(effect->type, ff->ffbit)) { in input_ff_upload()
115 ret = compat_effect(ff, effect); in input_ff_upload()
120 mutex_lock(&ff->mutex); in input_ff_upload()
123 for (id = 0; id < ff->max_effects; id++) in input_ff_upload()
124 if (!ff->effect_owners[id]) in input_ff_upload()
127 if (id >= ff->max_effects) { in input_ff_upload()
138 ret = check_effect_access(ff, id, file); in input_ff_upload()
142 old = &ff->effects[id]; in input_ff_upload()
150 ret = ff->upload(dev, effect, old); in input_ff_upload()
155 ff->effects[id] = *effect; in input_ff_upload()
156 ff->effect_owners[id] = file; in input_ff_upload()
160 mutex_unlock(&ff->mutex); in input_ff_upload()
172 struct ff_device *ff = dev->ff; in erase_effect() local
175 error = check_effect_access(ff, effect_id, file); in erase_effect()
180 ff->playback(dev, effect_id, 0); in erase_effect()
181 ff->effect_owners[effect_id] = NULL; in erase_effect()
184 if (ff->erase) { in erase_effect()
185 error = ff->erase(dev, effect_id); in erase_effect()
188 ff->effect_owners[effect_id] = file; in erase_effect()
210 struct ff_device *ff = dev->ff; in input_ff_erase() local
216 mutex_lock(&ff->mutex); in input_ff_erase()
218 mutex_unlock(&ff->mutex); in input_ff_erase()
235 struct ff_device *ff = dev->ff; in input_ff_flush() local
240 mutex_lock(&ff->mutex); in input_ff_flush()
242 for (i = 0; i < ff->max_effects; i++) in input_ff_flush()
245 mutex_unlock(&ff->mutex); in input_ff_flush()
261 struct ff_device *ff = dev->ff; in input_ff_event() local
271 ff->set_gain(dev, value); in input_ff_event()
278 ff->set_autocenter(dev, value); in input_ff_event()
282 if (check_effect_access(ff, code, NULL) == 0) in input_ff_event()
283 ff->playback(dev, code, value); in input_ff_event()
304 struct ff_device *ff; in input_ff_create() local
323 ff = kzalloc(ff_dev_size, GFP_KERNEL); in input_ff_create()
324 if (!ff) in input_ff_create()
327 ff->effects = kcalloc(max_effects, sizeof(struct ff_effect), in input_ff_create()
329 if (!ff->effects) { in input_ff_create()
330 kfree(ff); in input_ff_create()
334 ff->max_effects = max_effects; in input_ff_create()
335 mutex_init(&ff->mutex); in input_ff_create()
337 dev->ff = ff; in input_ff_create()
344 __set_bit(i, ff->ffbit); in input_ff_create()
347 if (test_bit(FF_PERIODIC, ff->ffbit)) in input_ff_create()
364 struct ff_device *ff = dev->ff; in input_ff_destroy() local
367 if (ff) { in input_ff_destroy()
368 if (ff->destroy) in input_ff_destroy()
369 ff->destroy(ff); in input_ff_destroy()
370 kfree(ff->private); in input_ff_destroy()
371 kfree(ff->effects); in input_ff_destroy()
372 kfree(ff); in input_ff_destroy()
373 dev->ff = NULL; in input_ff_destroy()