Merge branch 'stable-3.2' into pandora-3.2
[pandora-kernel.git] / drivers / mtd / ubi / kapi.c
index 5164b72..c36c762 100644 (file)
@@ -221,7 +221,7 @@ out_free:
        kfree(desc);
 out_put_ubi:
        ubi_put_device(ubi);
-       dbg_err("cannot open device %d, volume %d, error %d",
+       ubi_err("cannot open device %d, volume %d, error %d",
                ubi_num, vol_id, err);
        return ERR_PTR(err);
 }
@@ -551,7 +551,7 @@ int ubi_leb_erase(struct ubi_volume_desc *desc, int lnum)
        if (err)
                return err;
 
-       return ubi_wl_flush(ubi);
+       return ubi_wl_flush(ubi, vol->vol_id, lnum);
 }
 EXPORT_SYMBOL_GPL(ubi_leb_erase);
 
@@ -706,6 +706,33 @@ int ubi_sync(int ubi_num)
 }
 EXPORT_SYMBOL_GPL(ubi_sync);
 
+/**
+ * ubi_flush - flush UBI work queue.
+ * @ubi_num: UBI device to flush work queue
+ * @vol_id: volume id to flush for
+ * @lnum: logical eraseblock number to flush for
+ *
+ * This function executes all pending works for a particular volume id / logical
+ * eraseblock number pair. If either value is set to %UBI_ALL, then it acts as
+ * a wildcard for all of the corresponding volume numbers or logical
+ * eraseblock numbers. It returns zero in case of success and a negative error
+ * code in case of failure.
+ */
+int ubi_flush(int ubi_num, int vol_id, int lnum)
+{
+       struct ubi_device *ubi;
+       int err = 0;
+
+       ubi = ubi_get_device(ubi_num);
+       if (!ubi)
+               return -ENODEV;
+
+       err = ubi_wl_flush(ubi, vol_id, lnum);
+       ubi_put_device(ubi);
+       return err;
+}
+EXPORT_SYMBOL_GPL(ubi_flush);
+
 BLOCKING_NOTIFIER_HEAD(ubi_notifiers);
 
 /**