interrupts: new static IRQ API

The interrupt API has been redesigned:

- irq_connect() for dynamic interrupts renamed to irq_connect_dynamic().
  It will be used in situations where the new static irq_connect()
  won't work, i.e. the value of arguments can't be computed at build time
- a new API for static interrupts replaces irq_connect(). it is used
  exactly the same way as its dynamic counterpart. The old static irq
  macros will be removed
- Separate stub assembly files are no longer needed as the stubs are now
  generated inline with irq_connect()

ReST documentation updated for the changed API. Some detail about the
IDT in ROM added, and an oblique reference to the internal-only
_irq_handler_set() API removed; we don't talk about internal APIs in
the official documentation.

Change-Id: I280519993da0e0fe671eb537a876f67de33d3cd4
Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
diff --git a/drivers/adc/adc_dw.c b/drivers/adc/adc_dw.c
index 567b4d9..0321a55 100644
--- a/drivers/adc/adc_dw.c
+++ b/drivers/adc/adc_dw.c
@@ -53,7 +53,7 @@
 #else
 #define int_unmask(...) { ; }
 #endif
-static void adc_config_0_irq(struct device *dev);
+static void adc_config_0_irq(void);
 
 static void adc_goto_normal_mode_wo_calibration(void)
 {
@@ -259,7 +259,7 @@
 	sys_out32(ADC_INT_ENABLE & ~(ADC_CLK_ENABLE),
 		adc_base + ADC_CTRL);
 
-	config->config_func(dev);
+	config->config_func();
 
 	int_unmask(config->reg_irq_mask);
 	int_unmask(config->reg_err_mask);
@@ -340,8 +340,6 @@
 		.reg_base = PERIPH_ADDR_BASE_ADC,
 		.reg_irq_mask = SCSS_REGISTER_BASE + INT_SS_ADC_IRQ_MASK,
 		.reg_err_mask = SCSS_REGISTER_BASE + INT_SS_ADC_ERR_MASK,
-		.rx_vector = CONFIG_ADC_DW_0_RX_IRQ,
-		.err_vector = CONFIG_ADC_DW_0_ERR_IRQ,
 #ifdef CONFIG_ADC_DW_SINGLE_ENDED
 		.in_mode      = 0,
 #elif CONFIG_ADC_DW_DIFFERENTIAL
@@ -376,25 +374,14 @@
 SYS_DEFINE_DEVICE(adc_dw_0, &adc_info_dev_0, SECONDARY,
 					CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
 
-IRQ_CONNECT_STATIC(adc_dw_0_rx,
-		CONFIG_ADC_DW_0_RX_IRQ,
-		CONFIG_ADC_DW_0_PRI,
-		adc_dw_rx_isr,
-		SYS_GET_DEVICE(adc_dw_0), 0);
-
-IRQ_CONNECT_STATIC(adc_dw_0_err,
-		CONFIG_ADC_DW_0_ERR_IRQ,
-		CONFIG_ADC_DW_0_PRI,
-		adc_dw_err_isr,
-		SYS_GET_DEVICE(adc_dw_0), 0);
-
-static void adc_config_0_irq(struct device *dev)
+static void adc_config_0_irq(void)
 {
-	struct adc_config *config = dev->config->config_info;
+	irq_connect(CONFIG_ADC_DW_0_RX_IRQ, CONFIG_ADC_DW_0_PRI, adc_dw_rx_isr,
+		    SYS_GET_DEVICE(adc_dw_0), 0);
+	irq_enable(CONFIG_ADC_DW_0_RX_IRQ);
 
-	IRQ_CONFIG(adc_dw_0_rx, CONFIG_ADC_DW_0_RX_IRQ);
-	irq_enable(config->rx_vector);
-	IRQ_CONFIG(adc_dw_0_err, CONFIG_ADC_DW_0_ERR_IRQ);
-	irq_enable(config->err_vector);
+	irq_connect(CONFIG_ADC_DW_0_ERR_IRQ, CONFIG_ADC_DW_0_PRI,
+		    adc_dw_err_isr, SYS_GET_DEVICE(adc_dw_0), 0);
+	irq_enable(CONFIG_ADC_DW_0_ERR_IRQ);
 }
 #endif
diff --git a/drivers/adc/adc_dw.h b/drivers/adc/adc_dw.h
index 9a549b7..424005d 100644
--- a/drivers/adc/adc_dw.h
+++ b/drivers/adc/adc_dw.h
@@ -145,7 +145,7 @@
 #define ss_adc_data_to_mv(_data_, _resolution_) \
 	((_data_ * ADC_VREF) / (1 << _resolution_))
 
-typedef void (*adc_dw_config_t)(struct device *dev);
+typedef void (*adc_dw_config_t)(void);
 /** @brief ADC configuration
  * This structure defines the ADC configuration values
  * that define the ADC hardware instance and configuration.
@@ -157,10 +157,6 @@
 	uint32_t reg_irq_mask;
 	/**IIO address for the error mask register.*/
 	uint32_t reg_err_mask;
-	/**Interruption vector for the reception ISR.*/
-	uint8_t  rx_vector;
-	/**Interruption vector for the error ISR.*/
-	uint8_t  err_vector;
 	/**Input mode*/
 	uint8_t  in_mode;
 	/**Output mode*/
diff --git a/drivers/aio/Makefile b/drivers/aio/Makefile
index 3f0ec5a..ffe5ab2 100644
--- a/drivers/aio/Makefile
+++ b/drivers/aio/Makefile
@@ -1 +1 @@
-obj-$(CONFIG_AIO_DW_COMPARATOR) += aio_dw_comparator.o aio_static_irq_stubs.o
+obj-$(CONFIG_AIO_DW_COMPARATOR) += aio_dw_comparator.o
diff --git a/drivers/aio/aio_dw_comparator.c b/drivers/aio/aio_dw_comparator.c
index f5ed27f..7484d64 100644
--- a/drivers/aio/aio_dw_comparator.c
+++ b/drivers/aio/aio_dw_comparator.c
@@ -213,20 +213,11 @@
 SYS_DEFINE_DEVICE(dw_aio_cmp, &dw_aio_cmp_dev_data, SECONDARY,
 	CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
 
-struct device *dw_aio_cmp_device = SYS_GET_DEVICE(dw_aio_cmp);
-
-IRQ_CONNECT_STATIC(dw_aio_cmp,
-		   INT_AIO_CMP_IRQ,
-		   0,
-		   dw_aio_cmp_isr,
-		   0,
-		   0);
-
 static int dw_aio_cmp_config(struct device *dev)
 {
 	ARG_UNUSED(dev);
 
-	IRQ_CONFIG(dw_aio_cmp, INT_AIO_CMP_IRQ);
-
+	irq_connect(INT_AIO_CMP_IRQ, 0, dw_aio_cmp_isr,
+		    SYS_GET_DEVICE(dw_aio_cmp), 0);
 	return DEV_OK;
 }
diff --git a/drivers/aio/aio_static_irq_stubs.S b/drivers/aio/aio_static_irq_stubs.S
deleted file mode 100644
index bd9fe78..0000000
--- a/drivers/aio/aio_static_irq_stubs.S
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2015, Intel Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file
- * @brief AIO interrupt stubs
- * This module contains the static interrupt stubs for the aio driver
- */
-
-#define _ASMLANGUAGE
-
-#ifdef CONFIG_X86
-#include <arch/x86/asm.h>
-#include <drivers/ioapic.h>
-#endif
-
-#if defined(CONFIG_AIO_DW_COMPARATOR)
-#if defined(CONFIG_IOAPIC)
-	ioapic_mkstub dw_aio_cmp dw_aio_cmp_isr dw_aio_cmp_device
-#endif
-#endif /* CONFIG_AIO_DW_COMPARATOR */
diff --git a/drivers/bluetooth/Makefile b/drivers/bluetooth/Makefile
index 07e319f..f9bcca3 100644
--- a/drivers/bluetooth/Makefile
+++ b/drivers/bluetooth/Makefile
@@ -1,2 +1,2 @@
-obj-$(CONFIG_BLUETOOTH_H4) += h4.o uart_static_irq_stubs.o
-obj-$(CONFIG_BLUETOOTH_H5) += h5.o uart_static_irq_stubs.o
+obj-$(CONFIG_BLUETOOTH_H4) += h4.o
+obj-$(CONFIG_BLUETOOTH_H5) += h5.o
diff --git a/drivers/bluetooth/h4.c b/drivers/bluetooth/h4.c
index 32a9387..192cb17 100644
--- a/drivers/bluetooth/h4.c
+++ b/drivers/bluetooth/h4.c
@@ -218,17 +218,14 @@
 	return 0;
 }
 
-IRQ_CONNECT_STATIC(bluetooth, CONFIG_BLUETOOTH_UART_IRQ,
-		   CONFIG_BLUETOOTH_UART_IRQ_PRI, bt_uart_isr, 0,
-		   UART_IRQ_FLAGS);
-
 static int h4_open(void)
 {
 	BT_DBG("");
 
 	uart_irq_rx_disable(h4_dev);
 	uart_irq_tx_disable(h4_dev);
-	IRQ_CONFIG(bluetooth, CONFIG_BLUETOOTH_UART_IRQ);
+	irq_connect(CONFIG_BLUETOOTH_UART_IRQ, CONFIG_BLUETOOTH_UART_IRQ_PRI,
+		    bt_uart_isr, 0, UART_IRQ_FLAGS);
 	irq_enable(CONFIG_BLUETOOTH_UART_IRQ);
 
 	/* Drain the fifo */
diff --git a/drivers/bluetooth/h5.c b/drivers/bluetooth/h5.c
index 6a4d523..1dac1ee 100644
--- a/drivers/bluetooth/h5.c
+++ b/drivers/bluetooth/h5.c
@@ -768,17 +768,15 @@
 	nano_fifo_init(&h5.unack_queue);
 }
 
-IRQ_CONNECT_STATIC(bluetooth, CONFIG_BLUETOOTH_UART_IRQ,
-		   CONFIG_BLUETOOTH_UART_IRQ_PRI, bt_uart_isr, 0,
-		   UART_IRQ_FLAGS);
-
 static int h5_open(void)
 {
 	BT_DBG("");
 
 	uart_irq_rx_disable(h5_dev);
 	uart_irq_tx_disable(h5_dev);
-	IRQ_CONFIG(bluetooth, CONFIG_BLUETOOTH_UART_IRQ);
+
+	irq_connect(CONFIG_BLUETOOTH_UART_IRQ, CONFIG_BLUETOOTH_UART_IRQ_PRI,
+		    bt_uart_isr, 0, UART_IRQ_FLAGS);
 	irq_enable(CONFIG_BLUETOOTH_UART_IRQ);
 
 	/* Drain the fifo */
diff --git a/drivers/bluetooth/uart_static_irq_stubs.S b/drivers/bluetooth/uart_static_irq_stubs.S
deleted file mode 100644
index de9e19f..0000000
--- a/drivers/bluetooth/uart_static_irq_stubs.S
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2015, Intel Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file
- * @brief Bluetooth UART interrupt stubs
- */
-
-#ifdef CONFIG_X86
-
-#define _ASMLANGUAGE
-
-#include <arch/x86/asm.h>
-#include <drivers/ioapic.h>
-#include <drivers/loapic.h>
-
-#if defined(CONFIG_BLUETOOTH_UART)
-#if defined(CONFIG_IOAPIC)
-	ioapic_mkstub bluetooth bt_uart_isr 0
-#endif /* CONFIG_IOAPIC */
-#endif /* CONFIG_BLUETOOTH_UART */
-
-#undef _ASMLANGUAGE
-
-#endif /* CONFIG_X86 */
diff --git a/drivers/console/Makefile b/drivers/console/Makefile
index de2e6ba..c456b47 100644
--- a/drivers/console/Makefile
+++ b/drivers/console/Makefile
@@ -1,6 +1,6 @@
 obj-$(CONFIG_CONSOLE_HANDLER_SHELL) += console_handler_shell.o
-obj-$(CONFIG_UART_CONSOLE) += uart_console.o uart_console_static_irq_stubs.o
+obj-$(CONFIG_UART_CONSOLE) += uart_console.o
 obj-$(CONFIG_RAM_CONSOLE) += ram_console.o
 obj-$(CONFIG_IPM_CONSOLE_RECEIVER) += ipm_console_receiver.o
 obj-$(CONFIG_IPM_CONSOLE_SENDER) += ipm_console_sender.o
-obj-$(CONFIG_UART_PIPE) += uart_pipe.o uart_console_static_irq_stubs.o
+obj-$(CONFIG_UART_PIPE) += uart_pipe.o
diff --git a/drivers/console/uart_console.c b/drivers/console/uart_console.c
index b05c384..645c5d0 100644
--- a/drivers/console/uart_console.c
+++ b/drivers/console/uart_console.c
@@ -366,17 +366,14 @@
 	}
 }
 
-IRQ_CONNECT_STATIC(console, CONFIG_UART_CONSOLE_IRQ,
-		   CONFIG_UART_CONSOLE_IRQ_PRI, uart_console_isr, 0,
-		   UART_IRQ_FLAGS);
-
 static void console_input_init(void)
 {
 	uint8_t c;
 
 	uart_irq_rx_disable(uart_console_dev);
 	uart_irq_tx_disable(uart_console_dev);
-	IRQ_CONFIG(console, CONFIG_UART_CONSOLE_IRQ);
+	irq_connect(CONFIG_UART_CONSOLE_IRQ, CONFIG_UART_CONSOLE_IRQ_PRI,
+		    uart_console_isr, 0, UART_IRQ_FLAGS);
 	irq_enable(CONFIG_UART_CONSOLE_IRQ);
 
 	/* Drain the fifo */
diff --git a/drivers/console/uart_console_static_irq_stubs.S b/drivers/console/uart_console_static_irq_stubs.S
deleted file mode 100644
index 2d9ff9b..0000000
--- a/drivers/console/uart_console_static_irq_stubs.S
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (c) 2015, Intel Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file
- * @brief UART console interrupt stubs
- */
-
-#ifdef CONFIG_X86
-
-#define _ASMLANGUAGE
-
-#include <arch/x86/asm.h>
-#include <drivers/ioapic.h>
-#include <drivers/loapic.h>
-
-#if defined(CONFIG_CONSOLE_HANDLER)
-#if defined(CONFIG_IOAPIC) || defined(CONFIG_MVIC)
-	ioapic_mkstub console uart_console_isr 0
-#endif /* CONFIG_IOAPIC */
-#endif /* CONFIG_CONSOLE_HANDLER */
-
-#if defined(CONFIG_UART_PIPE)
-#if defined(CONFIG_IOAPIC) || defined(CONFIG_MVIC)
-	ioapic_mkstub uart_pipe uart_pipe_isr 0
-#endif /* CONFIG_IOAPIC */
-#endif /* CONFIG_UART_PIPE */
-
-#undef _ASMLANGUAGE
-
-#endif /* CONFIG_X86 */
diff --git a/drivers/console/uart_pipe.c b/drivers/console/uart_pipe.c
index 5a3ff14..bd7aa2f 100644
--- a/drivers/console/uart_pipe.c
+++ b/drivers/console/uart_pipe.c
@@ -72,15 +72,13 @@
 	}
 }
 
