From: <micky_ching@realsil.com.cn>
To: <devel@linuxdriverproject.org>, <linux-kernel@vger.kernel.org>
Cc: <sameo@linux.intel.com>, <maximlevitsky@gmail.com>,
<gregkh@linuxfoundation.org>, <oakad@yahoo.com>,
<rogerable@realtek.com>, <wei_wang@realsil.com.cn>,
Micky Ching <micky_ching@realsil.com.cn>
Subject: [PATCH 2/3] memstick: rtsx: finish request if no card exist
Date: Wed, 14 Jan 2015 10:40:16 +0800 [thread overview]
Message-ID: <48dbfdff5bf6148483698249fa5ca21ab33816d5.1421202479.git.micky_ching@realsil.com.cn> (raw)
In-Reply-To: <cover.1421202479.git.micky_ching@realsil.com.cn>
From: Micky Ching <micky_ching@realsil.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@realsil.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
next prev parent reply other threads:[~2015-01-14 2:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-14 2:40 [PATCH 0/3] memstick: rtsx: finish request faster " micky_ching
2015-01-14 2:40 ` [PATCH 1/3] memstick: rtsx: dump register using compact format micky_ching
2015-01-14 2:40 ` micky_ching [this message]
2015-01-14 2:40 ` [PATCH 3/3] memstick: rtsx: move suspend/resume to pm ops micky_ching
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48dbfdff5bf6148483698249fa5ca21ab33816d5.1421202479.git.micky_ching@realsil.com.cn \
--to=micky_ching@realsil.com.cn \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maximlevitsky@gmail.com \
--cc=oakad@yahoo.com \
--cc=rogerable@realtek.com \
--cc=sameo@linux.intel.com \
--cc=wei_wang@realsil.com.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®