]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
spi: Tweak a few strange SPI NOR features for of-platdata
authorSimon Glass <sjg@chromium.org>
Sat, 19 Dec 2020 17:40:01 +0000 (10:40 -0700)
committerSimon Glass <sjg@chromium.org>
Tue, 5 Jan 2021 19:24:41 +0000 (12:24 -0700)
The #define of one struct to another has been around for a while. It
confuses dtoc and makes it think that struct spi_flash does not exist.

Make a few changes to improve things while we wait for migration to be
completed:

- Move the 'struct spi_flash' to column 1 so dtoc scans it
- Remove the #define when compiling dt-platdata.c
- Update the strange mtd_get/set_of_node() functions
- Use struct spi_nor in the drivers, so dtoc sees the correct struct

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/mtd/spi/sf-uclass.c
drivers/mtd/spi/sf_probe.c
include/linux/mtd/spi-nor.h

index ed629f1d4581f8051cb63a18a069ef6fcc114ffd..3017022abbbc193a64b5050d7ca27097b39b9494 100644 (file)
@@ -100,5 +100,5 @@ UCLASS_DRIVER(spi_flash) = {
        .id             = UCLASS_SPI_FLASH,
        .name           = "spi_flash",
        .post_bind      = spi_flash_post_bind,
-       .per_device_auto        = sizeof(struct spi_flash),
+       .per_device_auto        = sizeof(struct spi_nor),
 };
index c8bcec3c5890c7654211c9b49ee2361f5b9fb1b2..630787df1bf6cd9bd02e7eff42347f57fc8d4b12 100644 (file)
@@ -166,7 +166,7 @@ U_BOOT_DRIVER(jedec_spi_nor) = {
        .of_match       = spi_flash_std_ids,
        .probe          = spi_flash_std_probe,
        .remove         = spi_flash_std_remove,
-       .priv_auto      = sizeof(struct spi_flash),
+       .priv_auto      = sizeof(struct spi_nor),
        .ops            = &spi_flash_std_ops,
 };
 
index 2642bf91d00afa35d50b34356b10ca802f6dcf80..363f2749d7d4027b051cbf491760799c180fedad 100644 (file)
@@ -258,11 +258,13 @@ struct flash_info;
 /*
  * TODO: Remove, once all users of spi_flash interface are moved to MTD
  *
- * struct spi_flash {
+struct spi_flash {
  *     Defined below (keep this text to enable searching for spi_flash decl)
  * }
  */
+#ifndef DT_PLATDATA_C
 #define spi_flash spi_nor
+#endif
 
 /**
  * struct spi_nor - Structure for defining a the SPI NOR layer