-IRQ_CONNECT_STATIC(uart_pipe, CONFIG_UART_PIPE_IRQ,
-		   CONFIG_UART_PIPE_IRQ_PRI, uart_pipe_isr, 0,
-		   UART_IRQ_FLAGS);
-
 static void uart_pipe_setup(struct device *uart)
 {
 	uart_irq_rx_disable(uart);
 	uart_irq_tx_disable(uart);
-	IRQ_CONFIG(uart_pipe, CONFIG_UART_PIPE_IRQ);
+
+	irq_connect(CONFIG_UART_PIPE_IRQ, CONFIG_UART_PIPE_IRQ_PRI,
+		    uart_pipe_isr, 0, UART_IRQ_FLAGS);
 	irq_enable(CONFIG_UART_PIPE_IRQ);
 
 	/* Drain the fifo */
diff --git a/drivers/ethernet/Makefile b/drivers/ethernet/Makefile
index e8858c1..b918a82 100644
--- a/drivers/ethernet/Makefile
+++ b/drivers/ethernet/Makefile
@@ -3,4 +3,4 @@
 ccflags-y += -I${srctree}/net/ip/contiki/os
 ccflags-y += -I${srctree}
 
-obj-$(CONFIG_ETH_DW) += eth_dw.o eth_static_irq_stubs.o
+obj-$(CONFIG_ETH_DW) += eth_dw.o
diff --git a/drivers/ethernet/eth_dw.c b/drivers/ethernet/eth_dw.c
index 413398e..10c68d1 100644
--- a/drivers/ethernet/eth_dw.c
+++ b/drivers/ethernet/eth_dw.c
@@ -313,11 +313,6 @@
 	return eth_tx(&__initconfig_eth_dw_0, buf);
 }
 
