@@ -292,7 +292,7 @@ static int amdgpu_atif_get_notification_params(struct amdgpu_atif *atif)
out:
DRM_DEBUG_DRIVER("Notification %s, command code = %#x\n",
- (n->enabled ? "enabled" : "disabled"),
+ (enableddisabled(n->enabled)),
n->command_code);
kfree(info);
return err;
@@ -737,7 +737,7 @@ static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg)
break;
}
if (arg != ATOM_COND_ALWAYS)
- SDEBUG(" taken: %s\n", execute ? "yes" : "no");
+ SDEBUG(" taken: %s\n", yesno(execute));
SDEBUG(" target: 0x%04X\n", target);
if (execute) {
if (ctx->last_jump == (ctx->start + target)) {
@@ -2918,7 +2918,8 @@ static int vega10_enable_disable_PCC_limit_feature(struct pp_hwmgr *hwmgr, bool
if (data->smu_features[GNLD_PCC_LIMIT].supported) {
if (enable == data->smu_features[GNLD_PCC_LIMIT].enabled)
- pr_info("GNLD_PCC_LIMIT has been %s \n", enable ? "enabled" : "disabled");
+ pr_info("GNLD_PCC_LIMIT has been %s \n",
+ enableddisabled(enable));
PP_ASSERT_WITH_CODE(!vega10_enable_smc_features(hwmgr,
enable, data->smu_features[GNLD_PCC_LIMIT].smu_feature_bitmap),
"Attempt to Enable PCC Limit feature Failed!",
@@ -653,7 +653,7 @@ static int tc_get_display_props(struct tc_data *tc)
"enhanced" : "non-enhanced");
dev_dbg(tc->dev, "Downspread: %s, scrambler: %s\n",
tc->link.spread ? "0.5%" : "0.0%",
- tc->link.scrambler_dis ? "disabled" : "enabled");
+ enableddisabled(!tc->link.scrambler_dis));
dev_dbg(tc->dev, "Display ASSR: %d, TC358767 ASSR: %d\n",
tc->link.assr, tc->assr);
@@ -213,7 +213,7 @@ static void drm_client_connectors_enabled(struct drm_connector **connectors,
connector = connectors[i];
enabled[i] = drm_connector_enabled(connector, true);
DRM_DEBUG_KMS("connector %d enabled? %s\n", connector->base.id,
- connector->display_info.non_desktop ? "non desktop" : enabled[i] ? "yes" : "no");
+ connector->display_info.non_desktop ? "non desktop" : yesno(enabled[i]));
any_enabled |= enabled[i];
}
@@ -600,7 +600,7 @@ void drm_dp_downstream_debug(struct seq_file *m,
DP_DWN_STRM_PORT_PRESENT;
seq_printf(m, "\tDP branch device present: %s\n",
- branch_device ? "yes" : "no");
+ yesno(branch_device));
if (!branch_device)
return;
@@ -255,7 +255,7 @@ static void *edid_load(struct drm_connector *connector, const char *name,
DRM_INFO("Got %s EDID base block and %d extension%s from "
"\"%s\" for connector \"%s\"\n", (builtin >= 0) ? "built-in" :
- "external", valid_extensions, valid_extensions == 1 ? "" : "s",
+ "external", valid_extensions, plural(valid_extensions),
name, connector_name);
out:
@@ -1208,7 +1208,7 @@ void drm_gem_print_info(struct drm_printer *p, unsigned int indent,
drm_vma_node_start(&obj->vma_node));
drm_printf_indent(p, indent, "size=%zu\n", obj->size);
drm_printf_indent(p, indent, "imported=%s\n",
- obj->import_attach ? "yes" : "no");
+ yesno(obj->import_attach));
if (obj->funcs && obj->funcs->print_info)
obj->funcs->print_info(p, indent, obj);
@@ -16006,7 +16006,7 @@ int intel_modeset_init(struct drm_device *dev)
DRM_DEBUG_KMS("%d display pipe%s available.\n",
INTEL_INFO(dev_priv)->num_pipes,
- INTEL_INFO(dev_priv)->num_pipes > 1 ? "s" : "");
+ plural(INTEL_INFO(dev_priv)->num_pipes));
for_each_pipe(dev_priv, pipe) {
ret = intel_crtc_init(dev_priv, pipe);
@@ -277,7 +277,7 @@ static void nouveau_dsm_pci_probe(struct pci_dev *pdev, acpi_handle *dhandle_out
nouveau_optimus_dsm(dhandle, NOUVEAU_DSM_OPTIMUS_CAPS, 0,
&result);
dev_info(&pdev->dev, "optimus capabilities: %s, status %s%s\n",
- (result & OPTIMUS_ENABLED) ? "enabled" : "disabled",
+ enableddisabled(result & OPTIMUS_ENABLED),
(result & OPTIMUS_DYNAMIC_PWR_CAP) ? "dynamic power, " : "",
(result & OPTIMUS_HDA_CODEC_MASK) ? "hda bios codec supported" : "");
@@ -94,7 +94,7 @@ void
nvkm_i2c_aux_monitor(struct nvkm_i2c_aux *aux, bool monitor)
{
struct nvkm_i2c_pad *pad = aux->pad;
- AUX_TRACE(aux, "monitor: %s", monitor ? "yes" : "no");
+ AUX_TRACE(aux, "monitor: %s", yesno(monitor));
if (monitor)
nvkm_i2c_pad_mode(pad, NVKM_I2C_PAD_AUX);
else
@@ -1506,7 +1506,7 @@ void dispc_enable_fifomerge(struct dispc_device *dispc, bool enable)
return;
}
- DSSDBG("FIFO merge %s\n", enable ? "enabled" : "disabled");
+ DSSDBG("FIFO merge %s\n", enableddisabled(enable));
REG_FLD_MOD(dispc, DISPC_CONFIG, enable ? 1 : 0, 14, 14);
}
@@ -1408,8 +1408,7 @@ static int dsi_dump_dsi_clocks(struct seq_file *s, void *p)
DSS_CLK_SRC_PLL2_1),
cinfo->clkout[HSDIV_DISPC],
cinfo->mX[HSDIV_DISPC],
- dispc_clk_src == DSS_CLK_SRC_FCK ?
- "off" : "on");
+ onoff(dispc_clk_src != DSS_CLK_SRC_FCK));
seq_printf(s, "DSI_PLL_HSDIV_DSI (%s)\t%-16lum_dsi %u\t(%s)\n",
dss_get_clk_source_name(dsi_module == 0 ?
@@ -1417,8 +1416,7 @@ static int dsi_dump_dsi_clocks(struct seq_file *s, void *p)
DSS_CLK_SRC_PLL2_2),
cinfo->clkout[HSDIV_DSI],
cinfo->mX[HSDIV_DSI],
- dsi_clk_src == DSS_CLK_SRC_FCK ?
- "off" : "on");
+ onoff(dsi_clk_src != DSS_CLK_SRC_FCK));
seq_printf(s, "- DSI%d -\n", dsi_module + 1);
@@ -355,7 +355,7 @@ static void qxl_crtc_update_monitors_config(struct drm_crtc *crtc,
DRM_DEBUG_KMS("head %d, %dx%d, at +%d+%d, %s (%s)\n",
i, head.width, head.height, head.x, head.y,
- crtc->state->active ? "on" : "off", reason);
+ onoff(crtc->state->active), reason);
if (oldcount != qdev->monitors_config->count)
DRM_DEBUG_KMS("active heads %d -> %d (%d total)\n",
oldcount, qdev->monitors_config->count,
@@ -722,7 +722,7 @@ static void atom_op_jump(atom_exec_context *ctx, int *ptr, int arg)
break;
}
if (arg != ATOM_COND_ALWAYS)
- SDEBUG(" taken: %s\n", execute ? "yes" : "no");
+ SDEBUG(" taken: %s\n", yesno(execute));
SDEBUG(" target: 0x%04X\n", target);
if (execute) {
if (ctx->last_jump == (ctx->start + target)) {
@@ -299,7 +299,7 @@ static int radeon_atif_get_notification_params(acpi_handle handle,
out:
DRM_DEBUG_DRIVER("Notification %s, command code = %#x\n",
- (n->enabled ? "enabled" : "disabled"),
+ (enableddisabled(n->enabled)),
n->command_code);
kfree(info);
return err;
@@ -317,7 +317,7 @@ static void hda_enable_hd_dacs(struct sti_hda *hda, bool enable)
static void hda_dbg_cfg(struct seq_file *s, int val)
{
seq_puts(s, "\tAWG ");
- seq_puts(s, val & CFG_AWG_ASYNC_EN ? "enabled" : "disabled");
+ seq_puts(s, enableddisabled(val & CFG_AWG_ASYNC_EN));
}
static void hda_dbg_awg_microcode(struct seq_file *s, void __iomem *reg)
@@ -338,7 +338,7 @@ static void hda_dbg_video_dacs_ctrl(struct seq_file *s, void __iomem *reg)
seq_printf(s, "\n\n %-25s 0x%08X", "VIDEO_DACS_CONTROL", val);
seq_puts(s, "\tHD DACs ");
- seq_puts(s, val & DAC_CFG_HD_HZUVW_OFF_MASK ? "disabled" : "enabled");
+ seq_puts(s, enableddisabled(!(val & DAC_CFG_HD_HZUVW_OFF_MASK)));
}
static int hda_dbg_show(struct seq_file *s, void *data)
@@ -491,7 +491,7 @@ static void tvout_dbg_vip(struct seq_file *s, int val)
static void tvout_dbg_hd_dac_cfg(struct seq_file *s, int val)
{
seq_printf(s, "\t%-24s %s", "HD DAC:",
- val & 1 ? "disabled" : "enabled");
+ enableddisabled(!(val & 1)));
}
static int tvout_dbg_show(struct seq_file *s, void *data)
@@ -273,7 +273,7 @@ int sun4i_backend_update_layer_formats(struct sun4i_backend *backend,
interlaced ? SUN4I_BACKEND_MODCTL_ITLMOD_EN : 0);
DRM_DEBUG_DRIVER("Switching display backend interlaced mode %s\n",
- interlaced ? "on" : "off");
+ onoff(interlaced));
val = SUN4I_BACKEND_ATTCTL_REG0_LAY_GLBALPHA(state->alpha >> 8);
if (state->alpha != DRM_BLEND_ALPHA_OPAQUE)
@@ -126,7 +126,7 @@ static int sun8i_ui_layer_update_coord(struct sun8i_mixer *mixer, int channel,
val);
DRM_DEBUG_DRIVER("Switching display mixer interlaced mode %s\n",
- interlaced ? "on" : "off");
+ onoff(interlaced));
}
/* Set height and width */
@@ -147,15 +147,15 @@ static int v3d_v3d_debugfs_ident(struct seq_file *m, void *unused)
V3D_GET_FIELD(ident3, V3D_HUB_IDENT3_IPREV),
V3D_GET_FIELD(ident3, V3D_HUB_IDENT3_IPIDX));
seq_printf(m, "MMU: %s\n",
- (ident2 & V3D_HUB_IDENT2_WITH_MMU) ? "yes" : "no");
+ yesno(ident2 & V3D_HUB_IDENT2_WITH_MMU));
seq_printf(m, "TFU: %s\n",
- (ident1 & V3D_HUB_IDENT1_WITH_TFU) ? "yes" : "no");
+ yesno(ident1 & V3D_HUB_IDENT1_WITH_TFU));
seq_printf(m, "TSY: %s\n",
- (ident1 & V3D_HUB_IDENT1_WITH_TSY) ? "yes" : "no");
+ yesno(ident1 & V3D_HUB_IDENT1_WITH_TSY));
seq_printf(m, "MSO: %s\n",
- (ident1 & V3D_HUB_IDENT1_WITH_MSO) ? "yes" : "no");
+ yesno(ident1 & V3D_HUB_IDENT1_WITH_MSO));
seq_printf(m, "L3C: %s (%dkb)\n",
- (ident1 & V3D_HUB_IDENT1_WITH_L3C) ? "yes" : "no",
+ yesno(ident1 & V3D_HUB_IDENT1_WITH_L3C),
V3D_GET_FIELD(ident2, V3D_HUB_IDENT2_L3C_NKB));
for (core = 0; core < cores; core++) {
@@ -31,7 +31,7 @@
static void virtio_add_bool(struct seq_file *m, const char *name,
bool value)
{
- seq_printf(m, "%-16s : %s\n", name, value ? "yes" : "no");
+ seq_printf(m, "%-16s : %s\n", name, yesno(value));
}
static void virtio_add_int(struct seq_file *m, const char *name,
THIS IS NOT FOR MERGING; DEMO FOR PREVIOUS PATCH ONLY! Further conversion should be done incrementally and by driver/subsystem. This here is the result of running the following on the below cocci patch: $ spatch --sp-file yesno.cocci --in-place --dir drivers/gpu/drm I wish I knew how to not duplicate stuff in the cocci patch so much... @enableddisabled@ expression E; @@ ( - (E) ? "enabled" : "disabled" + enableddisabled(E) | - E ? "enabled" : "disabled" + enableddisabled(E) ) @reverse_enableddisabled@ expression A, B; @@ ( - (A == B) ? "disabled" : "enabled" + enableddisabled(A != B) | - (A != B) ? "disabled" : "enabled" + enableddisabled(A == B) | - A == B ? "disabled" : "enabled" + enableddisabled(A != B) | - A != B ? "disabled" : "enabled" + enableddisabled(A == B) | - A ? "disabled" : "enabled" + enableddisabled(!A) ) @yesno@ expression E; @@ ( - (E) ? "yes" : "no" + yesno(E) | - E ? "yes" : "no" + yesno(E) ) @reverse_yesno@ expression A, B; @@ ( - (A == B) ? "no" : "yes" + yesno(A != B) | - (A != B) ? "no" : "yes" + yesno(A == B) | - A == B ? "no" : "yes" + yesno(A != B) | - A != B ? "no" : "yes" + yesno(A == B) | - A ? "no" : "yes" + yesno(!A) ) @onoff@ expression E; @@ ( - (E) ? "on" : "off" + onoff(E) | - E ? "on" : "off" + onoff(E) ) @reverse_onoff@ expression A, B; @@ ( - (A == B) ? "off" : "on" + onoff(A != B) | - (A != B) ? "off" : "on" + onoff(A == B) | - A == B ? "off" : "on" + onoff(A != B) | - A != B ? "off" : "on" + onoff(A == B) | - A ? "off" : "on" + onoff(!A) ) @plural@ expression E; @@ ( - (E > 1) ? "s" : "" + plural(E) | - E > 1 ? "s" : "" + plural(E) | - (E == 1) ? "" : "s" + plural(E) | - E == 1 ? "" : "s" + plural(E) ) Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Cc: intel-gfx@lists.freedesktop.org Cc: Vishal Kulkarni <vishal@chelsio.com> Cc: netdev@vger.kernel.org Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: linux-usb@vger.kernel.org Cc: Andrew Morton <akpm@linux-foundation.org> Cc: linux-kernel@vger.kernel.org Cc: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Jani Nikula <jani.nikula@intel.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_acpi.c | 2 +- drivers/gpu/drm/amd/amdgpu/atom.c | 2 +- drivers/gpu/drm/amd/powerplay/hwmgr/vega10_hwmgr.c | 3 ++- drivers/gpu/drm/bridge/tc358767.c | 2 +- drivers/gpu/drm/drm_client_modeset.c | 2 +- drivers/gpu/drm/drm_dp_helper.c | 2 +- drivers/gpu/drm/drm_edid_load.c | 2 +- drivers/gpu/drm/drm_gem.c | 2 +- drivers/gpu/drm/i915/display/intel_display.c | 2 +- drivers/gpu/drm/nouveau/nouveau_acpi.c | 2 +- drivers/gpu/drm/nouveau/nvkm/subdev/i2c/aux.c | 2 +- drivers/gpu/drm/omapdrm/dss/dispc.c | 2 +- drivers/gpu/drm/omapdrm/dss/dsi.c | 6 ++---- drivers/gpu/drm/qxl/qxl_display.c | 2 +- drivers/gpu/drm/radeon/atom.c | 2 +- drivers/gpu/drm/radeon/radeon_acpi.c | 2 +- drivers/gpu/drm/sti/sti_hda.c | 4 ++-- drivers/gpu/drm/sti/sti_tvout.c | 2 +- drivers/gpu/drm/sun4i/sun4i_backend.c | 2 +- drivers/gpu/drm/sun4i/sun8i_ui_layer.c | 2 +- drivers/gpu/drm/v3d/v3d_debugfs.c | 10 +++++----- drivers/gpu/drm/virtio/virtgpu_debugfs.c | 2 +- 22 files changed, 29 insertions(+), 30 deletions(-)