arch/arm/tiva: simplify TIVA_CAN option usage

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
Petro Karashchenko
2023-01-26 01:34:19 +02:00
committed by Xiang Xiao
parent bd7cb522a1
commit a58e73add8
3 changed files with 7 additions and 26 deletions
@@ -58,7 +58,7 @@
#include "tiva_gpio.h"
#include "hardware/tiva_pinmap.h"
#ifdef CONFIG_CAN
#ifdef CONFIG_TIVA_CAN
/****************************************************************************
* Pre-processor Definitions
@@ -78,21 +78,18 @@
int tm4c_can_setup(void)
{
#ifdef CONFIG_TIVA_CAN
int ret;
int ret = ERROR;
# ifdef CONFIG_TIVA_CAN0
tiva_can0_enableclk();
ret = tiva_configgpio(GPIO_CAN0_RX);
if (ret < 0)
{
goto configgpio_error;
}
ret = tiva_configgpio(GPIO_CAN0_TX);
if (ret < 0)
{
goto configgpio_error;
@@ -114,14 +111,12 @@ int tm4c_can_setup(void)
tiva_can1_enableclk();
ret = tiva_configgpio(GPIO_CAN1_RX);
if (ret < 0)
{
goto configgpio_error;
}
ret = tiva_configgpio(GPIO_CAN1_TX);
if (ret < 0)
{
goto configgpio_error;
@@ -144,10 +139,6 @@ int tm4c_can_setup(void)
configgpio_error:
canerr("ERROR: failed to configure CAN GPIO pin.\n");
return ret;
#else
return -ENODEV;
#endif
}
#endif /* CONFIG_CAN */
#endif /* CONFIG_TIVA_CAN */
@@ -41,7 +41,7 @@
#include "tiva_gpio.h"
#include "hardware/tiva_pinmap.h"
#ifdef CONFIG_CAN
#ifdef CONFIG_TIVA_CAN
/****************************************************************************
* Pre-processor Definitions
@@ -61,21 +61,18 @@
int tm4c_can_setup(void)
{
#ifdef CONFIG_TIVA_CAN
int ret;
int ret = ERROR;
# ifdef CONFIG_TIVA_CAN0
tiva_can0_enableclk();
ret = tiva_configgpio(GPIO_CAN0_RX);
if (ret < 0)
{
goto configgpio_error;
}
ret = tiva_configgpio(GPIO_CAN0_TX);
if (ret < 0)
{
goto configgpio_error;
@@ -97,14 +94,12 @@ int tm4c_can_setup(void)
tiva_can1_enableclk();
ret = tiva_configgpio(GPIO_CAN1_RX);
if (ret < 0)
{
goto configgpio_error;
}
ret = tiva_configgpio(GPIO_CAN1_TX);
if (ret < 0)
{
goto configgpio_error;
@@ -127,10 +122,6 @@ int tm4c_can_setup(void)
configgpio_error:
canerr("ERROR: failed to configure CAN GPIO pin.\n");
return ret;
#else
return -ENODEV;
#endif
}
#endif /* CONFIG_CAN */
#endif /* CONFIG_TIVA_CAN */