linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 08/11] firmware: arm_scmi: Drop async flag in sensor_ops->reading_get
       [not found] <20190708154730.16643-1-sudeep.holla@arm.com>
@ 2019-07-08 15:47 ` Sudeep Holla
  2019-07-08 16:05   ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Sudeep Holla @ 2019-07-08 15:47 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Sudeep Holla, linux-kernel, Peng Fan, Jim Quinlan, Bo Zhang,
	Volodymyr Babchuk, Guenter Roeck, linux-hwmon

SENSOR_DESCRIPTION_GET provides attributes to indicate if the sensor
supports asynchronous read. Ideally we should be able to read that flag
and use asynchronous reads for any sensors with that attribute set.

In order to add that support, let's drop the async flag passed to
sensor_ops->reading_get and dynamically switch between sync and async
flags based on the attributes as provided by the firmware.

Cc: Guenter Roeck <linux@roeck-us.net>
Cc: linux-hwmon@vger.kernel.org
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
---
 drivers/firmware/arm_scmi/sensors.c | 4 ++--
 drivers/hwmon/scmi-hwmon.c          | 2 +-
 include/linux/scmi_protocol.h       | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scmi/sensors.c
index 17dbabd8a94a..1b5757c77a35 100644
--- a/drivers/firmware/arm_scmi/sensors.c
+++ b/drivers/firmware/arm_scmi/sensors.c
@@ -211,7 +211,7 @@ scmi_sensor_trip_point_config(const struct scmi_handle *handle, u32 sensor_id,
 }
 
 static int scmi_sensor_reading_get(const struct scmi_handle *handle,
-				   u32 sensor_id, bool async, u64 *value)
+				   u32 sensor_id, u64 *value)
 {
 	int ret;
 	struct scmi_xfer *t;
@@ -225,7 +225,7 @@ static int scmi_sensor_reading_get(const struct scmi_handle *handle,
 
 	sensor = t->tx.buf;
 	sensor->id = cpu_to_le32(sensor_id);
-	sensor->flags = cpu_to_le32(async ? SENSOR_READ_ASYNC : 0);
+	sensor->flags = cpu_to_le32(0);
 
 	ret = scmi_do_xfer(handle, t);
 	if (!ret) {
diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c
index 0c93fc5ca762..8a7732c0bef3 100644
--- a/drivers/hwmon/scmi-hwmon.c
+++ b/drivers/hwmon/scmi-hwmon.c
@@ -72,7 +72,7 @@ static int scmi_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
 	const struct scmi_handle *h = scmi_sensors->handle;
 
 	sensor = *(scmi_sensors->info[type] + channel);
-	ret = h->sensor_ops->reading_get(h, sensor->id, false, &value);
+	ret = h->sensor_ops->reading_get(h, sensor->id, &value);
 	if (ret)
 		return ret;
 
diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h
index ea6b72018752..697e30fb9004 100644
--- a/include/linux/scmi_protocol.h
+++ b/include/linux/scmi_protocol.h
@@ -182,7 +182,7 @@ struct scmi_sensor_ops {
 	int (*trip_point_config)(const struct scmi_handle *handle,
 				 u32 sensor_id, u8 trip_id, u64 trip_value);
 	int (*reading_get)(const struct scmi_handle *handle, u32 sensor_id,
-			   bool async, u64 *value);
+			   u64 *value);
 };
 
 /**
-- 
2.17.1


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

* Re: [PATCH 08/11] firmware: arm_scmi: Drop async flag in sensor_ops->reading_get
  2019-07-08 15:47 ` [PATCH 08/11] firmware: arm_scmi: Drop async flag in sensor_ops->reading_get Sudeep Holla
@ 2019-07-08 16:05   ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2019-07-08 16:05 UTC (permalink / raw)
  To: Sudeep Holla
  Cc: linux-arm-kernel, linux-kernel, Peng Fan, Jim Quinlan, Bo Zhang,
	Volodymyr Babchuk, linux-hwmon

