* [PATCH] nvmem: eeprom: at25: fram discovery simplification
@ 2021-06-11 15:24 Jiri Prchal
0 siblings, 0 replies; only message in thread
From: Jiri Prchal @ 2021-06-11 15:24 UTC (permalink / raw)
To: devicetree, linux-kernel
Cc: Rob Herring, Christian Eggers, Arnd Bergmann, Greg Kroah-Hartman,
Jiri Prchal
Changed "is_fram" to bool and set it based on compatible string.
Signed-off-by: Jiri Prchal <jiri.prchal@aksignal.cz>
---
drivers/misc/eeprom/at25.c | 13 +++++--------
1 file changed, 5 insertions(+), 8 deletions(-)
diff --git a/drivers/misc/eeprom/at25.c b/drivers/misc/eeprom/at25.c
index 744f7abb22ee..4d09b672ac3c 100644
--- a/drivers/misc/eeprom/at25.c
+++ b/drivers/misc/eeprom/at25.c
@@ -69,9 +69,6 @@ struct at25_data {
*/
#define EE_TIMEOUT 25
-#define IS_EEPROM 0
-#define IS_FRAM 1
-
/*-------------------------------------------------------------------------*/
#define io_limit PAGE_SIZE /* bytes */
@@ -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[] = {
- { .compatible = "atmel,at25", .data = (const void *)IS_EEPROM },
- { .compatible = "cypress,fm25", .data = (const void *)IS_FRAM },
+ { .compatible = "atmel,at25",},
+ { .compatible = "cypress,fm25",},
{ }
};
MODULE_DEVICE_TABLE(of, at25_of_match);
@@ -379,11 +376,11 @@ static int at25_probe(struct spi_device *spi)
u8 sernum[FM25_SN_LEN];
int i;
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);
- if (match)
- is_fram = (unsigned long)match->data;
+ if (match && !strcmp(match->compatible, "cypress,fm25"))
+ is_fram = 1;
/* Chip description */
if (!spi->dev.platform_data) {
--
2.25.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-11 15:24 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-11 15:24 [PATCH] nvmem: eeprom: at25: fram discovery simplification Jiri Prchal
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.