Commit 0d9030a2 authored by Octavian Purdila's avatar Octavian Purdila Committed by Alexandre Belloni

rtc: fix drivers that consider 0 as a valid IRQ in client->irq

Since dab472eb ("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: default avatarOctavian Purdila <octavian.purdila@intel.com>
Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@free-electrons.com>
parent 1e4cd625
...@@ -688,7 +688,7 @@ static int ds1374_suspend(struct device *dev) ...@@ -688,7 +688,7 @@ static int ds1374_suspend(struct device *dev)
{ {
struct i2c_client *client = to_i2c_client(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); enable_irq_wake(client->irq);
return 0; return 0;
} }
...@@ -697,7 +697,7 @@ static int ds1374_resume(struct device *dev) ...@@ -697,7 +697,7 @@ static int ds1374_resume(struct device *dev)
{ {
struct i2c_client *client = to_i2c_client(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); disable_irq_wake(client->irq);
return 0; return 0;
} }
......
...@@ -443,7 +443,7 @@ static int ds3232_remove(struct i2c_client *client) ...@@ -443,7 +443,7 @@ static int ds3232_remove(struct i2c_client *client)
{ {
struct ds3232 *ds3232 = i2c_get_clientdata(client); struct ds3232 *ds3232 = i2c_get_clientdata(client);
if (client->irq >= 0) { if (client->irq > 0) {
mutex_lock(&ds3232->mutex); mutex_lock(&ds3232->mutex);
ds3232->exiting = 1; ds3232->exiting = 1;
mutex_unlock(&ds3232->mutex); mutex_unlock(&ds3232->mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment