Message ID | 20230807-mtd-flash-info-db-rework-v2-14-291a0f39f8d8@kernel.org |
---|---|
State | Changes Requested |
Delegated to: | Ambarus Tudor |
Headers | show |
Series | mtd: spi-nor: clean the flash_info database up | expand |
On 22.08.2023 10:09, Michael Walle wrote: > 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> Reviewed-by: Tudor Ambarus <tudor.ambarus@linaro.org> > --- > drivers/mtd/spi-nor/core.c | 2 +- > drivers/mtd/spi-nor/core.h | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c > index 80c340c7863a..1c443fe568cf 100644 > --- a/drivers/mtd/spi-nor/core.c > +++ b/drivers/mtd/spi-nor/core.c > @@ -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; > diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h > index 81535f31907f..c22f5cf65a58 100644 > --- a/drivers/mtd/spi-nor/core.h > +++ b/drivers/mtd/spi-nor/core.h > @@ -555,7 +555,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; > }; > > @@ -605,7 +605,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), \ >
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 80c340c7863a..1c443fe568cf 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -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; diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h index 81535f31907f..c22f5cf65a58 100644 --- a/drivers/mtd/spi-nor/core.h +++ b/drivers/mtd/spi-nor/core.h @@ -555,7 +555,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; }; @@ -605,7 +605,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), \
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> --- drivers/mtd/spi-nor/core.c | 2 +- drivers/mtd/spi-nor/core.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)