Skip to content

Commit

Permalink
rtc: cdev lock_kernel() pushdown
Browse files Browse the repository at this point in the history
Signed-off-by: Jonathan Corbet <[email protected]>
  • Loading branch information
Jonathan Corbet committed Jun 20, 2008
1 parent 0bec0bb commit 51a776f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions drivers/rtc/rtc-dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <linux/module.h>
#include <linux/rtc.h>
#include <linux/smp_lock.h>
#include "rtc-core.h"

static dev_t rtc_devt;
Expand All @@ -26,8 +27,11 @@ static int rtc_dev_open(struct inode *inode, struct file *file)
struct rtc_device, char_dev);
const struct rtc_class_ops *ops = rtc->ops;

if (test_and_set_bit_lock(RTC_DEV_BUSY, &rtc->flags))
return -EBUSY;
lock_kernel();
if (test_and_set_bit_lock(RTC_DEV_BUSY, &rtc->flags)) {
err = -EBUSY;
goto out;
}

file->private_data = rtc;

Expand All @@ -37,11 +41,13 @@ static int rtc_dev_open(struct inode *inode, struct file *file)
rtc->irq_data = 0;
spin_unlock_irq(&rtc->irq_lock);

return 0;
goto out;
}

/* something has gone wrong */
clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags);
out:
unlock_kernel();
return err;
}

Expand Down

0 comments on commit 51a776f

Please sign in to comment.