Commit b946e949 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Jonathan Cameron

iio: ssp_sensors: Make use of device properties

Convert the module to be property provider agnostic and allow
it to be used on non-OF platforms.
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220210135724.26660-1-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 261ecd47
...@@ -7,9 +7,10 @@ ...@@ -7,9 +7,10 @@
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/mfd/core.h> #include <linux/mfd/core.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/of.h> #include <linux/property.h>
#include <linux/of_platform.h>
#include "ssp.h" #include "ssp.h"
#define SSP_WDT_TIME 10000 #define SSP_WDT_TIME 10000
...@@ -425,7 +426,6 @@ int ssp_queue_ssp_refresh_task(struct ssp_data *data, unsigned int delay) ...@@ -425,7 +426,6 @@ int ssp_queue_ssp_refresh_task(struct ssp_data *data, unsigned int delay)
msecs_to_jiffies(delay)); msecs_to_jiffies(delay));
} }
#ifdef CONFIG_OF
static const struct of_device_id ssp_of_match[] = { static const struct of_device_id ssp_of_match[] = {
{ {
.compatible = "samsung,sensorhub-rinato", .compatible = "samsung,sensorhub-rinato",
...@@ -441,8 +441,6 @@ MODULE_DEVICE_TABLE(of, ssp_of_match); ...@@ -441,8 +441,6 @@ MODULE_DEVICE_TABLE(of, ssp_of_match);
static struct ssp_data *ssp_parse_dt(struct device *dev) static struct ssp_data *ssp_parse_dt(struct device *dev)
{ {
struct ssp_data *data; struct ssp_data *data;
struct device_node *node = dev->of_node;
const struct of_device_id *match;
data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
if (!data) if (!data)
...@@ -461,22 +459,12 @@ static struct ssp_data *ssp_parse_dt(struct device *dev) ...@@ -461,22 +459,12 @@ static struct ssp_data *ssp_parse_dt(struct device *dev)
if (IS_ERR(data->mcu_reset_gpiod)) if (IS_ERR(data->mcu_reset_gpiod))
return NULL; return NULL;
match = of_match_node(ssp_of_match, node); data->sensorhub_info = device_get_match_data(dev);
if (!match)
return NULL;
data->sensorhub_info = match->data;
dev_set_drvdata(dev, data); dev_set_drvdata(dev, data);
return data; return data;
} }
#else
static struct ssp_data *ssp_parse_dt(struct device *pdev)
{
return NULL;
}
#endif
/** /**
* ssp_register_consumer() - registers iio consumer in ssp framework * ssp_register_consumer() - registers iio consumer in ssp framework
...@@ -672,7 +660,7 @@ static struct spi_driver ssp_driver = { ...@@ -672,7 +660,7 @@ static struct spi_driver ssp_driver = {
.remove = ssp_remove, .remove = ssp_remove,
.driver = { .driver = {
.pm = &ssp_pm_ops, .pm = &ssp_pm_ops,
.of_match_table = of_match_ptr(ssp_of_match), .of_match_table = ssp_of_match,
.name = "sensorhub" .name = "sensorhub"
}, },
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment