All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] hwmon: (ntc_thermistor): Inline OF data lookup in probe()
@ 2021-12-05 23:59 Linus Walleij
  2021-12-05 23:59 ` [PATCH 2/3] hwmon: (ntc_thermistor): Switch to generic firmware props Linus Walleij
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Linus Walleij @ 2021-12-05 23:59 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck
  Cc: linux-hwmon, Linus Walleij, Peter Rosin, Chris Lesiak

There is no need to allocate the state container and look
up DT properties in a separate function if OF is all we
support. Inline it into probe().

Cc: Peter Rosin <peda@axentia.se>
Cc: Chris Lesiak <chris.lesiak@licor.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/hwmon/ntc_thermistor.c | 76 ++++++++++++----------------------
 1 file changed, 27 insertions(+), 49 deletions(-)

diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c
index ed638ebd0923..44abcb8a2393 100644
--- a/drivers/hwmon/ntc_thermistor.c
+++ b/drivers/hwmon/ntc_thermistor.c
@@ -403,49 +403,6 @@ static const struct of_device_id ntc_match[] = {
 };
 MODULE_DEVICE_TABLE(of, ntc_match);
 
-static struct ntc_data *ntc_thermistor_parse_dt(struct device *dev)
-{
-	struct ntc_data *data;
-	struct iio_channel *chan;
-	enum iio_chan_type type;
-	struct device_node *np = dev->of_node;
-	int ret;
-
-	if (!np)
-		return NULL;
-
-	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
-	if (!data)
-		return ERR_PTR(-ENOMEM);
-
-	chan = devm_iio_channel_get(dev, NULL);
-	if (IS_ERR(chan))
-		return ERR_CAST(chan);
-
-	ret = iio_get_channel_type(chan, &type);
-	if (ret < 0)
-		return ERR_PTR(ret);
-
-	if (type != IIO_VOLTAGE)
-		return ERR_PTR(-EINVAL);
-
-	if (of_property_read_u32(np, "pullup-uv", &data->pullup_uv))
-		return ERR_PTR(-ENODEV);
-	if (of_property_read_u32(np, "pullup-ohm", &data->pullup_ohm))
-		return ERR_PTR(-ENODEV);
-	if (of_property_read_u32(np, "pulldown-ohm", &data->pulldown_ohm))
-		return ERR_PTR(-ENODEV);
-
-	if (of_find_property(np, "connected-positive", NULL))
-		data->connect = NTC_CONNECTED_POSITIVE;
-	else /* status change should be possible if not always on. */
-		data->connect = NTC_CONNECTED_GROUND;
-
-	data->chan = chan;
-
-	return data;
-}
-
 static inline u64 div64_u64_safe(u64 dividend, u64 divisor)
 {
 	if (divisor == 0 && dividend == 0)
@@ -641,20 +598,41 @@ static const struct hwmon_chip_info ntc_chip_info = {
 static int ntc_thermistor_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
+	struct device_node *np = dev->of_node;
 	const struct of_device_id *of_id =
 			of_match_device(of_match_ptr(ntc_match), dev);
 	const struct platform_device_id *pdev_id;
 	struct device *hwmon_dev;
 	struct ntc_data *data;
+	enum iio_chan_type type;
+	int ret;
 
-	data = ntc_thermistor_parse_dt(dev);
-	if (IS_ERR(data))
-		return PTR_ERR(data);
+	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
+	if (!data)
+		return -ENOMEM;
+
+	data->chan = devm_iio_channel_get(dev, NULL);
+	if (IS_ERR(data->chan))
+		return PTR_ERR(data->chan);
+
+	ret = iio_get_channel_type(data->chan, &type);
+	if (ret < 0)
+		return ret;
 
-	if (!data) {
-		dev_err(dev, "No platform init data supplied.\n");
+	if (type != IIO_VOLTAGE)
+		return -EINVAL;
+
+	if (of_property_read_u32(np, "pullup-uv", &data->pullup_uv))
 		return -ENODEV;
-	}
+	if (of_property_read_u32(np, "pullup-ohm", &data->pullup_ohm))
+		return -ENODEV;
+	if (of_property_read_u32(np, "pulldown-ohm", &data->pulldown_ohm))
+		return -ENODEV;
+
+	if (of_find_property(np, "connected-positive", NULL))
+		data->connect = NTC_CONNECTED_POSITIVE;
+	else /* status change should be possible if not always on. */
+		data->connect = NTC_CONNECTED_GROUND;
 
 	if (data->pullup_uv == 0 ||
 	    (data->pullup_ohm == 0 && data->connect ==
-- 
2.31.1


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

* [PATCH 2/3] hwmon: (ntc_thermistor): Switch to generic firmware props
  2021-12-05 23:59 [PATCH 1/3] hwmon: (ntc_thermistor): Inline OF data lookup in probe() Linus Walleij
@ 2021-12-05 23:59 ` Linus Walleij
  2021-12-05 23:59 ` [PATCH 3/3] hwmon: (ntc_thermistor): Move DT matches to the driver block Linus Walleij
  2021-12-06  0:38 ` [PATCH 1/3] hwmon: (ntc_thermistor): Inline OF data lookup in probe() Guenter Roeck
  2 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2021-12-05 23:59 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck
  Cc: linux-hwmon, Linus Walleij, Peter Rosin, Chris Lesiak

