All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] mmc: omap: driver registration cleanups
@ 2012-05-08 11:35 Venkatraman S
  2012-05-08 11:35 ` [PATCH 1/3] mmc: omap: convert to per instance workqueue Venkatraman S
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Venkatraman S @ 2012-05-08 11:35 UTC (permalink / raw)
  To: cjb, linux-mmc; +Cc: linux-omap, Venkatraman S

Cleanups for the legacy omap mmc driver to remove clutter and
make it well behaved as module.

Venkatraman S (3):
  mmc: omap: convert to per instance workqueue
  mmc: omap: make it behave well as module
  mmc: omap: convert to module_platform_driver

 drivers/mmc/host/omap.c |   48 +++++++++++++++-------------------------------
 1 files changed, 16 insertions(+), 32 deletions(-)

-- 
1.7.5.4


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] mmc: omap: convert to per instance workqueue
  2012-05-08 11:35 [PATCH 0/3] mmc: omap: driver registration cleanups Venkatraman S
@ 2012-05-08 11:35 ` Venkatraman S
  2012-05-08 11:35 ` [PATCH 2/3] mmc: omap: make it behave well as module Venkatraman S
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Venkatraman S @ 2012-05-08 11:35 UTC (permalink / raw)
  To: cjb, linux-mmc; +Cc: linux-omap, Venkatraman S

Currently, a global mmc_omap_wq is created for all instances of
omap hosts, which can lead to races and doesn't lend itself to
unload the module cleanly.
Instead, create per instance workqueue and remove the common workqueue.

Signed-off-by: Venkatraman S <svenkatr@ti.com>
---
 drivers/mmc/host/omap.c |   29 ++++++++++++-----------------
 1 files changed, 12 insertions(+), 17 deletions(-)

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 887c0e5..2d7628e 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -169,11 +169,11 @@ struct mmc_omap_host {
 	struct timer_list       clk_timer;
 	spinlock_t		clk_lock;     /* for changing enabled state */
 	unsigned int            fclk_enabled:1;
+	struct workqueue_struct *mmc_omap_wq;
 
 	struct omap_mmc_platform_data *pdata;
 };
 
-static struct workqueue_struct *mmc_omap_wq;
 
 static void mmc_omap_fclk_offdelay(struct mmc_omap_slot *slot)
 {
@@ -291,7 +291,7 @@ static void mmc_omap_release_slot(struct mmc_omap_slot *slot, int clk_enabled)
 		host->next_slot = new_slot;
 		host->mmc = new_slot->mmc;
 		spin_unlock_irqrestore(&host->slot_lock, flags);
-		queue_work(mmc_omap_wq, &host->slot_release_work);
+		queue_work(host->mmc_omap_wq, &host->slot_release_work);
 		return;
 	}
 
@@ -459,7 +459,7 @@ mmc_omap_xfer_done(struct mmc_omap_host *host, struct mmc_data *data)
 	}
 
 	host->stop_data = data;
-	queue_work(mmc_omap_wq, &host->send_stop_work);
+	queue_work(host->mmc_omap_wq, &host->send_stop_work);
 }
 
 static void
@@ -639,7 +639,7 @@ mmc_omap_cmd_timer(unsigned long data)
 		OMAP_MMC_WRITE(host, IE, 0);
 		disable_irq(host->irq);
 		host->abort = 1;
-		queue_work(mmc_omap_wq, &host->cmd_abort_work);
+		queue_work(host->mmc_omap_wq, &host->cmd_abort_work);
 	}
 	spin_unlock_irqrestore(&host->slot_lock, flags);
 }
@@ -828,7 +828,7 @@ static irqreturn_t mmc_omap_irq(int irq, void *dev_id)
 		host->abort = 1;
 		OMAP_MMC_WRITE(host, IE, 0);
 		disable_irq_nosync(host->irq);
-		queue_work(mmc_omap_wq, &host->cmd_abort_work);
+		queue_work(host->mmc_omap_wq, &host->cmd_abort_work);
 		return IRQ_HANDLED;
 	}
 
@@ -1389,7 +1389,7 @@ static void mmc_omap_remove_slot(struct mmc_omap_slot *slot)
 
 	tasklet_kill(&slot->cover_tasklet);
 	del_timer_sync(&slot->cover_timer);
-	flush_workqueue(mmc_omap_wq);
+	flush_workqueue(slot->host->mmc_omap_wq);
 
 	mmc_remove_host(mmc);
 	mmc_free_host(mmc);
@@ -1497,6 +1497,10 @@ static int __init mmc_omap_probe(struct platform_device *pdev)
 
 	host->reg_shift = (cpu_is_omap7xx() ? 1 : 2);
 
+	host->mmc_omap_wq = alloc_workqueue("mmc_omap", 0, 0);
+	if (!host->mmc_omap_wq)
+		goto err_plat_cleanup;
+
 	return 0;
 
 err_plat_cleanup:
@@ -1542,6 +1546,7 @@ static int mmc_omap_remove(struct platform_device *pdev)
 	iounmap(host->virt_base);
 	release_mem_region(pdev->resource[0].start,
 			   pdev->resource[0].end - pdev->resource[0].start + 1);
+	destroy_workqueue(host->mmc_omap_wq);
 
 	kfree(host);
 
@@ -1610,22 +1615,12 @@ static struct platform_driver mmc_omap_driver = {
 
 static int __init mmc_omap_init(void)
 {
-	int ret;
-
-	mmc_omap_wq = alloc_workqueue("mmc_omap", 0, 0);
-	if (!mmc_omap_wq)
-		return -ENOMEM;
-
-	ret = platform_driver_probe(&mmc_omap_driver, mmc_omap_probe);
-	if (ret)
-		destroy_workqueue(mmc_omap_wq);
-	return ret;
+	return platform_driver_probe(&mmc_omap_driver, mmc_omap_probe);
 }
 
 static void __exit mmc_omap_exit(void)
 {
 	platform_driver_unregister(&mmc_omap_driver);
-	destroy_workqueue(mmc_omap_wq);
 }
 
 module_init(mmc_omap_init);
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] mmc: omap: make it behave well as module
  2012-05-08 11:35 [PATCH 0/3] mmc: omap: driver registration cleanups Venkatraman S
  2012-05-08 11:35 ` [PATCH 1/3] mmc: omap: convert to per instance workqueue Venkatraman S
@ 2012-05-08 11:35 ` Venkatraman S
  2012-05-08 11:35 ` [PATCH 3/3] mmc: omap: convert to module_platform_driver Venkatraman S
  2012-05-10 14:54 ` [PATCH 0/3] mmc: omap: driver registration cleanups T Krishnamoorthy, Balaji
  3 siblings, 0 replies; 6+ messages in thread
From: Venkatraman S @ 2012-05-08 11:35 UTC (permalink / raw)
  To: cjb, linux-mmc; +Cc: linux-omap, Venkatraman S

Use proper __devinit and __devexit annotation for driver
functions. Instantiate the probe function for driver_ops
instead of a probe in the register function.

Signed-off-by: Venkatraman S <svenkatr@ti.com>
---
 drivers/mmc/host/omap.c |    9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 2d7628e..0056bd8 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1395,7 +1395,7 @@ static void mmc_omap_remove_slot(struct mmc_omap_slot *slot)
 	mmc_free_host(mmc);
 }
 
-static int __init mmc_omap_probe(struct platform_device *pdev)
+static int __devinit mmc_omap_probe(struct platform_device *pdev)
 {
 	struct omap_mmc_platform_data *pdata = pdev->dev.platform_data;
 	struct mmc_omap_host *host = NULL;
@@ -1522,7 +1522,7 @@ err_free_mem_region:
 	return ret;
 }
 
-static int mmc_omap_remove(struct platform_device *pdev)
+static int __devexit mmc_omap_remove(struct platform_device *pdev)
 {
 	struct mmc_omap_host *host = platform_get_drvdata(pdev);
 	int i;
@@ -1604,7 +1604,8 @@ static int mmc_omap_resume(struct platform_device *pdev)
 #endif
 
 static struct platform_driver mmc_omap_driver = {
-	.remove		= mmc_omap_remove,
+	.probe		= mmc_omap_probe,
+	.remove		= __devexit_p(mmc_omap_remove),
 	.suspend	= mmc_omap_suspend,
 	.resume		= mmc_omap_resume,
 	.driver		= {
@@ -1615,7 +1616,7 @@ static struct platform_driver mmc_omap_driver = {
 
 static int __init mmc_omap_init(void)
 {
-	return platform_driver_probe(&mmc_omap_driver, mmc_omap_probe);
+	return platform_driver_register(&mmc_omap_driver);
 }
 
 static void __exit mmc_omap_exit(void)
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] mmc: omap: convert to module_platform_driver
  2012-05-08 11:35 [PATCH 0/3] mmc: omap: driver registration cleanups Venkatraman S
  2012-05-08 11:35 ` [PATCH 1/3] mmc: omap: convert to per instance workqueue Venkatraman S
  2012-05-08 11:35 ` [PATCH 2/3] mmc: omap: make it behave well as module Venkatraman S
@ 2012-05-08 11:35 ` Venkatraman S
  2012-05-10 14:54 ` [PATCH 0/3] mmc: omap: driver registration cleanups T Krishnamoorthy, Balaji
  3 siblings, 0 replies; 6+ messages in thread
From: Venkatraman S @ 2012-05-08 11:35 UTC (permalink / raw)
  To: cjb, linux-mmc; +Cc: linux-omap, Venkatraman S

Get rid of boilerplate code by using module_platform_driver macro,
no functional changes.

Signed-off-by: Venkatraman S <svenkatr@ti.com>
---
 drivers/mmc/host/omap.c |   14 +-------------
 1 files changed, 1 insertions(+), 13 deletions(-)

diff --git a/drivers/mmc/host/omap.c b/drivers/mmc/host/omap.c
index 0056bd8..552196c 100644
--- a/drivers/mmc/host/omap.c
+++ b/drivers/mmc/host/omap.c
@@ -1614,19 +1614,7 @@ static struct platform_driver mmc_omap_driver = {
 	},
 };
 
-static int __init mmc_omap_init(void)
-{
-	return platform_driver_register(&mmc_omap_driver);
-}
-
-static void __exit mmc_omap_exit(void)
-{
-	platform_driver_unregister(&mmc_omap_driver);
-}
-
-module_init(mmc_omap_init);
-module_exit(mmc_omap_exit);
-
+module_platform_driver(mmc_omap_driver);
 MODULE_DESCRIPTION("OMAP Multimedia Card driver");
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:" DRIVER_NAME);
-- 
1.7.5.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] mmc: omap: driver registration cleanups
  2012-05-08 11:35 [PATCH 0/3] mmc: omap: driver registration cleanups Venkatraman S
                   ` (2 preceding siblings ...)
  2012-05-08 11:35 ` [PATCH 3/3] mmc: omap: convert to module_platform_driver Venkatraman S
@ 2012-05-10 14:54 ` T Krishnamoorthy, Balaji
  2012-05-17 12:27   ` Chris Ball
  3 siblings, 1 reply; 6+ messages in thread
From: T Krishnamoorthy, Balaji @ 2012-05-10 14:54 UTC (permalink / raw)
  To: Venkatraman S; +Cc: cjb, linux-mmc, linux-omap

On Tue, May 8, 2012 at 5:05 PM, Venkatraman S <svenkatr@ti.com> wrote:
> Cleanups for the legacy omap mmc driver to remove clutter and
> make it well behaved as module.
>
> Venkatraman S (3):
>  mmc: omap: convert to per instance workqueue
>  mmc: omap: make it behave well as module
>  mmc: omap: convert to module_platform_driver

Looks good to me, So
Acked-by: Balaji T K <balajitk@ti.com>

>
>  drivers/mmc/host/omap.c |   48 +++++++++++++++-------------------------------
>  1 files changed, 16 insertions(+), 32 deletions(-)
>
> --
> 1.7.5.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/3] mmc: omap: driver registration cleanups
  2012-05-10 14:54 ` [PATCH 0/3] mmc: omap: driver registration cleanups T Krishnamoorthy, Balaji
