diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mtd/maps/scb2_flash.c | 3 | ||||
-rw-r--r-- | drivers/mtd/mtdchar.c | 15 | ||||
-rw-r--r-- | drivers/mtd/mtdconcat.c | 18 | ||||
-rw-r--r-- | drivers/mtd/mtdcore.c | 6 |
4 files changed, 13 insertions, 29 deletions
diff --git a/drivers/mtd/maps/scb2_flash.c b/drivers/mtd/maps/scb2_flash.c index 01af34778de3..934a72c80078 100644 --- a/drivers/mtd/maps/scb2_flash.c +++ b/drivers/mtd/maps/scb2_flash.c | |||
@@ -204,8 +204,7 @@ scb2_flash_remove(struct pci_dev *dev) | |||
204 | return; | 204 | return; |
205 | 205 | ||
206 | /* disable flash writes */ | 206 | /* disable flash writes */ |
207 | if (scb2_mtd->lock) | 207 | mtd_lock(scb2_mtd, 0, scb2_mtd->size); |
208 | mtd_lock(scb2_mtd, 0, scb2_mtd->size); | ||
209 | 208 | ||
210 | mtd_device_unregister(scb2_mtd); | 209 | mtd_device_unregister(scb2_mtd); |
211 | map_destroy(scb2_mtd); | 210 | map_destroy(scb2_mtd); |
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c index 23a51104aeb5..92da621b1425 100644 --- a/drivers/mtd/mtdchar.c +++ b/drivers/mtd/mtdchar.c | |||
@@ -814,10 +814,7 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) | |||
814 | if (copy_from_user(&einfo, argp, sizeof(einfo))) | 814 | if (copy_from_user(&einfo, argp, sizeof(einfo))) |
815 | return -EFAULT; | 815 | return -EFAULT; |
816 | 816 | ||
817 | if (!mtd->lock) | 817 | ret = mtd_lock(mtd, einfo.start, einfo.length); |
818 | ret = -EOPNOTSUPP; | ||
819 | else | ||
820 | ret = mtd_lock(mtd, einfo.start, einfo.length); | ||
821 | break; | 818 | break; |
822 | } | 819 | } |
823 | 820 | ||
@@ -828,10 +825,7 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) | |||
828 | if (copy_from_user(&einfo, argp, sizeof(einfo))) | 825 | if (copy_from_user(&einfo, argp, sizeof(einfo))) |
829 | return -EFAULT; | 826 | return -EFAULT; |
830 | 827 | ||
831 | if (!mtd->unlock) | 828 | ret = mtd_unlock(mtd, einfo.start, einfo.length); |
832 | ret = -EOPNOTSUPP; | ||
833 | else | ||
834 | ret = mtd_unlock(mtd, einfo.start, einfo.length); | ||
835 | break; | 829 | break; |
836 | } | 830 | } |
837 | 831 | ||
@@ -842,10 +836,7 @@ static int mtdchar_ioctl(struct file *file, u_int cmd, u_long arg) | |||
842 | if (copy_from_user(&einfo, argp, sizeof(einfo))) | 836 | if (copy_from_user(&einfo, argp, sizeof(einfo))) |
843 | return -EFAULT; | 837 | return -EFAULT; |
844 | 838 | ||
845 | if (!mtd->is_locked) | 839 | ret = mtd_is_locked(mtd, einfo.start, einfo.length); |
846 | ret = -EOPNOTSUPP; | ||
847 | else | ||
848 | ret = mtd_is_locked(mtd, einfo.start, einfo.length); | ||
849 | break; | 840 | break; |
850 | } | 841 | } |
851 | 842 | ||
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index 9119f76f87ff..aaafb5e18765 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c | |||
@@ -555,12 +555,9 @@ static int concat_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) | |||
555 | else | 555 | else |
556 | size = len; | 556 | size = len; |
557 | 557 | ||
558 | if (subdev->lock) { | 558 | err = mtd_lock(subdev, ofs, size); |
559 | err = mtd_lock(subdev, ofs, size); | 559 | if (err) |
560 | if (err) | 560 | break; |
561 | break; | ||
562 | } else | ||
563 | err = -EOPNOTSUPP; | ||
564 | 561 | ||
565 | len -= size; | 562 | len -= size; |
566 | if (len == 0) | 563 | if (len == 0) |
@@ -595,12 +592,9 @@ static int concat_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) | |||
595 | else | 592 | else |
596 | size = len; | 593 | size = len; |
597 | 594 | ||
598 | if (subdev->unlock) { | 595 | err = mtd_unlock(subdev, ofs, size); |
599 | err = mtd_unlock(subdev, ofs, size); | 596 | if (err) |
600 | if (err) | 597 | break; |
601 | break; | ||
602 | } else | ||
603 | err = -EOPNOTSUPP; | ||
604 | 598 | ||
605 | len -= size; | 599 | len -= size; |
606 | if (len == 0) | 600 | if (len == 0) |
diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 4d0f3e557bd1..66494ee5355a 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c | |||
@@ -339,9 +339,9 @@ int add_mtd_device(struct mtd_info *mtd) | |||
339 | mtd->writesize_mask = (1 << mtd->writesize_shift) - 1; | 339 | mtd->writesize_mask = (1 << mtd->writesize_shift) - 1; |
340 | 340 | ||
341 | /* Some chips always power up locked. Unlock them now */ | 341 | /* Some chips always power up locked. Unlock them now */ |
342 | if ((mtd->flags & MTD_WRITEABLE) | 342 | if ((mtd->flags & MTD_WRITEABLE) && (mtd->flags & MTD_POWERUP_LOCK)) { |
343 | && (mtd->flags & MTD_POWERUP_LOCK) && mtd->unlock) { | 343 | error = mtd_unlock(mtd, 0, mtd->size); |
344 | if (mtd_unlock(mtd, 0, mtd->size)) | 344 | if (error && error != -EOPNOTSUPP) |
345 | printk(KERN_WARNING | 345 | printk(KERN_WARNING |
346 | "%s: unlock failed, writes may not work\n", | 346 | "%s: unlock failed, writes may not work\n", |
347 | mtd->name); | 347 | mtd->name); |