This switches to retrieveing the configuration of the NTC
from generic firmware properties so that we get neutral from
device tree: now ACPI or, more importantly, software nodes
can be used to spawn NTC devices provided they have the
required properties.

This was inspired by the similar changes made to the IIO
drivers.

This was tested on the Ux500 HREF with the NTC devices
probing from device tree just as fine after this as before.

Cc: Peter Rosin <peda@axentia.se>
Cc: Chris Lesiak <chris.lesiak@licor.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/hwmon/ntc_thermistor.c | 31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c
index 44abcb8a2393..246e109db462 100644
--- a/drivers/hwmon/ntc_thermistor.c
+++ b/drivers/hwmon/ntc_thermistor.c
@@ -9,10 +9,10 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/math64.h>
+#include <linux/mod_devicetable.h>
 #include <linux/platform_device.h>
+#include <linux/property.h>
 #include <linux/err.h>
-#include <linux/of.h>
-#include <linux/of_device.h>
 #include <linux/fixp-arith.h>
 #include <linux/iio/consumer.h>
 #include <linux/hwmon.h>
@@ -598,9 +598,6 @@ static const struct hwmon_chip_info ntc_chip_info = {
 static int ntc_thermistor_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
-	struct device_node *np = dev->of_node;
-	const struct of_device_id *of_id =
-			of_match_device(of_match_ptr(ntc_match), dev);
 	const struct platform_device_id *pdev_id;
 	struct device *hwmon_dev;
 	struct ntc_data *data;
@@ -622,14 +619,19 @@ static int ntc_thermistor_probe(struct platform_device *pdev)
 	if (type != IIO_VOLTAGE)
 		return -EINVAL;
 
-	if (of_property_read_u32(np, "pullup-uv", &data->pullup_uv))
-		return -ENODEV;
-	if (of_property_read_u32(np, "pullup-ohm", &data->pullup_ohm))
-		return -ENODEV;
-	if (of_property_read_u32(np, "pulldown-ohm", &data->pulldown_ohm))
-		return -ENODEV;
+	ret = device_property_read_u32(dev, "pullup-uv", &data->pullup_uv);
+	if (ret)
+		return dev_err_probe(dev,  ret, "pullup-uv not specified\n");
 
-	if (of_find_property(np, "connected-positive", NULL))
+	ret = device_property_read_u32(dev, "pullup-ohm", &data->pullup_ohm);
+	if (ret)
+		return dev_err_probe(dev,  ret, "pullup-ohm not specified\n");
+
+	ret = device_property_read_u32(dev, "pulldown-ohm", &data->pulldown_ohm);
+	if (ret)
+		return dev_err_probe(dev,  ret, "pulldown-ohm not specified\n");
+
+	if (device_property_read_bool(dev, "connected-positive"))
 		data->connect = NTC_CONNECTED_POSITIVE;
 	else /* status change should be possible if not always on. */
 		data->connect = NTC_CONNECTED_GROUND;
@@ -645,8 +647,7 @@ static int ntc_thermistor_probe(struct platform_device *pdev)
 		return -EINVAL;
 	}
 