-#ifdef CONFIG_ETH_DW_0_IRQ_DIRECT
-IRQ_CONNECT_STATIC(eth_dw_0, CONFIG_ETH_DW_0_IRQ,
-		   CONFIG_ETH_DW_0_PRI, eth_dw_isr, 0);
-#endif
-
 static void eth_config_0_irq(struct device *port)
 {
 	struct eth_config *config = port->config->config_info;
@@ -325,8 +320,9 @@
 
 #ifdef CONFIG_ETH_DW_0_IRQ_DIRECT
 	ARG_UNUSED(shared_irq_dev);
-	IRQ_CONFIG(eth_dw_0, config->irq_num);
-	irq_enable(config->irq_num);
+	irq_connect(CONFIG_ETH_DW_0_IRQ, CONFIG_ETH_DW_0_PRI, eth_dw_isr,
+		    SYS_GET_DEVICE(eth_dw_0), 0);
+	irq_enable(CONFIG_ETH_DW_0_IRQ);
 #elif defined(CONFIG_ETH_DW_0_IRQ_SHARED)
 	shared_irq_dev = device_get_binding(config->shared_irq_dev_name);
 	__ASSERT(shared_irq_dev != NULL, "Failed to get eth_dw device binding");
@@ -334,9 +330,4 @@
 	shared_irq_enable(shared_irq_dev, port);
 #endif
 }
-
-#ifdef CONFIG_ETH_DW_0_IRQ_DIRECT
-struct device *eth_dw_isr_0 = SYS_GET_DEVICE(eth_dw_0);
-#endif  /* CONFIG_ETH_DW_0_IRQ_DIRECT */
-
 #endif  /* CONFIG_ETH_DW_0 */
diff --git a/drivers/ethernet/eth_static_irq_stubs.S b/drivers/ethernet/eth_static_irq_stubs.S
deleted file mode 100644
index 6a7774f..0000000
--- a/drivers/ethernet/eth_static_irq_stubs.S
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (c) 2015, Intel Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file
- * @brief Ethernet interrupt stubs
- * This module contains the static interrupt stubs for Ethernet drivers.
- */
-
-#define _ASMLANGUAGE
-
-#ifdef CONFIG_X86
-#include <arch/x86/asm.h>
-#include <drivers/ioapic.h>
-#endif
-
-#if defined(CONFIG_ETH_DW)
-#if CONFIG_ETH_DW_0
-	ioapic_mkstub eth_dw_0 eth_dw_isr eth_dw_isr_0
-#endif /* CONFIG_ETH_DW_0 */
-#endif /* CONFIG_ETH_DW */
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 9222d97..7307e91 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -1,6 +1,5 @@
 ccflags-y +=-I$(srctree)/drivers
 
-obj-$(CONFIG_GPIO) += gpio_static_irq_stubs.o
 obj-$(CONFIG_GPIO_DW) += gpio_dw.o
 obj-$(CONFIG_GPIO_PCAL9535A) += gpio_pcal9535a.o
 obj-$(CONFIG_GPIO_MMIO) += gpio_mmio.o
diff --git a/drivers/gpio/gpio_dw.c b/drivers/gpio/gpio_dw.c
index b9053b8..fe08eb3 100644
--- a/drivers/gpio/gpio_dw.c
+++ b/drivers/gpio/gpio_dw.c
@@ -454,14 +454,12 @@
 
 struct gpio_dw_runtime gpio_0_runtime;
 
