linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] irqchip: sunxi-nmi: misc. / aesthetic improvements
@ 2015-10-01 15:33 Chen-Yu Tsai
  2015-10-01 15:33 ` [PATCH 1/2] irqchip: sunxi-nmi: Use driver name instead of DT node name for identification Chen-Yu Tsai
  2015-10-01 15:33 ` [PATCH 2/2] irqchip: sunxi-nmi: switch to of_io_request_and_map() from of_iomap() Chen-Yu Tsai
  0 siblings, 2 replies; 6+ messages in thread
From: Chen-Yu Tsai @ 2015-10-01 15:33 UTC (permalink / raw)
  To: Thomas Gleixner, Jason Cooper, Marc Zyngier, Maxime Ripard
  Cc: Chen-Yu Tsai, linux-kernel, linux-arm-kernel

Hi everyone,

sunxi-nmi uses its DT node name, which is normally "interrupt-controller",
as its irqchip name. This only serves to confuse the user when one sees
"interrupt-controller" in /sys/kernel/debug/irq_domain_mapping or
/proc/interrupts. We want it to show something more specific, like
"sunxi-nmi". Also do this for the printk calls.

While at it, also switch to the new of_io_request_and_map() call, so the
IO resource is properly held, and also shows up in /proc/iomem.


Regards
ChenYu


P.S. I'm thinking about removing the "_irq_chip" suffix from the axp20x
irq chip name as well.


Chen-Yu Tsai (2):
  irqchip: sunxi-nmi: Use driver name instead of DT node name for
    identification
  irqchip: sunxi-nmi: switch to of_io_request_and_map() from of_iomap()

 drivers/irqchip/irq-sunxi-nmi.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

-- 
2.5.3


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

* [PATCH 1/2] irqchip: sunxi-nmi: Use driver name instead of DT node name for identification
  2015-10-01 15:33 [PATCH 0/2] irqchip: sunxi-nmi: misc. / aesthetic improvements Chen-Yu Tsai
@ 2015-10-01 15:33 ` Chen-Yu Tsai
  2015-10-01 20:14   ` Maxime Ripard
  2015-10-01 15:33 ` [PATCH 2/2] irqchip: sunxi-nmi: switch to of_io_request_and_map() from of_iomap() Chen-Yu Tsai
  1 sibling, 1 reply; 6+ messages in thread
From: Chen-Yu Tsai @ 2015-10-01 15:33 UTC (permalink / raw)
  To: Thomas Gleixner, Jason Cooper, Marc Zyngier, Maxime Ripard
  Cc: Chen-Yu Tsai, linux-kernel, linux-arm-kernel

The device tree node name is typically "interrupt-controller", which is
rather useless when used in printk messages and irq chip names for
identification purposes. Use the driver name "sunxi-nmi" instead.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 drivers/irqchip/irq-sunxi-nmi.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/irqchip/irq-sunxi-nmi.c b/drivers/irqchip/irq-sunxi-nmi.c
index c143dd58410c..57e009917d2d 100644
--- a/drivers/irqchip/irq-sunxi-nmi.c
+++ b/drivers/irqchip/irq-sunxi-nmi.c
@@ -21,6 +21,7 @@
 #include <linux/irqchip/chained_irq.h>
 
 #define SUNXI_NMI_SRC_TYPE_MASK	0x00000003
+#define DRV_NAME "sunxi-nmi"
 
 enum {
 	SUNXI_SRC_TYPE_LEVEL_LOW = 0,
@@ -130,22 +131,22 @@ static int __init sunxi_sc_nmi_irq_init(struct device_node *node,
 
 	domain = irq_domain_add_linear(node, 1, &irq_generic_chip_ops, NULL);
 	if (!domain) {
-		pr_err("%s: Could not register interrupt domain.\n", node->name);
+		pr_err("%s: Could not register interrupt domain.\n", DRV_NAME);
 		return -ENOMEM;
 	}
 
-	ret = irq_alloc_domain_generic_chips(domain, 1, 2, node->name,
+	ret = irq_alloc_domain_generic_chips(domain, 1, 2, DRV_NAME,
 					     handle_fasteoi_irq, clr, 0,
 					     IRQ_GC_INIT_MASK_CACHE);
 	if (ret) {
 		 pr_err("%s: Could not allocate generic interrupt chip.\n",
-			 node->name);
+			 DRV_NAME);
 		 goto fail_irqd_remove;
 	}
 
 	irq = irq_of_parse_and_map(node, 0);
 	if (irq <= 0) {
-		pr_err("%s: unable to parse irq\n", node->name);
+		pr_err("%s: unable to parse irq\n", DRV_NAME);
 		ret = -EINVAL;
 		goto fail_irqd_remove;
 	}
@@ -153,7 +154,7 @@ static int __init sunxi_sc_nmi_irq_init(struct device_node *node,
 	gc = irq_get_domain_generic_chip(domain, 0);
 	gc->reg_base = of_iomap(node, 0);
 	if (!gc->reg_base) {
-		pr_err("%s: unable to map resource\n", node->name);
+		pr_err("%s: unable to map resource\n", DRV_NAME);
 		ret = -ENOMEM;
 		goto fail_irqd_remove;
 	}
-- 
2.5.3


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

* [PATCH 2/2] irqchip: sunxi-nmi: switch to of_io_request_and_map() from of_iomap()
  2015-10-01 15:33 [PATCH 0/2] irqchip: sunxi-nmi: misc. / aesthetic improvements Chen-Yu Tsai
  2015-10-01 15:33 ` [PATCH 1/2] irqchip: sunxi-nmi: Use driver name instead of DT node name for identification Chen-Yu Tsai
