diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-02-01 00:09:25 -0500 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2011-02-01 00:15:44 -0500 |
commit | 723d928417bffff6467da155d8ebbbe016464012 (patch) | |
tree | 49678818fd746defefb544d8319891311a67ab2f /drivers/input/touchscreen | |
parent | 00cfa730db0d8378685148e6365b9cec7384b275 (diff) |
Input: wm831x-ts - remove use of ternary operator
While being applied the driver was modified to add use of the ternary
operator. Write the conditionals out longhand as I find it terribly
unhelpful for legibility.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r-- | drivers/input/touchscreen/wm831x-ts.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/input/touchscreen/wm831x-ts.c b/drivers/input/touchscreen/wm831x-ts.c index a6121bdb635d..1022f715d3c2 100644 --- a/drivers/input/touchscreen/wm831x-ts.c +++ b/drivers/input/touchscreen/wm831x-ts.c | |||
@@ -76,9 +76,14 @@ static irqreturn_t wm831x_ts_data_irq(int irq, void *irq_data) | |||
76 | struct wm831x *wm831x = wm831x_ts->wm831x; | 76 | struct wm831x *wm831x = wm831x_ts->wm831x; |
77 | static int data_types[] = { ABS_X, ABS_Y, ABS_PRESSURE }; | 77 | static int data_types[] = { ABS_X, ABS_Y, ABS_PRESSURE }; |
78 | u16 data[3]; | 78 | u16 data[3]; |
79 | int count = wm831x_ts->pressure ? 3 : 2; | 79 | int count; |
80 | int i, ret; | 80 | int i, ret; |
81 | 81 | ||
82 | if (wm831x_ts->pressure) | ||
83 | count = 3; | ||
84 | else | ||
85 | count = 2; | ||
86 | |||
82 | wm831x_set_bits(wm831x, WM831X_INTERRUPT_STATUS_1, | 87 | wm831x_set_bits(wm831x, WM831X_INTERRUPT_STATUS_1, |
83 | WM831X_TCHDATA_EINT, WM831X_TCHDATA_EINT); | 88 | WM831X_TCHDATA_EINT, WM831X_TCHDATA_EINT); |
84 | 89 | ||
@@ -134,10 +139,11 @@ static irqreturn_t wm831x_ts_pen_down_irq(int irq, void *irq_data) | |||
134 | { | 139 | { |
135 | struct wm831x_ts *wm831x_ts = irq_data; | 140 | struct wm831x_ts *wm831x_ts = irq_data; |
136 | struct wm831x *wm831x = wm831x_ts->wm831x; | 141 | struct wm831x *wm831x = wm831x_ts->wm831x; |
137 | int ena; | 142 | int ena = 0; |
138 | 143 | ||
139 | /* Start collecting data */ | 144 | /* Start collecting data */ |
140 | ena = wm831x_ts->pressure ? WM831X_TCH_Z_ENA : 0; | 145 | if (wm831x_ts->pressure) |
146 | ena |= WM831X_TCH_Z_ENA; | ||
141 | 147 | ||
142 | wm831x_set_bits(wm831x, WM831X_TOUCH_CONTROL_1, | 148 | wm831x_set_bits(wm831x, WM831X_TOUCH_CONTROL_1, |
143 | WM831X_TCH_X_ENA | WM831X_TCH_Y_ENA | WM831X_TCH_Z_ENA, | 149 | WM831X_TCH_X_ENA | WM831X_TCH_Y_ENA | WM831X_TCH_Z_ENA, |
@@ -188,11 +194,13 @@ static __devinit int wm831x_ts_probe(struct platform_device *pdev) | |||
188 | struct wm831x_ts *wm831x_ts; | 194 | struct wm831x_ts *wm831x_ts; |
189 | struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); | 195 | struct wm831x *wm831x = dev_get_drvdata(pdev->dev.parent); |
190 | struct wm831x_pdata *core_pdata = dev_get_platdata(pdev->dev.parent); | 196 | struct wm831x_pdata *core_pdata = dev_get_platdata(pdev->dev.parent); |
191 | struct wm831x_touch_pdata *pdata = | 197 | struct wm831x_touch_pdata *pdata = NULL; |
192 | core_pdata ? core_pdata->touch : NULL; | ||
193 | struct input_dev *input_dev; | 198 | struct input_dev *input_dev; |
194 | int error; | 199 | int error; |
195 | 200 | ||
201 | if (core_pdata) | ||
202 | pdata = core_pdata->touch; | ||
203 | |||
196 | wm831x_ts = kzalloc(sizeof(struct wm831x_ts), GFP_KERNEL); | 204 | wm831x_ts = kzalloc(sizeof(struct wm831x_ts), GFP_KERNEL); |
197 | input_dev = input_allocate_device(); | 205 | input_dev = input_allocate_device(); |
198 | if (!wm831x_ts || !input_dev) { | 206 | if (!wm831x_ts || !input_dev) { |