summaryrefslogtreecommitdiff
path: root/drivers/mfd/wm831x-spi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/wm831x-spi.c')
-rw-r--r--drivers/mfd/wm831x-spi.c47
1 files changed, 7 insertions, 40 deletions
diff --git a/drivers/mfd/wm831x-spi.c b/drivers/mfd/wm831x-spi.c
index 018ce652ae57..54c87267917b 100644
--- a/drivers/mfd/wm831x-spi.c
+++ b/drivers/mfd/wm831x-spi.c
@@ -1,21 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
/*
* wm831x-spi.c -- SPI access for Wolfson WM831x PMICs
*
* Copyright 2009,2010 Wolfson Microelectronics PLC.
*
* Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- *
*/
#include <linux/kernel.h>
-#include <linux/module.h>
+#include <linux/init.h>
#include <linux/of.h>
-#include <linux/of_device.h>
#include <linux/pm.h>
#include <linux/spi/spi.h>
#include <linux/regmap.h>
@@ -26,21 +20,14 @@
static int wm831x_spi_probe(struct spi_device *spi)
{
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;
enum wm831x_parent type;
int ret;
- if (spi->dev.of_node) {
- of_id = of_match_device(wm831x_of_match, &spi->dev);
- if (!of_id) {
- dev_err(&spi->dev, "Failed to match device\n");
- return -ENODEV;
- }
- type = (enum wm831x_parent)of_id->data;
- } else {
- type = (enum wm831x_parent)id->driver_data;
+ type = (uintptr_t)spi_get_device_match_data(spi);
+ if (!type) {
+ dev_err(&spi->dev, "Failed to match device\n");
+ return -ENODEV;
}
wm831x = devm_kzalloc(&spi->dev, sizeof(struct wm831x), GFP_KERNEL);
@@ -67,15 +54,6 @@ static int wm831x_spi_probe(struct spi_device *spi)
return wm831x_device_init(wm831x, spi->irq);
}
-static int wm831x_spi_remove(struct spi_device *spi)
-{
- struct wm831x *wm831x = spi_get_drvdata(spi);
-
- wm831x_device_exit(wm831x);
-
- return 0;
-}
-
static int wm831x_spi_suspend(struct device *dev)
{
struct wm831x *wm831x = dev_get_drvdata(dev);
@@ -108,17 +86,16 @@ static const struct spi_device_id wm831x_spi_ids[] = {
{ "wm8326", WM8326 },
{ },
};
-MODULE_DEVICE_TABLE(spi, wm831x_spi_ids);
static struct spi_driver wm831x_spi_driver = {
.driver = {
.name = "wm831x",
.pm = &wm831x_spi_pm,
.of_match_table = of_match_ptr(wm831x_of_match),
+ .suppress_bind_attrs = true,
},
.id_table = wm831x_spi_ids,
.probe = wm831x_spi_probe,
- .remove = wm831x_spi_remove,
};
static int __init wm831x_spi_init(void)
@@ -132,13 +109,3 @@ static int __init wm831x_spi_init(void)
return 0;
}
subsys_initcall(wm831x_spi_init);
-
-static void __exit wm831x_spi_exit(void)
-{
- spi_unregister_driver(&wm831x_spi_driver);
-}
-module_exit(wm831x_spi_exit);
-
-MODULE_DESCRIPTION("SPI support for WM831x/2x AudioPlus PMICs");
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Mark Brown");