mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-24 19:35:58 +00:00
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)
This commit is contained in:
parent
9f58744c5e
commit
15d71e678e
2 changed files with 6 additions and 24 deletions
|
@ -8,13 +8,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
|
#include <linux/mod_devicetable.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/platform_device.h>
|
#include <linux/platform_device.h>
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
#include <linux/mfd/core.h>
|
#include <linux/mfd/core.h>
|
||||||
#include <linux/mfd/mc13xxx.h>
|
#include <linux/mfd/mc13xxx.h>
|
||||||
#include <linux/of.h>
|
|
||||||
#include <linux/of_device.h>
|
|
||||||
#include <linux/err.h>
|
#include <linux/err.h>
|
||||||
#include <linux/spi/spi.h>
|
#include <linux/spi/spi.h>
|
||||||
|
|
||||||
|
@ -151,16 +150,7 @@ static int mc13xxx_spi_probe(struct spi_device *spi)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spi->dev.of_node) {
|
mc13xxx->variant = spi_get_device_match_data(spi);
|
||||||
const struct of_device_id *of_id =
|
|
||||||
of_match_device(mc13xxx_dt_ids, &spi->dev);
|
|
||||||
|
|
||||||
mc13xxx->variant = of_id->data;
|
|
||||||
} else {
|
|
||||||
const struct spi_device_id *id_entry = spi_get_device_id(spi);
|
|
||||||
|
|
||||||
mc13xxx->variant = (void *)id_entry->driver_data;
|
|
||||||
}
|
|
||||||
|
|
||||||
return mc13xxx_common_init(&spi->dev);
|
return mc13xxx_common_init(&spi->dev);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/of.h>
|
#include <linux/of.h>
|
||||||
#include <linux/of_device.h>
|
|
||||||
#include <linux/pm.h>
|
#include <linux/pm.h>
|
||||||
#include <linux/spi/spi.h>
|
#include <linux/spi/spi.h>
|
||||||
#include <linux/regmap.h>
|
#include <linux/regmap.h>
|
||||||
|
@ -21,21 +20,14 @@
|
||||||
static int wm831x_spi_probe(struct spi_device *spi)
|
static int wm831x_spi_probe(struct spi_device *spi)
|
||||||
{
|
{
|
||||||
struct wm831x_pdata *pdata = dev_get_platdata(&spi->dev);
|
struct wm831x_pdata *pdata = dev_get_platdata(&spi->dev);
|
||||||
const struct spi_device_id *id = spi_get_device_id(spi);
|
|
||||||
const struct of_device_id *of_id;
|
|
||||||
struct wm831x *wm831x;
|
struct wm831x *wm831x;
|
||||||
enum wm831x_parent type;
|
enum wm831x_parent type;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (spi->dev.of_node) {
|
type = (uintptr_t)spi_get_device_match_data(spi);
|
||||||
of_id = of_match_device(wm831x_of_match, &spi->dev);
|
if (!type) {
|
||||||
if (!of_id) {
|
dev_err(&spi->dev, "Failed to match device\n");
|
||||||
dev_err(&spi->dev, "Failed to match device\n");
|
return -ENODEV;
|
||||||
return -ENODEV;
|
|
||||||
}
|
|
||||||
type = (uintptr_t)of_id->data;
|
|
||||||
} else {
|
|
||||||
type = (enum wm831x_parent)id->driver_data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wm831x = devm_kzalloc(&spi->dev, sizeof(struct wm831x), GFP_KERNEL);
|
wm831x = devm_kzalloc(&spi->dev, sizeof(struct wm831x), GFP_KERNEL);
|
||||||
|
|
Loading…
Reference in a new issue