From patchwork Wed Nov 2 02:24:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinming Hu X-Patchwork-Id: 9408405 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5891A60721 for ; Wed, 2 Nov 2016 02:26:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 44DE229D2A for ; Wed, 2 Nov 2016 02:26:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3A06029D2E; Wed, 2 Nov 2016 02:26:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9F0A29D2A for ; Wed, 2 Nov 2016 02:26:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755283AbcKBC0J (ORCPT ); Tue, 1 Nov 2016 22:26:09 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33453 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755278AbcKBC0H (ORCPT ); Tue, 1 Nov 2016 22:26:07 -0400 Received: by mail-pf0-f193.google.com with SMTP id a136so277259pfa.0 for ; Tue, 01 Nov 2016 19:26:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=7XhN6G83JaHJUAH0cNq6GnYXF+v4vDWJ8p3KdMpsGnI=; b=gCHP6FcEm9Vo2mcWMpfYQycCwm2EOPOLsb0XC1JVub9n9xg0LiiqRxQ640uV70Pteq IlTzxk39457Q0e+tRMF9kZ+fECSnYOnr12iF/+dP21MiCsXZuAv2fLBPbnS2TSWH+sf7 AR+3d98Wrc8IYQaGYtnqmCezx65rElpD0ajilyHsvf0JO+F28XLWwcgMOnoKEFN23rQO vrZJfUMf3+1NvaGbWEjvQZ+KZi5zPJ08IKj9GTGfXQq6JW5d1B/HF4xfncKTcBixnwwQ Fwy4q+39O3E1WJM/jIMh7l7IicRH2C9WEXogQfklzJnwWHNQ2QTnkh78COtRo+tYBxyn Xx1Q== 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=7XhN6G83JaHJUAH0cNq6GnYXF+v4vDWJ8p3KdMpsGnI=; b=LS8QHFguEthf+coOkOZQMfVL5lXAPLZKpnbYjdoGYzauCsNtwTrfm9eqU6GlD3WKSU LcCEAGF9x8NHLtfxbDa43DydLkzfEG7lezMJ6f1BNOncKxu5UrX4gQy23DJ1CR+6LmFW IOYdgkFXVTcQJ/qnaKd36MapvCgeoDV8mMJgTT0BqrWM1Ta63kXqlZtwHGqeQl6i/0xd K6tGVRijsuXQXjiCy62mgu5BZ2hfh5Rt6+DO64cHxQ/H4eng1K8IQLY1y+6718ClruVD VhnnbcezK0Th+rBMQZY1leQWlMdL4zz6SUopethvsRqhVq7qa3siGjkm1UriF0iWFCZp c4Kw== X-Gm-Message-State: ABUngvdgEoSdbKVr976KIyqLiog0HZaqe1KV+QOICS+47eJJmSXabanJZQCT+BI+cvPXBg== X-Received: by 10.98.66.77 with SMTP id p74mr2324922pfa.15.1478053567102; Tue, 01 Nov 2016 19:26:07 -0700 (PDT) Received: from localhost.localdomain ([216.207.47.6]) by smtp.gmail.com with ESMTPSA id tx10sm36409076pab.40.2016.11.01.19.26.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 01 Nov 2016 19:26:06 -0700 (PDT) From: Xinming Hu X-Google-Original-From: Xinming Hu To: Linux Wireless Cc: Kalle Valo , Brian Norris , Dmitry Torokhov , Amitkumar Karwar , Cathy Luo , Brian Norris Subject: [PATCH v2 09/12] mwifiex: usb: handle HS failures Date: Wed, 2 Nov 2016 10:24:45 +0800 Message-Id: <1478053488-16042-7-git-send-email-huxinming820@marvell.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1478053488-16042-1-git-send-email-huxinming820@marvell.com> References: <1478053488-16042-1-git-send-email-huxinming820@marvell.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Brian Norris SDIO and PCIe drivers handle this. Let's imitate it. Not tested. --- v2: Same as v1 --- Signed-off-by: Brian Norris --- drivers/net/wireless/marvell/mwifiex/usb.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/marvell/mwifiex/usb.c b/drivers/net/wireless/marvell/mwifiex/usb.c index 70126c3..c26daf4 100644 --- a/drivers/net/wireless/marvell/mwifiex/usb.c +++ b/drivers/net/wireless/marvell/mwifiex/usb.c @@ -521,7 +521,14 @@ static int mwifiex_usb_suspend(struct usb_interface *intf, pm_message_t message) mwifiex_dbg(adapter, WARN, "Device already suspended\n"); - mwifiex_enable_hs(adapter); + /* Enable the Host Sleep */ + if (!mwifiex_enable_hs(adapter)) { + mwifiex_dbg(adapter, ERROR, + "cmd: failed to suspend\n"); + adapter->hs_enabling = false; + return -EFAULT; + } + /* 'is_suspended' flag indicates device is suspended. * It must be set here before the usb_kill_urb() calls. Reason