summaryrefslogtreecommitdiffstats
path: root/drivers/platform/chrome
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2020-03-27 23:34:32 +0100
committerEnric Balletbo i Serra <enric.balletbo@collabora.com>2020-03-28 22:04:32 +0100
commitcee416a347440628762db2257ff921ccf9f66923 (patch)
tree5c9bc2d7f5ec0b3016bcfecb444c56350481d327 /drivers/platform/chrome
parentplatform/chrome: chromeos_laptop: make I2C API conversion complete (diff)
downloadlinux-cee416a347440628762db2257ff921ccf9f66923.tar.xz
linux-cee416a347440628762db2257ff921ccf9f66923.zip
platform/chrome: cros_ec_sensorhub: Add the number of sensors in sensorhub
To better manage resources, store the number of sensors reported by the EC. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Diffstat (limited to 'drivers/platform/chrome')
-rw-r--r--drivers/platform/chrome/cros_ec_sensorhub.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/platform/chrome/cros_ec_sensorhub.c b/drivers/platform/chrome/cros_ec_sensorhub.c
index 79fefd3bb0fa..134ee5e46047 100644
--- a/drivers/platform/chrome/cros_ec_sensorhub.c
+++ b/drivers/platform/chrome/cros_ec_sensorhub.c
@@ -65,6 +65,7 @@ static int cros_ec_sensorhub_register(struct device *dev,
return sensor_num;
}
+ sensorhub->sensor_num = sensor_num;
if (sensor_num == 0) {
dev_err(dev, "Zero sensors reported.\n");
return -EINVAL;
@@ -172,7 +173,8 @@ static int cros_ec_sensorhub_probe(struct platform_device *pdev)
* If the device has sensors but does not claim to
* be a sensor hub, we are in legacy mode.
*/
- for (i = 0; i < 2; i++) {
+ data->sensor_num = 2;
+ for (i = 0; i < data->sensor_num; i++) {
ret = cros_ec_sensorhub_allocate_sensor(dev,
"cros-ec-accel-legacy", i);
if (ret)