aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
AgeCommit message (Collapse)Author
2023-08-16iio: cros_ec: Fix the allocation size for cros_ec_commandYiyuan Guo
commit 8a4629055ef55177b5b63dab1ecce676bd8cccdd upstream. The struct cros_ec_command contains several integer fields and a trailing array. An allocation size neglecting the integer fields can lead to buffer overrun. Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org> Signed-off-by: Yiyuan Guo <yguoaz@gmail.com> Fixes: 974e6f02e27e ("iio: cros_ec_sensors_core: Add common functions for the ChromeOS EC Sensor Hub.") Link: https://lore.kernel.org/r/20230630143719.1513906-1-yguoaz@gmail.com Cc: <Stable@vger.kerenl.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-04-28iio: common: cros_ec_sensors: simplify getting .drvdataWolfram Sang
We should get drvdata from struct device directly. Going via platform_device is an unneeded step back and forth. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-17iio: cros_ec: Move cros_ec_sensors_core.h in /includeGwendal Grignou
Similar to other common iio frameworks, move cros_ec_sensors_core.h from drivers/iio/common/cros_ec_sensors/ to include/linux/iio/common. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-03iio: cros_ec: Relax sampling frequency before suspendingGwendal Grignou
If an application set a tight sampling frequency, given the interrupt use is a wakeup source, suspend will not happen: the kernel will receive a wake up interrupt and will cancel the suspend process. Given cros_ec sensors type is non wake up, this patch adds prepare and complete callbacks to set 1s sampling period just before suspend. This ensures the sensor hub will not be a source of interrupt during the suspend process. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2016-11-12iio: cros_ec_sensors_core: fix unsigned compared less than zero on statusColin Ian King
status is a u8 hence the check if status is less than zero has no effect. Fix this by replacing status with int ret so the less than zero compare will correctly detect errors. Issue found with static analysis with CoverityScan, CID 1375919 Signed-off-by: Colin Ian King <colin.king@canonical.com> Fixes: 974e6f02e27e ("iio: cros_ec_sensors_core: Add common functions for the ChromeOS EC Sensor Hub") Reviewed-by: Guenter Roeck <groeck@chromium.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-10-25iio: cros_ec_sensors_core: Add common functions for the ChromeOS EC Sensor Hub.Enric Balletbo i Serra
Add the core functions to be able to support the sensors attached behind the ChromeOS Embedded Controller and used by other IIO cros-ec sensor drivers. The cros_ec_sensor_core driver matches with current driver in ChromeOS 4.4 tree, so it includes all the fixes at the moment. The support for this driver was made by Gwendal Grignou. The original patch and all the fixes has been squashed and rebased on top of mainline. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Signed-off-by: Guenter Roeck <groeck@chromium.org> [eballetbo: split, squash and rebase on top of mainline the patches found in ChromeOS tree] Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>