Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nvmem: eeprom: at25: fram discovery simplification

Changed "is_fram" to bool and set it based on compatible string.

Signed-off-by: Jiri Prchal <jiri.prchal@aksignal.cz>
Link: https://lore.kernel.org/r/20210611152416.68386-1-jiri.prchal@aksignal.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Jiri Prchal and committed by
Greg Kroah-Hartman
eab61fb1 604288bc

+5 -8
+5 -8
drivers/misc/eeprom/at25.c
··· 69 69 */ 70 70 #define EE_TIMEOUT 25 71 71 72 - #define IS_EEPROM 0 73 - #define IS_FRAM 1 74 - 75 72 /*-------------------------------------------------------------------------*/ 76 73 77 74 #define io_limit PAGE_SIZE /* bytes */ ··· 360 363 } 361 364 362 365 static const struct of_device_id at25_of_match[] = { 363 - { .compatible = "atmel,at25", .data = (const void *)IS_EEPROM }, 364 - { .compatible = "cypress,fm25", .data = (const void *)IS_FRAM }, 366 + { .compatible = "atmel,at25",}, 367 + { .compatible = "cypress,fm25",}, 365 368 { } 366 369 }; 367 370 MODULE_DEVICE_TABLE(of, at25_of_match); ··· 376 379 u8 sernum[FM25_SN_LEN]; 377 380 int i; 378 381 const struct of_device_id *match; 379 - unsigned long is_fram = 0; 382 + bool is_fram = 0; 380 383 381 384 match = of_match_device(of_match_ptr(at25_of_match), &spi->dev); 382 - if (match) 383 - is_fram = (unsigned long)match->data; 385 + if (match && !strcmp(match->compatible, "cypress,fm25")) 386 + is_fram = 1; 384 387 385 388 /* Chip description */ 386 389 if (!spi->dev.platform_data) {