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>
This commit is contained in:

کامیت شده توسط
Enric Balletbo i Serra

والد
b2057c6401
کامیت
cee416a347
@@ -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)
|
||||
|
مرجع در شماره جدید
Block a user