summaryrefslogtreecommitdiff
path: root/drivers/hwmon/pmbus
diff options
context:
space:
mode:
authorGuenter Roeck <linux@roeck-us.net>2025-01-25 19:19:37 -0800
committerGuenter Roeck <linux@roeck-us.net>2025-03-02 08:48:32 -0800
commit05452a3328a57237878f2f8759cec91d7583915c (patch)
tree767f9cc8622d30041e74dce073dc2edd5035a999 /drivers/hwmon/pmbus
parentde438ec92f83a2c3107514dd676fbd7db5eebbba (diff)
hwmon: (pmbus/core) Make debugfs code unconditional
Drop contitionals around debugfs code to compile it unconditionally. In practice it will be optimized away by the compiler if CONFIG_DEBUG_FS is not enabled, so the code size is not affected by this change. Also silently ignore errors if debugfs initialization fails. Reviewed-by: Tzung-Bi Shih <tzungbi@kernel.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/pmbus')
-rw-r--r--drivers/hwmon/pmbus/pmbus_core.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index c38072b6ee98..a19b32eb9a04 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -3420,7 +3420,6 @@ static int pmbus_irq_setup(struct i2c_client *client, struct pmbus_data *data)
static struct dentry *pmbus_debugfs_dir; /* pmbus debugfs directory */
-#if IS_ENABLED(CONFIG_DEBUG_FS)
static int pmbus_debugfs_get(void *data, u64 *val)
{
int rc;
@@ -3501,8 +3500,8 @@ static void pmbus_remove_symlink(void *symlink)
debugfs_remove(symlink);
}
-static int pmbus_init_debugfs(struct i2c_client *client,
- struct pmbus_data *data)
+static void pmbus_init_debugfs(struct i2c_client *client,
+ struct pmbus_data *data)
{
struct dentry *symlink_d, *debugfs = client->debugfs;
struct pmbus_debugfs_entry *entries;
@@ -3516,7 +3515,7 @@ static int pmbus_init_debugfs(struct i2c_client *client,
* client->debugfs before using it.
*/
if (!pmbus_debugfs_dir || IS_ERR_OR_NULL(debugfs))
- return -ENODEV;
+ return;
/*
* Backwards compatibility: Create symlink from /pmbus/<hwmon_device>
@@ -3524,7 +3523,7 @@ static int pmbus_init_debugfs(struct i2c_client *client,
*/
pathname = dentry_path_raw(debugfs, name, sizeof(name));
if (IS_ERR(pathname))
- return PTR_ERR(pathname);
+ return;
/*
* The path returned by dentry_path_raw() starts with '/'. Prepend it
@@ -3532,7 +3531,7 @@ static int pmbus_init_debugfs(struct i2c_client *client,
*/
symlink = kasprintf(GFP_KERNEL, "..%s", pathname);
if (!symlink)
- return -ENOMEM;
+ return;
symlink_d = debugfs_create_symlink(dev_name(data->hwmon_dev),
pmbus_debugfs_dir, symlink);
@@ -3549,7 +3548,7 @@ static int pmbus_init_debugfs(struct i2c_client *client,
7 + data->info->pages * 10, sizeof(*entries),
GFP_KERNEL);
if (!entries)
- return -ENOMEM;
+ return;
/*
* Add device-specific entries.
@@ -3726,15 +3725,7 @@ static int pmbus_init_debugfs(struct i2c_client *client,
&pmbus_debugfs_ops);
}
}
- return 0;
-}
-#else
-static int pmbus_init_debugfs(struct i2c_client *client,
- struct pmbus_data *data)
-{
- return 0;
}
-#endif /* IS_ENABLED(CONFIG_DEBUG_FS) */
int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info)
{
@@ -3821,9 +3812,7 @@ int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info)
if (ret)
return ret;
- ret = pmbus_init_debugfs(client, data);
- if (ret)
- dev_warn(dev, "Failed to register debugfs\n");
+ pmbus_init_debugfs(client, data);
return 0;
}