diff options
-rw-r--r-- | drivers/hwmon/lm90.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c index 5e414ca80a78..499f473e0780 100644 --- a/drivers/hwmon/lm90.c +++ b/drivers/hwmon/lm90.c | |||
@@ -89,6 +89,7 @@ | |||
89 | #include <linux/err.h> | 89 | #include <linux/err.h> |
90 | #include <linux/mutex.h> | 90 | #include <linux/mutex.h> |
91 | #include <linux/sysfs.h> | 91 | #include <linux/sysfs.h> |
92 | #include <linux/interrupt.h> | ||
92 | 93 | ||
93 | /* | 94 | /* |
94 | * Addresses to scan | 95 | * Addresses to scan |
@@ -1445,6 +1446,17 @@ static bool lm90_is_tripped(struct i2c_client *client, u16 *status) | |||
1445 | return true; | 1446 | return true; |
1446 | } | 1447 | } |
1447 | 1448 | ||
1449 | static irqreturn_t lm90_irq_thread(int irq, void *dev_id) | ||
1450 | { | ||
1451 | struct i2c_client *client = dev_id; | ||
1452 | u16 status; | ||
1453 | |||
1454 | if (lm90_is_tripped(client, &status)) | ||
1455 | return IRQ_HANDLED; | ||
1456 | else | ||
1457 | return IRQ_NONE; | ||
1458 | } | ||
1459 | |||
1448 | static int lm90_probe(struct i2c_client *client, | 1460 | static int lm90_probe(struct i2c_client *client, |
1449 | const struct i2c_device_id *id) | 1461 | const struct i2c_device_id *id) |
1450 | { | 1462 | { |
@@ -1521,6 +1533,18 @@ static int lm90_probe(struct i2c_client *client, | |||
1521 | goto exit_remove_files; | 1533 | goto exit_remove_files; |
1522 | } | 1534 | } |
1523 | 1535 | ||
1536 | if (client->irq) { | ||
1537 | dev_dbg(dev, "IRQ: %d\n", client->irq); | ||
1538 | err = devm_request_threaded_irq(dev, client->irq, | ||
1539 | NULL, lm90_irq_thread, | ||
1540 | IRQF_TRIGGER_LOW | IRQF_ONESHOT, | ||
1541 | "lm90", client); | ||
1542 | if (err < 0) { | ||
1543 | dev_err(dev, "cannot request IRQ %d\n", client->irq); | ||
1544 | goto exit_remove_files; | ||
1545 | } | ||
1546 | } | ||
1547 | |||
1524 | return 0; | 1548 | return 0; |
1525 | 1549 | ||
1526 | exit_remove_files: | 1550 | exit_remove_files: |