[PATCH] Removing legacy method from arm csb336

Sebastian Huber sebastian.huber at embedded-brains.de
Mon Jul 8 07:08:51 UTC 2013


On 07/07/2013 06:56 PM, Vipul Nayyar wrote:
[...]
> @@ -243,13 +217,43 @@ static void imx_uart_init(int minor)
>   static int imx_uart_first_open(int major, int minor, void *arg)
>   {
>       rtems_libio_open_close_args_t *args = arg;
> -
>       imx_uart_data[minor].tty   = args->iop->data1;
>
> -#if defined(USE_INTERRUPTS)
> -    BSP_install_rtems_irq_handler(&imx_uart_tx_isr_data[minor]);
> -    BSP_install_rtems_irq_handler(&imx_uart_rx_isr_data[minor]);
> +#if defined(USE_INTERRUPTS)
> +    rtems_status_code status = RTEMS_SUCCESSFUL;
> +    rtems_irq_number name_uart_tx, name_uart_rx;

Unfortunately we put the declarations to the block begin.

> +
> +    if (minor == 0) {
> +        name_uart_tx = BSP_INT_UART1_TX;
> +        name_uart_rx = BSP_INT_UART1_RX;
> +    } else if (minor == 1) {
> +        name_uart_tx = BSP_INT_UART2_TX;
> +        name_uart_rx = BSP_INT_UART2_RX;
> +    } else {
> +        rtems_panic("%s:%d Unknown UART minor number %d\n",
> +                    __FUNCTION__, __LINE__, minor);
> +    }
[...]
> +    if (minor == 0) {
> +        name_uart_tx = BSP_INT_UART1_TX;
> +        name_uart_rx = BSP_INT_UART1_RX;
> +    } else if (minor == 1) {
> +        name_uart_tx = BSP_INT_UART2_TX;
> +        name_uart_rx = BSP_INT_UART2_RX;
> +    } else {
> +        rtems_panic("%s:%d Unknown UART minor number %d\n",
> +                    __FUNCTION__, __LINE__, minor);
> +    }

The problem with this is that you have two identical code blocks.  Move it to a 
function.

[...]
> @@ -602,7 +601,7 @@ void mc9328mxl_enet_stats (mc9328mxl_enet_softc_t *sc)
>
>
>   /* Enables mc9328mxl_enet interrupts. */
> -static void enet_isr_on(const rtems_irq_connect_data *unused)
> +static void enet_isr_on()
[...]

Please use

static void enet_isr_on(void)

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list