mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Samuel Ortiz <sameo@linux.intel.com>
Subject: [patch 05/10] mfd: htc-i2cpld: Cleanup interrupt handling
Date: Fri, 25 Mar 2011 11:12:29 -0000	[thread overview]
Message-ID: <20110325111218.061208160@linutronix.de> (raw)
In-Reply-To: <20110325110939.701487744@linutronix.de>

[-- Attachment #1: mfd-htc-i2.patch --]
[-- Type: text/plain, Size: 2647 bytes --]

Remove the pointless irq_desc check in set_type. This function is
called with that irq descriptor locked. Also remove the write back of
the flow type as the core code does this already when the return value
is 0.

Also store the flow type in the chip data structure, so there is no
need to fiddle in the irq descriptor.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
 drivers/mfd/htc-i2cpld.c |   25 +++++++------------------
 1 file changed, 7 insertions(+), 18 deletions(-)

Index: linux-2.6-tip/drivers/mfd/htc-i2cpld.c
===================================================================
--- linux-2.6-tip.orig/drivers/mfd/htc-i2cpld.c
+++ linux-2.6-tip/drivers/mfd/htc-i2cpld.c
@@ -58,6 +58,7 @@ struct htcpld_chip {
 	uint                    irq_start;
 	int                     nirqs;
 
+	unsigned int		flow_type;
 	/*
 	 * Work structure to allow for setting values outside of any
 	 * possible interrupt context
@@ -97,12 +98,7 @@ static void htcpld_unmask(struct irq_dat
 
 static int htcpld_set_type(struct irq_data *data, unsigned int flags)
 {
-	struct irq_desc *d = irq_to_desc(data->irq);
-
-	if (!d) {
-		pr_err("HTCPLD invalid IRQ: %d\n", data->irq);
-		return -EINVAL;
-	}
+	struct htcpld_chip *chip = irq_data_get_irq_chip_data(data);
 
 	if (flags & ~IRQ_TYPE_SENSE_MASK)
 		return -EINVAL;
@@ -111,9 +107,7 @@ static int htcpld_set_type(struct irq_da
 	if (flags & (IRQ_TYPE_LEVEL_LOW|IRQ_TYPE_LEVEL_HIGH))
 		return -EINVAL;
 
-	d->status &= ~IRQ_TYPE_SENSE_MASK;
-	d->status |= flags;
-
+	chip->flow_type = flags;
 	return 0;
 }
 
@@ -135,7 +129,6 @@ static irqreturn_t htcpld_handler(int ir
 	unsigned int i;
 	unsigned long flags;
 	int irqpin;
-	struct irq_desc *desc;
 
 	if (!htcpld) {
 		pr_debug("htcpld is null in ISR\n");
@@ -195,23 +188,19 @@ static irqreturn_t htcpld_handler(int ir
 		 * associated interrupts.
 		 */
 		for (irqpin = 0; irqpin < chip->nirqs; irqpin++) {
-			unsigned oldb, newb;
-			int flags;
+			unsigned oldb, newb, type = chip->flow_type;
 
 			irq = chip->irq_start + irqpin;
-			desc = irq_to_desc(irq);
-			flags = desc->status;
 
 			/* Run the IRQ handler, but only if the bit value
 			 * changed, and the proper flags are set */
 			oldb = (old_val >> irqpin) & 1;
 			newb = (uval >> irqpin) & 1;
 
-			if ((!oldb && newb && (flags & IRQ_TYPE_EDGE_RISING)) ||
-			    (oldb && !newb &&
-			     (flags & IRQ_TYPE_EDGE_FALLING))) {
+			if ((!oldb && newb && (type & IRQ_TYPE_EDGE_RISING)) ||
+			    (oldb && !newb && (type & IRQ_TYPE_EDGE_FALLING))) {
 				pr_debug("fire IRQ %d\n", irqpin);
-				desc->handle_irq(irq, desc);
+				generic_handle_irq(irq);
 			}
 		}
 	}



  parent reply	other threads:[~2011-03-25 11:14 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-25 11:12 [patch 00/10] mfd: irq cleanup and namespace conversion Thomas Gleixner
2011-03-25 11:12 ` [patch 01/10] mfd: asic3: Cleanup irq handling Thomas Gleixner
2011-03-25 11:12 ` [patch 03/10] mfd: ezx-pcap: Remvove open coded " Thomas Gleixner
2011-03-25 11:12 ` [patch 02/10] mfd: 88pm860x: Remove unused irq_desc leftovers Thomas Gleixner
2011-03-25 11:12 ` [patch 04/10] mfd: htc-egpio: Cleanup interrupt handling Thomas Gleixner
2011-03-25 11:12 ` Thomas Gleixner [this message]
2011-03-25 11:12 ` [patch 06/10] mfd: mx8925: Remove irq_desc leftovers Thomas Gleixner
2011-03-25 11:12 ` [patch 08/10] mfd: twl6030: Cleanup interrupt handling Thomas Gleixner
2011-03-25 11:12 ` [patch 07/10] mfd: twl4030: " Thomas Gleixner
2011-03-25 11:12 ` [patch 09/10] mfd: Cleanup irq namespace Thomas Gleixner
2011-03-25 12:08   ` Mark Brown
2011-03-25 12:33     ` Thomas Gleixner
2011-03-25 12:41       ` Mark Brown
2011-03-25 11:12 ` [patch 10/10] mfd: Fold irq_set_chip/irq_set_handler Thomas Gleixner

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=20110325111218.061208160@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sameo@linux.intel.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®