All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] iio: ssp_sensors: Make use of device properties
@ 2022-02-10 13:57 Andy Shevchenko
  2022-02-13 17:52 ` Jonathan Cameron
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2022-02-10 13:57 UTC (permalink / raw)
  To: Andy Shevchenko, linux-iio, linux-kernel
  Cc: Jonathan Cameron, Lars-Peter Clausen

Convert the module to be property provider agnostic and allow
it to be used on non-OF platforms.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/iio/common/ssp_sensors/ssp_dev.c | 22 +++++-----------------
 1 file changed, 5 insertions(+), 17 deletions(-)

diff --git a/drivers/iio/common/ssp_sensors/ssp_dev.c b/drivers/iio/common/ssp_sensors/ssp_dev.c
index eafaf4529df5..c1abd20ff808 100644
--- a/drivers/iio/common/ssp_sensors/ssp_dev.c
+++ b/drivers/iio/common/ssp_sensors/ssp_dev.c
@@ -7,9 +7,10 @@
 #include <linux/interrupt.h>
 #include <linux/io.h>
 #include <linux/mfd/core.h>
+#include <linux/mod_devicetable.h>
 #include <linux/module.h>
-#include <linux/of.h>
-#include <linux/of_platform.h>
+#include <linux/property.h>
+
 #include "ssp.h"
 
 #define SSP_WDT_TIME			10000
@@ -425,7 +426,6 @@ int ssp_queue_ssp_refresh_task(struct ssp_data *data, unsigned int delay)
 				  msecs_to_jiffies(delay));
 }
 
-#ifdef CONFIG_OF
 static const struct of_device_id ssp_of_match[] = {
 	{
 		.compatible	= "samsung,sensorhub-rinato",
@@ -441,8 +441,6 @@ MODULE_DEVICE_TABLE(of, ssp_of_match);
 static struct ssp_data *ssp_parse_dt(struct device *dev)
 {
 	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);
 	if (!data)
@@ -461,22 +459,12 @@ static struct ssp_data *ssp_parse_dt(struct device *dev)
 	if (IS_ERR(data->mcu_reset_gpiod))
 		return NULL;
 
-	match = of_match_node(ssp_of_match, node);
-	if (!match)
-		return NULL;
-
-	data->sensorhub_info = match->data;
+	data->sensorhub_info = device_get_match_data(dev);
 
 	dev_set_drvdata(dev, 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
@@ -670,7 +658,7 @@ static struct spi_driver ssp_driver = {
 	.remove = ssp_remove,
 	.driver = {
 		.pm = &ssp_pm_ops,
-		.of_match_table = of_match_ptr(ssp_of_match),
+		.of_match_table = ssp_of_match,
 		.name = "sensorhub"
 	},
 };
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v1 1/1] iio: ssp_sensors: Make use of device properties
  2022-02-10 13:57 [PATCH v1 1/1] iio: ssp_sensors: Make use of device properties Andy Shevchenko
@ 2022-02-13 17:52 ` Jonathan Cameron
  0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2022-02-13 17:52 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: linux-iio, linux-kernel, Lars-Peter Clausen

On Thu, 10 Feb 2022 15:57:24 +0200
Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:

> Convert the module to be property provider agnostic and allow
> it to be used on non-OF platforms.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Applied to the togreg branch of iio.git and pushed out as testing.

Thanks,

Jonathan

> ---
>  drivers/iio/common/ssp_sensors/ssp_dev.c | 22 +++++-----------------
>  1 file changed, 5 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/iio/common/ssp_sensors/ssp_dev.c b/drivers/iio/common/ssp_sensors/ssp_dev.c
> index eafaf4529df5..c1abd20ff808 100644
> --- a/drivers/iio/common/ssp_sensors/ssp_dev.c
> +++ b/drivers/iio/common/ssp_sensors/ssp_dev.c
> @@ -7,9 +7,10 @@
>  #include <linux/interrupt.h>
>  #include <linux/io.h>
>  #include <linux/mfd/core.h>
> +#include <linux/mod_devicetable.h>
>  #include <linux/module.h>
> -#include <linux/of.h>
> -#include <linux/of_platform.h>
> +#include <linux/property.h>
> +
>  #include "ssp.h"
>  
>  #define SSP_WDT_TIME			10000
> @@ -425,7 +426,6 @@ int ssp_queue_ssp_refresh_task(struct ssp_data *data, unsigned int delay)
>  				  msecs_to_jiffies(delay));
>  }
>  
> -#ifdef CONFIG_OF
>  static const struct of_device_id ssp_of_match[] = {
>  	{
>  		.compatible	= "samsung,sensorhub-rinato",
> @@ -441,8 +441,6 @@ MODULE_DEVICE_TABLE(of, ssp_of_match);
>  static struct ssp_data *ssp_parse_dt(struct device *dev)
>  {
>  	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);
>  	if (!data)
> @@ -461,22 +459,12 @@ static struct ssp_data *ssp_parse_dt(struct device *dev)
>  	if (IS_ERR(data->mcu_reset_gpiod))
>  		return NULL;
>  
> -	match = of_match_node(ssp_of_match, node);
> -	if (!match)
> -		return NULL;
> -
> -	data->sensorhub_info = match->data;
> +	data->sensorhub_info = device_get_match_data(dev);
>  
>  	dev_set_drvdata(dev, 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
> @@ -670,7 +658,7 @@ static struct spi_driver ssp_driver = {
>  	.remove = ssp_remove,
>  	.driver = {
>  		.pm = &ssp_pm_ops,
> -		.of_match_table = of_match_ptr(ssp_of_match),
> +		.of_match_table = ssp_of_match,
>  		.name = "sensorhub"
>  	},
>  };


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-02-13 17:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10 13:57 [PATCH v1 1/1] iio: ssp_sensors: Make use of device properties Andy Shevchenko
2022-02-13 17:52 ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.