@@ -744,6 +744,7 @@ static irqreturn_t cmos_interrupt(int irq, void *p)
744
744
return IRQ_NONE ;
745
745
}
746
746
747
+ static inline void rtc_wake_setup (struct device * dev );
747
748
static void cmos_wake_setup (struct device * dev );
748
749
749
750
#ifdef CONFIG_PNP
@@ -938,6 +939,13 @@ cmos_do_probe(struct device *dev, struct resource *ports, int rtc_irq)
938
939
nvmem_cfg .size = address_space - NVRAM_OFFSET ;
939
940
devm_rtc_nvmem_register (cmos_rtc .rtc , & nvmem_cfg );
940
941
942
+ /*
943
+ * Everything has gone well so far, so by default register a handler for
944
+ * the ACPI RTC fixed event.
945
+ */
946
+ if (!info )
947
+ rtc_wake_setup (dev );
948
+
941
949
dev_info (dev , "%s%s, %d bytes nvram%s\n" ,
942
950
!is_valid_irq (rtc_irq ) ? "no alarms" :
943
951
cmos_rtc .mon_alrm ? "alarms up to one year" :
@@ -1357,7 +1365,7 @@ static void rtc_wake_setup(struct device *dev)
1357
1365
1358
1366
static int cmos_pnp_probe (struct pnp_dev * pnp , const struct pnp_device_id * id )
1359
1367
{
1360
- int irq , ret ;
1368
+ int irq ;
1361
1369
1362
1370
if (pnp_port_start (pnp , 0 ) == 0x70 && !pnp_irq_valid (pnp , 0 )) {
1363
1371
irq = 0 ;
@@ -1373,13 +1381,7 @@ static int cmos_pnp_probe(struct pnp_dev *pnp, const struct pnp_device_id *id)
1373
1381
irq = pnp_irq (pnp , 0 );
1374
1382
}
1375
1383
1376
- ret = cmos_do_probe (& pnp -> dev , pnp_get_resource (pnp , IORESOURCE_IO , 0 ), irq );
1377
- if (ret )
1378
- return ret ;
1379
-
1380
- rtc_wake_setup (& pnp -> dev );
1381
-
1382
- return 0 ;
1384
+ return cmos_do_probe (& pnp -> dev , pnp_get_resource (pnp , IORESOURCE_IO , 0 ), irq );
1383
1385
}
1384
1386
1385
1387
static void cmos_pnp_remove (struct pnp_dev * pnp )
@@ -1463,7 +1465,7 @@ static inline void cmos_of_init(struct platform_device *pdev) {}
1463
1465
static int __init cmos_platform_probe (struct platform_device * pdev )
1464
1466
{
1465
1467
struct resource * resource ;
1466
- int irq , ret ;
1468
+ int irq ;
1467
1469
1468
1470
cmos_of_init (pdev );
1469
1471
@@ -1475,13 +1477,7 @@ static int __init cmos_platform_probe(struct platform_device *pdev)
1475
1477
if (irq < 0 )
1476
1478
irq = -1 ;
1477
1479
1478
- ret = cmos_do_probe (& pdev -> dev , resource , irq );
1479
- if (ret )
1480
- return ret ;
1481
-
1482
- rtc_wake_setup (& pdev -> dev );
1483
-
1484
- return 0 ;
1480
+ return cmos_do_probe (& pdev -> dev , resource , irq );
1485
1481
}
1486
1482
1487
1483
static int cmos_platform_remove (struct platform_device * pdev )
0 commit comments