From patchwork Mon Sep 3 19:49:09 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Drake X-Patchwork-Id: 1400781 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 7329F3FC71 for ; Mon, 3 Sep 2012 19:57:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756434Ab2ICT5p (ORCPT ); Mon, 3 Sep 2012 15:57:45 -0400 Received: from swan.laptop.org ([18.85.2.166]:44313 "EHLO swan.laptop.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756229Ab2ICT5o (ORCPT ); Mon, 3 Sep 2012 15:57:44 -0400 X-Greylist: delayed 510 seconds by postgrey-1.27 at vger.kernel.org; Mon, 03 Sep 2012 15:57:44 EDT Received: from dev.laptop.org (crank.laptop.org [18.85.2.147]) by swan.laptop.org (Postfix) with ESMTP id E94543162A3; Mon, 3 Sep 2012 15:47:58 -0400 (EDT) Received: by dev.laptop.org (Postfix, from userid 1230) id A878DFAA0A; Mon, 3 Sep 2012 15:49:09 -0400 (EDT) From: Daniel Drake To: linville@tuxdriver.com, dcbw@redhat.com Cc: linux-wireless@vger.kernel.org, libertas-dev@lists.infradead.org Subject: [PATCH] libertas sdio: fix suspend when interface is down Message-Id: <20120903194909.A878DFAA0A@dev.laptop.org> Date: Mon, 3 Sep 2012 15:49:09 -0400 (EDT) Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org When the interface is down, the hardware is powered off. However, the suspend handler currently tries to send host sleep commands (when wakeup params are set) in this configuration, causing a system hang when going into suspend (the commands will never complete). Avoid this by detecting this situation and simply returning from the suspend handler without doing anything special. Signed-off-by: Daniel Drake Acked-by: Dan Williams --- drivers/net/wireless/libertas/if_sdio.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/wireless/libertas/if_sdio.c b/drivers/net/wireless/libertas/if_sdio.c index e970897..4cb2343 100644 --- a/drivers/net/wireless/libertas/if_sdio.c +++ b/drivers/net/wireless/libertas/if_sdio.c @@ -1326,6 +1326,11 @@ static int if_sdio_suspend(struct device *dev) mmc_pm_flag_t flags = sdio_get_host_pm_caps(func); + /* If we're powered off anyway, just let the mmc layer remove the + * card. */ + if (!lbs_iface_active(card->priv)) + return -ENOSYS; + dev_info(dev, "%s: suspend: PM flags = 0x%x\n", sdio_func_id(func), flags);