]> git.itanic.dy.fi Git - linux-stable/commitdiff
mtd: spi-nor: rename .otp_org to .otp and make it a pointer
authorMichael Walle <mwalle@kernel.org>
Fri, 8 Sep 2023 10:16:32 +0000 (12:16 +0200)
committerTudor Ambarus <tudor.ambarus@linaro.org>
Tue, 19 Sep 2023 15:57:50 +0000 (18:57 +0300)
Move the OTP ops out of the flash_info structure. Besides of saving some
space, there will be a new macro SNOR_OTP() which can be used to set the
ops:
  .otp = SNOR_OTP(...),

Signed-off-by: Michael Walle <mwalle@kernel.org>
Link: https://lore.kernel.org/r/20230807-mtd-flash-info-db-rework-v3-14-e60548861b10@kernel.org
Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
drivers/mtd/spi-nor/core.c
drivers/mtd/spi-nor/core.h
drivers/mtd/spi-nor/winbond.c

index 80c340c7863a628f4826a7325f2eb9ff51898d93..1c443fe568cfb45d07b8cda123e5feb0f21d98e5 100644 (file)
@@ -2978,7 +2978,7 @@ static void spi_nor_init_default_params(struct spi_nor *nor)
        struct device_node *np = spi_nor_get_flash_node(nor);
 
        params->quad_enable = spi_nor_sr2_bit1_quad_enable;
-       params->otp.org = &info->otp_org;
+       params->otp.org = info->otp;
 
        /* Default to 16-bit Write Status (01h) Command */
        nor->flags |= SNOR_F_HAS_16BIT_SR;
index fc6c8ddedc2faa4349788b2102016a9735b5dbb5..6d1870d5484daf08f7eb42f346a3f9c5c3de87f3 100644 (file)
@@ -557,7 +557,7 @@ struct flash_info {
 
        u8 mfr_flags;
 
-       const struct spi_nor_otp_organization otp_org;
+       const struct spi_nor_otp_organization *otp;
        const struct spi_nor_fixups *fixups;
 };
 
@@ -607,7 +607,7 @@ struct flash_info {
                .flags = SPI_NOR_NO_ERASE | SPI_NOR_NO_FR,              \
 
 #define OTP_INFO(_len, _n_regions, _base, _offset)                     \
-               .otp_org = {                                            \
+               .otp = &(const struct spi_nor_otp_organization){        \
                        .len = (_len),                                  \
                        .base = (_base),                                \
                        .offset = (_offset),                            \
index 7873cc394f07ec0408479c4d2303d31284f2bcca..ecf52b9e3148fa98c8de8b6443fef34128f32b2c 100644 (file)
@@ -217,7 +217,7 @@ static int winbond_nor_late_init(struct spi_nor *nor)
 {
        struct spi_nor_flash_parameter *params = nor->params;
 
-       if (params->otp.org->n_regions)
+       if (params->otp.org)
                params->otp.ops = &winbond_nor_otp_ops;
 
        /*