diff options
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/ftl.c | 4 | ||||
-rw-r--r-- | drivers/mtd/maps/pcmciamtd.c | 9 | ||||
-rw-r--r-- | drivers/mtd/mtdchar.c | 22 | ||||
-rw-r--r-- | drivers/mtd/ubi/cdev.c | 7 |
4 files changed, 24 insertions, 18 deletions
diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c index 4a79b187b568..5c29872184e6 100644 --- a/drivers/mtd/ftl.c +++ b/drivers/mtd/ftl.c | |||
@@ -130,10 +130,6 @@ typedef struct partition_t { | |||
130 | u_int16_t DataUnits; | 130 | u_int16_t DataUnits; |
131 | u_int32_t BlocksPerUnit; | 131 | u_int32_t BlocksPerUnit; |
132 | erase_unit_header_t header; | 132 | erase_unit_header_t header; |
133 | #if 0 | ||
134 | region_info_t region; | ||
135 | memory_handle_t handle; | ||
136 | #endif | ||
137 | } partition_t; | 133 | } partition_t; |
138 | 134 | ||
139 | /* Partition state flags */ | 135 | /* Partition state flags */ |
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index 1912d968718b..0cc31675aeb9 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c | |||
@@ -498,17 +498,14 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
498 | int i; | 498 | int i; |
499 | config_info_t t; | 499 | config_info_t t; |
500 | static char *probes[] = { "jedec_probe", "cfi_probe" }; | 500 | static char *probes[] = { "jedec_probe", "cfi_probe" }; |
501 | cisinfo_t cisinfo; | ||
502 | int new_name = 0; | 501 | int new_name = 0; |
503 | 502 | ||
504 | DEBUG(3, "link=0x%p", link); | 503 | DEBUG(3, "link=0x%p", link); |
505 | 504 | ||
506 | DEBUG(2, "Validating CIS"); | 505 | DEBUG(2, "Validating CIS"); |
507 | ret = pcmcia_validate_cis(link, &cisinfo); | 506 | ret = pcmcia_validate_cis(link, NULL); |
508 | if(ret != CS_SUCCESS) { | 507 | if(ret != CS_SUCCESS) { |
509 | cs_error(link, GetTupleData, ret); | 508 | cs_error(link, GetTupleData, ret); |
510 | } else { | ||
511 | DEBUG(2, "ValidateCIS found %d chains", cisinfo.Chains); | ||
512 | } | 509 | } |
513 | 510 | ||
514 | card_settings(dev, link, &new_name); | 511 | card_settings(dev, link, &new_name); |
@@ -563,9 +560,7 @@ static int pcmciamtd_config(struct pcmcia_device *link) | |||
563 | DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); | 560 | DEBUG(1, "Allocated a window of %dKiB", dev->win_size >> 10); |
564 | 561 | ||
565 | /* Get write protect status */ | 562 | /* Get write protect status */ |
566 | CS_CHECK(GetStatus, pcmcia_get_status(link, &status)); | 563 | DEBUG(2, "window handle = 0x%8.8lx", (unsigned long)link->win); |
567 | DEBUG(2, "status value: 0x%x window handle = 0x%8.8lx", | ||
568 | status.CardState, (unsigned long)link->win); | ||
569 | dev->win_base = ioremap(req.Base, req.Size); | 564 | dev->win_base = ioremap(req.Base, req.Size); |
570 | if(!dev->win_base) { | 565 | if(!dev->win_base) { |
571 | err("ioremap(%lu, %u) failed", req.Base, req.Size); | 566 | err("ioremap(%lu, %u) failed", req.Base, req.Size); |
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 5d3ac512ce16..129d429cd2da 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include <linux/module.h> | 14 | #include <linux/module.h> |
15 | #include <linux/slab.h> | 15 | #include <linux/slab.h> |
16 | #include <linux/sched.h> | 16 | #include <linux/sched.h> |
17 | #include <linux/smp_lock.h> | ||
17 | 18 | ||
18 | #include <linux/mtd/mtd.h> | 19 | #include <linux/mtd/mtd.h> |
19 | #include <linux/mtd/compatmac.h> | 20 | #include <linux/mtd/compatmac.h> |
@@ -86,6 +87,7 @@ static int mtd_open(struct inode *inode, struct file *file) | |||
86 | { | 87 | { |
87 | int minor = iminor(inode); | 88 | int minor = iminor(inode); |
88 | int devnum = minor >> 1; | 89 | int devnum = minor >> 1; |
90 | int ret = 0; | ||
89 | struct mtd_info *mtd; | 91 | struct mtd_info *mtd; |
90 | struct mtd_file_info *mfi; | 92 | struct mtd_file_info *mfi; |
91 | 93 | ||
@@ -98,31 +100,39 @@ static int mtd_open(struct inode *inode, struct file *file) | |||
98 | if ((file->f_mode & 2) && (minor & 1)) | 100 | if ((file->f_mode & 2) && (minor & 1)) |
99 | return -EACCES; | 101 | return -EACCES; |
100 | 102 | ||
103 | lock_kernel(); | ||
101 | mtd = get_mtd_device(NULL, devnum); | 104 | mtd = get_mtd_device(NULL, devnum); |
102 | 105 | ||
103 | if (IS_ERR(mtd)) | 106 | if (IS_ERR(mtd)) { |
104 | return PTR_ERR(mtd); | 107 | ret = PTR_ERR(mtd); |
108 | goto out; | ||
109 | } | ||
105 | 110 | ||
106 | if (MTD_ABSENT == mtd->type) { | 111 | if (MTD_ABSENT == mtd->type) { |
107 | put_mtd_device(mtd); | 112 | put_mtd_device(mtd); |
108 | return -ENODEV; | 113 | ret = -ENODEV; |
114 | goto out; | ||
109 | } | 115 | } |
110 | 116 | ||
111 | /* You can't open it RW if it's not a writeable device */ | 117 | /* You can't open it RW if it's not a writeable device */ |
112 | if ((file->f_mode & 2) && !(mtd->flags & MTD_WRITEABLE)) { | 118 | if ((file->f_mode & 2) && !(mtd->flags & MTD_WRITEABLE)) { |
113 | put_mtd_device(mtd); | 119 | put_mtd_device(mtd); |
114 | return -EACCES; | 120 | ret = -EACCES; |
121 | goto out; | ||
115 | } | 122 | } |
116 | 123 | ||
117 | mfi = kzalloc(sizeof(*mfi), GFP_KERNEL); | 124 | mfi = kzalloc(sizeof(*mfi), GFP_KERNEL); |
118 | if (!mfi) { | 125 | if (!mfi) { |
119 | put_mtd_device(mtd); | 126 | put_mtd_device(mtd); |
120 | return -ENOMEM; | 127 | ret = -ENOMEM; |
128 | goto out; | ||
121 | } | 129 | } |
122 | mfi->mtd = mtd; | 130 | mfi->mtd = mtd; |
123 | file->private_data = mfi; | 131 | file->private_data = mfi; |
124 | 132 | ||
125 | return 0; | 133 | out: |
134 | unlock_kernel(); | ||
135 | return ret; | ||
126 | } /* mtd_open */ | 136 | } /* mtd_open */ |
127 | 137 | ||
128 | /*====================================================================*/ | 138 | /*====================================================================*/ |
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c index 9d6aae5449b6..89193ba9451e 100644 --- a/drivers/mtd/ubi/cdev.c +++ b/drivers/mtd/ubi/cdev.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/stat.h> | 39 | #include <linux/stat.h> |
40 | #include <linux/ioctl.h> | 40 | #include <linux/ioctl.h> |
41 | #include <linux/capability.h> | 41 | #include <linux/capability.h> |
42 | #include <linux/smp_lock.h> | ||
42 | #include <mtd/ubi-user.h> | 43 | #include <mtd/ubi-user.h> |
43 | #include <asm/uaccess.h> | 44 | #include <asm/uaccess.h> |
44 | #include <asm/div64.h> | 45 | #include <asm/div64.h> |
@@ -103,9 +104,12 @@ static int vol_cdev_open(struct inode *inode, struct file *file) | |||
103 | struct ubi_volume_desc *desc; | 104 | struct ubi_volume_desc *desc; |
104 | int vol_id = iminor(inode) - 1, mode, ubi_num; | 105 | int vol_id = iminor(inode) - 1, mode, ubi_num; |
105 | 106 | ||
107 | lock_kernel(); | ||
106 | ubi_num = ubi_major2num(imajor(inode)); | 108 | ubi_num = ubi_major2num(imajor(inode)); |
107 | if (ubi_num < 0) | 109 | if (ubi_num < 0) { |
110 | unlock_kernel(); | ||
108 | return ubi_num; | 111 | return ubi_num; |
112 | } | ||
109 | 113 | ||
110 | if (file->f_mode & FMODE_WRITE) | 114 | if (file->f_mode & FMODE_WRITE) |
111 | mode = UBI_READWRITE; | 115 | mode = UBI_READWRITE; |
@@ -115,6 +119,7 @@ static int vol_cdev_open(struct inode *inode, struct file *file) | |||
115 | dbg_msg("open volume %d, mode %d", vol_id, mode); | 119 | dbg_msg("open volume %d, mode %d", vol_id, mode); |
116 | 120 | ||
117 | desc = ubi_open_volume(ubi_num, vol_id, mode); | 121 | desc = ubi_open_volume(ubi_num, vol_id, mode); |
122 | unlock_kernel(); | ||
118 | if (IS_ERR(desc)) | 123 | if (IS_ERR(desc)) |
119 | return PTR_ERR(desc); | 124 | return PTR_ERR(desc); |
120 | 125 | ||