Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3253905imm; Fri, 19 Oct 2018 07:41:44 -0700 (PDT) X-Google-Smtp-Source: ACcGV63OefeueNZTqmp5Wm5B3i62YlZ0dlmPQmMdGMFMTnqB7lCj2zwS51bOZ8TP2szVb1V1tEpb X-Received: by 2002:a17:902:1ea:: with SMTP id b97-v6mr35096768plb.152.1539960104398; Fri, 19 Oct 2018 07:41:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539960104; cv=none; d=google.com; s=arc-20160816; b=L9EzkOnTNBhsSmoBp1SPLVj31UKScibGD+nr1ymHLs0xg28lS1xrslR6Gasuxe7Cm6 PdAcDmCW1h31InvnxPvpMG+HZosqqK0GAgWcaDv8dEh73YeZuY8u94H3ZAgCATFpJKDW LkOmIec2WXr5ANmRfR7Jr5LY3vWpLeHBYafbD7vczTsvh8KFAOxj3aqxak8b2TMg3oWB wHwbwhZvfQmapw0Cf50e2drX2Ki2fJS06zJdd8RFQxB6EVeb+NmpUE2DTymXQRLMiT4C f6jx7aXwvHK1kkCY9UjCevju5iwsI8ncpbJ0nYc+YSrrO6ADQoEp35XXpOqkhsxL1KLy zdWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=s5MnNV4RjHCyfb8GjHutbJjoAcZTNqPufveAP5RsMMY=; b=sReKboScTgo+PnhFltgIFKRn84uVO/PPskKo8KlIHGdCOOxG/3sfoc759M7QP9pFpJ hBY1CIqLndyl9zXdDnE4y6WmU788nAeaM60fob6/At6F6Inz4J5Rj+PQGLI4HPMY9ArH bRoCHV7rVk5VhLaKNJKI8xdSY9Tw7LkRN5Cm1dOWAeZL6kB26mmevSOu9NV00r+ZyZ6H CdMTegowFTfrKpqjElbpCEpKaOKK7Avl/FaUv6u6aqEEzufHtiZ8liv3Blgzf8o44nbE H6/QnNq2KMYcrkR9m8gj8SUzYHonpcnRoOj72xLDHmd0BO9YbCj8Zf7fXKOenmsVNBoJ mjyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@orbital-systems-com.20150623.gappssmtp.com header.s=20150623 header.b=MMyymVLY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o12-v6si25995573pfd.102.2018.10.19.07.41.28; Fri, 19 Oct 2018 07:41:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@orbital-systems-com.20150623.gappssmtp.com header.s=20150623 header.b=MMyymVLY; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727651AbeJSWqz (ORCPT + 99 others); Fri, 19 Oct 2018 18:46:55 -0400 Received: from mail-lj1-f194.google.com ([209.85.208.194]:44253 "EHLO mail-lj1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727243AbeJSWqy (ORCPT ); Fri, 19 Oct 2018 18:46:54 -0400 Received: by mail-lj1-f194.google.com with SMTP id v6-v6so31025711ljc.11 for ; Fri, 19 Oct 2018 07:40:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=orbital-systems-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=s5MnNV4RjHCyfb8GjHutbJjoAcZTNqPufveAP5RsMMY=; b=MMyymVLY36H7w/U/WiWDHtPleNgqFmM8zD9vfF9+DFBn9T/lBB593wWQypP3Ds7+se 643UDGScBvdy/RyxID5ptxioLZTiPH39vfT9o/A0o+kpvVFGEm7ioypWXYCbnU3xIgm7 X/NDBxBMfymPTmsMJtWrbbANt1jdI6VKbZp6dJlAM4GtbHTQpL4rcvDo6SuPFEWyk+x6 C3lMwiafN6v4BRU5BBi5ek80nPjp+MauDTMckKFTHeEgN9pTCGbCF2wiVmUwY16So7RE qFwEfEirnpHturvA4twW/xRIVCv6/LY/rr5/iEqPXKAdCg0vSWCDcE5ltELVOQlyuqW0 +R8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=s5MnNV4RjHCyfb8GjHutbJjoAcZTNqPufveAP5RsMMY=; b=V8aBVGDA7+wZLUL7AragN8lq0pAVL67rSU5BwIDw0TCqlsOQ+UaxdMB0Yg4OWzeDpy K+gHoIQaJplZab8Fq6Ib6G6cD5RnNb7L4x8K9ZtlGHPNWL6BCJAGplJtFGJNbpZHpRKD aq0s4DqN5uS1j5BH2YJrYhPbiR79HqzYJl8SgVm5BhzBVI5Szivtgrl8YYlqhbLi/yR0 SZCTibQ7cZRkVLjcimWOo4zC4DmmTWlO8x6urrpMo6TXJe5fwjAN7mDbJSt8rsR3Y/ig emOy9kGGv0rhgfaEII4J0juUogP3lSMhoAOVjPkvIIBEzsOz+axCWaZMWPJVzE5GqV65 HjaA== X-Gm-Message-State: ABuFfohWnD2IZxYekAi7vX4thJEG74zxAQ6ZXknbfyag1mdpMe7rdv0P Mtm6URsKW6FeVAmtt7EcPWBLYMut7qIWa1js X-Received: by 2002:a2e:900c:: with SMTP id h12-v6mr24784319ljg.121.1539960028238; Fri, 19 Oct 2018 07:40:28 -0700 (PDT) Received: from localhost.lan (81-225-58-94-no182.bredband.skanova.com. [81.225.58.94]) by smtp.gmail.com with ESMTPSA id d9-v6sm5231991lja.39.2018.10.19.07.40.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Oct 2018 07:40:27 -0700 (PDT) From: Jonas Danielsson To: linux-kernel@vger.kernel.org Cc: Jonas Danielsson , Ludovic Desroches , Ulf Hansson , linux-mmc@vger.kernel.org Subject: [PATCH] mmc: atmel-mci: do not assume idle after atmci_request_end Date: Fri, 19 Oct 2018 16:40:05 +0200 Message-Id: <20181019144024.31077-1-jonas@orbital-systems.com> X-Mailer: git-send-email 2.17.2 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On our AT91SAM9260 board we use the same sdio bus for wifi and for the sd card slot. This caused the atmel-mci to give the following splat on the serial console: ------------[ cut here ]------------ WARNING: CPU: 0 PID: 538 at drivers/mmc/host/atmel-mci.c:859 atmci_send_command+0x24/0x44 Modules linked in: CPU: 0 PID: 538 Comm: mmcqd/0 Not tainted 4.14.76 #14 Hardware name: Atmel AT91SAM9 [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (__warn+0xd8/0xf4) [] (__warn) from [] (warn_slowpath_null+0x1c/0x24) [] (warn_slowpath_null) from [] (atmci_send_command+0x24/0x44) [] (atmci_send_command) from [] (atmci_start_request+0x1f4/0x2dc) [] (atmci_start_request) from [] (atmci_request+0xf0/0x164) [] (atmci_request) from [] (mmc_start_request+0x280/0x2d0) [] (mmc_start_request) from [] (mmc_start_areq+0x230/0x330) [] (mmc_start_areq) from [] (mmc_blk_issue_rw_rq+0xc4/0x310) [] (mmc_blk_issue_rw_rq) from [] (mmc_blk_issue_rq+0x118/0x5ac) [] (mmc_blk_issue_rq) from [] (mmc_queue_thread+0xc4/0x118) [] (mmc_queue_thread) from [] (kthread+0x100/0x118) [] (kthread) from [] (ret_from_fork+0x14/0x34) ---[ end trace 594371ddfa284bd6 ]--- This is: WARN_ON(host->cmd); This was fixed on our board by letting atmci_request_end determine what state we are in. Instead of unconditionally setting it to STATE_IDLE on STATE_END_REQUEST. Signed-off-by: Jonas Danielsson --- drivers/mmc/host/atmel-mci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c index 0a0ebf3a0..c8a591d8a 100644 --- a/drivers/mmc/host/atmel-mci.c +++ b/drivers/mmc/host/atmel-mci.c @@ -1954,13 +1954,14 @@ static void atmci_tasklet_func(unsigned long priv) } atmci_request_end(host, host->mrq); - state = STATE_IDLE; + goto unlock; /* atmci_request_end() sets host->state */ break; } } while (state != prev_state); host->state = state; +unlock: spin_unlock(&host->lock); } -- 2.17.2