]> Pileus Git - ~andy/linux/blobdiff - drivers/input/touchscreen/ads7846.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
[~andy/linux] / drivers / input / touchscreen / ads7846.c
index f59aecf5ec1565fe4959308edc8cc034c3a0a9a3..58934a40f5ce5ff90abfbe071327370598d0e631 100644 (file)
@@ -116,6 +116,7 @@ struct ads7846 {
 // FIXME remove "irq_disabled"
        unsigned                irq_disabled:1; /* P: lock */
        unsigned                disabled:1;
+       unsigned                is_suspended:1;
 
        int                     (*filter)(void *data, int data_idx, int *val);
        void                    *filter_data;
@@ -203,7 +204,7 @@ static void ads7846_disable(struct ads7846 *ts);
 static int device_suspended(struct device *dev)
 {
        struct ads7846 *ts = dev_get_drvdata(dev);
-       return dev->power.power_state.event != PM_EVENT_ON || ts->disabled;
+       return ts->is_suspended || ts->disabled;
 }
 
 static int ads7846_read12_ser(struct device *dev, unsigned command)
@@ -267,13 +268,12 @@ static int ads7846_read12_ser(struct device *dev, unsigned command)
        ts->irq_disabled = 0;
        enable_irq(spi->irq);
 
-       if (req->msg.status)
-               status = req->msg.status;
-
-       /* on-wire is a must-ignore bit, a BE12 value, then padding */
-       sample = be16_to_cpu(req->sample);
-       sample = sample >> 3;
-       sample &= 0x0fff;
+       if (status == 0) {
+               /* on-wire is a must-ignore bit, a BE12 value, then padding */
+               sample = be16_to_cpu(req->sample);
+               sample = sample >> 3;
+               sample &= 0x0fff;
+       }
 
        kfree(req);
        return status ? status : sample;
@@ -795,7 +795,7 @@ static int ads7846_suspend(struct spi_device *spi, pm_message_t message)
 
        spin_lock_irq(&ts->lock);
 
-       spi->dev.power.power_state = message;
+       ts->is_suspended = 1;
        ads7846_disable(ts);
 
        spin_unlock_irq(&ts->lock);
@@ -810,7 +810,7 @@ static int ads7846_resume(struct spi_device *spi)
 
        spin_lock_irq(&ts->lock);
 
-       spi->dev.power.power_state = PMSG_ON;
+       ts->is_suspended = 0;
        ads7846_enable(ts);
 
        spin_unlock_irq(&ts->lock);
@@ -872,7 +872,6 @@ static int __devinit ads7846_probe(struct spi_device *spi)
        }
 
        dev_set_drvdata(&spi->dev, ts);
-       spi->dev.power.power_state = PMSG_ON;
 
        ts->spi = spi;
        ts->input = input_dev;