@@ -9,6 +9,7 @@
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/seq_file.h>
+#include <linux/string_choices.h>
#include <media/cec-notifier.h>
#include <media/cec-pin.h>
@@ -136,10 +137,10 @@ static void cec_gpio_status(struct cec_adapter *adap, struct seq_file *file)
seq_printf(file, "using irq: %d\n", cec->cec_irq);
if (cec->hpd_gpio)
seq_printf(file, "hpd: %s\n",
- cec->hpd_is_high ? "high" : "low");
+ str_high_low(cec->hpd_is_high));
if (cec->v5_gpio)
seq_printf(file, "5V: %s\n",
- cec->v5_is_high ? "high" : "low");
+ str_high_low(cec->v5_is_high));
}
static int cec_gpio_read_hpd(struct cec_adapter *adap)
@@ -36,6 +36,7 @@
#include <linux/workqueue.h>
#include <linux/serio.h>
#include <linux/slab.h>
+#include <linux/string_choices.h>
#include <linux/time.h>
#include <linux/delay.h>
@@ -695,14 +696,14 @@ static int pulse8_setup(struct pulse8 *pulse8, struct serio *serio,
return err;
pulse8->autonomous = data[0];
dev_dbg(pulse8->dev, "Autonomous mode: %s",
- data[0] ? "on" : "off");
+ str_on_off(data[0]));
if (pulse8->vers >= 10) {
cmd[0] = MSGCODE_GET_AUTO_POWER_ON;
err = pulse8_send_and_wait(pulse8, cmd, 1, cmd[0], 1);
if (!err)
dev_dbg(pulse8->dev, "Auto Power On: %s",
- data[0] ? "on" : "off");
+ str_on_off(data[0]));
}
cmd[0] = MSGCODE_GET_DEVICE_TYPE;
@@ -5,11 +5,12 @@
* see flexcop.c for copyright information
*/
#include "flexcop.h"
+#include <linux/string_choices.h>
static void flexcop_rcv_data_ctrl(struct flexcop_device *fc, int onoff)
{
flexcop_set_ibi_value(ctrl_208, Rcv_Data_sig, onoff);
- deb_ts("rcv_data is now: '%s'\n", onoff ? "on" : "off");
+ deb_ts("rcv_data is now: '%s'\n", str_on_off(onoff));
}
void flexcop_smc_ctrl(struct flexcop_device *fc, int onoff)
@@ -116,7 +117,7 @@ static void flexcop_pid_control(struct flexcop_device *fc,
return;
deb_ts("setting pid: %5d %04x at index %d '%s'\n",
- pid, pid, index, onoff ? "on" : "off");
+ pid, pid, index, str_on_off(onoff));
/* First 6 can be buggy - skip over them if option set */
if (fc->skip_6_hw_pid_filter)
@@ -8,6 +8,7 @@
#include "sms-cards.h"
#include "smsir.h"
#include <linux/module.h>
+#include <linux/string_choices.h>
static struct sms_board sms_boards[] = {
[SMS_BOARD_UNKNOWN] = {
@@ -326,7 +327,7 @@ int sms_board_lna_control(struct smscore_device_t *coredev, int onoff)
int board_id = smscore_get_board_id(coredev);
struct sms_board *board = sms_get_board(board_id);
- pr_debug("%s: LNA %s\n", __func__, onoff ? "enabled" : "disabled");
+ pr_debug("%s: LNA %s\n", __func__, str_enabled_disabled(onoff));
switch (board_id) {
case SMS1XXX_BOARD_HAUPPAUGE_TIGER_MINICARD_R2:
@@ -23,6 +23,7 @@
#include <linux/poll.h>
#include <linux/slab.h>
#include <linux/sched.h>
+#include <linux/string_choices.h>
#include <linux/freezer.h>
#include <linux/kthread.h>
@@ -2874,7 +2875,8 @@ static int __vb2_init_fileio(struct vb2_queue *q, int read)
return -EBUSY;
dprintk(q, 3, "setting up file io: mode %s, count %d, read_once %d, write_immediately %d\n",
- (read) ? "read" : "write", q->min_reqbufs_allocation, q->fileio_read_once,
+ str_read_write(read), q->min_reqbufs_allocation,
+ q->fileio_read_once,
q->fileio_write_immediately);
fileio = kzalloc(sizeof(*fileio), GFP_KERNEL);
@@ -3022,7 +3024,7 @@ static size_t __vb2_perform_fileio(struct vb2_queue *q, char __user *data, size_
int ret;
dprintk(q, 3, "mode %s, offset %ld, count %zd, %sblocking\n",
- read ? "read" : "write", (long)*ppos, count,
+ str_read_write(read), (long)*ppos, count,
nonblock ? "non" : "");
if (!data)
@@ -24,6 +24,7 @@
#include <linux/interrupt.h>
#include <linux/sched.h>
#include <linux/slab.h>
+#include <linux/string_choices.h>
#include <media/rc-core.h>
#include "ene_ir.h"
@@ -1118,7 +1119,7 @@ static void ene_remove(struct pnp_dev *pnp_dev)
/* enable wake on IR (wakes on specific button on original remote) */
static void ene_enable_wake(struct ene_device *dev, bool enable)
{
- dbg("wake on IR %s", enable ? "enabled" : "disabled");
+ dbg("wake on IR %s", str_enabled_disabled(enable));
ene_set_clear_reg_mask(dev, ENE_FW1, ENE_FW1_WAKE, enable);
}
@@ -25,6 +25,7 @@
#include <linux/device.h>
#include <linux/module.h>
#include <linux/slab.h>
+#include <linux/string_choices.h>
#include <linux/workqueue.h>
#include <linux/usb.h>
#include <linux/usb/input.h>
@@ -1126,7 +1127,7 @@ static int mceusb_set_rx_carrier_report(struct rc_dev *dev, int enable)
MCE_CMD_SETIRRXPORTEN, 0x00 };
dev_dbg(ir->dev, "%s short-range receiver carrier reporting",
- enable ? "enable" : "disable");
+ str_enable_disable(enable));
if (enable) {
ir->carrier_report_enabled = true;
if (!ir->learning_active) {
@@ -25,6 +25,7 @@
#include <linux/delay.h>
#include <linux/platform_device.h>
#include <linux/spinlock.h>
+#include <linux/string_choices.h>
#include <media/rc-core.h>
struct serial_ir_hw {
@@ -588,10 +589,10 @@ static int serial_ir_probe(struct platform_device *dev)
}
sense = nlow >= nhigh ? 1 : 0;
dev_info(&dev->dev, "auto-detected active %s receiver\n",
- sense ? "low" : "high");
+ str_low_high(sense));
} else
dev_info(&dev->dev, "Manually using active %s receiver\n",
- sense ? "low" : "high");
+ str_low_high(sense));
dev_dbg(&dev->dev, "Interrupt %d, port %04x obtained\n", irq, io);
@@ -7,6 +7,7 @@
#include "tda18250_priv.h"
#include <linux/regmap.h>
+#include <linux/string_choices.h>
static const struct dvb_tuner_ops tda18250_ops;
@@ -107,7 +108,7 @@ static int tda18250_wait_for_irq(struct dvb_frontend *fe,
dev_dbg(&client->dev, "waited IRQ (0x%02x) %d ms, triggered: %s", irq,
jiffies_to_msecs(jiffies) -
(jiffies_to_msecs(timeout) - maxwait),
- triggered ? "true" : "false");
+ str_true_false(triggered));
if (!triggered)
return -ETIMEDOUT;
@@ -6,6 +6,7 @@
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/delay.h>
+#include <linux/string_choices.h>
#include <linux/videodev2.h>
#include <media/v4l2-common.h>
#include <media/tuner.h>
@@ -291,11 +292,11 @@ static void dump_read_message(struct dvb_frontend *fe, unsigned char *buf)
"+ 12.5 kHz",
};
tuner_info("read: 0x%2x\n", buf[0]);
- tuner_info(" after power on : %s\n", (buf[0] & 0x01) ? "yes" : "no");
+ tuner_info(" after power on : %s\n", str_yes_no(buf[0] & 0x01));
tuner_info(" afc : %s\n", afc[(buf[0] >> 1) & 0x0f]);
- tuner_info(" fmif level : %s\n", (buf[0] & 0x20) ? "high" : "low");
+ tuner_info(" fmif level : %s\n", str_high_low(buf[0] & 0x20));
tuner_info(" afc window : %s\n", (buf[0] & 0x40) ? "in" : "out");
- tuner_info(" vfi level : %s\n", (buf[0] & 0x80) ? "high" : "low");
+ tuner_info(" vfi level : %s\n", str_high_low(buf[0] & 0x80));
}
static void dump_write_message(struct dvb_frontend *fe, unsigned char *buf)
@@ -344,13 +345,13 @@ static void dump_write_message(struct dvb_frontend *fe, unsigned char *buf)
tuner_info(" B0 video mode : %s\n",
(buf[1] & 0x01) ? "video trap" : "sound trap");
tuner_info(" B1 auto mute fm : %s\n",
- (buf[1] & 0x02) ? "yes" : "no");
+ str_yes_no(buf[1] & 0x02));
tuner_info(" B2 carrier mode : %s\n",
(buf[1] & 0x04) ? "QSS" : "Intercarrier");
tuner_info(" B3-4 tv sound/radio : %s\n",
sound[(buf[1] & 0x18) >> 3]);
tuner_info(" B5 force mute audio: %s\n",
- (buf[1] & 0x20) ? "yes" : "no");
+ str_yes_no(buf[1] & 0x20));
tuner_info(" B6 output port 1 : %s\n",
(buf[1] & 0x40) ? "high (inactive)" : "low (active)");
tuner_info(" B7 output port 2 : %s\n",
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> --- drivers/media/cec/platform/cec-gpio/cec-gpio.c | 5 +++-- drivers/media/cec/usb/pulse8/pulse8-cec.c | 5 +++-- drivers/media/common/b2c2/flexcop-hw-filter.c | 5 +++-- drivers/media/common/siano/sms-cards.c | 3 ++- drivers/media/common/videobuf2/videobuf2-core.c | 6 ++++-- drivers/media/rc/ene_ir.c | 3 ++- drivers/media/rc/mceusb.c | 3 ++- drivers/media/rc/serial_ir.c | 5 +++-- drivers/media/tuners/tda18250.c | 3 ++- drivers/media/tuners/tda9887.c | 11 ++++++----- 10 files changed, 30 insertions(+), 19 deletions(-)