Skip to content

Commit 83e62ff

Browse files
mwalleambarus
authored andcommitted
mtd: spi-nor: rename .otp_org to .otp and make it a pointer
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>
1 parent 2d7f3a0 commit 83e62ff

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/mtd/spi-nor/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2978,7 +2978,7 @@ static void spi_nor_init_default_params(struct spi_nor *nor)
29782978
struct device_node *np = spi_nor_get_flash_node(nor);
29792979

29802980
params->quad_enable = spi_nor_sr2_bit1_quad_enable;
2981-
params->otp.org = &info->otp_org;
2981+
params->otp.org = info->otp;
29822982

29832983
/* Default to 16-bit Write Status (01h) Command */
29842984
nor->flags |= SNOR_F_HAS_16BIT_SR;

drivers/mtd/spi-nor/core.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@ struct flash_info {
557557

558558
u8 mfr_flags;
559559

560-
const struct spi_nor_otp_organization otp_org;
560+
const struct spi_nor_otp_organization *otp;
561561
const struct spi_nor_fixups *fixups;
562562
};
563563

@@ -607,7 +607,7 @@ struct flash_info {
607607
.flags = SPI_NOR_NO_ERASE | SPI_NOR_NO_FR, \
608608

609609
#define OTP_INFO(_len, _n_regions, _base, _offset) \
610-
.otp_org = { \
610+
.otp = &(const struct spi_nor_otp_organization){ \
611611
.len = (_len), \
612612
.base = (_base), \
613613
.offset = (_offset), \

drivers/mtd/spi-nor/winbond.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ static int winbond_nor_late_init(struct spi_nor *nor)
217217
{
218218
struct spi_nor_flash_parameter *params = nor->params;
219219

220-
if (params->otp.org->n_regions)
220+
if (params->otp.org)
221221
params->otp.ops = &winbond_nor_otp_ops;
222222

223223
/*

0 commit comments

Comments
 (0)