linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Thomas Gleixner <tglx@linutronix.de>,
	Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, linux-nvme@lists.infradead.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH 2/4] genirq: return the irq name from free_irq
Date: Thu, 13 Apr 2017 09:06:41 +0200	[thread overview]
Message-ID: <20170413070643.32165-3-hch@lst.de> (raw)
In-Reply-To: <20170413070643.32165-1-hch@lst.de>

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

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 include/linux/interrupt.h |  2 +-
 kernel/irq/manage.c       | 13 ++++++++++---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/include/linux/interrupt.h b/include/linux/interrupt.h
index 53144e78a369..a6fba4804672 100644
--- a/include/linux/interrupt.h
+++ b/include/linux/interrupt.h
@@ -155,7 +155,7 @@ extern int __must_check
 request_percpu_irq(unsigned int irq, irq_handler_t handler,
 		   const char *devname, void __percpu *percpu_dev_id);
 
-extern void free_irq(unsigned int, void *);
+extern const void *free_irq(unsigned int, void *);
 extern void free_percpu_irq(unsigned int, void __percpu *);
 
 struct device;
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
index 391cb738b2db..e688e7e06772 100644
--- a/kernel/irq/manage.c
+++ b/kernel/irq/manage.c
@@ -1574,20 +1574,27 @@ EXPORT_SYMBOL_GPL(remove_irq);
  *	have completed.
  *
  *	This function must not be called from interrupt context.
+ *
+ *	Returns the devname argument passed to request_irq.
  */
-void free_irq(unsigned int irq, void *dev_id)
+const void *free_irq(unsigned int irq, void *dev_id)
 {
 	struct irq_desc *desc = irq_to_desc(irq);
+	struct irqaction *action;
+	const char *devname;
 
 	if (!desc || WARN_ON(irq_settings_is_per_cpu_devid(desc)))
-		return;
+		return NULL;
 
 #ifdef CONFIG_SMP
 	if (WARN_ON(desc->affinity_notify))
 		desc->affinity_notify = NULL;
 #endif
 
-	kfree(__free_irq(irq, dev_id));
+	action = __free_irq(irq, dev_id);
+	devname = action->name;
+	kfree(action);
+	return devname;
 }
 EXPORT_SYMBOL(free_irq);
 
-- 
2.11.0

  parent reply	other threads:[~2017-04-13  7:07 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-13  7:06 provide pci_request_irq / pci_free_irq helpers Christoph Hellwig
2017-04-13  7:06 ` [PATCH 1/4] genirq: fix indentation in remove_irq Christoph Hellwig
2017-04-14 17:20   ` Thomas Gleixner
2017-04-20 13:25   ` Sagi Grimberg
2017-04-13  7:06 ` Christoph Hellwig [this message]
2017-04-14 17:28   ` [PATCH 2/4] genirq: return the irq name from free_irq Thomas Gleixner
2017-04-14 17:36     ` Christoph Hellwig
2017-04-14 17:53       ` Thomas Gleixner
2017-04-13  7:06 ` [PATCH 3/4] PCI/irq: add pci_request_irq and pci_free_irq helpers Christoph Hellwig
2017-04-14 14:46   ` Bjorn Helgaas
2017-04-14 15:58     ` Christoph Hellwig
2017-04-13  7:06 ` [PATCH 4/4] nvme/pci: switch to pci_request_irq Christoph Hellwig
2017-04-13 20:02   ` Keith Busch
2017-04-20 16:19     ` Sagi Grimberg
2017-04-18 18:45 ` provide pci_request_irq / pci_free_irq helpers Bjorn Helgaas

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=20170413070643.32165-3-hch@lst.de \
    --to=hch@lst.de \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --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 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).