Re: [PATCH v1 08/16] rtc: mediatek: remove unnecessary irq_dispose_mapping

2018-03-25 Thread Sean Wang
On Fri, 2018-03-23 at 11:38 +0100, Alexandre Belloni wrote:
> On 23/03/2018 at 17:15:05 +0800, sean.w...@mediatek.com wrote:
> > From: Sean Wang 
> > 
> > It's unnecessary doing irq_dispose_mapping as a reverse operation for
> > platform_get_irq.
> > 
> > Ususally, irq_dispose_mapping should be called in error path or module
> > removal to release the resources for irq_of_parse_and_map requested.
> > 
> > Signed-off-by: Sean Wang 
> > ---
> >  drivers/rtc/rtc-mt6397.c | 7 ++-
> >  1 file changed, 2 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
> > index b62eaa8..cefb83b 100644
> > --- a/drivers/rtc/rtc-mt6397.c
> > +++ b/drivers/rtc/rtc-mt6397.c
> > @@ -17,7 +17,6 @@
> >  #include 
> >  #include 
> >  #include 
> > -#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -336,7 +335,7 @@ static int mtk_rtc_probe(struct platform_device *pdev)
> > if (ret) {
> > dev_err(>dev, "Failed to request alarm IRQ: %d: %d\n",
> > rtc->irq, ret);
> > -   goto out_dispose_irq;
> > +   return ret;
> > }
> >  
> > device_init_wakeup(>dev, 1);
> > @@ -353,8 +352,7 @@ static int mtk_rtc_probe(struct platform_device *pdev)
> >  
> >  out_free_irq:
> > free_irq(rtc->irq, rtc->rtc_dev);
> > -out_dispose_irq:
> > -   irq_dispose_mapping(rtc->irq);
> > +
> 
> Don't you still have a irq_create_mapping?
> 

Sorry for that I didn't mention in the beginning that the series must
depend on another patch [1]. With the patch, the job irq_create_mapping
had been moved from rtc to mfd, so here it should be better to cleanup
up irq_dispose_mapping in all paths.

[1] https://patchwork.kernel.org/patch/9954643/

> > return ret;
> >  }
> >  
> > @@ -364,7 +362,6 @@ static int mtk_rtc_remove(struct platform_device *pdev)
> >  
> > rtc_device_unregister(rtc->rtc_dev);
> > free_irq(rtc->irq, rtc->rtc_dev);
> > -   irq_dispose_mapping(rtc->irq);
> >  
> > return 0;
> >  }
> > -- 
> > 2.7.4
> > 
> 




Re: [PATCH v1 08/16] rtc: mediatek: remove unnecessary irq_dispose_mapping

2018-03-25 Thread Sean Wang
On Fri, 2018-03-23 at 11:38 +0100, Alexandre Belloni wrote:
> On 23/03/2018 at 17:15:05 +0800, sean.w...@mediatek.com wrote:
> > From: Sean Wang 
> > 
> > It's unnecessary doing irq_dispose_mapping as a reverse operation for
> > platform_get_irq.
> > 
> > Ususally, irq_dispose_mapping should be called in error path or module
> > removal to release the resources for irq_of_parse_and_map requested.
> > 
> > Signed-off-by: Sean Wang 
> > ---
> >  drivers/rtc/rtc-mt6397.c | 7 ++-
> >  1 file changed, 2 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
> > index b62eaa8..cefb83b 100644
> > --- a/drivers/rtc/rtc-mt6397.c
> > +++ b/drivers/rtc/rtc-mt6397.c
> > @@ -17,7 +17,6 @@
> >  #include 
> >  #include 
> >  #include 
> > -#include 
> >  #include 
> >  #include 
> >  #include 
> > @@ -336,7 +335,7 @@ static int mtk_rtc_probe(struct platform_device *pdev)
> > if (ret) {
> > dev_err(>dev, "Failed to request alarm IRQ: %d: %d\n",
> > rtc->irq, ret);
> > -   goto out_dispose_irq;
> > +   return ret;
> > }
> >  
> > device_init_wakeup(>dev, 1);
> > @@ -353,8 +352,7 @@ static int mtk_rtc_probe(struct platform_device *pdev)
> >  
> >  out_free_irq:
> > free_irq(rtc->irq, rtc->rtc_dev);
> > -out_dispose_irq:
> > -   irq_dispose_mapping(rtc->irq);
> > +
> 
> Don't you still have a irq_create_mapping?
> 

