summaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2013-06-05 16:13:47 +0200
committerSebastian Andrzej Siewior <bigeasy@linutronix.de>2013-06-12 17:58:59 +0200
commita9bce1b03c2199e66d36cda8aac675338bc074a7 (patch)
tree1f02ee8522388834c2a31de21dd8b7b38409f457 /drivers/input
parentd683b96b072dc4680fc74964eca77e6a23d1fa6e (diff)
downloadlinux-a9bce1b03c2199e66d36cda8aac675338bc074a7.tar.bz2
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.c16
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)
{
struct titsc *ts_dev;
struct input_dev *input_dev;
- struct ti_tscadc_dev *tscadc_dev = pdev->dev.platform_data;
+ struct ti_tscadc_dev *tscadc_dev = ti_tscadc_dev_get(pdev);
struct mfd_tscadc_board *pdata;
int err;
@@ -329,8 +329,8 @@ err_free_mem:
static int titsc_remove(struct platform_device *pdev)
{
- struct ti_tscadc_dev *tscadc_dev = pdev->dev.platform_data;
- struct titsc *ts_dev = tscadc_dev->tsc;
+ struct titsc *ts_dev = platform_get_drvdata(pdev);
+ u32 steps;
free_irq(ts_dev->irq, ts_dev);
@@ -344,10 +344,11 @@ static int titsc_remove(struct platform_device *pdev)
#ifdef CONFIG_PM
static int titsc_suspend(struct device *dev)
{
- struct ti_tscadc_dev *tscadc_dev = dev->platform_data;
- struct titsc *ts_dev = tscadc_dev->tsc;
+ struct titsc *ts_dev = dev_get_drvdata(dev);
+ struct ti_tscadc_dev *tscadc_dev;
unsigned int idle;
+ tscadc_dev = ti_tscadc_dev_get(to_platform_device(dev));
if (device_may_wakeup(tscadc_dev->dev)) {
idle = titsc_readl(ts_dev, REG_IRQENABLE);
titsc_writel(ts_dev, REG_IRQENABLE,
@@ -359,9 +360,10 @@ static int titsc_suspend(struct device *dev)
static int titsc_resume(struct device *dev)
{
- struct ti_tscadc_dev *tscadc_dev = dev->platform_data;
- struct titsc *ts_dev = tscadc_dev->tsc;
+ struct titsc *ts_dev = dev_get_drvdata(dev);
+ struct ti_tscadc_dev *tscadc_dev;
+ tscadc_dev = ti_tscadc_dev_get(to_platform_device(dev));
if (device_may_wakeup(tscadc_dev->dev)) {
titsc_writel(ts_dev, REG_IRQWAKEUP,
0x00);