Skip to contentSkip to conversation

rtc: rtc-pl031: Set wakeup flag prior to registering rtcdev

RFC PATCH In review John Stultz 2 participants 3 messages Sep 17, 2013 – Sep 18, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 rtc: rtc-pl031: Set wakeup flag prior to registering rtcdev

In some recent testing, I noticed the CLOCK_REALTIME_ALARM clockid wasn't functioning on my vexpress qemu environment. Looking into it I noticed the pl031 rtc driver doesn't set the wakeup flag on the device until after registering the device with the RTC subsystem.

This causes the alarmtimer subsystem to not see the pl031 driver as a valid backing device, and that resuls in alarm clockids getting ENOTSUPP errors.

Thus be sure to set the wakeup flag on the device prior to registering the rtcdev so the pl031 rtc driver can be used as the backing alarmtimer device.

Let me know if you have any feedback or objections to this. If it looks ok, I'll queue it for 3.13. I suspect there may be other RTC drivers with the same problem.

Cc Linus Walleij <[email protected]>
Cc Alessandro Zummo <[email protected]>
Cc "Jon Medhurst (Tixy)" <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
---
 drivers/rtc/rtc-pl031.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/rtc/rtc-pl031.c +1 -2
index 0f0609b..e3b2571 100644
@@ -371,6 +371,7 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
 		}
 	}
 
+	device_init_wakeup(&adev->dev, 1);
 	ldata->rtc = rtc_device_register("pl031", &adev->dev, ops,
 					THIS_MODULE);
 	if (IS_ERR(ldata->rtc)) {
@@ -384,8 +385,6 @@ static int pl031_probe(struct amba_device *adev, const struct amba_id *id)
 		goto out_no_irq;
 	}
 
-	device_init_wakeup(&adev->dev, 1);
-
 	return 0;
 
 out_no_irq:
Signature · 1 line
1.8.1.2
Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · John Stultz

In some recent testing, I noticed the CLOCK_REALTIME_ALARM clockid wasn't functioning on my vexpress qemu environment. Looking into it I noticed the pl031 rtc driver doesn't set the wakeup flag on the device until after registering the device with the RTC subsystem.

This causes the alarmtimer subsystem to not see the pl031 driver as a valid backing device, and that resuls in alarm clockids getting ENOTSUPP errors.

Thus be sure to set the wakeup flag on the device prior to registering the rtcdev so the pl031 rtc driver can be used as the backing alarmtimer device.

Let me know if you have any feedback or objections to this. If it looks ok, I'll queue it for 3.13. I suspect there may be other RTC drivers with the same problem.

Quoted 5 lines
Cc Linus Walleij <[email protected]>
Cc Alessandro Zummo <[email protected]>
Cc "Jon Medhurst (Tixy)" <[email protected]>
Cc linux-arm-kernel at lists.infradead.org

Makes perfect sense. I have only tested the driver from regular userspace using ioctl()s. Is these a simple way to test an alarmtimer on a barebones system?

Are you sure this should not be for -rc:s and stable?

Yours,
Linus Walleij

#2 lore raw
Quoted 26 lines · Linus Walleij
Quoted 17 lines · John Stultz

In some recent testing, I noticed the CLOCK_REALTIME_ALARM clockid wasn't functioning on my vexpress qemu environment. Looking into it I noticed the pl031 rtc driver doesn't set the wakeup flag on the device until after registering the device with the RTC subsystem.

This causes the alarmtimer subsystem to not see the pl031 driver as a valid backing device, and that resuls in alarm clockids getting ENOTSUPP errors.

Thus be sure to set the wakeup flag on the device prior to registering the rtcdev so the pl031 rtc driver can be used as the backing alarmtimer device.

Let me know if you have any feedback or objections to this. If it looks ok, I'll queue it for 3.13. I suspect there may be other RTC drivers with the same problem.

Quoted 5 lines
Cc Linus Walleij <[email protected]>
Cc Alessandro Zummo <[email protected]>
Cc "Jon Medhurst (Tixy)" <[email protected]>
Cc linux-arm-kernel at lists.infradead.org
Quoted 3 lines

Makes perfect sense. I have only tested the driver from regular userspace using ioctl()s. Is these a simple way to test an alarmtimer on a barebones system?

The easiest way is to try to read CLOCK_REALTIME_ALARM which will only function if there's a backing rtc.

I've got some further timekeeping tests here that will test timers etc on the _ALARM clockids:
https://github.com/johnstultz-work/timetests

Quoted 3 lines

Are you sure this should not be for -rc:s and stable?

Its not a regression (never worked before), so I don't think so, unless someone finds the functionality critical for long-term kernels.

thanks
-john