Commit 3569e846 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] sparse: misc drivers annotations

assorted minor bits in drivers/* - all independent, but there's
some limit to splitting stuff...
parent 796c43e5
......@@ -250,7 +250,7 @@ static loff_t nvram_llseek(struct file *file,loff_t offset, int origin )
}
static ssize_t
nvram_read(struct file *file, char *buf, size_t count, loff_t *ppos)
nvram_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
{
unsigned char contents[NVRAM_BYTES];
unsigned i = *ppos;
......@@ -279,7 +279,7 @@ nvram_read(struct file *file, char *buf, size_t count, loff_t *ppos)
}
static ssize_t
nvram_write(struct file *file, const char *buf, size_t count, loff_t *ppos)
nvram_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
{
unsigned char contents[NVRAM_BYTES];
unsigned i = *ppos;
......
......@@ -26,7 +26,7 @@ static int major = 0; /* default to dynamic major */
MODULE_PARM(major, "i");
MODULE_PARM_DESC(major, "Major device number");
static ssize_t scx200_gpio_write(struct file *file, const char *data,
static ssize_t scx200_gpio_write(struct file *file, const char __user *data,
size_t len, loff_t *ppos)
{
unsigned m = iminor(file->f_dentry->d_inode);
......@@ -77,7 +77,7 @@ static ssize_t scx200_gpio_write(struct file *file, const char *data,
return len;
}
static ssize_t scx200_gpio_read(struct file *file, char *buf,
static ssize_t scx200_gpio_read(struct file *file, char __user *buf,
size_t len, loff_t *ppos)
{
unsigned m = iminor(file->f_dentry->d_inode);
......
......@@ -251,13 +251,14 @@ static int tosh_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
unsigned long arg)
{
SMMRegisters regs;
SMMRegisters __user *argp = (SMMRegisters __user *)arg;
unsigned short ax,bx;
int err;
if (!arg)
if (!argp)
return -EINVAL;
if (copy_from_user(&regs, (SMMRegisters *) arg, sizeof(SMMRegisters)))
if (copy_from_user(&regs, argp, sizeof(SMMRegisters)))
return -EFAULT;
switch (cmd) {
......@@ -281,7 +282,7 @@ static int tosh_ioctl(struct inode *ip, struct file *fp, unsigned int cmd,
return -EINVAL;
}
if (copy_to_user((SMMRegisters *) arg, &regs, sizeof(SMMRegisters)))
if (copy_to_user(argp, &regs, sizeof(SMMRegisters)))
return -EFAULT;
return (err==0) ? 0:-EINVAL;
......
......@@ -404,6 +404,7 @@ static int pcwd_ioctl(struct inode *inode, struct file *file,
int status;
int temperature;
int new_heartbeat;
int __user *argp = (int __user *)arg;
static struct watchdog_info ident = {
.options = WDIOF_OVERHEAT |
WDIOF_CARDRESET |
......@@ -419,27 +420,27 @@ static int pcwd_ioctl(struct inode *inode, struct file *file,
return -ENOIOCTLCMD;
case WDIOC_GETSUPPORT:
if(copy_to_user((void*)arg, &ident, sizeof(ident)))
if(copy_to_user(argp, &ident, sizeof(ident)))
return -EFAULT;
return 0;
case WDIOC_GETSTATUS:
pcwd_get_status(&status);
return put_user(status, (int *) arg);
return put_user(status, argp);
case WDIOC_GETBOOTSTATUS:
return put_user(initial_status, (int *) arg);
return put_user(initial_status, argp);
case WDIOC_GETTEMP:
if (pcwd_get_temperature(&temperature))
return -EFAULT;
return put_user(temperature, (int *) arg);
return put_user(temperature, argp);
case WDIOC_SETOPTIONS:
if (revision == PCWD_REVISION_C)
{
if(copy_from_user(&rv, (int*) arg, sizeof(int)))
if(copy_from_user(&rv, argp, sizeof(int)))
return -EFAULT;
if (rv & WDIOS_DISABLECARD)
......@@ -464,7 +465,7 @@ static int pcwd_ioctl(struct inode *inode, struct file *file,
return 0;
case WDIOC_SETTIMEOUT:
if (get_user(new_heartbeat, (int *) arg))
if (get_user(new_heartbeat, argp))
return -EFAULT;
if (pcwd_set_heartbeat(new_heartbeat))
......@@ -474,13 +475,13 @@ static int pcwd_ioctl(struct inode *inode, struct file *file,
/* Fall */
case WDIOC_GETTIMEOUT:
return put_user(heartbeat, (int *)arg);
return put_user(heartbeat, argp);
}
return 0;
}
static ssize_t pcwd_write(struct file *file, const char *buf, size_t len,
static ssize_t pcwd_write(struct file *file, const char __user *buf, size_t len,
loff_t *ppos)
{
/* Can't seek (pwrite) on this device */
......@@ -541,7 +542,7 @@ static int pcwd_close(struct inode *inode, struct file *file)
* /dev/temperature handling
*/
static ssize_t pcwd_temp_read(struct file *file, char *buf, size_t count,
static ssize_t pcwd_temp_read(struct file *file, char __user *buf, size_t count,
loff_t *ppos)
{
int temperature;
......
......@@ -164,7 +164,7 @@ static int cpufreq_proc_read (
*/
static int cpufreq_proc_write (
struct file *file,
const char *buffer,
const char __user *buffer,
unsigned long count,
void *data)
{
......
......@@ -396,7 +396,7 @@ static unsigned int fops_poll(struct file *file, struct poll_table_struct *wait)
return 0;
}
static ssize_t fops_read(struct file *file, char *data, size_t count, loff_t *ppos)
static ssize_t fops_read(struct file *file, char __user *data, size_t count, loff_t *ppos)
{
struct saa7146_fh *fh = file->private_data;
......
......@@ -577,11 +577,11 @@ struct aha152x_scdata {
#define MSGO(i) (HOSTDATA(shpnt)->msgo[i])
#define MSGO_I (HOSTDATA(shpnt)->msgo_i)
#define MSGOLEN (HOSTDATA(shpnt)->msgo_len)
#define ADDMSGO(x) (MSGOLEN<256 ? MSGO(MSGOLEN++)=x : aha152x_error(shpnt,"MSGO overflow"))
#define ADDMSGO(x) (MSGOLEN<256 ? (void)(MSGO(MSGOLEN++)=x) : aha152x_error(shpnt,"MSGO overflow"))
#define MSGI(i) (HOSTDATA(shpnt)->msgi[i])
#define MSGILEN (HOSTDATA(shpnt)->msgi_len)
#define ADDMSGI(x) (MSGILEN<256 ? MSGI(MSGILEN++)=x : aha152x_error(shpnt,"MSGI overflow"))
#define ADDMSGI(x) (MSGILEN<256 ? (void)(MSGI(MSGILEN++)=x) : aha152x_error(shpnt,"MSGI overflow"))
#define DATA_LEN (HOSTDATA(shpnt)->data_len)
......
......@@ -204,7 +204,7 @@ static unsigned long vdma_mem_alloc(unsigned long size)
static void _fd_dma_mem_free(unsigned long addr, unsigned long size)
{
if((unsigned int) addr >= (unsigned int) high_memory)
return vfree((void *)addr);
vfree((void *)addr);
else
free_pages(addr, get_order(size));
}
......
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