On Mon, Jul 08, 2019 at 04:47:27PM +0100, Sudeep Holla wrote:
> SENSOR_DESCRIPTION_GET provides attributes to indicate if the sensor
> supports asynchronous read. Ideally we should be able to read that flag
> and use asynchronous reads for any sensors with that attribute set.
> 
> In order to add that support, let's drop the async flag passed to
> sensor_ops->reading_get and dynamically switch between sync and async
> flags based on the attributes as provided by the firmware.
> 
> Cc: Guenter Roeck <linux@roeck-us.net>
> Cc: linux-hwmon@vger.kernel.org
> Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>

For hwmon:

Acked-by: Guenter Roeck <linux@roeck-us.net>

Guenter

> ---
>  drivers/firmware/arm_scmi/sensors.c | 4 ++--
>  drivers/hwmon/scmi-hwmon.c          | 2 +-
>  include/linux/scmi_protocol.h       | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/firmware/arm_scmi/sensors.c b/drivers/firmware/arm_scmi/sensors.c
> index 17dbabd8a94a..1b5757c77a35 100644
> --- a/drivers/firmware/arm_scmi/sensors.c
> +++ b/drivers/firmware/arm_scmi/sensors.c
> @@ -211,7 +211,7 @@ scmi_sensor_trip_point_config(const struct scmi_handle *handle, u32 sensor_id,
>  }
>  
>  static int scmi_sensor_reading_get(const struct scmi_handle *handle,
> -				   u32 sensor_id, bool async, u64 *value)
> +				   u32 sensor_id, u64 *value)
>  {
>  	int ret;
>  	struct scmi_xfer *t;
> @@ -225,7 +225,7 @@ static int scmi_sensor_reading_get(const struct scmi_handle *handle,
>  
>  	sensor = t->tx.buf;
>  	sensor->id = cpu_to_le32(sensor_id);
> -	sensor->flags = cpu_to_le32(async ? SENSOR_READ_ASYNC : 0);
> +	sensor->flags = cpu_to_le32(0);
>  
>  	ret = scmi_do_xfer(handle, t);
>  	if (!ret) {
> diff --git a/drivers/hwmon/scmi-hwmon.c b/drivers/hwmon/scmi-hwmon.c
> index 0c93fc5ca762..8a7732c0bef3 100644
> --- a/drivers/hwmon/scmi-hwmon.c
> +++ b/drivers/hwmon/scmi-hwmon.c
> @@ -72,7 +72,7 @@ static int scmi_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
>  	const struct scmi_handle *h = scmi_sensors->handle;
>  
>  	sensor = *(scmi_sensors->info[type] + channel);
> -	ret = h->sensor_ops->reading_get(h, sensor->id, false, &value);
> +	ret = h->sensor_ops->reading_get(h, sensor->id, &value);
>  	if (ret)
>  		return ret;
>  
> diff --git a/include/linux/scmi_protocol.h b/include/linux/scmi_protocol.h
> index ea6b72018752..697e30fb9004 100644
> --- a/include/linux/scmi_protocol.h
> +++ b/include/linux/scmi_protocol.h
> @@ -182,7 +182,7 @@ struct scmi_sensor_ops {
>  	int (*trip_point_config)(const struct scmi_handle *handle,
>  				 u32 sensor_id, u8 trip_id, u64 trip_value);
>  	int (*reading_get)(const struct scmi_handle *handle, u32 sensor_id,
> -			   bool async, u64 *value);
> +			   u64 *value);
>  };
>  
>  /**
> -- 
> 2.17.1
> 

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

end of thread, other threads:[~2019-07-08 16:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20190708154730.16643-1-sudeep.holla@arm.com>
2019-07-08 15:47 ` [PATCH 08/11] firmware: arm_scmi: Drop async flag in sensor_ops->reading_get Sudeep Holla
2019-07-08 16:05   ` Guenter Roeck

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).