Commit 3f6a2676 authored by Russell King's avatar Russell King

[ARM] Sparse fixes

Clean up sparse warnings in rtctime.c and netwinder-hw.c
parent 1514a193
...@@ -179,7 +179,7 @@ EXPORT_SYMBOL(rtc_update); ...@@ -179,7 +179,7 @@ EXPORT_SYMBOL(rtc_update);
static ssize_t static ssize_t
rtc_read(struct file *file, char *buf, size_t count, loff_t *ppos) rtc_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
{ {
DECLARE_WAITQUEUE(wait, current); DECLARE_WAITQUEUE(wait, current);
unsigned long data; unsigned long data;
...@@ -215,7 +215,7 @@ rtc_read(struct file *file, char *buf, size_t count, loff_t *ppos) ...@@ -215,7 +215,7 @@ rtc_read(struct file *file, char *buf, size_t count, loff_t *ppos)
remove_wait_queue(&rtc_wait, &wait); remove_wait_queue(&rtc_wait, &wait);
if (ret == 0) { if (ret == 0) {
ret = put_user(data, (unsigned long *)buf); ret = put_user(data, (unsigned long __user *)buf);
if (ret == 0) if (ret == 0)
ret = sizeof(unsigned long); ret = sizeof(unsigned long);
} }
...@@ -241,6 +241,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -241,6 +241,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
struct rtc_ops *ops = file->private_data; struct rtc_ops *ops = file->private_data;
struct rtc_time tm; struct rtc_time tm;
struct rtc_wkalrm alrm; struct rtc_wkalrm alrm;
void __user *uarg = (void __user *)arg;
int ret = -EINVAL; int ret = -EINVAL;
switch (cmd) { switch (cmd) {
...@@ -248,13 +249,13 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -248,13 +249,13 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
ret = rtc_read_alarm(ops, &alrm); ret = rtc_read_alarm(ops, &alrm);
if (ret) if (ret)
break; break;
ret = copy_to_user((void *)arg, &alrm.time, sizeof(tm)); ret = copy_to_user(uarg, &alrm.time, sizeof(tm));
if (ret) if (ret)
ret = -EFAULT; ret = -EFAULT;
break; break;
case RTC_ALM_SET: case RTC_ALM_SET:
ret = copy_from_user(&alrm.time, (void *)arg, sizeof(tm)); ret = copy_from_user(&alrm.time, uarg, sizeof(tm));
if (ret) { if (ret) {
ret = -EFAULT; ret = -EFAULT;
break; break;
...@@ -272,7 +273,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -272,7 +273,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
case RTC_RD_TIME: case RTC_RD_TIME:
rtc_read_time(ops, &tm); rtc_read_time(ops, &tm);
ret = copy_to_user((void *)arg, &tm, sizeof(tm)); ret = copy_to_user(uarg, &tm, sizeof(tm));
if (ret) if (ret)
ret = -EFAULT; ret = -EFAULT;
break; break;
...@@ -282,12 +283,13 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -282,12 +283,13 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
ret = -EACCES; ret = -EACCES;
break; break;
} }
ret = copy_from_user(&tm, (void *)arg, sizeof(tm)); ret = copy_from_user(&tm, uarg, sizeof(tm));
if (ret == 0) if (ret) {
ret = rtc_set_time(ops, &tm);
else
ret = -EFAULT; ret = -EFAULT;
break; break;
}
ret = rtc_set_time(ops, &tm);
break;
case RTC_EPOCH_SET: case RTC_EPOCH_SET:
#ifndef rtc_epoch #ifndef rtc_epoch
...@@ -308,11 +310,11 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -308,11 +310,11 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
break; break;
case RTC_EPOCH_READ: case RTC_EPOCH_READ:
ret = put_user(rtc_epoch, (unsigned long *)arg); ret = put_user(rtc_epoch, (unsigned long __user *)uarg);
break; break;
case RTC_WKALM_SET: case RTC_WKALM_SET:
ret = copy_from_user(&alrm, (void *)arg, sizeof(alrm)); ret = copy_from_user(&alrm, uarg, sizeof(alrm));
if (ret) { if (ret) {
ret = -EFAULT; ret = -EFAULT;
break; break;
...@@ -324,7 +326,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -324,7 +326,7 @@ static int rtc_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
ret = rtc_read_alarm(ops, &alrm); ret = rtc_read_alarm(ops, &alrm);
if (ret) if (ret)
break; break;
ret = copy_to_user((void *)arg, &alrm, sizeof(alrm)); ret = copy_to_user(uarg, &alrm, sizeof(alrm));
if (ret) if (ret)
ret = -EFAULT; ret = -EFAULT;
break; break;
...@@ -478,7 +480,7 @@ int register_rtc(struct rtc_ops *ops) ...@@ -478,7 +480,7 @@ int register_rtc(struct rtc_ops *ops)
ret = misc_register(&rtc_miscdev); ret = misc_register(&rtc_miscdev);
if (ret == 0) if (ret == 0)
create_proc_read_entry("driver/rtc", 0, 0, create_proc_read_entry("driver/rtc", 0, NULL,
rtc_read_proc, ops); rtc_read_proc, ops);
} }
up(&rtc_sem); up(&rtc_sem);
......
...@@ -58,7 +58,7 @@ static inline void wb977_ww(int reg, int val) ...@@ -58,7 +58,7 @@ static inline void wb977_ww(int reg, int val)
outb(reg, 0x370); outb(reg, 0x370);
outb(val >> 8, 0x371); outb(val >> 8, 0x371);
outb(reg + 1, 0x370); outb(reg + 1, 0x370);
outb(val, 0x371); outb(val & 255, 0x371);
} }
#define wb977_device_select(dev) wb977_wb(0x07, dev) #define wb977_device_select(dev) wb977_wb(0x07, dev)
...@@ -488,7 +488,7 @@ static inline void rwa010_waveartist_init(int base, int irq, int dma) ...@@ -488,7 +488,7 @@ static inline void rwa010_waveartist_init(int base, int irq, int dma)
WRITE_RWA(7, 0); WRITE_RWA(7, 0);
dprintk("WaveArtist base: "); dprintk("WaveArtist base: ");
WRITE_RWA(0x61, base); WRITE_RWA(0x61, base & 255);
i = inb(0x203); i = inb(0x203);
WRITE_RWA(0x60, base >> 8); WRITE_RWA(0x60, base >> 8);
...@@ -510,7 +510,7 @@ static inline void rwa010_soundblaster_init(int sb_base, int al_base, int irq, i ...@@ -510,7 +510,7 @@ static inline void rwa010_soundblaster_init(int sb_base, int al_base, int irq, i
WRITE_RWA(7, 1); WRITE_RWA(7, 1);
dprintk("SoundBlaster base: "); dprintk("SoundBlaster base: ");
WRITE_RWA(0x61, sb_base); WRITE_RWA(0x61, sb_base & 255);
i = inb(0x203); i = inb(0x203);
WRITE_RWA(0x60, sb_base >> 8); WRITE_RWA(0x60, sb_base >> 8);
...@@ -525,7 +525,7 @@ static inline void rwa010_soundblaster_init(int sb_base, int al_base, int irq, i ...@@ -525,7 +525,7 @@ static inline void rwa010_soundblaster_init(int sb_base, int al_base, int irq, i
dprintk("%d (%d)\n", inb(0x203), dma); dprintk("%d (%d)\n", inb(0x203), dma);
dprintk("AdLib base: "); dprintk("AdLib base: ");
WRITE_RWA(0x63, al_base); WRITE_RWA(0x63, al_base & 255);
i = inb(0x203); i = inb(0x203);
WRITE_RWA(0x62, al_base >> 8); WRITE_RWA(0x62, al_base >> 8);
......
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