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 @@
* Copy data from IO memory space to "real" memory space.
* 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) {
count--;
*(char *) to = readb(from);
((char *) to)++;
*t = readb(from);
t++;
from++;
}
}
......@@ -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.
* 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) {
count--;
writeb(*(char *) from, to);
((char *) from)++;
writeb(*f, to);
f++;
to++;
}
}
......
......@@ -29,7 +29,7 @@
* stack+task struct. Use the same method as 'current' uses to
* reach them.
*/
register unsigned int *user_registers asm("sl");
register unsigned long *user_registers asm("sl");
#define GET_USERREG() (user_registers)
......
......@@ -29,14 +29,14 @@
#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->fType[Fn] = typeSingle;
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();
unsigned int *p;
......@@ -47,7 +47,7 @@ static inline void loadDouble(const unsigned int Fn, const unsigned int *pMem)
}
#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();
unsigned int *p;
......@@ -59,7 +59,7 @@ static inline void loadExtended(const unsigned int Fn, const unsigned int *pMem)
}
#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();
register unsigned int *p;
......@@ -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();
union {
......@@ -117,7 +117,7 @@ static inline void storeSingle(const unsigned int Fn, unsigned int *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();
union {
......@@ -145,7 +145,7 @@ static inline void storeDouble(const unsigned int Fn, unsigned int *pMem)
}
#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();
union {
......@@ -172,7 +172,7 @@ static inline void storeExtended(const unsigned int Fn, unsigned int *pMem)
}
#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();
register unsigned int nType, *p;
......@@ -204,10 +204,10 @@ static inline void storeMultiple(const unsigned int Fn, unsigned int *pMem)
unsigned int PerformLDF(const unsigned int opcode)
{
unsigned int *pBase, *pAddress, *pFinal, nRc = 1,
write_back = WRITE_BACK(opcode);
unsigned int __user *pBase, *pAddress, *pFinal;
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)) {
pBase += 2;
write_back = 0;
......@@ -241,18 +241,18 @@ unsigned int PerformLDF(const unsigned int opcode)
}
if (write_back)
writeRegister(getRn(opcode), (unsigned int) pFinal);
writeRegister(getRn(opcode), (unsigned long) pFinal);
return nRc;
}
unsigned int PerformSTF(const unsigned int opcode)
{
unsigned int *pBase, *pAddress, *pFinal, nRc = 1,
write_back = WRITE_BACK(opcode);
unsigned int __user *pBase, *pAddress, *pFinal;
unsigned int nRc = 1, write_back = WRITE_BACK(opcode);
SetRoundingMode(ROUND_TO_NEAREST);
pBase = (unsigned int *) readRegister(getRn(opcode));
pBase = (unsigned int __user *) readRegister(getRn(opcode));
if (REG_PC == getRn(opcode)) {
pBase += 2;
write_back = 0;
......@@ -286,16 +286,16 @@ unsigned int PerformSTF(const unsigned int opcode)
}
if (write_back)
writeRegister(getRn(opcode), (unsigned int) pFinal);
writeRegister(getRn(opcode), (unsigned long) pFinal);
return nRc;
}
unsigned int PerformLFM(const unsigned int opcode)
{
unsigned int i, Fd, *pBase, *pAddress, *pFinal,
write_back = WRITE_BACK(opcode);
unsigned int __user *pBase, *pAddress, *pFinal;
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)) {
pBase += 2;
write_back = 0;
......@@ -322,16 +322,16 @@ unsigned int PerformLFM(const unsigned int opcode)
}
if (write_back)
writeRegister(getRn(opcode), (unsigned int) pFinal);
writeRegister(getRn(opcode), (unsigned long) pFinal);
return 1;
}
unsigned int PerformSFM(const unsigned int opcode)
{
unsigned int i, Fd, *pBase, *pAddress, *pFinal,
write_back = WRITE_BACK(opcode);
unsigned int __user *pBase, *pAddress, *pFinal;
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)) {
pBase += 2;
write_back = 0;
......@@ -358,7 +358,7 @@ unsigned int PerformSFM(const unsigned int opcode)
}
if (write_back)
writeRegister(getRn(opcode), (unsigned int) pFinal);
writeRegister(getRn(opcode), (unsigned long) pFinal);
return 1;
}
......
......@@ -131,7 +131,7 @@ void float_raise(signed char flags)
#ifdef CONFIG_DEBUG_USER
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,
__builtin_return_address(0), GET_USERREG()[15]);
#endif
......
......@@ -19,8 +19,7 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
extern __inline__
unsigned int readRegister(const unsigned int nReg)
static inline unsigned long readRegister(const unsigned int nReg)
{
/* Note: The CPU thinks it has dealt with the current instruction.
As a result the program counter has been advanced to the next
......@@ -29,34 +28,31 @@ unsigned int readRegister(const unsigned int nReg)
for this in this routine. LDF/STF instructions with Rn = PC
depend on the PC being correct, as they use PC+8 in their
address calculations. */
unsigned int *userRegisters = GET_USERREG();
unsigned long *userRegisters = GET_USERREG();
unsigned int val = userRegisters[nReg];
if (REG_PC == nReg)
val -= 4;
return val;
}
extern __inline__
void writeRegister(const unsigned int nReg, const unsigned int val)
static inline void
writeRegister(const unsigned int nReg, const unsigned long val)
{
unsigned int *userRegisters = GET_USERREG();
unsigned long *userRegisters = GET_USERREG();
userRegisters[nReg] = val;
}
extern __inline__
unsigned int readCPSR(void)
static inline unsigned long readCPSR(void)
{
return (readRegister(REG_CPSR));
}
extern __inline__
void writeCPSR(const unsigned int val)
static inline void writeCPSR(const unsigned long val)
{
writeRegister(REG_CPSR, val);
}
extern __inline__
unsigned int readConditionCodes(void)
static inline unsigned long readConditionCodes(void)
{
#ifdef __FPEM_TEST__
return (0);
......@@ -65,11 +61,10 @@ unsigned int readConditionCodes(void)
#endif
}
extern __inline__
void writeConditionCodes(const unsigned int val)
static inline void writeConditionCodes(const unsigned long val)
{
unsigned int *userRegisters = GET_USERREG();
unsigned int rval;
unsigned long *userRegisters = GET_USERREG();
unsigned long rval;
/*
* Operate directly on userRegisters since
* the CPSR may be the PC register itself.
......@@ -77,9 +72,3 @@ void writeConditionCodes(const unsigned int val)
rval = userRegisters[REG_CPSR] & ~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)
}
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 char cur_temp_degF;
......@@ -233,8 +233,14 @@ static int
ds1620_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
struct therm therm;
union {
struct therm __user *therm;
int __user *i;
} uarg;
int i;
uarg.i = (int __user *)arg;
switch(cmd) {
case CMD_SET_THERMOSTATE:
case CMD_SET_THERMOSTATE2:
......@@ -242,11 +248,11 @@ ds1620_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned
return -EPERM;
if (cmd == CMD_SET_THERMOSTATE) {
if (get_user(therm.hi, (int *)arg))
if (get_user(therm.hi, uarg.i))
return -EFAULT;
therm.lo = therm.hi - 3;
} else {
if (copy_from_user(&therm, (void *)arg, sizeof(therm)))
if (copy_from_user(&therm, uarg.therm, sizeof(therm)))
return -EFAULT;
}
......@@ -264,10 +270,10 @@ ds1620_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned
therm.hi >>= 1;
if (cmd == CMD_GET_THERMOSTATE) {
if (put_user(therm.hi, (int *)arg))
if (put_user(therm.hi, uarg.i))
return -EFAULT;
} else {
if (copy_to_user((void *)arg, &therm, sizeof(therm)))
if (copy_to_user(uarg.therm, &therm, sizeof(therm)))
return -EFAULT;
}
break;
......@@ -279,23 +285,23 @@ ds1620_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned
if (cmd == CMD_GET_TEMPERATURE)
i >>= 1;
return put_user(i, (int *)arg) ? -EFAULT : 0;
return put_user(i, uarg.i) ? -EFAULT : 0;
case CMD_GET_STATUS:
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:
i = netwinder_get_fan();
return put_user(i, (int *)arg) ? -EFAULT : 0;
return put_user(i, uarg.i) ? -EFAULT : 0;
case CMD_SET_FAN:
if (!capable(CAP_SYS_ADMIN))
return -EPERM;
if (get_user(i, (int *)arg))
if (get_user(i, uarg.i))
return -EFAULT;
netwinder_set_fan(i);
......@@ -377,7 +383,7 @@ static int __init ds1620_init(void)
return ret;
#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)
proc_therm_ds1620->read_proc = proc_therm_ds1620_read;
else
......
......@@ -170,7 +170,7 @@ static irqreturn_t button_handler (int irq, void *dev_id, struct pt_regs *regs)
* 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)
{
interruptible_sleep_on (&button_wait_queue);
......
......@@ -26,8 +26,6 @@ struct button_callback {
static void button_sequence_finished (unsigned long parameters);
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_add_callback (void (*callback) (void), int count);
int button_del_callback (void (*callback) (void));
......
......@@ -43,11 +43,7 @@
static void kick_open(void);
static int get_flash_id(void);
static int erase_block(int nBlock);
static int write_block(unsigned long p, const char *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);
static int write_block(unsigned long p, const char __user *buf, int count);
#define KFLASH_SIZE 1024*1024 //1 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
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 int count = size;
int ret = 0;
if (flashdebug)
printk(KERN_DEBUG "flash_read: flash_read: offset=0x%lX, buffer=%p, count=0x%X.\n",
p, buf, count);
printk(KERN_DEBUG "flash_read: flash_read: offset=0x%lX, "
"buffer=%p, count=0x%X.\n", p, buf, count);
if (count)
ret = -ENXIO;
......@@ -166,7 +163,8 @@ static ssize_t flash_read(struct file *file, char *buf, size_t size, loff_t * pp
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 int count = size;
......@@ -244,8 +242,9 @@ static ssize_t flash_write(struct file *file, const char *buf, size_t size, loff
break;
}
if (flashdebug)
printk(KERN_DEBUG "flash_write: writing offset %lX, from buf "
"%p, bytes left %X.\n", p, buf, count - written);
printk(KERN_DEBUG "flash_write: writing offset %lX, "
"from buf %p, bytes left %X.\n", p, buf,
count - written);
/*
* write_block will limit write to space left in this block
......@@ -460,7 +459,7 @@ static int erase_block(int nBlock)
/*
* 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 c2;
......
......@@ -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.
*/
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 (!nowayout) {
......@@ -321,6 +322,12 @@ static int wdt977_ioctl(struct inode *inode, struct file *file,
int status;
int new_options, retval = -EINVAL;
int new_timeout;
union {
struct watchdog_info __user *ident;
int __user *i;
} uarg;
uarg.i = (int __user *)arg;
switch(cmd)
{
......@@ -328,22 +335,22 @@ static int wdt977_ioctl(struct inode *inode, struct file *file,
return -ENOIOCTLCMD;
case WDIOC_GETSUPPORT:
return copy_to_user((struct watchdog_info *)arg, &ident,
return copy_to_user(uarg.ident, &ident,
sizeof(ident)) ? -EFAULT : 0;
case WDIOC_GETSTATUS:
wdt977_get_status(&status);
return put_user(status, (int *) arg);
return put_user(status, uarg.i);
case WDIOC_GETBOOTSTATUS:
return put_user(0, (int *) arg);
return put_user(0, uarg.i);
case WDIOC_KEEPALIVE:
wdt977_keepalive();
return 0;
case WDIOC_SETOPTIONS:
if (get_user (new_options, (int *) arg))
if (get_user (new_options, uarg.i))
return -EFAULT;
if (new_options & WDIOS_DISABLECARD) {
......@@ -359,7 +366,7 @@ static int wdt977_ioctl(struct inode *inode, struct file *file,
return retval;
case WDIOC_SETTIMEOUT:
if (get_user(new_timeout, (int *) arg))
if (get_user(new_timeout, uarg.i))
return -EFAULT;
if (wdt977_set_timeout(new_timeout))
......@@ -369,7 +376,7 @@ static int wdt977_ioctl(struct inode *inode, struct file *file,
/* Fall */
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