This message generated a parse failure. Raw output follows here. Please use 'back' to navigate. From devnull@lkml.org Thu Apr 18 09:04:24 2024 Delivery-date: Wed, 03 Jun 2009 11:49:00 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752411AbZFCJsG (ORCPT ); Wed, 3 Jun 2009 05:48:06 -0400 Received: from smtp.nokia.com ([192.100.105.134]:27017 "EHLO mgw-mx09.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752150AbZFCJsD (ORCPT ); Wed, 3 Jun 2009 05:48:03 -0400 Received: from esebh106.NOE.Nokia.com (esebh106.ntc.nokia.com [172.21.138.213]) by mgw-mx09.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n539lKSB010961; Wed, 3 Jun 2009 04:47:59 -0500 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by esebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 3 Jun 2009 12:47:49 +0300 Received: from mgw-sa02.ext.nokia.com ([147.243.1.48]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Wed, 3 Jun 2009 12:47:49 +0300 Received: from [172.21.36.192] (esdhcp036192.research.nokia.com [172.21.36.192]) by mgw-sa02.ext.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n539lmXZ001872; Wed, 3 Jun 2009 12:47:48 +0300 Subject: Re: [PATCH 1/1] MMC: core/core.c: mmc_rescan detects card change in one run From: =?ISO-8859-1?Q?J=F6rg?= Schummer To: ext Pierre Ossman Cc: "linux-kernel@vger.kernel.org" In-Reply-To: <20090410183955.011c4d65@mjolnir.ossman.eu> References: <20090303095530.65923117@mjolnir.ossman.eu> <1238511081-24570-1-git-send-email-ext-jorg.2.schummer@nokia.com> <20090410183955.011c4d65@mjolnir.ossman.eu> Content-Type: multipart/mixed; boundary="=-XyVVsPNMlZ3R/AAyZyDP" Date: Wed, 03 Jun 2009 12:47:48 +0300 Message-Id: <1244022468.20907.5.camel@jorg-desktop> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 X-OriginalArrivalTime: 03 Jun 2009 09:47:49.0047 (UTC) FILETIME=[5AD87C70:01C9E430] X-Nokia-AV: Clean Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-Id: X-Mailing-List: linux-kernel@vger.kernel.org --=-XyVVsPNMlZ3R/AAyZyDP Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Fri, 2009-04-10 at 18:39 +0200, ext Pierre Ossman wrote: > On Tue, 31 Mar 2009 17:51:21 +0300 > Jorg Schummer wrote: > > > With this patch, mmc_rescan can detect the removal of an mmc card and > > the insertion of (possibly another) card in the same run. This means > > that a card change can be detected without having to call > > mmc_detect_change multiple times. > > > > This change generalises the core such that it can be easily used by > > hosts which provide a mechanism to detect only the presence of a card > > reader cover, which has to be taken off in order to insert a card. Other > > hosts ("card detect" or "MMC_CAP_NEEDS_POLL") each receive an event when > > a card is removed and when a card is inserted, so it is sufficient for > > them if mmc_rescan handles only one event at a time. "Cover detect" > > hosts, however, only receive events about the cover status. This means > > that between 2 subsequent events, both a card removal and a card > > insertion can occur. In this case, the pre-patch version of mmc_rescan > > would only detect the removal of the previous card but not the insertion > > of the new card. > > > > Signed-off-by: Jorg Schummer > > --- > > Queued, thanks. Hi Pierre, is there any news about this patch? Regards, Jörg --=-XyVVsPNMlZ3R/AAyZyDP Content-Disposition: attachment; filename=mmc_rescan.patch Content-Type: message/rfc822; name=mmc_rescan.patch From: ext-jorg.2.schummer@nokia.com Subject: [PATCH 1/1] MMC: core/core.c: mmc_rescan detects card change in one run Date: Wed, 03 Jun 2009 12:47:48 +0300 Message-Id: <1244022468.20907.6.camel@jorg-desktop> Mime-Version: 1.0 Content-Transfer-Encoding: 7bit With this patch, mmc_rescan can detect the removal of an mmc card and the insertion of (possibly another) card in the same run. This means that a card change can be detected without having to call mmc_detect_change multiple times. This change generalises the core such that it can be easily used by hosts which provide a mechanism to detect only the presence of a card reader cover, which has to be taken off in order to insert a card. Other hosts ("card detect" or "MMC_CAP_NEEDS_POLL") each receive an event when a card is removed and when a card is inserted, so it is sufficient for them if mmc_rescan handles only one event at a time. "Cover detect" hosts, however, only receive events about the cover status. This means that between 2 subsequent events, both a card removal and a card insertion can occur. In this case, the pre-patch version of mmc_rescan would only detect the removal of the previous card but not the insertion of the new card. Signed-off-by: Jorg Schummer --- drivers/mmc/core/core.c | 99 ++++++++++++++++++++++++++--------------------- 1 files changed, 55 insertions(+), 44 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index df6ce4a..5970719 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -740,61 +740,72 @@ void mmc_rescan(struct work_struct *work) mmc_bus_get(host); - if (host->bus_ops == NULL) { - /* - * Only we can add a new handler, so it's safe to - * release the lock here. - */ + /* if there is a card registered, check whether it is still present */ + if ((host->bus_ops != NULL) && host->bus_ops->detect && !host->bus_dead) + host->bus_ops->detect(host); + + mmc_bus_put(host); + + + mmc_bus_get(host); + + /* if there still is a card present, stop here */ + if (host->bus_ops != NULL) { mmc_bus_put(host); + goto out; + } - if (host->ops->get_cd && host->ops->get_cd(host) == 0) - goto out; + /* detect a newly inserted card */ - mmc_claim_host(host); + /* + * Only we can add a new handler, so it's safe to + * release the lock here. + */ + mmc_bus_put(host); - mmc_power_up(host); - mmc_go_idle(host); + if (host->ops->get_cd && host->ops->get_cd(host) == 0) + goto out; - mmc_send_if_cond(host, host->ocr_avail); + mmc_claim_host(host); - /* - * First we search for SDIO... - */ - err = mmc_send_io_op_cond(host, 0, &ocr); - if (!err) { - if (mmc_attach_sdio(host, ocr)) - mmc_power_off(host); - goto out; - } + mmc_power_up(host); + mmc_go_idle(host); - /* - * ...then normal SD... - */ - err = mmc_send_app_op_cond(host, 0, &ocr); - if (!err) { - if (mmc_attach_sd(host, ocr)) - mmc_power_off(host); - goto out; - } + mmc_send_if_cond(host, host->ocr_avail); - /* - * ...and finally MMC. - */ - err = mmc_send_op_cond(host, 0, &ocr); - if (!err) { - if (mmc_attach_mmc(host, ocr)) - mmc_power_off(host); - goto out; - } + /* + * First we search for SDIO... + */ + err = mmc_send_io_op_cond(host, 0, &ocr); + if (!err) { + if (mmc_attach_sdio(host, ocr)) + mmc_power_off(host); + goto out; + } - mmc_release_host(host); - mmc_power_off(host); - } else { - if (host->bus_ops->detect && !host->bus_dead) - host->bus_ops->detect(host); + /* + * ...then normal SD... + */ + err = mmc_send_app_op_cond(host, 0, &ocr); + if (!err) { + if (mmc_attach_sd(host, ocr)) + mmc_power_off(host); + goto out; + } - mmc_bus_put(host); + /* + * ...and finally MMC. + */ + err = mmc_send_op_cond(host, 0, &ocr); + if (!err) { + if (mmc_attach_mmc(host, ocr)) + mmc_power_off(host); + goto out; } + + mmc_release_host(host); + mmc_power_off(host); + out: if (host->caps & MMC_CAP_NEEDS_POLL) mmc_schedule_delayed_work(&host->detect, HZ); -- 1.5.4.3 --=-XyVVsPNMlZ3R/AAyZyDP-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/