From patchwork Wed Dec 30 16:44:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 7934331 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7249BBEEE5 for ; Wed, 30 Dec 2015 16:47:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A64D3202EB for ; Wed, 30 Dec 2015 16:47:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CF7CD202F0 for ; Wed, 30 Dec 2015 16:47:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753304AbbL3Qrm (ORCPT ); Wed, 30 Dec 2015 11:47:42 -0500 Received: from mail-wm0-f42.google.com ([74.125.82.42]:37764 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754988AbbL3Qq5 (ORCPT ); Wed, 30 Dec 2015 11:46:57 -0500 Received: by mail-wm0-f42.google.com with SMTP id f206so84215106wmf.0 for ; Wed, 30 Dec 2015 08:46:57 -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=7ruA0LxhEZO/kUC+FlwAZ/ppXFqpShkAOGmq3EEkOVU=; b=mYKOevCufFl1UGD3Ks17q8T8t3woWwl0kmWt3hz47KPu6p0zaATg48TlPCyNUxnwjY YtvrzrNg/eUZc42FY5OWYKfmcSiYwuXjrQ92tf5HlRQJ8ByncGkFqbroUg1gpx2naWfD ZsgWscO7BF7GMnp0g4mvXRuhDa7QXneRqzyk8EcIe5iN4Wk9JF2mDsivBkuhFOrIQREO EK1AwuAucZ4XuuolEf5SPdKaXUbbp53KDIRVebBu2l1/XvihKctnanYskOkTgHxpAVs5 qwzXGSS7sHRtBTfSVabgR8i5lUvJNYf3ld6i7zHNAKziC2Tir4Ot+4+hqGHGvePN8lW8 HQkw== X-Received: by 10.28.195.138 with SMTP id t132mr49961421wmf.61.1451494016656; Wed, 30 Dec 2015 08:46:56 -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 qs1sm5382024wjc.2.2015.12.30.08.46.55 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 30 Dec 2015 08:46:56 -0800 (PST) From: Heiner Kallweit Subject: [PATCH 13/16] media: rc: nuvoton-cir: add locking to calls of nvt_enable_wake To: Mauro Carvalho Chehab Cc: linux-media@vger.kernel.org Message-ID: <568409F4.2020102@gmail.com> Date: Wed, 30 Dec 2015 17:44:36 +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=ham 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 Add locking to nvt_enable_wake calls. Signed-off-by: Heiner Kallweit --- drivers/media/rc/nuvoton-cir.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index 252804d..c3294fb 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c @@ -1173,16 +1173,16 @@ static int nvt_suspend(struct pnp_dev *pdev, pm_message_t state) nvt_dbg("%s called", __func__); - /* zero out misc state tracking */ - spin_lock_irqsave(&nvt->nvt_lock, flags); - nvt->study_state = ST_STUDY_NONE; - nvt->wake_state = ST_WAKE_NONE; - spin_unlock_irqrestore(&nvt->nvt_lock, flags); - spin_lock_irqsave(&nvt->tx.lock, flags); nvt->tx.tx_state = ST_TX_NONE; spin_unlock_irqrestore(&nvt->tx.lock, flags); + spin_lock_irqsave(&nvt->nvt_lock, flags); + + /* zero out misc state tracking */ + nvt->study_state = ST_STUDY_NONE; + nvt->wake_state = ST_WAKE_NONE; + /* disable all CIR interrupts */ nvt_cir_reg_write(nvt, 0, CIR_IREN); @@ -1192,6 +1192,8 @@ static int nvt_suspend(struct pnp_dev *pdev, pm_message_t state) /* make sure wake is enabled */ nvt_enable_wake(nvt); + spin_unlock_irqrestore(&nvt->nvt_lock, flags); + return 0; } @@ -1210,7 +1212,11 @@ static int nvt_resume(struct pnp_dev *pdev) static void nvt_shutdown(struct pnp_dev *pdev) { struct nvt_dev *nvt = pnp_get_drvdata(pdev); + unsigned long flags; + + spin_lock_irqsave(&nvt->nvt_lock, flags); nvt_enable_wake(nvt); + spin_unlock_irqrestore(&nvt->nvt_lock, flags); } static const struct pnp_device_id nvt_ids[] = {