Commit eab61fb1 authored by Jiri Prchal's avatar Jiri Prchal Committed by Greg Kroah-Hartman

nvmem: eeprom: at25: fram discovery simplification

Changed "is_fram" to bool and set it based on compatible string.
Signed-off-by: default avatarJiri Prchal <jiri.prchal@aksignal.cz>
Link: https://lore.kernel.org/r/20210611152416.68386-1-jiri.prchal@aksignal.czSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 604288bc
...@@ -69,9 +69,6 @@ struct at25_data { ...@@ -69,9 +69,6 @@ struct at25_data {
*/ */
#define EE_TIMEOUT 25 #define EE_TIMEOUT 25
#define IS_EEPROM 0
#define IS_FRAM 1
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
#define io_limit PAGE_SIZE /* bytes */ #define io_limit PAGE_SIZE /* bytes */
...@@ -363,8 +360,8 @@ static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip) ...@@ -363,8 +360,8 @@ static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip)
} }
static const struct of_device_id at25_of_match[] = { static const struct of_device_id at25_of_match[] = {
{ .compatible = "atmel,at25", .data = (const void *)IS_EEPROM }, { .compatible = "atmel,at25",},
{ .compatible = "cypress,fm25", .data = (const void *)IS_FRAM }, { .compatible = "cypress,fm25",},
{ } { }
}; };
MODULE_DEVICE_TABLE(of, at25_of_match); MODULE_DEVICE_TABLE(of, at25_of_match);
...@@ -379,11 +376,11 @@ static int at25_probe(struct spi_device *spi) ...@@ -379,11 +376,11 @@ static int at25_probe(struct spi_device *spi)
u8 sernum[FM25_SN_LEN]; u8 sernum[FM25_SN_LEN];
int i; int i;
const struct of_device_id *match; const struct of_device_id *match;
unsigned long is_fram = 0; bool is_fram = 0;
match = of_match_device(of_match_ptr(at25_of_match), &spi->dev); match = of_match_device(of_match_ptr(at25_of_match), &spi->dev);
if (match) if (match && !strcmp(match->compatible, "cypress,fm25"))
is_fram = (unsigned long)match->data; is_fram = 1;
/* Chip description */ /* Chip description */
if (!spi->dev.platform_data) { if (!spi->dev.platform_data) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment