Subject: Re: [GIT PULL] Disintegrate and kill asm/system.h

From: Michael Neuling <[email-masked]>
Date: Thu, 29 Mar 2012 15:55:24 +1100

> > Can we please move that abortion into arch/powerpc/? Instead of making
> > generic code even uglier..
> 
> How about this (build tested on powerpc allyesconfig):
> 
> From: Stephen Rothwell <[email-masked]>
> Date: Thu, 29 Mar 2012 14:58:10 +1100
> Subject: [PATCH] powerpc: fix fallout from system.h split up
> 
> Signed-off-by: Stephen Rothwell <[email-masked]>

FWIW.. this works for me too..

Acked-by: Michael Neuling <[email-masked]>

Mikey

> ---
>  arch/powerpc/kernel/fadump.c |    2 +
>  arch/powerpc/kernel/irq.c    |   72 ++++++++++++++++++++++++++++++++++++++> ++++
>  arch/powerpc/kernel/kgdb.c   |    1 +
>  kernel/irq/irqdomain.c       |   72 --------------------------------------> ----
>  4 files changed, 75 insertions(+), 72 deletions(-)
> 
> diff --git a/arch/powerpc/kernel/fadump.c b/arch/powerpc/kernel/fadump.c
> index cfe7a38..18bdf74 100644
> --- a/arch/powerpc/kernel/fadump.c
> +++ b/arch/powerpc/kernel/fadump.c
> @@ -40,6 +40,8 @@
>  #include <asm/prom.h>
>  #include <asm/rtas.h>
>  #include <asm/fadump.h>
> +#include <asm/debug.h>
> +#include <asm/setup.h>
>  
>  static struct fw_dump fw_dump;
>  static struct fadump_mem_struct fdm;
> diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
> index 243dbab..ff165f5 100644
> --- a/arch/powerpc/kernel/irq.c
> +++ b/arch/powerpc/kernel/irq.c
> @@ -623,3 +623,75 @@ static int __init setup_noirqdistrib(char *str)
>  
>  __setup("noirqdistrib", setup_noirqdistrib);
>  #endif /* CONFIG_PPC64 */
> +
> +#ifdef CONFIG_VIRQ_DEBUG
> +static int virq_debug_show(struct seq_file *m, void *private)
> +{
> +	unsigned long flags;
> +	struct irq_desc *desc;
> +	const char *p;
> +	static const char none[] = "none";
> +	void *data;
> +	int i;
> +
> +	seq_printf(m, "%-5s  %-7s  %-15s  %-18s  %s\n", "virq", "hwirq",
> +		      "chip name", "chip data", "domain name");
> +
> +	for (i = 1; i < nr_irqs; i++) {
> +		desc = irq_to_desc(i);
> +		if (!desc)
> +			continue;
> +
> +		raw_spin_lock_irqsave(&desc->lock, flags);
> +
> +		if (desc->action && desc->action->handler) {
> +			struct irq_chip *chip;
> +
> +			seq_printf(m, "%5d  ", i);
> +			seq_printf(m, "0x%05lx  ", desc->irq_data.hwirq);
> +
> +			chip = irq_desc_get_chip(desc);
> +			if (chip && chip->name)
> +				p = chip->name;
> +			else
> +				p = none;
> +			seq_printf(m, "%-15s  ", p);
> +
> +			data = irq_desc_get_chip_data(desc);
> +			seq_printf(m, "0x%16p  ", data);
> +
> +			if (desc->irq_data.domain->of_node)
> +				p = desc->irq_data.domain->of_node->full_name
;
> +			else
> +				p = none;
> +			seq_printf(m, "%s\n", p);
> +		}
> +
> +		raw_spin_unlock_irqrestore(&desc->lock, flags);
> +	}
> +
> +	return 0;
> +}
> +
> +static int virq_debug_open(struct inode *inode, struct file *file)
> +{
> +	return single_open(file, virq_debug_show, inode->i_private);
> +}
> +
> +static const struct file_operations virq_debug_fops = {
> +	.open = virq_debug_open,
> +	.read = seq_read,
> +	.llseek = seq_lseek,
> +	.release = single_release,
> +};
> +
> +static int __init irq_debugfs_init(void)
> +{
> +	if (debugfs_create_file("virq_mapping", S_IRUGO, powerpc_debugfs_root,
> +				 NULL, &virq_debug_fops) == NULL)
> +		return -ENOMEM;
> +
> +	return 0;
> +}
> +__initcall(irq_debugfs_init);
> +#endif /* CONFIG_VIRQ_DEBUG */
> diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
> index 76a6e40..782bd0a 100644
> --- a/arch/powerpc/kernel/kgdb.c
> +++ b/arch/powerpc/kernel/kgdb.c
> @@ -24,6 +24,7 @@
>  #include <asm/current.h>
>  #include <asm/processor.h>
>  #include <asm/machdep.h>
> +#include <asm/debug.h>
>  
>  /*
>   * This table contains the mapping between PowerPC hardware trap types, and
> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
> index af48e59..ae645ab 100644
> --- a/kernel/irq/irqdomain.c
> +++ b/kernel/irq/irqdomain.c
> @@ -632,78 +632,6 @@ unsigned int irq_linear_revmap(struct irq_domain *doma> in,
>  	return revmap[hwirq];
>  }
>  
> -#ifdef CONFIG_VIRQ_DEBUG
> -static int virq_debug_show(struct seq_file *m, void *private)
> -{
> -	unsigned long flags;
> -	struct irq_desc *desc;
> -	const char *p;
> -	static const char none[] = "none";
> -	void *data;
> -	int i;
> -
> -	seq_printf(m, "%-5s  %-7s  %-15s  %-18s  %s\n", "virq", "hwirq",
> -		      "chip name", "chip data", "domain name");
> -
> -	for (i = 1; i < nr_irqs; i++) {
> -		desc = irq_to_desc(i);
> -		if (!desc)
> -			continue;
> -
> -		raw_spin_lock_irqsave(&desc->lock, flags);
> -
> -		if (desc->action && desc->action->handler) {
> -			struct irq_chip *chip;
> -
> -			seq_printf(m, "%5d  ", i);
> -			seq_printf(m, "0x%05lx  ", desc->irq_data.hwirq);
> -
> -			chip = irq_desc_get_chip(desc);
> -			if (chip && chip->name)
> -				p = chip->name;
> -			else
> -				p = none;
> -			seq_printf(m, "%-15s  ", p);
> -
> -			data = irq_desc_get_chip_data(desc);
> -			seq_printf(m, "0x%16p  ", data);
> -
> -			if (desc->irq_data.domain->of_node)
> -				p = desc->irq_data.domain->of_node->full_name
;
> -			else
> -				p = none;
> -			seq_printf(m, "%s\n", p);
> -		}
> -
> -		raw_spin_unlock_irqrestore(&desc->lock, flags);
> -	}
> -
> -	return 0;
> -}
> -
> -static int virq_debug_open(struct inode *inode, struct file *file)
> -{
> -	return single_open(file, virq_debug_show, inode->i_private);
> -}
> -
> -static const struct file_operations virq_debug_fops = {
> -	.open = virq_debug_open,
> -	.read = seq_read,
> -	.llseek = seq_lseek,
> -	.release = single_release,
> -};
> -
> -static int __init irq_debugfs_init(void)
> -{
> -	if (debugfs_create_file("virq_mapping", S_IRUGO, powerpc_debugfs_root,
> -				 NULL, &virq_debug_fops) == NULL)
> -		return -ENOMEM;
> -
> -	return 0;
> -}
> -__initcall(irq_debugfs_init);
> -#endif /* CONFIG_VIRQ_DEBUG */
> -
>  int irq_domain_simple_map(struct irq_domain *d, unsigned int irq,
>  			  irq_hw_number_t hwirq)
>  {
> -- 
> 1.7.9.1
> 
> 
> -- 
> Cheers,
> Stephen Rothwell                    [email-masked]
> http://www.canb.auug.org.au/~sfr/