firmware: arm_scmi: Drop async flag in sensor_ops->reading_get
authorSudeep Holla <sudeep.holla@arm.com>
Mon, 8 Jul 2019 08:40:57 +0000 (09:40 +0100)
committerSudeep Holla <sudeep.holla@arm.com>
Mon, 12 Aug 2019 11:23:00 +0000 (12:23 +0100)
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: linux-hwmon@vger.kernel.org
Acked-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
drivers/firmware/arm_scmi/sensors.c
drivers/hwmon/scmi-hwmon.c
include/linux/scmi_protocol.h

index 17dbabd8a94aeb50b39824e09d3002650cf3d995..1b5757c77a359dbe8b8214d7ac46465aae0a0858 100644 (file)
@@ -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) {
index 0c93fc5ca762ecfe7690fe482f9ff4f9a9a77b4d..8a7732c0bef3e4fdbd1a2fa4b56d5998f38eae2b 100644 (file)
@@ -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;
 
index 1383d47e643536fe8fb39a90d3a7117274a1ae6b..2ace5af210adba771809be963020caae89c92fbe 100644 (file)
@@ -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);
 };
 
 /**