Skip to content

Commit 51c4cfe

Browse files
Felipe Balbialexandrebelloni
authored andcommitted
rtc: ds1307: fix kernel splat due to wakeup irq handling
Since commit 3fffd12 ("i2c: allow specifying separate wakeup interrupt in device tree") we have automatic wakeup irq support for i2c devices. That commit missed the fact that rtc-1307 had its own wakeup irq handling and ended up introducing a kernel splat for at least Beagle x15 boards. Fix that by reverting original commit _and_ passing correct interrupt names on DTS so i2c-core can choose correct IRQ as wakeup. Now that we have automatic wakeirq support, we can revert the original commit which did it manually. Fixes the following warning: [ 10.346582] WARNING: CPU: 1 PID: 263 at linux/drivers/base/power/wakeirq.c:43 dev_pm_attach_wake_irq+0xbc/0xd4() [ 10.359244] rtc-ds1307 2-006f: wake irq already initialized Cc: Tony Lindgren <tony@atomide.com> Cc: Nishanth Menon <nm@ti.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
1 parent 1ec2183 commit 51c4cfe

File tree

2 files changed

+4
-33
lines changed

2 files changed

+4
-33
lines changed

arch/arm/boot/dts/am57xx-beagle-x15.dts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,7 @@
604604
reg = <0x6f>;
605605
interrupts-extended = <&crossbar_mpu GIC_SPI 2 IRQ_TYPE_EDGE_RISING>,
606606
<&dra7_pmx_core 0x424>;
607+
interrupt-names = "irq", "wakeup";
607608

608609
pinctrl-names = "default";
609610
pinctrl-0 = <&mcp79410_pins_default>;

drivers/rtc/rtc-ds1307.c

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
#include <linux/i2c.h>
1616
#include <linux/init.h>
1717
#include <linux/module.h>
18-
#include <linux/of_device.h>
19-
#include <linux/of_irq.h>
20-
#include <linux/pm_wakeirq.h>
2118
#include <linux/rtc/ds1307.h>
2219
#include <linux/rtc.h>
2320
#include <linux/slab.h>
@@ -117,7 +114,6 @@ struct ds1307 {
117114
#define HAS_ALARM 1 /* bit 1 == irq claimed */
118115
struct i2c_client *client;
119116
struct rtc_device *rtc;
120-
int wakeirq;
121117
s32 (*read_block_data)(const struct i2c_client *client, u8 command,
122118
u8 length, u8 *values);
123119
s32 (*write_block_data)(const struct i2c_client *client, u8 command,
@@ -1146,43 +1142,20 @@ static int ds1307_probe(struct i2c_client *client,
11461142
}
11471143

11481144
if (want_irq) {
1149-
struct device_node *node = client->dev.of_node;
1150-
11511145
err = devm_request_threaded_irq(&client->dev,
11521146
client->irq, NULL, irq_handler,
11531147
IRQF_SHARED | IRQF_ONESHOT,
11541148
ds1307->rtc->name, client);
11551149
if (err) {
11561150
client->irq = 0;
11571151
dev_err(&client->dev, "unable to request IRQ!\n");
1158-
goto no_irq;
1159-
}
1160-
1161-
set_bit(HAS_ALARM, &ds1307->flags);
1162-
dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
1163-
1164-
/* Currently supported by OF code only! */
1165-
if (!node)
1166-
goto no_irq;
1167-
1168-
err = of_irq_get(node, 1);
1169-
if (err <= 0) {
1170-
if (err == -EPROBE_DEFER)
1171-
goto exit;
1172-
goto no_irq;
1173-
}
1174-
ds1307->wakeirq = err;
1152+
} else {
11751153

1176-
err = dev_pm_set_dedicated_wake_irq(&client->dev,
1177-
ds1307->wakeirq);
1178-
if (err) {
1179-
dev_err(&client->dev, "unable to setup wakeIRQ %d!\n",
1180-
err);
1181-
goto exit;
1154+
set_bit(HAS_ALARM, &ds1307->flags);
1155+
dev_dbg(&client->dev, "got IRQ %d\n", client->irq);
11821156
}
11831157
}
11841158

1185-
no_irq:
11861159
if (chip->nvram_size) {
11871160

11881161
ds1307->nvram = devm_kzalloc(&client->dev,
@@ -1226,9 +1199,6 @@ static int ds1307_remove(struct i2c_client *client)
12261199
{
12271200
struct ds1307 *ds1307 = i2c_get_clientdata(client);
12281201

1229-
if (ds1307->wakeirq)
1230-
dev_pm_clear_wake_irq(&client->dev);
1231-
12321202
if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags))
12331203
sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);
12341204

0 commit comments

Comments
 (0)