]>
Commit | Line | Data |
---|---|---|
309a988b GKH |
1 | From c42f8218610aa09d7d3795e5810387673c1f84b6 Mon Sep 17 00:00:00 2001 |
2 | From: Lars-Peter Clausen <lars@metafoo.de> | |
3 | Date: Thu, 9 Mar 2017 17:20:04 +0100 | |
4 | Subject: iio: sw-device: Fix config group initialization | |
5 | ||
6 | From: Lars-Peter Clausen <lars@metafoo.de> | |
7 | ||
8 | commit c42f8218610aa09d7d3795e5810387673c1f84b6 upstream. | |
9 | ||
10 | Use the IS_ENABLED() helper macro to ensure that the configfs group is | |
11 | initialized either when configfs is built-in or when configfs is built as a | |
12 | module. Otherwise software device creation will result in undefined | |
13 | behaviour when configfs is built as a module since the configfs group for | |
14 | the device not properly initialized. | |
15 | ||
16 | Similar to commit b2f0c09664b7 ("iio: sw-trigger: Fix config group | |
17 | initialization"). | |
18 | ||
19 | Fixes: 0f3a8c3f34f7 ("iio: Add support for creating IIO devices via configfs") | |
20 | Reported-by: Miguel Robles <miguel.robles@farole.net> | |
21 | Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> | |
22 | Acked-by: Daniel Baluta <daniel.baluta@gmail.com> | |
23 | Signed-off-by: Jonathan Cameron <jic23@kernel.org> | |
24 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
25 | ||
26 | --- | |
27 | include/linux/iio/sw_device.h | 2 +- | |
28 | 1 file changed, 1 insertion(+), 1 deletion(-) | |
29 | ||
30 | --- a/include/linux/iio/sw_device.h | |
31 | +++ b/include/linux/iio/sw_device.h | |
32 | @@ -62,7 +62,7 @@ void iio_swd_group_init_type_name(struct | |
33 | const char *name, | |
34 | struct config_item_type *type) | |
35 | { | |
36 | -#ifdef CONFIG_CONFIGFS_FS | |
37 | +#if IS_ENABLED(CONFIG_CONFIGFS_FS) | |
38 | config_group_init_type_name(&d->group, name, type); | |
39 | #endif | |
40 | } |