Commit 994233e1 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman

misc: at25: Get platform data via dev_get_platdata()

Access to platform data via dev_get_platdata() getter to make code cleaner.
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20211125213203.86693-5-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent fb422f44
...@@ -378,7 +378,7 @@ MODULE_DEVICE_TABLE(spi, at25_spi_ids); ...@@ -378,7 +378,7 @@ MODULE_DEVICE_TABLE(spi, at25_spi_ids);
static int at25_probe(struct spi_device *spi) static int at25_probe(struct spi_device *spi)
{ {
struct at25_data *at25 = NULL; struct at25_data *at25 = NULL;
struct spi_eeprom chip; struct spi_eeprom chip, *pdata;
int err; int err;
int sr; int sr;
u8 id[FM25_ID_LEN]; u8 id[FM25_ID_LEN];
...@@ -393,7 +393,8 @@ static int at25_probe(struct spi_device *spi) ...@@ -393,7 +393,8 @@ static int at25_probe(struct spi_device *spi)
is_fram = false; is_fram = false;
/* Chip description */ /* Chip description */
if (!spi->dev.platform_data) { pdata = dev_get_platdata(&spi->dev);
if (!pdata) {
if (is_fram) { if (is_fram) {
/* We file fields for FRAM case later on */ /* We file fields for FRAM case later on */
memset(&chip, 0, sizeof(chip)); memset(&chip, 0, sizeof(chip));
...@@ -403,7 +404,7 @@ static int at25_probe(struct spi_device *spi) ...@@ -403,7 +404,7 @@ static int at25_probe(struct spi_device *spi)
return err; return err;
} }
} else } else
chip = *(struct spi_eeprom *)spi->dev.platform_data; chip = *pdata;
/* Ping the chip ... the status register is pretty portable, /* Ping the chip ... the status register is pretty portable,
* unlike probing manufacturer IDs. We do expect that system * unlike probing manufacturer IDs. We do expect that system
......
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