Hi, During a little talk with Lars on #openmoko-cdevel about the state of the OM drivers, one of the "issues" of the glamo driver was the use of workqueues instead of threaded IRQs for IRQ handling in glamo-mci.
Here is a patch trying to fix that. It seems to work fine, however, I'm new to this kind of things, and discovered the glamo code today :) So, I may have missed something important, but anyway, here is the patch. Best Regards, Thibaut Girka
diff --git a/drivers/mfd/glamo/glamo-mci.c b/drivers/mfd/glamo/glamo-mci.c
index aa53124..2df150d 100644
--- a/drivers/mfd/glamo/glamo-mci.c
+++ b/drivers/mfd/glamo/glamo-mci.c
@@ -54,7 +54,6 @@ struct glamo_mci_host {
struct timer_list disable_timer;
- struct work_struct irq_work;
struct work_struct read_work;
unsigned clk_enabled:1;
@@ -256,11 +255,9 @@ mmc_request *mrq)
mmc_request_done(host->mmc, mrq);
}
-
-static void glamo_mci_irq_worker(struct work_struct *work)
+static irqreturn_t glamo_mci_irq(int irq, void *data)
{
- struct glamo_mci_host *host = container_of(work, struct glamo_mci_host,
- irq_work);
+ struct glamo_mci_host *host = data;
struct mmc_request *mrq;
struct mmc_command *cmd;
uint16_t status;
@@ -306,6 +303,7 @@ static void glamo_mci_irq_worker(struct work_struct *work)
done:
host->mrq = NULL;
glamo_mci_request_done(host, cmd->mrq);
+ return IRQ_HANDLED;
}
static void glamo_mci_read_worker(struct work_struct *work)
@@ -370,14 +368,6 @@ done:
glamo_mci_request_done(host, cmd->mrq);
}
-static irqreturn_t glamo_mci_irq(int irq, void *devid)
-{
- struct glamo_mci_host *host = (struct glamo_mci_host *)devid;
- schedule_work(&host->irq_work);
-
- return IRQ_HANDLED;
-}
-
static void glamo_mci_send_command(struct glamo_mci_host *host,
struct mmc_command *cmd)
{
@@ -792,7 +782,6 @@ static int glamo_mci_probe(struct platform_device *pdev)
host->core = core;
host->irq = platform_get_irq(pdev, 0);
- INIT_WORK(&host->irq_work, glamo_mci_irq_worker);
INIT_WORK(&host->read_work, glamo_mci_read_worker);
host->regulator = regulator_get(pdev->dev.parent, "SD_3V3");
@@ -856,7 +845,7 @@ static int glamo_mci_probe(struct platform_device *pdev)
goto probe_free_mem_region_data;
}
- ret = request_irq(host->irq, glamo_mci_irq, IRQF_SHARED,
+ ret = request_threaded_irq(host->irq, NULL, glamo_mci_irq, IRQF_SHARED,
pdev->name, host);
if (ret) {
dev_err(&pdev->dev, "failed to register irq.\n");
@@ -959,8 +948,6 @@ static int glamo_mci_suspend(struct device *dev)
struct glamo_mci_host *host = mmc_priv(mmc);
int ret;
- cancel_work_sync(&host->irq_work);
-
ret = mmc_suspend_host(mmc, PMSG_SUSPEND);
return ret;
signature.asc
Description: Ceci est une partie de message numériquement signée
