From d44f0bbbd8d182debcce88bda55b05269f3d33d6 Mon Sep 17 00:00:00 2001 From: Aapo Vienamo Date: Wed, 13 Mar 2024 19:34:24 +0200 Subject: mtd: core: Report error if first mtd_otp_size() call fails in mtd_otp_nvmem_add() Jump to the error reporting code in mtd_otp_nvmem_add() if the mtd_otp_size() call fails. Without this fix, the error is not logged. Signed-off-by: Aapo Vienamo Reviewed-by: Mika Westerberg Reviewed-by: Michael Walle Fixes: 4b361cfa8624 ("mtd: core: add OTP nvmem provider support") Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20240313173425.1325790-2-aapo.vienamo@linux.intel.com --- drivers/mtd/mtdcore.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 5887feb347a4..c365c97e7232 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -956,8 +956,10 @@ static int mtd_otp_nvmem_add(struct mtd_info *mtd) if (mtd->_get_user_prot_info && mtd->_read_user_prot_reg) { size = mtd_otp_size(mtd, true); - if (size < 0) - return size; + if (size < 0) { + err = size; + goto err; + } if (size > 0) { nvmem = mtd_otp_nvmem_register(mtd, "user-otp", size, -- cgit v1.2.3 From fe0b8213c0129ff2419458343d8d8e716b1495c0 Mon Sep 17 00:00:00 2001 From: Aapo Vienamo Date: Wed, 13 Mar 2024 19:34:25 +0200 Subject: mtd: core: Don't fail mtd_otp_nvmem_add() if OTP is unsupported Handle the case where -EOPNOTSUPP is returned from OTP driver. This addresses an issue that occurs with the Intel SPI flash controller, which has a limited supported opcode set. Whilst the OTP functionality is not available due to this restriction, other parts of the MTD functionality of the device are intact. This change allows the driver to gracefully handle the restriction by allowing the supported functionality to remain available instead of failing the probe altogether. Signed-off-by: Aapo Vienamo Reviewed-by: Mika Westerberg Reviewed-by: Michael Walle Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20240313173425.1325790-3-aapo.vienamo@linux.intel.com --- drivers/mtd/mtdcore.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index c365c97e7232..9e18422fdc77 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -1014,7 +1014,11 @@ static int mtd_otp_nvmem_add(struct mtd_info *mtd) err: nvmem_unregister(mtd->otp_user_nvmem); - return dev_err_probe(dev, err, "Failed to register OTP NVMEM device\n"); + /* Don't report error if OTP is not supported. */ + if (err != -EOPNOTSUPP) + return dev_err_probe(dev, err, + "Failed to register OTP NVMEM device\n"); + return 0; } /** -- cgit v1.2.3 From 26729dbb53ac575635ef96ece0442165efa9613f Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Wed, 13 Mar 2024 19:43:17 +0100 Subject: dt-bindings: mtd: Add Samsung S5Pv210 OneNAND Document binding for Samsung S5Pv210 SoC OneNAND controller used already in S5Pv210 DTS. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Rob Herring Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20240313184317.18466-1-krzysztof.kozlowski@linaro.org --- .../bindings/mtd/samsung,s5pv210-onenand.yaml | 65 ++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/samsung,s5pv210-onenand.yaml diff --git a/Documentation/devicetree/bindings/mtd/samsung,s5pv210-onenand.yaml b/Documentation/devicetree/bindings/mtd/samsung,s5pv210-onenand.yaml new file mode 100644 index 000000000000..e07941b69904 --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/samsung,s5pv210-onenand.yaml @@ -0,0 +1,65 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mtd/samsung,s5pv210-onenand.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Samsung S5Pv210 SoC OneNAND Controller + +maintainers: + - Krzysztof Kozlowski + +properties: + compatible: + enum: + - samsung,s5pv210-onenand + + reg: + items: + - description: Control registers + - description: OneNAND interface nCE[0] + - description: OneNAND interface nCE[1] + + clocks: + maxItems: 2 + + clock-names: + items: + - const: bus + - const: onenand + + interrupts: + maxItems: 1 + +required: + - compatible + - reg + - clocks + - clock-names + - interrupts + +allOf: + - $ref: nand-controller.yaml + +unevaluatedProperties: false + +examples: + - | + #include + + nand-controller@b0600000 { + compatible = "samsung,s5pv210-onenand"; + reg = <0xb0600000 0x2000>, + <0xb0000000 0x20000>, + <0xb0040000 0x20000>; + clocks = <&clocks CLK_NANDXL>, <&clocks DOUT_FLASH>; + clock-names = "bus", "onenand"; + interrupt-parent = <&vic1>; + interrupts = <31>; + #address-cells = <1>; + #size-cells = <0>; + + nand@0 { + reg = <0>; + }; + }; -- cgit v1.2.3 From 1162bc2f8f5de7da23d18aa4b7fbd4e93c369c50 Mon Sep 17 00:00:00 2001 From: Denis Arefev Date: Fri, 15 Mar 2024 12:37:58 +0300 Subject: mtd: partitions: redboot: Added conversion of operands to a larger type The value of an arithmetic expression directory * master->erasesize is subject to overflow due to a failure to cast operands to a larger data type before perfroming arithmetic Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Denis Arefev Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20240315093758.20790-1-arefev@swemel.ru --- drivers/mtd/parsers/redboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/parsers/redboot.c b/drivers/mtd/parsers/redboot.c index a16b42a88581..3b55b676ca6b 100644 --- a/drivers/mtd/parsers/redboot.c +++ b/drivers/mtd/parsers/redboot.c @@ -102,7 +102,7 @@ nogood: offset -= master->erasesize; } } else { - offset = directory * master->erasesize; + offset = (unsigned long) directory * master->erasesize; while (mtd_block_isbad(master, offset)) { offset += master->erasesize; if (offset == master->size) -- cgit v1.2.3 From 31e6bb6787e730ddedf5cc9b90863c5ff438ead7 Mon Sep 17 00:00:00 2001 From: Bastien Curutchet Date: Fri, 8 Mar 2024 08:46:09 +0100 Subject: mtd: rawnand: davinci: Add dummy read after sending command Sometimes, writes fail because the tWB_max is not correctly observed after sending PAGEPROG. It leads to the R/B pin to be read as in the "ready" state right after sending the command, thus preventing the normal tPROG delay to be actually observed. This happens because the ndelay() that waits for tWB_max starts before the command reaches the NAND chip. Add a dummy read when a delay is requested at the end of the executed instruction to make sure that the sent command is received by the NAND before starting the short ndelay() (<1us but rounded up to 1us in practice). This read is done on the control register area because doing it on the Async Data area would change the NAND's RE pin state. This is not perfect as the two areas are behind two different devm_ioremap_resource() and could possibly be located on different interconnects (I did not find more details). This means either the additional latency due to the load operation is enough impacting, or it has the expected behavior of ensuring the write has been received. This has been tested on two platforms designed off of the DAVINCI/OMAP-L138. The first uses a Toshiba NAND Flash (TC58NYG2S3EBAI5), the other a Macronix one (MX30UF4G18AC). Signed-off-by: Bastien Curutchet Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20240308074609.9056-1-bastien.curutchet@bootlin.com --- drivers/mtd/nand/raw/davinci_nand.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/davinci_nand.c b/drivers/mtd/nand/raw/davinci_nand.c index e75d81cf8c21..051deea768db 100644 --- a/drivers/mtd/nand/raw/davinci_nand.c +++ b/drivers/mtd/nand/raw/davinci_nand.c @@ -671,8 +671,11 @@ static int davinci_nand_exec_instr(struct davinci_nand_info *info, break; } - if (instr->delay_ns) + if (instr->delay_ns) { + /* Dummy read to be sure that command is sent before ndelay starts */ + davinci_nand_readl(info, 0); ndelay(instr->delay_ns); + } return 0; } -- cgit v1.2.3 From 6819db94e1cd3ce24a432f3616cd563ed0c4eaba Mon Sep 17 00:00:00 2001 From: Maxim Korotkov Date: Wed, 13 Mar 2024 13:27:20 +0300 Subject: mtd: rawnand: hynix: fixed typo The function hynix_nand_rr_init() should probably return an error code. Judging by the usage, it seems that the return code is passed up the call stack. Right now, it always returns 0 and the function hynix_nand_cleanup() in hynix_nand_init() has never been called. Found by RASU JSC and Linux Verification Center (linuxtesting.org) Fixes: 626994e07480 ("mtd: nand: hynix: Add read-retry support for 1x nm MLC NANDs") Signed-off-by: Maxim Korotkov Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20240313102721.1991299-1-korotkov.maxim.s@gmail.com --- drivers/mtd/nand/raw/nand_hynix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/nand_hynix.c b/drivers/mtd/nand/raw/nand_hynix.c index a74e64e0cfa3..c02e50608816 100644 --- a/drivers/mtd/nand/raw/nand_hynix.c +++ b/drivers/mtd/nand/raw/nand_hynix.c @@ -401,7 +401,7 @@ static int hynix_nand_rr_init(struct nand_chip *chip) if (ret) pr_warn("failed to initialize read-retry infrastructure"); - return 0; + return ret; } static void hynix_nand_extract_oobsize(struct nand_chip *chip, -- cgit v1.2.3 From 5043e5553601504995300c98141230f5edd11933 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Mon, 25 Mar 2024 17:11:50 +0200 Subject: mtd: core: Align comment with an action in mtd_otp_nvmem_add() The comment is related to the non-error case, make it more clear by inverting the condition. It also makes code neater at the end. Signed-off-by: Andy Shevchenko Reviewed-by: Pratyush Yadav Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20240325151150.3368658-1-andriy.shevchenko@linux.intel.com --- drivers/mtd/mtdcore.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c index 9e18422fdc77..d0c231600f84 100644 --- a/drivers/mtd/mtdcore.c +++ b/drivers/mtd/mtdcore.c @@ -1015,10 +1015,9 @@ static int mtd_otp_nvmem_add(struct mtd_info *mtd) err: nvmem_unregister(mtd->otp_user_nvmem); /* Don't report error if OTP is not supported. */ - if (err != -EOPNOTSUPP) - return dev_err_probe(dev, err, - "Failed to register OTP NVMEM device\n"); - return 0; + if (err == -EOPNOTSUPP) + return 0; + return dev_err_probe(dev, err, "Failed to register OTP NVMEM device\n"); } /** -- cgit v1.2.3 From 3ef4600f12269d489933b3835fe8d43621e4ee6c Mon Sep 17 00:00:00 2001 From: Erick Archer Date: Sat, 30 Mar 2024 18:55:35 +0100 Subject: mtd: maps: sa1100-flash: Prefer struct_size over open coded arithmetic This is an effort to get rid of all multiplications from allocation functions in order to prevent integer overflows [1][2]. As the "info" variable is a pointer to "struct sa_info" and this structure ends in a flexible array: struct sa_info { [...] struct sa_subdev_info subdev[]; }; the preferred way in the kernel is to use the struct_size() helper to do the arithmetic instead of the calculation "size + size * count" in the kzalloc() function. This way, the code is more readable and safer. This code was detected with the help of Coccinelle, and audited and modified manually. Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#open-coded-arithmetic-in-allocator-arguments [1] Link: https://github.com/KSPP/linux/issues/160 [2] Signed-off-by: Erick Archer Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/AS8PR02MB7237AC633B0D1D2EBD3C40E98B392@AS8PR02MB7237.eurprd02.prod.outlook.com --- drivers/mtd/maps/sa1100-flash.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/mtd/maps/sa1100-flash.c b/drivers/mtd/maps/sa1100-flash.c index d4ce2376d33f..ac8a0a19a021 100644 --- a/drivers/mtd/maps/sa1100-flash.c +++ b/drivers/mtd/maps/sa1100-flash.c @@ -153,7 +153,7 @@ static struct sa_info *sa1100_setup_mtd(struct platform_device *pdev, struct flash_platform_data *plat) { struct sa_info *info; - int nr, size, i, ret = 0; + int nr, i, ret = 0; /* * Count number of devices. @@ -167,12 +167,10 @@ static struct sa_info *sa1100_setup_mtd(struct platform_device *pdev, goto out; } - size = sizeof(struct sa_info) + sizeof(struct sa_subdev_info) * nr; - /* * Allocate the map_info structs in one go. */ - info = kzalloc(size, GFP_KERNEL); + info = kzalloc(struct_size(info, subdev, nr), GFP_KERNEL); if (!info) { ret = -ENOMEM; goto out; -- cgit v1.2.3 From d8d42d47a9ff9a997abccab1e4ebffe4fce28f32 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 12 Apr 2024 09:32:48 -0600 Subject: dt-bindings: mtd: fixed-partitions: Add alignment properties Add three properties for controlling alignment of partitions, aka 'entries' in fixed-partition. For now there is no explicit mention of hierarchy, so a 'section' is just the 'fixed-partitions' node. These new properties are inputs to the Binman packaging process, but are also needed if the firmware is repacked, to ensure that alignment constraints are not violated. Therefore they are provided as part of the schema. Signed-off-by: Simon Glass Reviewed-by: Rob Herring Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20240412153249.100787-1-sjg@chromium.org --- .../bindings/mtd/partitions/partition.yaml | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/Documentation/devicetree/bindings/mtd/partitions/partition.yaml b/Documentation/devicetree/bindings/mtd/partitions/partition.yaml index 1ebe9e2347ea..31bbeb161396 100644 --- a/Documentation/devicetree/bindings/mtd/partitions/partition.yaml +++ b/Documentation/devicetree/bindings/mtd/partitions/partition.yaml @@ -57,6 +57,57 @@ properties: user space from type: boolean + align: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 2 + maximum: 0x80000000 + multipleOf: 2 + description: + This sets the alignment of the entry in bytes. + + The entry offset is adjusted so that the entry starts on an aligned + boundary within the containing section or image. For example ‘align = + <16>’ means that the entry will start on a 16-byte boundary. This may + mean that padding is added before the entry. The padding is part of + the containing section but is not included in the entry, meaning that + an empty space may be created before the entry starts. Alignment + must be a power of 2. If ‘align’ is not provided, no alignment is + performed. + + align-size: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 2 + maximum: 0x80000000 + multipleOf: 2 + description: + This sets the alignment of the entry size in bytes. It must be a power + of 2. + + For example, to ensure that the size of an entry is a multiple of 64 + bytes, set this to 64. While this does not affect the content of the + entry itself (the padding is performed only when its parent section is + assembled), the end result is that the entry ends with the padding + bytes, so may grow. If ‘align-size’ is not provided, no alignment is + performed. + + align-end: + $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 2 + maximum: 0x80000000 + multipleOf: 2 + description: + This sets the alignment (in bytes) of the end of an entry with respect + to the containing section. It must be a power of 2. + + Some entries require that they end on an alignment boundary, + regardless of where they start. This does not move the start of the + entry, so the content of the entry will still start at the beginning. + But there may be padding at the end. While this does not affect the + content of the entry itself (the padding is performed only when its + parent section is assembled), the end result is that the entry ends + with the padding bytes, so may grow. If ‘align-end’ is not provided, + no alignment is performed. + if: not: required: [ reg ] -- cgit v1.2.3 From f48d2d6ebd3bde515f4725a88e53953cd6eccc29 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 12 Apr 2024 09:32:49 -0600 Subject: dt-bindings: mtd: fixed-partition: Add binman compatibles Add two compatibles for binman entries, as a starting point for the schema. Note that, after discussion on v2, we decided to keep the existing meaning of label so as not to require changes to existing userspace software when moving to use binman nodes to specify the firmware layout. Note also that, after discussion on v6, we decided to use the same 'fixed-partition' schema for the binman features, so this version adds a new 'binman.yaml' file providing the new compatibles to the existing partition.yaml binding. Signed-off-by: Simon Glass Reviewed-by: Rob Herring Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20240412153249.100787-2-sjg@chromium.org --- .../devicetree/bindings/mtd/partitions/binman.yaml | 53 ++++++++++++++++++++++ .../bindings/mtd/partitions/partition.yaml | 21 +++++++++ MAINTAINERS | 5 ++ 3 files changed, 79 insertions(+) create mode 100644 Documentation/devicetree/bindings/mtd/partitions/binman.yaml diff --git a/Documentation/devicetree/bindings/mtd/partitions/binman.yaml b/Documentation/devicetree/bindings/mtd/partitions/binman.yaml new file mode 100644 index 000000000000..bb4b08546184 --- /dev/null +++ b/Documentation/devicetree/bindings/mtd/partitions/binman.yaml @@ -0,0 +1,53 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/mtd/partitions/binman.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Binman entries + +description: | + This corresponds to a binman 'entry'. It is a single partition which holds + data of a defined type. + + Binman uses the type to indicate what data file / type to place in the + partition. There are quite a number of binman-specific entry types, such as + section, fill and files, to be added later. + +maintainers: + - Simon Glass + +allOf: + - $ref: /schemas/mtd/partitions/partition.yaml# + +properties: + compatible: + enum: + - u-boot # u-boot.bin from U-Boot project + - tfa-bl31 # bl31.bin or bl31.elf from TF-A project + +required: + - compatible + +unevaluatedProperties: false + +examples: + - | + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@100000 { + compatible = "u-boot"; + reg = <0x100000 0xf00000>; + align-size = <0x1000>; + align-end = <0x10000>; + }; + + partition@200000 { + compatible = "tfa-bl31"; + reg = <0x200000 0x100000>; + align = <0x4000>; + }; + }; diff --git a/Documentation/devicetree/bindings/mtd/partitions/partition.yaml b/Documentation/devicetree/bindings/mtd/partitions/partition.yaml index 31bbeb161396..80d0452a2a33 100644 --- a/Documentation/devicetree/bindings/mtd/partitions/partition.yaml +++ b/Documentation/devicetree/bindings/mtd/partitions/partition.yaml @@ -118,3 +118,24 @@ then: # This is a generic file other binding inherit from and extend additionalProperties: true + +examples: + - | + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition@100000 { + compatible = "u-boot"; + reg = <0x100000 0xf00000>; + align-size = <0x1000>; + align-end = <0x10000>; + }; + + partition@200000 { + compatible = "tfa-bl31"; + reg = <0x200000 0x100000>; + align = <0x4000>; + }; + }; diff --git a/MAINTAINERS b/MAINTAINERS index aa3b947fb080..317bf0a55844 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -3611,6 +3611,11 @@ F: Documentation/filesystems/bfs.rst F: fs/bfs/ F: include/uapi/linux/bfs_fs.h +BINMAN +M: Simon Glass +S: Supported +F: Documentation/devicetree/bindings/mtd/partitions/binman* + BITMAP API M: Yury Norov R: Rasmus Villemoes -- cgit v1.2.3 From 6277967d872e229de53b0585ebc34c8172965492 Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Sun, 14 Apr 2024 17:49:43 +0200 Subject: mtd: mchp23k256: drop unneeded MODULE_ALIAS The ID table already has respective entry and MODULE_DEVICE_TABLE and creates proper alias for SPI driver. Having another MODULE_ALIAS causes the alias to be duplicated. Signed-off-by: Krzysztof Kozlowski Signed-off-by: Miquel Raynal Link: https://lore.kernel.org/linux-mtd/20240414154943.127079-1-krzk@kernel.org --- drivers/mtd/devices/mchp23k256.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/mtd/devices/mchp23k256.c b/drivers/mtd/devices/mchp23k256.c index d533475fda15..cef5f9677d39 100644 --- a/drivers/mtd/devices/mchp23k256.c +++ b/drivers/mtd/devices/mchp23k256.c @@ -257,4 +257,3 @@ module_spi_driver(mchp23k256_driver); MODULE_DESCRIPTION("MTD SPI driver for MCHP23K256 RAM chips"); MODULE_AUTHOR("Andrew Lunn "); MODULE_LICENSE("GPL v2"); -MODULE_ALIAS("spi:mchp23k256"); -- cgit v1.2.3 From c84b3925c7d6c649f5add009084ff409139f894d Mon Sep 17 00:00:00 2001 From: Michael Walle Date: Mon, 29 Apr 2024 14:11:13 +0200 Subject: 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 Link: https://lore.kernel.org/r/9ba7f4e6-2b8b-44a3-9cac-9ed6e50f1700@moroto.mountain/ Signed-off-by: Michael Walle Reviewed-by: Pratyush Yadav [pratyush@kernel.org: touched up commit message] Signed-off-by: Pratyush Yadav Link: https://lore.kernel.org/r/20240429121113.803703-1-mwalle@kernel.org --- drivers/mtd/spi-nor/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 3e1f1913536b..028514c6996f 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -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; } -- cgit v1.2.3