mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-11 13:04:03 +08:00
a574e68ff5
The st_gyro_allocate_ring() function calls iio_triggered_buffer_setup() to allocate a triggered buffer. But the same can be done with devm_iio_triggered_buffer_setup() and then the st_gyro_common_remove() no longer needs to manually deallocate it. We know that the parent of the IIO device is used to manage other instances of the devm unwind, so it can be used in the st_gyro_allocate_ring() as well. Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com> Link: https://lore.kernel.org/r/20210720074642.223293-4-aardelean@deviqon.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
40 lines
1.1 KiB
C
40 lines
1.1 KiB
C
/* SPDX-License-Identifier: GPL-2.0-only */
|
|
/*
|
|
* STMicroelectronics gyroscopes driver
|
|
*
|
|
* Copyright 2012-2013 STMicroelectronics Inc.
|
|
*
|
|
* Denis Ciocca <denis.ciocca@st.com>
|
|
* v. 1.0.0
|
|
*/
|
|
|
|
#ifndef ST_GYRO_H
|
|
#define ST_GYRO_H
|
|
|
|
#include <linux/types.h>
|
|
#include <linux/iio/common/st_sensors.h>
|
|
|
|
#define L3G4200D_GYRO_DEV_NAME "l3g4200d"
|
|
#define LSM330D_GYRO_DEV_NAME "lsm330d_gyro"
|
|
#define LSM330DL_GYRO_DEV_NAME "lsm330dl_gyro"
|
|
#define LSM330DLC_GYRO_DEV_NAME "lsm330dlc_gyro"
|
|
#define L3GD20_GYRO_DEV_NAME "l3gd20"
|
|
#define L3GD20H_GYRO_DEV_NAME "l3gd20h"
|
|
#define L3G4IS_GYRO_DEV_NAME "l3g4is_ui"
|
|
#define LSM330_GYRO_DEV_NAME "lsm330_gyro"
|
|
#define LSM9DS0_GYRO_DEV_NAME "lsm9ds0_gyro"
|
|
|
|
#ifdef CONFIG_IIO_BUFFER
|
|
int st_gyro_allocate_ring(struct iio_dev *indio_dev);
|
|
int st_gyro_trig_set_state(struct iio_trigger *trig, bool state);
|
|
#define ST_GYRO_TRIGGER_SET_STATE (&st_gyro_trig_set_state)
|
|
#else /* CONFIG_IIO_BUFFER */
|
|
static inline int st_gyro_allocate_ring(struct iio_dev *indio_dev)
|
|
{
|
|
return 0;
|
|
}
|
|
#define ST_GYRO_TRIGGER_SET_STATE NULL
|
|
#endif /* CONFIG_IIO_BUFFER */
|
|
|
|
#endif /* ST_GYRO_H */
|