From patchwork Mon Jul 30 21:58:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Drake X-Patchwork-Id: 1256681 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id D7829DFFBF for ; Mon, 30 Jul 2012 21:58:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754946Ab2G3V6Q (ORCPT ); Mon, 30 Jul 2012 17:58:16 -0400 Received: from mtaout02-winn.ispmail.ntl.com ([81.103.221.48]:3126 "EHLO mtaout02-winn.ispmail.ntl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754895Ab2G3V6Q (ORCPT ); Mon, 30 Jul 2012 17:58:16 -0400 Received: from aamtaout01-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com (InterMail vM.7.08.04.00 201-2186-134-20080326) with ESMTP id <20120730215811.FXYB14795.mtaout02-winn.ispmail.ntl.com@aamtaout01-winn.ispmail.ntl.com>; Mon, 30 Jul 2012 22:58:11 +0100 Received: from zog.reactivated.net ([86.14.215.141]) by aamtaout01-winn.ispmail.ntl.com (InterMail vG.3.00.04.00 201-2196-133-20080908) with ESMTP id <20120730215806.TPBE8396.aamtaout01-winn.ispmail.ntl.com@zog.reactivated.net>; Mon, 30 Jul 2012 22:58:06 +0100 Received: by zog.reactivated.net (Postfix, from userid 1000) id 4BFA89D401E; Mon, 30 Jul 2012 22:58:04 +0100 (BST) From: Daniel Drake To: linville@tuxdriver.com Cc: libertas-dev@lists.infradead.org, linux-wireless@vger.kernel.org, dcbw@redhat.com Subject: [PATCH] libertas: don't reset card on error when it is being removed Message-Id: <20120730215804.4BFA89D401E@zog.reactivated.net> Date: Mon, 30 Jul 2012 22:58:04 +0100 (BST) X-Cloudmark-Analysis: v=1.1 cv=AUhbpHVS+xhHrj9wLCYAQoYnFLYUZdbP8UM0GmH2jwk= c=1 sm=0 a=CcUtYLmXt0UA:10 a=vJ1w_8FsMGIA:10 a=Op-mwl0xAAAA:8 a=NMtxdlrwinSrAOEAo7IA:9 a=d4CUUju0HPYA:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org On an OLPC XO-1.5 we have seen the following situation: - the system starts going into suspend - no wake params are set, so the mmc layer removes the card - during remove, we send a command to the card - that command fails, causing if_sdio's reset method to try and remove the mmc card in attempt to reset it - the mmc layer is not happy about being asked to remove a card that it is already removing, and the kernel crashes While the MMC layer could possibly be taught to behave better here, it also seems sensible for libertas not to try and reset a card if we're in the process of removing it anyway. Signed-off-by: Daniel Drake Acked-by: Dan Williams --- drivers/net/wireless/libertas/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/libertas/main.c b/drivers/net/wireless/libertas/main.c index e96ee0a..8d17cac 100644 --- a/drivers/net/wireless/libertas/main.c +++ b/drivers/net/wireless/libertas/main.c @@ -565,7 +565,10 @@ static int lbs_thread(void *data) netdev_info(dev, "Timeout submitting command 0x%04x\n", le16_to_cpu(cmdnode->cmdbuf->command)); lbs_complete_command(priv, cmdnode, -ETIMEDOUT); - if (priv->reset_card) + + /* Reset card, but only when it isn't in the process + * of being shutdown anyway. */ + if (!dev->dismantle && priv->reset_card) priv->reset_card(priv); } priv->cmd_timed_out = 0;