All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] irqchip: bcm7120-l2: use of_io_request_and_map() to claim iomem
@ 2015-06-18 23:05 ` Brian Norris
  0 siblings, 0 replies; 4+ messages in thread
From: Brian Norris @ 2015-06-18 23:05 UTC (permalink / raw)
  To: Kevin Cernekee, Florian Fainelli, Thomas Gleixner, Jason Cooper
  Cc: bcm-kernel-feedback-list, Brian Norris, Gregory Fong, linux-mips,
	linux-kernel

This way, the IO resources will show up in /proc/iomem, and we can make
sure no other drivers are trying to claim these register regions.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 drivers/irqchip/irq-bcm7120-l2.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c
index 3ba5cc780fcb..299d4de2deb5 100644
--- a/drivers/irqchip/irq-bcm7120-l2.c
+++ b/drivers/irqchip/irq-bcm7120-l2.c
@@ -142,10 +142,10 @@ static int __init bcm7120_l2_intc_iomap_7120(struct device_node *dn,
 {
 	int ret;
 
-	data->map_base[0] = of_iomap(dn, 0);
-	if (!data->map_base[0]) {
+	data->map_base[0] = of_io_request_and_map(dn, 0, dn->full_name);
+	if (IS_ERR(data->map_base[0])) {
 		pr_err("unable to map registers\n");
-		return -ENOMEM;
+		return PTR_ERR(data->map_base[0]);
 	}
 
 	data->pair_base[0] = data->map_base[0];
@@ -178,16 +178,17 @@ static int __init bcm7120_l2_intc_iomap_3380(struct device_node *dn,
 
 	for (gc_idx = 0; gc_idx < MAX_WORDS; gc_idx++) {
 		unsigned int map_idx = gc_idx * 2;
-		void __iomem *en = of_iomap(dn, map_idx + 0);
-		void __iomem *stat = of_iomap(dn, map_idx + 1);
-		void __iomem *base = min(en, stat);
+		void __iomem *en, *stat, *base;
+
+		en = of_io_request_and_map(dn, map_idx + 0, "irq-en");
+		stat = of_io_request_and_map(dn, map_idx + 1, "irq-stat");
+		if (IS_ERR(en) || IS_ERR(stat))
+			break;
 
+		base = min(en, stat);
 		data->map_base[map_idx + 0] = en;
 		data->map_base[map_idx + 1] = stat;
 
-		if (!base)
-			break;
-
 		data->pair_base[gc_idx] = base;
 		data->en_offset[gc_idx] = en - base;
 		data->stat_offset[gc_idx] = stat - base;
-- 
1.9.1


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

* [PATCH] irqchip: bcm7120-l2: use of_io_request_and_map() to claim iomem
@ 2015-06-18 23:05 ` Brian Norris
  0 siblings, 0 replies; 4+ messages in thread
From: Brian Norris @ 2015-06-18 23:05 UTC (permalink / raw)
  To: Kevin Cernekee, Florian Fainelli, Thomas Gleixner, Jason Cooper
  Cc: bcm-kernel-feedback-list, Brian Norris, Gregory Fong, linux-mips,
	linux-kernel

This way, the IO resources will show up in /proc/iomem, and we can make
sure no other drivers are trying to claim these register regions.

Signed-off-by: Brian Norris <computersforpeace@gmail.com>
---
 drivers/irqchip/irq-bcm7120-l2.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c
