diff mbox series

[v4,6/6] spinand: bind UBI block

Message ID 20240603155740.1840571-7-avromanov@salutedevices.com
State Superseded
Delegated to: Dario Binacchi
Headers show
Series Introduce UBI block device | expand

Commit Message

Alexey Romanov June 3, 2024, 3:57 p.m. UTC
UBI block is virtual block device, which is an abstraction
over MTD layer. Therefore it is logical to use it in
combination with MTD drivers.

Signed-off-by: Alexey Romanov <avromanov@salutedevices.com>
---
 drivers/mtd/nand/spi/core.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Frieder Schrempf June 10, 2024, 12:46 p.m. UTC | #1
On 03.06.24 5:57 PM, Alexey Romanov wrote:
> UBI block is virtual block device, which is an abstraction
> over MTD layer. Therefore it is logical to use it in
> combination with MTD drivers.
> 
> Signed-off-by: Alexey Romanov <avromanov@salutedevices.com>

I think I already sent a review tag for v2, but anyway:

Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>

> ---
>  drivers/mtd/nand/spi/core.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
> index 8edb468aed..db71e0627b 100644
> --- a/drivers/mtd/nand/spi/core.c
> +++ b/drivers/mtd/nand/spi/core.c
> @@ -26,6 +26,7 @@
>  #include <watchdog.h>
>  #include <spi.h>
>  #include <spi-mem.h>
> +#include <ubi_uboot.h>
>  #include <dm/device_compat.h>
>  #include <dm/devres.h>
>  #include <linux/bitops.h>
> @@ -1181,8 +1182,13 @@ static int spinand_bind(struct udevice *dev)
>  {
>  	if (blk_enabled()) {
>  		struct spinand_plat *plat = dev_get_plat(dev);
> +		int ret;
> +
> +		ret = mtd_bind(dev, &plat->mtd);
> +		if (ret)
> +			return ret;
>  
> -		return mtd_bind(dev, &plat->mtd);
> +		return ubi_bind(dev);
>  	}
>  
>  	return 0;
diff mbox series

Patch

diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index 8edb468aed..db71e0627b 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -26,6 +26,7 @@ 
 #include <watchdog.h>
 #include <spi.h>
 #include <spi-mem.h>
+#include <ubi_uboot.h>
 #include <dm/device_compat.h>
 #include <dm/devres.h>
 #include <linux/bitops.h>
@@ -1181,8 +1182,13 @@  static int spinand_bind(struct udevice *dev)
 {
 	if (blk_enabled()) {
 		struct spinand_plat *plat = dev_get_plat(dev);
+		int ret;
+
+		ret = mtd_bind(dev, &plat->mtd);
+		if (ret)
+			return ret;
 
-		return mtd_bind(dev, &plat->mtd);
+		return ubi_bind(dev);
 	}
 
 	return 0;