]> git.karo-electronics.de Git - linux-beck.git/commitdiff
rtc: fix drivers that consider 0 as a valid IRQ in client->irq
authorOctavian Purdila <octavian.purdila@intel.com>
Fri, 5 Jun 2015 13:59:43 +0000 (16:59 +0300)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Sat, 5 Sep 2015 11:19:07 +0000 (13:19 +0200)
Since dab472eb931b ("i2c / ACPI: Use 0 to indicate that device does not
have interrupt assigned"), 0 is not a valid i2c client irq anymore, so
change all driver's checks accordingly.

The same issue occurs when the device is instantiated via device tree
with no IRQ, or from the i2c sysfs interface, even before the patch
above.

Signed-off-by: Octavian Purdila <octavian.purdila@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
drivers/rtc/rtc-ds1374.c
drivers/rtc/rtc-ds3232.c

index 6d8665647eee28004ab1328e29ed63180efb9d4c..7067232ba50719e7bca3160b8f2d8a1844f060e8 100644 (file)
@@ -688,7 +688,7 @@ static int ds1374_suspend(struct device *dev)
 {
        struct i2c_client *client = to_i2c_client(dev);
 
-       if (client->irq >= 0 && device_may_wakeup(&client->dev))
+       if (client->irq > 0 && device_may_wakeup(&client->dev))
                enable_irq_wake(client->irq);
        return 0;
 }
@@ -697,7 +697,7 @@ static int ds1374_resume(struct device *dev)
 {
        struct i2c_client *client = to_i2c_client(dev);
 
-       if (client->irq >= 0 && device_may_wakeup(&client->dev))
+       if (client->irq > 0 && device_may_wakeup(&client->dev))
                disable_irq_wake(client->irq);
        return 0;
 }
index 18f062f2a6343532ad443682b0c92d0799e8caa9..a8702dda0f26286a31ba513b77317af4d096d691 100644 (file)
@@ -443,7 +443,7 @@ static int ds3232_remove(struct i2c_client *client)
 {
        struct ds3232 *ds3232 = i2c_get_clientdata(client);
 
-       if (client->irq >= 0) {
+       if (client->irq > 0) {
                mutex_lock(&ds3232->mutex);
                ds3232->exiting = 1;
                mutex_unlock(&ds3232->mutex);