Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio:magn: introduce st_magn_get_settings() function

The function is introduced to retrieve magn device settings. It will be
used by probe in order to configure regmap.

Signed-off-by: Denis Ciocca <denis.ciocca@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Denis Ciocca and committed by
Jonathan Cameron
aa4e75c8 2acca26b

+19
+1
drivers/iio/magnetometer/st_magn.h
··· 22 22 #define LIS2MDL_MAGN_DEV_NAME "lis2mdl" 23 23 #define LSM9DS1_MAGN_DEV_NAME "lsm9ds1_magn" 24 24 25 + const struct st_sensor_settings *st_magn_get_settings(const char *name); 25 26 int st_magn_common_probe(struct iio_dev *indio_dev); 26 27 void st_magn_common_remove(struct iio_dev *indio_dev); 27 28
+18
drivers/iio/magnetometer/st_magn_core.c
··· 470 470 #define ST_MAGN_TRIGGER_OPS NULL 471 471 #endif 472 472 473 + /* 474 + * st_magn_get_settings() - get sensor settings from device name 475 + * @name: device name buffer reference. 476 + * 477 + * Return: valid reference on success, NULL otherwise. 478 + */ 479 + const struct st_sensor_settings *st_magn_get_settings(const char *name) 480 + { 481 + int index = st_sensors_get_settings_index(name, 482 + st_magn_sensors_settings, 483 + ARRAY_SIZE(st_magn_sensors_settings)); 484 + if (index < 0) 485 + return NULL; 486 + 487 + return &st_magn_sensors_settings[index]; 488 + } 489 + EXPORT_SYMBOL(st_magn_get_settings); 490 + 473 491 int st_magn_common_probe(struct iio_dev *indio_dev) 474 492 { 475 493 struct st_sensor_data *mdata = iio_priv(indio_dev);