aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/cdev.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd/ubi/cdev.c')
-rw-r--r--drivers/mtd/ubi/cdev.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/drivers/mtd/ubi/cdev.c b/drivers/mtd/ubi/cdev.c
index f8e0f68f2186..f237ddbb2713 100644
--- a/drivers/mtd/ubi/cdev.c
+++ b/drivers/mtd/ubi/cdev.c
@@ -113,7 +113,8 @@ static int vol_cdev_open(struct inode *inode, struct file *file)
113 else 113 else
114 mode = UBI_READONLY; 114 mode = UBI_READONLY;
115 115
116 dbg_gen("open volume %d, mode %d", vol_id, mode); 116 dbg_gen("open device %d, volume %d, mode %d",
117 ubi_num, vol_id, mode);
117 118
118 desc = ubi_open_volume(ubi_num, vol_id, mode); 119 desc = ubi_open_volume(ubi_num, vol_id, mode);
119 if (IS_ERR(desc)) 120 if (IS_ERR(desc))
@@ -128,7 +129,8 @@ static int vol_cdev_release(struct inode *inode, struct file *file)
128 struct ubi_volume_desc *desc = file->private_data; 129 struct ubi_volume_desc *desc = file->private_data;
129 struct ubi_volume *vol = desc->vol; 130 struct ubi_volume *vol = desc->vol;
130 131
131 dbg_gen("release volume %d, mode %d", vol->vol_id, desc->mode); 132 dbg_gen("release device %d, volume %d, mode %d",
133 vol->ubi->ubi_num, vol->vol_id, desc->mode);
132 134
133 if (vol->updating) { 135 if (vol->updating) {
134 ubi_warn("update of volume %d not finished, volume is damaged", 136 ubi_warn("update of volume %d not finished, volume is damaged",
@@ -393,7 +395,7 @@ static ssize_t vol_cdev_write(struct file *file, const char __user *buf,
393 vol->corrupted = 1; 395 vol->corrupted = 1;
394 } 396 }
395 vol->checked = 1; 397 vol->checked = 1;
396 ubi_gluebi_updated(vol); 398 ubi_volume_notify(ubi, vol, UBI_VOLUME_UPDATED);
397 revoke_exclusive(desc, UBI_READWRITE); 399 revoke_exclusive(desc, UBI_READWRITE);
398 } 400 }
399 401
@@ -558,7 +560,7 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd,
558 break; 560 break;
559 } 561 }
560 562
561 /* Set volume property command*/ 563 /* Set volume property command */
562 case UBI_IOCSETPROP: 564 case UBI_IOCSETPROP:
563 { 565 {
564 struct ubi_set_prop_req req; 566 struct ubi_set_prop_req req;
@@ -571,9 +573,9 @@ static long vol_cdev_ioctl(struct file *file, unsigned int cmd,
571 } 573 }
572 switch (req.property) { 574 switch (req.property) {
573 case UBI_PROP_DIRECT_WRITE: 575 case UBI_PROP_DIRECT_WRITE:
574 mutex_lock(&ubi->volumes_mutex); 576 mutex_lock(&ubi->device_mutex);
575 desc->vol->direct_writes = !!req.value; 577 desc->vol->direct_writes = !!req.value;
576 mutex_unlock(&ubi->volumes_mutex); 578 mutex_unlock(&ubi->device_mutex);
577 break; 579 break;
578 default: 580 default:
579 err = -EINVAL; 581 err = -EINVAL;
@@ -810,9 +812,9 @@ static int rename_volumes(struct ubi_device *ubi,
810 re->desc->vol->vol_id, re->desc->vol->name); 812 re->desc->vol->vol_id, re->desc->vol->name);
811 } 813 }
812 814
813 mutex_lock(&ubi->volumes_mutex); 815 mutex_lock(&ubi->device_mutex);
814 err = ubi_rename_volumes(ubi, &rename_list); 816 err = ubi_rename_volumes(ubi, &rename_list);
815 mutex_unlock(&ubi->volumes_mutex); 817 mutex_unlock(&ubi->device_mutex);
816 818
817out_free: 819out_free:
818 list_for_each_entry_safe(re, re1, &rename_list, list) { 820 list_for_each_entry_safe(re, re1, &rename_list, list) {
@@ -856,9 +858,9 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd,
856 if (err) 858 if (err)
857 break; 859 break;
858 860
859 mutex_lock(&ubi->volumes_mutex); 861 mutex_lock(&ubi->device_mutex);
860 err = ubi_create_volume(ubi, &req); 862 err = ubi_create_volume(ubi, &req);
861 mutex_unlock(&ubi->volumes_mutex); 863 mutex_unlock(&ubi->device_mutex);
862 if (err) 864 if (err)
863 break; 865 break;
864 866
@@ -887,9 +889,9 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd,
887 break; 889 break;
888 } 890 }
889 891
890 mutex_lock(&ubi->volumes_mutex); 892 mutex_lock(&ubi->device_mutex);
891 err = ubi_remove_volume(desc, 0); 893 err = ubi_remove_volume(desc, 0);
892 mutex_unlock(&ubi->volumes_mutex); 894 mutex_unlock(&ubi->device_mutex);
893 895
894 /* 896 /*
895 * The volume is deleted (unless an error occurred), and the 897 * The volume is deleted (unless an error occurred), and the
@@ -926,9 +928,9 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd,
926 pebs = div_u64(req.bytes + desc->vol->usable_leb_size - 1, 928 pebs = div_u64(req.bytes + desc->vol->usable_leb_size - 1,
927 desc->vol->usable_leb_size); 929 desc->vol->usable_leb_size);
928 930
929 mutex_lock(&ubi->volumes_mutex); 931 mutex_lock(&ubi->device_mutex);
930 err = ubi_resize_volume(desc, pebs); 932 err = ubi_resize_volume(desc, pebs);
931 mutex_unlock(&ubi->volumes_mutex); 933 mutex_unlock(&ubi->device_mutex);
932 ubi_close_volume(desc); 934 ubi_close_volume(desc);
933 break; 935 break;
934 } 936 }
@@ -952,9 +954,7 @@ static long ubi_cdev_ioctl(struct file *file, unsigned int cmd,
952 break; 954 break;
953 } 955 }
954 956
955 mutex_lock(&ubi->mult_mutex);
956 err = rename_volumes(ubi, req); 957 err = rename_volumes(ubi, req);
957 mutex_unlock(&ubi->mult_mutex);
958 kfree(req); 958 kfree(req);
959 break; 959 break;
960 } 960 }