mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
mfd: ipaq-micro/tps65010: Use str_enable_disable-like helpers
Replace ternary (condition ? "enable" : "disable") syntax with helpers from string_choices.h because: 1. Simple function call with one argument is easier to read. Ternary operator has three arguments and with wrapping might lead to quite long code. 2. Is slightly shorter thus also easier to read. 3. It brings uniformity in the text - same string. 4. Allows deduping by the linker, which results in a smaller binary file. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Link: https://lore.kernel.org/r/20250114192538.911970-1-krzysztof.kozlowski@linaro.org Signed-off-by: Lee Jones <lee@kernel.org>
This commit is contained in:
parent
7dc0dddbe5
commit
9675c059e4
2 changed files with 9 additions and 7 deletions
|
@ -22,6 +22,7 @@
|
|||
#include <linux/mfd/core.h>
|
||||
#include <linux/mfd/ipaq-micro.h>
|
||||
#include <linux/string.h>
|
||||
#include <linux/string_choices.h>
|
||||
#include <linux/random.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/list.h>
|
||||
|
@ -267,7 +268,7 @@ static void __init ipaq_micro_eeprom_dump(struct ipaq_micro *micro)
|
|||
dev_info(micro->dev, "page mode: %u\n", ipaq_micro_to_u16(dump+84));
|
||||
dev_info(micro->dev, "country ID: %u\n", ipaq_micro_to_u16(dump+86));
|
||||
dev_info(micro->dev, "color display: %s\n",
|
||||
ipaq_micro_to_u16(dump+88) ? "yes" : "no");
|
||||
str_yes_no(ipaq_micro_to_u16(dump + 88)));
|
||||
dev_info(micro->dev, "ROM size: %u MiB\n", ipaq_micro_to_u16(dump+90));
|
||||
dev_info(micro->dev, "RAM size: %u KiB\n", ipaq_micro_to_u16(dump+92));
|
||||
dev_info(micro->dev, "screen: %u x %u\n",
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <linux/workqueue.h>
|
||||
#include <linux/debugfs.h>
|
||||
#include <linux/seq_file.h>
|
||||
#include <linux/string_choices.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/platform_device.h>
|
||||
|
||||
|
@ -250,7 +251,7 @@ static int dbg_show(struct seq_file *s, void *_)
|
|||
v2 = i2c_smbus_read_byte_data(tps->client, TPS_LED1_PER);
|
||||
seq_printf(s, "led1 %s, on=%02x, per=%02x, %d/%d msec\n",
|
||||
(value & 0x80)
|
||||
? ((v2 & 0x80) ? "on" : "off")
|
||||
? str_on_off(v2 & 0x80)
|
||||
: ((v2 & 0x80) ? "blink" : "(nPG)"),
|
||||
value, v2,
|
||||
(value & 0x7f) * 10, (v2 & 0x7f) * 100);
|
||||
|
@ -259,7 +260,7 @@ static int dbg_show(struct seq_file *s, void *_)
|
|||
v2 = i2c_smbus_read_byte_data(tps->client, TPS_LED2_PER);
|
||||
seq_printf(s, "led2 %s, on=%02x, per=%02x, %d/%d msec\n",
|
||||
(value & 0x80)
|
||||
? ((v2 & 0x80) ? "on" : "off")
|
||||
? str_on_off(v2 & 0x80)
|
||||
: ((v2 & 0x80) ? "blink" : "off"),
|
||||
value, v2,
|
||||
(value & 0x7f) * 10, (v2 & 0x7f) * 100);
|
||||
|
@ -738,7 +739,7 @@ int tps65010_set_gpio_out_value(unsigned gpio, unsigned value)
|
|||
TPS_DEFGPIO, defgpio);
|
||||
|
||||
pr_debug("%s: gpio%dout = %s, defgpio 0x%02x\n", DRIVER_NAME,
|
||||
gpio, value ? "high" : "low",
|
||||
gpio, str_high_low(value),
|
||||
i2c_smbus_read_byte_data(the_tps->client, TPS_DEFGPIO));
|
||||
|
||||
mutex_unlock(&the_tps->lock);
|
||||
|
@ -850,7 +851,7 @@ int tps65010_set_vib(unsigned value)
|
|||
status = i2c_smbus_write_byte_data(the_tps->client,
|
||||
TPS_VDCDC2, vdcdc2);
|
||||
|
||||
pr_debug("%s: vibrator %s\n", DRIVER_NAME, value ? "on" : "off");
|
||||
pr_debug("%s: vibrator %s\n", DRIVER_NAME, str_on_off(value));
|
||||
|
||||
mutex_unlock(&the_tps->lock);
|
||||
return status;
|
||||
|
@ -872,7 +873,7 @@ int tps65010_set_low_pwr(unsigned mode)
|
|||
mutex_lock(&the_tps->lock);
|
||||
|
||||
pr_debug("%s: %s low_pwr, vdcdc1 0x%02x\n", DRIVER_NAME,
|
||||
mode ? "enable" : "disable",
|
||||
str_enable_disable(mode),
|
||||
i2c_smbus_read_byte_data(the_tps->client, TPS_VDCDC1));
|
||||
|
||||
vdcdc1 = i2c_smbus_read_byte_data(the_tps->client, TPS_VDCDC1);
|
||||
|
@ -984,7 +985,7 @@ int tps65013_set_low_pwr(unsigned mode)
|
|||
|
||||
pr_debug("%s: %s low_pwr, chgconfig 0x%02x vdcdc1 0x%02x\n",
|
||||
DRIVER_NAME,
|
||||
mode ? "enable" : "disable",
|
||||
str_enable_disable(mode),
|
||||
i2c_smbus_read_byte_data(the_tps->client, TPS_CHGCONFIG),
|
||||
i2c_smbus_read_byte_data(the_tps->client, TPS_VDCDC1));
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue