public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hwmon: ibmpex.c remove inline wrapper of be16_to_cpup
@ 2008-08-26 22:45 Harvey Harrison
  2008-08-27  8:06 ` Jean Delvare
  0 siblings, 1 reply; 2+ messages in thread
From: Harvey Harrison @ 2008-08-26 22:45 UTC (permalink / raw)
  To: Mark M. Hoffman, Jean Delvare; +Cc: Andrew Morton, LKML

Sparse noticed the helper was missing a cast:
drivers/hwmon/ibmpex.c:43:23: warning: incorrect type in argument 1 (different base types)
drivers/hwmon/ibmpex.c:43:23:    expected restricted __be16 const [usertype] *p
drivers/hwmon/ibmpex.c:43:23:    got unsigned short [usertype] *<noident>

Just open-code the helper as it didn't add anything.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
---
 drivers/hwmon/ibmpex.c |   13 ++++---------
 1 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/hwmon/ibmpex.c b/drivers/hwmon/ibmpex.c
index 4e9b19c..abc8fb0 100644
--- a/drivers/hwmon/ibmpex.c
+++ b/drivers/hwmon/ibmpex.c
@@ -38,11 +38,6 @@
 #define PEX_NET_FUNCTION	0x3A
 #define PEX_COMMAND		0x3C
 
-static inline u16 extract_value(const char *data, int offset)
-{
-	return be16_to_cpup((u16 *)&data[offset]);
-}
-
 #define TEMP_SENSOR		1
 #define POWER_SENSOR		2
 
@@ -165,7 +160,7 @@ static int ibmpex_ver_check(struct ibmpex_bmc_data *data)
 		 "v%d.%d %d-%02d-%02d on interface %d\n",
 		 data->sensor_major,
 		 data->sensor_minor,
-		 extract_value(data->rx_msg_data, 2),
+		 be16_to_cpup((__be16 *)&data->rx_msg_data[2]),
 		 data->rx_msg_data[4],
 		 data->rx_msg_data[5],
 		 data->interface);
@@ -247,11 +242,11 @@ static void ibmpex_update_device(struct ibmpex_bmc_data *data)
 		if (err)
 			continue;
 		data->sensors[i].values[0] =
-			extract_value(data->rx_msg_data, 16);
+			be16_to_cpup((__be16 *)&data->rx_msg_data[16]);
 		data->sensors[i].values[1] =
-			extract_value(data->rx_msg_data, 18);
+			be16_to_cpup((__be16 *)&data->rx_msg_data[18]);
 		data->sensors[i].values[2] =
-			extract_value(data->rx_msg_data, 20);
+			be16_to_cpup((__be16 *)&data->rx_msg_data[20]);
 	}
 
 	data->last_updated = jiffies;
-- 
1.6.0.340.g84854




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

* Re: [PATCH] hwmon: ibmpex.c remove inline wrapper of be16_to_cpup
  2008-08-26 22:45 [PATCH] hwmon: ibmpex.c remove inline wrapper of be16_to_cpup Harvey Harrison
@ 2008-08-27  8:06 ` Jean Delvare
  0 siblings, 0 replies; 2+ messages in thread
From: Jean Delvare @ 2008-08-27  8:06 UTC (permalink / raw)
  To: Harvey Harrison; +Cc: Andrew Morton, LKML

Hi Harvey,

On Tue, 26 Aug 2008 15:45:55 -0700, Harvey Harrison wrote:
> Sparse noticed the helper was missing a cast:
> drivers/hwmon/ibmpex.c:43:23: warning: incorrect type in argument 1 (different base types)
> drivers/hwmon/ibmpex.c:43:23:    expected restricted __be16 const [usertype] *p
> drivers/hwmon/ibmpex.c:43:23:    got unsigned short [usertype] *<noident>
> 
> Just open-code the helper as it didn't add anything.
> 
> Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
> ---
>  drivers/hwmon/ibmpex.c |   13 ++++---------
>  1 files changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/hwmon/ibmpex.c b/drivers/hwmon/ibmpex.c
> index 4e9b19c..abc8fb0 100644
> --- a/drivers/hwmon/ibmpex.c
> +++ b/drivers/hwmon/ibmpex.c
> @@ -38,11 +38,6 @@
>  #define PEX_NET_FUNCTION	0x3A
>  #define PEX_COMMAND		0x3C
>  
> -static inline u16 extract_value(const char *data, int offset)
> -{
> -	return be16_to_cpup((u16 *)&data[offset]);
> -}
> -
>  #define TEMP_SENSOR		1
>  #define POWER_SENSOR		2
>  
> @@ -165,7 +160,7 @@ static int ibmpex_ver_check(struct ibmpex_bmc_data *data)
>  		 "v%d.%d %d-%02d-%02d on interface %d\n",
>  		 data->sensor_major,
>  		 data->sensor_minor,
> -		 extract_value(data->rx_msg_data, 2),
> +		 be16_to_cpup((__be16 *)&data->rx_msg_data[2]),
>  		 data->rx_msg_data[4],
>  		 data->rx_msg_data[5],
>  		 data->interface);
> @@ -247,11 +242,11 @@ static void ibmpex_update_device(struct ibmpex_bmc_data *data)
>  		if (err)
>  			continue;
>  		data->sensors[i].values[0] =
> -			extract_value(data->rx_msg_data, 16);
> +			be16_to_cpup((__be16 *)&data->rx_msg_data[16]);
>  		data->sensors[i].values[1] =
> -			extract_value(data->rx_msg_data, 18);
> +			be16_to_cpup((__be16 *)&data->rx_msg_data[18]);
>  		data->sensors[i].values[2] =
> -			extract_value(data->rx_msg_data, 20);
> +			be16_to_cpup((__be16 *)&data->rx_msg_data[20]);
>  	}
>  
>  	data->last_updated = jiffies;

Please send this patch to the lm-sensors list (as specified in
MAINTAINERS) and to the driver author (Darrick J. Wong) so that it can
get review and testing.

Thanks,
-- 
Jean Delvare

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

end of thread, other threads:[~2008-08-27  8:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-08-26 22:45 [PATCH] hwmon: ibmpex.c remove inline wrapper of be16_to_cpup Harvey Harrison
2008-08-27  8:06 ` Jean Delvare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox