All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Grant Likely <grant.likely@secretlab.ca>
Cc: linux-kernel@vger.kernel.org, Milton Miller <miltonm@bga.com>,
	Paul Mundt <lethal@linux-sh.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Rob Herring <rob.herring@calxeda.com>
Subject: Re: [PATCH 01/12] irqdomain: Split disassociating code into separate function
Date: Sat, 16 Jun 2012 15:57:27 +1000	[thread overview]
Message-ID: <1339826247.9220.219.camel@pasglop> (raw)
In-Reply-To: <1339822897-15840-2-git-send-email-grant.likely@secretlab.ca>

On Fri, 2012-06-15 at 23:01 -0600, Grant Likely wrote:
> This patch moves the irq disassociation code out into a separate
> function in preparation to extend irq_setup_virq to handle multiple
> irqs and rename it for use by interrupt controller drivers.  The new
> function will be used by irq_setup_virq() in its error path.
> 
> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
> Cc: Paul Mundt <lethal@linux-sh.org>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Rob Herring <rob.herring@calxeda.com>
> ---
>  kernel/irq/irqdomain.c |   75 ++++++++++++++++++++++++++++++------------------
>  1 file changed, 47 insertions(+), 28 deletions(-)
> 
> diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c
> index b1f774c..4161d2a 100644
> --- a/kernel/irq/irqdomain.c
> +++ b/kernel/irq/irqdomain.c
> @@ -333,6 +333,52 @@ void irq_set_default_host(struct irq_domain *domain)
>  }
>  EXPORT_SYMBOL_GPL(irq_set_default_host);
>  
> +static void irq_domain_disassociate_many(struct irq_domain *domain,
> +					 unsigned int irq_base, int count)
> +{
> +	/*
> +	 * disassociate in reverse order;
> +	 * not strictly necessary, but nice for unwinding
> +	 */
> +	while (count--) {
> +		int irq = irq_base + count;
> +		struct irq_data *irq_data = irq_get_irq_data(irq);
> +		irq_hw_number_t hwirq = irq_data->hwirq;
> +
> +		if (WARN_ON(!irq_data || irq_data->domain != domain))
> +			continue;
> +
> +		irq_set_status_flags(irq, IRQ_NOREQUEST);
> +
> +		/* remove chip and handler */
> +		irq_set_chip_and_handler(irq, NULL, NULL);
> +
> +		/* Make sure it's completed */
> +		synchronize_irq(irq);
> +
> +		/* Tell the PIC about it */
> +		if (domain->ops->unmap)
> +			domain->ops->unmap(domain, irq);
> +		smp_mb();
> +
> +		irq_data->domain = NULL;
> +		irq_data->hwirq = 0;
> +
> +		/* Clear reverse map */
> +		switch(domain->revmap_type) {
> +		case IRQ_DOMAIN_MAP_LINEAR:
> +			if (hwirq < domain->revmap_data.linear.size)
> +				domain->revmap_data.linear.revmap[hwirq] = 0;
> +			break;
> +		case IRQ_DOMAIN_MAP_TREE:
> +			mutex_lock(&revmap_trees_mutex);
> +			radix_tree_delete(&domain->revmap_data.tree, hwirq);
> +			mutex_unlock(&revmap_trees_mutex);
> +			break;
> +		}
> +	}
> +}
> +
>  static int irq_setup_virq(struct irq_domain *domain, unsigned int virq,
>  			    irq_hw_number_t hwirq)
>  {
> @@ -513,7 +559,6 @@ void irq_dispose_mapping(unsigned int virq)
>  {
>  	struct irq_data *irq_data = irq_get_irq_data(virq);
>  	struct irq_domain *domain;
> -	irq_hw_number_t hwirq;
>  
>  	if (!virq || !irq_data)
>  		return;
> @@ -526,33 +571,7 @@ void irq_dispose_mapping(unsigned int virq)
>  	if (domain->revmap_type == IRQ_DOMAIN_MAP_LEGACY)
>  		return;
>  
> -	irq_set_status_flags(virq, IRQ_NOREQUEST);
> -
> -	/* remove chip and handler */
> -	irq_set_chip_and_handler(virq, NULL, NULL);
> -
> -	/* Make sure it's completed */
> -	synchronize_irq(virq);
> -
> -	/* Tell the PIC about it */
> -	if (domain->ops->unmap)
> -		domain->ops->unmap(domain, virq);
> -	smp_mb();
> -
> -	/* Clear reverse map */
> -	hwirq = irq_data->hwirq;
> -	switch(domain->revmap_type) {
> -	case IRQ_DOMAIN_MAP_LINEAR:
> -		if (hwirq < domain->revmap_data.linear.size)
> -			domain->revmap_data.linear.revmap[hwirq] = 0;
> -		break;
> -	case IRQ_DOMAIN_MAP_TREE:
> -		mutex_lock(&revmap_trees_mutex);
> -		radix_tree_delete(&domain->revmap_data.tree, hwirq);
> -		mutex_unlock(&revmap_trees_mutex);
> -		break;
> -	}
> -
> +	irq_domain_disassociate_many(domain, virq, 1);
>  	irq_free_desc(virq);
>  }
>  EXPORT_SYMBOL_GPL(irq_dispose_mapping);



  reply	other threads:[~2012-06-16  5:58 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-16  5:01 [PATCH 00/12] irqdomain cleanup and refactoring Grant Likely
2012-06-16  5:01 ` [PATCH 01/12] irqdomain: Split disassociating code into separate function Grant Likely
2012-06-16  5:57   ` Benjamin Herrenschmidt [this message]
2012-06-16  5:01 ` [PATCH 02/12] irqdomain: Always update revmap when setting up a virq Grant Likely
2012-06-16  5:57   ` Benjamin Herrenschmidt
2012-06-16  5:01 ` [PATCH 03/12] irqdomain: Support for static IRQ mapping and association Grant Likely
2012-06-16  5:58   ` Benjamin Herrenschmidt
2012-06-17 22:16     ` Grant Likely
2012-06-16  5:01 ` [PATCH 04/12] irqdomain: Eliminate dedicated radix lookup functions Grant Likely
2012-06-16  5:56   ` Benjamin Herrenschmidt
2012-06-16  6:12     ` Grant Likely
2012-06-17 21:58       ` Grant Likely
2012-06-16  5:01 ` [PATCH 05/12] irqdomain: Fix irq_create_direct_mapping() to test irq_domain type Grant Likely
2012-06-16  5:01 ` [PATCH 06/12] irqdomain: eliminate slow-path revmap lookups Grant Likely
2012-06-16  5:01 ` [PATCH 07/12] irqdomain: Make ops->map hook optional Grant Likely
2012-06-16  5:59   ` Benjamin Herrenschmidt
2012-06-16  5:01 ` [PATCH 08/12] irqdomain: Replace LEGACY mapping with LINEAR Grant Likely
2012-06-16  6:01   ` Benjamin Herrenschmidt
2012-06-16  6:16     ` Grant Likely
2012-06-18 12:23       ` Mark Brown
2012-06-16  5:01 ` [PATCH 09/12] irqdomain: Reserve IRQs for legacy domain Grant Likely
2012-06-16  5:01 ` [PATCH 10/12] irqdomain: Add debugging message Grant Likely
2012-06-16  6:02   ` Benjamin Herrenschmidt
2012-06-16  5:01 ` [PATCH 11/12] irqdomain: reorganize revmap data Grant Likely
2012-06-16  6:06   ` Benjamin Herrenschmidt
2012-06-16  6:19     ` Grant Likely
2012-06-16  6:20       ` Grant Likely
2012-06-16  5:01 ` [PATCH 12/12] irqdomain: merge linear and tree reverse mappings Grant Likely
2012-06-18 12:28 ` [PATCH 00/12] irqdomain cleanup and refactoring Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1339826247.9220.219.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=grant.likely@secretlab.ca \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miltonm@bga.com \
    --cc=rob.herring@calxeda.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.