Lines Matching refs:ff
24 static int check_effect_access(struct ff_device *ff, int effect_id, in check_effect_access() argument
27 if (effect_id < 0 || effect_id >= ff->max_effects || in check_effect_access()
28 !ff->effect_owners[effect_id]) in check_effect_access()
31 if (file && ff->effect_owners[effect_id] != file) in check_effect_access()
51 static int compat_effect(struct ff_device *ff, struct ff_effect *effect) in compat_effect() argument
57 if (!test_bit(FF_PERIODIC, ff->ffbit)) in compat_effect()
95 struct ff_device *ff = dev->ff; in input_ff_upload() local
117 if (!test_bit(effect->type, ff->ffbit)) { in input_ff_upload()
118 ret = compat_effect(ff, effect); in input_ff_upload()
123 mutex_lock(&ff->mutex); in input_ff_upload()
126 for (id = 0; id < ff->max_effects; id++) in input_ff_upload()
127 if (!ff->effect_owners[id]) in input_ff_upload()
130 if (id >= ff->max_effects) { in input_ff_upload()
141 ret = check_effect_access(ff, id, file); in input_ff_upload()
145 old = &ff->effects[id]; in input_ff_upload()
153 ret = ff->upload(dev, effect, old); in input_ff_upload()
158 ff->effects[id] = *effect; in input_ff_upload()
159 ff->effect_owners[id] = file; in input_ff_upload()
163 mutex_unlock(&ff->mutex); in input_ff_upload()
175 struct ff_device *ff = dev->ff; in erase_effect() local
178 error = check_effect_access(ff, effect_id, file); in erase_effect()
183 ff->playback(dev, effect_id, 0); in erase_effect()
184 ff->effect_owners[effect_id] = NULL; in erase_effect()
187 if (ff->erase) { in erase_effect()
188 error = ff->erase(dev, effect_id); in erase_effect()
191 ff->effect_owners[effect_id] = file; in erase_effect()
213 struct ff_device *ff = dev->ff; in input_ff_erase() local
219 mutex_lock(&ff->mutex); in input_ff_erase()
221 mutex_unlock(&ff->mutex); in input_ff_erase()
238 struct ff_device *ff = dev->ff; in input_ff_flush() local
243 mutex_lock(&ff->mutex); in input_ff_flush()
245 for (i = 0; i < ff->max_effects; i++) in input_ff_flush()
248 mutex_unlock(&ff->mutex); in input_ff_flush()
264 struct ff_device *ff = dev->ff; in input_ff_event() local
274 ff->set_gain(dev, value); in input_ff_event()
281 ff->set_autocenter(dev, value); in input_ff_event()
285 if (check_effect_access(ff, code, NULL) == 0) in input_ff_event()
286 ff->playback(dev, code, value); in input_ff_event()
307 struct ff_device *ff; in input_ff_create() local
326 ff = kzalloc(ff_dev_size, GFP_KERNEL); in input_ff_create()
327 if (!ff) in input_ff_create()
330 ff->effects = kcalloc(max_effects, sizeof(struct ff_effect), in input_ff_create()
332 if (!ff->effects) { in input_ff_create()
333 kfree(ff); in input_ff_create()
337 ff->max_effects = max_effects; in input_ff_create()
338 mutex_init(&ff->mutex); in input_ff_create()
340 dev->ff = ff; in input_ff_create()
347 __set_bit(i, ff->ffbit); in input_ff_create()
350 if (test_bit(FF_PERIODIC, ff->ffbit)) in input_ff_create()
367 struct ff_device *ff = dev->ff; in input_ff_destroy() local
370 if (ff) { in input_ff_destroy()
371 if (ff->destroy) in input_ff_destroy()
372 ff->destroy(ff); in input_ff_destroy()
373 kfree(ff->private); in input_ff_destroy()
374 kfree(ff->effects); in input_ff_destroy()
375 kfree(ff); in input_ff_destroy()
376 dev->ff = NULL; in input_ff_destroy()