From patchwork Fri Dec 21 09:27:59 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chunhe Lan X-Patchwork-Id: 1902541 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 5DBB53FC64 for ; Fri, 21 Dec 2012 09:26:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751500Ab2LUJ0b (ORCPT ); Fri, 21 Dec 2012 04:26:31 -0500 Received: from db3ehsobe002.messaging.microsoft.com ([213.199.154.140]:13470 "EHLO db3outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751445Ab2LUJ03 (ORCPT ); Fri, 21 Dec 2012 04:26:29 -0500 Received: from mail55-db3-R.bigfish.com (10.3.81.237) by DB3EHSOBE001.bigfish.com (10.3.84.21) with Microsoft SMTP Server id 14.1.225.23; Fri, 21 Dec 2012 09:26:28 +0000 Received: from mail55-db3 (localhost [127.0.0.1]) by mail55-db3-R.bigfish.com (Postfix) with ESMTP id 55B7D3C0267; Fri, 21 Dec 2012 09:26:28 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1de0h1202h1e76h1d1ah1d2ahzz8275bh8275dhz2dh2a8h668h839he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1155h) Received: from mail55-db3 (localhost.localdomain [127.0.0.1]) by mail55-db3 (MessageSwitch) id 1356081986562700_5787; Fri, 21 Dec 2012 09:26:26 +0000 (UTC) Received: from DB3EHSMHS012.bigfish.com (unknown [10.3.81.240]) by mail55-db3.bigfish.com (Postfix) with ESMTP id 8339480078; Fri, 21 Dec 2012 09:26:26 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB3EHSMHS012.bigfish.com (10.3.87.112) with Microsoft SMTP Server (TLS) id 14.1.225.23; Fri, 21 Dec 2012 09:26:23 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-005.039d.mgd.msft.net (10.84.1.17) with Microsoft SMTP Server (TLS) id 14.2.318.3; Fri, 21 Dec 2012 09:26:21 +0000 Received: from ustc.localdomain4 ([10.193.20.71]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id qBL9Q6w7018697; Fri, 21 Dec 2012 02:26:09 -0700 From: Chunhe Lan To: CC: , Chunhe Lan , Kumar Gala , Arnd Bergmann Subject: [v4 1/2] mmc: Move mmc_delay() to include/linux/mmc/core.h Date: Fri, 21 Dec 2012 17:27:59 +0800 Message-ID: <1356082080-7756-1-git-send-email-Chunhe.Lan@freescale.com> X-Mailer: git-send-email 1.7.6.5 MIME-Version: 1.0 X-OriginatorOrg: freescale.com Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org Move mmc_delay() from drivers/mmc/core/core.h to include/linux/mmc/core.h. So when other functions call it with include syntax using of absolute path rather than "../core/core.h" of relative path. At the same time, change code, so schedule subsystem has more chances to call other threads. Signed-off-by: Chunhe Lan Signed-off-by: Kumar Gala Cc: Arnd Bergmann Cc: Chris Ball --- drivers/mmc/core/core.h | 12 ------------ include/linux/mmc/core.h | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h index 3bdafbc..5f63d00 100644 --- a/drivers/mmc/core/core.h +++ b/drivers/mmc/core/core.h @@ -11,8 +11,6 @@ #ifndef _MMC_CORE_CORE_H #define _MMC_CORE_CORE_H -#include - #define MMC_CMD_RETRIES 3 struct mmc_bus_ops { @@ -46,16 +44,6 @@ void mmc_set_timing(struct mmc_host *host, unsigned int timing); void mmc_set_driver_type(struct mmc_host *host, unsigned int drv_type); void mmc_power_off(struct mmc_host *host); -static inline void mmc_delay(unsigned int ms) -{ - if (ms < 1000 / HZ) { - cond_resched(); - mdelay(ms); - } else { - msleep(ms); - } -} - void mmc_rescan(struct work_struct *work); void mmc_start_host(struct mmc_host *host); void mmc_stop_host(struct mmc_host *host); diff --git a/include/linux/mmc/core.h b/include/linux/mmc/core.h index 5bf7c22..e051c5b 100644 --- a/include/linux/mmc/core.h +++ b/include/linux/mmc/core.h @@ -10,6 +10,7 @@ #include #include +#include struct request; struct mmc_data; @@ -198,6 +199,22 @@ static inline void mmc_claim_host(struct mmc_host *host) __mmc_claim_host(host, NULL); } +static inline void mmc_delay(unsigned int ms) +{ + ktime_t end = ktime_add_us(ktime_get(), ms * 1000); + + while (1) { + s64 remaining; + + cond_resched(); + remaining = ktime_to_us(ktime_sub(end, ktime_get())); + if (remaining < 0) + break; + + udelay(min_t(u32, remaining, 100)); + } +} + extern u32 mmc_vddrange_to_ocrmask(int vdd_min, int vdd_max); #endif /* LINUX_MMC_CORE_H */