]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: imu: adis16475: drop ifdef around CONFIG_DEBUG_FS
authorNuno Sa <nuno.sa@analog.com>
Fri, 9 Aug 2024 09:17:06 +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 early 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.

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

index c094ae4ffcb26924f651a0952e6228a864cf3ba4..88efe728b61bfe077965d1ed0ebc8d8df81feb64 100644 (file)
@@ -164,7 +164,6 @@ module_param(low_rate_allow, bool, 0444);
 MODULE_PARM_DESC(low_rate_allow,
                 "Allow IMU rates below the minimum advisable when external clk is used in SCALED mode (default: N)");
 
-#ifdef CONFIG_DEBUG_FS
 static ssize_t adis16475_show_firmware_revision(struct file *file,
                                                char __user *userbuf,
                                                size_t count, loff_t *ppos)
@@ -279,6 +278,9 @@ static void adis16475_debugfs_init(struct iio_dev *indio_dev)
        struct adis16475 *st = 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, st, &adis16475_serial_number_fops);
        debugfs_create_file_unsafe("product_id", 0400,
@@ -290,11 +292,6 @@ static void adis16475_debugfs_init(struct iio_dev *indio_dev)
        debugfs_create_file("firmware_date", 0400, d,
                            st, &adis16475_firmware_date_fops);
 }
-#else
-static void adis16475_debugfs_init(struct iio_dev *indio_dev)
-{
-}
-#endif
 
 static int adis16475_get_freq(struct adis16475 *st, u32 *freq)
 {