MFD: ucb1x00-ts: fix resume failure
[linux-2.6-microblaze.git] / drivers / mfd / ucb1x00-ts.c
index 38ffbd5..63a3cbd 100644 (file)
@@ -47,7 +47,6 @@ struct ucb1x00_ts {
        u16                     x_res;
        u16                     y_res;
 
-       unsigned int            restart:1;
        unsigned int            adcsync:1;
 };
 
@@ -207,15 +206,17 @@ static int ucb1x00_thread(void *_ts)
 {
        struct ucb1x00_ts *ts = _ts;
        DECLARE_WAITQUEUE(wait, current);
+       bool frozen, ignore = false;
        int valid = 0;
 
        set_freezable();
        add_wait_queue(&ts->irq_wait, &wait);
-       while (!kthread_should_stop()) {
+       while (!kthread_freezable_should_stop(&frozen)) {
                unsigned int x, y, p;
                signed long timeout;
 
-               ts->restart = 0;
+               if (frozen)
+                       ignore = true;
 
                ucb1x00_adc_enable(ts->ucb);
 
@@ -258,7 +259,7 @@ static int ucb1x00_thread(void *_ts)
                         * space.  We therefore leave it to user space
                         * to do any filtering they please.
                         */
-                       if (!ts->restart) {
+                       if (!ignore) {
                                ucb1x00_ts_evt_add(ts, p, x, y);
                                valid = 1;
                        }
@@ -267,8 +268,6 @@ static int ucb1x00_thread(void *_ts)
                        timeout = HZ / 100;
                }
 
-               try_to_freeze();
-
                schedule_timeout(timeout);
        }
 
@@ -340,26 +339,6 @@ static void ucb1x00_ts_close(struct input_dev *idev)
        ucb1x00_disable(ts->ucb);
 }
 
-#ifdef CONFIG_PM
-static int ucb1x00_ts_resume(struct ucb1x00_dev *dev)
-{
-       struct ucb1x00_ts *ts = dev->priv;
-
-       if (ts->rtask != NULL) {
-               /*
-                * Restart the TS thread to ensure the
-                * TS interrupt mode is set up again
-                * after sleep.
-                */
-               ts->restart = 1;
-               wake_up(&ts->irq_wait);
-       }
-       return 0;
-}
-#else
-#define ucb1x00_ts_resume NULL
-#endif
-
 
 /*
  * Initialisation.
@@ -425,7 +404,6 @@ static void ucb1x00_ts_remove(struct ucb1x00_dev *dev)
 static struct ucb1x00_driver ucb1x00_ts_driver = {
        .add            = ucb1x00_ts_add,
        .remove         = ucb1x00_ts_remove,
-       .resume         = ucb1x00_ts_resume,
 };
 
 static int __init ucb1x00_ts_init(void)