From patchwork Thu Dec 10 09:44:27 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajkumar Manoharan X-Patchwork-Id: 7817961 Return-Path: X-Original-To: patchwork-ath10k@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 C8554BEEE1 for ; Thu, 10 Dec 2015 09:45:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DD73A2056D for ; Thu, 10 Dec 2015 09:45:43 +0000 (UTC) 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.kernel.org (Postfix) with ESMTPS id DAF402055D for ; Thu, 10 Dec 2015 09:45:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1a6xn5-0002aE-V0; Thu, 10 Dec 2015 09:45:35 +0000 Received: from sabertooth01.qualcomm.com ([65.197.215.72]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1a6xn3-0001gx-3s for ath10k@lists.infradead.org; Thu, 10 Dec 2015 09:45:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qti.qualcomm.com; i=@qti.qualcomm.com; q=dns/txt; s=qcdkim; t=1449740733; x=1481276733; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version; bh=R/VaoB7yOm7eX/FxMFQsDIdlvKlL7HE6awWdFtzu4kw=; b=WsGX7BzboLOJENBWYC97w5Ome1iXnBNfI1hhrR+hLhYZjg17+NGzW9XV 1xREmUPRtnugvMcmt0CU4rRW4USXCUKonA+27uVEf9qlFHHyvbFj+m5/G afjtqD4y18f6zKIiZLuo5yeYsEbfBXvloT/AoFOpx+CZ2/Sonhe6SIWM4 M=; X-IronPort-AV: E=McAfee;i="5700,7163,8010"; a="102619400" Received: from ironmsg04-l-new.qualcomm.com (HELO Ironmsg04-L.qualcomm.com) ([10.53.140.111]) by sabertooth01.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 10 Dec 2015 01:45:11 -0800 X-IronPort-AV: E=Sophos; i="5.20,407,1444719600"; d="scan'208"; a="1024903295" Received: from nasanexm01e.na.qualcomm.com ([10.85.0.31]) by Ironmsg04-L.qualcomm.com with ESMTP/TLS/RC4-SHA; 10 Dec 2015 01:45:10 -0800 Received: from APHYDEXM01E.ap.qualcomm.com (10.252.127.13) by NASANEXM01E.na.qualcomm.com (10.85.0.31) with Microsoft SMTP Server (TLS) id 15.0.1076.9; Thu, 10 Dec 2015 01:45:09 -0800 Received: from qcmail1.qualcomm.com (10.80.80.8) by APHYDEXM01E.ap.qualcomm.com (10.252.127.13) with Microsoft SMTP Server (TLS) id 15.0.1076.9; Thu, 10 Dec 2015 01:45:01 -0800 Received: by qcmail1.qualcomm.com (sSMTP sendmail emulation); Thu, 10 Dec 2015 15:14:51 +0530 From: Rajkumar Manoharan To: Subject: [PATCH 2/2] ath10k: reduce indentation by moving powersave check within function Date: Thu, 10 Dec 2015 15:14:27 +0530 Message-ID: <1449740667-25901-2-git-send-email-rmanohar@qti.qualcomm.com> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1449740667-25901-1-git-send-email-rmanohar@qti.qualcomm.com> References: <1449740667-25901-1-git-send-email-rmanohar@qti.qualcomm.com> MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01G.na.qualcomm.com (10.85.0.33) To APHYDEXM01E.ap.qualcomm.com (10.252.127.13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151210_014533_235281_40646B3F X-CRM114-Status: GOOD ( 11.88 ) X-Spam-Score: -7.0 (-------) X-BeenThere: ath10k@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-wireless@vger.kernel.org, Rajkumar Manoharan Sender: "ath10k" Errors-To: ath10k-bounces+patchwork-ath10k=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, 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 For devices that does not support PCI power save, force wake up API is used. So move powersave check inside force wakeup to reduce one level indentation. Signed-off-by: Rajkumar Manoharan --- drivers/net/wireless/ath/ath10k/pci.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/drivers/net/wireless/ath/ath10k/pci.c b/drivers/net/wireless/ath/ath10k/pci.c index 473a141..c6aaad2 100644 --- a/drivers/net/wireless/ath/ath10k/pci.c +++ b/drivers/net/wireless/ath/ath10k/pci.c @@ -487,6 +487,9 @@ static int ath10k_pci_force_wake(struct ath10k *ar) unsigned long flags; int ret = 0; + if (ar_pci->pci_ps) + return ret; + spin_lock_irqsave(&ar_pci->ps_lock, flags); if (!ar_pci->ps_awake) { @@ -2480,12 +2483,10 @@ static int ath10k_pci_hif_resume(struct ath10k *ar) u32 val; int ret = 0; - if (ar_pci->pci_ps == 0) { - ret = ath10k_pci_force_wake(ar); - if (ret) { - ath10k_err(ar, "failed to wake up target: %d\n", ret); - return ret; - } + ret = ath10k_pci_force_wake(ar); + if (ret) { + ath10k_err(ar, "failed to wake up target: %d\n", ret); + return ret; } /* Suspend/Resume resets the PCI configuration space, so we have to @@ -2592,13 +2593,10 @@ static irqreturn_t ath10k_pci_interrupt_handler(int irq, void *arg) struct ath10k_pci *ar_pci = ath10k_pci_priv(ar); int ret; - if (ar_pci->pci_ps == 0) { - ret = ath10k_pci_force_wake(ar); - if (ret) { - ath10k_warn(ar, "failed to wake device up on irq: %d\n", - ret); - return IRQ_NONE; - } + ret = ath10k_pci_force_wake(ar); + if (ret) { + ath10k_warn(ar, "failed to wake device up on irq: %d\n", ret); + return IRQ_NONE; } if (ar_pci->num_msi_intrs == 0) { @@ -3071,12 +3069,10 @@ static int ath10k_pci_probe(struct pci_dev *pdev, goto err_sleep; } - if (ar_pci->pci_ps == 0) { - ret = ath10k_pci_force_wake(ar); - if (ret) { - ath10k_warn(ar, "failed to wake up device : %d\n", ret); - goto err_free_pipes; - } + ret = ath10k_pci_force_wake(ar); + if (ret) { + ath10k_warn(ar, "failed to wake up device : %d\n", ret); + goto err_free_pipes; } ath10k_pci_ce_deinit(ar);