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

mfd: mc13xxx-spi/wm831x-spi: Use spi_get_device_match_data()

Use preferred spi_get_device_match_data() instead of of_match_device() and
spi_get_device_id() to get the driver match data. With this, adjust the
includes to explicitly include the correct headers.

Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20231017203550.2700601-1-robh@kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>

tils.feedkeys.call.run(35)
all.run(37)
all.run(39)

authored by

Rob Herring and committed by
Lee Jones
15d71e67 9f58744c

+6 -24
+2 -12
drivers/mfd/mc13xxx-spi.c
··· 8 8 */ 9 9 10 10 #include <linux/slab.h> 11 + #include <linux/mod_devicetable.h> 11 12 #include <linux/module.h> 12 13 #include <linux/platform_device.h> 13 14 #include <linux/interrupt.h> 14 15 #include <linux/mfd/core.h> 15 16 #include <linux/mfd/mc13xxx.h> 16 - #include <linux/of.h> 17 - #include <linux/of_device.h> 18 17 #include <linux/err.h> 19 18 #include <linux/spi/spi.h> 20 19 ··· 150 151 return ret; 151 152 } 152 153 153 - if (spi->dev.of_node) { 154 - const struct of_device_id *of_id = 155 - of_match_device(mc13xxx_dt_ids, &spi->dev); 156 - 157 - mc13xxx->variant = of_id->data; 158 - } else { 159 - const struct spi_device_id *id_entry = spi_get_device_id(spi); 160 - 161 - mc13xxx->variant = (void *)id_entry->driver_data; 162 - } 154 + mc13xxx->variant = spi_get_device_match_data(spi); 163 155 164 156 return mc13xxx_common_init(&spi->dev); 165 157 }
+4 -12
drivers/mfd/wm831x-spi.c
··· 10 10 #include <linux/kernel.h> 11 11 #include <linux/init.h> 12 12 #include <linux/of.h> 13 - #include <linux/of_device.h> 14 13 #include <linux/pm.h> 15 14 #include <linux/spi/spi.h> 16 15 #include <linux/regmap.h> ··· 20 21 static int wm831x_spi_probe(struct spi_device *spi) 21 22 { 22 23 struct wm831x_pdata *pdata = dev_get_platdata(&spi->dev); 23 - const struct spi_device_id *id = spi_get_device_id(spi); 24 - const struct of_device_id *of_id; 25 24 struct wm831x *wm831x; 26 25 enum wm831x_parent type; 27 26 int ret; 28 27 29 - if (spi->dev.of_node) { 30 - of_id = of_match_device(wm831x_of_match, &spi->dev); 31 - if (!of_id) { 32 - dev_err(&spi->dev, "Failed to match device\n"); 33 - return -ENODEV; 34 - } 35 - type = (uintptr_t)of_id->data; 36 - } else { 37 - type = (enum wm831x_parent)id->driver_data; 28 + type = (uintptr_t)spi_get_device_match_data(spi); 29 + if (!type) { 30 + dev_err(&spi->dev, "Failed to match device\n"); 31 + return -ENODEV; 38 32 } 39 33 40 34 wm831x = devm_kzalloc(&spi->dev, sizeof(struct wm831x), GFP_KERNEL);