svn commit: r298739 - in head/sys: dev/gpio kern sys
Michal Meloun
mmel at FreeBSD.org
Thu Apr 28 12:04:14 UTC 2016
Author: mmel
Date: Thu Apr 28 12:04:12 2016
New Revision: 298739
URL: https://svnweb.freebsd.org/changeset/base/298739
Log:
INTRNG: Define 'INTR_IRQ_INVALID' constant and use it consistently
as error indicator.
Modified:
head/sys/dev/gpio/gpiobus.c
head/sys/kern/subr_intr.c
head/sys/sys/intr.h
Modified: head/sys/dev/gpio/gpiobus.c
==============================================================================
--- head/sys/dev/gpio/gpiobus.c Thu Apr 28 12:03:22 2016 (r298738)
+++ head/sys/dev/gpio/gpiobus.c Thu Apr 28 12:04:12 2016 (r298739)
@@ -90,7 +90,7 @@ gpio_alloc_intr_resource(device_t consum
* into it.
*/
irqnum = intr_gpio_map_irq(pin->dev, pin->pin, pin->flags, intr_mode);
- if (irqnum == 0xFFFFFFFF)
+ if (irqnum == INTR_IRQ_INVALID)
return (NULL);
return (bus_alloc_resource(consumer_dev, SYS_RES_IRQ, rid,
Modified: head/sys/kern/subr_intr.c
==============================================================================
--- head/sys/kern/subr_intr.c Thu Apr 28 12:03:22 2016 (r298738)
+++ head/sys/kern/subr_intr.c Thu Apr 28 12:04:12 2016 (r298739)
@@ -109,8 +109,6 @@ static struct mtx isrc_table_lock;
static struct intr_irqsrc *irq_sources[NIRQ];
u_int irq_next_free;
-#define IRQ_INVALID nitems(irq_sources)
-
/*
* XXX - All stuff around struct intr_dev_data is considered as temporary
* until better place for storing struct intr_map_data will be find.
@@ -138,7 +136,7 @@ static struct intr_dev_data *intr_ddata_
static u_int intr_ddata_first_unused;
#define IRQ_DDATA_BASE 10000
-CTASSERT(IRQ_DDATA_BASE > IRQ_INVALID);
+CTASSERT(IRQ_DDATA_BASE > nitems(irq_sources));
#ifdef SMP
static boolean_t irq_assign_cpu = FALSE;
@@ -399,7 +397,7 @@ isrc_free_irq(struct intr_irqsrc *isrc)
return (EINVAL);
irq_sources[isrc->isrc_irq] = NULL;
- isrc->isrc_irq = IRQ_INVALID; /* just to be safe */
+ isrc->isrc_irq = INTR_IRQ_INVALID; /* just to be safe */
return (0);
}
@@ -427,7 +425,7 @@ intr_isrc_register(struct intr_irqsrc *i
bzero(isrc, sizeof(struct intr_irqsrc));
isrc->isrc_dev = dev;
- isrc->isrc_irq = IRQ_INVALID; /* just to be safe */
+ isrc->isrc_irq = INTR_IRQ_INVALID; /* just to be safe */
isrc->isrc_flags = flags;
va_start(ap, fmt);
@@ -560,7 +558,7 @@ intr_acpi_map_irq(device_t dev, u_int ir
ddata = intr_ddata_alloc(0);
if (ddata == NULL)
- return (0xFFFFFFFF); /* no space left */
+ return (INTR_IRQ_INVALID); /* no space left */
ddata->idd_dev = dev;
ddata->idd_data.type = INTR_MAP_DATA_ACPI;
@@ -585,7 +583,7 @@ intr_fdt_map_irq(phandle_t node, pcell_t
cellsize = ncells * sizeof(*cells);
ddata = intr_ddata_alloc(cellsize);
if (ddata == NULL)
- return (0xFFFFFFFF); /* no space left */
+ return (INTR_IRQ_INVALID); /* no space left */
ddata->idd_xref = (intptr_t)node;
ddata->idd_data.type = INTR_MAP_DATA_FDT;
@@ -607,7 +605,7 @@ intr_gpio_map_irq(device_t dev, u_int pi
ddata = intr_ddata_alloc(0);
if (ddata == NULL)
- return (0xFFFFFFFF); /* no space left */
+ return (INTR_IRQ_INVALID); /* no space left */
ddata->idd_dev = dev;
ddata->idd_data.type = INTR_MAP_DATA_GPIO;
Modified: head/sys/sys/intr.h
==============================================================================
--- head/sys/sys/intr.h Thu Apr 28 12:03:22 2016 (r298738)
+++ head/sys/sys/intr.h Thu Apr 28 12:04:12 2016 (r298739)
@@ -32,6 +32,8 @@
#include <sys/systm.h>
+#define INTR_IRQ_INVALID 0xFFFFFFFF
+
enum intr_map_data_type {
INTR_MAP_DATA_ACPI,
INTR_MAP_DATA_FDT,
More information about the svn-src-head
mailing list