From patchwork Sat Aug 28 13:53:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Fleming X-Patchwork-Id: 177572 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: Sat, 28 Aug 2010 14:53:55 +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 1OpLr1-00036s-Mw for chris@printf.net; Sat, 28 Aug 2010 14:53:55 +0100 Received: by mail.laptop.org (Postfix) id A515023EA6; Sat, 28 Aug 2010 09:53:36 -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 8DEBE23EA5 for ; Sat, 28 Aug 2010 09:53:36 -0400 (EDT) X-ASG-Debug-ID: 1283003632-0b74b26b0001-zHW3sV Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by spam.laptop.org with ESMTP id GFEDU6f03U37qvzs for ; Sat, 28 Aug 2010 09:53:52 -0400 (EDT) X-Barracuda-Envelope-From: linux-mmc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752653Ab0H1Nxt (ORCPT ); Sat, 28 Aug 2010 09:53:49 -0400 Received: from arkanian.console-pimps.org ([212.110.184.194]:39278 "EHLO arkanian.console-pimps.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751429Ab0H1Nxs (ORCPT ); Sat, 28 Aug 2010 09:53:48 -0400 Received: by arkanian.console-pimps.org (Postfix, from userid 1002) id E04A250E49; Sat, 28 Aug 2010 14:53:47 +0100 (BST) Received: from localhost (cpc5-brad6-0-0-cust25.barn.cable.virginmedia.com [82.38.64.26]) by arkanian.console-pimps.org (Postfix) with ESMTPSA id 6DDE650E29; Sat, 28 Aug 2010 14:53:47 +0100 (BST) From: Matt Fleming To: Jaehoon Chung Cc: linux-mmc@vger.kernel.org, Kyungmin Park , Marek Szyprowski , Andrew Morton , Ben Dooks , Ben Hutchings , Yunpeng Gao X-ASG-Orig-Subj: [PATCH 1/2] mmc: Add helper function to check if a card is removable Subject: [PATCH 1/2] mmc: Add helper function to check if a card is removable Date: Sat, 28 Aug 2010 14:53:47 +0100 Message-Id: <4d1a88f196fa7e7eaf4c4a4af13d91ec81fb084e.1283003070.git.matt@console-pimps.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <20100828133737.GH18829@console-pimps.org> References: <20100828133737.GH18829@console-pimps.org> 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: 1283003632 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= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.39250 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index dcfc921..66c4a59 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -718,7 +718,7 @@ static void mmc_attach_bus_ops(struct mmc_host *host) { const struct mmc_bus_ops *bus_ops; - if (host->caps & MMC_CAP_NONREMOVABLE || !mmc_assume_removable) + if (!mmc_card_is_removable(host)) bus_ops = &mmc_ops_unsafe; else bus_ops = &mmc_ops; diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c index 0f52410..bc745e1 100644 --- a/drivers/mmc/core/sd.c +++ b/drivers/mmc/core/sd.c @@ -750,7 +750,7 @@ static void mmc_sd_attach_bus_ops(struct mmc_host *host) { const struct mmc_bus_ops *bus_ops; - if (host->caps & MMC_CAP_NONREMOVABLE || !mmc_assume_removable) + if (!mmc_card_is_removable(host)) bus_ops = &mmc_sd_ops_unsafe; else bus_ops = &mmc_sd_ops; diff --git a/include/linux/mmc/host.h b/include/linux/mmc/host.h index 09dbb90..cf4b71f 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -272,5 +272,12 @@ static inline void mmc_set_disable_delay(struct mmc_host *host, host->disable_delay = disable_delay; } +extern int mmc_assume_removable; + +static inline int mmc_card_is_removable(struct mmc_host *host) +{ + return (!(host->caps & MMC_CAP_NONREMOVABLE) || mmc_assume_removable); +} + #endif