linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] thermal: exynos: use of_property_read_u8()
@ 2015-11-23 14:10 Saurabh Sengar
  2015-11-23 23:29 ` Eduardo Valentin
  0 siblings, 1 reply; 3+ messages in thread
From: Saurabh Sengar @ 2015-11-23 14:10 UTC (permalink / raw)
  To: l.majewski, rui.zhang, edubezval, kgene, k.kozlowski,
	linux-samsung-soc, linux-kernel
  Cc: Saurabh Sengar

use of_property_read_u8() for u8 variables,
also changed the return type to void as this function return type
is nowhere used.

Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
---
 drivers/thermal/samsung/exynos_tmu.c | 30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
index fa61eff..b692c95 100644
--- a/drivers/thermal/samsung/exynos_tmu.c
+++ b/drivers/thermal/samsung/exynos_tmu.c
@@ -1128,20 +1128,16 @@ static int exynos_of_get_soc_type(struct device_node *np)
 	return -EINVAL;
 }
 
-static int exynos_of_sensor_conf(struct device_node *np,
+static void exynos_of_sensor_conf(struct device_node *np,
 				 struct exynos_tmu_platform_data *pdata)
 {
-	u32 value;
-	int ret;
-
 	of_node_get(np);
 
-	ret = of_property_read_u32(np, "samsung,tmu_gain", &value);
-	pdata->gain = (u8)value;
-	of_property_read_u32(np, "samsung,tmu_reference_voltage", &value);
-	pdata->reference_voltage = (u8)value;
-	of_property_read_u32(np, "samsung,tmu_noise_cancel_mode", &value);
-	pdata->noise_cancel_mode = (u8)value;
+	of_property_read_u8(np, "samsung,tmu_gain", &pdata->gain);
+	of_property_read_u8(np, "samsung,tmu_reference_voltage",
+				&pdata->reference_voltage);
+	of_property_read_u8(np, "samsung,tmu_noise_cancel_mode",
+				&pdata->noise_cancel_mode);
 
 	of_property_read_u32(np, "samsung,tmu_efuse_value",
 			     &pdata->efuse_value);
@@ -1150,18 +1146,18 @@ static int exynos_of_sensor_conf(struct device_node *np,
 	of_property_read_u32(np, "samsung,tmu_max_efuse_value",
 			     &pdata->max_efuse_value);
 
-	of_property_read_u32(np, "samsung,tmu_first_point_trim", &value);
-	pdata->first_point_trim = (u8)value;
-	of_property_read_u32(np, "samsung,tmu_second_point_trim", &value);
-	pdata->second_point_trim = (u8)value;
-	of_property_read_u32(np, "samsung,tmu_default_temp_offset", &value);
-	pdata->default_temp_offset = (u8)value;
+	of_property_read_u8(np, "samsung,tmu_first_point_trim",
+				&pdata->first_point_trim);
+	of_property_read_u8(np, "samsung,tmu_second_point_trim",
+				&pdata->second_point_trim);
+	of_property_read_u8(np, "samsung,tmu_default_temp_offset",
+				&pdata->default_temp_offset);
 
 	of_property_read_u32(np, "samsung,tmu_cal_type", &pdata->cal_type);
 	of_property_read_u32(np, "samsung,tmu_cal_mode", &pdata->cal_mode);
 
 	of_node_put(np);
-	return 0;
+	return;
 }
 
 static int exynos_map_dt_data(struct platform_device *pdev)
-- 
1.9.1


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

* Re: [PATCH] thermal: exynos: use of_property_read_u8()
  2015-11-23 14:10 [PATCH] thermal: exynos: use of_property_read_u8() Saurabh Sengar
@ 2015-11-23 23:29 ` Eduardo Valentin
  2015-11-24  1:28   ` Krzysztof Kozlowski
  0 siblings, 1 reply; 3+ messages in thread
From: Eduardo Valentin @ 2015-11-23 23:29 UTC (permalink / raw)
  To: Saurabh Sengar
  Cc: l.majewski, rui.zhang, kgene, k.kozlowski, linux-samsung-soc,
	linux-kernel

On Mon, Nov 23, 2015 at 07:40:41PM +0530, Saurabh Sengar wrote:
> use of_property_read_u8() for u8 variables,
> also changed the return type to void as this function return type
> is nowhere used.
> 

I would be good if you could split both changes into two patches.

Also, I still do not understand properly the proposal to use u8.

Why are they u8?

If they are so, please document them in their DT bindings. Today, the
bindings tell us they are s32 (as there is nothing really specifying the
type).


BR


> Signed-off-by: Saurabh Sengar <saurabh.truth@gmail.com>
> ---
>  drivers/thermal/samsung/exynos_tmu.c | 30 +++++++++++++-----------------
>  1 file changed, 13 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/thermal/samsung/exynos_tmu.c b/drivers/thermal/samsung/exynos_tmu.c
> index fa61eff..b692c95 100644
> --- a/drivers/thermal/samsung/exynos_tmu.c
> +++ b/drivers/thermal/samsung/exynos_tmu.c
> @@ -1128,20 +1128,16 @@ static int exynos_of_get_soc_type(struct device_node *np)
>  	return -EINVAL;
>  }
>  
> -static int exynos_of_sensor_conf(struct device_node *np,
> +static void exynos_of_sensor_conf(struct device_node *np,
>  				 struct exynos_tmu_platform_data *pdata)
>  {
> -	u32 value;
> -	int ret;
> -
>  	of_node_get(np);
>  
> -	ret = of_property_read_u32(np, "samsung,tmu_gain", &value);
> -	pdata->gain = (u8)value;
> -	of_property_read_u32(np, "samsung,tmu_reference_voltage", &value);
> -	pdata->reference_voltage = (u8)value;
> -	of_property_read_u32(np, "samsung,tmu_noise_cancel_mode", &value);
> -	pdata->noise_cancel_mode = (u8)value;
> +	of_property_read_u8(np, "samsung,tmu_gain", &pdata->gain);
> +	of_property_read_u8(np, "samsung,tmu_reference_voltage",
> +				&pdata->reference_voltage);
> +	of_property_read_u8(np, "samsung,tmu_noise_cancel_mode",
> +				&pdata->noise_cancel_mode);
>  
>  	of_property_read_u32(np, "samsung,tmu_efuse_value",
>  			     &pdata->efuse_value);
> @@ -1150,18 +1146,18 @@ static int exynos_of_sensor_conf(struct device_node *np,
>  	of_property_read_u32(np, "samsung,tmu_max_efuse_value",
>  			     &pdata->max_efuse_value);
>  
> -	of_property_read_u32(np, "samsung,tmu_first_point_trim", &value);
> -	pdata->first_point_trim = (u8)value;
> -	of_property_read_u32(np, "samsung,tmu_second_point_trim", &value);
> -	pdata->second_point_trim = (u8)value;
> -	of_property_read_u32(np, "samsung,tmu_default_temp_offset", &value);
> -	pdata->default_temp_offset = (u8)value;
> +	of_property_read_u8(np, "samsung,tmu_first_point_trim",
> +				&pdata->first_point_trim);
> +	of_property_read_u8(np, "samsung,tmu_second_point_trim",
> +				&pdata->second_point_trim);
> +	of_property_read_u8(np, "samsung,tmu_default_temp_offset",
> +				&pdata->default_temp_offset);
>  
>  	of_property_read_u32(np, "samsung,tmu_cal_type", &pdata->cal_type);
>  	of_property_read_u32(np, "samsung,tmu_cal_mode", &pdata->cal_mode);
>  
>  	of_node_put(np);
> -	return 0;
> +	return;

The landing return; is not needed.

>  }
>  
>  static int exynos_map_dt_data(struct platform_device *pdev)
> -- 
> 1.9.1
> 

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

* Re: [PATCH] thermal: exynos: use of_property_read_u8()
  2015-11-23 23:29 ` Eduardo Valentin
@ 2015-11-24  1:28   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 3+ messages in thread
From: Krzysztof Kozlowski @ 2015-11-24  1:28 UTC (permalink / raw)
  To: Eduardo Valentin, Saurabh Sengar
  Cc: l.majewski, rui.zhang, kgene, linux-samsung-soc, linux-kernel

On 24.11.2015 08:29, Eduardo Valentin wrote:
> On Mon, Nov 23, 2015 at 07:40:41PM +0530, Saurabh Sengar wrote:
>> use of_property_read_u8() for u8 variables,
>> also changed the return type to void as this function return type
>> is nowhere used.
>>
> 
> I would be good if you could split both changes into two patches.
> 
> Also, I still do not understand properly the proposal to use u8.
> 
> Why are they u8?
> 
> If they are so, please document them in their DT bindings. Today, the
> bindings tell us they are s32 (as there is nothing really specifying the
> type).

It looks like u8 came from platform data from old times when the driver
did not support DT. All of our Exynos mainline boards are converted to
DT, so I think legacy platform data can be also changed to match DT.
Which means changing from u8 to u32.

Best regards,
Krzysztof



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

end of thread, other threads:[~2015-11-24  1:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-23 14:10 [PATCH] thermal: exynos: use of_property_read_u8() Saurabh Sengar
2015-11-23 23:29 ` Eduardo Valentin
2015-11-24  1:28   ` Krzysztof Kozlowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).