mfd: madera: Simplify with spi_get_device_match_data()

Use spi_get_device_match_data() helper to simplify a bit the driver.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://lore.kernel.org/r/20240606142457.130553-2-krzysztof.kozlowski@linaro.org
Signed-off-by: Lee Jones <lee@kernel.org>
This commit is contained in:
Krzysztof Kozlowski 2024-06-06 16:24:57 +02:00 committed by Lee Jones
parent a49d9bae9c
commit 0ddabc8c6e

View File

@ -18,21 +18,14 @@
static int madera_spi_probe(struct spi_device *spi) static int madera_spi_probe(struct spi_device *spi)
{ {
const struct spi_device_id *id = spi_get_device_id(spi);
struct madera *madera; struct madera *madera;
const struct regmap_config *regmap_16bit_config = NULL; const struct regmap_config *regmap_16bit_config = NULL;
const struct regmap_config *regmap_32bit_config = NULL; const struct regmap_config *regmap_32bit_config = NULL;
const void *of_data;
unsigned long type; unsigned long type;
const char *name; const char *name;
int ret; int ret;
of_data = of_device_get_match_data(&spi->dev); type = (unsigned long)spi_get_device_match_data(spi);
if (of_data)
type = (unsigned long)of_data;
else
type = id->driver_data;
switch (type) { switch (type) {
case CS47L15: case CS47L15:
if (IS_ENABLED(CONFIG_MFD_CS47L15)) { if (IS_ENABLED(CONFIG_MFD_CS47L15)) {