Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Feb 2018 15:37:34 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r329372 - head/sys/compat/linuxkpi/common/include/linux
Message-ID:  <201802161537.w1GFbY8D059033@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Fri Feb 16 15:37:33 2018
New Revision: 329372
URL: https://svnweb.freebsd.org/changeset/base/329372

Log:
  Implement enable_irq() and disable_irq() in the LinuxKPI.
  
  MFC after:	1 week
  Submitted by:	Johannes Lundberg <johalun0@gmail.com>
  Sponsored by:	Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/interrupt.h

Modified: head/sys/compat/linuxkpi/common/include/linux/interrupt.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/interrupt.h	Fri Feb 16 15:20:21 2018	(r329371)
+++ head/sys/compat/linuxkpi/common/include/linux/interrupt.h	Fri Feb 16 15:37:33 2018	(r329372)
@@ -112,6 +112,38 @@ request_irq(unsigned int irq, irq_handler_t handler, u
 }
 
 static inline int
+enable_irq(unsigned int irq)
+{
+	struct irq_ent *irqe;
+	struct device *dev;
+
+	dev = linux_pci_find_irq_dev(irq);
+	if (dev == NULL)
+		return -EINVAL;
+	irqe = linux_irq_ent(dev, irq);
+	if (irqe == NULL)
+		return -EINVAL;
+	return -bus_setup_intr(dev->bsddev, irqe->res, INTR_TYPE_NET | INTR_MPSAFE,
+	    NULL, linux_irq_handler, irqe, &irqe->tag);
+}
+
+static inline void
+disable_irq(unsigned int irq)
+{
+	struct irq_ent *irqe;
+	struct device *dev;
+
+	dev = linux_pci_find_irq_dev(irq);
+	if (dev == NULL)
+		return;
+	irqe = linux_irq_ent(dev, irq);
+	if (irqe == NULL)
+		return;
+	bus_teardown_intr(dev->bsddev, irqe->res, irqe->tag);
+	irqe->tag = NULL;
+}
+
+static inline int
 bind_irq_to_cpu(unsigned int irq, int cpu_id)
 {
 	struct irq_ent *irqe;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201802161537.w1GFbY8D059033>