diff options
author | Artem Bityutskiy <artem.bityutskiy@linux.intel.com> | 2011-12-23 10:27:46 -0500 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2012-01-09 13:25:02 -0500 |
commit | 969e57adc2589a0a0ae5edbbe7b92062565ce70b (patch) | |
tree | af82f2a48104749151e8d87573f29df1eb73ff48 /drivers/mtd/mtdchar.c | |
parent | 48d3610268cef9cea0704119a74a00d1bf82f536 (diff) |
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: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/mtdchar.c')
-rw-r--r-- | drivers/mtd/mtdchar.c | 76 |
1 files changed, 39 insertions, 37 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index e7dc732ddabc..00423cc85807 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c | |||
@@ -51,7 +51,7 @@ struct mtd_file_info { | |||
51 | enum mtd_file_modes mode; | 51 | enum mtd_file_modes mode; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | static loff_t mtd_lseek (struct file *file, loff_t offset, int orig) | 54 | static loff_t mtdchar_lseek(struct file *file, loff_t offset, int orig) |
55 | { | 55 | { |
56 | struct mtd_file_info *mfi = file->private_data; | 56 | struct mtd_file_info *mfi = file->private_data; |
57 | struct mtd_info *mtd = mfi->mtd; | 57 | struct mtd_info *mtd = mfi->mtd; |
@@ -77,7 +77,7 @@ static loff_t mtd_lseek (struct file *file, loff_t offset, int orig) | |||
77 | 77 | ||
78 | 78 | ||
79 | 79 | ||
80 | static int mtd_open(struct inode *inode, struct file *file) | 80 | static int mtdchar_open(struct inode *inode, struct file *file) |
81 | { | 81 | { |
82 | int minor = iminor(inode); | 82 | int minor = iminor(inode); |
83 | int devnum = minor >> 1; | 83 | int devnum = minor >> 1; |
@@ -142,11 +142,11 @@ static int mtd_open(struct inode *inode, struct file *file) | |||
142 | out: | 142 | out: |
143 | mutex_unlock(&mtd_mutex); | 143 | mutex_unlock(&mtd_mutex); |
144 | return ret; | 144 | return ret; |
145 | } /* mtd_open */ | 145 | } /* mtdchar_open */ |
146 | 146 | ||
147 | /*====================================================================*/ | 147 | /*====================================================================*/ |
148 | 148 | ||
149 | static int mtd_close(struct inode *inode, struct file *file) | 149 | static int mtdchar_close(struct inode *inode, struct file *file) |
150 | { | 150 | { |
151 | struct mtd_file_info *mfi = file->private_data; | 151 | struct mtd_file_info *mfi = file->private_data; |
152 | struct mtd_info *mtd = mfi->mtd; | 152 | struct mtd_info *mtd = mfi->mtd; |
@@ -164,7 +164,7 @@ static int mtd_close(struct inode *inode, struct file *file) | |||
164 | kfree(mfi); | 164 | kfree(mfi); |
165 | 165 | ||
166 | return 0; | 166 | return 0; |
167 | } /* mtd_close */ | 167 | } /* mtdchar_close */ |
168 | 168 | ||
169 | /* Back in June 2001, dwmw2 wrote: | 169 | /* Back in June 2001, dwmw2 wrote: |
170 | * | 170 | * |
@@ -184,7 +184,8 @@ static int mtd_close(struct inode *inode, struct file *file) | |||
184 | * alignment requirements are not met in the NAND subdriver. | 184 | * alignment requirements are not met in the NAND subdriver. |
185 | */ | 185 | */ |
186 | 186 | ||
187 | static ssize_t mtd_read(struct file *file, char __user *buf, size_t count,loff_t *ppos) | 187 | static ssize_t mtdchar_read(struct file *file, char __user *buf, size_t count, |
188 | loff_t *ppos) | ||
188 | { | 189 | { |
189 | struct mtd_file_info *mfi = file->private_data; | 190 | struct mtd_file_info *mfi = file->private_data; |
190 | struct mtd_info *mtd = mfi->mtd; | 191 | 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 | 266 | ||
266 | kfree(kbuf); | 267 | kfree(kbuf); |
267 | return total_retlen; | 268 | return total_retlen; |
268 | } /* mtd_read */ | 269 | } /* mtdchar_read */ |
269 | 270 | ||
270 | static ssize_t mtd_write(struct file *file, const char __user *buf, size_t count,loff_t *ppos) | 271 | static ssize_t mtdchar_write(struct file *file, const char __user *buf, size_t count, |
272 | loff_t *ppos) | ||
271 | { | 273 | { |
272 | struct mtd_file_info *mfi = file->private_data; | 274 | struct mtd_file_info *mfi = file->private_data; |
273 | struct mtd_info *mtd = mfi->mtd; | 275 | 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 | 347 | ||
346 | kfree(kbuf); | 348 | kfree(kbuf); |
347 | return total_retlen; | 349 | return total_retlen; |
348 | } /* mtd_write */ | 350 | } /* mtdchar_write */ |
349 | 351 | ||
350 | /*====================================================================== | 352 | /*====================================================================== |
351 | 353 | ||
@@ -387,7 +389,7 @@ static int otp_select_filemode(struct mtd_file_info *mfi, int mode) | |||
387 | # define otp_select_filemode(f,m) -EOPNOTSUPP | 389 | # define otp_select_filemode(f,m) -EOPNOTSUPP |
388 | #endif | 390 | #endif |
389 | 391 | ||
390 | static int mtd_do_writeoob(struct file *file, struct mtd_info *mtd, | 392 | static int mtdchar_writeoob(struct file *file, struct mtd_info *mtd, |
391 | uint64_t start, uint32_t length, void __user *ptr, | 393 | uint64_t start, uint32_t length, void __user *ptr, |
392 | uint32_t __user *retp) | 394 | uint32_t __user *retp) |
393 | { | 395 | { |
@@ -436,7 +438,7 @@ static int mtd_do_writeoob(struct file *file, struct mtd_info *mtd, | |||
436 | return ret; | 438 | return ret; |
437 | } | 439 | } |
438 | 440 | ||
439 | static int mtd_do_readoob(struct file *file, struct mtd_info *mtd, | 441 | static int mtdchar_readoob(struct file *file, struct mtd_info *mtd, |
440 | uint64_t start, uint32_t length, void __user *ptr, | 442 | uint64_t start, uint32_t length, void __user *ptr, |
441 | uint32_t __user *retp) | 443 | uint32_t __user *retp) |
442 | { | 444 | { |
@@ -530,7 +532,7 @@ static int shrink_ecclayout(const struct nand_ecclayout *from, | |||
530 | return 0; | 532 | return 0; |
531 | } | 533 | } |
532 | 534 | ||
533 | static int mtd_blkpg_ioctl(struct mtd_info *mtd, | 535 | static int mtdchar_blkpg_ioctl(struct mtd_info *mtd, |
534 | struct blkpg_ioctl_arg __user *arg) | 536 | struct blkpg_ioctl_arg __user *arg) |
535 | { | 537 | { |
536 | struct blkpg_ioctl_arg a; | 538 | struct blkpg_ioctl_arg a; |
@@ -566,7 +568,7 @@ static int mtd_blkpg_ioctl(struct mtd_info *mtd, | |||
566 | } | 568 | } |
567 | } | 569 | } |
568 | 570 | ||
569 | static int mtd_write_ioctl(struct mtd_info *mtd, | 571 | static int mtdchar_write_ioctl(struct mtd_info *mtd, |
570 | struct mtd_write_req __user *argp) | 572 | struct mtd_write_req __user *argp) |
571 | { | 573 | { |
572 | struct mtd_write_req req; | 574 | struct mtd_write_req req; |
@@ -615,7 +617,7 @@ static int mtd_write_ioctl(struct mtd_info *mtd, | |||
615 | return ret; | 617 | return ret; |
616 | } | 618 | } |
617 | 619 | ||
618 | static int mtd_ioctl(struct file *file, u_int cmd, u_long arg) | 620 | static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) |
619 | { | 621 | { |
620 | struct mtd_file_info *mfi = file->private_data; | 622 | struct mtd_file_info *mfi = file->private_data; |
621 | struct mtd_info *mtd = mfi->mtd; | 623 | struct mtd_info *mtd = mfi->mtd; |
@@ -755,7 +757,7 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg) | |||
755 | if (copy_from_user(&buf, argp, sizeof(buf))) | 757 | if (copy_from_user(&buf, argp, sizeof(buf))) |
756 | ret = -EFAULT; | 758 | ret = -EFAULT; |
757 | else | 759 | else |
758 | ret = mtd_do_writeoob(file, mtd, buf.start, buf.length, | 760 | ret = mtdchar_writeoob(file, mtd, buf.start, buf.length, |
759 | buf.ptr, &buf_user->length); | 761 | buf.ptr, &buf_user->length); |
760 | break; | 762 | break; |
761 | } | 763 | } |
@@ -769,7 +771,7 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg) | |||
769 | if (copy_from_user(&buf, argp, sizeof(buf))) | 771 | if (copy_from_user(&buf, argp, sizeof(buf))) |
770 | ret = -EFAULT; | 772 | ret = -EFAULT; |
771 | else | 773 | else |
772 | ret = mtd_do_readoob(file, mtd, buf.start, buf.length, | 774 | ret = mtdchar_readoob(file, mtd, buf.start, buf.length, |
773 | buf.ptr, &buf_user->start); | 775 | buf.ptr, &buf_user->start); |
774 | break; | 776 | break; |
775 | } | 777 | } |
@@ -782,7 +784,7 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg) | |||
782 | if (copy_from_user(&buf, argp, sizeof(buf))) | 784 | if (copy_from_user(&buf, argp, sizeof(buf))) |
783 | ret = -EFAULT; | 785 | ret = -EFAULT; |
784 | else | 786 | else |
785 | ret = mtd_do_writeoob(file, mtd, buf.start, buf.length, | 787 | ret = mtdchar_writeoob(file, mtd, buf.start, buf.length, |
786 | (void __user *)(uintptr_t)buf.usr_ptr, | 788 | (void __user *)(uintptr_t)buf.usr_ptr, |
787 | &buf_user->length); | 789 | &buf_user->length); |
788 | break; | 790 | break; |
@@ -796,7 +798,7 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg) | |||
796 | if (copy_from_user(&buf, argp, sizeof(buf))) | 798 | if (copy_from_user(&buf, argp, sizeof(buf))) |
797 | ret = -EFAULT; | 799 | ret = -EFAULT; |
798 | else | 800 | else |
799 | ret = mtd_do_readoob(file, mtd, buf.start, buf.length, | 801 | ret = mtdchar_readoob(file, mtd, buf.start, buf.length, |
800 | (void __user *)(uintptr_t)buf.usr_ptr, | 802 | (void __user *)(uintptr_t)buf.usr_ptr, |
801 | &buf_user->length); | 803 | &buf_user->length); |
802 | break; | 804 | break; |
@@ -804,7 +806,7 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg) | |||
804 | 806 | ||
805 | case MEMWRITE: | 807 | case MEMWRITE: |
806 | { | 808 | { |
807 | ret = mtd_write_ioctl(mtd, | 809 | ret = mtdchar_write_ioctl(mtd, |
808 | (struct mtd_write_req __user *)arg); | 810 | (struct mtd_write_req __user *)arg); |
809 | break; | 811 | break; |
810 | } | 812 | } |
@@ -1014,7 +1016,7 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg) | |||
1014 | 1016 | ||
1015 | case BLKPG: | 1017 | case BLKPG: |
1016 | { | 1018 | { |
1017 | ret = mtd_blkpg_ioctl(mtd, | 1019 | ret = mtdchar_blkpg_ioctl(mtd, |
1018 | (struct blkpg_ioctl_arg __user *)arg); | 1020 | (struct blkpg_ioctl_arg __user *)arg); |
1019 | break; | 1021 | break; |
1020 | } | 1022 | } |
@@ -1033,12 +1035,12 @@ static int mtd_ioctl(struct file *file, u_int cmd, u_long arg) | |||
1033 | return ret; | 1035 | return ret; |
1034 | } /* memory_ioctl */ | 1036 | } /* memory_ioctl */ |
1035 | 1037 | ||
1036 | static long mtd_unlocked_ioctl(struct file *file, u_int cmd, u_long arg) | 1038 | static long mtdchar_unlocked_ioctl(struct file *file, u_int cmd, u_long arg) |
1037 | { | 1039 | { |
1038 | int ret; | 1040 | int ret; |
1039 | 1041 | ||
1040 | mutex_lock(&mtd_mutex); | 1042 | mutex_lock(&mtd_mutex); |
1041 | ret = mtd_ioctl(file, cmd, arg); | 1043 | ret = mtdchar_ioctl(file, cmd, arg); |
1042 | mutex_unlock(&mtd_mutex); | 1044 | mutex_unlock(&mtd_mutex); |
1043 | 1045 | ||
1044 | return ret; | 1046 | return ret; |
@@ -1055,7 +1057,7 @@ struct mtd_oob_buf32 { | |||
1055 | #define MEMWRITEOOB32 _IOWR('M', 3, struct mtd_oob_buf32) | 1057 | #define MEMWRITEOOB32 _IOWR('M', 3, struct mtd_oob_buf32) |
1056 | #define MEMREADOOB32 _IOWR('M', 4, struct mtd_oob_buf32) | 1058 | #define MEMREADOOB32 _IOWR('M', 4, struct mtd_oob_buf32) |
1057 | 1059 | ||
1058 | static long mtd_compat_ioctl(struct file *file, unsigned int cmd, | 1060 | static long mtdchar_compat_ioctl(struct file *file, unsigned int cmd, |
1059 | unsigned long arg) | 1061 | unsigned long arg) |
1060 | { | 1062 | { |
1061 | struct mtd_file_info *mfi = file->private_data; | 1063 | struct mtd_file_info *mfi = file->private_data; |
@@ -1074,7 +1076,7 @@ static long mtd_compat_ioctl(struct file *file, unsigned int cmd, | |||
1074 | if (copy_from_user(&buf, argp, sizeof(buf))) | 1076 | if (copy_from_user(&buf, argp, sizeof(buf))) |
1075 | ret = -EFAULT; | 1077 | ret = -EFAULT; |
1076 | else | 1078 | else |
1077 | ret = mtd_do_writeoob(file, mtd, buf.start, | 1079 | ret = mtdchar_writeoob(file, mtd, buf.start, |
1078 | buf.length, compat_ptr(buf.ptr), | 1080 | buf.length, compat_ptr(buf.ptr), |
1079 | &buf_user->length); | 1081 | &buf_user->length); |
1080 | break; | 1082 | break; |
@@ -1089,13 +1091,13 @@ static long mtd_compat_ioctl(struct file *file, unsigned int cmd, | |||
1089 | if (copy_from_user(&buf, argp, sizeof(buf))) | 1091 | if (copy_from_user(&buf, argp, sizeof(buf))) |
1090 | ret = -EFAULT; | 1092 | ret = -EFAULT; |
1091 | else | 1093 | else |
1092 | ret = mtd_do_readoob(file, mtd, buf.start, | 1094 | ret = mtdchar_readoob(file, mtd, buf.start, |
1093 | buf.length, compat_ptr(buf.ptr), | 1095 | buf.length, compat_ptr(buf.ptr), |
1094 | &buf_user->start); | 1096 | &buf_user->start); |
1095 | break; | 1097 | break; |
1096 | } | 1098 | } |
1097 | default: | 1099 | default: |
1098 | ret = mtd_ioctl(file, cmd, (unsigned long)argp); | 1100 | ret = mtdchar_ioctl(file, cmd, (unsigned long)argp); |
1099 | } | 1101 | } |
1100 | 1102 | ||
1101 | mutex_unlock(&mtd_mutex); | 1103 | mutex_unlock(&mtd_mutex); |
@@ -1111,7 +1113,7 @@ static long mtd_compat_ioctl(struct file *file, unsigned int cmd, | |||
1111 | * mappings) | 1113 | * mappings) |
1112 | */ | 1114 | */ |
1113 | #ifndef CONFIG_MMU | 1115 | #ifndef CONFIG_MMU |
1114 | static unsigned long mtd_get_unmapped_area(struct file *file, | 1116 | static unsigned long mtdchar_get_unmapped_area(struct file *file, |
1115 | unsigned long addr, | 1117 | unsigned long addr, |
1116 | unsigned long len, | 1118 | unsigned long len, |
1117 | unsigned long pgoff, | 1119 | unsigned long pgoff, |
@@ -1144,7 +1146,7 @@ static unsigned long mtd_get_unmapped_area(struct file *file, | |||
1144 | /* | 1146 | /* |
1145 | * set up a mapping for shared memory segments | 1147 | * set up a mapping for shared memory segments |
1146 | */ | 1148 | */ |
1147 | static int mtd_mmap(struct file *file, struct vm_area_struct *vma) | 1149 | static int mtdchar_mmap(struct file *file, struct vm_area_struct *vma) |
1148 | { | 1150 | { |
1149 | #ifdef CONFIG_MMU | 1151 | #ifdef CONFIG_MMU |
1150 | struct mtd_file_info *mfi = file->private_data; | 1152 | 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 | 1187 | ||
1186 | static const struct file_operations mtd_fops = { | 1188 | static const struct file_operations mtd_fops = { |
1187 | .owner = THIS_MODULE, | 1189 | .owner = THIS_MODULE, |
1188 | .llseek = mtd_lseek, | 1190 | .llseek = mtdchar_lseek, |
1189 | .read = mtd_read, | 1191 | .read = mtdchar_read, |
1190 | .write = mtd_write, | 1192 | .write = mtdchar_write, |
1191 | .unlocked_ioctl = mtd_unlocked_ioctl, | 1193 | .unlocked_ioctl = mtdchar_unlocked_ioctl, |
1192 | #ifdef CONFIG_COMPAT | 1194 | #ifdef CONFIG_COMPAT |
1193 | .compat_ioctl = mtd_compat_ioctl, | 1195 | .compat_ioctl = mtdchar_compat_ioctl, |
1194 | #endif | 1196 | #endif |
1195 | .open = mtd_open, | 1197 | .open = mtdchar_open, |
1196 | .release = mtd_close, | 1198 | .release = mtdchar_close, |
1197 | .mmap = mtd_mmap, | 1199 | .mmap = mtdchar_mmap, |
1198 | #ifndef CONFIG_MMU | 1200 | #ifndef CONFIG_MMU |
1199 | .get_unmapped_area = mtd_get_unmapped_area, | 1201 | .get_unmapped_area = mtdchar_get_unmapped_area, |
1200 | #endif | 1202 | #endif |
1201 | }; | 1203 | }; |
1202 | 1204 | ||