Skip to contentSkip to conversation

Re-send of patch to broader audience

PATCH New [email protected] 2 participants 3 messages Jun 6, 2013 Real time clock (RTC)

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 RTC: Return -EBUSY, not -EACCES when device is busy

From: Chris Brand <[email protected]>

If rtc->irq_task is non-NULL and task is NULL, they always differ, which means that in rtc_irq_set_state() and rtc_irq_set_freq(), whenever err is set to -EBUSY it will then immediately be set to -EACCES, misleading the caller as to the underlying problem.

---
 drivers/rtc/interface.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/rtc/interface.c +4 -4
index 42bd57d..40d4032 100644
@@ -698,9 +698,9 @@ retry:
 	spin_lock_irqsave(&rtc->irq_task_lock, flags);
 	if (rtc->irq_task != NULL && task == NULL)
 		err = -EBUSY;
-	if (rtc->irq_task != task)
+	else if (rtc->irq_task != task)
 		err = -EACCES;
-	if (!err) {
+	else {
 		if (rtc_update_hrtimer(rtc, enabled) < 0) {
 			spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
 			cpu_relax();
@@ -734,9 +734,9 @@ retry:
 	spin_lock_irqsave(&rtc->irq_task_lock, flags);
 	if (rtc->irq_task != NULL && task == NULL)
 		err = -EBUSY;
-	if (rtc->irq_task != task)
+	else if (rtc->irq_task != task)
 		err = -EACCES;
-	if (!err) {
+	else {
 		rtc->irq_freq = freq;
 		if (rtc->pie_enabled && rtc_update_hrtimer(rtc, 1) < 0) {
 			spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
Signature · 1 line
1.7.5.4
#2 lore raw
In reply to [email protected]
Quoted 3 lines · On Thu, 6 Jun 2013 10:46:08 -0700 [email protected] wrote:

I originally sent this patch 4 Apr [1] and 17 Apr [2] to the rtc mailing list and maintainer, but saw no responses. I think it's pretty clear that the original code is wrong.

Hi, your patch seems reasonable to me.

Signature · 6 lines
 Best regards,

 Alessandro Zummo,
  Tower Technologies - Torino, Italy

  http://www.towertech.it