Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

platform/x86: ideapad-laptop: Use str_on_off() helper

Use the str_on_off() helper instead of open-coding the same operation.
This improves code readability.

No functional change intended.

Suggested-by: kernel test robot <lkp@intel.com>
Suggested-by: Julia Lawall <julia.lawall@inria.fr>
Link: https://lore.kernel.org/r/202510311551.xjWbHTrm-lkp@intel.com/
Suggested-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/2bae2ea7-2ef9-0cfa-0c2c-39a7043b2aa5@linux.intel.com/
Signed-off-by: Rong Zhang <i@rong.moe>
Link: https://patch.msgid.link/20251105182832.104946-2-i@rong.moe
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

authored by

Rong Zhang and committed by
Ilpo Järvinen
06c129ca a9ed446c

+8 -7
+8 -7
drivers/platform/x86/lenovo/ideapad-laptop.c
··· 31 31 #include <linux/power_supply.h> 32 32 #include <linux/rfkill.h> 33 33 #include <linux/seq_file.h> 34 + #include <linux/string_choices.h> 34 35 #include <linux/sysfs.h> 35 36 #include <linux/types.h> 36 37 #include <linux/wmi.h> ··· 463 462 if (!read_ec_data(priv->adev->handle, VPCCMD_R_BL, &value)) 464 463 seq_printf(s, "Backlight now: %lu\n", value); 465 464 if (!read_ec_data(priv->adev->handle, VPCCMD_R_BL_POWER, &value)) 466 - seq_printf(s, "BL power value: %s (%lu)\n", value ? "on" : "off", value); 465 + seq_printf(s, "BL power value: %s (%lu)\n", str_on_off(value), value); 467 466 468 467 seq_puts(s, "=====================\n"); 469 468 470 469 if (!read_ec_data(priv->adev->handle, VPCCMD_R_RF, &value)) 471 - seq_printf(s, "Radio status: %s (%lu)\n", value ? "on" : "off", value); 470 + seq_printf(s, "Radio status: %s (%lu)\n", str_on_off(value), value); 472 471 if (!read_ec_data(priv->adev->handle, VPCCMD_R_WIFI, &value)) 473 - seq_printf(s, "Wifi status: %s (%lu)\n", value ? "on" : "off", value); 472 + seq_printf(s, "Wifi status: %s (%lu)\n", str_on_off(value), value); 474 473 if (!read_ec_data(priv->adev->handle, VPCCMD_R_BT, &value)) 475 - seq_printf(s, "BT status: %s (%lu)\n", value ? "on" : "off", value); 474 + seq_printf(s, "BT status: %s (%lu)\n", str_on_off(value), value); 476 475 if (!read_ec_data(priv->adev->handle, VPCCMD_R_3G, &value)) 477 - seq_printf(s, "3G status: %s (%lu)\n", value ? "on" : "off", value); 476 + seq_printf(s, "3G status: %s (%lu)\n", str_on_off(value), value); 478 477 479 478 seq_puts(s, "=====================\n"); 480 479 481 480 if (!read_ec_data(priv->adev->handle, VPCCMD_R_TOUCHPAD, &value)) 482 - seq_printf(s, "Touchpad status: %s (%lu)\n", value ? "on" : "off", value); 481 + seq_printf(s, "Touchpad status: %s (%lu)\n", str_on_off(value), value); 483 482 if (!read_ec_data(priv->adev->handle, VPCCMD_R_CAMERA, &value)) 484 - seq_printf(s, "Camera status: %s (%lu)\n", value ? "on" : "off", value); 483 + seq_printf(s, "Camera status: %s (%lu)\n", str_on_off(value), value); 485 484 486 485 seq_puts(s, "=====================\n"); 487 486