Skip to content

Commit c84b392

Browse files
mwallePratyush Yadav
authored andcommitted
mtd: spi-nor: replace unnecessary div64_u64() with div_u64()
Both occurrences of div64_u64() just have a u8 or u32 divisor. Use div_u64() instead. Many 32 bit architectures can optimize this variant better than a full 64 bit divide. Reported-by: Dan Carpenter <[email protected]> Link: https://lore.kernel.org/r/[email protected]/ Signed-off-by: Michael Walle <[email protected]> Reviewed-by: Pratyush Yadav <[email protected]> [[email protected]: touched up commit message] Signed-off-by: Pratyush Yadav <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 4cece76 commit c84b392

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/mtd/spi-nor/core.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2893,7 +2893,7 @@ static int spi_nor_late_init_params(struct spi_nor *nor)
28932893
spi_nor_init_default_locking_ops(nor);
28942894

28952895
if (params->n_banks > 1)
2896-
params->bank_size = div64_u64(params->size, params->n_banks);
2896+
params->bank_size = div_u64(params->size, params->n_banks);
28972897

28982898
return 0;
28992899
}
@@ -3406,7 +3406,7 @@ static int spi_nor_set_mtd_eraseregions(struct spi_nor *nor)
34063406
return -EINVAL;
34073407

34083408
mtd_region[i].erasesize = erasesize;
3409-
mtd_region[i].numblocks = div64_ul(region[i].size, erasesize);
3409+
mtd_region[i].numblocks = div_u64(region[i].size, erasesize);
34103410
mtd_region[i].offset = region[i].offset;
34113411
}
34123412

0 commit comments

Comments
 (0)