Skip to content

Commit

Permalink
misc: at25: Get platform data via dev_get_platdata()
Browse files Browse the repository at this point in the history
Access to platform data via dev_get_platdata() getter to make code cleaner.

Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20211125213203.86693-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Andy Shevchenko authored and Greg Kroah-Hartman committed Dec 3, 2021
1 parent fb422f4 commit 994233e
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/misc/eeprom/at25.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ MODULE_DEVICE_TABLE(spi, at25_spi_ids);
static int at25_probe(struct spi_device *spi)
{
struct at25_data *at25 = NULL;
struct spi_eeprom chip;
struct spi_eeprom chip, *pdata;
int err;
int sr;
u8 id[FM25_ID_LEN];
Expand All @@ -393,7 +393,8 @@ static int at25_probe(struct spi_device *spi)
is_fram = false;

/* Chip description */
if (!spi->dev.platform_data) {
pdata = dev_get_platdata(&spi->dev);
if (!pdata) {
if (is_fram) {
/* We file fields for FRAM case later on */
memset(&chip, 0, sizeof(chip));
Expand All @@ -403,7 +404,7 @@ static int at25_probe(struct spi_device *spi)
return err;
}
} else
chip = *(struct spi_eeprom *)spi->dev.platform_data;
chip = *pdata;

/* Ping the chip ... the status register is pretty portable,
* unlike probing manufacturer IDs. We do expect that system
Expand Down

0 comments on commit 994233e

Please sign in to comment.