mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-28 21:46:02 -04:00
iio: st_sensors: Add a local lock for protecting odr
Right now the (framework) mlock lock is (ab)used for multiple purposes: 1- protecting concurrent accesses over the odr local cache 2- avoid changing samplig frequency whilst buffer is running Let's start by handling situation #1 with a local lock. Suggested-by: Jonathan Cameron <jic23@kernel.org> Cc: Denis Ciocca <denis.ciocca@st.com> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> Link: https://lore.kernel.org/r/20220207143840.707510-7-miquel.raynal@bootlin.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
committed by
Jonathan Cameron
parent
05a32f1aeb
commit
474010127e
@@ -237,6 +237,7 @@ struct st_sensor_settings {
|
||||
* @hw_irq_trigger: if we're using the hardware interrupt on the sensor.
|
||||
* @hw_timestamp: Latest timestamp from the interrupt handler, when in use.
|
||||
* @buffer_data: Data used by buffer part.
|
||||
* @odr_lock: Local lock for preventing concurrent ODR accesses/changes
|
||||
*/
|
||||
struct st_sensor_data {
|
||||
struct iio_trigger *trig;
|
||||
@@ -261,6 +262,8 @@ struct st_sensor_data {
|
||||
s64 hw_timestamp;
|
||||
|
||||
char buffer_data[ST_SENSORS_MAX_BUFFER_SIZE] ____cacheline_aligned;
|
||||
|
||||
struct mutex odr_lock;
|
||||
};
|
||||
|
||||
#ifdef CONFIG_IIO_BUFFER
|
||||
|
||||
Reference in New Issue
Block a user