rtc: ds1307: fix kernel splat due to wakeup irq handling

Since commit 3fffd1283927 ("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>

authored by Felipe Balbi and committed by Alexandre Belloni 51c4cfef 1ec21837

Changed files
+4 -33
arch
arm
drivers
+1
arch/arm/boot/dts/am57xx-beagle-x15.dts
··· 604 604 reg = <0x6f>; 605 605 interrupts-extended = <&crossbar_mpu GIC_SPI 2 IRQ_TYPE_EDGE_RISING>, 606 606 <&dra7_pmx_core 0x424>; 607 + interrupt-names = "irq", "wakeup"; 607 608 608 609 pinctrl-names = "default"; 609 610 pinctrl-0 = <&mcp79410_pins_default>;
+3 -33
drivers/rtc/rtc-ds1307.c
··· 15 15 #include <linux/i2c.h> 16 16 #include <linux/init.h> 17 17 #include <linux/module.h> 18 - #include <linux/of_device.h> 19 - #include <linux/of_irq.h> 20 - #include <linux/pm_wakeirq.h> 21 18 #include <linux/rtc/ds1307.h> 22 19 #include <linux/rtc.h> 23 20 #include <linux/slab.h> ··· 114 117 #define HAS_ALARM 1 /* bit 1 == irq claimed */ 115 118 struct i2c_client *client; 116 119 struct rtc_device *rtc; 117 - int wakeirq; 118 120 s32 (*read_block_data)(const struct i2c_client *client, u8 command, 119 121 u8 length, u8 *values); 120 122 s32 (*write_block_data)(const struct i2c_client *client, u8 command, ··· 1142 1146 } 1143 1147 1144 1148 if (want_irq) { 1145 - struct device_node *node = client->dev.of_node; 1146 - 1147 1149 err = devm_request_threaded_irq(&client->dev, 1148 1150 client->irq, NULL, irq_handler, 1149 1151 IRQF_SHARED | IRQF_ONESHOT, ··· 1149 1155 if (err) { 1150 1156 client->irq = 0; 1151 1157 dev_err(&client->dev, "unable to request IRQ!\n"); 1152 - goto no_irq; 1153 - } 1158 + } else { 1154 1159 1155 - set_bit(HAS_ALARM, &ds1307->flags); 1156 - dev_dbg(&client->dev, "got IRQ %d\n", client->irq); 1157 - 1158 - /* Currently supported by OF code only! */ 1159 - if (!node) 1160 - goto no_irq; 1161 - 1162 - err = of_irq_get(node, 1); 1163 - if (err <= 0) { 1164 - if (err == -EPROBE_DEFER) 1165 - goto exit; 1166 - goto no_irq; 1167 - } 1168 - ds1307->wakeirq = err; 1169 - 1170 - err = dev_pm_set_dedicated_wake_irq(&client->dev, 1171 - ds1307->wakeirq); 1172 - if (err) { 1173 - dev_err(&client->dev, "unable to setup wakeIRQ %d!\n", 1174 - err); 1175 - goto exit; 1160 + set_bit(HAS_ALARM, &ds1307->flags); 1161 + dev_dbg(&client->dev, "got IRQ %d\n", client->irq); 1176 1162 } 1177 1163 } 1178 1164 1179 - no_irq: 1180 1165 if (chip->nvram_size) { 1181 1166 1182 1167 ds1307->nvram = devm_kzalloc(&client->dev, ··· 1198 1225 static int ds1307_remove(struct i2c_client *client) 1199 1226 { 1200 1227 struct ds1307 *ds1307 = i2c_get_clientdata(client); 1201 - 1202 - if (ds1307->wakeirq) 1203 - dev_pm_clear_wake_irq(&client->dev); 1204 1228 1205 1229 if (test_and_clear_bit(HAS_NVRAM, &ds1307->flags)) 1206 1230 sysfs_remove_bin_file(&client->dev.kobj, ds1307->nvram);