-	pdev_id = of_id ? of_id->data : platform_get_device_id(pdev);
-
+	pdev_id = device_get_match_data(dev);
 	if (pdev_id->driver_data >= ARRAY_SIZE(ntc_type)) {
 		dev_err(dev, "Unknown device type: %lu(%s)\n",
 				pdev_id->driver_data, pdev_id->name);
@@ -673,7 +674,7 @@ static int ntc_thermistor_probe(struct platform_device *pdev)
 static struct platform_driver ntc_thermistor_driver = {
 	.driver = {
 		.name = "ntc-thermistor",
-		.of_match_table = of_match_ptr(ntc_match),
+		.of_match_table = ntc_match,
 	},
 	.probe = ntc_thermistor_probe,
 	.id_table = ntc_thermistor_id,
-- 
2.31.1


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

* [PATCH 3/3] hwmon: (ntc_thermistor): Move DT matches to the driver block
  2021-12-05 23:59 [PATCH 1/3] hwmon: (ntc_thermistor): Inline OF data lookup in probe() Linus Walleij
  2021-12-05 23:59 ` [PATCH 2/3] hwmon: (ntc_thermistor): Switch to generic firmware props Linus Walleij
@ 2021-12-05 23:59 ` Linus Walleij
  2021-12-07 17:33   ` Guenter Roeck
  2021-12-06  0:38 ` [PATCH 1/3] hwmon: (ntc_thermistor): Inline OF data lookup in probe() Guenter Roeck
  2 siblings, 1 reply; 6+ messages in thread
From: Linus Walleij @ 2021-12-05 23:59 UTC (permalink / raw)
  To: Jean Delvare, Guenter Roeck
  Cc: linux-hwmon, Linus Walleij, Peter Rosin, Chris Lesiak

This moves the device tree match data toward the end of the
driver which is the convention, here we can also add ACPI
and similar match data in a conforming manner.

Cc: Peter Rosin <peda@axentia.se>
Cc: Chris Lesiak <chris.lesiak@licor.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/hwmon/ntc_thermistor.c | 70 +++++++++++++++++-----------------
 1 file changed, 35 insertions(+), 35 deletions(-)

diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c
index 246e109db462..a3588ec12ca5 100644
--- a/drivers/hwmon/ntc_thermistor.c
+++ b/drivers/hwmon/ntc_thermistor.c
@@ -368,41 +368,6 @@ static int ntc_adc_iio_read(struct ntc_data *data)
 	return uv;
 }
 
-static const struct of_device_id ntc_match[] = {
-	{ .compatible = "epcos,b57330v2103",
-		.data = &ntc_thermistor_id[NTC_B57330V2103]},
-	{ .compatible = "epcos,b57891s0103",
-		.data = &ntc_thermistor_id[NTC_B57891S0103] },
-	{ .compatible = "murata,ncp03wb473",
-		.data = &ntc_thermistor_id[NTC_NCP03WB473] },
-	{ .compatible = "murata,ncp03wf104",
-		.data = &ntc_thermistor_id[NTC_NCP03WF104] },
-	{ .compatible = "murata,ncp15wb473",
-		.data = &ntc_thermistor_id[NTC_NCP15WB473] },
-	{ .compatible = "murata,ncp15wl333",
-		.data = &ntc_thermistor_id[NTC_NCP15WL333] },
-	{ .compatible = "murata,ncp15xh103",
-		.data = &ntc_thermistor_id[NTC_NCP15XH103] },
-	{ .compatible = "murata,ncp18wb473",
-		.data = &ntc_thermistor_id[NTC_NCP18WB473] },
-	{ .compatible = "murata,ncp21wb473",
-		.data = &ntc_thermistor_id[NTC_NCP21WB473] },
-
-	/* Usage of vendor name "ntc" is deprecated */
-	{ .compatible = "ntc,ncp03wb473",
-		.data = &ntc_thermistor_id[NTC_NCP03WB473] },
-	{ .compatible = "ntc,ncp15wb473",
-		.data = &ntc_thermistor_id[NTC_NCP15WB473] },
-	{ .compatible = "ntc,ncp15wl333",
-		.data = &ntc_thermistor_id[NTC_NCP15WL333] },
-	{ .compatible = "ntc,ncp18wb473",
-		.data = &ntc_thermistor_id[NTC_NCP18WB473] },
-	{ .compatible = "ntc,ncp21wb473",
-		.data = &ntc_thermistor_id[NTC_NCP21WB473] },
-	{ },
-};
-MODULE_DEVICE_TABLE(of, ntc_match);
-
 static inline u64 div64_u64_safe(u64 dividend, u64 divisor)
 {
 	if (divisor == 0 && dividend == 0)
@@ -671,6 +636,41 @@ static int ntc_thermistor_probe(struct platform_device *pdev)
 	return 0;
 }
 
+static const struct of_device_id ntc_match[] = {
+	{ .compatible = "epcos,b57330v2103",
+		.data = &ntc_thermistor_id[NTC_B57330V2103]},
+	{ .compatible = "epcos,b57891s0103",
+		.data = &ntc_thermistor_id[NTC_B57891S0103] },
+	{ .compatible = "murata,ncp03wb473",
+		.data = &ntc_thermistor_id[NTC_NCP03WB473] },
+	{ .compatible = "murata,ncp03wf104",
+		.data = &ntc_thermistor_id[NTC_NCP03WF104] },
+	{ .compatible = "murata,ncp15wb473",
+		.data = &ntc_thermistor_id[NTC_NCP15WB473] },
+	{ .compatible = "murata,ncp15wl333",
+		.data = &ntc_thermistor_id[NTC_NCP15WL333] },
+	{ .compatible = "murata,ncp15xh103",
+		.data = &ntc_thermistor_id[NTC_NCP15XH103] },
+	{ .compatible = "murata,ncp18wb473",
+		.data = &ntc_thermistor_id[NTC_NCP18WB473] },
+	{ .compatible = "murata,ncp21wb473",
+		.data = &ntc_thermistor_id[NTC_NCP21WB473] },
+
+	/* Usage of vendor name "ntc" is deprecated */
+	{ .compatible = "ntc,ncp03wb473",
+		.data = &ntc_thermistor_id[NTC_NCP03WB473] },
+	{ .compatible = "ntc,ncp15wb473",
+		.data = &ntc_thermistor_id[NTC_NCP15WB473] },
+	{ .compatible = "ntc,ncp15wl333",
+		.data = &ntc_thermistor_id[NTC_NCP15WL333] },
+	{ .compatible = "ntc,ncp18wb473",
+		.data = &ntc_thermistor_id[NTC_NCP18WB473] },
+	{ .compatible = "ntc,ncp21wb473",
+		.data = &ntc_thermistor_id[NTC_NCP21WB473] },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, ntc_match);
+
 static struct platform_driver ntc_thermistor_driver = {
 	.driver = {
 		.name = "ntc-thermistor",
-- 
2.31.1


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

* Re: [PATCH 1/3] hwmon: (ntc_thermistor): Inline OF data lookup in probe()
  2021-12-05 23:59 [PATCH 1/3] hwmon: (ntc_thermistor): Inline OF data lookup in probe() Linus Walleij
  2021-12-05 23:59 ` [PATCH 2/3] hwmon: (ntc_thermistor): Switch to generic firmware props Linus Walleij
  2021-12-05 23:59 ` [PATCH 3/3] hwmon: (ntc_thermistor): Move DT matches to the driver block Linus Walleij
@ 2021-12-06  0:38 ` Guenter Roeck
  2021-12-06  0:46   ` Linus Walleij
  2 siblings, 1 reply; 6+ messages in thread
From: Guenter Roeck @ 2021-12-06  0:38 UTC (permalink / raw)
  To: Linus Walleij, Jean Delvare; +Cc: linux-hwmon, Peter Rosin, Chris Lesiak

On 12/5/21 3:59 PM, Linus Walleij wrote:
> There is no need to allocate the state container and look
> up DT properties in a separate function if OF is all we
> support. Inline it into probe().
> 

This is POV. Old fashioned as I am, I still prefer smaller
functions over large ones. Is there a _technical_ reason
for this change ?

Guenter

> Cc: Peter Rosin <peda@axentia.se>
> Cc: Chris Lesiak <chris.lesiak@licor.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> > ---
>   drivers/hwmon/ntc_thermistor.c | 76 ++++++++++++----------------------
>   1 file changed, 27 insertions(+), 49 deletions(-)
> 
> diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c
> index ed638ebd0923..44abcb8a2393 100644
> --- a/drivers/hwmon/ntc_thermistor.c
> +++ b/drivers/hwmon/ntc_thermistor.c
> @@ -403,49 +403,6 @@ static const struct of_device_id ntc_match[] = {
>   };
>   MODULE_DEVICE_TABLE(of, ntc_match);
>   
> -static struct ntc_data *ntc_thermistor_parse_dt(struct device *dev)
> -{
> -	struct ntc_data *data;
> -	struct iio_channel *chan;
> -	enum iio_chan_type type;
> -	struct device_node *np = dev->of_node;
> -	int ret;
> -
> -	if (!np)
> -		return NULL;
> -
> -	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
> -	if (!data)
> -		return ERR_PTR(-ENOMEM);
> -
> -	chan = devm_iio_channel_get(dev, NULL);
> -	if (IS_ERR(chan))
> -		return ERR_CAST(chan);
> -
> -	ret = iio_get_channel_type(chan, &type);
> -	if (ret < 0)
> -		return ERR_PTR(ret);
> -
> -	if (type != IIO_VOLTAGE)
> -		return ERR_PTR(-EINVAL);
> -
> -	if (of_property_read_u32(np, "pullup-uv", &data->pullup_uv))
> -		return ERR_PTR(-ENODEV);
> -	if (of_property_read_u32(np, "pullup-ohm", &data->pullup_ohm))
> -		return ERR_PTR(-ENODEV);
> -	if (of_property_read_u32(np, "pulldown-ohm", &data->pulldown_ohm))
> -		return ERR_PTR(-ENODEV);
> -
> -	if (of_find_property(np, "connected-positive", NULL))
> -		data->connect = NTC_CONNECTED_POSITIVE;
> -	else /* status change should be possible if not always on. */
> -		data->connect = NTC_CONNECTED_GROUND;
> -
> -	data->chan = chan;
> -
> -	return data;
> -}
> -
>   static inline u64 div64_u64_safe(u64 dividend, u64 divisor)
>   {
>   	if (divisor == 0 && dividend == 0)
> @@ -641,20 +598,41 @@ static const struct hwmon_chip_info ntc_chip_info = {
>   static int ntc_thermistor_probe(struct platform_device *pdev)
>   {
>   	struct device *dev = &pdev->dev;
> +	struct device_node *np = dev->of_node;
>   	const struct of_device_id *of_id =
>   			of_match_device(of_match_ptr(ntc_match), dev);
>   	const struct platform_device_id *pdev_id;
>   	struct device *hwmon_dev;
>   	struct ntc_data *data;
> +	enum iio_chan_type type;
> +	int ret;
>   
> -	data = ntc_thermistor_parse_dt(dev);
> -	if (IS_ERR(data))
> -		return PTR_ERR(data);
> +	data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
> +	if (!data)
> +		return -ENOMEM;
> +
> +	data->chan = devm_iio_channel_get(dev, NULL);
> +	if (IS_ERR(data->chan))
> +		return PTR_ERR(data->chan);
> +
> +	ret = iio_get_channel_type(data->chan, &type);
> +	if (ret < 0)
> +		return ret;
>   
> -	if (!data) {
> -		dev_err(dev, "No platform init data supplied.\n");
> +	if (type != IIO_VOLTAGE)
> +		return -EINVAL;
> +
> +	if (of_property_read_u32(np, "pullup-uv", &data->pullup_uv))
>   		return -ENODEV;
> -	}
> +	if (of_property_read_u32(np, "pullup-ohm", &data->pullup_ohm))
> +		return -ENODEV;
> +	if (of_property_read_u32(np, "pulldown-ohm", &data->pulldown_ohm))
> +		return -ENODEV;
> +
> +	if (of_find_property(np, "connected-positive", NULL))
> +		data->connect = NTC_CONNECTED_POSITIVE;
> +	else /* status change should be possible if not always on. */
> +		data->connect = NTC_CONNECTED_GROUND;
>   
>   	if (data->pullup_uv == 0 ||
>   	    (data->pullup_ohm == 0 && data->connect ==
> 


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

* Re: [PATCH 1/3] hwmon: (ntc_thermistor): Inline OF data lookup in probe()
  2021-12-06  0:38 ` [PATCH 1/3] hwmon: (ntc_thermistor): Inline OF data lookup in probe() Guenter Roeck
@ 2021-12-06  0:46   ` Linus Walleij
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Walleij @ 2021-12-06  0:46 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Jean Delvare, linux-hwmon, Peter Rosin, Chris Lesiak

On Mon, Dec 6, 2021 at 1:38 AM Guenter Roeck <linux@roeck-us.net> wrote:
> On 12/5/21 3:59 PM, Linus Walleij wrote:
> > There is no need to allocate the state container and look
> > up DT properties in a separate function if OF is all we
> > support. Inline it into probe().
> >
>
> This is POV. Old fashioned as I am, I still prefer smaller
> functions over large ones. Is there a _technical_ reason
> for this change ?

Mainly the *data state container should be allocated in
probe() but I can keep the rest in a separate (renamed,
moved) function, I can certainly respin it like such, just
a minute!

Yours,
Linus Walleij

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

* Re: [PATCH 3/3] hwmon: (ntc_thermistor): Move DT matches to the driver block
  2021-12-05 23:59 ` [PATCH 3/3] hwmon: (ntc_thermistor): Move DT matches to the driver block Linus Walleij
@ 2021-12-07 17:33   ` Guenter Roeck
  0 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2021-12-07 17:33 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Jean Delvare, linux-hwmon, Peter Rosin, Chris Lesiak

On Mon, Dec 06, 2021 at 12:59:48AM +0100, Linus Walleij wrote:
> This moves the device tree match data toward the end of the
> driver which is the convention, here we can also add ACPI
> and similar match data in a conforming manner.
> 
> Cc: Peter Rosin <peda@axentia.se>
> Cc: Chris Lesiak <chris.lesiak@licor.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

Applied.

Thanks,
Guenter

> ---
>  drivers/hwmon/ntc_thermistor.c | 70 +++++++++++++++++-----------------
>  1 file changed, 35 insertions(+), 35 deletions(-)
> 
> diff --git a/drivers/hwmon/ntc_thermistor.c b/drivers/hwmon/ntc_thermistor.c
> index 246e109db462..a3588ec12ca5 100644
> --- a/drivers/hwmon/ntc_thermistor.c
> +++ b/drivers/hwmon/ntc_thermistor.c
> @@ -368,41 +368,6 @@ static int ntc_adc_iio_read(struct ntc_data *data)
>  	return uv;
>  }
>  
> -static const struct of_device_id ntc_match[] = {
> -	{ .compatible = "epcos,b57330v2103",
> -		.data = &ntc_thermistor_id[NTC_B57330V2103]},
> -	{ .compatible = "epcos,b57891s0103",
> -		.data = &ntc_thermistor_id[NTC_B57891S0103] },
> -	{ .compatible = "murata,ncp03wb473",
> -		.data = &ntc_thermistor_id[NTC_NCP03WB473] },
> -	{ .compatible = "murata,ncp03wf104",
> -		.data = &ntc_thermistor_id[NTC_NCP03WF104] },
> -	{ .compatible = "murata,ncp15wb473",
> -		.data = &ntc_thermistor_id[NTC_NCP15WB473] },
> -	{ .compatible = "murata,ncp15wl333",
> -		.data = &ntc_thermistor_id[NTC_NCP15WL333] },
> -	{ .compatible = "murata,ncp15xh103",
> -		.data = &ntc_thermistor_id[NTC_NCP15XH103] },
> -	{ .compatible = "murata,ncp18wb473",
> -		.data = &ntc_thermistor_id[NTC_NCP18WB473] },
> -	{ .compatible = "murata,ncp21wb473",
> -		.data = &ntc_thermistor_id[NTC_NCP21WB473] },
> -
> -	/* Usage of vendor name "ntc" is deprecated */
> -	{ .compatible = "ntc,ncp03wb473",
> -		.data = &ntc_thermistor_id[NTC_NCP03WB473] },
> -	{ .compatible = "ntc,ncp15wb473",
> -		.data = &ntc_thermistor_id[NTC_NCP15WB473] },
> -	{ .compatible = "ntc,ncp15wl333",
> -		.data = &ntc_thermistor_id[NTC_NCP15WL333] },
> -	{ .compatible = "ntc,ncp18wb473",
> -		.data = &ntc_thermistor_id[NTC_NCP18WB473] },
> -	{ .compatible = "ntc,ncp21wb473",
> -		.data = &ntc_thermistor_id[NTC_NCP21WB473] },
> -	{ },
> -};
> -MODULE_DEVICE_TABLE(of, ntc_match);
> -
>  static inline u64 div64_u64_safe(u64 dividend, u64 divisor)
>  {
>  	if (divisor == 0 && dividend == 0)
> @@ -671,6 +636,41 @@ static int ntc_thermistor_probe(struct platform_device *pdev)
>  	return 0;
>  }
>  
> +static const struct of_device_id ntc_match[] = {
> +	{ .compatible = "epcos,b57330v2103",
> +		.data = &ntc_thermistor_id[NTC_B57330V2103]},
> +	{ .compatible = "epcos,b57891s0103",
> +		.data = &ntc_thermistor_id[NTC_B57891S0103] },
> +	{ .compatible = "murata,ncp03wb473",
> +		.data = &ntc_thermistor_id[NTC_NCP03WB473] },
> +	{ .compatible = "murata,ncp03wf104",
> +		.data = &ntc_thermistor_id[NTC_NCP03WF104] },
> +	{ .compatible = "murata,ncp15wb473",
> +		.data = &ntc_thermistor_id[NTC_NCP15WB473] },
> +	{ .compatible = "murata,ncp15wl333",
> +		.data = &ntc_thermistor_id[NTC_NCP15WL333] },
> +	{ .compatible = "murata,ncp15xh103",
> +		.data = &ntc_thermistor_id[NTC_NCP15XH103] },
> +	{ .compatible = "murata,ncp18wb473",
> +		.data = &ntc_thermistor_id[NTC_NCP18WB473] },
> +	{ .compatible = "murata,ncp21wb473",
> +		.data = &ntc_thermistor_id[NTC_NCP21WB473] },
> +
> +	/* Usage of vendor name "ntc" is deprecated */
> +	{ .compatible = "ntc,ncp03wb473",
> +		.data = &ntc_thermistor_id[NTC_NCP03WB473] },
> +	{ .compatible = "ntc,ncp15wb473",
> +		.data = &ntc_thermistor_id[NTC_NCP15WB473] },
> +	{ .compatible = "ntc,ncp15wl333",
> +		.data = &ntc_thermistor_id[NTC_NCP15WL333] },
> +	{ .compatible = "ntc,ncp18wb473",
> +		.data = &ntc_thermistor_id[NTC_NCP18WB473] },
> +	{ .compatible = "ntc,ncp21wb473",
> +		.data = &ntc_thermistor_id[NTC_NCP21WB473] },
> +	{ },
> +};
> +MODULE_DEVICE_TABLE(of, ntc_match);
> +
>  static struct platform_driver ntc_thermistor_driver = {
>  	.driver = {
>  		.name = "ntc-thermistor",

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

end of thread, other threads:[~2021-12-07 17:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-05 23:59 [PATCH 1/3] hwmon: (ntc_thermistor): Inline OF data lookup in probe() Linus Walleij
2021-12-05 23:59 ` [PATCH 2/3] hwmon: (ntc_thermistor): Switch to generic firmware props Linus Walleij
2021-12-05 23:59 ` [PATCH 3/3] hwmon: (ntc_thermistor): Move DT matches to the driver block Linus Walleij
2021-12-07 17:33   ` Guenter Roeck
2021-12-06  0:38 ` [PATCH 1/3] hwmon: (ntc_thermistor): Inline OF data lookup in probe() Guenter Roeck
2021-12-06  0:46   ` Linus Walleij

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.