linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] clk: at91: utmi: use pmc_read when the at91_pmc is available
@ 2015-09-11 14:34 Alexandre Belloni
  2015-09-11 14:34 ` [PATCH 2/2] clk: at91: system: don't try to free_irq when there is no IRQ Alexandre Belloni
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Alexandre Belloni @ 2015-09-11 14:34 UTC (permalink / raw)
  To: linux-arm-kernel

at91_pmc_read is a workaround to allow external drivers to acces some
registers of the PMC. There is no need for it in clk-utmi.c as we aready
have a pointer to the struct at91_pmc.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 drivers/clk/at91/clk-utmi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/clk/at91/clk-utmi.c b/drivers/clk/at91/clk-utmi.c
index 30dd697b1668..ca561e90a60f 100644
--- a/drivers/clk/at91/clk-utmi.c
+++ b/drivers/clk/at91/clk-utmi.c
@@ -47,7 +47,7 @@ static int clk_utmi_prepare(struct clk_hw *hw)
 {
 	struct clk_utmi *utmi = to_clk_utmi(hw);
 	struct at91_pmc *pmc = utmi->pmc;
-	u32 tmp = at91_pmc_read(AT91_CKGR_UCKR) | AT91_PMC_UPLLEN |
+	u32 tmp = pmc_read(pmc, AT91_CKGR_UCKR) | AT91_PMC_UPLLEN |
 		  AT91_PMC_UPLLCOUNT | AT91_PMC_BIASEN;
 
 	pmc_write(pmc, AT91_CKGR_UCKR, tmp);
@@ -73,7 +73,7 @@ static void clk_utmi_unprepare(struct clk_hw *hw)
 {
 	struct clk_utmi *utmi = to_clk_utmi(hw);
 	struct at91_pmc *pmc = utmi->pmc;
-	u32 tmp = at91_pmc_read(AT91_CKGR_UCKR) & ~AT91_PMC_UPLLEN;
+	u32 tmp = pmc_read(pmc, AT91_CKGR_UCKR) & ~AT91_PMC_UPLLEN;
 
 	pmc_write(pmc, AT91_CKGR_UCKR, tmp);
 }
-- 
2.1.4

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

* [PATCH 2/2] clk: at91: system: don't try to free_irq when there is no IRQ
  2015-09-11 14:34 [PATCH 1/2] clk: at91: utmi: use pmc_read when the at91_pmc is available Alexandre Belloni
@ 2015-09-11 14:34 ` Alexandre Belloni
  2015-09-14 14:40   ` Boris Brezillon
  2015-09-14 21:57   ` Stephen Boyd
  2015-09-14 14:31 ` [PATCH 1/2] clk: at91: utmi: use pmc_read when the at91_pmc is available Boris Brezillon
  2015-09-14 21:57 ` Stephen Boyd
  2 siblings, 2 replies; 6+ messages in thread
From: Alexandre Belloni @ 2015-09-11 14:34 UTC (permalink / raw)
  To: linux-arm-kernel

In the error path of at91_clk_register_system(), sys->irq is freed
unconditionally but it may not exist or be request at all.

Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
---
 drivers/clk/at91/clk-system.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/at91/clk-system.c b/drivers/clk/at91/clk-system.c
