UBI: use nicer 64-bit math
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / drivers / mtd / ubi / scan.c
index 41d47e1cf15c23f8c36423ae3caa4a0e2091e245..c3d653ba5ca0153c45ccbfd21a6d106bfa1b6220 100644 (file)
@@ -42,7 +42,7 @@
 
 #include <linux/err.h>
 #include <linux/crc32.h>
-#include <asm/div64.h>
+#include <linux/math64.h>
 #include "ubi.h"
 
 #ifdef CONFIG_MTD_UBI_DEBUG_PARANOID
@@ -478,7 +478,7 @@ int ubi_scan_add_used(struct ubi_device *ubi, struct ubi_scan_info *si,
                        return 0;
                } else {
                        /*
-                        * This logical eraseblock is older then the one found
+                        * This logical eraseblock is older than the one found
                         * previously.
                         */
                        if (cmp_res & 4)
@@ -904,10 +904,8 @@ struct ubi_scan_info *ubi_scan(struct ubi_device *ubi)
        dbg_msg("scanning is finished");
 
        /* Calculate mean erase counter */
-       if (si->ec_count) {
-               do_div(si->ec_sum, si->ec_count);
-               si->mean_ec = si->ec_sum;
-       }
+       if (si->ec_count)
+               si->mean_ec = div_u64(si->ec_sum, si->ec_count);
 
        if (si->is_empty)
                ubi_msg("empty MTD device detected");