[PATCH 2/2] Make group filter return samples

Nelson arhuaco at freaks-unidos.net
Tue Jan 6 10:58:08 CET 2009


From: Nelson Castillo <arhuaco at freaks-unidos.net>

For consistency the group filter should return samples if it is the last
filter in the chain. It is useful when you want to check what the filter
does.

Signed-off-by: Nelson Castillo <arhuaco at freaks-unidos.net>
---

 0 files changed, 0 insertions(+), 0 deletions(-)

diff --git a/drivers/input/touchscreen/ts_filter_group.c b/drivers/input/touchscreen/ts_filter_group.c
index 80e6677..73e3625 100644
--- a/drivers/input/touchscreen/ts_filter_group.c
+++ b/drivers/input/touchscreen/ts_filter_group.c
@@ -182,8 +182,6 @@ static int ts_filter_group_process(struct ts_filter *tsf, int *coords)
 		tsfg->range_max[n] = v[best_idx + best_size - 1];
 	}
 
-	BUG_ON(!tsf->next);
-
 	for (i = 0; i < tsfg->N; ++i) {
 		int r;
 
@@ -197,10 +195,14 @@ static int ts_filter_group_process(struct ts_filter *tsf, int *coords)
 		if (n != tsfg->tsf.count_coords) /* sample not OK */
 			continue;
 
-		r = (tsf->next->api->process)(tsf->next, coords);
-		if (r)  {
-			ret = r;
-			break;
+		if (tsf->next) {
+			r = (tsf->next->api->process)(tsf->next, coords);
+			if (r)  {
+				ret = r;
+				break;
+			}
+		} else if (i == tsfg->N - 1) {
+			ret = 1;
 		}
 	}
 




More information about the openmoko-kernel mailing list