From: Jeremie Samuel <jeremie.samuel.ext@parrot.com>
To: Chris Ball <cjb@laptop.org>
Cc: linux-mmc@vger.kernel.org,
"Grégor Boirie" <gregor.boirie@parrot.com>,
"Matthieu Castet" <matthieu.castet@parrot.com>,
"Jeremie Samuel" <jeremie.samuel.ext@parrot.com>,
"Anton Vorontsov" <avorontsov@mvista.com>
Subject: [PATCH v2 1/8] sdhci: Turn timeout timer into delayed work
Date: Mon, 21 Oct 2013 17:25:50 +0200 [thread overview]
Message-ID: <1382369157-16129-2-git-send-email-jeremie.samuel.ext@parrot.com> (raw)
In-Reply-To: <1382369157-16129-1-git-send-email-jeremie.samuel.ext@parrot.com>
There is no need for the timeout handler to run in the atomic
context, so this patch turns timeout timeout into the delayed
work.
Note that the timeout handler still grabs an irqsave spinlock,
we'll deal with it in a separate patch.
Patch based on http://thread.gmane.org/gmane.linux.kernel.mmc/2579.
Signed-off-by: Anton Vorontsov <avorontsov@mvista.com>
Signed-off-by: Jeremie Samuel <jeremie.samuel.ext@parrot.com>
---
drivers/mmc/host/sdhci.c | 13 +++++++------
include/linux/mmc/sdhci.h | 3 ++-
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index 66bce7a..b312ec6 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -13,6 +13,7 @@
* - JMicron (hardware and technical support)
*/
+#include <linux/workqueue.h>
#include <linux/delay.h>
#include <linux/highmem.h>
#include <linux/io.h>
@@ -1013,7 +1014,7 @@ void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
mdelay(1);
}
- mod_timer(&host->timer, jiffies + 10 * HZ);
+ schedule_delayed_work(&host->timeout_work, 10 * HZ);
host->cmd = cmd;
@@ -2140,7 +2141,7 @@ static void sdhci_tasklet_finish(unsigned long param)
return;
}
- del_timer(&host->timer);
+ cancel_delayed_work(&host->timeout_work);
mrq = host->mrq;
@@ -2180,12 +2181,12 @@ static void sdhci_tasklet_finish(unsigned long param)
sdhci_runtime_pm_put(host);
}
-static void sdhci_timeout_timer(unsigned long data)
+static void sdhci_timeout_work(struct work_struct *wk)
{
struct sdhci_host *host;
unsigned long flags;
- host = (struct sdhci_host*)data;
+ host = container_of(wk, struct sdhci_host, timeout_work.work);
spin_lock_irqsave(&host->lock, flags);
@@ -3213,7 +3214,7 @@ int sdhci_add_host(struct sdhci_host *host)
tasklet_init(&host->finish_tasklet,
sdhci_tasklet_finish, (unsigned long)host);
- setup_timer(&host->timer, sdhci_timeout_timer, (unsigned long)host);
+ INIT_DELAYED_WORK(&host->timeout_work, sdhci_timeout_work);
if (host->version >= SDHCI_SPEC_300) {
init_waitqueue_head(&host->buf_ready_int);
@@ -3316,7 +3317,7 @@ void sdhci_remove_host(struct sdhci_host *host, int dead)
sdhci_mask_irqs(host, SDHCI_INT_ALL_MASK);
free_irq(host->irq, host);
- del_timer_sync(&host->timer);
+ flush_delayed_work(&host->timeout_work);
tasklet_kill(&host->card_tasklet);
tasklet_kill(&host->finish_tasklet);
diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h
index 3e781b8..98cf934 100644
--- a/include/linux/mmc/sdhci.h
+++ b/include/linux/mmc/sdhci.h
@@ -12,6 +12,7 @@
#define LINUX_MMC_SDHCI_H
#include <linux/scatterlist.h>
+#include <linux/workqueue.h>
#include <linux/compiler.h>
#include <linux/types.h>
#include <linux/io.h>
@@ -163,7 +164,7 @@ struct sdhci_host {
struct tasklet_struct card_tasklet; /* Tasklet structures */
struct tasklet_struct finish_tasklet;
- struct timer_list timer; /* Timer for timeouts */
+ struct delayed_work timeout_work; /* Work for timeouts */
u32 caps; /* Alternative CAPABILITY_0 */
u32 caps1; /* Alternative CAPABILITY_1 */
--
1.7.10.4
next prev parent reply other threads:[~2013-10-21 15:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-21 15:25 [PATCH v2 0/8] sdhci: Move real work out of an atomic context Jeremie Samuel
2013-10-21 15:25 ` Jeremie Samuel [this message]
2013-10-21 15:25 ` [PATCH v2 2/8] sdhci: Turn tuning timeout timer into delayed work Jeremie Samuel
2013-10-21 15:25 ` [PATCH v2 3/8] sdhci: Use work structs instead of tasklets Jeremie Samuel
2013-10-21 15:25 ` [PATCH v2 4/8] sdhci: Use threaded IRQ handler Jeremie Samuel
2013-10-30 19:30 ` Olof Johansson
2013-10-21 15:25 ` [PATCH v2 5/8] sdhci: Delay led blinking Jeremie Samuel
2013-10-21 15:25 ` [PATCH v2 6/8] sdhci: Turn host->lock into a mutex Jeremie Samuel
2013-10-21 15:25 ` [PATCH v2 7/8] sdhci: Get rid of mdelay()s where it is safe and makes sense Jeremie Samuel
2013-10-21 15:25 ` [PATCH v2 8/8] sdhci: Use jiffies instead of a timeout counter Jeremie Samuel
2013-10-21 15:31 ` [PATCH v2 0/8] sdhci: Move real work out of an atomic context Chris Ball
2013-10-21 15:52 ` Jeremie Samuel
2013-10-21 20:02 ` Chris Ball
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=1382369157-16129-2-git-send-email-jeremie.samuel.ext@parrot.com \
--to=jeremie.samuel.ext@parrot.com \
--cc=avorontsov@mvista.com \
--cc=cjb@laptop.org \
--cc=gregor.boirie@parrot.com \
--cc=linux-mmc@vger.kernel.org \
--cc=matthieu.castet@parrot.com \
/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;
as well as URLs for NNTP newsgroup(s).