]> Git Repo - J-linux.git/commitdiff
mtd: spi-nor: replace unnecessary div64_u64() with div_u64()
authorMichael Walle <[email protected]>
Mon, 29 Apr 2024 12:11:13 +0000 (14:11 +0200)
committerPratyush Yadav <[email protected]>
Mon, 29 Apr 2024 15:36:48 +0000 (17:36 +0200)
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]
drivers/mtd/spi-nor/core.c

index 3e1f1913536bf52f14b91e0569cd28e0a7228271..028514c6996f0049b0688365a60f42c5147ee038 100644 (file)
@@ -2893,7 +2893,7 @@ static int spi_nor_late_init_params(struct spi_nor *nor)
                spi_nor_init_default_locking_ops(nor);
 
        if (params->n_banks > 1)
-               params->bank_size = div64_u64(params->size, params->n_banks);
+               params->bank_size = div_u64(params->size, params->n_banks);
 
        return 0;
 }
@@ -3406,7 +3406,7 @@ static int spi_nor_set_mtd_eraseregions(struct spi_nor *nor)
                        return -EINVAL;
 
                mtd_region[i].erasesize = erasesize;
-               mtd_region[i].numblocks = div64_ul(region[i].size, erasesize);
+               mtd_region[i].numblocks = div_u64(region[i].size, erasesize);
                mtd_region[i].offset = region[i].offset;
        }
 
This page took 0.06459 seconds and 4 git commands to generate.