diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2021-11-26 00:31:54 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-12-03 16:26:14 +0300 |
commit | 51902c1212feb9652826fd978e5c58b683f865db (patch) | |
tree | e51ab3ef2de038bc7b0681bb2a45bed9d51c5ebd /drivers/misc/eeprom | |
parent | 58589a75bba96f43b62d8069b35be081bc00d7c3 (diff) | |
download | linux-51902c1212feb9652826fd978e5c58b683f865db.tar.xz |
misc: at25: Use at25->chip instead of local chip everywhere in ->probe()
Currently some values are compared against the contents of the chip structure
and most are from its updated copy in at25->chip. Use the latter one everywhere
in ->probe().
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20211125213203.86693-2-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/eeprom')
-rw-r--r-- | drivers/misc/eeprom/at25.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c index e21216541b0f..6bea9c7c64a0 100644 --- a/drivers/misc/eeprom/at25.c +++ b/drivers/misc/eeprom/at25.c @@ -434,8 +434,8 @@ static int at25_probe(struct spi_device *spi) return -ENODEV; } - chip.byte_len = int_pow(2, id[7] - 0x21 + 4) * 1024; - if (chip.byte_len > 64 * 1024) + at25->chip.byte_len = int_pow(2, id[7] - 0x21 + 4) * 1024; + if (at25->chip.byte_len > 64 * 1024) at25->chip.flags |= EE_ADDR3; else at25->chip.flags |= EE_ADDR2; @@ -466,7 +466,7 @@ static int at25_probe(struct spi_device *spi) at25->nvmem_config.type = is_fram ? NVMEM_TYPE_FRAM : NVMEM_TYPE_EEPROM; at25->nvmem_config.name = dev_name(&spi->dev); at25->nvmem_config.dev = &spi->dev; - at25->nvmem_config.read_only = chip.flags & EE_READONLY; + at25->nvmem_config.read_only = at25->chip.flags & EE_READONLY; at25->nvmem_config.root_only = true; at25->nvmem_config.owner = THIS_MODULE; at25->nvmem_config.compat = true; @@ -476,17 +476,17 @@ static int at25_probe(struct spi_device *spi) at25->nvmem_config.priv = at25; at25->nvmem_config.stride = 1; at25->nvmem_config.word_size = 1; - at25->nvmem_config.size = chip.byte_len; + at25->nvmem_config.size = at25->chip.byte_len; at25->nvmem = devm_nvmem_register(&spi->dev, &at25->nvmem_config); if (IS_ERR(at25->nvmem)) return PTR_ERR(at25->nvmem); dev_info(&spi->dev, "%d %s %s %s%s, pagesize %u\n", - (chip.byte_len < 1024) ? chip.byte_len : (chip.byte_len / 1024), - (chip.byte_len < 1024) ? "Byte" : "KByte", + (at25->chip.byte_len < 1024) ? at25->chip.byte_len : (at25->chip.byte_len / 1024), + (at25->chip.byte_len < 1024) ? "Byte" : "KByte", at25->chip.name, is_fram ? "fram" : "eeprom", - (chip.flags & EE_READONLY) ? " (readonly)" : "", + (at25->chip.flags & EE_READONLY) ? " (readonly)" : "", at25->chip.page_size); return 0; } |