]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: imu: adis16460: drop ifdef around CONFIG_DEBUG_FS
authorNuno Sa <nuno.sa@analog.com>
Fri, 9 Aug 2024 09:17:09 +0000 (11:17 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 10 Aug 2024 10:39:57 +0000 (11:39 +0100)
Use IS_ENABLED(CONFIG_DEBUG_FS) to return in case debugfs is not present.
Since this is known at compile time, it allows the compiler to drop any
unused code. Therefore no need to wrap the code with #ifdef.

While at it make adis16460_debugfs_init() void as the return code is
ignored.

Signed-off-by: Nuno Sa <nuno.sa@analog.com>
Link: https://patch.msgid.link/20240809-dev-adis-debugfs-improv-v1-4-d3adb6996518@analog.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/imu/adis16460.c

index 69facd72bd7d8aeebf51b706534d3ab36879a983..eaa38dd6201fdb64d207571619b65e3ca5a092d6 100644 (file)
@@ -69,8 +69,6 @@ struct adis16460 {
        struct adis adis;
 };
 
-#ifdef CONFIG_DEBUG_FS
-
 static int adis16460_show_serial_number(void *arg, u64 *val)
 {
        struct adis16460 *adis16460 = arg;
@@ -125,30 +123,22 @@ static int adis16460_show_flash_count(void *arg, u64 *val)
 DEFINE_DEBUGFS_ATTRIBUTE(adis16460_flash_count_fops,
                adis16460_show_flash_count, NULL, "%lld\n");
 
-static int adis16460_debugfs_init(struct iio_dev *indio_dev)
+static void adis16460_debugfs_init(struct iio_dev *indio_dev)
 {
        struct adis16460 *adis16460 = iio_priv(indio_dev);
        struct dentry *d = iio_get_debugfs_dentry(indio_dev);
 
+       if (!IS_ENABLED(CONFIG_DEBUG_FS))
+               return;
+
        debugfs_create_file_unsafe("serial_number", 0400,
                        d, adis16460, &adis16460_serial_number_fops);
        debugfs_create_file_unsafe("product_id", 0400,
                        d, adis16460, &adis16460_product_id_fops);
        debugfs_create_file_unsafe("flash_count", 0400,
                        d, adis16460, &adis16460_flash_count_fops);
-
-       return 0;
-}
-
-#else
-
-static int adis16460_debugfs_init(struct iio_dev *indio_dev)
-{
-       return 0;
 }
 
-#endif
-
 static int adis16460_set_freq(struct iio_dev *indio_dev, int val, int val2)
 {
        struct adis16460 *st = iio_priv(indio_dev);