index 58008b3e8bc1..3f5314344286 100644
--- a/drivers/clk/at91/clk-system.c
+++ b/drivers/clk/at91/clk-system.c
@@ -138,7 +138,8 @@ at91_clk_register_system(struct at91_pmc *pmc, const char *name,
 
 	clk = clk_register(NULL, &sys->hw);
 	if (IS_ERR(clk)) {
-		free_irq(sys->irq, sys);
+		if (irq)
+			free_irq(sys->irq, sys);
 		kfree(sys);
 	}
 
-- 
2.1.4

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

* [PATCH 1/2] clk: at91: utmi: use pmc_read when the at91_pmc is available
  2015-09-11 14:34 [PATCH 1/2] clk: at91: utmi: use pmc_read when the at91_pmc is available Alexandre Belloni
  2015-09-11 14:34 ` [PATCH 2/2] clk: at91: system: don't try to free_irq when there is no IRQ Alexandre Belloni
@ 2015-09-14 14:31 ` Boris Brezillon
  2015-09-14 21:57 ` Stephen Boyd
  2 siblings, 0 replies; 6+ messages in thread
From: Boris Brezillon @ 2015-09-14 14:31 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Alexandre,

On Fri, 11 Sep 2015 16:34:06 +0200
Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote:

> at91_pmc_read is a workaround to allow external drivers to acces some
> registers of the PMC. There is no need for it in clk-utmi.c as we aready
> have a pointer to the struct at91_pmc.

Indeed.

> 
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

Thanks,

Boris

> ---
>  drivers/clk/at91/clk-utmi.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/at91/clk-utmi.c b/drivers/clk/at91/clk-utmi.c
> index 30dd697b1668..ca561e90a60f 100644
> --- a/drivers/clk/at91/clk-utmi.c
> +++ b/drivers/clk/at91/clk-utmi.c
> @@ -47,7 +47,7 @@ static int clk_utmi_prepare(struct clk_hw *hw)
>  {
>  	struct clk_utmi *utmi = to_clk_utmi(hw);
>  	struct at91_pmc *pmc = utmi->pmc;
> -	u32 tmp = at91_pmc_read(AT91_CKGR_UCKR) | AT91_PMC_UPLLEN |
> +	u32 tmp = pmc_read(pmc, AT91_CKGR_UCKR) | AT91_PMC_UPLLEN |
>  		  AT91_PMC_UPLLCOUNT | AT91_PMC_BIASEN;
>  
>  	pmc_write(pmc, AT91_CKGR_UCKR, tmp);
> @@ -73,7 +73,7 @@ static void clk_utmi_unprepare(struct clk_hw *hw)
>  {
>  	struct clk_utmi *utmi = to_clk_utmi(hw);
>  	struct at91_pmc *pmc = utmi->pmc;
> -	u32 tmp = at91_pmc_read(AT91_CKGR_UCKR) & ~AT91_PMC_UPLLEN;
> +	u32 tmp = pmc_read(pmc, AT91_CKGR_UCKR) & ~AT91_PMC_UPLLEN;
>  
>  	pmc_write(pmc, AT91_CKGR_UCKR, tmp);
>  }



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* [PATCH 2/2] clk: at91: system: don't try to free_irq when there is no IRQ
  2015-09-11 14:34 ` [PATCH 2/2] clk: at91: system: don't try to free_irq when there is no IRQ Alexandre Belloni
@ 2015-09-14 14:40   ` Boris Brezillon
  2015-09-14 21:57   ` Stephen Boyd
  1 sibling, 0 replies; 6+ messages in thread
From: Boris Brezillon @ 2015-09-14 14:40 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Alexandre,

On Fri, 11 Sep 2015 16:34:07 +0200
Alexandre Belloni <alexandre.belloni@free-electrons.com> wrote:

> In the error path of at91_clk_register_system(), sys->irq is freed
> unconditionally but it may not exist or be request at all.

Not sure this is really needed since free_irq() seems to gracefully
handle the case where the irq has not been previously requested [1]
(it does not complain about invalid irq descriptors), but I guess
this extra check cannot hurt.

BTW, that's kinda weird that free_irq() accepts this case, but complains
when you're trying to free a wrong (or already freed) shared irq handler
[2].

Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>

Best Regards,

Boris

[1]http://lxr.free-electrons.com/source/kernel/irq/manage.c#L1471
[2]http://lxr.free-electrons.com/source/kernel/irq/manage.c#L1377

> 
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---
>  drivers/clk/at91/clk-system.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/at91/clk-system.c b/drivers/clk/at91/clk-system.c
> index 58008b3e8bc1..3f5314344286 100644
> --- a/drivers/clk/at91/clk-system.c
> +++ b/drivers/clk/at91/clk-system.c
> @@ -138,7 +138,8 @@ at91_clk_register_system(struct at91_pmc *pmc, const char *name,
>  
>  	clk = clk_register(NULL, &sys->hw);
>  	if (IS_ERR(clk)) {
> -		free_irq(sys->irq, sys);
> +		if (irq)
> +			free_irq(sys->irq, sys);
>  		kfree(sys);
>  	}
>  



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

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

* [PATCH 1/2] clk: at91: utmi: use pmc_read when the at91_pmc is available
  2015-09-11 14:34 [PATCH 1/2] clk: at91: utmi: use pmc_read when the at91_pmc is available Alexandre Belloni
  2015-09-11 14:34 ` [PATCH 2/2] clk: at91: system: don't try to free_irq when there is no IRQ Alexandre Belloni
  2015-09-14 14:31 ` [PATCH 1/2] clk: at91: utmi: use pmc_read when the at91_pmc is available Boris Brezillon
@ 2015-09-14 21:57 ` Stephen Boyd
  2 siblings, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2015-09-14 21:57 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/11, Alexandre Belloni wrote:
> at91_pmc_read is a workaround to allow external drivers to acces some
> registers of the PMC. There is no need for it in clk-utmi.c as we aready
> have a pointer to the struct at91_pmc.
> 
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

* [PATCH 2/2] clk: at91: system: don't try to free_irq when there is no IRQ
  2015-09-11 14:34 ` [PATCH 2/2] clk: at91: system: don't try to free_irq when there is no IRQ Alexandre Belloni
  2015-09-14 14:40   ` Boris Brezillon
@ 2015-09-14 21:57   ` Stephen Boyd
  1 sibling, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2015-09-14 21:57 UTC (permalink / raw)
  To: linux-arm-kernel

On 09/11, Alexandre Belloni wrote:
> In the error path of at91_clk_register_system(), sys->irq is freed
> unconditionally but it may not exist or be request at all.
> 
> Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
> ---

Applied to clk-next

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

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

end of thread, other threads:[~2015-09-14 21:57 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-11 14:34 [PATCH 1/2] clk: at91: utmi: use pmc_read when the at91_pmc is available Alexandre Belloni
2015-09-11 14:34 ` [PATCH 2/2] clk: at91: system: don't try to free_irq when there is no IRQ Alexandre Belloni
2015-09-14 14:40   ` Boris Brezillon
2015-09-14 21:57   ` Stephen Boyd
2015-09-14 14:31 ` [PATCH 1/2] clk: at91: utmi: use pmc_read when the at91_pmc is available Boris Brezillon
2015-09-14 21:57 ` Stephen Boyd

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