diff options
| author | Jeff Garzik <jeff@garzik.org> | 2006-05-15 11:26:03 -0400 |
|---|---|---|
| committer | Jeff Garzik <jeff@garzik.org> | 2006-05-15 11:26:03 -0400 |
| commit | 5006ecc2d5073d4e52f54381fd0fee1575d4ce22 (patch) | |
| tree | bedfff6f96118771b809de30e559cc370f94c7be /drivers/rtc/rtc-dev.c | |
| parent | acc696d93dcf993dec123d69d599979e1456ffec (diff) | |
| parent | 9be2f7c38e0bd64e8a0f74ea68df1e73e2ddfcc3 (diff) | |
Merge branch 'master' into upstream
Diffstat (limited to 'drivers/rtc/rtc-dev.c')
| -rw-r--r-- | drivers/rtc/rtc-dev.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index b1e3e6179e56..6c9ad92747fd 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c | |||
| @@ -58,7 +58,7 @@ rtc_dev_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | |||
| 58 | unsigned long data; | 58 | unsigned long data; |
| 59 | ssize_t ret; | 59 | ssize_t ret; |
| 60 | 60 | ||
| 61 | if (count < sizeof(unsigned long)) | 61 | if (count != sizeof(unsigned int) && count < sizeof(unsigned long)) |
| 62 | return -EINVAL; | 62 | return -EINVAL; |
| 63 | 63 | ||
| 64 | add_wait_queue(&rtc->irq_queue, &wait); | 64 | add_wait_queue(&rtc->irq_queue, &wait); |
| @@ -90,11 +90,16 @@ rtc_dev_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) | |||
| 90 | if (ret == 0) { | 90 | if (ret == 0) { |
| 91 | /* Check for any data updates */ | 91 | /* Check for any data updates */ |
| 92 | if (rtc->ops->read_callback) | 92 | if (rtc->ops->read_callback) |
| 93 | data = rtc->ops->read_callback(rtc->class_dev.dev, data); | 93 | data = rtc->ops->read_callback(rtc->class_dev.dev, |
| 94 | 94 | data); | |
| 95 | ret = put_user(data, (unsigned long __user *)buf); | 95 | |
| 96 | if (ret == 0) | 96 | if (sizeof(int) != sizeof(long) && |
| 97 | ret = sizeof(unsigned long); | 97 | count == sizeof(unsigned int)) |
| 98 | ret = put_user(data, (unsigned int __user *)buf) ?: | ||
| 99 | sizeof(unsigned int); | ||
| 100 | else | ||
| 101 | ret = put_user(data, (unsigned long __user *)buf) ?: | ||
| 102 | sizeof(unsigned long); | ||
| 98 | } | 103 | } |
| 99 | return ret; | 104 | return ret; |
| 100 | } | 105 | } |
