From patchwork Mon Dec 28 01:34:25 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 7924491 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Original-To: patchwork-linux-wireless@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 2FB299F3CD for ; Mon, 28 Dec 2015 01:36:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 481D92028D for ; Mon, 28 Dec 2015 01:36:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 78C9320279 for ; Mon, 28 Dec 2015 01:36:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751768AbbL1Bf3 (ORCPT ); Sun, 27 Dec 2015 20:35:29 -0500 Received: from mail-pf0-f169.google.com ([209.85.192.169]:36701 "EHLO mail-pf0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751120AbbL1Bei (ORCPT ); Sun, 27 Dec 2015 20:34:38 -0500 Received: by mail-pf0-f169.google.com with SMTP id 65so60766274pff.3 for ; Sun, 27 Dec 2015 17:34:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kryo-se.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=uSE0F8V4m4rA3hwGC/d4s678bwgViql5zSGHy+mes9c=; b=Hu8l+17HKzk32sHpuSpo6g9NwCgWVcb2x4c7vK/93UiJx8pbltR4wccTFxAvy995ia GdxnTfVggVQZnP7G3C6RU8xxZDImYYqnGT5A7XEpcscRBTuSgbjQxKETp8nEdwnm8LV3 3wmlbm2jhOqFoCcwnx/1qcO7R+apB8k+5Cedf6m32E14f0X/R7OElXNw3XhRRo32D0S9 XMaAM3uoQoJp6pCCHpGtPYzouGLj+2zvR4eBdoukl7gQ5LL5EFvI+/3YjomfBDHLmNRk jkshxgUxkobg4LswIq+tK0UHrR1IbGas/TbTqkdxD/LDrEhz75uKahbdL0L/LGZcjpHe b6lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=uSE0F8V4m4rA3hwGC/d4s678bwgViql5zSGHy+mes9c=; b=dn+wKw2p+j9xYcqM2KJY4mmXYV1dMDQ4SZdIet0kE4nLPSDl35YRBsJF85ItL7AtUC jRvxSKj6Z0YG2eYCJ94bra/iyLvJvQR2+PEIs/dZfhwXSy5ju0lsRbej6O136EpcFpkA zc9bFzzs+Ice8rzVFrhToSFuV5Jg8np62EQH4riwtR0+7qvt3ExlhdTMhTywferRUwGS g6gzwNF3t7I+6LxbFHQV/All7T+8yoWe1IlNVI/ttXIGTW7OKRoyfyUTUOiDKGRr+VTA sWpq9EGvSFFc02oAqbgDnSP2rdGbwzBAe2U9uIxmnlIEJ517vhLOKAWmot827TOTmDkz v9Cg== X-Gm-Message-State: ALoCoQlFHyIU2fnPAimvUOHRtvhlbRIs5yStPYCxwFyj6wjmdQNuhKI2V/b5vRVEp731ZibLtGPOTPFDH6JjMEsSuvDGAEBPeg== X-Received: by 10.98.10.66 with SMTP id s63mr67202221pfi.71.1451266478041; Sun, 27 Dec 2015 17:34:38 -0800 (PST) Received: from tuxbot.san.rr.com (cpe-76-167-68-231.natsow.res.rr.com. [76.167.68.231]) by smtp.gmail.com with ESMTPSA id p80sm47600850pfi.12.2015.12.27.17.34.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 27 Dec 2015 17:34:36 -0800 (PST) From: Bjorn Andersson X-Google-Original-From: Bjorn Andersson To: Eugene Krasnikov , Kalle Valo Cc: fengwei.yin@linaro.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, wcn36xx@lists.infradead.org Subject: [PATCH 2/4] wcn36xx: Change indication list lock to spinlock Date: Sun, 27 Dec 2015 17:34:25 -0800 Message-Id: <1451266467-15377-3-git-send-email-bjorn.andersson@sonymobile.com> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1451266467-15377-1-git-send-email-bjorn.andersson@sonymobile.com> References: <1451266467-15377-1-git-send-email-bjorn.andersson@sonymobile.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, 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 In preparation for handling incoming messages from IRQ context, change the indication list lock to a spinlock Signed-off-by: Bjorn Andersson --- drivers/net/wireless/ath/wcn36xx/smd.c | 12 ++++++------ drivers/net/wireless/ath/wcn36xx/wcn36xx.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/wireless/ath/wcn36xx/smd.c b/drivers/net/wireless/ath/wcn36xx/smd.c index 6b5dbe6f0d0a..4307429740a9 100644 --- a/drivers/net/wireless/ath/wcn36xx/smd.c +++ b/drivers/net/wireless/ath/wcn36xx/smd.c @@ -2165,10 +2165,10 @@ static void wcn36xx_smd_rsp_process(struct wcn36xx *wcn, void *buf, size_t len) msg_ind->msg_len = len; memcpy(msg_ind->msg, buf, len); - mutex_lock(&wcn->hal_ind_mutex); + spin_lock(&wcn->hal_ind_lock); list_add_tail(&msg_ind->list, &wcn->hal_ind_queue); queue_work(wcn->hal_ind_wq, &wcn->hal_ind_work); - mutex_unlock(&wcn->hal_ind_mutex); + spin_unlock(&wcn->hal_ind_lock); wcn36xx_dbg(WCN36XX_DBG_HAL, "indication arrived\n"); break; default: @@ -2182,8 +2182,9 @@ static void wcn36xx_ind_smd_work(struct work_struct *work) container_of(work, struct wcn36xx, hal_ind_work); struct wcn36xx_hal_msg_header *msg_header; struct wcn36xx_hal_ind_msg *hal_ind_msg; + unsigned long flags; - mutex_lock(&wcn->hal_ind_mutex); + spin_lock_irqsave(&wcn->hal_ind_lock, flags); hal_ind_msg = list_first_entry(&wcn->hal_ind_queue, struct wcn36xx_hal_ind_msg, @@ -2215,8 +2216,8 @@ static void wcn36xx_ind_smd_work(struct work_struct *work) msg_header->msg_type); } list_del(wcn->hal_ind_queue.next); + spin_unlock_irqrestore(&wcn->hal_ind_lock, flags); kfree(hal_ind_msg); - mutex_unlock(&wcn->hal_ind_mutex); } int wcn36xx_smd_open(struct wcn36xx *wcn) { @@ -2229,7 +2230,7 @@ int wcn36xx_smd_open(struct wcn36xx *wcn) } INIT_WORK(&wcn->hal_ind_work, wcn36xx_ind_smd_work); INIT_LIST_HEAD(&wcn->hal_ind_queue); - mutex_init(&wcn->hal_ind_mutex); + spin_lock_init(&wcn->hal_ind_lock); ret = wcn->ctrl_ops->open(wcn, wcn36xx_smd_rsp_process); if (ret) { @@ -2249,5 +2250,4 @@ void wcn36xx_smd_close(struct wcn36xx *wcn) { wcn->ctrl_ops->close(); destroy_workqueue(wcn->hal_ind_wq); - mutex_destroy(&wcn->hal_ind_mutex); } diff --git a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h index 7b41e833e18c..7997cc1312ee 100644 --- a/drivers/net/wireless/ath/wcn36xx/wcn36xx.h +++ b/drivers/net/wireless/ath/wcn36xx/wcn36xx.h @@ -215,7 +215,7 @@ struct wcn36xx { struct completion hal_rsp_compl; struct workqueue_struct *hal_ind_wq; struct work_struct hal_ind_work; - struct mutex hal_ind_mutex; + spinlock_t hal_ind_lock; struct list_head hal_ind_queue; /* DXE channels */