summaryrefslogtreecommitdiffstats
path: root/sys/arm/nvidia
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/nvidia
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/nvidia')
-rw-r--r--sys/arm/nvidia/tegra_gpio.c42
1 files changed, 26 insertions, 16 deletions
diff --git a/sys/arm/nvidia/tegra_gpio.c b/sys/arm/nvidia/tegra_gpio.c
index 0b2b081..7329ce0 100644
--- a/sys/arm/nvidia/tegra_gpio.c
+++ b/sys/arm/nvidia/tegra_gpio.c
@@ -579,14 +579,19 @@ tegra_gpio_pic_map_intr(device_t dev, struct intr_map_data *data,
sc = device_get_softc(dev);
- if (data->type == INTR_MAP_DATA_FDT)
- rv = tegra_gpio_pic_map_fdt(sc, data->fdt.ncells,
- data->fdt.cells, &irq, NULL);
- else if (data->type == INTR_MAP_DATA_GPIO)
- rv = tegra_gpio_pic_map_gpio(sc, data->gpio.gpio_pin_num,
- data->gpio.gpio_pin_flags, data->gpio.gpio_intr_mode,
- &irq, NULL);
- else
+ if (data->type == INTR_MAP_DATA_FDT) {
+ struct intr_map_data_fdt *daf;
+
+ daf = (struct intr_map_data_fdt *)data;
+ rv = tegra_gpio_pic_map_fdt(sc, daf->ncells, daf->cells, &irq,
+ NULL);
+ } else if (data->type == INTR_MAP_DATA_GPIO) {
+ struct intr_map_data_gpio *dag;
+
+ dag = (struct intr_map_data_gpio *)data;
+ rv = tegra_gpio_pic_map_gpio(sc, dag->gpio_pin_num,
+ dag->gpio_pin_flags, dag->gpio_intr_mode, &irq, NULL);
+ } else
return (ENOTSUP);
if (rv == 0)
@@ -648,14 +653,19 @@ tegra_gpio_pic_setup_intr(device_t dev, struct intr_irqsrc *isrc,
return (ENOTSUP);
/* Get and check config for an interrupt. */
- if (data->type == INTR_MAP_DATA_FDT)
- rv = tegra_gpio_pic_map_fdt(sc, data->fdt.ncells,
- data->fdt.cells, &irq, &cfgreg);
- else if (data->type == INTR_MAP_DATA_GPIO)
- rv = tegra_gpio_pic_map_gpio(sc, data->gpio.gpio_pin_num,
- data->gpio.gpio_pin_flags, data->gpio.gpio_intr_mode,
- &irq, &cfgreg);
- else
+ if (data->type == INTR_MAP_DATA_FDT) {
+ struct intr_map_data_fdt *daf;
+
+ daf = (struct intr_map_data_fdt *)data;
+ rv = tegra_gpio_pic_map_fdt(sc, daf->ncells, daf->cells, &irq,
+ &cfgreg);
+ } else if (data->type == INTR_MAP_DATA_GPIO) {
+ struct intr_map_data_gpio *dag;
+
+ dag = (struct intr_map_data_gpio *)data;
+ rv = tegra_gpio_pic_map_gpio(sc, dag->gpio_pin_num,
+ dag->gpio_pin_flags, dag->gpio_intr_mode, &irq, &cfgreg);
+ } else
return (ENOTSUP);
if (rv != 0)
return (EINVAL);
OpenPOWER on IntegriCloud