@@ -13,6 +13,7 @@
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/dvb/frontend.h>
+#include <linux/string_choices.h>
#include <linux/types.h>
#include "ascot2e.h"
#include <media/dvb_frontend.h>
@@ -104,7 +105,7 @@ static void ascot2e_i2c_debug(struct ascot2e_priv *priv,
u8 reg, u8 write, const u8 *data, u32 len)
{
dev_dbg(&priv->i2c->dev, "ascot2e: I2C %s reg 0x%02x size %d\n",
- (write == 0 ? "read" : "write"), reg, len);
+ str_read_write(write == 0), reg, len);
print_hex_dump_bytes("ascot2e: I2C data: ",
DUMP_PREFIX_OFFSET, data, len);
}
@@ -21,6 +21,7 @@
#include <linux/moduleparam.h>
#include <linux/init.h>
#include <linux/firmware.h>
+#include <linux/string_choices.h>
#include <media/dvb_frontend.h>
#include "cx24120.h"
@@ -453,13 +454,13 @@ static int cx24120_msg_mpeg_output_global_config(struct cx24120_state *state,
ret = cx24120_message_send(state, &cmd);
if (ret != 0) {
dev_dbg(&state->i2c->dev, "failed to %s MPEG output\n",
- enable ? "enable" : "disable");
+ str_enable_disable(enable));
return ret;
}
state->mpeg_enabled = enable;
dev_dbg(&state->i2c->dev, "MPEG output %s\n",
- enable ? "enabled" : "disabled");
+ str_enabled_disabled(enable));
return 0;
}
@@ -15,6 +15,7 @@
#include <linux/module.h>
#include <linux/init.h>
#include <linux/string.h>
+#include <linux/string_choices.h>
#include <linux/slab.h>
#include <linux/bitops.h>
#include <linux/math64.h>
@@ -206,7 +207,7 @@ static void cxd2841er_i2c_debug(struct cxd2841er_priv *priv,
{
dev_dbg(&priv->i2c->dev,
"cxd2841er: I2C %s addr %02x reg 0x%02x size %d data %*ph\n",
- (write == 0 ? "read" : "write"), addr, reg, len, len, data);
+ str_read_write(write == 0), addr, reg, len, len, data);
}
static int cxd2841er_write_regs(struct cxd2841er_priv *priv,
@@ -15,6 +15,7 @@
#include <linux/firmware.h>
#include <linux/i2c.h>
#include <linux/hardirq.h>
+#include <linux/string_choices.h>
#include <asm/div64.h>
#include <media/dvb_frontend.h>
@@ -1068,7 +1069,7 @@ static int mpegts_configure_pins(struct drxk_state *state, bool mpeg_enable)
u16 err_cfg = 0;
dprintk(1, ": mpeg %s, %s mode\n",
- mpeg_enable ? "enable" : "disable",
+ str_enable_disable(mpeg_enable),
state->m_enable_parallel ? "parallel" : "serial");
/* stop lock indicator process */
@@ -6279,7 +6280,7 @@ static int drxk_gate_ctrl(struct dvb_frontend *fe, int enable)
{
struct drxk_state *state = fe->demodulator_priv;
- dprintk(1, ": %s\n", enable ? "enable" : "disable");
+ dprintk(1, ": %s\n", str_enable_disable(enable));
if (state->m_drxk_state == DRXK_NO_DEV)
return -ENODEV;
@@ -12,6 +12,7 @@
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/dvb/frontend.h>
+#include <linux/string_choices.h>
#include <linux/types.h>
#include "helene.h"
#include <media/dvb_frontend.h>
@@ -279,7 +280,7 @@ static void helene_i2c_debug(struct helene_priv *priv,
u8 reg, u8 write, const u8 *data, u32 len)
{
dev_dbg(&priv->i2c->dev, "helene: I2C %s reg 0x%02x size %d\n",
- (write == 0 ? "read" : "write"), reg, len);
+ str_read_write(write == 0), reg, len);
print_hex_dump_bytes("helene: I2C data: ",
DUMP_PREFIX_OFFSET, data, len);
}
@@ -13,6 +13,7 @@
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/dvb/frontend.h>
+#include <linux/string_choices.h>
#include <linux/types.h>
#include "horus3a.h"
#include <media/dvb_frontend.h>
@@ -38,7 +39,7 @@ static void horus3a_i2c_debug(struct horus3a_priv *priv,
u8 reg, u8 write, const u8 *data, u32 len)
{
dev_dbg(&priv->i2c->dev, "horus3a: I2C %s reg 0x%02x size %d\n",
- (write == 0 ? "read" : "write"), reg, len);
+ str_read_write(write == 0), reg, len);
print_hex_dump_bytes("horus3a: I2C data: ",
DUMP_PREFIX_OFFSET, data, len);
}
@@ -12,6 +12,7 @@
* Copyright (C) 2009 Abylay Ospan <aospan@netup.ru>
*/
+#include <linux/string_choices.h>
#include "sp2_priv.h"
static int sp2_read_i2c(struct sp2 *s, u8 reg, u8 *buf, int len)
@@ -132,7 +133,7 @@ static int sp2_ci_op_cam(struct dvb_ca_en50221 *en50221, int slot, u8 acs,
return ret;
dev_dbg(&s->client->dev, "%s: slot=%d, addr=0x%04x, %s, data=%x",
- (read) ? "read" : "write", slot, addr,
+ str_read_write(read), slot, addr,
(acs == SP2_CI_ATTR_ACS) ? "attr" : "io",
(read) ? mem : data);
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/dvb-frontends/ascot2e.c | 3 ++- drivers/media/dvb-frontends/cx24120.c | 5 +++-- drivers/media/dvb-frontends/cxd2841er.c | 3 ++- drivers/media/dvb-frontends/drxk_hard.c | 5 +++-- drivers/media/dvb-frontends/helene.c | 3 ++- drivers/media/dvb-frontends/horus3a.c | 3 ++- drivers/media/dvb-frontends/sp2.c | 3 ++- 7 files changed, 16 insertions(+), 9 deletions(-)