From patchwork Wed Dec 30 16:40:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 7934211 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 5C42E9F387 for ; Wed, 30 Dec 2015 16:46:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9608C202F2 for ; Wed, 30 Dec 2015 16:46:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id BA0EB202EB for ; Wed, 30 Dec 2015 16:46:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754940AbbL3Qqu (ORCPT ); Wed, 30 Dec 2015 11:46:50 -0500 Received: from mail-wm0-f51.google.com ([74.125.82.51]:38074 "EHLO mail-wm0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754093AbbL3Qqq (ORCPT ); Wed, 30 Dec 2015 11:46:46 -0500 Received: by mail-wm0-f51.google.com with SMTP id b14so55519311wmb.1 for ; Wed, 30 Dec 2015 08:46:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:subject:to:cc:message-id:date:user-agent:mime-version :content-type:content-transfer-encoding; bh=LwPMNi696qFzasBy6GMN7Ic9YSR93+u8SYr1OUV/V+Y=; b=kgmal8JhCOdMFbwnaN7EdRpPP17sxVkGrFrWeCbsOf6RdujIpoS33CNUMaGv8MFVn6 zTolW6egFgawooAYuLGLX4TwSDz/kdJsnox0faWkwO4ipB3eM0ExTxgTHrsAuy9hy64H ngmK1pwx0oK3t7KMN/itcrPEyLbI025knlrOCAm5mpQbfPGE1zU0bQrGWe8yzKjDdidB Zz+WVaVTW4y7CEaOsDZ1g2WGnwGBC2qyismAqbs/drxNPq1til2Ewh5VyDob1B/yN4gU Q9WJSLs3tX/I+o8oy8iB/1rxSgDVmDl2MZwsJNIyON6vCq0KMopHEtClM71OCZ4x9dlG ZbOw== X-Received: by 10.194.133.135 with SMTP id pc7mr69243921wjb.90.1451494005349; Wed, 30 Dec 2015 08:46:45 -0800 (PST) Received: from ?IPv6:2003:62:5f55:ba00:84bb:b7f:fe67:66b9? (p200300625F55BA0084BB0B7FFE6766B9.dip0.t-ipconnect.de. [2003:62:5f55:ba00:84bb:b7f:fe67:66b9]) by smtp.googlemail.com with ESMTPSA id b127sm8708274wmh.9.2015.12.30.08.46.44 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 30 Dec 2015 08:46:44 -0800 (PST) From: Heiner Kallweit Subject: [PATCH 04/16] media: rc: nuvoton-cir: factor out logical device disabling To: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org Message-ID: <568408E5.6030208@gmail.com> Date: Wed, 30 Dec 2015 17:40:05 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Factor out disabling of a logical device. Signed-off-by: Heiner Kallweit --- drivers/media/rc/nuvoton-cir.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index f661eff..ceb6b95 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c @@ -110,6 +110,15 @@ static inline void nvt_select_logical_dev(struct nvt_dev *nvt, u8 ldev) nvt_cr_write(nvt, ldev, CR_LOGICAL_DEV_SEL); } +/* select and disable logical device with setting EFM mode*/ +static inline void nvt_disable_logical_dev(struct nvt_dev *nvt, u8 ldev) +{ + nvt_efm_enable(nvt); + nvt_select_logical_dev(nvt, ldev); + nvt_cr_write(nvt, LOGICAL_DEV_DISABLE, CR_LOGICAL_DEV_EN); + nvt_efm_disable(nvt); +} + /* write val to cir config register */ static inline void nvt_cir_reg_write(struct nvt_dev *nvt, u8 val, u8 offset) { @@ -937,13 +946,8 @@ static void nvt_disable_cir(struct nvt_dev *nvt) nvt_clear_cir_fifo(nvt); nvt_clear_tx_fifo(nvt); - nvt_efm_enable(nvt); - /* disable the CIR logical device */ - nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR); - nvt_cr_write(nvt, LOGICAL_DEV_DISABLE, CR_LOGICAL_DEV_EN); - - nvt_efm_disable(nvt); + nvt_disable_logical_dev(nvt, LOGICAL_DEV_CIR); } static int nvt_open(struct rc_dev *dev) @@ -1145,13 +1149,8 @@ static int nvt_suspend(struct pnp_dev *pdev, pm_message_t state) /* disable all CIR interrupts */ nvt_cir_reg_write(nvt, 0, CIR_IREN); - nvt_efm_enable(nvt); - /* disable cir logical dev */ - nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR); - nvt_cr_write(nvt, LOGICAL_DEV_DISABLE, CR_LOGICAL_DEV_EN); - - nvt_efm_disable(nvt); + nvt_disable_logical_dev(nvt, LOGICAL_DEV_CIR); /* make sure wake is enabled */ nvt_enable_wake(nvt);