From patchwork Mon Mar 31 21:01:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Mayer X-Patchwork-Id: 27506 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ig0-f199.google.com (mail-ig0-f199.google.com [209.85.213.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C091C202E0 for ; Mon, 31 Mar 2014 21:01:56 +0000 (UTC) Received: by mail-ig0-f199.google.com with SMTP id c1sf880605igq.6 for ; Mon, 31 Mar 2014 14:01:55 -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=eQOHh/Ll7BRCnxQnX7tufd9H17tstTVQE9OTRyq0qJ4h4o+hsFHrr5iFxS0Oxe9tCa x+jo/91GBlIAtkgLhz+hR9WQ9vpX7vuPrBsOygl8fpyf8l6Ks++9RKnNPEnHTsfg1VWb IB0U5Orz/kP7b/nJi0br+xFoWEh2yZ/sHq8XK4fp3y/woEbKT+EHaOIFQ/INUUtwxVDV t7LMeL91S36gAFmUUsC0BMD0LodRavkc2+OMUf9Bb+eOYVvHZzKZdx9KyUGo7MKbKLY1 l2ncs04n6W66B5ROIXigEbOBy5o6XwHEIaG3cAQ8ML9gAN6n9oNcYo63kOx+2tNr9hMf J6rw== X-Gm-Message-State: ALoCoQnd2gENzlrrNHsGqldQMSdmXNdrjOVCL3bMg/lZQKf4LhM9raPpG7YFgOS6SMbi2bkyx+eg X-Received: by 10.182.241.9 with SMTP id we9mr11157340obc.22.1396299715719; Mon, 31 Mar 2014 14:01:55 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.89.70 with SMTP id u64ls2508189qgd.80.gmail; Mon, 31 Mar 2014 14:01:55 -0700 (PDT) X-Received: by 10.58.31.136 with SMTP id a8mr4094426vei.20.1396299715574; Mon, 31 Mar 2014 14:01:55 -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 tm8si3189937vdc.44.2014.03.31.14.01.55 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 31 Mar 2014 14:01:55 -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 ik5so8826290vcb.14 for ; Mon, 31 Mar 2014 14:01:55 -0700 (PDT) X-Received: by 10.58.187.78 with SMTP id fq14mr24473082vec.9.1396299715455; Mon, 31 Mar 2014 14:01:55 -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 v8csp174267vcv; Mon, 31 Mar 2014 14:01:55 -0700 (PDT) X-Received: by 10.66.25.7 with SMTP id y7mr5701932paf.151.1396299714665; Mon, 31 Mar 2014 14:01:54 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ob6si9837897pbb.431.2014.03.31.14.01.53; Mon, 31 Mar 2014 14:01:54 -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 S1751635AbaCaVBv (ORCPT + 8 others); Mon, 31 Mar 2014 17:01:51 -0400 Received: from mail-gw1-out.broadcom.com ([216.31.210.62]:24460 "EHLO mail-gw1-out.broadcom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751086AbaCaVBt (ORCPT ); Mon, 31 Mar 2014 17:01:49 -0400 X-IronPort-AV: E=Sophos;i="4.97,767,1389772800"; d="scan'208";a="22525923" Received: from irvexchcas08.broadcom.com (HELO IRVEXCHCAS08.corp.ad.broadcom.com) ([10.9.208.57]) by mail-gw1-out.broadcom.com with ESMTP; 31 Mar 2014 14:57:01 -0700 Received: from IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) by IRVEXCHCAS08.corp.ad.broadcom.com (10.9.208.57) with Microsoft SMTP Server (TLS) id 14.3.174.1; Mon, 31 Mar 2014 14:01:48 -0700 Received: from mail-irva-13.broadcom.com (10.10.10.20) by IRVEXCHSMTP3.corp.ad.broadcom.com (10.9.207.53) with Microsoft SMTP Server id 14.3.174.1; Mon, 31 Mar 2014 14:01:48 -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 8F942EAD4D; Mon, 31 Mar 2014 14:01:47 -0700 (PDT) From: Markus Mayer To: Chris Ball , Ulf Hansson , Christian Daudt CC: Linux MMC List , Linux Kernel Mailing List Subject: [PATCH] mmc: Delay the card_event callback into the mmc_rescan worker Date: Mon, 31 Mar 2014 14:01:45 -0700 Message-ID: <1396299705-29268-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 --- 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;