From patchwork Mon Aug 30 09:59:54 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matt Fleming X-Patchwork-Id: 177592 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: Mon, 30 Aug 2010 11:00:00 +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 1Oq19k-0002Cy-7P for chris@printf.net; Mon, 30 Aug 2010 11:00:00 +0100 Received: by mail.laptop.org (Postfix) id 1ACFC241CF; Mon, 30 Aug 2010 05:59:41 -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 07284241CE for ; Mon, 30 Aug 2010 05:59:41 -0400 (EDT) X-ASG-Debug-ID: 1283162398-0b744d5e0001-zHW3sV Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by spam.laptop.org with ESMTP id zQyIENDz0u93ILT2 for ; Mon, 30 Aug 2010 05:59:58 -0400 (EDT) X-Barracuda-Envelope-From: linux-mmc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754874Ab0H3J75 (ORCPT ); Mon, 30 Aug 2010 05:59:57 -0400 Received: from arkanian.console-pimps.org ([212.110.184.194]:41359 "EHLO arkanian.console-pimps.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754795Ab0H3J75 (ORCPT ); Mon, 30 Aug 2010 05:59:57 -0400 Received: by arkanian.console-pimps.org (Postfix, from userid 1002) id 212932E4B6; Mon, 30 Aug 2010 10:59:56 +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 5E4E22E47B; Mon, 30 Aug 2010 10:59:55 +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 v2] mmc: Add helper function to check if a card is removable Subject: [PATCH v2] mmc: Add helper function to check if a card is removable Date: Mon, 30 Aug 2010 10:59:54 +0100 Message-Id: <47ab65a2e5b756b73fb78efa3a238f0c1c87fa24.1283158644.git.matt@console-pimps.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <4d1a88f196fa7e7eaf4c4a4af13d91ec81fb084e.1283003070.git.matt@console-pimps.org> References: <4d1a88f196fa7e7eaf4c4a4af13d91ec81fb084e.1283003070.git.matt@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: 1283162398 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.39408 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h index 9d9eef5..a2ca770 100644 --- a/drivers/mmc/core/core.h +++ b/drivers/mmc/core/core.h @@ -58,7 +58,6 @@ int mmc_attach_sdio(struct mmc_host *host, u32 ocr); /* Module parameters */ extern int use_spi_crc; -extern int mmc_assume_removable; /* Debugfs information for hosts and cards */ void mmc_add_host_debugfs(struct mmc_host *host); 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..c920cfc 100644 --- a/include/linux/mmc/host.h +++ b/include/linux/mmc/host.h @@ -272,5 +272,13 @@ static inline void mmc_set_disable_delay(struct mmc_host *host, host->disable_delay = disable_delay; } +/* Module parameter */ +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