index 3ba5cc780fcb..299d4de2deb5 100644
--- a/drivers/irqchip/irq-bcm7120-l2.c
+++ b/drivers/irqchip/irq-bcm7120-l2.c
@@ -142,10 +142,10 @@ static int __init bcm7120_l2_intc_iomap_7120(struct device_node *dn,
 {
 	int ret;
 
-	data->map_base[0] = of_iomap(dn, 0);
-	if (!data->map_base[0]) {
+	data->map_base[0] = of_io_request_and_map(dn, 0, dn->full_name);
+	if (IS_ERR(data->map_base[0])) {
 		pr_err("unable to map registers\n");
-		return -ENOMEM;
+		return PTR_ERR(data->map_base[0]);
 	}
 
 	data->pair_base[0] = data->map_base[0];
@@ -178,16 +178,17 @@ static int __init bcm7120_l2_intc_iomap_3380(struct device_node *dn,
 
 	for (gc_idx = 0; gc_idx < MAX_WORDS; gc_idx++) {
 		unsigned int map_idx = gc_idx * 2;
-		void __iomem *en = of_iomap(dn, map_idx + 0);
-		void __iomem *stat = of_iomap(dn, map_idx + 1);
-		void __iomem *base = min(en, stat);
+		void __iomem *en, *stat, *base;
+
+		en = of_io_request_and_map(dn, map_idx + 0, "irq-en");
+		stat = of_io_request_and_map(dn, map_idx + 1, "irq-stat");
+		if (IS_ERR(en) || IS_ERR(stat))
+			break;
 
+		base = min(en, stat);
 		data->map_base[map_idx + 0] = en;
 		data->map_base[map_idx + 1] = stat;
 
-		if (!base)
-			break;
-
 		data->pair_base[gc_idx] = base;
 		data->en_offset[gc_idx] = en - base;
 		data->stat_offset[gc_idx] = stat - base;
-- 
1.9.1

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

* Re: [PATCH] irqchip: bcm7120-l2: use of_io_request_and_map() to claim iomem
@ 2015-06-26 20:51   ` Florian Fainelli
  0 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2015-06-26 20:51 UTC (permalink / raw)
  To: Brian Norris, Kevin Cernekee, Florian Fainelli, Thomas Gleixner,
	Jason Cooper
  Cc: bcm-kernel-feedback-list, Gregory Fong, linux-mips, linux-kernel

On 18/06/15 16:05, Brian Norris wrote:
> This way, the IO resources will show up in /proc/iomem, and we can make
> sure no other drivers are trying to claim these register regions.
> 
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

> ---
>  drivers/irqchip/irq-bcm7120-l2.c | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c
> index 3ba5cc780fcb..299d4de2deb5 100644
> --- a/drivers/irqchip/irq-bcm7120-l2.c
> +++ b/drivers/irqchip/irq-bcm7120-l2.c
> @@ -142,10 +142,10 @@ static int __init bcm7120_l2_intc_iomap_7120(struct device_node *dn,
>  {
>  	int ret;
>  
> -	data->map_base[0] = of_iomap(dn, 0);
> -	if (!data->map_base[0]) {
> +	data->map_base[0] = of_io_request_and_map(dn, 0, dn->full_name);
> +	if (IS_ERR(data->map_base[0])) {
>  		pr_err("unable to map registers\n");
> -		return -ENOMEM;
> +		return PTR_ERR(data->map_base[0]);
>  	}
>  
>  	data->pair_base[0] = data->map_base[0];
> @@ -178,16 +178,17 @@ static int __init bcm7120_l2_intc_iomap_3380(struct device_node *dn,
>  
>  	for (gc_idx = 0; gc_idx < MAX_WORDS; gc_idx++) {
>  		unsigned int map_idx = gc_idx * 2;
> -		void __iomem *en = of_iomap(dn, map_idx + 0);
> -		void __iomem *stat = of_iomap(dn, map_idx + 1);
> -		void __iomem *base = min(en, stat);
> +		void __iomem *en, *stat, *base;
> +
> +		en = of_io_request_and_map(dn, map_idx + 0, "irq-en");
> +		stat = of_io_request_and_map(dn, map_idx + 1, "irq-stat");
> +		if (IS_ERR(en) || IS_ERR(stat))
> +			break;
>  
> +		base = min(en, stat);
>  		data->map_base[map_idx + 0] = en;
>  		data->map_base[map_idx + 1] = stat;
>  
> -		if (!base)
> -			break;
> -
>  		data->pair_base[gc_idx] = base;
>  		data->en_offset[gc_idx] = en - base;
>  		data->stat_offset[gc_idx] = stat - base;
> 


-- 
Florian

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

* Re: [PATCH] irqchip: bcm7120-l2: use of_io_request_and_map() to claim iomem
@ 2015-06-26 20:51   ` Florian Fainelli
  0 siblings, 0 replies; 4+ messages in thread
From: Florian Fainelli @ 2015-06-26 20:51 UTC (permalink / raw)
  To: Brian Norris, Kevin Cernekee, Florian Fainelli, Thomas Gleixner,
	Jason Cooper
  Cc: bcm-kernel-feedback-list, Gregory Fong, linux-mips, linux-kernel

On 18/06/15 16:05, Brian Norris wrote:
> This way, the IO resources will show up in /proc/iomem, and we can make
> sure no other drivers are trying to claim these register regions.
> 
> Signed-off-by: Brian Norris <computersforpeace@gmail.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

> ---
>  drivers/irqchip/irq-bcm7120-l2.c | 19 ++++++++++---------
>  1 file changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/irqchip/irq-bcm7120-l2.c b/drivers/irqchip/irq-bcm7120-l2.c
> index 3ba5cc780fcb..299d4de2deb5 100644
> --- a/drivers/irqchip/irq-bcm7120-l2.c
> +++ b/drivers/irqchip/irq-bcm7120-l2.c
> @@ -142,10 +142,10 @@ static int __init bcm7120_l2_intc_iomap_7120(struct device_node *dn,
>  {
>  	int ret;
>  
> -	data->map_base[0] = of_iomap(dn, 0);
> -	if (!data->map_base[0]) {
> +	data->map_base[0] = of_io_request_and_map(dn, 0, dn->full_name);
> +	if (IS_ERR(data->map_base[0])) {
>  		pr_err("unable to map registers\n");
> -		return -ENOMEM;
> +		return PTR_ERR(data->map_base[0]);
>  	}
>  
>  	data->pair_base[0] = data->map_base[0];
> @@ -178,16 +178,17 @@ static int __init bcm7120_l2_intc_iomap_3380(struct device_node *dn,
>  
>  	for (gc_idx = 0; gc_idx < MAX_WORDS; gc_idx++) {
>  		unsigned int map_idx = gc_idx * 2;
> -		void __iomem *en = of_iomap(dn, map_idx + 0);
> -		void __iomem *stat = of_iomap(dn, map_idx + 1);
> -		void __iomem *base = min(en, stat);
> +		void __iomem *en, *stat, *base;
> +
> +		en = of_io_request_and_map(dn, map_idx + 0, "irq-en");
> +		stat = of_io_request_and_map(dn, map_idx + 1, "irq-stat");
> +		if (IS_ERR(en) || IS_ERR(stat))
> +			break;
>  
> +		base = min(en, stat);
>  		data->map_base[map_idx + 0] = en;
>  		data->map_base[map_idx + 1] = stat;
>  
> -		if (!base)
> -			break;
> -
>  		data->pair_base[gc_idx] = base;
>  		data->en_offset[gc_idx] = en - base;
>  		data->stat_offset[gc_idx] = stat - base;
> 


-- 
Florian

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

end of thread, other threads:[~2015-06-26 20:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-18 23:05 [PATCH] irqchip: bcm7120-l2: use of_io_request_and_map() to claim iomem Brian Norris
2015-06-18 23:05 ` Brian Norris
2015-06-26 20:51 ` Florian Fainelli
2015-06-26 20:51   ` Florian Fainelli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.