From patchwork Sun Oct 23 19:11:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 9391185 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 222D160762 for ; Sun, 23 Oct 2016 19:15:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1213828A02 for ; Sun, 23 Oct 2016 19:15:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0275B28B55; Sun, 23 Oct 2016 19:15:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A006428A02 for ; Sun, 23 Oct 2016 19:15:52 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1byODs-00053T-5e; Sun, 23 Oct 2016 19:14:20 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:1be6]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1byOBI-0002vw-Fh for linux-arm-kernel@lists.infradead.org; Sun, 23 Oct 2016 19:11:42 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Date:Sender:Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Subject:To:From:References:In-Reply-To; bh=XSKKl3FU7OG3Qd2ITsFgm5+4xwfn+A7pa6+RBTjcbbQ=; b=oo/HVEsQ08+4ptYwfn0t1D/pOWOpsgzqdmp0SyBMrxoQrE8uOh46k5rd28IHxokcBePPkz+24VOKw1eqskCZcEGiv2nhADQUp9x/KEWX7CJ/I033x4KWQywri/Ap1gGP2iUVtdMBq/U4yctlzTtZvn1MyKJlVym2H1rO2p/q3Zs=; Received: from e0022681537dd.dyn.armlinux.org.uk ([2002:4e20:1eda:1:222:68ff:fe15:37dd]:35584 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1byOAu-0001mI-Iu; Sun, 23 Oct 2016 20:11:16 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1byOAt-0005zS-3i; Sun, 23 Oct 2016 20:11:15 +0100 In-Reply-To: <20161023191002.GJ1041@n2100.armlinux.org.uk> References: <20161023191002.GJ1041@n2100.armlinux.org.uk> From: Russell King To: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH RFC 10/10] drm/i2c: tda998x: switch to boolean is_on MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Sun, 23 Oct 2016 20:11:15 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161023_121140_957281_CADDE18A X-CRM114-Status: GOOD ( 13.85 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Rather than storing the DPMS mode (which will always be on or off) use a boolean to store this instead. Signed-off-by: Russell King --- drivers/gpu/drm/i2c/tda998x_drv.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index 547cf99ac32d..1f9a25fe17f3 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c @@ -42,7 +42,7 @@ struct tda998x_priv { struct mutex mutex; u16 rev; u8 current_page; - int dpms; + bool is_on; bool is_hdmi_sink; bool is_hdmi_config; u8 vip_cntrl_0; @@ -1150,16 +1150,15 @@ static int tda998x_connector_init(struct tda998x_priv *priv, static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode) { struct tda998x_priv *priv = enc_to_tda998x_priv(encoder); + bool on; /* we only care about on or off: */ - if (mode != DRM_MODE_DPMS_ON) - mode = DRM_MODE_DPMS_OFF; + on = mode == DRM_MODE_DPMS_ON; - if (mode == priv->dpms) + if (on == priv->is_on) return; - switch (mode) { - case DRM_MODE_DPMS_ON: + if (on) { /* enable video ports, audio will be enabled later */ reg_write(priv, REG_ENA_VP_0, 0xff); reg_write(priv, REG_ENA_VP_1, 0xff); @@ -1168,16 +1167,16 @@ static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode) reg_write(priv, REG_VIP_CNTRL_0, priv->vip_cntrl_0); reg_write(priv, REG_VIP_CNTRL_1, priv->vip_cntrl_1); reg_write(priv, REG_VIP_CNTRL_2, priv->vip_cntrl_2); - break; - case DRM_MODE_DPMS_OFF: + + priv->is_on = true; + } else { /* disable video ports */ reg_write(priv, REG_ENA_VP_0, 0x00); reg_write(priv, REG_ENA_VP_1, 0x00); reg_write(priv, REG_ENA_VP_2, 0x00); - break; - } - priv->dpms = mode; + priv->is_on = false; + } } static void