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

Configure Feed

Select the types of activity you want to include in your feed.

iio: adc: ad4030: move setting mode to update_scan_mode

Move calling ad4030_set_mode() from the buffer preenable callback to
the update_scan_mode callback. This doesn't change any functionality
but is more logical since setting the mode is a function of the scan
mask and doesn't require an "undo" operation when the buffer is
disabled.

Signed-off-by: David Lechner <dlechner@baylibre.com>
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
Link: https://patch.msgid.link/20250310-iio-adc-ad4030-check-scan-type-err-v1-3-589e4ebd9711@baylibre.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

David Lechner and committed by
Jonathan Cameron
efaa981e dc78e71d

+7 -6
+7 -6
drivers/iio/adc/ad4030.c
··· 868 868 return st->avg_log2 ? AD4030_SCAN_TYPE_AVG : AD4030_SCAN_TYPE_NORMAL; 869 869 } 870 870 871 + static int ad4030_update_scan_mode(struct iio_dev *indio_dev, 872 + const unsigned long *scan_mask) 873 + { 874 + return ad4030_set_mode(indio_dev, *scan_mask); 875 + } 876 + 871 877 static const struct iio_info ad4030_iio_info = { 872 878 .read_avail = ad4030_read_avail, 873 879 .read_raw = ad4030_read_raw, ··· 881 875 .debugfs_reg_access = ad4030_reg_access, 882 876 .read_label = ad4030_read_label, 883 877 .get_current_scan_type = ad4030_get_current_scan_type, 878 + .update_scan_mode = ad4030_update_scan_mode, 884 879 }; 885 - 886 - static int ad4030_buffer_preenable(struct iio_dev *indio_dev) 887 - { 888 - return ad4030_set_mode(indio_dev, *indio_dev->active_scan_mask); 889 - } 890 880 891 881 static bool ad4030_validate_scan_mask(struct iio_dev *indio_dev, 892 882 const unsigned long *scan_mask) ··· 897 895 } 898 896 899 897 static const struct iio_buffer_setup_ops ad4030_buffer_setup_ops = { 900 - .preenable = ad4030_buffer_preenable, 901 898 .validate_scan_mask = ad4030_validate_scan_mask, 902 899 }; 903 900