* [PATCH 0/3] OMAP: SPI: Driver updates
@ 2011-10-28 11:44 Shubhrajyoti D
2011-10-28 11:44 ` [PATCH 1/3] OMAP: SPI: Use a workqueue per omap2_mcspi controller Shubhrajyoti D
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Shubhrajyoti D @ 2011-10-28 11:44 UTC (permalink / raw)
To: spi-devel-general; +Cc: linux-kernel, Shubhrajyoti D
The patch series does the following
1. Optimises the workqueue to have 1 workqueue per controller so
that one data of one queue doesnt interfere with other.
Earlier discussion thread
http://sourceforge.net/mailarchive/forum.php?thread_name=1319210705-18677-1-git-send-email-shubhrajyoti%40ti.com&forum_name=spi-devel-general
2. Call pm_runtime_disable as it got missed out.
3. Error handling in the spi driver is corrected.
Shubhrajyoti D (3):
OMAP: SPI: Use a workqueue per omap2_mcspi controller
OMAP: SPI: call pm_runtime_disable in error path and remove
OMAP: SPI: Correct the error path
drivers/spi/spi-omap2-mcspi.c | 51 +++++++++++++++++++++++++---------------
1 files changed, 32 insertions(+), 19 deletions(-)
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH 1/3] OMAP: SPI: Use a workqueue per omap2_mcspi controller 2011-10-28 11:44 [PATCH 0/3] OMAP: SPI: Driver updates Shubhrajyoti D @ 2011-10-28 11:44 ` Shubhrajyoti D 2011-10-29 12:03 ` Grant Likely 2011-10-28 11:44 ` [PATCH 2/3] OMAP: SPI: call pm_runtime_disable in error path and remove Shubhrajyoti D 2011-10-28 11:44 ` [PATCH 3/3] OMAP: SPI: Correct the error path Shubhrajyoti D 2 siblings, 1 reply; 8+ messages in thread From: Shubhrajyoti D @ 2011-10-28 11:44 UTC (permalink / raw) To: spi-devel-general; +Cc: linux-kernel, Shubhrajyoti D, Steve Wilkins Currently all the spi controllers share the work queue. This patch allocates a work queue per controller. Signed-off-by: Steve Wilkins <steve.wilkins@raymarine.com> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> --- drivers/spi/spi-omap2-mcspi.c | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index a8b614b..471b0f3 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -121,6 +121,7 @@ struct omap2_mcspi { /* SPI1 has 4 channels, while SPI2 has 2 */ struct omap2_mcspi_dma *dma_channels; struct device *dev; + struct workqueue_struct *wq; }; struct omap2_mcspi_cs { @@ -143,8 +144,6 @@ struct omap2_mcspi_regs { static struct omap2_mcspi_regs omap2_mcspi_ctx[OMAP2_MCSPI_MAX_CTRL]; -static struct workqueue_struct *omap2_mcspi_wq; - #define MOD_REG_BIT(val, mask, set) do { \ if (set) \ val |= mask; \ @@ -1043,7 +1042,7 @@ static int omap2_mcspi_transfer(struct spi_device *spi, struct spi_message *m) spin_lock_irqsave(&mcspi->lock, flags); list_add_tail(&m->queue, &mcspi->msg_queue); - queue_work(omap2_mcspi_wq, &mcspi->work); + queue_work(mcspi->wq, &mcspi->work); spin_unlock_irqrestore(&mcspi->lock, flags); return 0; @@ -1088,6 +1087,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev) struct omap2_mcspi *mcspi; struct resource *r; int status = 0, i; + char wq_name[20]; master = spi_alloc_master(&pdev->dev, sizeof *mcspi); if (master == NULL) { @@ -1111,6 +1111,13 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev) mcspi = spi_master_get_devdata(master); mcspi->master = master; + sprintf(wq_name, "omap2_mcspi/%d", master->bus_num); + mcspi->wq = alloc_workqueue(wq_name, WQ_MEM_RECLAIM, 1); + if (mcspi->wq == NULL) { + status = -ENOMEM; + goto err1; + } + r = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (r == NULL) { status = -ENODEV; @@ -1216,6 +1223,7 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev) spi_unregister_master(master); iounmap(base); kfree(dma_channels); + destroy_workqueue(mcspi->wq); return 0; } @@ -1274,10 +1282,6 @@ static struct platform_driver omap2_mcspi_driver = { static int __init omap2_mcspi_init(void) { - omap2_mcspi_wq = create_singlethread_workqueue( - omap2_mcspi_driver.driver.name); - if (omap2_mcspi_wq == NULL) - return -1; return platform_driver_probe(&omap2_mcspi_driver, omap2_mcspi_probe); } subsys_initcall(omap2_mcspi_init); @@ -1286,7 +1290,6 @@ static void __exit omap2_mcspi_exit(void) { platform_driver_unregister(&omap2_mcspi_driver); - destroy_workqueue(omap2_mcspi_wq); } module_exit(omap2_mcspi_exit); -- 1.7.1 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/3] OMAP: SPI: Use a workqueue per omap2_mcspi controller 2011-10-28 11:44 ` [PATCH 1/3] OMAP: SPI: Use a workqueue per omap2_mcspi controller Shubhrajyoti D @ 2011-10-29 12:03 ` Grant Likely 0 siblings, 0 replies; 8+ messages in thread From: Grant Likely @ 2011-10-29 12:03 UTC (permalink / raw) To: Shubhrajyoti D; +Cc: spi-devel-general, linux-kernel, Steve Wilkins On Fri, Oct 28, 2011 at 05:14:17PM +0530, Shubhrajyoti D wrote: > Currently all the spi controllers share the work queue. > This patch allocates a work queue per controller. > > Signed-off-by: Steve Wilkins <steve.wilkins@raymarine.com> > Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Applied for v3.3, thanks. g. > --- > drivers/spi/spi-omap2-mcspi.c | 19 +++++++++++-------- > 1 files changed, 11 insertions(+), 8 deletions(-) > > diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c > index a8b614b..471b0f3 100644 > --- a/drivers/spi/spi-omap2-mcspi.c > +++ b/drivers/spi/spi-omap2-mcspi.c > @@ -121,6 +121,7 @@ struct omap2_mcspi { > /* SPI1 has 4 channels, while SPI2 has 2 */ > struct omap2_mcspi_dma *dma_channels; > struct device *dev; > + struct workqueue_struct *wq; > }; > > struct omap2_mcspi_cs { > @@ -143,8 +144,6 @@ struct omap2_mcspi_regs { > > static struct omap2_mcspi_regs omap2_mcspi_ctx[OMAP2_MCSPI_MAX_CTRL]; > > -static struct workqueue_struct *omap2_mcspi_wq; > - > #define MOD_REG_BIT(val, mask, set) do { \ > if (set) \ > val |= mask; \ > @@ -1043,7 +1042,7 @@ static int omap2_mcspi_transfer(struct spi_device *spi, struct spi_message *m) > > spin_lock_irqsave(&mcspi->lock, flags); > list_add_tail(&m->queue, &mcspi->msg_queue); > - queue_work(omap2_mcspi_wq, &mcspi->work); > + queue_work(mcspi->wq, &mcspi->work); > spin_unlock_irqrestore(&mcspi->lock, flags); > > return 0; > @@ -1088,6 +1087,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev) > struct omap2_mcspi *mcspi; > struct resource *r; > int status = 0, i; > + char wq_name[20]; > > master = spi_alloc_master(&pdev->dev, sizeof *mcspi); > if (master == NULL) { > @@ -1111,6 +1111,13 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev) > mcspi = spi_master_get_devdata(master); > mcspi->master = master; > > + sprintf(wq_name, "omap2_mcspi/%d", master->bus_num); > + mcspi->wq = alloc_workqueue(wq_name, WQ_MEM_RECLAIM, 1); > + if (mcspi->wq == NULL) { > + status = -ENOMEM; > + goto err1; > + } > + > r = platform_get_resource(pdev, IORESOURCE_MEM, 0); > if (r == NULL) { > status = -ENODEV; > @@ -1216,6 +1223,7 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev) > spi_unregister_master(master); > iounmap(base); > kfree(dma_channels); > + destroy_workqueue(mcspi->wq); > > return 0; > } > @@ -1274,10 +1282,6 @@ static struct platform_driver omap2_mcspi_driver = { > > static int __init omap2_mcspi_init(void) > { > - omap2_mcspi_wq = create_singlethread_workqueue( > - omap2_mcspi_driver.driver.name); > - if (omap2_mcspi_wq == NULL) > - return -1; > return platform_driver_probe(&omap2_mcspi_driver, omap2_mcspi_probe); > } > subsys_initcall(omap2_mcspi_init); > @@ -1286,7 +1290,6 @@ static void __exit omap2_mcspi_exit(void) > { > platform_driver_unregister(&omap2_mcspi_driver); > > - destroy_workqueue(omap2_mcspi_wq); > } > module_exit(omap2_mcspi_exit); > > -- > 1.7.1 > > > ------------------------------------------------------------------------------ > The demand for IT networking professionals continues to grow, and the > demand for specialized networking skills is growing even more rapidly. > Take a complimentary Learning@Cisco Self-Assessment and learn > about Cisco certifications, training, and career opportunities. > http://p.sf.net/sfu/cisco-dev2dev > _______________________________________________ > spi-devel-general mailing list > spi-devel-general@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/spi-devel-general ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/3] OMAP: SPI: call pm_runtime_disable in error path and remove 2011-10-28 11:44 [PATCH 0/3] OMAP: SPI: Driver updates Shubhrajyoti D 2011-10-28 11:44 ` [PATCH 1/3] OMAP: SPI: Use a workqueue per omap2_mcspi controller Shubhrajyoti D @ 2011-10-28 11:44 ` Shubhrajyoti D 2011-10-29 12:06 ` Grant Likely 2011-10-28 11:44 ` [PATCH 3/3] OMAP: SPI: Correct the error path Shubhrajyoti D 2 siblings, 1 reply; 8+ messages in thread From: Shubhrajyoti D @ 2011-10-28 11:44 UTC (permalink / raw) To: spi-devel-general; +Cc: linux-kernel, Shubhrajyoti D, Hebbar, Gururaja omap mcspi probe() doesnt call pm_runtime disable functions in case of failure. remove() doesnt call pm_runtime disable. This could lead to warnings as below on subsequent insmod. ~# insmod spi-omap2-mcspi.ko [ 255.383671] omap2_mcspi omap2_mcspi.1: Unbalanced pm_runtime_enable! ... This patch adds the pm_runtime disable() at appropriate stages. Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> --- drivers/spi/spi-omap2-mcspi.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 471b0f3..6875a0b 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -1195,6 +1195,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev) err4: spi_master_put(master); err3: + pm_runtime_disable(&pdev->dev); kfree(mcspi->dma_channels); err2: release_mem_region(r->start, resource_size(r)); @@ -1216,6 +1217,7 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev) dma_channels = mcspi->dma_channels; omap2_mcspi_disable_clocks(mcspi); + pm_runtime_disable(&pdev->dev); r = platform_get_resource(pdev, IORESOURCE_MEM, 0); release_mem_region(r->start, resource_size(r)); -- 1.7.1 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] OMAP: SPI: call pm_runtime_disable in error path and remove 2011-10-28 11:44 ` [PATCH 2/3] OMAP: SPI: call pm_runtime_disable in error path and remove Shubhrajyoti D @ 2011-10-29 12:06 ` Grant Likely 2011-10-31 5:16 ` Shubhrajyoti 0 siblings, 1 reply; 8+ messages in thread From: Grant Likely @ 2011-10-29 12:06 UTC (permalink / raw) To: Shubhrajyoti D; +Cc: spi-devel-general, Hebbar, Gururaja, linux-kernel On Fri, Oct 28, 2011 at 05:14:18PM +0530, Shubhrajyoti D wrote: > omap mcspi probe() doesnt call pm_runtime disable functions > in case of failure. remove() doesnt call pm_runtime disable. This could > lead to warnings as below on subsequent insmod. > > ~# insmod spi-omap2-mcspi.ko > [ 255.383671] omap2_mcspi omap2_mcspi.1: Unbalanced pm_runtime_enable! > ... > > This patch adds the pm_runtime disable() at appropriate stages. > > Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com> > Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Nitpick: please use the format "spi/<device>: ...." for the subject line of spi patches. It's just a consistency thing that I like. Picked up for v3.3, thanks. g. > --- > drivers/spi/spi-omap2-mcspi.c | 2 ++ > 1 files changed, 2 insertions(+), 0 deletions(-) > > diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c > index 471b0f3..6875a0b 100644 > --- a/drivers/spi/spi-omap2-mcspi.c > +++ b/drivers/spi/spi-omap2-mcspi.c > @@ -1195,6 +1195,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev) > err4: > spi_master_put(master); > err3: > + pm_runtime_disable(&pdev->dev); > kfree(mcspi->dma_channels); > err2: > release_mem_region(r->start, resource_size(r)); > @@ -1216,6 +1217,7 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev) > dma_channels = mcspi->dma_channels; > > omap2_mcspi_disable_clocks(mcspi); > + pm_runtime_disable(&pdev->dev); > r = platform_get_resource(pdev, IORESOURCE_MEM, 0); > release_mem_region(r->start, resource_size(r)); > > -- > 1.7.1 > > > ------------------------------------------------------------------------------ > The demand for IT networking professionals continues to grow, and the > demand for specialized networking skills is growing even more rapidly. > Take a complimentary Learning@Cisco Self-Assessment and learn > about Cisco certifications, training, and career opportunities. > http://p.sf.net/sfu/cisco-dev2dev > _______________________________________________ > spi-devel-general mailing list > spi-devel-general@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/spi-devel-general ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/3] OMAP: SPI: call pm_runtime_disable in error path and remove 2011-10-29 12:06 ` Grant Likely @ 2011-10-31 5:16 ` Shubhrajyoti 0 siblings, 0 replies; 8+ messages in thread From: Shubhrajyoti @ 2011-10-31 5:16 UTC (permalink / raw) To: Grant Likely; +Cc: spi-devel-general, Hebbar, Gururaja, linux-kernel On Saturday 29 October 2011 05:36 PM, Grant Likely wrote: > On Fri, Oct 28, 2011 at 05:14:18PM +0530, Shubhrajyoti D wrote: >> omap mcspi probe() doesnt call pm_runtime disable functions >> in case of failure. remove() doesnt call pm_runtime disable. This could >> lead to warnings as below on subsequent insmod. >> >> ~# insmod spi-omap2-mcspi.ko >> [ 255.383671] omap2_mcspi omap2_mcspi.1: Unbalanced pm_runtime_enable! >> ... >> >> This patch adds the pm_runtime disable() at appropriate stages. >> >> Signed-off-by: Hebbar, Gururaja<gururaja.hebbar@ti.com> >> Signed-off-by: Shubhrajyoti D<shubhrajyoti@ti.com> > Nitpick: please use the format "spi/<device>: ...." for the subject > line of spi patches. It's just a consistency thing that I like. Henceforth I will take care > Picked up for v3.3, thanks. > > g. > >> --- >> drivers/spi/spi-omap2-mcspi.c | 2 ++ >> 1 files changed, 2 insertions(+), 0 deletions(-) >> >> diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c >> index 471b0f3..6875a0b 100644 >> --- a/drivers/spi/spi-omap2-mcspi.c >> +++ b/drivers/spi/spi-omap2-mcspi.c >> @@ -1195,6 +1195,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev) >> err4: >> spi_master_put(master); >> err3: >> + pm_runtime_disable(&pdev->dev); >> kfree(mcspi->dma_channels); >> err2: >> release_mem_region(r->start, resource_size(r)); >> @@ -1216,6 +1217,7 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev) >> dma_channels = mcspi->dma_channels; >> >> omap2_mcspi_disable_clocks(mcspi); >> + pm_runtime_disable(&pdev->dev); >> r = platform_get_resource(pdev, IORESOURCE_MEM, 0); >> release_mem_region(r->start, resource_size(r)); >> >> -- >> 1.7.1 >> >> >> ------------------------------------------------------------------------------ >> The demand for IT networking professionals continues to grow, and the >> demand for specialized networking skills is growing even more rapidly. >> Take a complimentary Learning@Cisco Self-Assessment and learn >> about Cisco certifications, training, and career opportunities. >> http://p.sf.net/sfu/cisco-dev2dev >> _______________________________________________ >> spi-devel-general mailing list >> spi-devel-general@lists.sourceforge.net >> https://lists.sourceforge.net/lists/listinfo/spi-devel-general ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/3] OMAP: SPI: Correct the error path 2011-10-28 11:44 [PATCH 0/3] OMAP: SPI: Driver updates Shubhrajyoti D 2011-10-28 11:44 ` [PATCH 1/3] OMAP: SPI: Use a workqueue per omap2_mcspi controller Shubhrajyoti D 2011-10-28 11:44 ` [PATCH 2/3] OMAP: SPI: call pm_runtime_disable in error path and remove Shubhrajyoti D @ 2011-10-28 11:44 ` Shubhrajyoti D 2011-10-29 12:07 ` Grant Likely 2 siblings, 1 reply; 8+ messages in thread From: Shubhrajyoti D @ 2011-10-28 11:44 UTC (permalink / raw) To: spi-devel-general; +Cc: linux-kernel, Shubhrajyoti D, Hebbar, Gururaja Currently McSPI driver doesnt follow correct failure fallback steps attempting to correct the same. Also - label names changed to give meaningful names. - Setting the driver data to NULL in remove Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com> Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> --- drivers/spi/spi-omap2-mcspi.c | 32 ++++++++++++++++++++------------ 1 files changed, 20 insertions(+), 12 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 6875a0b..abe2fee 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -1115,13 +1115,13 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev) mcspi->wq = alloc_workqueue(wq_name, WQ_MEM_RECLAIM, 1); if (mcspi->wq == NULL) { status = -ENOMEM; - goto err1; + goto free_master; } r = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (r == NULL) { status = -ENODEV; - goto err1; + goto free_master; } r->start += pdata->regs_offset; r->end += pdata->regs_offset; @@ -1129,14 +1129,14 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev) if (!request_mem_region(r->start, resource_size(r), dev_name(&pdev->dev))) { status = -EBUSY; - goto err1; + goto free_master; } mcspi->base = ioremap(r->start, resource_size(r)); if (!mcspi->base) { dev_dbg(&pdev->dev, "can't ioremap MCSPI\n"); status = -ENOMEM; - goto err2; + goto release_region; } mcspi->dev = &pdev->dev; @@ -1151,7 +1151,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev) GFP_KERNEL); if (mcspi->dma_channels == NULL) - goto err2; + goto unmap_io; for (i = 0; i < master->num_chipselect; i++) { char dma_ch_name[14]; @@ -1181,26 +1181,33 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev) mcspi->dma_channels[i].dma_tx_sync_dev = dma_res->start; } + if (status < 0) + goto dma_chnl_free; + pm_runtime_enable(&pdev->dev); if (status || omap2_mcspi_master_setup(mcspi) < 0) - goto err3; + goto disable_pm; status = spi_register_master(master); if (status < 0) - goto err4; + goto err_spi_register; return status; -err4: +err_spi_register: spi_master_put(master); -err3: +disable_pm: pm_runtime_disable(&pdev->dev); +dma_chnl_free: kfree(mcspi->dma_channels); -err2: - release_mem_region(r->start, resource_size(r)); +unmap_io: iounmap(mcspi->base); -err1: +release_region: + release_mem_region(r->start, resource_size(r)); +free_master: + kfree(master); + platform_set_drvdata(pdev, NULL); return status; } @@ -1226,6 +1233,7 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev) iounmap(base); kfree(dma_channels); destroy_workqueue(mcspi->wq); + platform_set_drvdata(pdev, NULL); return 0; } -- 1.7.1 ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 3/3] OMAP: SPI: Correct the error path 2011-10-28 11:44 ` [PATCH 3/3] OMAP: SPI: Correct the error path Shubhrajyoti D @ 2011-10-29 12:07 ` Grant Likely 0 siblings, 0 replies; 8+ messages in thread From: Grant Likely @ 2011-10-29 12:07 UTC (permalink / raw) To: Shubhrajyoti D; +Cc: spi-devel-general, Hebbar, Gururaja, linux-kernel On Fri, Oct 28, 2011 at 05:14:19PM +0530, Shubhrajyoti D wrote: > Currently McSPI driver doesnt follow correct failure fallback steps > attempting to correct the same. > Also > - label names changed to give meaningful names. > - Setting the driver data to NULL in remove > > Signed-off-by: Hebbar, Gururaja <gururaja.hebbar@ti.com> > Signed-off-by: Shubhrajyoti D <shubhrajyoti@ti.com> Applied for v3.3, thanks. g. > --- > drivers/spi/spi-omap2-mcspi.c | 32 ++++++++++++++++++++------------ > 1 files changed, 20 insertions(+), 12 deletions(-) > > diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c > index 6875a0b..abe2fee 100644 > --- a/drivers/spi/spi-omap2-mcspi.c > +++ b/drivers/spi/spi-omap2-mcspi.c > @@ -1115,13 +1115,13 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev) > mcspi->wq = alloc_workqueue(wq_name, WQ_MEM_RECLAIM, 1); > if (mcspi->wq == NULL) { > status = -ENOMEM; > - goto err1; > + goto free_master; > } > > r = platform_get_resource(pdev, IORESOURCE_MEM, 0); > if (r == NULL) { > status = -ENODEV; > - goto err1; > + goto free_master; > } > r->start += pdata->regs_offset; > r->end += pdata->regs_offset; > @@ -1129,14 +1129,14 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev) > if (!request_mem_region(r->start, resource_size(r), > dev_name(&pdev->dev))) { > status = -EBUSY; > - goto err1; > + goto free_master; > } > > mcspi->base = ioremap(r->start, resource_size(r)); > if (!mcspi->base) { > dev_dbg(&pdev->dev, "can't ioremap MCSPI\n"); > status = -ENOMEM; > - goto err2; > + goto release_region; > } > > mcspi->dev = &pdev->dev; > @@ -1151,7 +1151,7 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev) > GFP_KERNEL); > > if (mcspi->dma_channels == NULL) > - goto err2; > + goto unmap_io; > > for (i = 0; i < master->num_chipselect; i++) { > char dma_ch_name[14]; > @@ -1181,26 +1181,33 @@ static int __init omap2_mcspi_probe(struct platform_device *pdev) > mcspi->dma_channels[i].dma_tx_sync_dev = dma_res->start; > } > > + if (status < 0) > + goto dma_chnl_free; > + > pm_runtime_enable(&pdev->dev); > > if (status || omap2_mcspi_master_setup(mcspi) < 0) > - goto err3; > + goto disable_pm; > > status = spi_register_master(master); > if (status < 0) > - goto err4; > + goto err_spi_register; > > return status; > > -err4: > +err_spi_register: > spi_master_put(master); > -err3: > +disable_pm: > pm_runtime_disable(&pdev->dev); > +dma_chnl_free: > kfree(mcspi->dma_channels); > -err2: > - release_mem_region(r->start, resource_size(r)); > +unmap_io: > iounmap(mcspi->base); > -err1: > +release_region: > + release_mem_region(r->start, resource_size(r)); > +free_master: > + kfree(master); > + platform_set_drvdata(pdev, NULL); > return status; > } > > @@ -1226,6 +1233,7 @@ static int __exit omap2_mcspi_remove(struct platform_device *pdev) > iounmap(base); > kfree(dma_channels); > destroy_workqueue(mcspi->wq); > + platform_set_drvdata(pdev, NULL); > > return 0; > } > -- > 1.7.1 > > > ------------------------------------------------------------------------------ > The demand for IT networking professionals continues to grow, and the > demand for specialized networking skills is growing even more rapidly. > Take a complimentary Learning@Cisco Self-Assessment and learn > about Cisco certifications, training, and career opportunities. > http://p.sf.net/sfu/cisco-dev2dev > _______________________________________________ > spi-devel-general mailing list > spi-devel-general@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/spi-devel-general ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2011-10-31 5:16 UTC | newest] Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2011-10-28 11:44 [PATCH 0/3] OMAP: SPI: Driver updates Shubhrajyoti D 2011-10-28 11:44 ` [PATCH 1/3] OMAP: SPI: Use a workqueue per omap2_mcspi controller Shubhrajyoti D 2011-10-29 12:03 ` Grant Likely 2011-10-28 11:44 ` [PATCH 2/3] OMAP: SPI: call pm_runtime_disable in error path and remove Shubhrajyoti D 2011-10-29 12:06 ` Grant Likely 2011-10-31 5:16 ` Shubhrajyoti 2011-10-28 11:44 ` [PATCH 3/3] OMAP: SPI: Correct the error path Shubhrajyoti D 2011-10-29 12:07 ` Grant Likely
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
Powered by JetHome