diff mbox

[2/4] genirq: return the irq name from free_irq

Message ID alpine.DEB.2.20.1704141920560.2327@nanos (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Thomas Gleixner April 14, 2017, 5:28 p.m. UTC
On Thu, 13 Apr 2017, Christoph Hellwig wrote:

> This allows callers to get back at them instead of having to store
> it in another variable.

Alternatively you tell the irq code to free it for you. Patch below.

Thanks,

	tglx

8<-----------------------

Comments

Christoph Hellwig April 14, 2017, 5:36 p.m. UTC | #1
On Fri, Apr 14, 2017 at 07:28:42PM +0200, Thomas Gleixner wrote:
> On Thu, 13 Apr 2017, Christoph Hellwig wrote:
> 
> > This allows callers to get back at them instead of having to store
> > it in another variable.
> 
> Alternatively you tell the irq code to free it for you. Patch below.

Yes, this should work to.  But I think having the same layer free
something they allocated again is a tad cleaner in terms of layering.

If you prefer this version I can respin the series.
Thomas Gleixner April 14, 2017, 5:53 p.m. UTC | #2
On Fri, 14 Apr 2017, Christoph Hellwig wrote:

> On Fri, Apr 14, 2017 at 07:28:42PM +0200, Thomas Gleixner wrote:
> > On Thu, 13 Apr 2017, Christoph Hellwig wrote:
> > 
> > > This allows callers to get back at them instead of having to store
> > > it in another variable.
> > 
> > Alternatively you tell the irq code to free it for you. Patch below.
> 
> Yes, this should work to.  But I think having the same layer free
> something they allocated again is a tad cleaner in terms of layering.

Fair enough. Was just a thought.

Bjorn, please route it through PCI alltogether.

For the whole series:

    Reviewed-by: Thomas Gleixner <tglx@linutronix.de>

Thanks,

	tglx
diff mbox

Patch

--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -60,7 +60,9 @@ 
  * IRQF_COND_SUSPEND - If the IRQ is shared with a NO_SUSPEND user, execute this
  *                interrupt handler after suspending interrupts. For system
  *                wakeup devices users need to implement wakeup detection in
- *                their interrupt handlers.
+ *                their interrupt handlers
+ * IRQF_FREE_NAME - Free the memory pointed to by the @name argument of
+ *		    request_irq() in free_irq()
  */
 #define IRQF_SHARED		0x00000080
 #define IRQF_PROBE_SHARED	0x00000100
@@ -74,6 +76,7 @@ 
 #define IRQF_NO_THREAD		0x00010000
 #define IRQF_EARLY_RESUME	0x00020000
 #define IRQF_COND_SUSPEND	0x00040000
+#define IRQF_FREE_NAME		0x00080000
 
 #define IRQF_TIMER		(__IRQF_TIMER | IRQF_NO_SUSPEND | IRQF_NO_THREAD)
 
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1542,6 +1542,8 @@  static struct irqaction *__free_irq(unsi
 	irq_chip_pm_put(&desc->irq_data);
 	module_put(desc->owner);
 	kfree(action->secondary);
+	if (action->flags & IRQF_FREE_NAME)
+		kfree(action->name);
 	return action;
 }