Sorry for that I didn't mention in the beginning that the series must
depend on another patch [1]. With the patch, the job irq_create_mapping
had been moved from rtc to mfd, so here it should be better to cleanup
up irq_dispose_mapping in all paths.

[1] https://patchwork.kernel.org/patch/9954643/

> > return ret;
> >  }
> >  
> > @@ -364,7 +362,6 @@ static int mtk_rtc_remove(struct platform_device *pdev)
> >  
> > rtc_device_unregister(rtc->rtc_dev);
> > free_irq(rtc->irq, rtc->rtc_dev);
> > -   irq_dispose_mapping(rtc->irq);
> >  
> > return 0;
> >  }
> > -- 
> > 2.7.4
> > 
> 




Re: [PATCH v1 08/16] rtc: mediatek: remove unnecessary irq_dispose_mapping

2018-03-23 Thread Alexandre Belloni
On 23/03/2018 at 17:15:05 +0800, sean.w...@mediatek.com wrote:
> From: Sean Wang 
> 
> It's unnecessary doing irq_dispose_mapping as a reverse operation for
> platform_get_irq.
> 
> Ususally, irq_dispose_mapping should be called in error path or module
> removal to release the resources for irq_of_parse_and_map requested.
> 
> Signed-off-by: Sean Wang 
> ---
>  drivers/rtc/rtc-mt6397.c | 7 ++-
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
> index b62eaa8..cefb83b 100644
> --- a/drivers/rtc/rtc-mt6397.c
> +++ b/drivers/rtc/rtc-mt6397.c
> @@ -17,7 +17,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -336,7 +335,7 @@ static int mtk_rtc_probe(struct platform_device *pdev)
>   if (ret) {
>   dev_err(>dev, "Failed to request alarm IRQ: %d: %d\n",
>   rtc->irq, ret);
> - goto out_dispose_irq;
> + return ret;
>   }
>  
>   device_init_wakeup(>dev, 1);
> @@ -353,8 +352,7 @@ static int mtk_rtc_probe(struct platform_device *pdev)
>  
>  out_free_irq:
>   free_irq(rtc->irq, rtc->rtc_dev);
> -out_dispose_irq:
> - irq_dispose_mapping(rtc->irq);
> +

Don't you still have a irq_create_mapping?

>   return ret;
>  }
>  
> @@ -364,7 +362,6 @@ static int mtk_rtc_remove(struct platform_device *pdev)
>  
>   rtc_device_unregister(rtc->rtc_dev);
>   free_irq(rtc->irq, rtc->rtc_dev);
> - irq_dispose_mapping(rtc->irq);
>  
>   return 0;
>  }
> -- 
> 2.7.4
> 

-- 
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com


Re: [PATCH v1 08/16] rtc: mediatek: remove unnecessary irq_dispose_mapping

2018-03-23 Thread Alexandre Belloni
On 23/03/2018 at 17:15:05 +0800, sean.w...@mediatek.com wrote:
> From: Sean Wang 
> 
> It's unnecessary doing irq_dispose_mapping as a reverse operation for
> platform_get_irq.
> 
> Ususally, irq_dispose_mapping should be called in error path or module
> removal to release the resources for irq_of_parse_and_map requested.
> 
> Signed-off-by: Sean Wang 
> ---
>  drivers/rtc/rtc-mt6397.c | 7 ++-
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
> index b62eaa8..cefb83b 100644
> --- a/drivers/rtc/rtc-mt6397.c
> +++ b/drivers/rtc/rtc-mt6397.c
> @@ -17,7 +17,6 @@
>  #include 
>  #include 
>  #include 
> -#include 
>  #include 
>  #include 
>  #include 
> @@ -336,7 +335,7 @@ static int mtk_rtc_probe(struct platform_device *pdev)
>   if (ret) {
>   dev_err(>dev, "Failed to request alarm IRQ: %d: %d\n",
>   rtc->irq, ret);
> - goto out_dispose_irq;
> + return ret;
>   }
>  
>   device_init_wakeup(>dev, 1);
> @@ -353,8 +352,7 @@ static int mtk_rtc_probe(struct platform_device *pdev)
>  
>  out_free_irq:
>   free_irq(rtc->irq, rtc->rtc_dev);
> -out_dispose_irq:
> - irq_dispose_mapping(rtc->irq);
> +

