From patchwork Wed Dec 30 16:40:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 7934241 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 C79159F387 for ; Wed, 30 Dec 2015 16:47:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 00311202FE for ; Wed, 30 Dec 2015 16:47:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 16F96202E9 for ; Wed, 30 Dec 2015 16:46:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754951AbbL3Qqv (ORCPT ); Wed, 30 Dec 2015 11:46:51 -0500 Received: from mail-wm0-f47.google.com ([74.125.82.47]:38091 "EHLO mail-wm0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753222AbbL3Qqr (ORCPT ); Wed, 30 Dec 2015 11:46:47 -0500 Received: by mail-wm0-f47.google.com with SMTP id b14so55519965wmb.1 for ; Wed, 30 Dec 2015 08:46:47 -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=rFDb69zKfNTfjqLo00ZsKcHhHxJQImkT+Csjssh3gH8=; b=V4rv+1WrWbVu0/SRYE2uksoeMO8F4YlvRe7W+cbL+gDChK7sojOklR7l6eJDkeQabc rGLof/0MqwcLEWN2WYs4kQlSRt5udFYdq1DLp+68RTy+wGH/Ou6SYRmVVCRtcu5MOITd 2tlns/H4J4wdu50mYYA2G2YMaEoR7mvJwmzEU6ZE+KrgKn1aXU0178hBxIYWID64xdl6 sFy0wmkoMdsWC57G74CZ2DTgI4HXzwCcDsjUx1AqOVNUoJfW6pzAg/+DyWuvGCvEhAcO 3MnOcuiohmF0VEd4FUnfMJmW8i1oXkaGR/UQ7y1mEQv1zSgNQ5cz9PLRExdo95kIgfcz CIxA== X-Received: by 10.194.58.235 with SMTP id u11mr22653959wjq.52.1451494006584; Wed, 30 Dec 2015 08:46:46 -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 a63sm57878774wmc.5.2015.12.30.08.46.45 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 30 Dec 2015 08:46:46 -0800 (PST) From: Heiner Kallweit Subject: [PATCH 05/16] media: rc: nuvoton-cir: factor out logical device enabling To: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org Message-ID: <568408EC.5090900@gmail.com> Date: Wed, 30 Dec 2015 17:40:12 +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 enabling of a logical device. Signed-off-by: Heiner Kallweit --- drivers/media/rc/nuvoton-cir.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index ceb6b95..8ed8011 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 enable logical device with setting EFM mode*/ +static inline void nvt_enable_logical_dev(struct nvt_dev *nvt, u8 ldev) +{ + nvt_efm_enable(nvt); + nvt_select_logical_dev(nvt, ldev); + nvt_cr_write(nvt, LOGICAL_DEV_ENABLE, CR_LOGICAL_DEV_EN); + nvt_efm_disable(nvt); +} + /* select and disable logical device with setting EFM mode*/ static inline void nvt_disable_logical_dev(struct nvt_dev *nvt, u8 ldev) { @@ -916,13 +925,8 @@ static void nvt_enable_cir(struct nvt_dev *nvt) CIR_IRCON_RXINV | CIR_IRCON_SAMPLE_PERIOD_SEL, CIR_IRCON); - nvt_efm_enable(nvt); - /* enable the CIR logical device */ - nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR); - nvt_cr_write(nvt, LOGICAL_DEV_ENABLE, CR_LOGICAL_DEV_EN); - - nvt_efm_disable(nvt); + nvt_enable_logical_dev(nvt, LOGICAL_DEV_CIR); /* clear all pending interrupts */ nvt_cir_reg_write(nvt, 0xff, CIR_IRSTS); @@ -1168,11 +1172,7 @@ static int nvt_resume(struct pnp_dev *pdev) nvt_set_cir_iren(nvt); /* Enable CIR logical device */ - nvt_efm_enable(nvt); - nvt_select_logical_dev(nvt, LOGICAL_DEV_CIR); - nvt_cr_write(nvt, LOGICAL_DEV_ENABLE, CR_LOGICAL_DEV_EN); - - nvt_efm_disable(nvt); + nvt_enable_logical_dev(nvt, LOGICAL_DEV_CIR); nvt_cir_regs_init(nvt); nvt_cir_wake_regs_init(nvt);