Commit 0734e27f authored by Chris Brand's avatar Chris Brand Committed by Linus Torvalds

drivers/rtc/interface.c: return -EBUSY, not -EACCES when device is busy

If rtc->irq_task is non-NULL and task is NULL, they always
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.
Signed-off-by: default avatarChris Brand <chris.brand@broadcom.com>
Acked-by: default avatarAlessandro Zummo <a.zummo@towertech.it>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5ee67484
...@@ -698,9 +698,9 @@ int rtc_irq_set_state(struct rtc_device *rtc, struct rtc_task *task, int enabled ...@@ -698,9 +698,9 @@ int rtc_irq_set_state(struct rtc_device *rtc, struct rtc_task *task, int enabled
spin_lock_irqsave(&rtc->irq_task_lock, flags); spin_lock_irqsave(&rtc->irq_task_lock, flags);
if (rtc->irq_task != NULL && task == NULL) if (rtc->irq_task != NULL && task == NULL)
err = -EBUSY; err = -EBUSY;
if (rtc->irq_task != task) else if (rtc->irq_task != task)
err = -EACCES; err = -EACCES;
if (!err) { else {
if (rtc_update_hrtimer(rtc, enabled) < 0) { if (rtc_update_hrtimer(rtc, enabled) < 0) {
spin_unlock_irqrestore(&rtc->irq_task_lock, flags); spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
cpu_relax(); cpu_relax();
...@@ -734,9 +734,9 @@ int rtc_irq_set_freq(struct rtc_device *rtc, struct rtc_task *task, int freq) ...@@ -734,9 +734,9 @@ int rtc_irq_set_freq(struct rtc_device *rtc, struct rtc_task *task, int freq)
spin_lock_irqsave(&rtc->irq_task_lock, flags); spin_lock_irqsave(&rtc->irq_task_lock, flags);
if (rtc->irq_task != NULL && task == NULL) if (rtc->irq_task != NULL && task == NULL)
err = -EBUSY; err = -EBUSY;
if (rtc->irq_task != task) else if (rtc->irq_task != task)
err = -EACCES; err = -EACCES;
if (!err) { else {
rtc->irq_freq = freq; rtc->irq_freq = freq;
if (rtc->pie_enabled && rtc_update_hrtimer(rtc, 1) < 0) { if (rtc->pie_enabled && rtc_update_hrtimer(rtc, 1) < 0) {
spin_unlock_irqrestore(&rtc->irq_task_lock, flags); spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment