* [PATCH 0/3] SPI updates @ 2012-03-20 10:29 Shubhrajyoti D [not found] ` <1332239389-1897-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org> 2012-03-20 16:20 ` [PATCH 0/3] SPI updates Grant Likely 0 siblings, 2 replies; 6+ messages in thread From: Shubhrajyoti D @ 2012-03-20 10:29 UTC (permalink / raw) To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f Cc: Shubhrajyoti, linux-omap-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, D The patch series does the following cleanups - Converts the spi to module_platform_driver - Use the devm functions so that the freeing need not be done in the driver. This is also available through git : git://gitorious.org/linus-tree/linus-tree.git branch : spi Felipe Balbi (2): spi: omap2-mcspi: make it behave as a module spi: omap2-mcspi: convert to module_platform_driver Shubhrajyoti D (1): spi: omap2-mcspi: use devm_* functions drivers/spi/spi-omap2-mcspi.c | 46 ++++++++--------------------------------- 1 files changed, 9 insertions(+), 37 deletions(-) ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure ^ permalink raw reply [flat|nested] 6+ messages in thread
[parent not found: <1332239389-1897-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org>]
* [PATCH 1/3] spi: omap2-mcspi: make it behave as a module [not found] ` <1332239389-1897-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org> @ 2012-03-20 10:29 ` Shubhrajyoti D 2012-03-20 10:29 ` [PATCH 2/3] spi: omap2-mcspi: convert to module_platform_driver Shubhrajyoti D 2012-03-20 10:29 ` [PATCH 3/3] spi: omap2-mcspi: use devm_* functions Shubhrajyoti D 2 siblings, 0 replies; 6+ messages in thread From: Shubhrajyoti D @ 2012-03-20 10:29 UTC (permalink / raw) To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Felipe Balbi, Shubhrajyoti D From: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org> move probe away from __init section and use platform_driver_register() instead of platform_driver_probe(). Signed-off-by: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org> Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org> --- drivers/spi/spi-omap2-mcspi.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 0b0dfb7..5f4419e 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -1080,7 +1080,7 @@ static int omap_mcspi_runtime_resume(struct device *dev) } -static int __init omap2_mcspi_probe(struct platform_device *pdev) +static int __devinit omap2_mcspi_probe(struct platform_device *pdev) { struct spi_master *master; struct omap2_mcspi_platform_config *pdata = pdev->dev.platform_data; @@ -1212,7 +1212,7 @@ free_master: return status; } -static int __exit omap2_mcspi_remove(struct platform_device *pdev) +static int __devexit omap2_mcspi_remove(struct platform_device *pdev) { struct spi_master *master; struct omap2_mcspi *mcspi; @@ -1287,13 +1287,14 @@ static struct platform_driver omap2_mcspi_driver = { .owner = THIS_MODULE, .pm = &omap2_mcspi_pm_ops }, - .remove = __exit_p(omap2_mcspi_remove), + .probe = omap2_mcspi_probe, + .remove = __devexit_p(omap2_mcspi_remove), }; static int __init omap2_mcspi_init(void) { - return platform_driver_probe(&omap2_mcspi_driver, omap2_mcspi_probe); + return platform_driver_register(&omap2_mcspi_driver); } subsys_initcall(omap2_mcspi_init); -- 1.7.1 ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 2/3] spi: omap2-mcspi: convert to module_platform_driver [not found] ` <1332239389-1897-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org> 2012-03-20 10:29 ` [PATCH 1/3] spi: omap2-mcspi: make it behave as a module Shubhrajyoti D @ 2012-03-20 10:29 ` Shubhrajyoti D 2012-03-20 10:29 ` [PATCH 3/3] spi: omap2-mcspi: use devm_* functions Shubhrajyoti D 2 siblings, 0 replies; 6+ messages in thread From: Shubhrajyoti D @ 2012-03-20 10:29 UTC (permalink / raw) To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f Cc: linux-omap-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Felipe Balbi, Shubhrajyoti D From: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org> this will delete a few lines of code, no functional changes. Signed-off-by: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org> Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org> --- drivers/spi/spi-omap2-mcspi.c | 15 +-------------- 1 files changed, 1 insertions(+), 14 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 5f4419e..7745f91 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -1291,18 +1291,5 @@ static struct platform_driver omap2_mcspi_driver = { .remove = __devexit_p(omap2_mcspi_remove), }; - -static int __init omap2_mcspi_init(void) -{ - return platform_driver_register(&omap2_mcspi_driver); -} -subsys_initcall(omap2_mcspi_init); - -static void __exit omap2_mcspi_exit(void) -{ - platform_driver_unregister(&omap2_mcspi_driver); - -} -module_exit(omap2_mcspi_exit); - +module_platform_driver(omap2_mcspi_driver); MODULE_LICENSE("GPL"); -- 1.7.1 ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure ^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH 3/3] spi: omap2-mcspi: use devm_* functions [not found] ` <1332239389-1897-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org> 2012-03-20 10:29 ` [PATCH 1/3] spi: omap2-mcspi: make it behave as a module Shubhrajyoti D 2012-03-20 10:29 ` [PATCH 2/3] spi: omap2-mcspi: convert to module_platform_driver Shubhrajyoti D @ 2012-03-20 10:29 ` Shubhrajyoti D 2 siblings, 0 replies; 6+ messages in thread From: Shubhrajyoti D @ 2012-03-20 10:29 UTC (permalink / raw) To: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f Cc: Shubhrajyoti, linux-omap-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Felipe Balbi, D The various devm_* functions allocate memory that is released when a driver detaches. This patch uses devm_request_and_ioremap to request memory in probe function. Since the freeing is not needed the calls are deleted from remove function.Also use use devm_kzalloc for the cs memory allocation. Signed-off-by: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org> Signed-off-by: Shubhrajyoti D <shubhrajyoti-l0cyMroinI0@public.gmane.org> --- drivers/spi/spi-omap2-mcspi.c | 24 ++++-------------------- 1 files changed, 4 insertions(+), 20 deletions(-) diff --git a/drivers/spi/spi-omap2-mcspi.c b/drivers/spi/spi-omap2-mcspi.c index 7745f91..cb2c0e3 100644 --- a/drivers/spi/spi-omap2-mcspi.c +++ b/drivers/spi/spi-omap2-mcspi.c @@ -789,7 +789,7 @@ static int omap2_mcspi_setup(struct spi_device *spi) mcspi_dma = &mcspi->dma_channels[spi->chip_select]; if (!cs) { - cs = kzalloc(sizeof *cs, GFP_KERNEL); + cs = devm_kzalloc(&spi->dev , sizeof *cs, GFP_KERNEL); if (!cs) return -ENOMEM; cs->base = mcspi->base + spi->chip_select * 0x14; @@ -831,7 +831,6 @@ static void omap2_mcspi_cleanup(struct spi_device *spi) cs = spi->controller_state; list_del(&cs->node); - kfree(spi->controller_state); } if (spi->chip_select < spi->master->num_chipselect) { @@ -1127,17 +1126,12 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev) r->start += pdata->regs_offset; r->end += pdata->regs_offset; mcspi->phys = r->start; - if (!request_mem_region(r->start, resource_size(r), - dev_name(&pdev->dev))) { - status = -EBUSY; - goto free_master; - } - mcspi->base = ioremap(r->start, resource_size(r)); + mcspi->base = devm_request_and_ioremap(&pdev->dev, r); if (!mcspi->base) { dev_dbg(&pdev->dev, "can't ioremap MCSPI\n"); status = -ENOMEM; - goto release_region; + goto free_master; } mcspi->dev = &pdev->dev; @@ -1152,7 +1146,7 @@ static int __devinit omap2_mcspi_probe(struct platform_device *pdev) GFP_KERNEL); if (mcspi->dma_channels == NULL) - goto unmap_io; + goto free_master; for (i = 0; i < master->num_chipselect; i++) { char dma_ch_name[14]; @@ -1202,10 +1196,6 @@ disable_pm: pm_runtime_disable(&pdev->dev); dma_chnl_free: kfree(mcspi->dma_channels); -unmap_io: - iounmap(mcspi->base); -release_region: - release_mem_region(r->start, resource_size(r)); free_master: kfree(master); platform_set_drvdata(pdev, NULL); @@ -1217,8 +1207,6 @@ static int __devexit omap2_mcspi_remove(struct platform_device *pdev) struct spi_master *master; struct omap2_mcspi *mcspi; struct omap2_mcspi_dma *dma_channels; - struct resource *r; - void __iomem *base; master = dev_get_drvdata(&pdev->dev); mcspi = spi_master_get_devdata(master); @@ -1226,12 +1214,8 @@ static int __devexit omap2_mcspi_remove(struct platform_device *pdev) 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)); - base = mcspi->base; spi_unregister_master(master); - iounmap(base); kfree(dma_channels); destroy_workqueue(mcspi->wq); platform_set_drvdata(pdev, NULL); -- 1.7.1 ------------------------------------------------------------------------------ This SF email is sponsosred by: Try Windows Azure free for 90 days Click Here http://p.sf.net/sfu/sfd2d-msazure ^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] SPI updates 2012-03-20 10:29 [PATCH 0/3] SPI updates Shubhrajyoti D [not found] ` <1332239389-1897-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org> @ 2012-03-20 16:20 ` Grant Likely 2012-03-20 16:42 ` Shubhrajyoti 1 sibling, 1 reply; 6+ messages in thread From: Grant Likely @ 2012-03-20 16:20 UTC (permalink / raw) To: Shubhrajyoti D, spi-devel-general Cc: Shubhrajyoti, linux-omap, linux-kernel, D On Tue, 20 Mar 2012 15:59:46 +0530, Shubhrajyoti D <shubhrajyoti@ti.com> wrote: > The patch series does the following cleanups > - Converts the spi to module_platform_driver > - Use the devm functions so that the freeing need not > be done in the driver. > > This is also available through > git : git://gitorious.org/linus-tree/linus-tree.git > branch : spi > > > Felipe Balbi (2): > spi: omap2-mcspi: make it behave as a module > spi: omap2-mcspi: convert to module_platform_driver > > Shubhrajyoti D (1): > spi: omap2-mcspi: use devm_* functions > > drivers/spi/spi-omap2-mcspi.c | 46 ++++++++--------------------------------- > 1 files changed, 9 insertions(+), 37 deletions(-) Merged for v3.5 (it's too late for v3.4) g. ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 0/3] SPI updates 2012-03-20 16:20 ` [PATCH 0/3] SPI updates Grant Likely @ 2012-03-20 16:42 ` Shubhrajyoti 0 siblings, 0 replies; 6+ messages in thread From: Shubhrajyoti @ 2012-03-20 16:42 UTC (permalink / raw) To: Grant Likely; +Cc: spi-devel-general, Shubhrajyoti, linux-omap, linux-kernel On Tuesday 20 March 2012 09:50 PM, Grant Likely wrote: > On Tue, 20 Mar 2012 15:59:46 +0530, Shubhrajyoti D <shubhrajyoti@ti.com> wrote: >> The patch series does the following cleanups >> - Converts the spi to module_platform_driver >> - Use the devm functions so that the freeing need not >> be done in the driver. >> >> This is also available through >> git : git://gitorious.org/linus-tree/linus-tree.git >> branch : spi >> >> >> Felipe Balbi (2): >> spi: omap2-mcspi: make it behave as a module >> spi: omap2-mcspi: convert to module_platform_driver >> >> Shubhrajyoti D (1): >> spi: omap2-mcspi: use devm_* functions >> >> drivers/spi/spi-omap2-mcspi.c | 46 ++++++++--------------------------------- >> 1 files changed, 9 insertions(+), 37 deletions(-) > Merged for v3.5 (it's too late for v3.4) > > g. Thanks Grant. ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-03-20 16:42 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2012-03-20 10:29 [PATCH 0/3] SPI updates Shubhrajyoti D [not found] ` <1332239389-1897-1-git-send-email-shubhrajyoti-l0cyMroinI0@public.gmane.org> 2012-03-20 10:29 ` [PATCH 1/3] spi: omap2-mcspi: make it behave as a module Shubhrajyoti D 2012-03-20 10:29 ` [PATCH 2/3] spi: omap2-mcspi: convert to module_platform_driver Shubhrajyoti D 2012-03-20 10:29 ` [PATCH 3/3] spi: omap2-mcspi: use devm_* functions Shubhrajyoti D 2012-03-20 16:20 ` [PATCH 0/3] SPI updates Grant Likely 2012-03-20 16:42 ` Shubhrajyoti
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).