Skip to content

Commit b42f931

Browse files
Anton Vorontsovtorvalds
authored andcommitted
rtc: rtc-ds1374: fix 'no irq' case handling
On a PowerPC board with ds1374 RTC I'm getting this error while RTC tries to probe: rtc-ds1374 0-0068: unable to request IRQ This happens because I2C probing code (drivers/of/of_i2c.c) is specifying IRQ0 for 'no irq' case, which is correct. The driver handles this incorrectly, though. This patch fixes it. Signed-off-by: Anton Vorontsov <[email protected]> Cc: David Brownell <[email protected]> Cc: Alessandro Zummo <[email protected]> Acked-by: Peter Korsgaard <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 14bac5a commit b42f931

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/rtc/rtc-ds1374.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ static int ds1374_read_alarm(struct device *dev, struct rtc_wkalrm *alarm)
173173
int cr, sr;
174174
int ret = 0;
175175

176-
if (client->irq < 0)
176+
if (client->irq <= 0)
177177
return -EINVAL;
178178

179179
mutex_lock(&ds1374->mutex);
@@ -212,7 +212,7 @@ static int ds1374_set_alarm(struct device *dev, struct rtc_wkalrm *alarm)
212212
int cr;
213213
int ret = 0;
214214

215-
if (client->irq < 0)
215+
if (client->irq <= 0)
216216
return -EINVAL;
217217

218218
ret = ds1374_read_time(dev, &now);
@@ -381,7 +381,7 @@ static int ds1374_probe(struct i2c_client *client,
381381
if (ret)
382382
goto out_free;
383383

384-
if (client->irq >= 0) {
384+
if (client->irq > 0) {
385385
ret = request_irq(client->irq, ds1374_irq, 0,
386386
"ds1374", client);
387387
if (ret) {
@@ -401,7 +401,7 @@ static int ds1374_probe(struct i2c_client *client,
401401
return 0;
402402

403403
out_irq:
404-
if (client->irq >= 0)
404+
if (client->irq > 0)
405405
free_irq(client->irq, client);
406406

407407
out_free:
@@ -414,7 +414,7 @@ static int __devexit ds1374_remove(struct i2c_client *client)
414414
{
415415
struct ds1374 *ds1374 = i2c_get_clientdata(client);
416416

417-
if (client->irq >= 0) {
417+
if (client->irq > 0) {
418418
mutex_lock(&ds1374->mutex);
419419
ds1374->exiting = 1;
420420
mutex_unlock(&ds1374->mutex);

0 commit comments

Comments
 (0)