Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 311868
b: refs/heads/master
c: 596fd46
h: refs/heads/master
v: v3
  • Loading branch information
Herton Ronaldo Krzesinski authored and David Woodhouse committed Jul 6, 2012
1 parent 7f2e1bc commit 30845a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 021796b892dcad45743f3196e3eef7222870dd55
refs/heads/master: 596fd46268634082314b3af1ded4612e1b7f3f03
12 changes: 3 additions & 9 deletions trunk/drivers/mtd/nand/nandsim.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/vmalloc.h>
#include <asm/div64.h>
#include <linux/math64.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/string.h>
Expand Down Expand Up @@ -546,12 +546,6 @@ static char *get_partition_name(int i)
return kstrdup(buf, GFP_KERNEL);
}

static uint64_t divide(uint64_t n, uint32_t d)
{
do_div(n, d);
return n;
}

/*
* Initialize the nandsim structure.
*
Expand Down Expand Up @@ -580,7 +574,7 @@ static int init_nandsim(struct mtd_info *mtd)
ns->geom.oobsz = mtd->oobsize;
ns->geom.secsz = mtd->erasesize;
ns->geom.pgszoob = ns->geom.pgsz + ns->geom.oobsz;
ns->geom.pgnum = divide(ns->geom.totsz, ns->geom.pgsz);
ns->geom.pgnum = div_u64(ns->geom.totsz, ns->geom.pgsz);
ns->geom.totszoob = ns->geom.totsz + (uint64_t)ns->geom.pgnum * ns->geom.oobsz;
ns->geom.secshift = ffs(ns->geom.secsz) - 1;
ns->geom.pgshift = chip->page_shift;
Expand Down Expand Up @@ -921,7 +915,7 @@ static int setup_wear_reporting(struct mtd_info *mtd)

if (!rptwear)
return 0;
wear_eb_count = divide(mtd->size, mtd->erasesize);
wear_eb_count = div_u64(mtd->size, mtd->erasesize);
mem = wear_eb_count * sizeof(unsigned long);
if (mem / sizeof(unsigned long) != wear_eb_count) {
NS_ERR("Too many erase blocks for wear reporting\n");
Expand Down

0 comments on commit 30845a0

Please sign in to comment.