Don't you still have a irq_create_mapping?

>   return ret;
>  }
>  
> @@ -364,7 +362,6 @@ static int mtk_rtc_remove(struct platform_device *pdev)
>  
>   rtc_device_unregister(rtc->rtc_dev);
>   free_irq(rtc->irq, rtc->rtc_dev);
> - irq_dispose_mapping(rtc->irq);
>  
>   return 0;
>  }
> -- 
> 2.7.4
> 

-- 
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com


[PATCH v1 08/16] rtc: mediatek: remove unnecessary irq_dispose_mapping

2018-03-23 Thread sean.wang
From: Sean Wang 

It's unnecessary doing irq_dispose_mapping as a reverse operation for
platform_get_irq.

Ususally, irq_dispose_mapping should be called in error path or module
removal to release the resources for irq_of_parse_and_map requested.

Signed-off-by: Sean Wang 
---
 drivers/rtc/rtc-mt6397.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
index b62eaa8..cefb83b 100644
--- a/drivers/rtc/rtc-mt6397.c
+++ b/drivers/rtc/rtc-mt6397.c
@@ -17,7 +17,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -336,7 +335,7 @@ static int mtk_rtc_probe(struct platform_device *pdev)
if (ret) {
dev_err(>dev, "Failed to request alarm IRQ: %d: %d\n",
rtc->irq, ret);
-   goto out_dispose_irq;
+   return ret;
}
 
device_init_wakeup(>dev, 1);
@@ -353,8 +352,7 @@ static int mtk_rtc_probe(struct platform_device *pdev)
 
 out_free_irq:
free_irq(rtc->irq, rtc->rtc_dev);
-out_dispose_irq:
-   irq_dispose_mapping(rtc->irq);
+
return ret;
 }
 
@@ -364,7 +362,6 @@ static int mtk_rtc_remove(struct platform_device *pdev)
 
rtc_device_unregister(rtc->rtc_dev);
free_irq(rtc->irq, rtc->rtc_dev);
-   irq_dispose_mapping(rtc->irq);
 
return 0;
 }
-- 
2.7.4



[PATCH v1 08/16] rtc: mediatek: remove unnecessary irq_dispose_mapping

2018-03-23 Thread sean.wang
From: Sean Wang 

It's unnecessary doing irq_dispose_mapping as a reverse operation for
platform_get_irq.

Ususally, irq_dispose_mapping should be called in error path or module
removal to release the resources for irq_of_parse_and_map requested.

Signed-off-by: Sean Wang 
---
 drivers/rtc/rtc-mt6397.c | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-mt6397.c b/drivers/rtc/rtc-mt6397.c
index b62eaa8..cefb83b 100644
--- a/drivers/rtc/rtc-mt6397.c
+++ b/drivers/rtc/rtc-mt6397.c
@@ -17,7 +17,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -336,7 +335,7 @@ static int mtk_rtc_probe(struct platform_device *pdev)
if (ret) {
dev_err(>dev, "Failed to request alarm IRQ: %d: %d\n",
rtc->irq, ret);
-   goto out_dispose_irq;
+   return ret;
}
 
device_init_wakeup(>dev, 1);
@@ -353,8 +352,7 @@ static int mtk_rtc_probe(struct platform_device *pdev)
 
 out_free_irq:
free_irq(rtc->irq, rtc->rtc_dev);
-out_dispose_irq:
-   irq_dispose_mapping(rtc->irq);
+
return ret;
 }
 
@@ -364,7 +362,6 @@ static int mtk_rtc_remove(struct platform_device *pdev)
 
rtc_device_unregister(rtc->rtc_dev);
free_irq(rtc->irq, rtc->rtc_dev);
-   irq_dispose_mapping(rtc->irq);
 
return 0;
 }
-- 
2.7.4