summaryrefslogtreecommitdiffstats
path: root/sys/arm/freescale
diff options
context:
space:
mode:
authorskra <skra@FreeBSD.org>2016-05-05 13:31:19 +0000
committerskra <skra@FreeBSD.org>2016-05-05 13:31:19 +0000
commitee35e1301377ddf7b2236efed36e044da05faa1a (patch)
tree3e504a67c1025ed66f3addbaa18d456e670fc7fb /sys/arm/freescale
parent93266297055f77bcef81e5f72468bc3b338f9e61 (diff)
downloadFreeBSD-src-ee35e1301377ddf7b2236efed36e044da05faa1a.zip
FreeBSD-src-ee35e1301377ddf7b2236efed36e044da05faa1a.tar.gz
INTRNG - redefine struct intr_map_data to avoid headers pollution. Each
struct associated with some type defined in enum intr_map_data_type must have struct intr_map_data on the top of its own definition now. When such structs are used, correct type and size must be filled in. There are three such structs defined in sys/intr.h now. Their definitions should be moved to corresponding headers by follow-up commits. While this change was propagated to all INTRNG like PICs, pic_map_intr() method implementations were corrected on some places. For this specific method, it's ensured by a caller that the 'data' argument passed to this method is never NULL. Also, the return error values were standardized there.
Diffstat (limited to 'sys/arm/freescale')
-rw-r--r--sys/arm/freescale/imx/imx_gpio.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/sys/arm/freescale/imx/imx_gpio.c b/sys/arm/freescale/imx/imx_gpio.c
index ba82f5c..c5f7b8c 100644
--- a/sys/arm/freescale/imx/imx_gpio.c
+++ b/sys/arm/freescale/imx/imx_gpio.c
@@ -225,13 +225,15 @@ gpio_pic_map_intr(device_t dev, struct intr_map_data *data,
{
int error;
u_int irq;
+ struct intr_map_data_fdt *daf;
struct imx51_gpio_softc *sc;
if (data->type != INTR_MAP_DATA_FDT)
return (ENOTSUP);
- error = gpio_pic_map_fdt(dev, data->fdt.ncells, data->fdt.cells, &irq,
- NULL, NULL);
+ daf = (struct intr_map_data_fdt *)data;
+ error = gpio_pic_map_fdt(dev, daf->ncells, daf->cells, &irq, NULL,
+ NULL);
if (error == 0) {
sc = device_get_softc(dev);
*isrcp = &sc->gpio_pic_irqsrc[irq].gi_isrc;
@@ -265,6 +267,7 @@ static int
gpio_pic_setup_intr(device_t dev, struct intr_irqsrc *isrc,
struct resource *res, struct intr_map_data *data)
{
+ struct intr_map_data_fdt *daf;
struct imx51_gpio_softc *sc;
struct gpio_irqsrc *gi;
int error, icfg;
@@ -278,8 +281,9 @@ gpio_pic_setup_intr(device_t dev, struct intr_irqsrc *isrc,
/* Get config for interrupt. */
if (data == NULL || data->type != INTR_MAP_DATA_FDT)
return (ENOTSUP);
- error = gpio_pic_map_fdt(dev, data->fdt.ncells, data->fdt.cells, &irq,
- &pol, &trig);
+ daf = (struct intr_map_data_fdt *)data;
+ error = gpio_pic_map_fdt(dev, daf->ncells, daf->cells, &irq, &pol,
+ &trig);
if (error != 0)
return (error);
if (gi->gi_irq != irq)
OpenPOWER on IntegriCloud