Lines Matching refs:ff

24 static int check_effect_access(struct ff_device *ff, int effect_id,
27 if (effect_id < 0 || effect_id >= ff->max_effects ||
28 !ff->effect_owners[effect_id])
31 if (file && ff->effect_owners[effect_id] != file)
51 static int compat_effect(struct ff_device *ff, struct ff_effect *effect)
57 if (!test_bit(FF_PERIODIC, ff->ffbit))
95 struct ff_device *ff = dev->ff;
117 if (!test_bit(effect->type, ff->ffbit)) {
118 ret = compat_effect(ff, effect);
123 mutex_lock(&ff->mutex);
126 for (id = 0; id < ff->max_effects; id++)
127 if (!ff->effect_owners[id])
130 if (id >= ff->max_effects) {
141 ret = check_effect_access(ff, id, file);
145 old = &ff->effects[id];
153 ret = ff->upload(dev, effect, old);
158 ff->effects[id] = *effect;
159 ff->effect_owners[id] = file;
163 mutex_unlock(&ff->mutex);
175 struct ff_device *ff = dev->ff;
178 error = check_effect_access(ff, effect_id, file);
183 ff->playback(dev, effect_id, 0);
184 ff->effect_owners[effect_id] = NULL;
187 if (ff->erase) {
188 error = ff->erase(dev, effect_id);
191 ff->effect_owners[effect_id] = file;
213 struct ff_device *ff = dev->ff;
219 mutex_lock(&ff->mutex);
221 mutex_unlock(&ff->mutex);
238 struct ff_device *ff = dev->ff;
243 mutex_lock(&ff->mutex);
245 for (i = 0; i < ff->max_effects; i++)
248 mutex_unlock(&ff->mutex);
264 struct ff_device *ff = dev->ff;
274 ff->set_gain(dev, value);
281 ff->set_autocenter(dev, value);
285 if (check_effect_access(ff, code, NULL) == 0)
286 ff->playback(dev, code, value);
302 * Once ff device is created you need to setup its upload, erase,
307 struct ff_device *ff;
326 ff = kzalloc(ff_dev_size, GFP_KERNEL);
327 if (!ff)
330 ff->effects = kcalloc(max_effects, sizeof(struct ff_effect),
332 if (!ff->effects) {
333 kfree(ff);
337 ff->max_effects = max_effects;
338 mutex_init(&ff->mutex);
340 dev->ff = ff;
345 /* Copy "true" bits into ff device bitmap */
347 __set_bit(i, ff->ffbit);
350 if (test_bit(FF_PERIODIC, ff->ffbit))
367 struct ff_device *ff = dev->ff;
370 if (ff) {
371 if (ff->destroy)
372 ff->destroy(ff);
373 kfree(ff->private);
374 kfree(ff->effects);
375 kfree(ff);
376 dev->ff = NULL;