Lines Matching refs:ff
21 static int check_effect_access(struct ff_device *ff, int effect_id,
24 if (effect_id < 0 || effect_id >= ff->max_effects ||
25 !ff->effect_owners[effect_id])
28 if (file && ff->effect_owners[effect_id] != file)
48 static int compat_effect(struct ff_device *ff, struct ff_effect *effect)
54 if (!test_bit(FF_PERIODIC, ff->ffbit))
92 struct ff_device *ff = dev->ff;
114 if (!test_bit(effect->type, ff->ffbit)) {
115 ret = compat_effect(ff, effect);
120 mutex_lock(&ff->mutex);
123 for (id = 0; id < ff->max_effects; id++)
124 if (!ff->effect_owners[id])
127 if (id >= ff->max_effects) {
138 ret = check_effect_access(ff, id, file);
142 old = &ff->effects[id];
150 ret = ff->upload(dev, effect, old);
155 ff->effects[id] = *effect;
156 ff->effect_owners[id] = file;
160 mutex_unlock(&ff->mutex);
172 struct ff_device *ff = dev->ff;
175 error = check_effect_access(ff, effect_id, file);
180 ff->playback(dev, effect_id, 0);
181 ff->effect_owners[effect_id] = NULL;
184 if (ff->erase) {
185 error = ff->erase(dev, effect_id);
188 ff->effect_owners[effect_id] = file;
210 struct ff_device *ff = dev->ff;
216 mutex_lock(&ff->mutex);
218 mutex_unlock(&ff->mutex);
235 struct ff_device *ff = dev->ff;
240 mutex_lock(&ff->mutex);
242 for (i = 0; i < ff->max_effects; i++)
245 mutex_unlock(&ff->mutex);
261 struct ff_device *ff = dev->ff;
271 ff->set_gain(dev, value);
278 ff->set_autocenter(dev, value);
282 if (check_effect_access(ff, code, NULL) == 0)
283 ff->playback(dev, code, value);
299 * Once ff device is created you need to setup its upload, erase,
304 struct ff_device *ff;
323 ff = kzalloc(ff_dev_size, GFP_KERNEL);
324 if (!ff)
327 ff->effects = kcalloc(max_effects, sizeof(struct ff_effect),
329 if (!ff->effects) {
330 kfree(ff);
334 ff->max_effects = max_effects;
335 mutex_init(&ff->mutex);
337 dev->ff = ff;
342 /* Copy "true" bits into ff device bitmap */
344 __set_bit(i, ff->ffbit);
347 if (test_bit(FF_PERIODIC, ff->ffbit))
364 struct ff_device *ff = dev->ff;
367 if (ff) {
368 if (ff->destroy)
369 ff->destroy(ff);
370 kfree(ff->private);
371 kfree(ff->effects);
372 kfree(ff);
373 dev->ff = NULL;