Skip to content

Commit eab61fb

Browse files
prchalgregkh
authored andcommitted
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>
1 parent 604288b commit eab61fb

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

‎drivers/misc/eeprom/at25.c‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,6 @@ struct at25_data {
6969
*/
7070
#define EE_TIMEOUT 25
7171

72-
#define IS_EEPROM 0
73-
#define IS_FRAM 1
74-
7572
/*-------------------------------------------------------------------------*/
7673

7774
#define io_limit PAGE_SIZE /* bytes */
@@ -363,8 +360,8 @@ static int at25_fw_to_chip(struct device *dev, struct spi_eeprom *chip)
363360
}
364361

365362
static const struct of_device_id at25_of_match[] = {
366-
{ .compatible = "atmel,at25", .data = (const void *)IS_EEPROM },
367-
{ .compatible = "cypress,fm25", .data = (const void *)IS_FRAM },
363+
{ .compatible = "atmel,at25",},
364+
{ .compatible = "cypress,fm25",},
368365
{ }
369366
};
370367
MODULE_DEVICE_TABLE(of, at25_of_match);
@@ -379,11 +376,11 @@ static int at25_probe(struct spi_device *spi)
379376
u8 sernum[FM25_SN_LEN];
380377
int i;
381378
const struct of_device_id *match;
382-
unsigned long is_fram = 0;
379+
bool is_fram = 0;
383380

384381
match = of_match_device(of_match_ptr(at25_of_match), &spi->dev);
385-
if (match)
386-
is_fram = (unsigned long)match->data;
382+
if (match && !strcmp(match->compatible, "cypress,fm25"))
383+
is_fram = 1;
387384

388385
/* Chip description */
389386
if (!spi->dev.platform_data) {

0 commit comments

Comments
 (0)