summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Viro <viro@parcelfarce.linux.theplanet.co.uk>2004-06-23 19:55:09 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-06-23 19:55:09 -0700
commita7834704c546ba087b5bf20f993b8083488bc595 (patch)
treee95250b336cb709a596e82653668e47ae83bbafc
parent8412a0db8eb60ef650a24578d38c1d18db5a806f (diff)
[PATCH] sparse: trivial drivers/char/* annotation and format fixes
- trivial annotation in several places in drivers/mtd - a bunch of debugging printks switched from %x to %llx (they get 64bit values) - in doc200[01].c fixed type of (unused) last argument in their doc_read_ecc().
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0001.c4
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0002.c8
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0020.c8
-rw-r--r--drivers/mtd/devices/doc2000.c12
-rw-r--r--drivers/mtd/devices/doc2001.c13
-rw-r--r--drivers/mtd/mtd_blkdevs.c2
-rw-r--r--drivers/mtd/mtdchar.c42
-rw-r--r--include/linux/mtd/mtd.h2
8 files changed, 48 insertions, 43 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index 18cc31d39752..e1be7178b70e 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -378,7 +378,7 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr
chip->state = FL_ERASING;
chip->oldstate = FL_READY;
printk(KERN_ERR "Chip not ready after erase "
- "suspended: status = 0x%x\n", status);
+ "suspended: status = 0x%llx\n", status);
return -EIO;
}
@@ -963,7 +963,7 @@ static inline int do_write_buffer(struct map_info *map, struct flchip *chip,
So we must check here and reset those bits if they're set. Otherwise
we're just pissing in the wind */
if (status & CMD(0x30)) {
- printk(KERN_WARNING "SR.4 or SR.5 bits set in buffer write (status %x). Clearing.\n", status);
+ printk(KERN_WARNING "SR.4 or SR.5 bits set in buffer write (status %llx). Clearing.\n", status);
cfi_write(map, CMD(0x50), cmd_adr);
cfi_write(map, CMD(0x70), cmd_adr);
}
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index df3309048290..cb5fcfcac9f5 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -509,7 +509,7 @@ static int do_write_oneword(struct map_info *map, struct flchip *chip, unsigned
chip->state = FL_WRITING;
adr += chip->start;
- DEBUG( MTD_DEBUG_LEVEL3, "MTD %s(): WRITE 0x%.8lx(0x%.8x)\n",
+ DEBUG( MTD_DEBUG_LEVEL3, "MTD %s(): WRITE 0x%.8lx(0x%.8llx)\n",
__func__, adr, datum );
ENABLE_VPP(map);
@@ -645,7 +645,7 @@ static int do_write_oneword(struct map_info *map, struct flchip *chip, unsigned
__func__ );
printk(KERN_WARNING
- "MTD %s(): 0x%.8lx(0x%.8x): 0x%.8x 0x%.8x 0x%.8x 0x%.8x\n",
+ "MTD %s(): 0x%.8lx(0x%.8llx): 0x%.8x 0x%.8x 0x%.8x 0x%.8x\n",
__func__, adr, datum,
prev_oldstatus, prev_status,
oldstatus, status);
@@ -971,7 +971,7 @@ static inline int do_erase_chip(struct map_info *map, struct flchip *chip)
__func__ );
printk(KERN_WARNING
- "MTD %s(): 0x%.8lx(0x%.8x): 0x%.8x 0x%.8x 0x%.8x 0x%.8x\n",
+ "MTD %s(): 0x%.8lx(0x%.8llx): 0x%.8x 0x%.8x 0x%.8x 0x%.8x\n",
__func__, adr, ones,
prev_oldstatus, prev_status,
oldstatus, status);
@@ -1151,7 +1151,7 @@ static inline int do_erase_oneblock(struct map_info *map, struct flchip *chip, u
__func__ );
printk(KERN_WARNING
- "MTD %s(): 0x%.8lx(0x%.8x): 0x%.8x 0x%.8x 0x%.8x 0x%.8x\n",
+ "MTD %s(): 0x%.8lx(0x%.8llx): 0x%.8x 0x%.8x 0x%.8x 0x%.8x\n",
__func__, adr, ones,
prev_oldstatus, prev_status,
oldstatus, status);
diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c
index 98e58b426140..074f6905991d 100644
--- a/drivers/mtd/chips/cfi_cmdset_0020.c
+++ b/drivers/mtd/chips/cfi_cmdset_0020.c
@@ -489,7 +489,7 @@ static inline int do_write_buffer(struct map_info *map, struct flchip *chip,
/* Urgh. Chip not yet ready to talk to us. */
if (time_after(jiffies, timeo)) {
spin_unlock_bh(chip->mutex);
- printk(KERN_ERR "waiting for chip to be ready timed out in buffer write Xstatus = %x, status = %x\n",
+ printk(KERN_ERR "waiting for chip to be ready timed out in buffer write Xstatus = %x, status = %llx\n",
status, cfi_read(map, cmd_adr));
return -EIO;
}
@@ -859,7 +859,7 @@ retry:
if (time_after(jiffies, timeo)) {
cfi_write(map, CMD(0x70), adr);
chip->state = FL_STATUS;
- printk(KERN_ERR "waiting for erase to complete timed out. Xstatus = %x, status = %x.\n", status, cfi_read(map, adr));
+ printk(KERN_ERR "waiting for erase to complete timed out. Xstatus = %x, status = %llx.\n", status, cfi_read(map, adr));
DISABLE_VPP(map);
spin_unlock_bh(chip->mutex);
return -EIO;
@@ -1145,7 +1145,7 @@ retry:
if (time_after(jiffies, timeo)) {
cfi_write(map, CMD(0x70), adr);
chip->state = FL_STATUS;
- printk(KERN_ERR "waiting for lock to complete timed out. Xstatus = %x, status = %x.\n", status, cfi_read(map, adr));
+ printk(KERN_ERR "waiting for lock to complete timed out. Xstatus = %x, status = %llx.\n", status, cfi_read(map, adr));
DISABLE_VPP(map);
spin_unlock_bh(chip->mutex);
return -EIO;
@@ -1294,7 +1294,7 @@ retry:
if (time_after(jiffies, timeo)) {
cfi_write(map, CMD(0x70), adr);
chip->state = FL_STATUS;
- printk(KERN_ERR "waiting for unlock to complete timed out. Xstatus = %x, status = %x.\n", status, cfi_read(map, adr));
+ printk(KERN_ERR "waiting for unlock to complete timed out. Xstatus = %x, status = %llx.\n", status, cfi_read(map, adr));
DISABLE_VPP(map);
spin_unlock_bh(chip->mutex);
return -EIO;
diff --git a/drivers/mtd/devices/doc2000.c b/drivers/mtd/devices/doc2000.c
index 5cb921d2197a..ee961c661f9d 100644
--- a/drivers/mtd/devices/doc2000.c
+++ b/drivers/mtd/devices/doc2000.c
@@ -53,9 +53,11 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len,
static int doc_write(struct mtd_info *mtd, loff_t to, size_t len,
size_t *retlen, const u_char *buf);
static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
- size_t *retlen, u_char *buf, u_char *eccbuf, int oobsel);
+ size_t *retlen, u_char *buf, u_char *eccbuf,
+ struct nand_oobinfo *unused);
static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
- size_t *retlen, const u_char *buf, u_char *eccbuf, int oobsel);
+ size_t *retlen, const u_char *buf, u_char *eccbuf,
+ struct nand_oobinfo *unused);
static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len,
size_t *retlen, u_char *buf);
static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len,
@@ -601,7 +603,8 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len,
}
static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
- size_t * retlen, u_char * buf, u_char * eccbuf, int oobsel)
+ size_t * retlen, u_char * buf, u_char * eccbuf,
+ struct nand_oobinfo *unused)
{
struct DiskOnChip *this = (struct DiskOnChip *) mtd->priv;
unsigned long docptr;
@@ -750,7 +753,8 @@ static int doc_write(struct mtd_info *mtd, loff_t to, size_t len,
static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
size_t * retlen, const u_char * buf,
- u_char * eccbuf, int oobsel)
+ u_char * eccbuf,
+ struct nand_oobinfo *unused)
{
struct DiskOnChip *this = (struct DiskOnChip *) mtd->priv;
int di; /* Yes, DI is a hangover from when I was disassembling the binary driver */
diff --git a/drivers/mtd/devices/doc2001.c b/drivers/mtd/devices/doc2001.c
index 25eea68ad774..223e29189050 100644
--- a/drivers/mtd/devices/doc2001.c
+++ b/drivers/mtd/devices/doc2001.c
@@ -37,9 +37,12 @@ static int doc_read(struct mtd_info *mtd, loff_t from, size_t len,
static int doc_write(struct mtd_info *mtd, loff_t to, size_t len,
size_t *retlen, const u_char *buf);
static int doc_read_ecc(struct mtd_info *mtd, loff_t from, size_t len,
- size_t *retlen, u_char *buf, u_char *eccbuf, int oobsel);
+ size_t *retlen, u_char *buf, u_char *eccbuf,
+ struct nand_oobinfo *unused);
static int doc_write_ecc(struct mtd_info *mtd, loff_t to, size_t len,
- size_t *retlen, const u_char *buf, u_char *eccbuf, int oobsel);
+ size_t *retlen, const u_char *buf, u_char *eccbuf,
+ struct nand_oobinfo *unused);
+
static int doc_read_oob(struct mtd_info *mtd, loff_t ofs, size_t len,
size_t *retlen, u_char *buf);
static int doc_write_oob(struct mtd_info *mtd, loff_t ofs, size_t len,
@@ -407,7 +410,8 @@ static int doc_read (struct mtd_info *mtd, loff_t from, size_t len,
}
static int doc_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
- size_t *retlen, u_char *buf, u_char *eccbuf, int oobsel)
+ size_t *retlen, u_char *buf, u_char *eccbuf,
+ struct nand_oobinfo *unused)
{
int i, ret;
volatile char dummy;
@@ -533,7 +537,8 @@ static int doc_write (struct mtd_info *mtd, loff_t to, size_t len,
}
static int doc_write_ecc (struct mtd_info *mtd, loff_t to, size_t len,
- size_t *retlen, const u_char *buf, u_char *eccbuf, int oobsel)
+ size_t *retlen, const u_char *buf, u_char *eccbuf,
+ struct nand_oobinfo *unused)
{
int i,ret = 0;
volatile char dummy;
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 4a0f2ea7c286..e45b3fc99fde 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -220,7 +220,7 @@ static int blktrans_ioctl(struct inode *inode, struct file *file,
return ret;
g.start = get_start_sect(inode->i_bdev);
- if (copy_to_user((void *)arg, &g, sizeof(g)))
+ if (copy_to_user((void __user *)arg, &g, sizeof(g)))
return -EFAULT;
return 0;
} /* else */
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 801bcc8f08d4..b1a9257b9b75 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -116,7 +116,7 @@ static int mtd_close(struct inode *inode, struct file *file)
*/
#define MAX_KMALLOC_SIZE 0x20000
-static ssize_t mtd_read(struct file *file, char *buf, size_t count,loff_t *ppos)
+static ssize_t mtd_read(struct file *file, char __user *buf, size_t count,loff_t *ppos)
{
struct mtd_info *mtd = (struct mtd_info *)file->private_data;
size_t retlen=0;
@@ -169,7 +169,7 @@ static ssize_t mtd_read(struct file *file, char *buf, size_t count,loff_t *ppos)
return total_retlen;
} /* mtd_read */
-static ssize_t mtd_write(struct file *file, const char *buf, size_t count,loff_t *ppos)
+static ssize_t mtd_write(struct file *file, const char __user *buf, size_t count,loff_t *ppos)
{
struct mtd_info *mtd = (struct mtd_info *)file->private_data;
char *kbuf;
@@ -238,6 +238,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
u_int cmd, u_long arg)
{
struct mtd_info *mtd = (struct mtd_info *)file->private_data;
+ void __user *argp = (void __user *)arg;
int ret = 0;
u_long size;
@@ -245,17 +246,17 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
size = (cmd & IOCSIZE_MASK) >> IOCSIZE_SHIFT;
if (cmd & IOC_IN) {
- ret = verify_area(VERIFY_READ, (char *)arg, size);
+ ret = verify_area(VERIFY_READ, argp, size);
if (ret) return ret;
}
if (cmd & IOC_OUT) {
- ret = verify_area(VERIFY_WRITE, (char *)arg, size);
+ ret = verify_area(VERIFY_WRITE, argp, size);
if (ret) return ret;
}
switch (cmd) {
case MEMGETREGIONCOUNT:
- if (copy_to_user((int *) arg, &(mtd->numeraseregions), sizeof(int)))
+ if (copy_to_user(argp, &(mtd->numeraseregions), sizeof(int)))
return -EFAULT;
break;
@@ -263,24 +264,19 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
{
struct region_info_user ur;
- if (copy_from_user( &ur,
- (struct region_info_user *)arg,
- sizeof(struct region_info_user))) {
+ if (copy_from_user(&ur, argp, sizeof(struct region_info_user)))
return -EFAULT;
- }
if (ur.regionindex >= mtd->numeraseregions)
return -EINVAL;
- if (copy_to_user((struct mtd_erase_region_info *) arg,
- &(mtd->eraseregions[ur.regionindex]),
+ if (copy_to_user(argp, &(mtd->eraseregions[ur.regionindex]),
sizeof(struct mtd_erase_region_info)))
return -EFAULT;
break;
}
case MEMGETINFO:
- if (copy_to_user((struct mtd_info *)arg, mtd,
- sizeof(struct mtd_info_user)))
+ if (copy_to_user(argp, mtd, sizeof(struct mtd_info_user)))
return -EFAULT;
break;
@@ -301,7 +297,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
init_waitqueue_head(&waitq);
memset (erase,0,sizeof(struct erase_info));
- if (copy_from_user(&erase->addr, (u_long *)arg,
+ if (copy_from_user(&erase->addr, argp,
2 * sizeof(u_long))) {
kfree(erase);
return -EFAULT;
@@ -345,7 +341,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
if(!(file->f_mode & 2))
return -EPERM;
- if (copy_from_user(&buf, (struct mtd_oob_buf *)arg, sizeof(struct mtd_oob_buf)))
+ if (copy_from_user(&buf, argp, sizeof(struct mtd_oob_buf)))
return -EFAULT;
if (buf.length > 0x4096)
@@ -354,7 +350,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
if (!mtd->write_oob)
ret = -EOPNOTSUPP;
else
- ret = verify_area(VERIFY_READ, (char *)buf.ptr, buf.length);
+ ret = verify_area(VERIFY_READ, buf.ptr, buf.length);
if (ret)
return ret;
@@ -370,7 +366,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
ret = (mtd->write_oob)(mtd, buf.start, buf.length, &retlen, databuf);
- if (copy_to_user((void *)arg + sizeof(u_int32_t), &retlen, sizeof(u_int32_t)))
+ if (copy_to_user(argp + sizeof(u_int32_t), &retlen, sizeof(u_int32_t)))
ret = -EFAULT;
kfree(databuf);
@@ -384,7 +380,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
void *databuf;
ssize_t retlen;
- if (copy_from_user(&buf, (struct mtd_oob_buf *)arg, sizeof(struct mtd_oob_buf)))
+ if (copy_from_user(&buf, argp, sizeof(struct mtd_oob_buf)))
return -EFAULT;
if (buf.length > 0x4096)
@@ -393,7 +389,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
if (!mtd->read_oob)
ret = -EOPNOTSUPP;
else
- ret = verify_area(VERIFY_WRITE, (char *)buf.ptr, buf.length);
+ ret = verify_area(VERIFY_WRITE, buf.ptr, buf.length);
if (ret)
return ret;
@@ -404,7 +400,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
ret = (mtd->read_oob)(mtd, buf.start, buf.length, &retlen, databuf);
- if (copy_to_user((void *)arg + sizeof(u_int32_t), &retlen, sizeof(u_int32_t)))
+ if (copy_to_user(argp + sizeof(u_int32_t), &retlen, sizeof(u_int32_t)))
ret = -EFAULT;
else if (retlen && copy_to_user(buf.ptr, databuf, retlen))
ret = -EFAULT;
@@ -417,7 +413,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
{
unsigned long adrs[2];
- if (copy_from_user(adrs ,(void *)arg, 2* sizeof(unsigned long)))
+ if (copy_from_user(adrs, argp, 2* sizeof(unsigned long)))
return -EFAULT;
if (!mtd->lock)
@@ -431,7 +427,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
{
unsigned long adrs[2];
- if (copy_from_user(adrs, (void *)arg, 2* sizeof(unsigned long)))
+ if (copy_from_user(adrs, argp, 2* sizeof(unsigned long)))
return -EFAULT;
if (!mtd->unlock)
@@ -443,7 +439,7 @@ static int mtd_ioctl(struct inode *inode, struct file *file,
case MEMSETOOBSEL:
{
- if (copy_from_user(&mtd->oobinfo ,(void *)arg, sizeof(struct nand_oobinfo)))
+ if (copy_from_user(&mtd->oobinfo, argp, sizeof(struct nand_oobinfo)))
return -EFAULT;
break;
}
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 9ac94aaabd3f..d186585b73a4 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -22,7 +22,7 @@ struct erase_info_user {
struct mtd_oob_buf {
u_int32_t start;
u_int32_t length;
- unsigned char *ptr;
+ unsigned char __user *ptr;
};
#define MTD_CHAR_MAJOR 90