提交 969e57ad 编写于 作者: A Artem Bityutskiy 提交者: David Woodhouse

mtd: mtdchar: rename functions

We are going to re-work the MTD interface and change 'mtd->write()' to
'mtd_write()', 'mtd->read()' to 'mtd_read()' and so forth for all functions
in the 'struct mtd_info' structure.

However, mtdchar.c has its own 'mtd_read()', 'mtd_write()', etc functions
which collide with our changes. This patch renames these functions
to 'mtdchar_read()', 'mtdchar_write()', etc.

Additionally, to make the 'mtdchar.c' file look consistent, rename
similarly all the other functions starting with 'mtd_'.
Signed-off-by: NArtem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: NDavid Woodhouse <David.Woodhouse@intel.com>
上级 48d36102
...@@ -51,7 +51,7 @@ struct mtd_file_info { ...@@ -51,7 +51,7 @@ struct mtd_file_info {
enum mtd_file_modes mode; enum mtd_file_modes mode;
}; };
static loff_t mtd_lseek (struct file *file, loff_t offset, int orig) static loff_t mtdchar_lseek(struct file *file, loff_t offset, int orig)
{ {
struct mtd_file_info *mfi = file->private_data; struct mtd_file_info *mfi = file->private_data;
struct mtd_info *mtd = mfi->mtd; struct mtd_info *mtd = mfi->mtd;
...@@ -77,7 +77,7 @@ static loff_t mtd_lseek (struct file *file, loff_t offset, int orig) ...@@ -77,7 +77,7 @@ static loff_t mtd_lseek (struct file *file, loff_t offset, int orig)
static int mtd_open(struct inode *inode, struct file *file) static int mtdchar_open(struct inode *inode, struct file *file)
{ {
int minor = iminor(inode); int minor = iminor(inode);
int devnum = minor >> 1; int devnum = minor >> 1;
...@@ -142,11 +142,11 @@ static int mtd_open(struct inode *inode, struct file *file) ...@@ -142,11 +142,11 @@ static int mtd_open(struct inode *inode, struct file *file)
out: out:
mutex_unlock(&mtd_mutex); mutex_unlock(&mtd_mutex);
return ret; return ret;
} /* mtd_open */ } /* mtdchar_open */
/*====================================================================*/ /*====================================================================*/
static int mtd_close(struct inode *inode, struct file *file) static int mtdchar_close(struct inode *inode, struct file *file)
{ {
struct mtd_file_info *mfi = file->private_data; struct mtd_file_info *mfi = file->private_data;
struct mtd_info *mtd = mfi->mtd; struct mtd_info *mtd = mfi->mtd;
...@@ -164,7 +164,7 @@ static int mtd_close(struct inode *inode, struct file *file) ...@@ -164,7 +164,7 @@ static int mtd_close(struct inode *inode, struct file *file)
kfree(mfi); kfree(mfi);
return 0; return 0;
} /* mtd_close */ } /* mtdchar_close */
/* Back in June 2001, dwmw2 wrote: /* Back in June 2001, dwmw2 wrote:
* *
...@@ -184,7 +184,8 @@ static int mtd_close(struct inode *inode, struct file *file) ...@@ -184,7 +184,8 @@ static int mtd_close(struct inode *inode, struct file *file)
* alignment requirements are not met in the NAND subdriver. * alignment requirements are not met in the NAND subdriver.
*/ */
static ssize_t mtd_read(struct file *file, char __user *buf, size_t count,loff_t *ppos) static ssize_t mtdchar_read(struct file *file, char __user *buf, size_t count,
loff_t *ppos)
{ {
struct mtd_file_info *mfi = file->private_data; struct mtd_file_info *mfi = file->private_data;
struct mtd_info *mtd = mfi->mtd; struct mtd_info *mtd = mfi->mtd;
...@@ -265,9 +266,10 @@ static ssize_t mtd_read(struct file *file, char __user *buf, size_t count,loff_t ...@@ -265,9 +266,10 @@ static ssize_t mtd_read(struct file *file, char __user *buf, size_t count,loff_t
kfree(kbuf); kfree(kbuf);
return total_retlen; return total_retlen;
} /* mtd_read */ } /* mtdchar_read */
static ssize_t mtd_write(struct file *file, const char __user *buf, size_t count,loff_t *ppos) static ssize_t mtdchar_write(struct file *file, const char __user *buf, size_t count,
loff_t *ppos)
{ {
struct mtd_file_info *mfi = file->private_data; struct mtd_file_info *mfi = file->private_data;
struct mtd_info *mtd = mfi->mtd; struct mtd_info *mtd = mfi->mtd;
...@@ -345,7 +347,7 @@ static ssize_t mtd_write(struct file *file, const char __user *buf, size_t count ...@@ -345,7 +347,7 @@ static ssize_t mtd_write(struct file *file, const char __user *buf, size_t count
kfree(kbuf); kfree(kbuf);
return total_retlen; return total_retlen;
} /* mtd_write */ } /* mtdchar_write */
/*====================================================================== /*======================================================================
...@@ -387,7 +389,7 @@ static int otp_select_filemode(struct mtd_file_info *mfi, int mode) ...@@ -387,7 +389,7 @@ static int otp_select_filemode(struct mtd_file_info *mfi, int mode)
# define otp_select_filemode(f,m) -EOPNOTSUPP # define otp_select_filemode(f,m) -EOPNOTSUPP
#endif #endif
static int mtd_do_writeoob(struct file *file, struct mtd_info *mtd, static int mtdchar_writeoob(struct file *file, struct mtd_info *mtd,
uint64_t start, uint32_t length, void __user *ptr, uint64_t start, uint32_t length, void __user *ptr,
uint32_t __user *retp) uint32_t __user *retp)
{ {
...@@ -436,7 +438,7 @@ static int mtd_do_writeoob(struct file *file, struct mtd_info *mtd, ...@@ -436,7 +438,7 @@ static int mtd_do_writeoob(struct file *file, struct mtd_info *mtd,
return ret; return ret;
} }
static int mtd_do_readoob(struct file *file, struct mtd_info *mtd, static int mtdchar_readoob(struct file *file, struct mtd_info *mtd,
uint64_t start, uint32_t length, void __user *ptr, uint64_t start, uint32_t length, void __user *ptr,
uint32_t __user *retp) uint32_t __user *retp)
{ {
...@@ -530,7 +532,7 @@ static int shrink_ecclayout(const struct nand_ecclayout *from, ...@@ -530,7 +532,7 @@ static int shrink_ecclayout(const struct nand_ecclayout *from,
return 0; return 0;
} }
static int mtd_blkpg_ioctl(struct mtd_info *mtd, static int mtdchar_blkpg_ioctl(struct mtd_info *mtd,
struct blkpg_ioctl_arg __user *arg) struct blkpg_ioctl_arg __user *arg)
{ {
struct blkpg_ioctl_arg a; struct blkpg_ioctl_arg a;
...@@ -566,7 +568,7 @@ static int mtd_blkpg_ioctl(struct mtd_info *mtd, ...@@ -566,7 +568,7 @@ static int mtd_blkpg_ioctl(struct mtd_info *mtd,
} }
} }
static int mtd_write_ioctl(struct mtd_info *mtd, static int mtdchar_write_ioctl(struct mtd_info *mtd,
struct mtd_write_req __user *argp) struct mtd_write_req __user *argp)
{ {
struct mtd_write_req req; struct mtd_write_req req;
...@@ -615,7 +617,7 @@ static int mtd_write_ioctl(struct mtd_info *mtd, ...@@ -615,7 +617,7 @@ static int mtd_write_ioctl(struct mtd_info *mtd,
return ret; return ret;
} }
static int mtd_ioctl(struct file *file, u_int cmd, u_long arg) static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg)
{ {
struct mtd_file_info *mfi = file->private_data; struct mtd_file_info *mfi = file->private_data;
struct mtd_info *mtd = mfi->mtd; struct mtd_info *mtd = mfi->mtd;
...@@ -755,7 +757,7 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg) ...@@ -755,7 +757,7 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg)
if (copy_from_user(&buf, argp, sizeof(buf))) if (copy_from_user(&buf, argp, sizeof(buf)))
ret = -EFAULT; ret = -EFAULT;
else else
ret = mtd_do_writeoob(file, mtd, buf.start, buf.length, ret = mtdchar_writeoob(file, mtd, buf.start, buf.length,
buf.ptr, &buf_user->length); buf.ptr, &buf_user->length);
break; break;
} }
...@@ -769,7 +771,7 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg) ...@@ -769,7 +771,7 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg)
if (copy_from_user(&buf, argp, sizeof(buf))) if (copy_from_user(&buf, argp, sizeof(buf)))
ret = -EFAULT; ret = -EFAULT;
else else
ret = mtd_do_readoob(file, mtd, buf.start, buf.length, ret = mtdchar_readoob(file, mtd, buf.start, buf.length,
buf.ptr, &buf_user->start); buf.ptr, &buf_user->start);
break; break;
} }
...@@ -782,7 +784,7 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg) ...@@ -782,7 +784,7 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg)
if (copy_from_user(&buf, argp, sizeof(buf))) if (copy_from_user(&buf, argp, sizeof(buf)))
ret = -EFAULT; ret = -EFAULT;
else else
ret = mtd_do_writeoob(file, mtd, buf.start, buf.length, ret = mtdchar_writeoob(file, mtd, buf.start, buf.length,
(void __user *)(uintptr_t)buf.usr_ptr, (void __user *)(uintptr_t)buf.usr_ptr,
&buf_user->length); &buf_user->length);
break; break;
...@@ -796,7 +798,7 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg) ...@@ -796,7 +798,7 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg)
if (copy_from_user(&buf, argp, sizeof(buf))) if (copy_from_user(&buf, argp, sizeof(buf)))
ret = -EFAULT; ret = -EFAULT;
else else
ret = mtd_do_readoob(file, mtd, buf.start, buf.length, ret = mtdchar_readoob(file, mtd, buf.start, buf.length,
(void __user *)(uintptr_t)buf.usr_ptr, (void __user *)(uintptr_t)buf.usr_ptr,
&buf_user->length); &buf_user->length);
break; break;
...@@ -804,7 +806,7 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg) ...@@ -804,7 +806,7 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg)
case MEMWRITE: case MEMWRITE:
{ {
ret = mtd_write_ioctl(mtd, ret = mtdchar_write_ioctl(mtd,
(struct mtd_write_req __user *)arg); (struct mtd_write_req __user *)arg);
break; break;
} }
...@@ -1014,7 +1016,7 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg) ...@@ -1014,7 +1016,7 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg)
case BLKPG: case BLKPG:
{ {
ret = mtd_blkpg_ioctl(mtd, ret = mtdchar_blkpg_ioctl(mtd,
(struct blkpg_ioctl_arg __user *)arg); (struct blkpg_ioctl_arg __user *)arg);
break; break;
} }
...@@ -1033,12 +1035,12 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg) ...@@ -1033,12 +1035,12 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg)
return ret; return ret;
} /* memory_ioctl */ } /* memory_ioctl */
static long mtd_unlocked_ioctl(struct file *file, u_int cmd, u_long arg) static long mtdchar_unlocked_ioctl(struct file *file, u_int cmd, u_long arg)
{ {
int ret; int ret;
mutex_lock(&mtd_mutex); mutex_lock(&mtd_mutex);
ret = mtd_ioctl(file, cmd, arg); ret = mtdchar_ioctl(file, cmd, arg);
mutex_unlock(&mtd_mutex); mutex_unlock(&mtd_mutex);
return ret; return ret;
...@@ -1055,7 +1057,7 @@ struct mtd_oob_buf32 { ...@@ -1055,7 +1057,7 @@ struct mtd_oob_buf32 {
#define MEMWRITEOOB32 _IOWR('M', 3, struct mtd_oob_buf32) #define MEMWRITEOOB32 _IOWR('M', 3, struct mtd_oob_buf32)
#define MEMREADOOB32 _IOWR('M', 4, struct mtd_oob_buf32) #define MEMREADOOB32 _IOWR('M', 4, struct mtd_oob_buf32)
static long mtd_compat_ioctl(struct file *file, unsigned int cmd, static long mtdchar_compat_ioctl(struct file *file, unsigned int cmd,
unsigned long arg) unsigned long arg)
{ {
struct mtd_file_info *mfi = file->private_data; struct mtd_file_info *mfi = file->private_data;
...@@ -1074,7 +1076,7 @@ static long mtd_compat_ioctl(struct file *file, unsigned int cmd, ...@@ -1074,7 +1076,7 @@ static long mtd_compat_ioctl(struct file *file, unsigned int cmd,
if (copy_from_user(&buf, argp, sizeof(buf))) if (copy_from_user(&buf, argp, sizeof(buf)))
ret = -EFAULT; ret = -EFAULT;
else else
ret = mtd_do_writeoob(file, mtd, buf.start, ret = mtdchar_writeoob(file, mtd, buf.start,
buf.length, compat_ptr(buf.ptr), buf.length, compat_ptr(buf.ptr),
&buf_user->length); &buf_user->length);
break; break;
...@@ -1089,13 +1091,13 @@ static long mtd_compat_ioctl(struct file *file, unsigned int cmd, ...@@ -1089,13 +1091,13 @@ static long mtd_compat_ioctl(struct file *file, unsigned int cmd,
if (copy_from_user(&buf, argp, sizeof(buf))) if (copy_from_user(&buf, argp, sizeof(buf)))
ret = -EFAULT; ret = -EFAULT;
else else
ret = mtd_do_readoob(file, mtd, buf.start, ret = mtdchar_readoob(file, mtd, buf.start,
buf.length, compat_ptr(buf.ptr), buf.length, compat_ptr(buf.ptr),
&buf_user->start); &buf_user->start);
break; break;
} }
default: default:
ret = mtd_ioctl(file, cmd, (unsigned long)argp); ret = mtdchar_ioctl(file, cmd, (unsigned long)argp);
} }
mutex_unlock(&mtd_mutex); mutex_unlock(&mtd_mutex);
...@@ -1111,7 +1113,7 @@ static long mtd_compat_ioctl(struct file *file, unsigned int cmd, ...@@ -1111,7 +1113,7 @@ static long mtd_compat_ioctl(struct file *file, unsigned int cmd,
* mappings) * mappings)
*/ */
#ifndef CONFIG_MMU #ifndef CONFIG_MMU
static unsigned long mtd_get_unmapped_area(struct file *file, static unsigned long mtdchar_get_unmapped_area(struct file *file,
unsigned long addr, unsigned long addr,
unsigned long len, unsigned long len,
unsigned long pgoff, unsigned long pgoff,
...@@ -1144,7 +1146,7 @@ static unsigned long mtd_get_unmapped_area(struct file *file, ...@@ -1144,7 +1146,7 @@ static unsigned long mtd_get_unmapped_area(struct file *file,
/* /*
* set up a mapping for shared memory segments * set up a mapping for shared memory segments
*/ */
static int mtd_mmap(struct file *file, struct vm_area_struct *vma) static int mtdchar_mmap(struct file *file, struct vm_area_struct *vma)
{ {
#ifdef CONFIG_MMU #ifdef CONFIG_MMU
struct mtd_file_info *mfi = file->private_data; struct mtd_file_info *mfi = file->private_data;
...@@ -1185,18 +1187,18 @@ static int mtd_mmap(struct file *file, struct vm_area_struct *vma) ...@@ -1185,18 +1187,18 @@ static int mtd_mmap(struct file *file, struct vm_area_struct *vma)
static const struct file_operations mtd_fops = { static const struct file_operations mtd_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.llseek = mtd_lseek, .llseek = mtdchar_lseek,
.read = mtd_read, .read = mtdchar_read,
.write = mtd_write, .write = mtdchar_write,
.unlocked_ioctl = mtd_unlocked_ioctl, .unlocked_ioctl = mtdchar_unlocked_ioctl,
#ifdef CONFIG_COMPAT #ifdef CONFIG_COMPAT
.compat_ioctl = mtd_compat_ioctl, .compat_ioctl = mtdchar_compat_ioctl,
#endif #endif
.open = mtd_open, .open = mtdchar_open,
.release = mtd_close, .release = mtdchar_close,
.mmap = mtd_mmap, .mmap = mtdchar_mmap,
#ifndef CONFIG_MMU #ifndef CONFIG_MMU
.get_unmapped_area = mtd_get_unmapped_area, .get_unmapped_area = mtdchar_get_unmapped_area,
#endif #endif
}; };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册