Lines Matching refs:ff

38 static int check_effect_access(struct ff_device *ff, int effect_id,
41 if (effect_id < 0 || effect_id >= ff->max_effects ||
42 !ff->effect_owners[effect_id])
45 if (file && ff->effect_owners[effect_id] != file)
65 static int compat_effect(struct ff_device *ff, struct ff_effect *effect)
71 if (!test_bit(FF_PERIODIC, ff->ffbit))
109 struct ff_device *ff = dev->ff;
131 if (!test_bit(effect->type, ff->ffbit)) {
132 ret = compat_effect(ff, effect);
137 mutex_lock(&ff->mutex);
140 for (id = 0; id < ff->max_effects; id++)
141 if (!ff->effect_owners[id])
144 if (id >= ff->max_effects) {
155 ret = check_effect_access(ff, id, file);
159 old = &ff->effects[id];
167 ret = ff->upload(dev, effect, old);
172 ff->effects[id] = *effect;
173 ff->effect_owners[id] = file;
177 mutex_unlock(&ff->mutex);
189 struct ff_device *ff = dev->ff;
192 error = check_effect_access(ff, effect_id, file);
197 ff->playback(dev, effect_id, 0);
198 ff->effect_owners[effect_id] = NULL;
201 if (ff->erase) {
202 error = ff->erase(dev, effect_id);
205 ff->effect_owners[effect_id] = file;
227 struct ff_device *ff = dev->ff;
233 mutex_lock(&ff->mutex);
235 mutex_unlock(&ff->mutex);
246 struct ff_device *ff = dev->ff;
251 mutex_lock(&ff->mutex);
253 for (i = 0; i < ff->max_effects; i++)
256 mutex_unlock(&ff->mutex);
271 struct ff_device *ff = dev->ff;
281 ff->set_gain(dev, value);
288 ff->set_autocenter(dev, value);
292 if (check_effect_access(ff, code, NULL) == 0)
293 ff->playback(dev, code, value);
309 * Once ff device is created you need to setup its upload, erase,
314 struct ff_device *ff;
328 ff = kzalloc(ff_dev_size, GFP_KERNEL);
329 if (!ff)
332 ff->effects = kcalloc(max_effects, sizeof(struct ff_effect),
334 if (!ff->effects) {
335 kfree(ff);
339 ff->max_effects = max_effects;
340 mutex_init(&ff->mutex);
342 dev->ff = ff;
347 /* Copy "true" bits into ff device bitmap */
350 __set_bit(i, ff->ffbit);
353 if (test_bit(FF_PERIODIC, ff->ffbit))
370 struct ff_device *ff = dev->ff;
373 if (ff) {
374 if (ff->destroy)
375 ff->destroy(ff);
376 kfree(ff->private);
377 kfree(ff->effects);
378 kfree(ff);
379 dev->ff = NULL;