aboutsummaryrefslogtreecommitdiff
path: root/drivers/input/touchscreen/ts_filter_group.c
diff options
context:
space:
mode:
authorNelson Castillo <arhuaco@freaks-unidos.net>2009-03-10 12:04:16 +0000
committerAndy Green <agreen@octopus.localdomain>2009-03-10 12:04:16 +0000
commit9e58a18567ec1ef306ea7b973749e5cd9902702c (patch)
treedbb5cbc62e0d91c6b185faad5bf93acf6b2733a6 /drivers/input/touchscreen/ts_filter_group.c
parentbd88fa696f505a8a71484341e4fcde581b2d12a6 (diff)
Use non-void configurations
This patch defines a ts_filter_configuration structure to avoid using void* in the filter initialization, fixing another upstream correction. This also makes the initialization more readable. Tested in GTA02/rev6. Other changes: ~ Comment filter configuration structures. ~ ts_filter.c:ts_filter_chain_create improved. ~ Small cleanups. ~ More TODOs/FIXMEs. ~ Updated GTA02 filter configuration. ~ Updated GTA01 filter configuration. ~ Updated mach-s3c2410/include/mach/ts.h for the new ts. configuration structure. ~ Updated all the filters to use the new configuration structure. ~ Removed MAX_TS_FILTER_CHAIN constant that is no longer needed. No more evil casts left it seems. Signed-off-by: Nelson Castillo <arhuaco@freaks-unidos.net>
Diffstat (limited to 'drivers/input/touchscreen/ts_filter_group.c')
-rw-r--r--drivers/input/touchscreen/ts_filter_group.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/drivers/input/touchscreen/ts_filter_group.c b/drivers/input/touchscreen/ts_filter_group.c
index 9b02c70c4bb..ac3229fcff2 100644
--- a/drivers/input/touchscreen/ts_filter_group.c
+++ b/drivers/input/touchscreen/ts_filter_group.c
@@ -83,8 +83,10 @@ static void ts_filter_group_clear(struct ts_filter *tsf)
ts_filter_group_clear_internal(tsfg, tsfg->config->attempts);
}
-static struct ts_filter *ts_filter_group_create(struct platform_device *pdev,
- void *conf, int count_coords)
+static struct ts_filter *ts_filter_group_create(
+ struct platform_device *pdev,
+ struct ts_filter_configuration *conf,
+ int count_coords)
{
struct ts_filter_group *tsfg;
int i;
@@ -93,28 +95,30 @@ static struct ts_filter *ts_filter_group_create(struct platform_device *pdev,
if (!tsfg)
return NULL;
- tsfg->config = (struct ts_filter_group_configuration *)conf;
+ tsfg->config = container_of(conf,
+ struct ts_filter_group_configuration,
+ config);
tsfg->tsf.count_coords = count_coords;
BUG_ON(tsfg->config->attempts <= 0);
tsfg->samples[0] = kmalloc((2 + count_coords) * sizeof(int) *
- tsfg->config->extent, GFP_KERNEL);
+ tsfg->config->length, GFP_KERNEL);
if (!tsfg->samples[0]) {
kfree(tsfg);
return NULL;
}
for (i = 1; i < count_coords; ++i)
- tsfg->samples[i] = tsfg->samples[0] + i * tsfg->config->extent;
+ tsfg->samples[i] = tsfg->samples[0] + i * tsfg->config->length;
tsfg->sorted_samples = tsfg->samples[0] + count_coords *
- tsfg->config->extent;
+ tsfg->config->length;
tsfg->group_size = tsfg->samples[0] + (1 + count_coords) *
- tsfg->config->extent;
+ tsfg->config->length;
ts_filter_group_clear_internal(tsfg, tsfg->config->attempts);
dev_info(&pdev->dev, "Created Group filter len:%d coords:%d close:%d "
- "thresh:%d\n", tsfg->config->extent, count_coords,
+ "thresh:%d\n", tsfg->config->length, count_coords,
tsfg->config->close_enough, tsfg->config->threshold);
return &tsfg->tsf;
@@ -148,13 +152,13 @@ static int ts_filter_group_process(struct ts_filter *tsf, int *coords)
int n;
int i;
- BUG_ON(tsfg->N >= tsfg->config->extent);
+ BUG_ON(tsfg->N >= tsfg->config->length);
BUG_ON(tsfg->ready);
for (n = 0; n < tsf->count_coords; n++)
tsfg->samples[n][tsfg->N] = coords[n];
- if (++tsfg->N < tsfg->config->extent)
+ if (++tsfg->N < tsfg->config->length)
return 0; /* We need more samples. */
for (n = 0; n < tsfg->tsf.count_coords; n++) {