linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] misc: mic: Introduce the managed version of ioremap
@ 2014-06-01 18:54 Himangi Saraogi
  2014-06-02 16:30 ` Sudeep Dutt
  0 siblings, 1 reply; 2+ messages in thread
From: Himangi Saraogi @ 2014-06-01 18:54 UTC (permalink / raw)
  To: Ashutosh Dixit, Dasaratharaman Chandramouli, Sudeep Dutt, linux-kernel
  Cc: julia.lawall

This patch moves data allocated using ioremap to managed data allocated
using devm_ioremap and cleans now unnecessary iounmaps in probe and remove
functions. Also the unnecessary label iounmap is done away with.

Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
---
I wonder if mic_card_map and mic_card_unmap can be used on the same data
as the devm_ioremap in the probe function. If yes, can I devmify them as well,
in which case mic_card_unmap will not be required.

 drivers/misc/mic/card/mic_x100.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/misc/mic/card/mic_x100.c b/drivers/misc/mic/card/mic_x100.c
index 2868945..5f26b17 100644
--- a/drivers/misc/mic/card/mic_x100.c
+++ b/drivers/misc/mic/card/mic_x100.c
@@ -159,7 +159,8 @@ static int __init mic_probe(struct platform_device *pdev)
 
 	mdev->mmio.pa = MIC_X100_MMIO_BASE;
 	mdev->mmio.len = MIC_X100_MMIO_LEN;
-	mdev->mmio.va = ioremap(MIC_X100_MMIO_BASE, MIC_X100_MMIO_LEN);
+	mdev->mmio.va = devm_ioremap(&pdev->dev, MIC_X100_MMIO_BASE,
+				     MIC_X100_MMIO_LEN);
 	if (!mdev->mmio.va) {
 		dev_err(&pdev->dev, "Cannot remap MMIO BAR\n");
 		rc = -EIO;
@@ -169,22 +170,17 @@ static int __init mic_probe(struct platform_device *pdev)
 	rc = mic_driver_init(mdrv);
 	if (rc) {
 		dev_err(&pdev->dev, "mic_driver_init failed rc %d\n", rc);
-		goto iounmap;
+		goto done;
 	}
 done:
 	return rc;
-iounmap:
-	iounmap(mdev->mmio.va);
-	return rc;
 }
 
 static int mic_remove(struct platform_device *pdev)
 {
 	struct mic_driver *mdrv = &g_drv;
-	struct mic_device *mdev = &mdrv->mdev;
 
 	mic_driver_uninit(mdrv);
-	iounmap(mdev->mmio.va);
 	return 0;
 }
 
-- 
1.9.1


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

* Re: [PATCH] misc: mic: Introduce the managed version of ioremap
  2014-06-01 18:54 [PATCH] misc: mic: Introduce the managed version of ioremap Himangi Saraogi
@ 2014-06-02 16:30 ` Sudeep Dutt
  0 siblings, 0 replies; 2+ messages in thread
From: Sudeep Dutt @ 2014-06-02 16:30 UTC (permalink / raw)
  To: Himangi Saraogi
  Cc: sudeep.dutt, Ashutosh Dixit, Dasaratharaman Chandramouli,
	Nikhil Rao, linux-kernel, julia.lawall

On Mon, 2014-06-02 at 00:24 +0530, Himangi Saraogi wrote:
> This patch moves data allocated using ioremap to managed data allocated
> using devm_ioremap and cleans now unnecessary iounmaps in probe and remove
> functions. Also the unnecessary label iounmap is done away with.
> 
> Signed-off-by: Himangi Saraogi <himangi774@gmail.com>
> ---
> I wonder if mic_card_map and mic_card_unmap can be used on the same data
> as the devm_ioremap in the probe function. If yes, can I devmify them as well,
> in which case mic_card_unmap will not be required.
> 

Hi Himangi,

Thanks for the patch which I have tested on MIC and it works fine.
mic_card_map(..) and mic_card_unmap(..) can be called multiple times
while the driver is loaded so it would be best to leave those APIs
unchanged or modify them to use devm_ioremap(..) and devm_iounmap(..)
instead.

This patch does create conflicts with a MIC DMA patch series under
review @ https://lkml.org/lkml/2014/5/29/981 I will send your patch to
Greg K-H for inclusion in char-misc-next once the larger patch is
accepted so that there are no conflicts.

Thanks,
Sudeep Dutt

>  drivers/misc/mic/card/mic_x100.c | 10 +++-------
>  1 file changed, 3 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/misc/mic/card/mic_x100.c b/drivers/misc/mic/card/mic_x100.c
> index 2868945..5f26b17 100644
> --- a/drivers/misc/mic/card/mic_x100.c
> +++ b/drivers/misc/mic/card/mic_x100.c
> @@ -159,7 +159,8 @@ static int __init mic_probe(struct platform_device *pdev)
>  
>  	mdev->mmio.pa = MIC_X100_MMIO_BASE;
>  	mdev->mmio.len = MIC_X100_MMIO_LEN;
> -	mdev->mmio.va = ioremap(MIC_X100_MMIO_BASE, MIC_X100_MMIO_LEN);
> +	mdev->mmio.va = devm_ioremap(&pdev->dev, MIC_X100_MMIO_BASE,
> +				     MIC_X100_MMIO_LEN);
>  	if (!mdev->mmio.va) {
>  		dev_err(&pdev->dev, "Cannot remap MMIO BAR\n");
>  		rc = -EIO;
> @@ -169,22 +170,17 @@ static int __init mic_probe(struct platform_device *pdev)
>  	rc = mic_driver_init(mdrv);
>  	if (rc) {
>  		dev_err(&pdev->dev, "mic_driver_init failed rc %d\n", rc);
> -		goto iounmap;
> +		goto done;
>  	}
>  done:
>  	return rc;
> -iounmap:
> -	iounmap(mdev->mmio.va);
> -	return rc;
>  }
>  
>  static int mic_remove(struct platform_device *pdev)
>  {
>  	struct mic_driver *mdrv = &g_drv;
> -	struct mic_device *mdev = &mdrv->mdev;
>  
>  	mic_driver_uninit(mdrv);
> -	iounmap(mdev->mmio.va);
>  	return 0;
>  }
>  



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

end of thread, other threads:[~2014-06-02 16:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-01 18:54 [PATCH] misc: mic: Introduce the managed version of ioremap Himangi Saraogi
2014-06-02 16:30 ` Sudeep Dutt

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).