未验证 提交 8389304e 编写于 作者: O openharmony_ci 提交者: Gitee

!533 fix:modify the API to judge whether a node exists

Merge pull request !533 from Zhang/master
......@@ -150,7 +150,6 @@ int32_t InitI2cDevice(struct I2cDevice *device)
break; \
} \
} while (0)
#define PLATFORM_CONFIG HCS_NODE(HCS_ROOT, platform)
#define PLATFORM_I2C_CONFIG HCS_NODE(HCS_NODE(HCS_ROOT, platform), i2c_config)
static uint32_t GetI2cDeviceResource(struct I2cDevice *device,
const char *deviceMatchAttr)
......@@ -163,7 +162,7 @@ static uint32_t GetI2cDeviceResource(struct I2cDevice *device,
return HDF_ERR_INVALID_PARAM;
}
resource = &device->resource;
#if HCS_NODE_HAS_PROP(PLATFORM_CONFIG, i2c_config)
#if HCS_NODE_EXISTS(PLATFORM_I2C_CONFIG)
HCS_FOREACH_CHILD_VARGS(PLATFORM_I2C_CONFIG, I2C_FIND_CONFIG, deviceMatchAttr, resource);
#endif
if (result != HDF_SUCCESS) {
......
......@@ -99,7 +99,6 @@ static int InitPwmDevice(struct PwmDev *host)
break; \
} \
} while (0)
#define PLATFORM_CONFIG HCS_NODE(HCS_ROOT, platform)
#define PLATFORM_PWM_CONFIG HCS_NODE(HCS_NODE(HCS_ROOT, platform), pwm_config)
static uint32_t GetPwmDeviceResource(struct PwmDevice *device, const char *deviceMatchAttr)
{
......@@ -111,7 +110,7 @@ static uint32_t GetPwmDeviceResource(struct PwmDevice *device, const char *devic
return HDF_ERR_INVALID_PARAM;
}
resource = &device->resource;
#if HCS_NODE_HAS_PROP(PLATFORM_CONFIG, pwm_config)
#if HCS_NODE_EXISTS(PLATFORM_PWM_CONFIG)
HCS_FOREACH_CHILD_VARGS(PLATFORM_PWM_CONFIG, PWM_FIND_CONFIG, deviceMatchAttr, resource);
#endif
if (result != HDF_SUCCESS) {
......
......@@ -438,7 +438,6 @@ static int32_t InitSpiDevice(struct SpiDevice *spiDevice)
} \
} while (0)
#define PLATFORM_CONFIG HCS_NODE(HCS_ROOT, platform)
#define PLATFORM_SPI_CONFIG HCS_NODE(HCS_NODE(HCS_ROOT, platform), spi_config)
static int32_t GetSpiDeviceResource(struct SpiDevice *spiDevice, const char *deviceMatchAttr)
{
......@@ -450,7 +449,7 @@ static int32_t GetSpiDeviceResource(struct SpiDevice *spiDevice, const char *dev
return HDF_ERR_INVALID_PARAM;
}
resource = &spiDevice->resource;
#if HCS_NODE_HAS_PROP(PLATFORM_CONFIG, spi_config)
#if HCS_NODE_EXISTS(PLATFORM_SPI_CONFIG)
HCS_FOREACH_CHILD_VARGS(PLATFORM_SPI_CONFIG, SPI_FIND_CONFIG, deviceMatchAttr, resource);
#endif
if (result != HDF_SUCCESS) {
......
......@@ -474,7 +474,6 @@ static int InitUartDevice(struct UartHost *host)
} \
} while (0)
#define PLATFORM_CONFIG HCS_NODE(HCS_ROOT, platform)
#define PLATFORM_UART_CONFIG HCS_NODE(HCS_NODE(HCS_ROOT, platform), uart_config)
static uint32_t GetUartDeviceResource(struct UartDevice *device, const char *deviceMatchAttr)
{
......@@ -485,7 +484,7 @@ static uint32_t GetUartDeviceResource(struct UartDevice *device, const char *dev
return HDF_ERR_INVALID_PARAM;
}
resource = &device->resource;
#if HCS_NODE_HAS_PROP(PLATFORM_CONFIG, uart_config)
#if HCS_NODE_EXISTS(PLATFORM_UART_CONFIG)
HCS_FOREACH_CHILD_VARGS(PLATFORM_UART_CONFIG, UART_FIND_CONFIG, deviceMatchAttr, resource);
#endif
if (result != HDF_SUCCESS) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册