summaryrefslogtreecommitdiffstats
path: root/drivers/iio/accel/mma9551_core.c
Commit message (Collapse)AuthorAgeFilesLines
* iio: accel: mma9551_core: Prevent uninitialized variable in ↵Harshit Mogalapalli2023-01-281-1/+4
| | | | | | | | | | | | | | | | | | mma9551_read_config_word() Smatch Warns: drivers/iio/accel/mma9551_core.c:299 mma9551_read_config_word() error: uninitialized symbol 'v'. When (offset >= 1 << 12) is true mma9551_transfer() will return -EINVAL without 'v' being initialized, so check for the error and return. Note: No actual bug as caller checks the return value and does not use the parameter in the problem case. Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> Link: https://lore.kernel.org/r/20230126153610.3586243-1-harshit.m.mogalapalli@oracle.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: accel: mma9551_core: Prevent uninitialized variable in ↵Harshit Mogalapalli2023-01-281-1/+4
| | | | | | | | | | | | | | | | | mma9551_read_status_word() Smatch Warns: drivers/iio/accel/mma9551_core.c:357 mma9551_read_status_word() error: uninitialized symbol 'v'. When (offset >= 1 << 12) is true mma9551_transfer() will return -EINVAL without 'v' being initialized, so check for the error and return. Note: Not a bug as such because the caller checks return value and doesn't not use this parameter in the problem case. Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com> Link: https://lore.kernel.org/r/20230126152147.3585874-1-harshit.m.mogalapalli@oracle.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio:accel:mma9551_core: Move exports into IIO_MMA9551 namespaceJonathan Cameron2022-02-181-18/+18
| | | | | | | | | | In order to avoid unnecessary pollution of the global symbol namespace move the core mma9551 functions into an mma9551 specific namespace. For more information see https://lwn.net/Articles/760045/ Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/20220116180535.2367780-2-jic23@kernel.org
* iio: accel: mma9551/3: Balance untime pm + use pm_runtime_resume_and_get()Jonathan Cameron2021-05-171-3/+1
| | | | | | | | | | | Both these drivers call pm_runtime_put_no_idle() when the reference count should already be zero as there is no matching get() Whilst here use pm_runtime_resume_and_get() rather than open coding. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/20210509113354.660190-7-jic23@kernel.org
* treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288Thomas Gleixner2019-06-051-9/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Based on 1 normalized pattern(s): this program is free software you can redistribute it and or modify it under the terms and conditions of the gnu general public license version 2 as published by the free software foundation this program is distributed in the hope it will be useful but without any warranty without even the implied warranty of merchantability or fitness for a particular purpose see the gnu general public license for more details extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 263 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Alexios Zavras <alexios.zavras@intel.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190529141901.208660670@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* iio: accel: mma9553: fix alignment issuesIrina Tirdea2015-06-141-4/+4
| | | | | | | | | Fix code alignment and wrap parameters. Fix issues reported by checkpatch.pl --strict. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Suggested-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: accel: mma9551_core: use size in words for word buffersIrina Tirdea2015-06-141-15/+12
| | | | | | | | | | Change the prototype for the mma9551_read/write_*_words functions to receive the length of the buffer in words (instead of bytes) since we are using a word buffer. This will prevent users from sending an odd number of bytes for a word array. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* Merge 4.1-rc4 into staging-nextGreg Kroah-Hartman2015-05-181-3/+18
|\ | | | | | | | | | | We want the fixes in here for testing and merge issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * iio: accel: mma9551_core: prevent buffer overrunIrina Tirdea2015-04-261-3/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The mma9551 functions that read/write word arrays from the device have a limit for the buffer size given by the device specifications. Check that the requested buffer length is within required limits when transferring word arrays. This will prevent buffer overrun in the mma9551_read/write_*_words functions and also in the mma9551_transfer call when writing into the MBOX response/request structure. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Reported-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio: accel: mma9551_core: typo fix in RSC APP IDIrina Tirdea2015-04-261-1/+1
| | | | | | | | | | | | | | | | Fix typo in Reset/Suspend/Clear Application ID definition. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Reported-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio: accel: mma9551_core: wrong doc fixesIrina Tirdea2015-04-261-3/+3
|/ | | | | | | | Fix docummentation for mma9553_read_* functions. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Reported-by: Hartmut Knaack <knaack.h@gmx.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: add driver for Freescale MMA9553Irina Tirdea2015-01-301-0/+183
| | | | | | | | | | | | | | | | | | | | | | Add support for Freescale MMA9553L Intelligent Pedometer Platform. The following functionalities are supported: - step counter (counts the number of steps using a HW register) - step detector (generates an iio event at every step the user takes) - activity recognition (rest, walking, jogging, running) - speed - calories - distance To get accurate pedometer results, the user's height, weight and gender need to be configured. The specifications can be downloaded from: http://www.freescale.com/files/sensors/doc/ref_manual/MMA955xLSWRM.pdf http://www.freescale.com/files/sensors/doc/ref_manual/MMA9553LSWRM.pdf Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: accel: mma9551: split driver to expose mma955x apiIrina Tirdea2015-01-271-0/+615
Freescale has the MMA955xL family of devices that use the same communication protocol (based on i2c messages): http://www.freescale.com/files/sensors/doc/data_sheet/MMA955xL.pdf. To support more devices from this family, we need to split the mma9551 driver so we can export the common functions that will be used by other mma955x drivers. Signed-off-by: Irina Tirdea <irina.tirdea@intel.com> Reviewed-by: Vlad Dogaru <vlad.dogaru@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>