-DECLARE_DEVICE_INIT_CONFIG(gpio_0, CONFIG_GPIO_DW_0_NAME,
+DECLARE_DEVICE_INIT_CONFIG(gpio_dw_0, CONFIG_GPIO_DW_0_NAME,
 			   gpio_dw_initialize, &gpio_config_0);
-SYS_DEFINE_DEVICE(gpio_0, &gpio_0_runtime, SECONDARY,
+SYS_DEFINE_DEVICE(gpio_dw_0, &gpio_0_runtime, SECONDARY,
 		  CONFIG_GPIO_DW_INIT_PRIORITY);
 
 #ifdef CONFIG_GPIO_DW_0_IRQ_DIRECT
-struct device *gpio_dw_isr_0 = SYS_GET_DEVICE(gpio_0);
-
 #ifdef CONFIG_IOAPIC
 #ifdef CONFIG_GPIO_DW_0
 	#if defined(CONFIG_GPIO_DW_0_FALLING_EDGE)
@@ -477,11 +475,6 @@
 #else
 	#define GPIO_DW_0_IRQ_FLAGS 0
 #endif
-
-IRQ_CONNECT_STATIC(gpio_dw_0, CONFIG_GPIO_DW_0_IRQ,
-		   CONFIG_GPIO_DW_0_PRI, gpio_dw_isr,
-		   SYS_GET_DEVICE(gpio_0),
-		   GPIO_DW_0_IRQ_FLAGS);
 #endif
 
 void gpio_config_0_irq(struct device *port)
@@ -491,7 +484,8 @@
 
 #ifdef CONFIG_GPIO_DW_0_IRQ_DIRECT
 	ARG_UNUSED(shared_irq_dev);
-	IRQ_CONFIG(gpio_dw_0, config->irq_num);
+	irq_connect(CONFIG_GPIO_DW_0_IRQ, CONFIG_GPIO_DW_0_PRI, gpio_dw_isr,
+		    SYS_GET_DEVICE(gpio_dw_0), GPIO_DW_0_IRQ_FLAGS);
 	irq_enable(config->irq_num);
 #elif defined(CONFIG_GPIO_DW_0_IRQ_SHARED)
 	shared_irq_dev = device_get_binding(config->shared_irq_dev_name);
@@ -534,15 +528,13 @@
 
 struct gpio_dw_runtime gpio_1_runtime;
 
-DECLARE_DEVICE_INIT_CONFIG(gpio_1, CONFIG_GPIO_DW_1_NAME,
+DECLARE_DEVICE_INIT_CONFIG(gpio_dw_1, CONFIG_GPIO_DW_1_NAME,
 			   gpio_dw_initialize, &gpio_dw_config_1);
 
-SYS_DEFINE_DEVICE(gpio_1, &gpio_1_runtime, SECONDARY,
+SYS_DEFINE_DEVICE(gpio_dw_1, &gpio_1_runtime, SECONDARY,
 		  CONFIG_GPIO_DW_INIT_PRIORITY);
 
 #ifdef CONFIG_GPIO_DW_1_IRQ_DIRECT
-struct device *gpio_dw_isr_1 = SYS_GET_DEVICE(gpio_1);
-
 #ifdef CONFIG_IOAPIC
 #ifdef CONFIG_GPIO_DW_1
 	#if defined(CONFIG_GPIO_DW_1_FALLING_EDGE)
@@ -558,11 +550,6 @@
 #else
 	#define GPIO_DW_1_IRQ_FLAGS 0
 #endif
-
-IRQ_CONNECT_STATIC(gpio_dw_1, CONFIG_GPIO_DW_1_IRQ,
-		   CONFIG_GPIO_DW_1_PRI, gpio_dw_isr,
-		   SYS_GET_DEVICE(gpio_1),
-		   GPIO_DW_1_IRQ_FLAGS);
 #endif
 
 void gpio_config_1_irq(struct device *port)
@@ -572,7 +559,8 @@
 
 #ifdef CONFIG_GPIO_DW_1_IRQ_DIRECT
 	ARG_UNUSED(shared_irq_dev);
-	IRQ_CONFIG(gpio_dw_1, config->irq_num);
+	irq_connect(CONFIG_GPIO_DW_1_IRQ, CONFIG_GPIO_DW_1_PRI, gpio_dw_isr,
+		    SYS_GET_DEVICE(gpio_dw_1), GPIO_DW_1_IRQ_FLAGS);
 	irq_enable(config->irq_num);
 #elif defined(CONFIG_GPIO_DW_1_IRQ_SHARED)
 	shared_irq_dev = device_get_binding(config->shared_irq_dev_name);
diff --git a/drivers/gpio/gpio_static_irq_stubs.S b/drivers/gpio/gpio_static_irq_stubs.S
deleted file mode 100644
index 0deb799..0000000
--- a/drivers/gpio/gpio_static_irq_stubs.S
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2015, Intel Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file
- * @brief GPIO interrupt stubs
- * This module contains the static interrupt stubs for the gpio drivers
- */
-
-#define _ASMLANGUAGE
-
-#ifdef CONFIG_X86
-#include <arch/x86/asm.h>
-#include <drivers/ioapic.h>
-#endif
-
-
-#ifdef CONFIG_GPIO_DW_0
-#ifdef CONFIG_IOAPIC
-	ioapic_mkstub gpio_dw_0 gpio_dw_isr gpio_dw_isr_0
-#endif
-#endif /* CONFIG_GPIO_DW_0 */
-
-#ifdef CONFIG_GPIO_DW_1
-#ifdef CONFIG_IOAPIC
-	ioapic_mkstub gpio_dw_1 gpio_dw_isr gpio_dw_isr_1
-#endif
-#endif /* CONFIG_GPIO_DW_1 */
diff --git a/drivers/i2c/Makefile b/drivers/i2c/Makefile
index 424ecc7..a674097 100644
--- a/drivers/i2c/Makefile
+++ b/drivers/i2c/Makefile
@@ -1,2 +1,2 @@
-obj-$(CONFIG_I2C_DW) += i2c_dw.o i2c_static_irq_stubs.o
+obj-$(CONFIG_I2C_DW) += i2c_dw.o
 obj-$(CONFIG_I2C_QUARK_SE_SS) += i2c_quark_se_ss.o
diff --git a/drivers/i2c/i2c_dw.c b/drivers/i2c/i2c_dw.c
index a4a4703..2caa437 100644
--- a/drivers/i2c/i2c_dw.c
+++ b/drivers/i2c/i2c_dw.c
@@ -779,16 +779,6 @@
 			   &i2c_config_dw_0);
 
 SYS_DEFINE_DEVICE(i2c_0, &i2c_0_runtime, SECONDARY, CONFIG_I2C_INIT_PRIORITY);
-struct device *i2c_dw_isr_0_device = SYS_GET_DEVICE(i2c_0);
-
-#ifdef CONFIG_I2C_DW_0_IRQ_DIRECT
-IRQ_CONNECT_STATIC(i2c_dw_0,
-		   CONFIG_I2C_DW_0_IRQ,
-		   CONFIG_I2C_DW_0_INT_PRIORITY,
-		   i2c_dw_isr,
-		   SYS_GET_DEVICE(i2c_0),
-		   I2C_DW_IRQ_FLAGS);
-#endif
 
 void i2c_config_0(struct device *port)
 {
@@ -797,7 +787,8 @@
 
 #if defined(CONFIG_I2C_DW_0_IRQ_DIRECT)
 	ARG_UNUSED(shared_irq_dev);
-	IRQ_CONFIG(i2c_dw_0, config->irq_num);
+	irq_connect(CONFIG_I2C_DW_0_IRQ, CONFIG_I2C_DW_0_INT_PRIORITY,
+		    i2c_dw_isr, SYS_GET_DEVICE(i2c_0), I2C_DW_IRQ_FLAGS);
 	irq_enable(config->irq_num);
 #elif defined(CONFIG_I2C_DW_0_IRQ_SHARED)
 	ARG_UNUSED(config);
@@ -842,14 +833,6 @@
 
 SYS_DEFINE_DEVICE(i2c_1, &i2c_1_runtime, SECONDARY,
 					CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
-struct device *i2c_dw_isr_1_device = SYS_GET_DEVICE(i2c_1);
-
-IRQ_CONNECT_STATIC(i2c_dw_1,
-		   CONFIG_I2C_DW_1_IRQ,
-		   CONFIG_I2C_DW_1_INT_PRIORITY,
-		   i2c_dw_isr,
-		   SYS_GET_DEVICE(i2c_1),
-		   I2C_DW_IRQ_FLAGS);
 
 void i2c_config_1(struct device *port)
 {
@@ -857,7 +840,8 @@
 	struct device *shared_irq_dev;
 
 	ARG_UNUSED(shared_irq_dev);
-	IRQ_CONFIG(i2c_dw_1, config->irq_num);
+	irq_connect(CONFIG_I2C_DW_1_IRQ, CONFIG_I2C_DW_1_INT_PRIORITY,
+		    i2c_dw_isr, SYS_GET_DEVICE(i2c_1), I2C_DW_IRQ_FLAGS);
 	irq_enable(config->irq_num);
 }
 
diff --git a/drivers/i2c/i2c_quark_se_ss.c b/drivers/i2c/i2c_quark_se_ss.c
index 9a9ccc8..3947f73 100644
--- a/drivers/i2c/i2c_quark_se_ss.c
+++ b/drivers/i2c/i2c_quark_se_ss.c
@@ -668,10 +668,10 @@
 	_i2c_qse_ss_memory_write(SCSS_REGISTER_BASE, rom->isr_stop_mask, mask);
 
 	/* Connect the IRQs to ISR */
-	irq_connect(rom->isr_err_vector, 1, i2c_qse_ss_isr, port, 0);
-	irq_connect(rom->isr_rx_vector, 1, i2c_qse_ss_isr, port, 0);
-	irq_connect(rom->isr_tx_vector, 1, i2c_qse_ss_isr, port, 0);
-	irq_connect(rom->isr_stop_vector, 1, i2c_qse_ss_isr, port, 0);
+	irq_connect_dynamic(rom->isr_err_vector, 1, i2c_qse_ss_isr, port, 0);
+	irq_connect_dynamic(rom->isr_rx_vector, 1, i2c_qse_ss_isr, port, 0);
+	irq_connect_dynamic(rom->isr_tx_vector, 1, i2c_qse_ss_isr, port, 0);
+	irq_connect_dynamic(rom->isr_stop_vector, 1, i2c_qse_ss_isr, port, 0);
 
 	irq_enable(rom->isr_err_vector);
 	irq_enable(rom->isr_rx_vector);
diff --git a/drivers/i2c/i2c_static_irq_stubs.S b/drivers/i2c/i2c_static_irq_stubs.S
deleted file mode 100644
index 85a87cb..0000000
--- a/drivers/i2c/i2c_static_irq_stubs.S
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2015, Intel Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * @file
- * @brief I2C interrupt stubs
- * This module contains the static interrupt stubs for the i2c drivers
- */
-
-#define _ASMLANGUAGE
-
-#ifdef CONFIG_X86
-#include <arch/x86/asm.h>
-#include <drivers/ioapic.h>
-#endif
-
-#if defined(CONFIG_I2C_DW_0)
-#if defined(CONFIG_IOAPIC) || defined(CONFIG_MVIC)
-    ioapic_mkstub i2c_dw_0 i2c_dw_isr i2c_dw_isr_0_device
-#endif
-#endif /* CONFIG_I2C_DW_0 */
-
-#if defined(CONFIG_I2C_DW_1)
-#if defined(CONFIG_IOAPIC) || defined(CONFIG_MVIC)
-    ioapic_mkstub i2c_dw_1 i2c_dw_isr i2c_dw_isr_1_device
-#endif
-#endif /* CONFIG_I2C_DW_1 */
-
-
diff --git a/drivers/interrupt_controller/ioapic_intr.c b/drivers/interrupt_controller/ioapic_intr.c
index e241b93..ed6ab5f 100644
--- a/drivers/interrupt_controller/ioapic_intr.c
+++ b/drivers/interrupt_controller/ioapic_intr.c
@@ -113,7 +113,7 @@
 
 	/*
 	 * Initialize the redirection table entries with default settings;
-	 * actual interrupt vectors are specified during irq_connect().
+	 * actual interrupt vectors are specified during irq_connect_dynamic().
 	 *
 	 * A future enhancement should make this initialization "table driven":
 	 * use data provided by the platform to specify the initial state
diff --git a/drivers/interrupt_controller/loapic_intr.c b/drivers/interrupt_controller/loapic_intr.c
index 7a77c3c..8b83d9e 100644
--- a/drivers/interrupt_controller/loapic_intr.c
+++ b/drivers/interrupt_controller/loapic_intr.c
@@ -302,7 +302,7 @@
  * @brief Set the vector field in the specified RTE
  *
  * This routine is utilized by the interrupt controller's _SysIntVecAlloc()
- * routine (which exists to support the irq_connect() API).  Once
+ * routine (which exists to support the irq_connect_dynamic() API).  Once
  * a vector has been allocated, this routine is invoked to update the LVT
  * entry associated with <irq> with the vector.
  *
diff --git a/drivers/interrupt_controller/system_apic.c b/drivers/interrupt_controller/system_apic.c
index 9a71403..49af28a 100644
--- a/drivers/interrupt_controller/system_apic.c
+++ b/drivers/interrupt_controller/system_apic.c
@@ -61,8 +61,8 @@
  *
  * @brief Allocate interrupt vector
  *
- * This routine is used by the x86's irq_connect().  It performs the following
- * functions:
+ * This routine is used by the x86's irq_connect_dynamic().  It performs the
+ * following functions:
  *
  *  a) Allocates a vector satisfying the requested priority.  The utility
  *     routine _IntVecAlloc() provided by the nanokernel will be used to
diff --git a/drivers/ipm/Makefile b/drivers/ipm/Makefile
index ff8c312..7c618ba 100644
--- a/drivers/ipm/Makefile
+++ b/drivers/ipm/Makefile
@@ -1,4 +1,4 @@
 ccflags-y += -I$(srctree/drivers)
 
-obj-$(CONFIG_IPM_QUARK_SE) += ipm_quark_se.o ipm_static_irq_stubs.o
+obj-$(CONFIG_IPM_QUARK_SE) += ipm_quark_se.o
 
diff --git a/drivers/ipm/ipm_static_irq_stubs.S b/drivers/ipm/ipm_static_irq_stubs.S
deleted file mode 100644
index 4694cb5..0000000
--- a/drivers/ipm/ipm_static_irq_stubs.S
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2015, Intel Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define _ASMLANGUAGE
-
-#ifdef CONFIG_X86
-#include <arch/x86/asm.h>
-#include <drivers/ioapic.h>
-#endif
-
-#if defined(CONFIG_IPM_QUARK_SE)
-#if defined(CONFIG_IOAPIC)
-        ioapic_mkstub quark_se_ipm quark_se_ipm_isr 0
-#endif
-#endif
diff --git a/drivers/rtc/Makefile b/drivers/rtc/Makefile
index 35115e6..e1aa56b 100644
--- a/drivers/rtc/Makefile
+++ b/drivers/rtc/Makefile
@@ -1,5 +1,4 @@
 ccflags-$(CONFIG_RTC_QMSI) += -I$(CONFIG_QMSI_INSTALL_PATH)/include
 
-obj-$(CONFIG_RTC) += rtc_static_irq_stubs.o
 obj-$(CONFIG_RTC_DW) += rtc_dw.o
 obj-$(CONFIG_RTC_QMSI) += rtc_qmsi.o
diff --git a/drivers/rtc/rtc_dw.c b/drivers/rtc/rtc_dw.c
index e106137..4de8d21 100644
--- a/drivers/rtc/rtc_dw.c
+++ b/drivers/rtc/rtc_dw.c
@@ -189,23 +189,7 @@
 	.set_alarm = rtc_dw_set_alarm,
 };
 
-/* IRQ_CONFIG needs the flags variable declared by IRQ_CONNECT_STATIC */
-IRQ_CONNECT_STATIC(rtc, CONFIG_RTC_IRQ,
-		   CONFIG_RTC_IRQ_PRI, rtc_dw_isr, 0, 0);
-
-int rtc_dw_init(struct device *dev)
-{
-	IRQ_CONFIG(rtc, CONFIG_RTC_IRQ);
-	irq_enable(CONFIG_RTC_IRQ);
-
-	_rtc_dw_int_unmask();
-
-	_rtc_dw_clock_config(dev);
-
-	dev->driver_api = &funcs;
-
-	return DEV_OK;
-}
+int rtc_dw_init(struct device *dev);
 
 struct rtc_dw_runtime rtc_runtime;
 
@@ -222,4 +206,18 @@
 SYS_DEFINE_DEVICE(rtc, &rtc_runtime, SECONDARY,
 		  CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
 
-struct device *rtc_dw_isr_dev = SYS_GET_DEVICE(rtc);
+int rtc_dw_init(struct device *dev)
+{
+	irq_connect(CONFIG_RTC_IRQ, CONFIG_RTC_IRQ_PRI, rtc_dw_isr,
+		    SYS_GET_DEVICE(rtc), 0);
+	irq_enable(CONFIG_RTC_IRQ);
+
+	_rtc_dw_int_unmask();
+
+	_rtc_dw_clock_config(dev);
+
+	dev->driver_api = &funcs;
+
+	return DEV_OK;
+}
+
diff --git a/drivers/rtc/rtc_qmsi.c b/drivers/rtc/rtc_qmsi.c
index d319a54..6b5d0db 100644
--- a/drivers/rtc/rtc_qmsi.c
+++ b/drivers/rtc/rtc_qmsi.c
@@ -22,9 +22,6 @@
 
 #include "qm_rtc.h"
 
-IRQ_CONNECT_STATIC(rtc, CONFIG_RTC_IRQ, CONFIG_RTC_IRQ_PRI, qm_rtc_isr_0,
-		   0, IOAPIC_EDGE | IOAPIC_HIGH);
-
 static struct device *rtc_qmsi_dev;
 
 static void (*user_callback)(struct device *dev);
@@ -82,7 +79,8 @@
 
 static int rtc_qmsi_init(struct device *dev)
 {
-	IRQ_CONFIG(rtc, CONFIG_RTC_IRQ);
+	irq_connect(CONFIG_RTC_IRQ, CONFIG_RTC_IRQ_PRI, qm_rtc_isr_0, 0,
+		    IOAPIC_EDGE | IOAPIC_HIGH);
 
 	/* Unmask RTC interrupt */
 	irq_enable(CONFIG_RTC_IRQ);
diff --git a/drivers/rtc/rtc_static_irq_stubs.S b/drivers/rtc/rtc_static_irq_stubs.S
deleted file mode 100644
index 516912d..0000000
--- a/drivers/rtc/rtc_static_irq_stubs.S
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2015, Intel Corportation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#define _ASMLANGUAGE
-
-#include <arch/x86/asm.h>
-#include <drivers/ioapic.h>
-
-#if defined(CONFIG_RTC_DW)
-#if defined(CONFIG_IOAPIC) || defined(CONFIG_MVIC)
-	ioapic_mkstub rtc rtc_dw_isr rtc_dw_isr_dev
-#endif
-#endif
-
-#if defined(CONFIG_RTC_QMSI)
-#if defined(CONFIG_IOAPIC) || defined(CONFIG_MVIC)
-	ioapic_mkstub rtc qm_rtc_isr_0 0
-#endif
-#endif /* CONFIG_RTC_QMSI */
-
-/* externs (internal APIs) */
-
-GTEXT(_IntEnt)
-GTEXT(_IntExit)
diff --git a/drivers/shared_irq/Makefile b/drivers/shared_irq/Makefile
index a2a0452..188ba8f 100644
--- a/drivers/shared_irq/Makefile
+++ b/drivers/shared_irq/Makefile
@@ -1,4 +1,3 @@
 ccflags-y +=-I$(srctree)/drivers
 
-obj-$(CONFIG_SHARED_IRQ) = shared_irq_static_irq_stubs.o
 obj-$(CONFIG_SHARED_IRQ) += shared_irq.o
diff --git a/drivers/shared_irq/shared_irq.c b/drivers/shared_irq/shared_irq.c
index e89dbb4..8dc94e3 100644
--- a/drivers/shared_irq/shared_irq.c
+++ b/drivers/shared_irq/shared_irq.c
@@ -128,13 +128,13 @@
 	struct shared_irq_config *config = dev->config->config_info;
 
 	dev->driver_api = &api_funcs;
-	config->config(dev);
+	config->config();
 
 	return 0;
 }
 
 #if CONFIG_SHARED_IRQ_0
-void shared_irq_config_0_irq(struct device *port);
+void shared_irq_config_0_irq(void);
 
 struct shared_irq_config shared_irq_config_0 = {
 	.irq_num = CONFIG_SHARED_IRQ_0_IRQ,
@@ -165,26 +165,17 @@
 	#define SHARED_IRQ_0_FLAGS 0
 #endif /* CONFIG_IOAPIC */
 
-IRQ_CONNECT_STATIC(shared_irq_0, CONFIG_SHARED_IRQ_0_IRQ,
-		   CONFIG_SHARED_IRQ_0_PRI, shared_irq_isr_0, 0,
-		   SHARED_IRQ_0_FLAGS);
-
-void shared_irq_config_0_irq(struct device *port)
+void shared_irq_config_0_irq(void)
 {
-	struct shared_irq_config *config = port->config->config_info;
-
-	IRQ_CONFIG(shared_irq_0, config->irq_num);
-}
-
-void shared_irq_isr_0(void *unused)
-{
-	shared_irq_isr(&__initconfig_shared_irq_0);
+	irq_connect(CONFIG_SHARED_IRQ_0_IRQ, CONFIG_SHARED_IRQ_0_PRI,
+		    shared_irq_isr, SYS_GET_DEVICE(shared_irq_0),
+		    SHARED_IRQ_0_FLAGS);
 }
 
 #endif /* CONFIG_SHARED_IRQ_0 */
 
 #if CONFIG_SHARED_IRQ_1
-void shared_irq_config_1_irq(struct device *port);
+void shared_irq_config_1_irq(void);
 
 struct shared_irq_config shared_irq_config_1 = {
 	.irq_num = CONFIG_SHARED_IRQ_1_IRQ,
@@ -215,20 +206,11 @@
 	#define SHARED_IRQ_1_FLAGS 0
 #endif /* CONFIG_IOAPIC */
 
-IRQ_CONNECT_STATIC(shared_irq_1, CONFIG_SHARED_IRQ_1_IRQ,
-		   CONFIG_SHARED_IRQ_1_PRI, shared_irq_isr_1, 0,
-		   SHARED_IRQ_1_FLAGS);
-
-void shared_irq_config_1_irq(struct device *port)
+void shared_irq_config_1_irq(void)
 {
-	struct shared_irq_config *config = port->config->config_info;
-
-	IRQ_CONFIG(shared_irq_1, config->irq_num);
-}
-
-void shared_irq_isr_1(void *unused)
-{
-	shared_irq_isr(&__initconfig_shared_irq_1);
+	irq_connect(CONFIG_SHARED_IRQ_1_IRQ, CONFIG_SHARED_IRQ_1_PRI,
+		    shared_irq_isr, SYS_GET_DEVICE(shared_irq_1),
+		    SHARED_IRQ_1_FLAGS);
 }
 
 #endif /* CONFIG_SHARED_IRQ_1 */
diff --git a/drivers/shared_irq/shared_irq_static_irq_stubs.S b/drivers/shared_irq/shared_irq_static_irq_stubs.S
deleted file mode 100644
index 5f7e87a..0000000
--- a/drivers/shared_irq/shared_irq_static_irq_stubs.S
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (c) 2012-2015, Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#define _ASMLANGUAGE
-
-#include <arch/x86/asm.h>
-#include <drivers/ioapic.h>
-
-
-#if CONFIG_SHARED_IRQ_0
-	ioapic_mkstub shared_irq_0 shared_irq_isr_0 0
-#endif /* CONFIG_SHARED_IRQ_0 */
-
-#if CONFIG_SHARED_IRQ_1
-	ioapic_mkstub shared_irq_1 shared_irq_isr_1 0
-#endif /* CONFIG_SHARED_IRQ_1 */
diff --git a/drivers/spi/Makefile b/drivers/spi/Makefile
index 5abbe77..07ae38b 100644
--- a/drivers/spi/Makefile
+++ b/drivers/spi/Makefile
@@ -1,4 +1,2 @@
-
-obj-$(CONFIG_SPI) = spi_static_irq_stubs.o
 obj-$(CONFIG_SPI_INTEL) += intel_spi.o
 obj-$(CONFIG_SPI_DW) += dw_spi.o
diff --git a/drivers/spi/dw_spi.c b/drivers/spi/dw_spi.c
index 172644e..2a4b321 100644
--- a/drivers/spi/dw_spi.c
+++ b/drivers/spi/dw_spi.c
@@ -459,8 +459,13 @@
 #endif /* CONFIG_IOAPIC */
 
 #ifdef CONFIG_SPI_DW_PORT_0
-
-void spi_config_0_irq(struct device *dev);
+void spi_config_0_irq(void)
+{
+	irq_connect(CONFIG_SPI_DW_PORT_0_IRQ, CONFIG_SPI_DW_PORT_0_PRI,
+		    spi_dw_isr, SYS_GET_DEVICE(spi_dw_port_0),
+		    SPI_DW_IRQ_FLAGS);
+	irq_enable(CONFIG_SPI_DW_PORT_0_IRQ);
+}
 
 struct spi_dw_data spi_dw_data_port_0;
 
@@ -479,24 +484,16 @@
 
 SYS_DEFINE_DEVICE(spi_dw_port_0, &spi_dw_data_port_0, SECONDARY,
 					CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
-struct device *spi_dw_isr_port_0 = SYS_GET_DEVICE(spi_dw_port_0);
-
-IRQ_CONNECT_STATIC(spi_dw_irq_port_0, CONFIG_SPI_DW_PORT_0_IRQ,
-		   CONFIG_SPI_DW_PORT_0_PRI, spi_dw_isr, 0,
-		   SPI_DW_IRQ_FLAGS);
-
-void spi_config_0_irq(struct device *dev)
-{
-	struct spi_dw_config *config = dev->config->config_info;
-
-	IRQ_CONFIG(spi_dw_irq_port_0, config->irq);
-	irq_enable(config->irq);
-}
-
 #endif /* CONFIG_SPI_DW_PORT_0 */
 #ifdef CONFIG_SPI_DW_PORT_1
 
-void spi_config_1_irq(struct device *dev);
+void spi_config_1_irq(void)
+{
+	irq_connect(CONFIG_SPI_DW_PORT_1_IRQ, CONFIG_SPI_DW_PORT_1_PRI,
+		    spi_dw_isr, SYS_GET_DEVICE(spi_dw_port_1),
+		    SPI_DW_IRQ_FLAGS);
+	irq_enable(CONFIG_SPI_DW_PORT_1_IRQ);
+}
 
 struct spi_dw_data spi_dw_data_port_1;
 
@@ -515,18 +512,4 @@
 
 SYS_DEFINE_DEVICE(spi_dw_port_1, &spi_dw_data_port_1, SECONDARY,
 					CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
-struct device *spi_dw_isr_port_1 = SYS_GET_DEVICE(spi_dw_port_1);
-
-IRQ_CONNECT_STATIC(spi_dw_irq_port_1, CONFIG_SPI_DW_PORT_1_IRQ,
-		   CONFIG_SPI_DW_PORT_1_PRI, spi_dw_isr, 0,
-		   SPI_DW_IRQ_FLAGS);
-
-void spi_config_1_irq(struct device *dev)
-{
-	struct spi_dw_config *config = dev->config->config_info;
-
-	IRQ_CONFIG(spi_dw_irq_port_1, config->irq);
-	irq_enable(config->irq);
-}
-
 #endif /* CONFIG_SPI_DW_PORT_1 */
diff --git a/drivers/spi/dw_spi_priv.h b/drivers/spi/dw_spi_priv.h
index a81bcb6..83c5a29 100644
--- a/drivers/spi/dw_spi_priv.h
+++ b/drivers/spi/dw_spi_priv.h
@@ -21,7 +21,7 @@
 
 #include <spi.h>
 
-typedef void (*spi_dw_config_t)(struct device *dev);
+typedef void (*spi_dw_config_t)(void);
 
 /* Private structures */
 struct spi_dw_config {
diff --git a/drivers/spi/intel_spi.c b/drivers/spi/intel_spi.c
index 765c6dd..12eacc8 100644
--- a/drivers/spi/intel_spi.c
+++ b/drivers/spi/intel_spi.c
@@ -420,7 +420,7 @@
 		return DEV_NOT_CONFIG;
 	}
 
-	info->config_func(dev);
+	info->config_func();
 
 	_spi_config_cs(dev);
 
@@ -448,7 +448,7 @@
 /* system bindings */
 #ifdef CONFIG_SPI_INTEL_PORT_0
 
-void spi_config_0_irq(struct device *dev);
+void spi_config_0_irq(void);
 
 struct spi_intel_data spi_intel_data_port_0;
 
@@ -476,23 +476,18 @@
 /* SPI may use GPIO pin for CS, thus it needs to be initialized after GPIO */
 SYS_DEFINE_DEVICE(spi_intel_port_0, &spi_intel_data_port_0, SECONDARY,
 		  CONFIG_SPI_INTEL_INIT_PRIORITY);
-struct device *spi_intel_isr_port_0 = SYS_GET_DEVICE(spi_intel_port_0);
 
-IRQ_CONNECT_STATIC(spi_intel_irq_port_0, CONFIG_SPI_INTEL_PORT_0_IRQ,
-		   CONFIG_SPI_INTEL_PORT_0_PRI, spi_intel_isr, 0,
-		   SPI_INTEL_IRQ_FLAGS);
-
-void spi_config_0_irq(struct device *dev)
+void spi_config_0_irq(void)
 {
-	struct spi_intel_config *config = dev->config->config_info;
-
-	IRQ_CONFIG(spi_intel_irq_port_0, config->irq);
+	irq_connect(CONFIG_SPI_INTEL_PORT_0_IRQ, CONFIG_SPI_INTEL_PORT_0_PRI,
+		    spi_intel_isr, SYS_GET_DEVICE(spi_intel_port_0),
+		    SPI_INTEL_IRQ_FLAGS);
 }
 
 #endif /* CONFIG_SPI_INTEL_PORT_0 */
 #ifdef CONFIG_SPI_INTEL_PORT_1
 
-void spi_config_1_irq(struct device *dev);
+void spi_config_1_irq(void);
 
 struct spi_intel_data spi_intel_data_port_1;
 
@@ -520,17 +515,12 @@
 /* SPI may use GPIO pin for CS, thus it needs to be initialized after GPIO */
 SYS_DEFINE_DEVICE(spi_intel_port_1, &spi_intel_data_port_1, SECONDARY,
 		  CONFIG_SPI_INTEL_INIT_PRIORITY);
-struct device *spi_intel_isr_port_1 = SYS_GET_DEVICE(spi_intel_port_1);
 
-IRQ_CONNECT_STATIC(spi_intel_irq_port_1, CONFIG_SPI_INTEL_PORT_1_IRQ,
-		   CONFIG_SPI_INTEL_PORT_1_PRI, spi_intel_isr, 0,
-		   SPI_INTEL_IRQ_FLAGS);
-
-void spi_config_1_irq(struct device *dev)
+void spi_config_1_irq(void);
 {
-	struct spi_intel_config *config = dev->config->config_info;
-
-	IRQ_CONFIG(spi_intel_irq_port_1, config->irq);
+	irq_connect(CONFIG_SPI_INTEL_PORT_1_IRQ, CONFIG_SPI_INTEL_PORT_1_PRI,
+		    spi_intel_isr, SYS_GET_DEVICE(spi_intel_port_1),
+		    SPI_INTEL_IRQ_FLAGS);
 }
 
 #endif /* CONFIG_SPI_INTEL_PORT_1 */
diff --git a/drivers/spi/intel_spi_priv.h b/drivers/spi/intel_spi_priv.h
index 9b9fcf5..a0e1b8b 100644
--- a/drivers/spi/intel_spi_priv.h
+++ b/drivers/spi/intel_spi_priv.h
@@ -24,7 +24,7 @@
 #include <pci/pci_mgr.h>
 #endif /* CONFIG_PCI */
 
-typedef void (*spi_intel_config_t)(struct device *dev);
+typedef void (*spi_intel_config_t)(void);
 
 struct spi_intel_config {
 	uint32_t regs;
diff --git a/drivers/spi/spi_static_irq_stubs.S b/drivers/spi/spi_static_irq_stubs.S
deleted file mode 100644
index 33f6c7a..0000000
--- a/drivers/spi/spi_static_irq_stubs.S
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2012-2015, Wind River Systems, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-#define _ASMLANGUAGE
-
-#ifdef CONFIG_X86
-#include <arch/x86/asm.h>
-#include <drivers/ioapic.h>
-#endif
-
-#if defined(CONFIG_SPI_INTEL_PORT_0)
-	ioapic_mkstub spi_intel_irq_port_0 spi_intel_isr spi_intel_isr_port_0
-#endif /* CONFIG_SPI_INTEL_PORT_0 */
-#if defined(CONFIG_SPI_INTEL_PORT_1)
-	ioapic_mkstub spi_intel_irq_port_1 spi_intel_isr spi_intel_isr_port_1
-#endif /* CONFIG_SPI_INTEL_PORT_1 */
-
-#if defined(CONFIG_SPI_DW_PORT_0)
-#ifdef CONFIG_IOAPIC
-	ioapic_mkstub spi_dw_irq_port_0 spi_dw_isr spi_dw_isr_port_0
-#endif
-#endif
-#if defined(CONFIG_SPI_DW_PORT_1)
-#ifdef CONFIG_IOAPIC
-	ioapic_mkstub spi_dw_irq_port_1 spi_dw_isr spi_dw_isr_port_1
-#endif
-#endif
-
diff --git a/drivers/timer/arcv2_timer0.c b/drivers/timer/arcv2_timer0.c
index ae0032d..3c967e7 100644
--- a/drivers/timer/arcv2_timer0.c
+++ b/drivers/timer/arcv2_timer0.c
@@ -311,9 +311,6 @@
  */
 int _sys_clock_driver_init(struct device *device)
 {
-	int irq = CONFIG_ARCV2_TIMER0_INT_LVL;
-	int prio = CONFIG_ARCV2_TIMER0_INT_PRI;
-
 	ARG_UNUSED(device);
 
 	/* ensure that the timer will not generate interrupts */
@@ -322,7 +319,8 @@
 
 	cycles_per_tick = sys_clock_hw_cycles_per_tick;
 
-	(void)irq_connect(irq, prio, _timer_int_handler, 0, 0);
+	irq_connect(CONFIG_ARCV2_TIMER0_INT_LVL, CONFIG_ARCV2_TIMER0_INT_PRI,
+		    _timer_int_handler, 0, 0);
 
 	/*
 	 * Set the reload value to achieve the configured tick rate, enable the
diff --git a/drivers/timer/hpet.c b/drivers/timer/hpet.c
index 4f5555f..59f06d5 100644
--- a/drivers/timer/hpet.c
+++ b/drivers/timer/hpet.c
@@ -183,8 +183,6 @@
 #define HPET_IOAPIC_FLAGS  (IOAPIC_LEVEL | IOAPIC_LOW)
 #endif
 
-IRQ_CONNECT_STATIC(hpet, CONFIG_HPET_TIMER_IRQ, CONFIG_HPET_TIMER_IRQ_PRIORITY,
-		   _timer_int_handler, 0, HPET_IOAPIC_FLAGS);
 
 #ifdef CONFIG_INT_LATENCY_BENCHMARK
 static uint32_t main_count_first_irq_value;
@@ -614,8 +612,8 @@
 	 * Although the stub has already been "connected", the vector number
 	 * still has to be programmed into the interrupt controller.
 	 */
-
-	IRQ_CONFIG(hpet, CONFIG_HPET_TIMER_IRQ);
+	irq_connect(CONFIG_HPET_TIMER_IRQ, CONFIG_HPET_TIMER_IRQ_PRIORITY,
+		   _timer_int_handler, 0, HPET_IOAPIC_FLAGS);
 
 	/* enable the IRQ in the interrupt controller */
 
diff --git a/drivers/timer/loapic_timer.c b/drivers/timer/loapic_timer.c
index c40c479..30f93f3 100644
--- a/drivers/timer/loapic_timer.c
+++ b/drivers/timer/loapic_timer.c
@@ -128,10 +128,6 @@
 extern int32_t _sys_idle_elapsed_ticks;
 #endif /* TIMER_SUPPORTS_TICKLESS */
 
-IRQ_CONNECT_STATIC(loapic, CONFIG_LOAPIC_TIMER_IRQ,
-			CONFIG_LOAPIC_TIMER_IRQ_PRIORITY,
-			_timer_int_handler, 0, 0);
-
 /* computed counter 0 initial count value */
 static uint32_t __noinit cycles_per_tick;
 static uint32_t accumulated_cycle_count;
@@ -571,11 +567,8 @@
 	initial_count_register_set(cycles_per_tick - 1);
 	periodic_mode_set();
 
-	/*
-	 * Although the stub has already been "connected", the vector number
-	 * still has to be programmed into the interrupt controller.
-	 */
-	IRQ_CONFIG(loapic, CONFIG_LOAPIC_TIMER_IRQ);
+	irq_connect(CONFIG_LOAPIC_TIMER_IRQ, CONFIG_LOAPIC_TIMER_IRQ_PRIORITY,
+		    _timer_int_handler, 0, 0);
 
 	/* Everything has been configured. It is now safe to enable the
 	 * interrupt
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index e28b89c..0a351e0 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -1,5 +1,3 @@
 ccflags-$(CONFIG_WDT_QMSI) +=-I$(CONFIG_QMSI_INSTALL_PATH)/include
-
-obj-$(CONFIG_WATCHDOG) += wdt_static_irq_stubs.o
 obj-$(CONFIG_WDT_DW) += wdt_dw.o
 obj-$(CONFIG_WDT_QMSI) += wdt_qmsi.o
diff --git a/drivers/watchdog/wdt_dw.c b/drivers/watchdog/wdt_dw.c
index 9fffaea..c2f00b1 100644
--- a/drivers/watchdog/wdt_dw.c
+++ b/drivers/watchdog/wdt_dw.c
@@ -149,23 +149,7 @@
 	.reload = wdt_dw_reload,
 };
 
-/* IRQ_CONFIG needs the flags variable declared by IRQ_CONNECT_STATIC */
-IRQ_CONNECT_STATIC(wdt_dw, CONFIG_WDT_DW_IRQ,
-		   CONFIG_WDT_DW_IRQ_PRI, wdt_dw_isr, 0, 0);
-
-int wdt_dw_init(struct device *dev)
-{
-	dev->driver_api = &wdt_dw_funcs;
-
-	IRQ_CONFIG(wdt_dw, CONFIG_WDT_DW_IRQ);
-	irq_enable(CONFIG_WDT_DW_IRQ);
-
-	_wdt_dw_int_unmask();
-
-	_wdt_dw_clock_config(dev);
-
-	return 0;
-}
+int wdt_dw_init(struct device *dev);
 
 struct wdt_dw_runtime wdt_runtime;
 
@@ -182,4 +166,18 @@
 SYS_DEFINE_DEVICE(wdt, &wdt_runtime, SECONDARY,
 		  CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
 
-struct device *wdt_dw_isr_dev = SYS_GET_DEVICE(wdt);
+int wdt_dw_init(struct device *dev)
+{
+	dev->driver_api = &wdt_dw_funcs;
+
+	irq_connect(CONFIG_WDT_DW_IRQ, CONFIG_WDT_DW_IRQ_PRI, wdt_dw_isr,
+		    SYS_GET_DEVICE(wdt), 0);
+	irq_enable(CONFIG_WDT_DW_IRQ);
+
+	_wdt_dw_int_unmask();
+
+	_wdt_dw_clock_config(dev);
+
+	return 0;
+}
+
diff --git a/drivers/watchdog/wdt_qmsi.c b/drivers/watchdog/wdt_qmsi.c
index e06a590..15a1cfe 100644
--- a/drivers/watchdog/wdt_qmsi.c
+++ b/drivers/watchdog/wdt_qmsi.c
@@ -83,12 +83,10 @@
 	qm_wdt_isr_0();
 }
 
-IRQ_CONNECT_STATIC(wdt, CONFIG_WDT_QMSI_IRQ, CONFIG_WDT_QMSI_IRQ_PRI,
-		   wdt_qmsi_isr, 0, IOAPIC_EDGE | IOAPIC_HIGH);
-
 static int init(struct device *dev)
 {
-	IRQ_CONFIG(wdt, CONFIG_WDT_QMSI_IRQ);
+	irq_connect(CONFIG_WDT_QMSI_IRQ, CONFIG_WDT_QMSI_IRQ_PRI,
+		    wdt_qmsi_isr, 0, IOAPIC_EDGE | IOAPIC_HIGH);
 
 	/* Unmask watchdog interrupt */
 	irq_enable(CONFIG_WDT_QMSI_IRQ);
diff --git a/drivers/watchdog/wdt_static_irq_stubs.S b/drivers/watchdog/wdt_static_irq_stubs.S
deleted file mode 100644
index effbb0a..0000000
--- a/drivers/watchdog/wdt_static_irq_stubs.S
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2015, Intel Corportation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-
-#define _ASMLANGUAGE
-
-#include <arch/x86/asm.h>
-#include <drivers/ioapic.h>
-
-#if defined(CONFIG_WDT_DW)
-#if defined(CONFIG_IOAPIC) || defined(CONFIG_MVIC)
-	ioapic_mkstub wdt_dw wdt_dw_isr wdt_dw_isr_dev
-#endif /* CONFIG_IOAPIC */
-#endif
-
-#if defined(CONFIG_WDT_QMSI)
-#if defined(CONFIG_IOAPIC) || defined(CONFIG_MVIC)
-	ioapic_mkstub wdt wdt_qmsi_isr wdt_qmsi_isr_dev
-#endif /* CONFIG_IOAPIC || CONFIG_MVIC */
-#endif /* CONFIG_WDT_QMSI */
-
-/* externs (internal APIs) */
-
-GTEXT(_IntEnt)
-GTEXT(_IntExit)