From patchwork Tue Sep 7 23:38:49 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 178192 Return-path: X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on void.printf.net X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.9 tests=RCVD_IN_DNSWL_LOW autolearn=disabled version=3.2.5 Envelope-to: chris@printf.net Delivery-date: Wed, 08 Sep 2010 00:39:37 +0100 Received: from lists.laptop.org ([18.85.2.145] helo=mail.laptop.org) by void.printf.net with esmtp (Exim 4.69) (envelope-from ) id 1Ot7lI-00070g-6D for chris@printf.net; Wed, 08 Sep 2010 00:39:36 +0100 Received: by mail.laptop.org (Postfix) id A69172447E; Tue, 7 Sep 2010 19:39:16 -0400 (EDT) Delivered-To: cjb@laptop.org Received: from spam.laptop.org (spam.laptop.org [18.85.46.23]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.laptop.org (Postfix) with ESMTPS id 99DE424450 for ; Tue, 7 Sep 2010 19:39:16 -0400 (EDT) X-ASG-Debug-ID: 1283902774-0b7477360001-zHW3sV Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by spam.laptop.org with ESMTP id RaESwGiAHYKg9T1s for ; Tue, 07 Sep 2010 19:39:34 -0400 (EDT) X-Barracuda-Envelope-From: linux-mmc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758236Ab0IGXjY (ORCPT ); Tue, 7 Sep 2010 19:39:24 -0400 Received: from smtp1.linux-foundation.org ([140.211.169.13]:52878 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758235Ab0IGXjX (ORCPT ); Tue, 7 Sep 2010 19:39:23 -0400 Received: from imap1.linux-foundation.org (imap1.linux-foundation.org [140.211.169.55]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id o87NcnVq027791 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 7 Sep 2010 16:38:49 -0700 Received: from localhost.localdomain (localhost [127.0.0.1]) by imap1.linux-foundation.org (8.13.5.20060308/8.13.5/Debian-3ubuntu1.1) with ESMTP id o87Ncnk7013457; Tue, 7 Sep 2010 16:38:49 -0700 Message-Id: <201009072338.o87Ncnk7013457@imap1.linux-foundation.org> X-ASG-Orig-Subj: + mmc-make-id-freq-configurable-v5.patch added to -mm tree Subject: + mmc-make-id-freq-configurable-v5.patch added to -mm tree To: mm-commits@vger.kernel.org Cc: hein_tibosch@yahoo.es, cjb@laptop.org, linux-mmc@vger.kernel.org, matt@console-pimps.org From: akpm@linux-foundation.org Date: Tue, 07 Sep 2010 16:38:49 -0700 X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.13 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Barracuda-Connect: vger.kernel.org[209.132.180.67] X-Barracuda-Start-Time: 1283902774 X-Barracuda-URL: http://18.85.46.23:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at laptop.org X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=5.5 tests=NO_REAL_NAME X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.40230 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 NO_REAL_NAME From: does not include a real name diff -puN drivers/mmc/core/core.c~mmc-make-id-freq-configurable-v5 drivers/mmc/core/core.c --- a/drivers/mmc/core/core.c~mmc-make-id-freq-configurable-v5 +++ a/drivers/mmc/core/core.c @@ -1400,7 +1400,7 @@ void mmc_rescan(struct work_struct *work int err; unsigned long flags; int i; - unsigned freqs[] = { 400000, 300000, 200000, 100000 }; + const unsigned freqs[] = { 400000, 300000, 200000, 100000 }; spin_lock_irqsave(&host->lock, flags); @@ -1445,12 +1445,15 @@ void mmc_rescan(struct work_struct *work if (freqs[i] >= host->f_min) host->f_init = freqs[i]; - else if (i && freqs[i-1] <= host->f_min) - goto out; - else + else if (!i || freqs[i-1] > host->f_min) host->f_init = host->f_min; + else { + mmc_release_host(host); + goto out; + } + pr_info("%s: %s: trying to init card at %u Hz\n", + mmc_hostname(host), __func__, host->f_init); - printk ("mmc_rescan: trying %u Hz\n", host->f_init); mmc_power_up(host); sdio_reset(host); mmc_go_idle(host); @@ -1464,7 +1467,10 @@ void mmc_rescan(struct work_struct *work if (!err) { if (mmc_attach_sdio(host, ocr)) { mmc_claim_host(host); - /* try SDMEM (but not MMC) even if SDIO is broken */ + /* + * Try SDMEM (but not MMC) even if SDIO + * is broken. + */ if (mmc_send_app_op_cond(host, 0, &ocr)) goto out_fail;