From patchwork Tue Apr 8 22:19:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Mayer X-Patchwork-Id: 28047 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f197.google.com (mail-ie0-f197.google.com [209.85.223.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 71FD720447 for ; Tue, 8 Apr 2014 22:19:54 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id rd18sf7023725iec.4 for ; Tue, 08 Apr 2014 15:19:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe:content-type; bh=4rklg/cDmNiC0zak7r+eEE0R22KLX1VR2LOR553BJeU=; b=Q22qIRGipcXB9S1cklD8NZkxYFjuXbmcOk3D1o7ozGZF0uJOiNxFPS4PrEIzb27vaJ Fh9r21lhxjPMparJsP7d8Z7diJ/bsw65/9uXwXJAaoj5O39/ItO3/zR7I+roJ2nMzU81 KUz8p6d2nglaeY6NqYaHXWZ/Z33EHfTewb3nJJEA3dFPBDbrgFAfWRrZJG41agtutoTi ysJ/QoPzcDKCnUBnQCRHsgWcy7FNn8Mz36+/DhXguwhO2kGIzyWqaFQRD207+acicl/A iWLBGMf2x0b9wpxpGce7TdzC2vSkec8KV0uh8bLqAJO1GPq9QXLLylmyQHdKjX93z8t5 8xng== X-Gm-Message-State: ALoCoQncuz8Up0UbaVbnsJN8FL5OsohBhsra7KYJCmSKl7YmZttt/rmMLbCLRvOtjYw+5yLxxIJY X-Received: by 10.182.104.200 with SMTP id gg8mr3164083obb.45.1396995593879; Tue, 08 Apr 2014 15:19:53 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.41.40 with SMTP id y37ls366205qgy.10.gmail; Tue, 08 Apr 2014 15:19:53 -0700 (PDT) X-Received: by 10.220.105.4 with SMTP id r4mr2523611vco.27.1396995593657; Tue, 08 Apr 2014 15:19:53 -0700 (PDT) Received: from mail-vc0-f169.google.com (mail-vc0-f169.google.com [209.85.220.169]) by mx.google.com with ESMTPS id kp14si658953vcb.110.2014.04.08.15.19.53 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Apr 2014 15:19:53 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.169; Received: by mail-vc0-f169.google.com with SMTP id ik5so1413177vcb.0 for ; Tue, 08 Apr 2014 15:19:53 -0700 (PDT) X-Received: by 10.58.220.161 with SMTP id px1mr5474127vec.13.1396995593553; Tue, 08 Apr 2014 15:19:53 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.12.8 with SMTP id v8csp281683vcv; Tue, 8 Apr 2014 15:19:53 -0700 (PDT) X-Received: by 10.68.211.164 with SMTP id nd4mr7596782pbc.44.1396995592615; Tue, 08 Apr 2014 15:19:52 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yl4si1699441pbc.255.2014.04.08.15.19.52; Tue, 08 Apr 2014 15:19:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756239AbaDHWTu (ORCPT + 8 others); Tue, 8 Apr 2014 18:19:50 -0400 Received: from mail-gw3-out.broadcom.com ([216.31.210.64]:25920 "EHLO mail-gw3-out.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751594AbaDHWTt (ORCPT ); Tue, 8 Apr 2014 18:19:49 -0400 X-IronPort-AV: E=Sophos;i="4.97,821,1389772800"; d="scan'208";a="23347121" Received: from irvexchcas06.broadcom.com (HELO IRVEXCHCAS06.corp.ad.broadcom.com) ([10.9.208.53]) by mail-gw3-out.broadcom.com with ESMTP; 08 Apr 2014 15:37:00 -0700 Received: from IRVEXCHSMTP2.corp.ad.broadcom.com (10.9.207.52) by IRVEXCHCAS06.corp.ad.broadcom.com (10.9.208.53) with Microsoft SMTP Server (TLS) id 14.3.174.1; Tue, 8 Apr 2014 15:19:49 -0700 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP2.corp.ad.broadcom.com (10.9.207.52) with Microsoft SMTP Server id 14.3.174.1; Tue, 8 Apr 2014 15:19:49 -0700 Received: from mail.broadcom.com (lbrmn-lnxub70.ric.broadcom.com [10.136.8.215]) by mail-irva-13.broadcom.com (Postfix) with ESMTP id 940F7EAD4C; Tue, 8 Apr 2014 15:19:48 -0700 (PDT) From: Markus Mayer To: Chris Ball , Ulf Hansson , Christian Daudt CC: Linux MMC List , Linux Kernel Mailing List Subject: [PATCH RESEND] mmc: Delay the card_event callback into the mmc_rescan worker Date: Tue, 8 Apr 2014 15:19:43 -0700 Message-ID: <1396995583-5475-1-git-send-email-markus.mayer@linaro.org> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: markus.mayer@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This change removes the callback from atomic context which it doesn't need to be in, and puts it in line with the debounced rescan. This code is based on these e-mail threads with Christian Daudt: https://lkml.org/lkml/2013/8/19/539 https://lkml.org/lkml/2014/3/19/79 Signed-off-by: Markus Mayer Acked-by: Ulf Hansson --- drivers/mmc/core/core.c | 5 +++++ drivers/mmc/core/slot-gpio.c | 4 +--- include/linux/mmc/host.h | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 098374b..ff7fd2e 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -2421,6 +2421,11 @@ void mmc_rescan(struct work_struct *work) container_of(work, struct mmc_host, detect.work); int i; + if (host->trigger_card_event && host->ops->card_event) { + host->ops->card_event(host); + host->trigger_card_event = false; + } + if (host->rescan_disable) return; diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c index 46596b71..4029c85 100644 --- a/drivers/mmc/core/slot-gpio.c +++ b/drivers/mmc/core/slot-gpio.c @@ -29,9 +29,7 @@ static irqreturn_t mmc_gpio_cd_irqt(int irq, void *dev_id) /* Schedule a card detection after a debounce timeout */ struct mmc_host *host = dev_id; - if (host->ops->card_event) - host->ops->card_event(host); - + host->trigger_card_event = true; mmc_detect_change(host, msecs_to_jiffies(200)); return IRQ_HANDLED; diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 99f5709..63b983b 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -322,6 +322,8 @@ struct mmc_host { int rescan_disable; /* disable card detection */ int rescan_entered; /* used with nonremovable devices */ + bool trigger_card_event; /* card_event necessary */ + struct mmc_card *card; /* device attached to this host */ wait_queue_head_t wq;