diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2013-06-05 10:13:47 -0400 |
---|---|---|
committer | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2013-06-12 11:58:59 -0400 |
commit | a9bce1b03c2199e66d36cda8aac675338bc074a7 (patch) | |
tree | 1f02ee8522388834c2a31de21dd8b7b38409f457 /drivers/input | |
parent | d683b96b072dc4680fc74964eca77e6a23d1fa6e (diff) |
mfd: input: iio: ti_am335x_adc: use one structure for ti_tscadc_dev
The mfd driver creates platform data for the child devices and it is the
ti_tscadc_dev struct. This struct is copied for the two devices.
The copy of the structure makes a common lock in this structure a little
less usefull. Therefore the platform data is not a pointer to the
structure and the same structure is used.
While doing the change I noticed that the suspend/resume code assumes
the wrong pointer for ti_tscadc_dev and this has been fixed as well.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/touchscreen/ti_am335x_tsc.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/input/touchscreen/ti_am335x_tsc.c b/drivers/input/touchscreen/ti_am335x_tsc.c index 51e7b87827a4..16077d3d80ba 100644 --- a/drivers/input/touchscreen/ti_am335x_tsc.c +++ b/drivers/input/touchscreen/ti_am335x_tsc.c | |||
@@ -262,7 +262,7 @@ static int titsc_probe(struct platform_device *pdev) | |||
262 | { | 262 | { |
263 | struct titsc *ts_dev; | 263 | struct titsc *ts_dev; |
264 | struct input_dev *input_dev; | 264 | struct input_dev *input_dev; |
265 | struct ti_tscadc_dev *tscadc_dev = pdev->dev.platform_data; | 265 | struct ti_tscadc_dev *tscadc_dev = ti_tscadc_dev_get(pdev); |
266 | struct mfd_tscadc_board *pdata; | 266 | struct mfd_tscadc_board *pdata; |
267 | int err; | 267 | int err; |
268 | 268 | ||
@@ -329,8 +329,8 @@ err_free_mem: | |||
329 | 329 | ||
330 | static int titsc_remove(struct platform_device *pdev) | 330 | static int titsc_remove(struct platform_device *pdev) |
331 | { | 331 | { |
332 | struct ti_tscadc_dev *tscadc_dev = pdev->dev.platform_data; | 332 | struct titsc *ts_dev = platform_get_drvdata(pdev); |
333 | struct titsc *ts_dev = tscadc_dev->tsc; | 333 | u32 steps; |
334 | 334 | ||
335 | free_irq(ts_dev->irq, ts_dev); | 335 | free_irq(ts_dev->irq, ts_dev); |
336 | 336 | ||
@@ -344,10 +344,11 @@ static int titsc_remove(struct platform_device *pdev) | |||
344 | #ifdef CONFIG_PM | 344 | #ifdef CONFIG_PM |
345 | static int titsc_suspend(struct device *dev) | 345 | static int titsc_suspend(struct device *dev) |
346 | { | 346 | { |
347 | struct ti_tscadc_dev *tscadc_dev = dev->platform_data; | 347 | struct titsc *ts_dev = dev_get_drvdata(dev); |
348 | struct titsc *ts_dev = tscadc_dev->tsc; | 348 | struct ti_tscadc_dev *tscadc_dev; |
349 | unsigned int idle; | 349 | unsigned int idle; |
350 | 350 | ||
351 | tscadc_dev = ti_tscadc_dev_get(to_platform_device(dev)); | ||
351 | if (device_may_wakeup(tscadc_dev->dev)) { | 352 | if (device_may_wakeup(tscadc_dev->dev)) { |
352 | idle = titsc_readl(ts_dev, REG_IRQENABLE); | 353 | idle = titsc_readl(ts_dev, REG_IRQENABLE); |
353 | titsc_writel(ts_dev, REG_IRQENABLE, | 354 | titsc_writel(ts_dev, REG_IRQENABLE, |
@@ -359,9 +360,10 @@ static int titsc_suspend(struct device *dev) | |||
359 | 360 | ||
360 | static int titsc_resume(struct device *dev) | 361 | static int titsc_resume(struct device *dev) |
361 | { | 362 | { |
362 | struct ti_tscadc_dev *tscadc_dev = dev->platform_data; | 363 | struct titsc *ts_dev = dev_get_drvdata(dev); |
363 | struct titsc *ts_dev = tscadc_dev->tsc; | 364 | struct ti_tscadc_dev *tscadc_dev; |
364 | 365 | ||
366 | tscadc_dev = ti_tscadc_dev_get(to_platform_device(dev)); | ||
365 | if (device_may_wakeup(tscadc_dev->dev)) { | 367 | if (device_may_wakeup(tscadc_dev->dev)) { |
366 | titsc_writel(ts_dev, REG_IRQWAKEUP, | 368 | titsc_writel(ts_dev, REG_IRQWAKEUP, |
367 | 0x00); | 369 | 0x00); |