2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 * Copyright (c) 2008 Andy Green <andy@openmoko.com>
19 #include <linux/kernel.h>
20 #include <linux/device.h>
21 #include "ts_filter.h"
23 static DEFINE_MUTEX(chain_mutex
);
25 int ts_filter_create_chain(struct platform_device
*pdev
,
26 struct ts_filter_api
**api
, void **config
,
27 struct ts_filter
**arr
, int count_coords
)
30 struct ts_filter
*last
= NULL
;
35 mutex_lock(&chain_mutex
);
38 *arr
= ((*api
)->create
)(pdev
, *config
++, count_coords
);
40 printk(KERN_ERR
"Filter %d failed init\n", count
);
51 mutex_unlock(&chain_mutex
);
55 EXPORT_SYMBOL_GPL(ts_filter_create_chain
);
57 void ts_filter_destroy_chain(struct platform_device
*pdev
,
58 struct ts_filter
**arr
)
60 struct ts_filter
**first
= arr
;
62 mutex_lock(&chain_mutex
);
65 ((*arr
)->api
->destroy
)(pdev
, *arr
);
70 mutex_unlock(&chain_mutex
);
72 EXPORT_SYMBOL_GPL(ts_filter_destroy_chain
);