[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <48dbfdff5bf6148483698249fa5ca21ab33816d5.1421202479.git.micky_ching@realsil.com.cn>
Date: Wed, 14 Jan 2015 10:40:16 +0800
From: <micky_ching@...lsil.com.cn>
To: <devel@...uxdriverproject.org>, <linux-kernel@...r.kernel.org>
CC: <sameo@...ux.intel.com>, <maximlevitsky@...il.com>,
<gregkh@...uxfoundation.org>, <oakad@...oo.com>,
<rogerable@...ltek.com>, <wei_wang@...lsil.com.cn>,
Micky Ching <micky_ching@...lsil.com.cn>
Subject: [PATCH 2/3] memstick: rtsx: finish request if no card exist
From: Micky Ching <micky_ching@...lsil.com.cn>
Check card exist before start request, this method can make card remove
faster. If we found the card is not exist, just return error-code,
not sending request can save much time.
Signed-off-by: Micky Ching <micky_ching@...lsil.com.cn>
---
drivers/memstick/host/rtsx_pci_ms.c | 27 ++++++++++++++++++---------
1 file changed, 18 insertions(+), 9 deletions(-)
diff --git a/drivers/memstick/host/rtsx_pci_ms.c b/drivers/memstick/host/rtsx_pci_ms.c
index baf94db..c9981af 100644
--- a/drivers/memstick/host/rtsx_pci_ms.c
+++ b/drivers/memstick/host/rtsx_pci_ms.c
@@ -85,6 +85,11 @@ static void ms_print_debug_regs(struct realtek_pci_ms *host)
#endif
+static inline int ms_get_cd_int(struct realtek_pci_ms *host)
+{
+ return rtsx_pci_readl(host->pcr, RTSX_BIPR) & MS_EXIST;
+}
+
static int ms_power_on(struct realtek_pci_ms *host)
{
struct rtsx_pcr *pcr = host->pcr;
@@ -409,6 +414,9 @@ static void rtsx_pci_ms_handle_req(struct work_struct *work)
struct memstick_host *msh = host->msh;
int rc;
+ if (host->req)
+ return;
+
mutex_lock(&pcr->pcr_mutex);
rtsx_pci_start_run(pcr);
@@ -419,15 +427,16 @@ static void rtsx_pci_ms_handle_req(struct work_struct *work)
rtsx_pci_write_register(pcr, CARD_SHARE_MODE,
CARD_SHARE_MASK, CARD_SHARE_48_MS);
- if (!host->req) {
- do {
- rc = memstick_next_req(msh, &host->req);
- dev_dbg(ms_dev(host), "next req %d\n", rc);
-
- if (!rc)
- host->req->error = rtsx_pci_ms_issue_cmd(host);
- } while (!rc);
- }
+ while (true) {
+ rc = memstick_next_req(msh, &host->req);
+ dev_dbg(ms_dev(host), "next req %d\n", rc);
+ if (rc)
+ break;
+ if (!ms_get_cd_int(host))
+ host->req->error = -ENOMEDIUM;
+ else
+ host->req->error = rtsx_pci_ms_issue_cmd(host);
+ };
mutex_unlock(&pcr->pcr_mutex);
}
--
1.9.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists