rtc: hym8563: make the irq optional
authorHeiko Stübner <heiko@sntech.de>
Sat, 13 Jun 2015 10:34:04 +0000 (12:34 +0200)
committerAlexandre Belloni <alexandre.belloni@free-electrons.com>
Wed, 24 Jun 2015 23:13:45 +0000 (01:13 +0200)
Sometimes the irq line is not connected to any soc-pin. This does
not hinder basic timekeeping functionality of the rtc, so probe
should not fail in this case.

Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Documentation/devicetree/bindings/rtc/haoyu,hym8563.txt
drivers/rtc/rtc-hym8563.c

index 5c199ee..a8934fe 100644 (file)
@@ -6,11 +6,11 @@ as well as a clock output of up to 32kHz.
 Required properties:
 - compatible: should be: "haoyu,hym8563"
 - reg: i2c address
-- interrupts: rtc alarm/event interrupt
 - #clock-cells: the value should be 0
 
 Optional properties:
 - clock-output-names: From common clock binding
+- interrupts: rtc alarm/event interrupt
 
 Example:
 
index 0f710e9..e9da795 100644 (file)
@@ -548,14 +548,16 @@ static int hym8563_probe(struct i2c_client *client,
                return ret;
        }
 
-       ret = devm_request_threaded_irq(&client->dev, client->irq,
-                                       NULL, hym8563_irq,
-                                       IRQF_TRIGGER_LOW | IRQF_ONESHOT,
-                                       client->name, hym8563);
-       if (ret < 0) {
-               dev_err(&client->dev, "irq %d request failed, %d\n",
-                       client->irq, ret);
-               return ret;
+       if (client->irq > 0) {
+               ret = devm_request_threaded_irq(&client->dev, client->irq,
+                                               NULL, hym8563_irq,
+                                               IRQF_TRIGGER_LOW | IRQF_ONESHOT,
+                                               client->name, hym8563);
+               if (ret < 0) {
+                       dev_err(&client->dev, "irq %d request failed, %d\n",
+                               client->irq, ret);
+                       return ret;
+               }
        }
 
        /* check state of calendar information */