Re: [PATCH] TSC2007: private data for platform callbacks.
From: Manuel Lauss <hidden>
Date: 2009-05-15 06:11:16
Also in:
lkml
On Fri, May 15, 2009 at 01:25:41PM +0900, Kwangwoo Lee wrote:
Hi Manual, On Thu, May 14, 2009 at 7:28 PM, Trilok Soni [off-list ref] wrote:quoted
Hi Manuel, CCing linux-input mailing list, so not deleting any code from this e-mail while replying. On Thu, May 14, 2009 at 3:39 PM, Manuel Lauss [off-list ref] wrote:quoted
Add a private data field to the tsc2007 platform data and pass this to the callbacks.I hope that you have created this patch on top of two recently posted patches by Kwangwoo Lee to merge changes from Thierry.quoted
Signed-off-by: Manuel Lauss <redacted> --- ?drivers/input/touchscreen/tsc2007.c | ? 52 +++++++++++++++++++++++----------- ?include/linux/i2c/tsc2007.h ? ? ? ? | ? 10 ++++--- ?2 files changed, 41 insertions(+), 21 deletions(-)diff --git a/drivers/input/touchscreen/tsc2007.c b/drivers/input/touchscreen/tsc2007.c index 948e167..5c4242d 100644 --- a/drivers/input/touchscreen/tsc2007.c +++ b/drivers/input/touchscreen/tsc2007.c@@ -83,10 +83,35 @@ struct tsc2007 {? ? ? ?unsigned ? ? ? ? ? ? ? ?pendown; ? ? ? ?int ? ? ? ? ? ? ? ? ? ? irq; - ? ? ? int ? ? ? ? ? ? ? ? ? ? (*get_pendown_state)(void); - ? ? ? void ? ? ? ? ? ? ? ? ? ?(*clear_penirq)(void); + ? ? ? struct tsc2007_platform_data *pd;Why is this pd is contained in struct tsc2007?
It just seemed nicer to me to store a pointer to the platform data instead of duplicating its members.
quoted
quoted
+/* ask platform for pendown state */ +static inline int ts_get_pendown_state(struct tsc2007 *ts) +{ + ? ? ? return ts->pd->get_pendown_state(ts->pd->priv);Is it required in get_pendown_state() function in your platform? The function just return true/false indicating the pendown state.
It enables me to reuse the same callbacks if more than one tsc2007 is soldered on (different bits to fiddle with in external registers). Thanks, Manuel Lauss