aboutsummaryrefslogtreecommitdiff
path: root/sys/arm/nvidia
diff options
context:
space:
mode:
authorSvatopluk Kraus <skra@FreeBSD.org>2016-05-05 13:31:19 +0000
committerSvatopluk Kraus <skra@FreeBSD.org>2016-05-05 13:31:19 +0000
commitcd642c88a1957179fdc6843a6c7bd04ca238d625 (patch)
tree3e504a67c1025ed66f3addbaa18d456e670fc7fb /sys/arm/nvidia
parent15adccc6874c49592f8bcbef2f67232c7e2fd593 (diff)
downloadsrc-cd642c88a1957179fdc6843a6c7bd04ca238d625.tar.gz
src-cd642c88a1957179fdc6843a6c7bd04ca238d625.zip
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.
Notes
Notes: svn path=/head/; revision=299117
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 0b2b081a6977..7329ce046240 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);