@ 2015-10-01 15:33 ` Chen-Yu Tsai
  2015-10-01 15:53   ` Marc Zyngier
  1 sibling, 1 reply; 6+ messages in thread
From: Chen-Yu Tsai @ 2015-10-01 15:33 UTC (permalink / raw)
  To: Thomas Gleixner, Jason Cooper, Marc Zyngier, Maxime Ripard
  Cc: Chen-Yu Tsai, linux-kernel, linux-arm-kernel

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 drivers/irqchip/irq-sunxi-nmi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-sunxi-nmi.c b/drivers/irqchip/irq-sunxi-nmi.c
index 57e009917d2d..4fa46d778d02 100644
--- a/drivers/irqchip/irq-sunxi-nmi.c
+++ b/drivers/irqchip/irq-sunxi-nmi.c
@@ -152,7 +152,7 @@ static int __init sunxi_sc_nmi_irq_init(struct device_node *node,
 	}
 
 	gc = irq_get_domain_generic_chip(domain, 0);
-	gc->reg_base = of_iomap(node, 0);
+	gc->reg_base = of_io_request_and_map(node, 0, of_node_full_name(node));
 	if (!gc->reg_base) {
 		pr_err("%s: unable to map resource\n", DRV_NAME);
 		ret = -ENOMEM;
-- 
2.5.3


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

* Re: [PATCH 2/2] irqchip: sunxi-nmi: switch to of_io_request_and_map() from of_iomap()
  2015-10-01 15:33 ` [PATCH 2/2] irqchip: sunxi-nmi: switch to of_io_request_and_map() from of_iomap() Chen-Yu Tsai
@ 2015-10-01 15:53   ` Marc Zyngier
  0 siblings, 0 replies; 6+ messages in thread
From: Marc Zyngier @ 2015-10-01 15:53 UTC (permalink / raw)
  To: Chen-Yu Tsai, Thomas Gleixner, Jason Cooper, Maxime Ripard
  Cc: linux-kernel, linux-arm-kernel

On 01/10/15 16:33, Chen-Yu Tsai wrote:
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>

Please, take the time to write a commit message. You've done it in your
cover letter (where it matters the least), so why avoid doing it where
it actually benefits everyone?

> ---
>  drivers/irqchip/irq-sunxi-nmi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/irqchip/irq-sunxi-nmi.c b/drivers/irqchip/irq-sunxi-nmi.c
> index 57e009917d2d..4fa46d778d02 100644
> --- a/drivers/irqchip/irq-sunxi-nmi.c
> +++ b/drivers/irqchip/irq-sunxi-nmi.c
> @@ -152,7 +152,7 @@ static int __init sunxi_sc_nmi_irq_init(struct device_node *node,
>  	}
>  
>  	gc = irq_get_domain_generic_chip(domain, 0);
> -	gc->reg_base = of_iomap(node, 0);
> +	gc->reg_base = of_io_request_and_map(node, 0, of_node_full_name(node));
>  	if (!gc->reg_base) {
>  		pr_err("%s: unable to map resource\n", DRV_NAME);
>  		ret = -ENOMEM;
> 

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

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

* Re: [PATCH 1/2] irqchip: sunxi-nmi: Use driver name instead of DT node name for identification
  2015-10-01 15:33 ` [PATCH 1/2] irqchip: sunxi-nmi: Use driver name instead of DT node name for identification Chen-Yu Tsai
@ 2015-10-01 20:14   ` Maxime Ripard
  2015-10-02  5:26     ` Chen-Yu Tsai
  0 siblings, 1 reply; 6+ messages in thread
From: Maxime Ripard @ 2015-10-01 20:14 UTC (permalink / raw)
  To: Chen-Yu Tsai
  Cc: Thomas Gleixner, Jason Cooper, Marc Zyngier, linux-kernel,
	linux-arm-kernel

[-- Attachment #1: Type: text/plain, Size: 2340 bytes --]

Hi,

On Thu, Oct 01, 2015 at 11:33:48PM +0800, Chen-Yu Tsai wrote:
> The device tree node name is typically "interrupt-controller", which is
> rather useless when used in printk messages and irq chip names for
> identification purposes. Use the driver name "sunxi-nmi" instead.
> 
> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
> ---
>  drivers/irqchip/irq-sunxi-nmi.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/irqchip/irq-sunxi-nmi.c b/drivers/irqchip/irq-sunxi-nmi.c
> index c143dd58410c..57e009917d2d 100644
> --- a/drivers/irqchip/irq-sunxi-nmi.c
> +++ b/drivers/irqchip/irq-sunxi-nmi.c
> @@ -21,6 +21,7 @@
>  #include <linux/irqchip/chained_irq.h>
>  
>  #define SUNXI_NMI_SRC_TYPE_MASK	0x00000003
> +#define DRV_NAME "sunxi-nmi"
>  
>  enum {
>  	SUNXI_SRC_TYPE_LEVEL_LOW = 0,
> @@ -130,22 +131,22 @@ static int __init sunxi_sc_nmi_irq_init(struct device_node *node,
>  
>  	domain = irq_domain_add_linear(node, 1, &irq_generic_chip_ops, NULL);
>  	if (!domain) {
> -		pr_err("%s: Could not register interrupt domain.\n", node->name);
> +		pr_err("%s: Could not register interrupt domain.\n", DRV_NAME);
>  		return -ENOMEM;
>  	}
>  
> -	ret = irq_alloc_domain_generic_chips(domain, 1, 2, node->name,
> +	ret = irq_alloc_domain_generic_chips(domain, 1, 2, DRV_NAME,
>  					     handle_fasteoi_irq, clr, 0,
>  					     IRQ_GC_INIT_MASK_CACHE);
>  	if (ret) {
>  		 pr_err("%s: Could not allocate generic interrupt chip.\n",
> -			 node->name);
> +			 DRV_NAME);
>  		 goto fail_irqd_remove;
>  	}
>  
>  	irq = irq_of_parse_and_map(node, 0);
>  	if (irq <= 0) {
> -		pr_err("%s: unable to parse irq\n", node->name);
> +		pr_err("%s: unable to parse irq\n", DRV_NAME);
>  		ret = -EINVAL;
>  		goto fail_irqd_remove;
>  	}
> @@ -153,7 +154,7 @@ static int __init sunxi_sc_nmi_irq_init(struct device_node *node,
>  	gc = irq_get_domain_generic_chip(domain, 0);
>  	gc->reg_base = of_iomap(node, 0);
>  	if (!gc->reg_base) {
> -		pr_err("%s: unable to map resource\n", node->name);
> +		pr_err("%s: unable to map resource\n", DRV_NAME);

All the pr_err changes can even be replaced by defining pr_fmt.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

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

* Re: [PATCH 1/2] irqchip: sunxi-nmi: Use driver name instead of DT node name for identification
  2015-10-01 20:14   ` Maxime Ripard
@ 2015-10-02  5:26     ` Chen-Yu Tsai
  0 siblings, 0 replies; 6+ messages in thread
From: Chen-Yu Tsai @ 2015-10-02  5:26 UTC (permalink / raw)
  To: Maxime Ripard
  Cc: Chen-Yu Tsai, Thomas Gleixner, Jason Cooper, Marc Zyngier,
	linux-kernel, linux-arm-kernel

On Fri, Oct 2, 2015 at 4:14 AM, Maxime Ripard
<maxime.ripard@free-electrons.com> wrote:
> Hi,
>
> On Thu, Oct 01, 2015 at 11:33:48PM +0800, Chen-Yu Tsai wrote:
>> The device tree node name is typically "interrupt-controller", which is
>> rather useless when used in printk messages and irq chip names for
>> identification purposes. Use the driver name "sunxi-nmi" instead.
>>
>> Signed-off-by: Chen-Yu Tsai <wens@csie.org>
>> ---
>>  drivers/irqchip/irq-sunxi-nmi.c | 11 ++++++-----
>>  1 file changed, 6 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/irqchip/irq-sunxi-nmi.c b/drivers/irqchip/irq-sunxi-nmi.c
>> index c143dd58410c..57e009917d2d 100644
>> --- a/drivers/irqchip/irq-sunxi-nmi.c
>> +++ b/drivers/irqchip/irq-sunxi-nmi.c
>> @@ -21,6 +21,7 @@
>>  #include <linux/irqchip/chained_irq.h>
>>
>>  #define SUNXI_NMI_SRC_TYPE_MASK      0x00000003
>> +#define DRV_NAME "sunxi-nmi"
>>
>>  enum {
>>       SUNXI_SRC_TYPE_LEVEL_LOW = 0,
>> @@ -130,22 +131,22 @@ static int __init sunxi_sc_nmi_irq_init(struct device_node *node,
>>
>>       domain = irq_domain_add_linear(node, 1, &irq_generic_chip_ops, NULL);
>>       if (!domain) {
>> -             pr_err("%s: Could not register interrupt domain.\n", node->name);
>> +             pr_err("%s: Could not register interrupt domain.\n", DRV_NAME);
>>               return -ENOMEM;
>>       }
>>
>> -     ret = irq_alloc_domain_generic_chips(domain, 1, 2, node->name,
>> +     ret = irq_alloc_domain_generic_chips(domain, 1, 2, DRV_NAME,
>>                                            handle_fasteoi_irq, clr, 0,
>>                                            IRQ_GC_INIT_MASK_CACHE);
>>       if (ret) {
>>                pr_err("%s: Could not allocate generic interrupt chip.\n",
>> -                      node->name);
>> +                      DRV_NAME);
>>                goto fail_irqd_remove;
>>       }
>>
>>       irq = irq_of_parse_and_map(node, 0);
>>       if (irq <= 0) {
>> -             pr_err("%s: unable to parse irq\n", node->name);
>> +             pr_err("%s: unable to parse irq\n", DRV_NAME);
>>               ret = -EINVAL;
>>               goto fail_irqd_remove;
>>       }
>> @@ -153,7 +154,7 @@ static int __init sunxi_sc_nmi_irq_init(struct device_node *node,
>>       gc = irq_get_domain_generic_chip(domain, 0);
>>       gc->reg_base = of_iomap(node, 0);
>>       if (!gc->reg_base) {
>> -             pr_err("%s: unable to map resource\n", node->name);
>> +             pr_err("%s: unable to map resource\n", DRV_NAME);
>
> All the pr_err changes can even be replaced by defining pr_fmt.

Cool. Learned something today.

ChenYu

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

end of thread, other threads:[~2015-10-02  5:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-01 15:33 [PATCH 0/2] irqchip: sunxi-nmi: misc. / aesthetic improvements Chen-Yu Tsai
2015-10-01 15:33 ` [PATCH 1/2] irqchip: sunxi-nmi: Use driver name instead of DT node name for identification Chen-Yu Tsai
2015-10-01 20:14   ` Maxime Ripard
2015-10-02  5:26     ` Chen-Yu Tsai
2015-10-01 15:33 ` [PATCH 2/2] irqchip: sunxi-nmi: switch to of_io_request_and_map() from of_iomap() Chen-Yu Tsai
2015-10-01 15:53   ` Marc Zyngier

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