Commit 4ab06c9a authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://bk.arm.linux.org.uk/linux-2.6-rmk

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents c25c7712 392bfb26
...@@ -7,12 +7,13 @@ ...@@ -7,12 +7,13 @@
* Copy data from IO memory space to "real" memory space. * Copy data from IO memory space to "real" memory space.
* This needs to be optimized. * This needs to be optimized.
*/ */
void _memcpy_fromio(void * to, unsigned long from, size_t count) void _memcpy_fromio(void *to, unsigned long from, size_t count)
{ {
unsigned char *t = to;
while (count) { while (count) {
count--; count--;
*(char *) to = readb(from); *t = readb(from);
((char *) to)++; t++;
from++; from++;
} }
} }
...@@ -21,12 +22,13 @@ void _memcpy_fromio(void * to, unsigned long from, size_t count) ...@@ -21,12 +22,13 @@ void _memcpy_fromio(void * to, unsigned long from, size_t count)
* Copy data from "real" memory space to IO memory space. * Copy data from "real" memory space to IO memory space.
* This needs to be optimized. * This needs to be optimized.
*/ */
void _memcpy_toio(unsigned long to, const void * from, size_t count) void _memcpy_toio(unsigned long to, const void *from, size_t count)
{ {
const unsigned char *f = from;
while (count) { while (count) {
count--; count--;
writeb(*(char *) from, to); writeb(*f, to);
((char *) from)++; f++;
to++; to++;
} }
} }
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
* stack+task struct. Use the same method as 'current' uses to * stack+task struct. Use the same method as 'current' uses to
* reach them. * reach them.
*/ */
register unsigned int *user_registers asm("sl"); register unsigned long *user_registers asm("sl");
#define GET_USERREG() (user_registers) #define GET_USERREG() (user_registers)
......
...@@ -29,14 +29,14 @@ ...@@ -29,14 +29,14 @@
#include <asm/uaccess.h> #include <asm/uaccess.h>
static inline void loadSingle(const unsigned int Fn, const unsigned int *pMem) static inline void loadSingle(const unsigned int Fn, const unsigned int __user *pMem)
{ {
FPA11 *fpa11 = GET_FPA11(); FPA11 *fpa11 = GET_FPA11();
fpa11->fType[Fn] = typeSingle; fpa11->fType[Fn] = typeSingle;
get_user(fpa11->fpreg[Fn].fSingle, pMem); get_user(fpa11->fpreg[Fn].fSingle, pMem);
} }
static inline void loadDouble(const unsigned int Fn, const unsigned int *pMem) static inline void loadDouble(const unsigned int Fn, const unsigned int __user *pMem)
{ {
FPA11 *fpa11 = GET_FPA11(); FPA11 *fpa11 = GET_FPA11();
unsigned int *p; unsigned int *p;
...@@ -47,7 +47,7 @@ static inline void loadDouble(const unsigned int Fn, const unsigned int *pMem) ...@@ -47,7 +47,7 @@ static inline void loadDouble(const unsigned int Fn, const unsigned int *pMem)
} }
#ifdef CONFIG_FPE_NWFPE_XP #ifdef CONFIG_FPE_NWFPE_XP
static inline void loadExtended(const unsigned int Fn, const unsigned int *pMem) static inline void loadExtended(const unsigned int Fn, const unsigned int __user *pMem)
{ {
FPA11 *fpa11 = GET_FPA11(); FPA11 *fpa11 = GET_FPA11();
unsigned int *p; unsigned int *p;
...@@ -59,7 +59,7 @@ static inline void loadExtended(const unsigned int Fn, const unsigned int *pMem) ...@@ -59,7 +59,7 @@ static inline void loadExtended(const unsigned int Fn, const unsigned int *pMem)
} }
#endif #endif
static inline void loadMultiple(const unsigned int Fn, const unsigned int *pMem) static inline void loadMultiple(const unsigned int Fn, const unsigned int __user *pMem)
{ {
FPA11 *fpa11 = GET_FPA11(); FPA11 *fpa11 = GET_FPA11();
register unsigned int *p; register unsigned int *p;
...@@ -91,7 +91,7 @@ static inline void loadMultiple(const unsigned int Fn, const unsigned int *pMem) ...@@ -91,7 +91,7 @@ static inline void loadMultiple(const unsigned int Fn, const unsigned int *pMem)
} }
} }
static inline void storeSingle(const unsigned int Fn, unsigned int *pMem) static inline void storeSingle(const unsigned int Fn, unsigned int __user *pMem)
{ {
FPA11 *fpa11 = GET_FPA11(); FPA11 *fpa11 = GET_FPA11();
union { union {
...@@ -117,7 +117,7 @@ static inline void storeSingle(const unsigned int Fn, unsigned int *pMem) ...@@ -117,7 +117,7 @@ static inline void storeSingle(const unsigned int Fn, unsigned int *pMem)
put_user(val.i[0], pMem); put_user(val.i[0], pMem);
} }
static inline void storeDouble(const unsigned int Fn, unsigned int *pMem) static inline void storeDouble(const unsigned int Fn, unsigned int __user *pMem)
{ {
FPA11 *fpa11 = GET_FPA11(); FPA11 *fpa11 = GET_FPA11();
union { union {
...@@ -145,7 +145,7 @@ static inline void storeDouble(const unsigned int Fn, unsigned int *pMem) ...@@ -145,7 +145,7 @@ static inline void storeDouble(const unsigned int Fn, unsigned int *pMem)
} }
#ifdef CONFIG_FPE_NWFPE_XP #ifdef CONFIG_FPE_NWFPE_XP
static inline void storeExtended(const unsigned int Fn, unsigned int *pMem) static inline void storeExtended(const unsigned int Fn, unsigned int __user *pMem)
{ {
FPA11 *fpa11 = GET_FPA11(); FPA11 *fpa11 = GET_FPA11();
union { union {
...@@ -172,7 +172,7 @@ static inline void storeExtended(const unsigned int Fn, unsigned int *pMem) ...@@ -172,7 +172,7 @@ static inline void storeExtended(const unsigned int Fn, unsigned int *pMem)
} }
#endif #endif
static inline void storeMultiple(const unsigned int Fn, unsigned int *pMem) static inline void storeMultiple(const unsigned int Fn, unsigned int __user *pMem)
{ {
FPA11 *fpa11 = GET_FPA11(); FPA11 *fpa11 = GET_FPA11();
register unsigned int nType, *p; register unsigned int nType, *p;
...@@ -204,10 +204,10 @@ static inline void storeMultiple(const unsigned int Fn, unsigned int *pMem) ...@@ -204,10 +204,10 @@ static inline void storeMultiple(const unsigned int Fn, unsigned int *pMem)
unsigned int PerformLDF(const unsigned int opcode) unsigned int PerformLDF(const unsigned int opcode)
{ {
unsigned int *pBase, *pAddress, *pFinal, nRc = 1, unsigned int __user *pBase, *pAddress, *pFinal;
write_back = WRITE_BACK(opcode); unsigned int nRc = 1, write_back = WRITE_BACK(opcode);
pBase = (unsigned int *) readRegister(getRn(opcode)); pBase = (unsigned int __user *) readRegister(getRn(opcode));
if (REG_PC == getRn(opcode)) { if (REG_PC == getRn(opcode)) {
pBase += 2; pBase += 2;
write_back = 0; write_back = 0;
...@@ -241,18 +241,18 @@ unsigned int PerformLDF(const unsigned int opcode) ...@@ -241,18 +241,18 @@ unsigned int PerformLDF(const unsigned int opcode)
} }
if (write_back) if (write_back)
writeRegister(getRn(opcode), (unsigned int) pFinal); writeRegister(getRn(opcode), (unsigned long) pFinal);
return nRc; return nRc;
} }
unsigned int PerformSTF(const unsigned int opcode) unsigned int PerformSTF(const unsigned int opcode)
{ {
unsigned int *pBase, *pAddress, *pFinal, nRc = 1, unsigned int __user *pBase, *pAddress, *pFinal;
write_back = WRITE_BACK(opcode); unsigned int nRc = 1, write_back = WRITE_BACK(opcode);
SetRoundingMode(ROUND_TO_NEAREST); SetRoundingMode(ROUND_TO_NEAREST);
pBase = (unsigned int *) readRegister(getRn(opcode)); pBase = (unsigned int __user *) readRegister(getRn(opcode));
if (REG_PC == getRn(opcode)) { if (REG_PC == getRn(opcode)) {
pBase += 2; pBase += 2;
write_back = 0; write_back = 0;
...@@ -286,16 +286,16 @@ unsigned int PerformSTF(const unsigned int opcode) ...@@ -286,16 +286,16 @@ unsigned int PerformSTF(const unsigned int opcode)
} }
if (write_back) if (write_back)
writeRegister(getRn(opcode), (unsigned int) pFinal); writeRegister(getRn(opcode), (unsigned long) pFinal);
return nRc; return nRc;
} }
unsigned int PerformLFM(const unsigned int opcode) unsigned int PerformLFM(const unsigned int opcode)
{ {
unsigned int i, Fd, *pBase, *pAddress, *pFinal, unsigned int __user *pBase, *pAddress, *pFinal;
write_back = WRITE_BACK(opcode); unsigned int i, Fd, write_back = WRITE_BACK(opcode);
pBase = (unsigned int *) readRegister(getRn(opcode)); pBase = (unsigned int __user *) readRegister(getRn(opcode));
if (REG_PC == getRn(opcode)) { if (REG_PC == getRn(opcode)) {
pBase += 2; pBase += 2;
write_back = 0; write_back = 0;
...@@ -322,16 +322,16 @@ unsigned int PerformLFM(const unsigned int opcode) ...@@ -322,16 +322,16 @@ unsigned int PerformLFM(const unsigned int opcode)
} }
if (write_back) if (write_back)
writeRegister(getRn(opcode), (unsigned int) pFinal); writeRegister(getRn(opcode), (unsigned long) pFinal);
return 1; return 1;
} }
unsigned int PerformSFM(const unsigned int opcode) unsigned int PerformSFM(const unsigned int opcode)
{ {
unsigned int i, Fd, *pBase, *pAddress, *pFinal, unsigned int __user *pBase, *pAddress, *pFinal;
write_back = WRITE_BACK(opcode); unsigned int i, Fd, write_back = WRITE_BACK(opcode);
pBase = (unsigned int *) readRegister(getRn(opcode)); pBase = (unsigned int __user *) readRegister(getRn(opcode));
if (REG_PC == getRn(opcode)) { if (REG_PC == getRn(opcode)) {
pBase += 2; pBase += 2;
write_back = 0; write_back = 0;
...@@ -358,7 +358,7 @@ unsigned int PerformSFM(const unsigned int opcode) ...@@ -358,7 +358,7 @@ unsigned int PerformSFM(const unsigned int opcode)
} }
if (write_back) if (write_back)
writeRegister(getRn(opcode), (unsigned int) pFinal); writeRegister(getRn(opcode), (unsigned long) pFinal);
return 1; return 1;
} }
......
...@@ -131,7 +131,7 @@ void float_raise(signed char flags) ...@@ -131,7 +131,7 @@ void float_raise(signed char flags)
#ifdef CONFIG_DEBUG_USER #ifdef CONFIG_DEBUG_USER
printk(KERN_DEBUG printk(KERN_DEBUG
"NWFPE: %s[%d] takes exception %08x at %p from %08x\n", "NWFPE: %s[%d] takes exception %08x at %p from %08lx\n",
current->comm, current->pid, flags, current->comm, current->pid, flags,
__builtin_return_address(0), GET_USERREG()[15]); __builtin_return_address(0), GET_USERREG()[15]);
#endif #endif
......
...@@ -19,8 +19,7 @@ ...@@ -19,8 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
extern __inline__ static inline unsigned long readRegister(const unsigned int nReg)
unsigned int readRegister(const unsigned int nReg)
{ {
/* Note: The CPU thinks it has dealt with the current instruction. /* Note: The CPU thinks it has dealt with the current instruction.
As a result the program counter has been advanced to the next As a result the program counter has been advanced to the next
...@@ -29,34 +28,31 @@ unsigned int readRegister(const unsigned int nReg) ...@@ -29,34 +28,31 @@ unsigned int readRegister(const unsigned int nReg)
for this in this routine. LDF/STF instructions with Rn = PC for this in this routine. LDF/STF instructions with Rn = PC
depend on the PC being correct, as they use PC+8 in their depend on the PC being correct, as they use PC+8 in their
address calculations. */ address calculations. */
unsigned int *userRegisters = GET_USERREG(); unsigned long *userRegisters = GET_USERREG();
unsigned int val = userRegisters[nReg]; unsigned int val = userRegisters[nReg];
if (REG_PC == nReg) if (REG_PC == nReg)
val -= 4; val -= 4;
return val; return val;
} }
extern __inline__ static inline void
void writeRegister(const unsigned int nReg, const unsigned int val) writeRegister(const unsigned int nReg, const unsigned long val)
{ {
unsigned int *userRegisters = GET_USERREG(); unsigned long *userRegisters = GET_USERREG();
userRegisters[nReg] = val; userRegisters[nReg] = val;
} }
extern __inline__ static inline unsigned long readCPSR(void)
unsigned int readCPSR(void)
{ {
return (readRegister(REG_CPSR)); return (readRegister(REG_CPSR));
} }
extern __inline__ static inline void writeCPSR(const unsigned long val)
void writeCPSR(const unsigned int val)
{ {
writeRegister(REG_CPSR, val); writeRegister(REG_CPSR, val);
} }
extern __inline__ static inline unsigned long readConditionCodes(void)
unsigned int readConditionCodes(void)
{ {
#ifdef __FPEM_TEST__ #ifdef __FPEM_TEST__
return (0); return (0);
...@@ -65,11 +61,10 @@ unsigned int readConditionCodes(void) ...@@ -65,11 +61,10 @@ unsigned int readConditionCodes(void)
#endif #endif
} }
extern __inline__ static inline void writeConditionCodes(const unsigned long val)
void writeConditionCodes(const unsigned int val)
{ {
unsigned int *userRegisters = GET_USERREG(); unsigned long *userRegisters = GET_USERREG();
unsigned int rval; unsigned long rval;
/* /*
* Operate directly on userRegisters since * Operate directly on userRegisters since
* the CPSR may be the PC register itself. * the CPSR may be the PC register itself.
...@@ -77,9 +72,3 @@ void writeConditionCodes(const unsigned int val) ...@@ -77,9 +72,3 @@ void writeConditionCodes(const unsigned int val)
rval = userRegisters[REG_CPSR] & ~CC_MASK; rval = userRegisters[REG_CPSR] & ~CC_MASK;
userRegisters[REG_CPSR] = rval | (val & CC_MASK); userRegisters[REG_CPSR] = rval | (val & CC_MASK);
} }
extern __inline__
unsigned int readMemoryInt(unsigned int *pMem)
{
return *pMem;
}
...@@ -213,7 +213,7 @@ static void ds1620_read_state(struct therm *therm) ...@@ -213,7 +213,7 @@ static void ds1620_read_state(struct therm *therm)
} }
static ssize_t static ssize_t
ds1620_read(struct file *file, char *buf, size_t count, loff_t *ptr) ds1620_read(struct file *file, char __user *buf, size_t count, loff_t *ptr)
{ {
signed int cur_temp; signed int cur_temp;
signed char cur_temp_degF; signed char cur_temp_degF;
...@@ -233,8 +233,14 @@ static int ...@@ -233,8 +233,14 @@ static int
ds1620_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) ds1620_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{ {
struct therm therm; struct therm therm;
union {
struct therm __user *therm;
int __user *i;
} uarg;
int i; int i;
uarg.i = (int __user *)arg;
switch(cmd) { switch(cmd) {
case CMD_SET_THERMOSTATE: case CMD_SET_THERMOSTATE:
case CMD_SET_THERMOSTATE2: case CMD_SET_THERMOSTATE2:
...@@ -242,11 +248,11 @@ ds1620_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned ...@@ -242,11 +248,11 @@ ds1620_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned
return -EPERM; return -EPERM;
if (cmd == CMD_SET_THERMOSTATE) { if (cmd == CMD_SET_THERMOSTATE) {
if (get_user(therm.hi, (int *)arg)) if (get_user(therm.hi, uarg.i))
return -EFAULT; return -EFAULT;
therm.lo = therm.hi - 3; therm.lo = therm.hi - 3;
} else { } else {
if (copy_from_user(&therm, (void *)arg, sizeof(therm))) if (copy_from_user(&therm, uarg.therm, sizeof(therm)))
return -EFAULT; return -EFAULT;
} }
...@@ -264,10 +270,10 @@ ds1620_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned ...@@ -264,10 +270,10 @@ ds1620_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned
therm.hi >>= 1; therm.hi >>= 1;
if (cmd == CMD_GET_THERMOSTATE) { if (cmd == CMD_GET_THERMOSTATE) {
if (put_user(therm.hi, (int *)arg)) if (put_user(therm.hi, uarg.i))
return -EFAULT; return -EFAULT;
} else { } else {
if (copy_to_user((void *)arg, &therm, sizeof(therm))) if (copy_to_user(uarg.therm, &therm, sizeof(therm)))
return -EFAULT; return -EFAULT;
} }
break; break;
...@@ -279,23 +285,23 @@ ds1620_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned ...@@ -279,23 +285,23 @@ ds1620_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned
if (cmd == CMD_GET_TEMPERATURE) if (cmd == CMD_GET_TEMPERATURE)
i >>= 1; i >>= 1;
return put_user(i, (int *)arg) ? -EFAULT : 0; return put_user(i, uarg.i) ? -EFAULT : 0;
case CMD_GET_STATUS: case CMD_GET_STATUS:
i = ds1620_in(THERM_READ_CONFIG, 8) & 0xe3; i = ds1620_in(THERM_READ_CONFIG, 8) & 0xe3;
return put_user(i, (int *)arg) ? -EFAULT : 0; return put_user(i, uarg.i) ? -EFAULT : 0;
case CMD_GET_FAN: case CMD_GET_FAN:
i = netwinder_get_fan(); i = netwinder_get_fan();
return put_user(i, (int *)arg) ? -EFAULT : 0; return put_user(i, uarg.i) ? -EFAULT : 0;
case CMD_SET_FAN: case CMD_SET_FAN:
if (!capable(CAP_SYS_ADMIN)) if (!capable(CAP_SYS_ADMIN))
return -EPERM; return -EPERM;
if (get_user(i, (int *)arg)) if (get_user(i, uarg.i))
return -EFAULT; return -EFAULT;
netwinder_set_fan(i); netwinder_set_fan(i);
...@@ -377,7 +383,7 @@ static int __init ds1620_init(void) ...@@ -377,7 +383,7 @@ static int __init ds1620_init(void)
return ret; return ret;
#ifdef THERM_USE_PROC #ifdef THERM_USE_PROC
proc_therm_ds1620 = create_proc_entry("therm", 0, 0); proc_therm_ds1620 = create_proc_entry("therm", 0, NULL);
if (proc_therm_ds1620) if (proc_therm_ds1620)
proc_therm_ds1620->read_proc = proc_therm_ds1620_read; proc_therm_ds1620->read_proc = proc_therm_ds1620_read;
else else
......
...@@ -170,7 +170,7 @@ static irqreturn_t button_handler (int irq, void *dev_id, struct pt_regs *regs) ...@@ -170,7 +170,7 @@ static irqreturn_t button_handler (int irq, void *dev_id, struct pt_regs *regs)
* device at any one time. * device at any one time.
*/ */
static int button_read (struct file *filp, char *buffer, static int button_read (struct file *filp, char __user *buffer,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
interruptible_sleep_on (&button_wait_queue); interruptible_sleep_on (&button_wait_queue);
......
...@@ -26,8 +26,6 @@ struct button_callback { ...@@ -26,8 +26,6 @@ struct button_callback {
static void button_sequence_finished (unsigned long parameters); static void button_sequence_finished (unsigned long parameters);
static irqreturn_t button_handler (int irq, void *dev_id, struct pt_regs *regs); static irqreturn_t button_handler (int irq, void *dev_id, struct pt_regs *regs);
static int button_read (struct file *filp, char *buffer,
size_t count, loff_t *ppos);
int button_init (void); int button_init (void);
int button_add_callback (void (*callback) (void), int count); int button_add_callback (void (*callback) (void), int count);
int button_del_callback (void (*callback) (void)); int button_del_callback (void (*callback) (void));
......
...@@ -43,11 +43,7 @@ ...@@ -43,11 +43,7 @@
static void kick_open(void); static void kick_open(void);
static int get_flash_id(void); static int get_flash_id(void);
static int erase_block(int nBlock); static int erase_block(int nBlock);
static int write_block(unsigned long p, const char *buf, int count); static int write_block(unsigned long p, const char __user *buf, int count);
static int flash_ioctl(struct inode *inodep, struct file *filep, unsigned int cmd, unsigned long arg);
static ssize_t flash_read(struct file *file, char *buf, size_t count, loff_t * ppos);
static ssize_t flash_write(struct file *file, const char *buf, size_t count, loff_t * ppos);
static loff_t flash_llseek(struct file *file, loff_t offset, int orig);
#define KFLASH_SIZE 1024*1024 //1 Meg #define KFLASH_SIZE 1024*1024 //1 Meg
#define KFLASH_SIZE4 4*1024*1024 //4 Meg #define KFLASH_SIZE4 4*1024*1024 //4 Meg
...@@ -132,15 +128,16 @@ static int flash_ioctl(struct inode *inodep, struct file *filep, unsigned int cm ...@@ -132,15 +128,16 @@ static int flash_ioctl(struct inode *inodep, struct file *filep, unsigned int cm
return 0; return 0;
} }
static ssize_t flash_read(struct file *file, char *buf, size_t size, loff_t * ppos) static ssize_t flash_read(struct file *file, char __user *buf, size_t size,
loff_t *ppos)
{ {
unsigned long p = *ppos; unsigned long p = *ppos;
unsigned int count = size; unsigned int count = size;
int ret = 0; int ret = 0;
if (flashdebug) if (flashdebug)
printk(KERN_DEBUG "flash_read: flash_read: offset=0x%lX, buffer=%p, count=0x%X.\n", printk(KERN_DEBUG "flash_read: flash_read: offset=0x%lX, "
p, buf, count); "buffer=%p, count=0x%X.\n", p, buf, count);
if (count) if (count)
ret = -ENXIO; ret = -ENXIO;
...@@ -166,7 +163,8 @@ static ssize_t flash_read(struct file *file, char *buf, size_t size, loff_t * pp ...@@ -166,7 +163,8 @@ static ssize_t flash_read(struct file *file, char *buf, size_t size, loff_t * pp
return ret; return ret;
} }
static ssize_t flash_write(struct file *file, const char *buf, size_t size, loff_t * ppos) static ssize_t flash_write(struct file *file, const char __user *buf,
size_t size, loff_t * ppos)
{ {
unsigned long p = *ppos; unsigned long p = *ppos;
unsigned int count = size; unsigned int count = size;
...@@ -244,8 +242,9 @@ static ssize_t flash_write(struct file *file, const char *buf, size_t size, loff ...@@ -244,8 +242,9 @@ static ssize_t flash_write(struct file *file, const char *buf, size_t size, loff
break; break;
} }
if (flashdebug) if (flashdebug)
printk(KERN_DEBUG "flash_write: writing offset %lX, from buf " printk(KERN_DEBUG "flash_write: writing offset %lX, "
"%p, bytes left %X.\n", p, buf, count - written); "from buf %p, bytes left %X.\n", p, buf,
count - written);
/* /*
* write_block will limit write to space left in this block * write_block will limit write to space left in this block
...@@ -460,7 +459,7 @@ static int erase_block(int nBlock) ...@@ -460,7 +459,7 @@ static int erase_block(int nBlock)
/* /*
* write_block will limit number of bytes written to the space in this block * write_block will limit number of bytes written to the space in this block
*/ */
static int write_block(unsigned long p, const char *buf, int count) static int write_block(unsigned long p, const char __user *buf, int count)
{ {
volatile unsigned int c1; volatile unsigned int c1;
volatile unsigned int c2; volatile unsigned int c2;
......
...@@ -273,7 +273,8 @@ static int wdt977_release(struct inode *inode, struct file *file) ...@@ -273,7 +273,8 @@ static int wdt977_release(struct inode *inode, struct file *file)
* write of data will do, as we we don't define content meaning. * write of data will do, as we we don't define content meaning.
*/ */
static ssize_t wdt977_write(struct file *file, const char *buf, size_t count, loff_t *ppos) static ssize_t wdt977_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{ {
if (count) { if (count) {
if (!nowayout) { if (!nowayout) {
...@@ -321,6 +322,12 @@ static int wdt977_ioctl(struct inode *inode, struct file *file, ...@@ -321,6 +322,12 @@ static int wdt977_ioctl(struct inode *inode, struct file *file,
int status; int status;
int new_options, retval = -EINVAL; int new_options, retval = -EINVAL;
int new_timeout; int new_timeout;
union {
struct watchdog_info __user *ident;
int __user *i;
} uarg;
uarg.i = (int __user *)arg;
switch(cmd) switch(cmd)
{ {
...@@ -328,22 +335,22 @@ static int wdt977_ioctl(struct inode *inode, struct file *file, ...@@ -328,22 +335,22 @@ static int wdt977_ioctl(struct inode *inode, struct file *file,
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
case WDIOC_GETSUPPORT: case WDIOC_GETSUPPORT:
return copy_to_user((struct watchdog_info *)arg, &ident, return copy_to_user(uarg.ident, &ident,
sizeof(ident)) ? -EFAULT : 0; sizeof(ident)) ? -EFAULT : 0;
case WDIOC_GETSTATUS: case WDIOC_GETSTATUS:
wdt977_get_status(&status); wdt977_get_status(&status);
return put_user(status, (int *) arg); return put_user(status, uarg.i);
case WDIOC_GETBOOTSTATUS: case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *) arg); return put_user(0, uarg.i);
case WDIOC_KEEPALIVE: case WDIOC_KEEPALIVE:
wdt977_keepalive(); wdt977_keepalive();
return 0; return 0;
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
if (get_user (new_options, (int *) arg)) if (get_user (new_options, uarg.i))
return -EFAULT; return -EFAULT;
if (new_options & WDIOS_DISABLECARD) { if (new_options & WDIOS_DISABLECARD) {
...@@ -359,7 +366,7 @@ static int wdt977_ioctl(struct inode *inode, struct file *file, ...@@ -359,7 +366,7 @@ static int wdt977_ioctl(struct inode *inode, struct file *file,
return retval; return retval;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, (int *) arg)) if (get_user(new_timeout, uarg.i))
return -EFAULT; return -EFAULT;
if (wdt977_set_timeout(new_timeout)) if (wdt977_set_timeout(new_timeout))
...@@ -369,7 +376,7 @@ static int wdt977_ioctl(struct inode *inode, struct file *file, ...@@ -369,7 +376,7 @@ static int wdt977_ioctl(struct inode *inode, struct file *file,
/* Fall */ /* Fall */
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(timeout, (int *)arg); return put_user(timeout, uarg.i);
} }
} }
......
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