Re: [PATCH v8 09/22] ACPI: platform_profile: Use `scoped_cond_guard`

From: Markus Elfring
Date: Sun Dec 01 2024 - 12:20:38 EST



> +++ b/drivers/acpi/platform_profile.c
> @@ -27,25 +27,20 @@ static ssize_t platform_profile_choices_show(struct device *dev,
> char *buf)
> {

+ for_each_set_bit(i, cur_profile->choices, PLATFORM_PROFILE_LAST) {
+ if (len == 0)
+ len += sysfs_emit_at(buf, len, "%s", profile_names[i]);
+ else
+ len += sysfs_emit_at(buf, len, " %s", profile_names[i]);
+ }


How do you think about to integrate the following source code variant?

for_each_set_bit(i, cur_profile->choices, PLATFORM_PROFILE_LAST)
len += sysfs_emit_at(buf, len, (len ? " %s" : "%s"), profile_names[i]);


Regards,
Markus