@ 2012-05-17 12:27   ` Chris Ball
  0 siblings, 0 replies; 6+ messages in thread
From: Chris Ball @ 2012-05-17 12:27 UTC (permalink / raw)
  To: T Krishnamoorthy, Balaji; +Cc: Venkatraman S, linux-mmc, linux-omap

Hi,

On Thu, May 10 2012, T Krishnamoorthy, Balaji wrote:
> On Tue, May 8, 2012 at 5:05 PM, Venkatraman S <svenkatr@ti.com> wrote:
>> Cleanups for the legacy omap mmc driver to remove clutter and
>> make it well behaved as module.
>>
>> Venkatraman S (3):
>>  mmc: omap: convert to per instance workqueue
>>  mmc: omap: make it behave well as module
>>  mmc: omap: convert to module_platform_driver
>
> Looks good to me, So
> Acked-by: Balaji T K <balajitk@ti.com>

Thanks, pushed to mmc-next for 3.5.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-05-17 12:27 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-08 11:35 [PATCH 0/3] mmc: omap: driver registration cleanups Venkatraman S
2012-05-08 11:35 ` [PATCH 1/3] mmc: omap: convert to per instance workqueue Venkatraman S
2012-05-08 11:35 ` [PATCH 2/3] mmc: omap: make it behave well as module Venkatraman S
2012-05-08 11:35 ` [PATCH 3/3] mmc: omap: convert to module_platform_driver Venkatraman S
2012-05-10 14:54 ` [PATCH 0/3] mmc: omap: driver registration cleanups T Krishnamoorthy, Balaji
2012-05-17 12:27   ` Chris Ball

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.