drivers: Replace DEV_OK by 0
This patch replaces all occurences of the macro DEV_OK by the actual value 0 at the driver level. So this patch touch the files under drivers/, include/ and samples/drivers/. This patch is part of the effort to transition from DEV_* codes to errno.h codes. Change-Id: I69980ecb9755f2fb026de5668ae9c21a4ae62d1e Signed-off-by: Andre Guedes <andre.guedes@intel.com>
This commit is contained in:
parent
69453a5d29
commit
024cfe754e
|
@ -1265,7 +1265,7 @@ static int cc2520_init(struct device *dev)
|
|||
return DEV_FAIL;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEVICE_INIT(cc2520, CONFIG_CC2520_DRV_NAME,
|
||||
|
|
|
@ -107,7 +107,7 @@ static inline bool spi_transfer(struct device *dev,
|
|||
spi_slave_select(dev, CC2520_SPI_SLAVE());
|
||||
ret = spi_transceive(dev, data_out, out_len, data_in, in_len);
|
||||
|
||||
return (ret == DEV_OK);
|
||||
return (ret == 0);
|
||||
}
|
||||
|
||||
static inline bool cc2520_read_fifo_buf(uint8_t *buffer, uint32_t count)
|
||||
|
|
|
@ -106,7 +106,7 @@ static void adc_qmsi_disable(struct device *dev)
|
|||
#if (CONFIG_ADC_QMSI_POLL)
|
||||
static int adc_qmsi_read(struct device *dev, struct adc_seq_table *seq_tbl)
|
||||
{
|
||||
int i, ret = DEV_OK;
|
||||
int i, ret = 0;
|
||||
qm_adc_xfer_t xfer;
|
||||
qm_adc_config_t cfg;
|
||||
|
||||
|
@ -161,7 +161,7 @@ static int adc_qmsi_read(struct device *dev, struct adc_seq_table *seq_tbl)
|
|||
#else
|
||||
static int adc_qmsi_read(struct device *dev, struct adc_seq_table *seq_tbl)
|
||||
{
|
||||
int i, ret = DEV_OK;
|
||||
int i, ret = 0;
|
||||
qm_adc_xfer_t xfer;
|
||||
qm_adc_config_t cfg;
|
||||
|
||||
|
@ -263,7 +263,7 @@ int adc_qmsi_init(struct device *dev)
|
|||
|
||||
adc_config_irq();
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct adc_info adc_info_dev;
|
||||
|
|
|
@ -162,7 +162,7 @@ static int ti_adc108s102_read(struct device *dev,
|
|||
struct spi_config spi_conf;
|
||||
uint32_t data[2] = {0, 0};
|
||||
struct nano_timer timer;
|
||||
int ret = DEV_OK;
|
||||
int ret = 0;
|
||||
int32_t delay;
|
||||
|
||||
spi_conf.config = config->spi_config_flags;
|
||||
|
@ -198,7 +198,7 @@ static int ti_adc108s102_read(struct device *dev,
|
|||
nano_task_timer_test(&timer, TICKS_UNLIMITED);
|
||||
|
||||
ret = _ti_adc108s102_sampling(dev);
|
||||
if (ret != DEV_OK) {
|
||||
if (ret != 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -228,7 +228,7 @@ int ti_adc108s102_init(struct device *dev)
|
|||
|
||||
dev->driver_api = &ti_adc108s102_api;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_ADC_TI_ADC108S102
|
||||
|
|
|
@ -46,7 +46,7 @@ static int dw_aio_cmp_disable(struct device *dev, uint8_t index)
|
|||
/* Disable power in comparator <index> */
|
||||
regs->pwr &= ~(1 << index);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dw_aio_cmp_configure(struct device *dev, uint8_t index,
|
||||
|
@ -116,7 +116,7 @@ static int dw_aio_cmp_configure(struct device *dev, uint8_t index,
|
|||
/* Enable interrupt to host */
|
||||
SCSS_INTERRUPT->int_comparators_host_mask &= ~(1 << index);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void dw_aio_cmp_isr(struct device *dev)
|
||||
|
@ -166,7 +166,7 @@ int dw_aio_cmp_init(struct device *dev)
|
|||
|
||||
if (config->config_func) {
|
||||
i = config->config_func(dev);
|
||||
if (i != DEV_OK)
|
||||
if (i != 0)
|
||||
return i;
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,7 @@ int dw_aio_cmp_init(struct device *dev)
|
|||
|
||||
irq_enable(config->interrupt_num);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct dw_aio_cmp_dev_cfg_t dw_aio_cmp_dev_config = {
|
||||
|
@ -216,5 +216,5 @@ static int dw_aio_cmp_config(struct device *dev)
|
|||
IRQ_CONNECT(INT_AIO_CMP_IRQ, CONFIG_AIO_DW_COMPARATOR_IRQ_PRI,
|
||||
dw_aio_cmp_isr,
|
||||
DEVICE_GET(dw_aio_cmp), 0);
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ static int aio_qmsi_cmp_disable(struct device *dev, uint8_t index)
|
|||
return DEV_INVALID_CONF;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int aio_qmsi_cmp_configure(struct device *dev, uint8_t index,
|
||||
|
@ -113,7 +113,7 @@ static int aio_qmsi_cmp_configure(struct device *dev, uint8_t index,
|
|||
/* Enable Interrupts to host for an specific comparator */
|
||||
QM_SCSS_INT->int_comparators_host_mask &= ~(1 << index);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct aio_cmp_driver_api aio_cmp_funcs = {
|
||||
|
@ -147,7 +147,7 @@ int aio_qmsi_cmp_init(struct device *dev)
|
|||
|
||||
irq_enable(INT_AIO_CMP_IRQ);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void aio_qmsi_cmp_isr(struct device *dev)
|
||||
|
@ -186,5 +186,5 @@ static int aio_cmp_config(struct device *dev)
|
|||
IRQ_CONNECT(INT_AIO_CMP_IRQ, CONFIG_AIO_COMPARATOR_IRQ_PRI,
|
||||
aio_qmsi_cmp_isr, DEVICE_GET(aio_qmsi_cmp), 0);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -254,7 +254,7 @@ static int _bt_uart_init(struct device *unused)
|
|||
|
||||
bt_driver_register(&drv);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(_bt_uart_init, NANOKERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
|
||||
|
|
|
@ -781,7 +781,7 @@ static int _bt_uart_init(struct device *unused)
|
|||
|
||||
bt_driver_register(&drv);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(_bt_uart_init, NANOKERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
|
||||
|
|
|
@ -55,7 +55,7 @@ static inline int quark_se_clock_control_on(struct device *dev,
|
|||
DBG("Enabling all clock gates on dev %p\n", dev);
|
||||
sys_write32(0xffffffff, info->base_address);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
DBG("Enabling clock gate on dev %p subsystem %u\n", dev, subsys);
|
||||
|
@ -73,7 +73,7 @@ static inline int quark_se_clock_control_off(struct device *dev,
|
|||
DBG("Disabling all clock gates on dev %p\n", dev);
|
||||
sys_write32(0x00000000, info->base_address);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
DBG("clock gate on dev %p subsystem %u\n", dev, subsys);
|
||||
|
@ -93,7 +93,7 @@ int quark_se_clock_control_init(struct device *dev)
|
|||
|
||||
DBG("Quark Se clock controller driver initialized on device: %p\n",
|
||||
dev);
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_CLOCK_CONTROL_QUARK_SE_PERIPHERAL
|
||||
|
|
|
@ -50,7 +50,7 @@ static inline int stm32f10x_clock_control_on(struct device *dev,
|
|||
} else {
|
||||
rcc->apb1enr |= subsys;
|
||||
}
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int stm32f10x_clock_control_off(struct device *dev,
|
||||
|
@ -67,7 +67,7 @@ static inline int stm32f10x_clock_control_off(struct device *dev,
|
|||
} else {
|
||||
rcc->apb1enr &= ~subsys;
|
||||
}
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -187,7 +187,7 @@ static int stm32f10x_clock_control_get_subsys_rate(struct device *clock,
|
|||
|
||||
*rate = __get_apb_clock(ahb_clock, prescaler);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct clock_control_driver_api stm32f10x_clock_control_api = {
|
||||
|
@ -257,7 +257,7 @@ int stm32f10x_clock_control_init(struct device *dev)
|
|||
}
|
||||
|
||||
dev->driver_api = &stm32f10x_clock_control_api;
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct stm32f10x_rcc_data stm32f10x_rcc_data = {
|
||||
|
|
|
@ -122,6 +122,6 @@ int ipm_console_receiver_init(struct device *d)
|
|||
IPM_CONSOLE_PRI, 0);
|
||||
ipm_set_enabled(ipm, 1);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -61,6 +61,6 @@ int ipm_console_sender_init(struct device *d)
|
|||
__printk_hook_install(consoleOut);
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ static int ram_console_init(struct device *d)
|
|||
__printk_hook_install(ram_console_out);
|
||||
__stdout_hook_install(ram_console_out);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(ram_console_init, PRIMARY, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
|
||||
|
|
|
@ -417,7 +417,7 @@ void uart_console_hook_install(void)
|
|||
*
|
||||
* @brief Initialize one UART as the console/debug port
|
||||
*
|
||||
* @return DEV_OK if successful, otherwise failed.
|
||||
* @return 0 if successful, otherwise failed.
|
||||
*/
|
||||
static int uart_console_init(struct device *arg)
|
||||
{
|
||||
|
@ -427,7 +427,7 @@ static int uart_console_init(struct device *arg)
|
|||
|
||||
uart_console_hook_install();
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* UART consloe initializes after the UART device itself */
|
||||
|
|
|
@ -30,7 +30,7 @@ static inline int spi_flash_wb_id(struct device *dev)
|
|||
buf[0] = W25QXXDV_CMD_RDID;
|
||||
|
||||
if (spi_transceive(driver_data->spi, buf, W25QXXDV_LEN_CMD_AND_ID,
|
||||
buf, W25QXXDV_LEN_CMD_AND_ID) != DEV_OK) {
|
||||
buf, W25QXXDV_LEN_CMD_AND_ID) != 0) {
|
||||
return DEV_FAIL;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ static inline int spi_flash_wb_id(struct device *dev)
|
|||
return DEV_NO_SUPPORT;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int spi_flash_wb_config(struct device *dev)
|
||||
|
@ -56,11 +56,11 @@ static int spi_flash_wb_config(struct device *dev)
|
|||
|
||||
if (spi_slave_select(driver_data->spi,
|
||||
CONFIG_SPI_FLASH_W25QXXDV_SPI_SLAVE) !=
|
||||
DEV_OK) {
|
||||
0) {
|
||||
return DEV_FAIL;
|
||||
}
|
||||
|
||||
if (spi_configure(driver_data->spi, &config) != DEV_OK) {
|
||||
if (spi_configure(driver_data->spi, &config) != 0) {
|
||||
return DEV_FAIL;
|
||||
}
|
||||
|
||||
|
@ -72,13 +72,13 @@ static int spi_flash_wb_reg_read(struct device *dev, uint8_t *data)
|
|||
struct spi_flash_data *const driver_data = dev->driver_data;
|
||||
uint8_t buf[2];
|
||||
|
||||
if (spi_transceive(driver_data->spi, data, 2, buf, 2) != DEV_OK) {
|
||||
if (spi_transceive(driver_data->spi, data, 2, buf, 2) != 0) {
|
||||
return DEV_FAIL;
|
||||
}
|
||||
|
||||
memcpy(data, buf, 2);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void wait_for_flash_idle(struct device *dev)
|
||||
|
@ -102,11 +102,11 @@ static int spi_flash_wb_reg_write(struct device *dev, uint8_t *data)
|
|||
wait_for_flash_idle(dev);
|
||||
|
||||
if (spi_transceive(driver_data->spi, data, 1,
|
||||
&buf /*dummy */, 1) != DEV_OK) {
|
||||
&buf /*dummy */, 1) != 0) {
|
||||
return DEV_FAIL;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int spi_flash_wb_read(struct device *dev, off_t offset, void *data,
|
||||
|
@ -121,7 +121,7 @@ static int spi_flash_wb_read(struct device *dev, off_t offset, void *data,
|
|||
|
||||
nano_sem_take(&driver_data->sem, TICKS_UNLIMITED);
|
||||
|
||||
if (spi_flash_wb_config(dev) != DEV_OK) {
|
||||
if (spi_flash_wb_config(dev) != 0) {
|
||||
nano_sem_give(&driver_data->sem);
|
||||
return DEV_FAIL;
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ static int spi_flash_wb_read(struct device *dev, off_t offset, void *data,
|
|||
memset(buf + W25QXXDV_LEN_CMD_ADDRESS, 0, len);
|
||||
|
||||
if (spi_transceive(driver_data->spi, buf, len + W25QXXDV_LEN_CMD_ADDRESS,
|
||||
buf, len + W25QXXDV_LEN_CMD_ADDRESS) != DEV_OK) {
|
||||
buf, len + W25QXXDV_LEN_CMD_ADDRESS) != 0) {
|
||||
nano_sem_give(&driver_data->sem);
|
||||
return DEV_FAIL;
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ static int spi_flash_wb_read(struct device *dev, off_t offset, void *data,
|
|||
|
||||
nano_sem_give(&driver_data->sem);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int spi_flash_wb_write(struct device *dev, off_t offset,
|
||||
|
@ -160,7 +160,7 @@ static int spi_flash_wb_write(struct device *dev, off_t offset,
|
|||
|
||||
nano_sem_take(&driver_data->sem, TICKS_UNLIMITED);
|
||||
|
||||
if (spi_flash_wb_config(dev) != DEV_OK) {
|
||||
if (spi_flash_wb_config(dev) != 0) {
|
||||
nano_sem_give(&driver_data->sem);
|
||||
return DEV_FAIL;
|
||||
}
|
||||
|
@ -184,14 +184,14 @@ static int spi_flash_wb_write(struct device *dev, off_t offset,
|
|||
|
||||
memcpy(buf + W25QXXDV_LEN_CMD_ADDRESS, data, len);
|
||||
|
||||
if (spi_write(driver_data->spi, buf, len + W25QXXDV_LEN_CMD_ADDRESS) != DEV_OK) {
|
||||
if (spi_write(driver_data->spi, buf, len + W25QXXDV_LEN_CMD_ADDRESS) != 0) {
|
||||
nano_sem_give(&driver_data->sem);
|
||||
return DEV_FAIL;
|
||||
}
|
||||
|
||||
nano_sem_give(&driver_data->sem);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int spi_flash_wb_write_protection_set(struct device *dev, bool enable)
|
||||
|
@ -201,7 +201,7 @@ static int spi_flash_wb_write_protection_set(struct device *dev, bool enable)
|
|||
|
||||
nano_sem_take(&driver_data->sem, TICKS_UNLIMITED);
|
||||
|
||||
if (spi_flash_wb_config(dev) != DEV_OK) {
|
||||
if (spi_flash_wb_config(dev) != 0) {
|
||||
nano_sem_give(&driver_data->sem);
|
||||
return DEV_FAIL;
|
||||
}
|
||||
|
@ -214,14 +214,14 @@ static int spi_flash_wb_write_protection_set(struct device *dev, bool enable)
|
|||
buf = W25QXXDV_CMD_WREN;
|
||||
}
|
||||
|
||||
if (spi_flash_wb_reg_write(dev, &buf) != DEV_OK) {
|
||||
if (spi_flash_wb_reg_write(dev, &buf) != 0) {
|
||||
nano_sem_give(&driver_data->sem);
|
||||
return DEV_FAIL;
|
||||
}
|
||||
|
||||
nano_sem_give(&driver_data->sem);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int spi_flash_wb_erase_internal(struct device *dev,
|
||||
|
@ -278,7 +278,7 @@ static int spi_flash_wb_erase(struct device *dev, off_t offset, size_t size)
|
|||
{
|
||||
struct spi_flash_data *const driver_data = dev->driver_data;
|
||||
uint8_t *buf = driver_data->buf;
|
||||
int ret = DEV_OK;
|
||||
int ret = 0;
|
||||
uint32_t new_offset = offset;
|
||||
uint32_t size_remaining = size;
|
||||
|
||||
|
@ -290,7 +290,7 @@ static int spi_flash_wb_erase(struct device *dev, off_t offset, size_t size)
|
|||
|
||||
nano_sem_take(&driver_data->sem, TICKS_UNLIMITED);
|
||||
|
||||
if (spi_flash_wb_config(dev) != DEV_OK) {
|
||||
if (spi_flash_wb_config(dev) != 0) {
|
||||
nano_sem_give(&driver_data->sem);
|
||||
return DEV_FAIL;
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ static int spi_flash_wb_erase(struct device *dev, off_t offset, size_t size)
|
|||
return DEV_FAIL;
|
||||
}
|
||||
|
||||
while ((size_remaining >= W25QXXDV_SECTOR_SIZE) && (ret == DEV_OK)) {
|
||||
while ((size_remaining >= W25QXXDV_SECTOR_SIZE) && (ret == 0)) {
|
||||
if (size_remaining == CONFIG_SPI_FLASH_W25QXXDV_FLASH_SIZE) {
|
||||
ret = spi_flash_wb_erase_internal(dev, offset, size);
|
||||
break;
|
||||
|
|
|
@ -108,7 +108,7 @@ static void _config(struct device *dev, uint32_t mask, int flags)
|
|||
* @param pin The pin number
|
||||
* @param flags Flags of pin or port
|
||||
*
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
static int gpio_sam3_config(struct device *dev, int access_op,
|
||||
uint32_t pin, int flags)
|
||||
|
@ -124,7 +124,7 @@ static int gpio_sam3_config(struct device *dev, int access_op,
|
|||
return DEV_INVALID_OP;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -135,7 +135,7 @@ static int gpio_sam3_config(struct device *dev, int access_op,
|
|||
* @param pin The pin number
|
||||
* @param value Value to set (0 or 1)
|
||||
*
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
static int gpio_sam3_write(struct device *dev, int access_op,
|
||||
uint32_t pin, uint32_t value)
|
||||
|
@ -165,7 +165,7 @@ static int gpio_sam3_write(struct device *dev, int access_op,
|
|||
return DEV_INVALID_OP;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -176,7 +176,7 @@ static int gpio_sam3_write(struct device *dev, int access_op,
|
|||
* @param pin The pin number
|
||||
* @param value Value of input pin(s)
|
||||
*
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
static int gpio_sam3_read(struct device *dev, int access_op,
|
||||
uint32_t pin, uint32_t *value)
|
||||
|
@ -195,7 +195,7 @@ static int gpio_sam3_read(struct device *dev, int access_op,
|
|||
return DEV_INVALID_OP;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void gpio_sam3_isr(void *arg)
|
||||
|
@ -233,7 +233,7 @@ static int gpio_sam3_set_callback(struct device *dev,
|
|||
|
||||
cfg->cb = callback;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gpio_sam3_enable_callback(struct device *dev,
|
||||
|
@ -256,7 +256,7 @@ static int gpio_sam3_enable_callback(struct device *dev,
|
|||
cfg->enabled_cb |= mask;
|
||||
cfg->port->ier |= mask;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gpio_sam3_disable_callback(struct device *dev,
|
||||
|
@ -279,7 +279,7 @@ static int gpio_sam3_disable_callback(struct device *dev,
|
|||
cfg->enabled_cb &= ~mask;
|
||||
cfg->port->idr |= mask;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gpio_sam3_suspend_port(struct device *dev)
|
||||
|
@ -311,7 +311,7 @@ static struct gpio_driver_api gpio_sam3_drv_api_funcs = {
|
|||
* @brief Initialization function of MMIO
|
||||
*
|
||||
* @param dev Device struct
|
||||
* @return DEV_OK if successful, failed otherwise.
|
||||
* @return 0 if successful, failed otherwise.
|
||||
*/
|
||||
int gpio_sam3_init(struct device *dev)
|
||||
{
|
||||
|
@ -321,7 +321,7 @@ int gpio_sam3_init(struct device *dev)
|
|||
|
||||
cfg->config_func(dev);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Port A */
|
||||
|
|
|
@ -153,7 +153,7 @@ static int gpio_k64_config(struct device *dev, int access_op,
|
|||
}
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -178,7 +178,7 @@ static int gpio_k64_write(struct device *dev, int access_op,
|
|||
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -195,7 +195,7 @@ static int gpio_k64_read(struct device *dev, int access_op,
|
|||
|
||||
/* nothing more to do for GPIO_ACCESS_BY_PORT */
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -205,7 +205,7 @@ static int gpio_k64_set_callback(struct device *dev, gpio_callback_t callback)
|
|||
|
||||
data->callback_func = callback;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -220,7 +220,7 @@ static int gpio_k64_enable_callback(struct device *dev, int access_op,
|
|||
data->port_callback_enable = 1;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -235,7 +235,7 @@ static int gpio_k64_disable_callback(struct device *dev, int access_op,
|
|||
data->port_callback_enable = 0;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -325,13 +325,13 @@ static struct gpio_driver_api gpio_k64_drv_api_funcs = {
|
|||
* @brief Initialization function of Freescale K64-based GPIO port
|
||||
*
|
||||
* @param dev Device structure pointer
|
||||
* @return DEV_OK if successful, failed otherwise.
|
||||
* @return 0 if successful, failed otherwise.
|
||||
*/
|
||||
int gpio_k64_init(struct device *dev)
|
||||
{
|
||||
dev->driver_api = &gpio_k64_drv_api_funcs;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Initialization for Port A */
|
||||
|
|
|
@ -98,7 +98,7 @@ static uint32_t _io_write(uint32_t addr, uint32_t bit, uint32_t value)
|
|||
* @param pin The pin number
|
||||
* @param flags Flags of pin or port
|
||||
*
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
static int gpio_mmio_config(struct device *dev, int access_op,
|
||||
uint32_t pin, int flags)
|
||||
|
@ -153,7 +153,7 @@ static int gpio_mmio_config(struct device *dev, int access_op,
|
|||
*/
|
||||
|
||||
if (!cfg->reg.en) {
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (cfg->cfg_flags & GPIO_MMIO_CFG_EN_MASK) {
|
||||
|
@ -175,7 +175,7 @@ static int gpio_mmio_config(struct device *dev, int access_op,
|
|||
return DEV_INVALID_OP;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -186,7 +186,7 @@ static int gpio_mmio_config(struct device *dev, int access_op,
|
|||
* @param pin The pin number
|
||||
* @param value Value to set (0 or 1)
|
||||
*
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
static int gpio_mmio_write(struct device *dev, int access_op,
|
||||
uint32_t pin, uint32_t value)
|
||||
|
@ -209,7 +209,7 @@ static int gpio_mmio_write(struct device *dev, int access_op,
|
|||
return DEV_INVALID_OP;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -220,7 +220,7 @@ static int gpio_mmio_write(struct device *dev, int access_op,
|
|||
* @param pin The pin number
|
||||
* @param value Value of input pin(s)
|
||||
*
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
static int gpio_mmio_read(struct device *dev, int access_op,
|
||||
uint32_t pin, uint32_t *value)
|
||||
|
@ -244,7 +244,7 @@ static int gpio_mmio_read(struct device *dev, int access_op,
|
|||
return DEV_INVALID_OP;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gpio_mmio_set_callback(struct device *dev,
|
||||
|
@ -305,13 +305,13 @@ static struct gpio_driver_api gpio_mmio_drv_api_funcs = {
|
|||
* @brief Initialization function of MMIO
|
||||
*
|
||||
* @param dev Device struct
|
||||
* @return DEV_OK if successful, failed otherwise.
|
||||
* @return 0 if successful, failed otherwise.
|
||||
*/
|
||||
int gpio_mmio_init(struct device *dev)
|
||||
{
|
||||
dev->driver_api = &gpio_mmio_drv_api_funcs;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Initialization for MMIO_0 */
|
||||
|
|
|
@ -49,7 +49,7 @@ extern "C" {
|
|||
* @brief Initialization function for GPIO driver
|
||||
*
|
||||
* @param dev Device struct
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
extern int gpio_mmio_init(struct device *dev);
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ static inline int _has_i2c_master(struct device *dev)
|
|||
* @param reg Register to read (the PORT0 of the pair of registers).
|
||||
* @param buf Buffer to read data into.
|
||||
*
|
||||
* @return DEV_OK if successful, failed otherwise.
|
||||
* @return 0 if successful, failed otherwise.
|
||||
*/
|
||||
static int _read_port_regs(struct device *dev, uint8_t reg,
|
||||
union gpio_pcal9535a_port_data *buf)
|
||||
|
@ -135,7 +135,7 @@ error:
|
|||
* @param reg Register to write into (the PORT0 of the pair of registers).
|
||||
* @param buf Buffer to write data from.
|
||||
*
|
||||
* @return DEV_OK if successful, failed otherwise.
|
||||
* @return 0 if successful, failed otherwise.
|
||||
*/
|
||||
static int _write_port_regs(struct device *dev, uint8_t reg,
|
||||
union gpio_pcal9535a_port_data *buf)
|
||||
|
@ -169,7 +169,7 @@ static int _write_port_regs(struct device *dev, uint8_t reg,
|
|||
* @param pin The pin number
|
||||
* @param flags Flags of pin or port
|
||||
*
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
static int _setup_pin_dir(struct device *dev, int access_op,
|
||||
uint32_t pin, int flags)
|
||||
|
@ -221,7 +221,7 @@ done:
|
|||
* @param pin The pin number
|
||||
* @param flags Flags of pin or port
|
||||
*
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
static int _setup_pin_pullupdown(struct device *dev, int access_op,
|
||||
uint32_t pin, int flags)
|
||||
|
@ -314,7 +314,7 @@ done:
|
|||
* @param pin The pin number
|
||||
* @param flags Flags of pin or port
|
||||
*
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
static int _setup_pin_polarity(struct device *dev, int access_op,
|
||||
uint32_t pin, int flags)
|
||||
|
@ -369,7 +369,7 @@ done:
|
|||
* @param pin The pin number
|
||||
* @param flags Flags of pin or port
|
||||
*
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
static int gpio_pcal9535a_config(struct device *dev, int access_op,
|
||||
uint32_t pin, int flags)
|
||||
|
@ -419,7 +419,7 @@ done:
|
|||
* @param pin The pin number
|
||||
* @param value Value to set (0 or 1)
|
||||
*
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
static int gpio_pcal9535a_write(struct device *dev, int access_op,
|
||||
uint32_t pin, uint32_t value)
|
||||
|
@ -479,7 +479,7 @@ done:
|
|||
* @param pin The pin number
|
||||
* @param value Value of input pin(s)
|
||||
*
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
static int gpio_pcal9535a_read(struct device *dev, int access_op,
|
||||
uint32_t pin, uint32_t *value)
|
||||
|
@ -492,7 +492,7 @@ static int gpio_pcal9535a_read(struct device *dev, int access_op,
|
|||
}
|
||||
|
||||
ret = _read_port_regs(dev, REG_INPUT_PORT0, &buf);
|
||||
if (ret != DEV_OK) {
|
||||
if (ret != 0) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
@ -574,7 +574,7 @@ static struct gpio_driver_api gpio_pcal9535a_drv_api_funcs = {
|
|||
* @brief Initialization function of PCAL9535A
|
||||
*
|
||||
* @param dev Device struct
|
||||
* @return DEV_OK if successful, failed otherwise.
|
||||
* @return 0 if successful, failed otherwise.
|
||||
*/
|
||||
int gpio_pcal9535a_init(struct device *dev)
|
||||
{
|
||||
|
@ -595,7 +595,7 @@ int gpio_pcal9535a_init(struct device *dev)
|
|||
|
||||
nano_timer_init(&drv_data->timer, (void *) 0);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Initialization for PCAL9535A_0 */
|
||||
|
|
|
@ -34,7 +34,7 @@ extern "C" {
|
|||
* @brief Initialization function for PCAL9535A
|
||||
*
|
||||
* @param dev Device struct
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
extern int gpio_pcal9535a_init(struct device *dev);
|
||||
|
||||
|
|
|
@ -189,7 +189,7 @@ static inline int gpio_qmsi_config(struct device *port, int access_op,
|
|||
} else {
|
||||
qmsi_port_config(port, flags);
|
||||
}
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int gpio_qmsi_write(struct device *port, int access_op,
|
||||
|
@ -208,7 +208,7 @@ static inline int gpio_qmsi_write(struct device *port, int access_op,
|
|||
qm_gpio_write_port(gpio, value);
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int gpio_qmsi_read(struct device *port, int access_op,
|
||||
|
@ -223,7 +223,7 @@ static inline int gpio_qmsi_read(struct device *port, int access_op,
|
|||
*value = qm_gpio_read_port(gpio);
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int gpio_qmsi_set_callback(struct device *port,
|
||||
|
@ -233,7 +233,7 @@ static inline int gpio_qmsi_set_callback(struct device *port,
|
|||
|
||||
context->callback = callback;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int gpio_qmsi_enable_callback(struct device *port, int access_op,
|
||||
|
@ -247,7 +247,7 @@ static inline int gpio_qmsi_enable_callback(struct device *port, int access_op,
|
|||
context->port_callback = 1;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int gpio_qmsi_disable_callback(struct device *port, int access_op,
|
||||
|
@ -261,7 +261,7 @@ static inline int gpio_qmsi_disable_callback(struct device *port, int access_op,
|
|||
context->port_callback = 0;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline int gpio_qmsi_suspend_port(struct device *port)
|
||||
|
@ -316,5 +316,5 @@ int gpio_qmsi_init(struct device *port)
|
|||
}
|
||||
|
||||
port->driver_api = &api_funcs;
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -149,7 +149,7 @@ static int gpio_sch_config(struct device *dev,
|
|||
_gpio_port_config(dev, flags);
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gpio_sch_write(struct device *dev,
|
||||
|
@ -167,7 +167,7 @@ static int gpio_sch_write(struct device *dev,
|
|||
_write_glvl(info->regs, value);
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gpio_sch_read(struct device *dev,
|
||||
|
@ -185,7 +185,7 @@ static int gpio_sch_read(struct device *dev,
|
|||
*value = !!(*value & BIT(pin));
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void _gpio_sch_poll_status(int data, int unused)
|
||||
|
@ -259,7 +259,7 @@ static int gpio_sch_set_callback(struct device *dev,
|
|||
gpio->poll = 0;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gpio_sch_enable_callback(struct device *dev,
|
||||
|
@ -287,7 +287,7 @@ static int gpio_sch_enable_callback(struct device *dev,
|
|||
|
||||
gpio_sch_set_callback(dev, gpio->callback);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gpio_sch_disable_callback(struct device *dev,
|
||||
|
@ -313,17 +313,17 @@ static int gpio_sch_disable_callback(struct device *dev,
|
|||
|
||||
gpio_sch_set_callback(dev, gpio->callback);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gpio_sch_suspend(struct device *dev)
|
||||
{
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int gpio_sch_resume(struct device *dev)
|
||||
{
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct gpio_driver_api gpio_sch_api = {
|
||||
|
@ -347,7 +347,7 @@ int gpio_sch_init(struct device *dev)
|
|||
|
||||
DBG("SCH GPIO Intel Driver initialized on device: %p\n", dev);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if CONFIG_GPIO_SCH_0
|
||||
|
|
|
@ -339,7 +339,7 @@ int glcd_initialize(struct device *port)
|
|||
_rgb_reg_set(dev->i2c, REGISTER_G, color_define[GROVE_RGB_WHITE][1]);
|
||||
_rgb_reg_set(dev->i2c, REGISTER_B, color_define[GROVE_RGB_WHITE][2]);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct glcd_driver grove_lcd_config = {
|
||||
|
|
|
@ -229,7 +229,7 @@ static int i2c_sam3_runtime_configure(struct device *dev, uint32_t config)
|
|||
/* Setup clock wavefore generator */
|
||||
cfg->port->cwgr = clk;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void i2c_sam3_isr(void *arg)
|
||||
|
@ -475,7 +475,7 @@ static int i2c_sam3_transfer(struct device *dev,
|
|||
struct i2c_msg *cur_msg = msgs;
|
||||
uint8_t msg_left = num_msgs;
|
||||
uint32_t pflags = 0;
|
||||
int ret = DEV_OK;
|
||||
int ret = 0;
|
||||
int xfr_ret;
|
||||
|
||||
/* Why bother processing no messages */
|
||||
|
@ -592,13 +592,13 @@ done:
|
|||
static int i2c_sam3_suspend(struct device *dev)
|
||||
{
|
||||
/* TODO - add this code */
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int i2c_sam3_resume(struct device *dev)
|
||||
{
|
||||
/* TODO - add this code */
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct i2c_driver_api api_funcs = {
|
||||
|
@ -623,13 +623,13 @@ static int i2c_sam3_init(struct device *dev)
|
|||
cfg->config_func(dev);
|
||||
|
||||
if (i2c_sam3_runtime_configure(dev, dev_data->dev_config.raw)
|
||||
!= DEV_OK) {
|
||||
!= 0) {
|
||||
DBG("I2C: Cannot set default configuration 0x%x\n",
|
||||
dev_data->dev_config.raw);
|
||||
return DEV_INVALID_CONF;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_I2C_ATMEL_SAM3_0
|
||||
|
|
|
@ -156,7 +156,7 @@ static int _i2c_dw_data_send(struct device *dev)
|
|||
|
||||
dw->state &= ~I2C_DW_CMD_SEND;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (regs->ic_status.bits.tfnf && (dw->xfr_len > 0)) {
|
||||
|
@ -184,7 +184,7 @@ static int _i2c_dw_data_send(struct device *dev)
|
|||
}
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void _i2c_dw_transfer_complete(struct device *dev)
|
||||
|
@ -208,7 +208,7 @@ void i2c_dw_isr(struct device *port)
|
|||
struct i2c_dw_dev_config * const dw = port->driver_data;
|
||||
union ic_interrupt_register intr_stat;
|
||||
uint32_t value;
|
||||
int ret = DEV_OK;
|
||||
int ret = 0;
|
||||
|
||||
volatile struct i2c_dw_registers * const regs =
|
||||
(struct i2c_dw_registers *)rom->base_address;
|
||||
|
@ -275,7 +275,7 @@ void i2c_dw_isr(struct device *port)
|
|||
*/
|
||||
if (((dw->xfr_len == 0)
|
||||
&& !(dw->xfr_flags & I2C_MSG_STOP))
|
||||
|| (ret != DEV_OK)) {
|
||||
|| (ret != 0)) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ static int _i2c_dw_setup(struct device *dev, uint16_t slave_address)
|
|||
regs->ic_sar.bits.ic_sar = slave_address;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int i2c_dw_transfer(struct device *dev,
|
||||
|
@ -527,7 +527,7 @@ static int i2c_dw_runtime_configure(struct device *dev, uint32_t config)
|
|||
struct i2c_dw_rom_config const * const rom = dev->config->config_info;
|
||||
struct i2c_dw_dev_config * const dw = dev->driver_data;
|
||||
uint32_t value = 0;
|
||||
uint32_t rc = DEV_OK;
|
||||
uint32_t rc = 0;
|
||||
|
||||
volatile struct i2c_dw_registers * const regs =
|
||||
(struct i2c_dw_registers *)rom->base_address;
|
||||
|
@ -632,7 +632,7 @@ static int i2c_dw_suspend(struct device *dev)
|
|||
{
|
||||
DBG("I2C: suspend called - function not yet implemented\n");
|
||||
/* TODO - add this code */
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -640,7 +640,7 @@ static int i2c_dw_resume(struct device *dev)
|
|||
{
|
||||
DBG("I2C: resume called - function not yet implemented\n");
|
||||
/* TODO - add this code */
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -718,7 +718,7 @@ int i2c_dw_initialize(struct device *port)
|
|||
|
||||
rom->config_func(port);
|
||||
|
||||
if (i2c_dw_runtime_configure(port, dev->app_config.raw) != DEV_OK) {
|
||||
if (i2c_dw_runtime_configure(port, dev->app_config.raw) != 0) {
|
||||
DBG("I2C: Cannot set default configuration 0x%x\n",
|
||||
dev->app_config.raw);
|
||||
return DEV_NOT_CONFIG;
|
||||
|
@ -726,7 +726,7 @@ int i2c_dw_initialize(struct device *port)
|
|||
|
||||
dev->state = I2C_DW_STATE_READY;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_IOAPIC)
|
||||
|
|
|
@ -97,7 +97,7 @@ static int i2c_qmsi_configure(struct device *dev, uint32_t config)
|
|||
if (qm_i2c_set_config(instance, &qm_cfg) != QM_RC_OK)
|
||||
return DEV_FAIL;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void transfer_complete(uint32_t id, qm_rc_t status)
|
||||
|
@ -180,7 +180,7 @@ static int i2c_qmsi_transfer(struct device *dev, struct i2c_msg *msgs,
|
|||
return DEV_FAIL;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int i2c_qmsi_suspend(struct device *dev)
|
||||
|
@ -238,5 +238,5 @@ static int i2c_qmsi_init(struct device *dev)
|
|||
device_sync_call_init(&driver_data->sync);
|
||||
|
||||
dev->driver_api = &api;
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -230,7 +230,7 @@ static int _i2c_qse_ss_data_send(struct device *dev)
|
|||
|
||||
dw->state &= ~I2C_QSE_SS_CMD_SEND;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
while (_i2c_qse_ss_is_tfnf(dev) && (dw->xfr_len > 0)) {
|
||||
|
@ -259,7 +259,7 @@ static int _i2c_qse_ss_data_send(struct device *dev)
|
|||
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void _i2c_qse_ss_transfer_complete(struct device *dev)
|
||||
|
@ -279,7 +279,7 @@ void i2c_qse_ss_isr(void *arg)
|
|||
struct device *dev = (struct device *)arg;
|
||||
struct i2c_qse_ss_dev_config * const dw = dev->driver_data;
|
||||
uint32_t ic_intr_stat;
|
||||
int ret = DEV_OK;
|
||||
int ret = 0;
|
||||
|
||||
/*
|
||||
* Causes of an intterrupts:
|
||||
|
@ -328,7 +328,7 @@ void i2c_qse_ss_isr(void *arg)
|
|||
*/
|
||||
if (((dw->xfr_len == 0)
|
||||
&& !(dw->xfr_flags & I2C_MSG_STOP))
|
||||
|| (ret != DEV_OK)) {
|
||||
|| (ret != 0)) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
@ -349,7 +349,7 @@ static int _i2c_qse_ss_setup(struct device *dev, uint16_t addr)
|
|||
{
|
||||
struct i2c_qse_ss_dev_config * const dw = dev->driver_data;
|
||||
uint32_t ic_con;
|
||||
int rc = DEV_OK;
|
||||
int rc = 0;
|
||||
|
||||
/* Disable the device controller but enable clock
|
||||
* so we can setup the controller.
|
||||
|
@ -518,7 +518,7 @@ static int i2c_qse_ss_runtime_configure(struct device *dev, uint32_t config)
|
|||
{
|
||||
struct i2c_qse_ss_dev_config * const dw = dev->driver_data;
|
||||
uint32_t value = 0;
|
||||
uint32_t rc = DEV_OK;
|
||||
uint32_t rc = 0;
|
||||
uint32_t ic_con;
|
||||
uint32_t spklen;
|
||||
|
||||
|
@ -598,14 +598,14 @@ static int i2c_qse_ss_suspend(struct device *dev)
|
|||
{
|
||||
DBG("I2C_SS: suspend called - function not yet implemented\n");
|
||||
/* TODO - add this code */
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int i2c_qse_ss_resume(struct device *dev)
|
||||
{
|
||||
DBG("I2C_SS: resume called - function not yet implemented\n");
|
||||
/* TODO - add this code */
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct i2c_driver_api ss_funcs = {
|
||||
|
@ -631,7 +631,7 @@ int i2c_qse_ss_initialize(struct device *dev)
|
|||
|
||||
device_sync_call_init(&dw->sync);
|
||||
|
||||
if (i2c_qse_ss_runtime_configure(dev, dw->app_config.raw) != DEV_OK) {
|
||||
if (i2c_qse_ss_runtime_configure(dev, dw->app_config.raw) != 0) {
|
||||
DBG("I2C_SS: Cannot set default configuration 0x%x\n",
|
||||
dw->app_config.raw);
|
||||
return DEV_NOT_CONFIG;
|
||||
|
@ -639,7 +639,7 @@ int i2c_qse_ss_initialize(struct device *dev)
|
|||
|
||||
dw->state = I2C_QSE_SS_STATE_READY;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if CONFIG_I2C_QUARK_SE_SS_0
|
||||
|
|
|
@ -215,7 +215,7 @@ int quark_se_ipm_controller_initialize(struct device *d)
|
|||
if (config->controller_init) {
|
||||
return config->controller_init();
|
||||
}
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -229,7 +229,7 @@ int quark_se_ipm_initialize(struct device *d)
|
|||
inbound_channels |= (0x3 << (config->channel * 2));
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -232,7 +232,7 @@ static int _bt_nble_init(struct device *unused)
|
|||
net_buf_pool_init(rx_pool);
|
||||
net_buf_pool_init(tx_pool);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEVICE_INIT(bt_nble, "", _bt_nble_init, NULL, NULL, NANOKERNEL,
|
||||
|
|
|
@ -47,7 +47,7 @@ struct fsl_k64_data {
|
|||
static inline int config_port_a(mem_addr_t *addr)
|
||||
{
|
||||
*addr = CONFIG_PORT_K64_A_BASE_ADDR;
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#define config_port_a(addr) DEV_NO_ACCESS
|
||||
|
@ -57,7 +57,7 @@ static inline int config_port_a(mem_addr_t *addr)
|
|||
static inline int config_port_b(mem_addr_t *addr)
|
||||
{
|
||||
*addr = CONFIG_PORT_K64_B_BASE_ADDR;
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#define config_port_b(addr) DEV_NO_ACCESS
|
||||
|
@ -67,7 +67,7 @@ static inline int config_port_b(mem_addr_t *addr)
|
|||
static inline int config_port_c(mem_addr_t *addr)
|
||||
{
|
||||
*addr = CONFIG_PORT_K64_C_BASE_ADDR;
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#define config_port_c(addr) DEV_NO_ACCESS
|
||||
|
@ -77,7 +77,7 @@ static inline int config_port_c(mem_addr_t *addr)
|
|||
static inline int config_port_d(mem_addr_t *addr)
|
||||
{
|
||||
*addr = CONFIG_PORT_K64_D_BASE_ADDR;
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#define config_port_d(addr) DEV_NO_ACCESS
|
||||
|
@ -87,7 +87,7 @@ static inline int config_port_d(mem_addr_t *addr)
|
|||
static inline int config_port_e(mem_addr_t *addr)
|
||||
{
|
||||
*addr = CONFIG_PORT_K64_E_BASE_ADDR;
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#define config_port_e(addr) DEV_NO_ACCESS
|
||||
|
@ -151,7 +151,7 @@ static int _fsl_k64_get_gpio_dev(struct device *dev,
|
|||
return DEV_NO_ACCESS;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -179,7 +179,7 @@ static int _fsl_k64_set_pin(struct device *dev,
|
|||
|
||||
status = _fsl_k64_get_port_addr(pin_id, &port_base_addr);
|
||||
|
||||
if (status != DEV_OK) {
|
||||
if (status != 0) {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -193,7 +193,7 @@ static int _fsl_k64_set_pin(struct device *dev,
|
|||
|
||||
status = _fsl_k64_get_gpio_dev(dev, port_base_addr, &gpio_dev);
|
||||
|
||||
if (status != DEV_OK) {
|
||||
if (status != 0) {
|
||||
return status;
|
||||
} else if (gpio_dev == NULL) {
|
||||
return DEV_NOT_CONFIG;
|
||||
|
@ -207,7 +207,7 @@ static int _fsl_k64_set_pin(struct device *dev,
|
|||
|
||||
status = gpio_pin_configure(gpio_dev, port_pin, gpio_setting);
|
||||
|
||||
if (status != DEV_OK) {
|
||||
if (status != 0) {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -220,7 +220,7 @@ static int _fsl_k64_set_pin(struct device *dev,
|
|||
|
||||
sys_write32(func, port_base_addr + K64_PINMUX_CTRL_OFFSET(port_pin));
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int _fsl_k64_get_pin(struct device *dev,
|
||||
|
@ -242,7 +242,7 @@ static int _fsl_k64_get_pin(struct device *dev,
|
|||
|
||||
status = _fsl_k64_get_port_addr(pin_id, &port_base_addr);
|
||||
|
||||
if (status != DEV_OK) {
|
||||
if (status != 0) {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
@ -260,7 +260,7 @@ static int _fsl_k64_get_pin(struct device *dev,
|
|||
|
||||
status = _fsl_k64_get_gpio_dev(dev, port_base_addr, &gpio_dev);
|
||||
|
||||
if (status != DEV_OK) {
|
||||
if (status != 0) {
|
||||
return status;
|
||||
} else if (gpio_dev == NULL) {
|
||||
return DEV_NOT_CONFIG;
|
||||
|
@ -275,7 +275,7 @@ static int _fsl_k64_get_pin(struct device *dev,
|
|||
}
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int fsl_k64_dev_set(struct device *dev,
|
||||
|
@ -340,7 +340,7 @@ int pinmux_fsl_k64_initialize(struct device *port)
|
|||
}
|
||||
#endif
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -112,7 +112,7 @@ static int pwm_dw_configure(struct device *dev, int access_op,
|
|||
ARG_UNUSED(pwm);
|
||||
ARG_UNUSED(flags);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __set_one_port(struct device *dev, uint32_t pwm,
|
||||
|
@ -127,7 +127,7 @@ static int __set_one_port(struct device *dev, uint32_t pwm,
|
|||
|
||||
if ((off == 0) || (on == 0)) {
|
||||
/* stop PWM if so specified */
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* write timer for pin to stay low */
|
||||
|
@ -139,7 +139,7 @@ static int __set_one_port(struct device *dev, uint32_t pwm,
|
|||
/* Enable timer so it starts running and counting */
|
||||
sys_write32((TIMER_INIT_CTRL | 0x01), (reg_addr + REG_TMR_CTRL));
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -158,7 +158,7 @@ static int __set_one_port(struct device *dev, uint32_t pwm,
|
|||
* @param on Duration for pin to stay high (must be >= 2)
|
||||
* @param off Duration for pin to stay low (must be >= 2)
|
||||
*
|
||||
* @return DEV_OK
|
||||
* @return 0
|
||||
*/
|
||||
static int pwm_dw_set_values(struct device *dev, int access_op,
|
||||
uint32_t pwm, uint32_t on, uint32_t off)
|
||||
|
@ -180,7 +180,7 @@ static int pwm_dw_set_values(struct device *dev, int access_op,
|
|||
__set_one_port(dev, i, on, off);
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return DEV_INVALID_OP;
|
||||
|
@ -227,13 +227,13 @@ static struct pwm_driver_api pwm_dw_drv_api_funcs = {
|
|||
* @brief Initialization function of PCA9685
|
||||
*
|
||||
* @param dev Device struct
|
||||
* @return DEV_OK if successful, failed otherwise.
|
||||
* @return 0 if successful, failed otherwise.
|
||||
*/
|
||||
int pwm_dw_init(struct device *dev)
|
||||
{
|
||||
dev->driver_api = &pwm_dw_drv_api_funcs;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Initialization for PWM_DW */
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
*
|
||||
* @param ftm_num index indicating which FTM
|
||||
*
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
|
||||
static int pwm_ftm_clk_enable(uint8_t ftm_num)
|
||||
|
@ -99,7 +99,7 @@ static int pwm_ftm_clk_enable(uint8_t ftm_num)
|
|||
|
||||
sim->scgc6 |= 1 << (24 + ftm_num);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -114,13 +114,13 @@ static int pwm_ftm_clk_enable(uint8_t ftm_num)
|
|||
* @param channel The pwm channel number
|
||||
* @param flags Device flags (unused)
|
||||
*
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
|
||||
static int pwm_ftm_configure(struct device *dev, int access_op,
|
||||
uint32_t channel, int flags)
|
||||
{
|
||||
int return_val = DEV_OK;
|
||||
int return_val = 0;
|
||||
|
||||
uint32_t clock_source;
|
||||
uint32_t prescale;
|
||||
|
@ -274,7 +274,7 @@ static int pwm_ftm_configure(struct device *dev, int access_op,
|
|||
* signal will be off (low if positive polarity) for the rest of
|
||||
* the cycle.
|
||||
*
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
|
||||
static int pwm_ftm_set_values(struct device *dev, int access_op,
|
||||
|
@ -440,7 +440,7 @@ static int pwm_ftm_set_values(struct device *dev, int access_op,
|
|||
|
||||
DBG("pwm_ftm_set_values done.\n");
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -453,7 +453,7 @@ static int pwm_ftm_set_values(struct device *dev, int access_op,
|
|||
* @param channel The pwm channel number
|
||||
* @param duty Percentage of time signal is on (value between 0 and 100)
|
||||
*
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
|
||||
static int pwm_ftm_set_duty_cycle(struct device *dev, int access_op,
|
||||
|
@ -549,7 +549,7 @@ static int pwm_ftm_set_duty_cycle(struct device *dev, int access_op,
|
|||
* @param channel The pwm channel number
|
||||
* @param phase Clock ticks of delay before start of the pulse (must be 0)
|
||||
*
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
|
||||
static int pwm_ftm_set_phase(struct device *dev, int access_op,
|
||||
|
@ -601,7 +601,7 @@ static int pwm_ftm_set_phase(struct device *dev, int access_op,
|
|||
|
||||
DBG("pwm_ftm_set_phase done.\n");
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
#else /*COMBINE_MODE_SUPPORT*/
|
||||
|
||||
ARG_UNUSED(dev);
|
||||
|
@ -623,7 +623,7 @@ static int pwm_ftm_set_phase(struct device *dev, int access_op,
|
|||
*
|
||||
* @param dev Device struct
|
||||
*
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
|
||||
static int pwm_ftm_suspend(struct device *dev)
|
||||
|
@ -647,7 +647,7 @@ static int pwm_ftm_suspend(struct device *dev)
|
|||
|
||||
DBG("pwm_ftm_suspend done.\n");
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
@ -660,7 +660,7 @@ static int pwm_ftm_suspend(struct device *dev)
|
|||
*
|
||||
* @param dev Device struct
|
||||
*
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
|
||||
static int pwm_ftm_resume(struct device *dev)
|
||||
|
@ -688,7 +688,7 @@ static int pwm_ftm_resume(struct device *dev)
|
|||
|
||||
DBG("pwm_ftm_resume done.\n");
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct pwm_driver_api pwm_ftm_drv_api_funcs = {
|
||||
|
@ -704,7 +704,7 @@ static struct pwm_driver_api pwm_ftm_drv_api_funcs = {
|
|||
* @brief Initialization function of FTM
|
||||
*
|
||||
* @param dev Device struct
|
||||
* @return DEV_OK if successful, failed otherwise.
|
||||
* @return 0 if successful, failed otherwise.
|
||||
*/
|
||||
int pwm_ftm_init(struct device *dev)
|
||||
{
|
||||
|
@ -713,7 +713,7 @@ int pwm_ftm_init(struct device *dev)
|
|||
|
||||
dev->driver_api = &pwm_ftm_drv_api_funcs;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Initialization for PWM_K64_FTM_0 */
|
||||
|
|
|
@ -147,7 +147,7 @@
|
|||
* @brief Initialization function for FlexTimer Module FTM (PWM mode)
|
||||
*
|
||||
* @param dev Device struct
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
extern int pwm_ftm_init(struct device *dev);
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ static int pwm_pca9685_configure(struct device *dev, int access_op,
|
|||
ARG_UNUSED(pwm);
|
||||
ARG_UNUSED(flags);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int pwm_pca9685_set_values(struct device *dev, int access_op,
|
||||
|
@ -184,7 +184,7 @@ static struct pwm_driver_api pwm_pca9685_drv_api_funcs = {
|
|||
* @brief Initialization function of PCA9685
|
||||
*
|
||||
* @param dev Device struct
|
||||
* @return DEV_OK if successful, failed otherwise.
|
||||
* @return 0 if successful, failed otherwise.
|
||||
*/
|
||||
int pwm_pca9685_init(struct device *dev)
|
||||
{
|
||||
|
@ -211,11 +211,11 @@ int pwm_pca9685_init(struct device *dev)
|
|||
buf[1] = (1 << 5); /* register addr auto increment */
|
||||
|
||||
ret = i2c_write(i2c_master, buf, 2, config->i2c_slave_addr);
|
||||
if (ret != DEV_OK) {
|
||||
if (ret != 0) {
|
||||
return DEV_NOT_CONFIG;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Initialization for PWM_PCA9685_0 */
|
||||
|
|
|
@ -32,7 +32,7 @@ extern "C" {
|
|||
* @brief Initialization function for PCA9685
|
||||
*
|
||||
* @param dev Device struct
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
extern int pwm_pca9685_init(struct device *dev);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ static int pwm_qmsi_configure(struct device *dev, int access_op,
|
|||
ARG_UNUSED(pwm);
|
||||
ARG_UNUSED(flags);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __set_one_port(qm_pwm_t id, uint32_t pwm, uint32_t on, uint32_t off)
|
||||
|
@ -42,7 +42,7 @@ static int __set_one_port(qm_pwm_t id, uint32_t pwm, uint32_t on, uint32_t off)
|
|||
|
||||
if ((off == 0) || (on == 0)) {
|
||||
/* stop PWM if so specified */
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* PWM mode, user-defined count mode, timer disabled */
|
||||
|
@ -62,7 +62,7 @@ static int __set_one_port(qm_pwm_t id, uint32_t pwm, uint32_t on, uint32_t off)
|
|||
/* Enable timer so it starts running and counting */
|
||||
qm_pwm_start(id, pwm);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -82,7 +82,7 @@ static int __set_one_port(qm_pwm_t id, uint32_t pwm, uint32_t on, uint32_t off)
|
|||
* on: Duration for pin to stay high (must be >= 2)
|
||||
* off: Duration for pin to stay low (must be >= 2)
|
||||
*
|
||||
* return DEV_OK, DEV_INVALID_OP
|
||||
* return 0, DEV_INVALID_OP
|
||||
*/
|
||||
static int pwm_qmsi_set_values(struct device *dev, int access_op,
|
||||
uint32_t pwm, uint32_t on, uint32_t off)
|
||||
|
@ -106,7 +106,7 @@ static int pwm_qmsi_set_values(struct device *dev, int access_op,
|
|||
return DEV_INVALID_OP;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
|
@ -167,7 +167,7 @@ static int pwm_qmsi_init(struct device *dev)
|
|||
{
|
||||
dev->driver_api = &pwm_qmsi_drv_api_funcs;
|
||||
clk_periph_enable(CLK_PERIPH_PWM_REGISTER | CLK_PERIPH_CLK);
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEVICE_INIT(pwm_qmsi_0, CONFIG_PWM_QMSI_DEV_NAME, pwm_qmsi_init,
|
||||
|
|
|
@ -138,7 +138,7 @@ static int rtc_dw_set_alarm(struct device *dev, const uint32_t alarm_val)
|
|||
|
||||
sys_write32(alarm_val, rtc_dev->base_address + RTC_CMR);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -167,7 +167,7 @@ static int rtc_dw_set_config(struct device *dev, struct rtc_config *config)
|
|||
sys_clear_bit(rtc_dev->base_address + RTC_CCR, 0);
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -216,6 +216,6 @@ int rtc_dw_init(struct device *dev)
|
|||
|
||||
dev->driver_api = &funcs;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,12 +56,12 @@ static int rtc_qmsi_set_config(struct device *dev, struct rtc_config *cfg)
|
|||
if (qm_rtc_set_config(QM_RTC_0, &qm_cfg) != QM_RC_OK)
|
||||
return DEV_FAIL;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int rtc_qmsi_set_alarm(struct device *dev, const uint32_t alarm_val)
|
||||
{
|
||||
return qm_rtc_set_alarm(QM_RTC_0, alarm_val) == QM_RC_OK ? DEV_OK : DEV_FAIL;
|
||||
return qm_rtc_set_alarm(QM_RTC_0, alarm_val) == QM_RC_OK ? 0 : DEV_FAIL;
|
||||
}
|
||||
|
||||
static uint32_t rtc_qmsi_read(struct device *dev)
|
||||
|
@ -89,7 +89,7 @@ static int rtc_qmsi_init(struct device *dev)
|
|||
QM_SCSS_INT->int_rtc_mask &= ~BIT(0);
|
||||
|
||||
dev->driver_api = &api;
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEVICE_INIT(rtc, CONFIG_RTC_DRV_NAME, &rtc_qmsi_init,
|
||||
|
|
|
@ -51,7 +51,7 @@ static int sensor_init(struct device *dev)
|
|||
sensor_fiber_main, 0, 0,
|
||||
CONFIG_SENSOR_DELAYED_WORK_PRIORITY, 0);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(sensor_init, PRIMARY, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
|
||||
|
|
|
@ -48,7 +48,7 @@ int mcp9808_reg_read(struct mcp9808_data *data, uint8_t reg, uint16_t *val)
|
|||
|
||||
*val = sys_be16_to_cpu(*val);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mcp9808_sample_fetch(struct device *dev)
|
||||
|
@ -80,7 +80,7 @@ static int mcp9808_channel_get(struct device *dev,
|
|||
val->val1 -= 256;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct sensor_driver_api mcp9808_api_funcs = {
|
||||
|
@ -107,7 +107,7 @@ int mcp9808_init(struct device *dev)
|
|||
|
||||
mcp9808_setup_interrupt(dev);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEVICE_INIT(mcp9808, CONFIG_MCP9808_DEV_NAME, mcp9808_init, &mcp9808_data,
|
||||
|
|
|
@ -59,7 +59,7 @@ static int mcp9808_reg_update(struct mcp9808_data *data, uint8_t reg,
|
|||
new_val |= val;
|
||||
|
||||
if (new_val == old_val) {
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mcp9808_reg_write(data, reg, new_val);
|
||||
|
|
|
@ -87,7 +87,7 @@ int sx9500_update_bits(struct sx9500_data *data, uint8_t reg,
|
|||
new_val = (old_val & ~mask) | (val & mask);
|
||||
|
||||
if (new_val == old_val) {
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return sx9500_reg_write(data, reg, new_val);
|
||||
|
@ -116,7 +116,7 @@ static int sx9500_channel_get(struct device *dev,
|
|||
val->val1 = !!(data->prox_stat &
|
||||
(1 << (4 + CONFIG_SX9500_PROX_CHANNEL)));
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct sensor_driver_api sx9500_api_funcs = {
|
||||
|
@ -185,7 +185,7 @@ int sx9500_init(struct device *dev)
|
|||
return ret;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
DEVICE_INIT(sx9500, CONFIG_SX9500_DEV_NAME, sx9500_init, &sx9500_data,
|
||||
|
|
|
@ -76,7 +76,7 @@ int sx9500_trigger_set(struct device *dev,
|
|||
#else
|
||||
static inline int sx9500_setup_interrupt(struct device *dev)
|
||||
{
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ int sx9500_trigger_set(struct device *dev,
|
|||
return DEV_INVALID_CONF;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SX9500_TRIGGER_OWN_FIBER
|
||||
|
@ -160,5 +160,5 @@ int sx9500_setup_interrupt(struct device *dev)
|
|||
CONFIG_SX9500_FIBER_PRIORITY, 0);
|
||||
#endif
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -164,7 +164,7 @@ static void baudrate_set(struct device *dev,
|
|||
*
|
||||
* @param dev UART device struct
|
||||
*
|
||||
* @return DEV_OK
|
||||
* @return 0
|
||||
*/
|
||||
static int uart_sam3_init(struct device *dev)
|
||||
{
|
||||
|
@ -195,7 +195,7 @@ static int uart_sam3_init(struct device *dev)
|
|||
|
||||
dev->driver_api = &uart_sam3_driver_api;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -62,7 +62,7 @@ static struct uart_driver_api uart_k20_driver_api;
|
|||
*
|
||||
* @param dev UART device struct
|
||||
*
|
||||
* @return DEV_OK
|
||||
* @return 0
|
||||
*/
|
||||
static int uart_k20_init(struct device *dev)
|
||||
{
|
||||
|
@ -101,7 +101,7 @@ static int uart_k20_init(struct device *dev)
|
|||
|
||||
dev->driver_api = &uart_k20_driver_api;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -287,7 +287,7 @@ static inline int ns16550_pci_uart_scan(struct device *dev)
|
|||
*
|
||||
* @param dev UART device struct
|
||||
*
|
||||
* @return DEV_OK if successful, failed othersie
|
||||
* @return 0 if successful, failed othersie
|
||||
*/
|
||||
static int uart_ns16550_init(struct device *dev)
|
||||
{
|
||||
|
@ -343,7 +343,7 @@ static int uart_ns16550_init(struct device *dev)
|
|||
|
||||
dev->driver_api = &uart_ns16550_driver_api;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -627,7 +627,7 @@ static void uart_ns16550_isr(void *arg)
|
|||
* @param ctrl The line control to be manipulated
|
||||
* @param val Value to set the line control
|
||||
*
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
static int uart_ns16550_line_ctrl_set(struct device *dev,
|
||||
uint32_t ctrl, uint32_t val)
|
||||
|
@ -637,7 +637,7 @@ static int uart_ns16550_line_ctrl_set(struct device *dev,
|
|||
switch (ctrl) {
|
||||
case LINE_CTRL_BAUD_RATE:
|
||||
set_baud_rate(dev, val);
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
|
||||
case LINE_CTRL_RTS:
|
||||
case LINE_CTRL_DTR:
|
||||
|
@ -655,7 +655,7 @@ static int uart_ns16550_line_ctrl_set(struct device *dev,
|
|||
mdc &= ~(chg);
|
||||
}
|
||||
OUTBYTE(MDC(dev), mdc);
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return DEV_INVALID_OP;
|
||||
|
@ -672,7 +672,7 @@ static int uart_ns16550_line_ctrl_set(struct device *dev,
|
|||
* @param cmd Command to driver
|
||||
* @param p Parameter to the command
|
||||
*
|
||||
* @return DEV_OK if successful, failed otherwise
|
||||
* @return 0 if successful, failed otherwise
|
||||
*/
|
||||
static int uart_ns16550_drv_cmd(struct device *dev, uint32_t cmd, uint32_t p)
|
||||
{
|
||||
|
@ -681,7 +681,7 @@ static int uart_ns16550_drv_cmd(struct device *dev, uint32_t cmd, uint32_t p)
|
|||
#ifdef CONFIG_UART_NS16550_DLF
|
||||
case CMD_SET_DLF:
|
||||
set_dlf(dev, p);
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
|
|
@ -43,13 +43,13 @@ static struct uart_driver_api uart_nsim_driver_api;
|
|||
*
|
||||
* @param dev UART device struct
|
||||
*
|
||||
* @return DEV_OK
|
||||
* @return 0
|
||||
*/
|
||||
static int uart_nsim_init(struct device *dev)
|
||||
{
|
||||
ARG_UNUSED(dev);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -315,7 +315,7 @@ static int uart_qmsi_line_ctrl_set(struct device *dev, uint32_t ctrl, uint32_t v
|
|||
return DEV_NO_SUPPORT;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
#endif /* CONFIG_UART_LINE_CTRL */
|
||||
|
||||
|
@ -377,5 +377,5 @@ static int uart_qmsi_init(struct device *dev)
|
|||
|
||||
dev->driver_api = &api;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -267,7 +267,7 @@ static inline void line_control_defaults_set(struct device *dev)
|
|||
*
|
||||
* @param dev UART device struct
|
||||
*
|
||||
* @return DEV_OK
|
||||
* @return 0
|
||||
*/
|
||||
static int uart_stellaris_init(struct device *dev)
|
||||
{
|
||||
|
@ -283,7 +283,7 @@ static int uart_stellaris_init(struct device *dev)
|
|||
|
||||
dev->driver_api = &uart_stellaris_driver_api;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,7 +42,7 @@ static int isr_register(struct device *dev, isr_t isr_func,
|
|||
if (!clients->client[i].isr_dev) {
|
||||
clients->client[i].isr_dev = isr_dev;
|
||||
clients->client[i].isr_func = isr_func;
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return DEV_FAIL;
|
||||
|
@ -63,7 +63,7 @@ static inline int enable(struct device *dev, struct device *isr_dev)
|
|||
if (clients->client[i].isr_dev == isr_dev) {
|
||||
clients->client[i].enabled = 1;
|
||||
irq_enable(config->irq_num);
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return DEV_FAIL;
|
||||
|
@ -97,7 +97,7 @@ static inline int disable(struct device *dev, struct device *isr_dev)
|
|||
if (last_enabled_isr(clients, config->client_count)) {
|
||||
irq_disable(config->irq_num);
|
||||
}
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return DEV_FAIL;
|
||||
|
|
|
@ -238,7 +238,7 @@ static int spi_dw_configure(struct device *dev,
|
|||
/* Configuring the rate */
|
||||
write_baudr(config->max_sys_freq, info->regs);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int spi_dw_slave_select(struct device *dev, uint32_t slave)
|
||||
|
@ -253,7 +253,7 @@ static int spi_dw_slave_select(struct device *dev, uint32_t slave)
|
|||
|
||||
spi->slave = 1 << (slave - 1);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int spi_dw_transceive(struct device *dev,
|
||||
|
@ -310,7 +310,7 @@ static int spi_dw_transceive(struct device *dev,
|
|||
return DEV_FAIL;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int spi_dw_suspend(struct device *dev)
|
||||
|
@ -319,7 +319,7 @@ static int spi_dw_suspend(struct device *dev)
|
|||
|
||||
_clock_off(dev);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int spi_dw_resume(struct device *dev)
|
||||
|
@ -328,7 +328,7 @@ static int spi_dw_resume(struct device *dev)
|
|||
|
||||
_clock_on(dev);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void spi_dw_isr(void *arg)
|
||||
|
@ -398,7 +398,7 @@ int spi_dw_init(struct device *dev)
|
|||
|
||||
DBG("Designware SPI driver initialized on device: %p\n", dev);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_IOAPIC) || defined(CONFIG_MVIC)
|
||||
|
|
|
@ -259,7 +259,7 @@ static int spi_intel_configure(struct device *dev,
|
|||
/* Configuring the rate */
|
||||
write_dds_rate(INTEL_SPI_DSS_RATE(config->max_sys_freq), info->regs);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int spi_intel_transceive(struct device *dev,
|
||||
|
@ -303,7 +303,7 @@ static int spi_intel_transceive(struct device *dev,
|
|||
return DEV_FAIL;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int spi_intel_suspend(struct device *dev)
|
||||
|
@ -315,7 +315,7 @@ static int spi_intel_suspend(struct device *dev)
|
|||
clear_bit_sscr0_sse(info->regs);
|
||||
irq_disable(info->irq);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int spi_intel_resume(struct device *dev)
|
||||
|
@ -327,7 +327,7 @@ static int spi_intel_resume(struct device *dev)
|
|||
set_bit_sscr0_sse(info->regs);
|
||||
irq_enable(info->irq);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void spi_intel_isr(void *arg)
|
||||
|
@ -417,7 +417,7 @@ int spi_intel_init(struct device *dev)
|
|||
|
||||
DBG("SPI Intel Driver initialized on device: %p\n", dev);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_IOAPIC
|
||||
|
|
|
@ -425,7 +425,7 @@ static uint32_t spi_k64_set_delay(enum spi_k64_delay_id delay_id,
|
|||
* @param dev Pointer to the device structure for the driver instance
|
||||
* @param config Pointer to the application provided configuration
|
||||
*
|
||||
* @return DEV_OK if successful, another DEV_* code otherwise.
|
||||
* @return 0 if successful, another DEV_* code otherwise.
|
||||
*/
|
||||
static int spi_k64_configure(struct device *dev, struct spi_config *config)
|
||||
{
|
||||
|
@ -528,7 +528,7 @@ static int spi_k64_configure(struct device *dev, struct spi_config *config)
|
|||
|
||||
spi_data->cont_pcs_sel = SPI_CONT_PCS_GET(flags);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -543,7 +543,7 @@ static int spi_k64_configure(struct device *dev, struct spi_config *config)
|
|||
* Select inactive state setting, MCR[PCSIS], determined by the configuration
|
||||
* data parameter to spi_configure()/spi_k64_configure().
|
||||
*
|
||||
* @return DEV_OK if successful, another DEV_* code otherwise.
|
||||
* @return 0 if successful, another DEV_* code otherwise.
|
||||
*/
|
||||
static int spi_k64_slave_select(struct device *dev, uint32_t slave)
|
||||
{
|
||||
|
@ -562,7 +562,7 @@ static int spi_k64_slave_select(struct device *dev, uint32_t slave)
|
|||
|
||||
spi_data->pcs = (uint8_t)slave;
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -574,7 +574,7 @@ static int spi_k64_slave_select(struct device *dev, uint32_t slave)
|
|||
* @param rx_buf Memory buffer that data should be transferred to
|
||||
* @param rx_buf_len Size of the memory buffer available for writing to
|
||||
*
|
||||
* @return DEV_OK if successful, another DEV_* code otherwise.
|
||||
* @return 0 if successful, another DEV_* code otherwise.
|
||||
*/
|
||||
static int spi_k64_transceive(struct device *dev,
|
||||
const void *tx_buf, uint32_t tx_buf_len,
|
||||
|
@ -645,13 +645,13 @@ static int spi_k64_transceive(struct device *dev,
|
|||
return DEV_FAIL;
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Suspend SPI host controller operations.
|
||||
* @param dev Pointer to the device structure for the driver instance
|
||||
* @return DEV_OK if successful, another DEV_* code otherwise.
|
||||
* @return 0 if successful, another DEV_* code otherwise.
|
||||
*/
|
||||
static int spi_k64_suspend(struct device *dev)
|
||||
{
|
||||
|
@ -669,13 +669,13 @@ static int spi_k64_suspend(struct device *dev)
|
|||
DBG("SPI Controller dev %p is running. Waiting to stop.\n", dev);
|
||||
}
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Resume SPI host controller operations.
|
||||
* @param dev Pointer to the device structure for the driver instance
|
||||
* @return DEV_OK if successful, another DEV_* code otherwise.
|
||||
* @return 0 if successful, another DEV_* code otherwise.
|
||||
*/
|
||||
static int spi_k64_resume(struct device *dev)
|
||||
{
|
||||
|
@ -689,7 +689,7 @@ static int spi_k64_resume(struct device *dev)
|
|||
|
||||
irq_enable(info->irq);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1027,7 +1027,7 @@ int spi_k64_init(struct device *dev)
|
|||
|
||||
/* operation remains disabled (MCR[HALT] = 1)*/
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* system bindings */
|
||||
|
|
|
@ -87,7 +87,7 @@ static int spi_qmsi_configure(struct device *dev,
|
|||
cfg->clk_divider = config->max_sys_freq;
|
||||
|
||||
/* Will set the configuration before the transfer starts */
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void pending_transfer_complete(uint32_t id, qm_rc_t rc)
|
||||
|
@ -139,7 +139,7 @@ static int spi_qmsi_slave_select(struct device *dev, uint32_t slave)
|
|||
struct spi_qmsi_config *spi_config = dev->config->config_info;
|
||||
qm_spi_t spi = spi_config->spi;
|
||||
|
||||
return qm_spi_slave_select(spi, 1 << (slave - 1)) ? DEV_FAIL : DEV_OK;
|
||||
return qm_spi_slave_select(spi, 1 << (slave - 1)) ? DEV_FAIL : 0;
|
||||
}
|
||||
|
||||
static inline uint8_t frame_size_to_dfs(qm_spi_frame_size_t frame_size)
|
||||
|
@ -210,7 +210,7 @@ static int spi_qmsi_transceive(struct device *dev,
|
|||
|
||||
device_sync_call_wait(&context->sync);
|
||||
|
||||
return context->rc ? DEV_FAIL : DEV_OK;
|
||||
return context->rc ? DEV_FAIL : 0;
|
||||
}
|
||||
|
||||
static int spi_qmsi_suspend(struct device *dev)
|
||||
|
@ -286,7 +286,7 @@ static int spi_qmsi_init(struct device *dev)
|
|||
|
||||
device_sync_call_init(&context->sync);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SPI_QMSI_PORT_0
|
||||
|
|
|
@ -138,7 +138,7 @@ static int wdt_dw_set_config(struct device *dev, struct wdt_config *config)
|
|||
|
||||
wdt_dw_reload(dev);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct wdt_driver_api wdt_dw_funcs = {
|
||||
|
|
|
@ -52,7 +52,7 @@ static int set_config(struct device *dev, struct wdt_config *cfg)
|
|||
qm_wdt_set_config(QM_WDT_0, &qm_cfg);
|
||||
qm_wdt_start(QM_WDT_0);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void reload(struct device *dev)
|
||||
|
|
|
@ -137,7 +137,7 @@ static inline void adc_disable(struct device *dev)
|
|||
* @param dev Pointer to the device structure for the driver instance.
|
||||
* @param seq_table Pointer to the structure representing the sequence table.
|
||||
*
|
||||
* @retval DEV_OK On success
|
||||
* @retval 0 On success
|
||||
* @retval else Otherwise.
|
||||
*/
|
||||
static inline int adc_read(struct device *dev, struct adc_seq_table *seq_table)
|
||||
|
|
|
@ -162,7 +162,7 @@ void glcd_color_set(struct device *port, uint8_t r, uint8_t g, uint8_t b);
|
|||
*
|
||||
* @param port Pointer to device structure for driver instance.
|
||||
*
|
||||
* @return Returns DEV_OK if all passes
|
||||
* @return Returns 0 if all passes
|
||||
*/
|
||||
int glcd_initialize(struct device *port);
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ struct flash_driver_api {
|
|||
* @param data : Buffer to store read data
|
||||
* @param len : Number of bytes to read.
|
||||
*
|
||||
* @return DEV_OK on success else DEV_* code
|
||||
* @return 0 on success else DEV_* code
|
||||
*/
|
||||
static inline int flash_read(struct device *dev, off_t offset, void *data,
|
||||
size_t len)
|
||||
|
@ -78,7 +78,7 @@ static inline int flash_read(struct device *dev, off_t offset, void *data,
|
|||
* @param data : data to write
|
||||
* @param len : Number of bytes to write
|
||||
*
|
||||
* @return DEV_OK on success else DEV_* code
|
||||
* @return 0 on success else DEV_* code
|
||||
*/
|
||||
static inline int flash_write(struct device *dev, off_t offset,
|
||||
const void *data, size_t len)
|
||||
|
@ -98,7 +98,7 @@ static inline int flash_write(struct device *dev, off_t offset,
|
|||
* @param offset : erase area starting offset
|
||||
* @param size : size of area to be erased
|
||||
*
|
||||
* @return DEV_OK on success else DEV_* code
|
||||
* @return 0 on success else DEV_* code
|
||||
*/
|
||||
static inline int flash_erase(struct device *dev, off_t offset, size_t size)
|
||||
{
|
||||
|
@ -113,7 +113,7 @@ static inline int flash_erase(struct device *dev, off_t offset, size_t size)
|
|||
* @param dev : flash device
|
||||
* @param enable : enable or disable flash write protection
|
||||
*
|
||||
* @return DEV_OK on success else DEV_* code
|
||||
* @return 0 on success else DEV_* code
|
||||
*/
|
||||
static inline int flash_write_protection_set(struct device *dev, bool enable)
|
||||
{
|
||||
|
|
|
@ -148,7 +148,7 @@ struct i2c_driver_api {
|
|||
* @param dev_config Bit-packed 32-bit value to the device runtime configuration
|
||||
* for the I2C controller.
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
* @retval DEV_* code otherwise.
|
||||
*/
|
||||
static inline int i2c_configure(struct device *dev, uint32_t dev_config)
|
||||
|
@ -169,7 +169,7 @@ static inline int i2c_configure(struct device *dev, uint32_t dev_config)
|
|||
* @param len Size of the memory pool available for reading.
|
||||
* @param addr Address to the target I2C device for writing.
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
* @retval DEV_* code otherwise.
|
||||
*/
|
||||
static inline int i2c_write(struct device *dev, uint8_t *buf,
|
||||
|
@ -196,7 +196,7 @@ static inline int i2c_write(struct device *dev, uint8_t *buf,
|
|||
* @param len Size of the memory pool available for writing.
|
||||
* @param addr Address of the I2C device being read.
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
* @retval DEV_* code otherwise.
|
||||
*/
|
||||
static inline int i2c_read(struct device *dev, uint8_t *buf,
|
||||
|
@ -225,7 +225,7 @@ static inline int i2c_read(struct device *dev, uint8_t *buf,
|
|||
* @param num_msgs Number of messages to transfer.
|
||||
* @param addr Address of the I2C target device.
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
* @retval DEV_* code otherwise.
|
||||
*/
|
||||
static inline int i2c_transfer(struct device *dev,
|
||||
|
@ -242,7 +242,7 @@ static inline int i2c_transfer(struct device *dev,
|
|||
* @brief Suspend an I2C driver.
|
||||
* @param dev Pointer to the device structure for the driver instance.
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
*/
|
||||
static inline int i2c_suspend(struct device *dev)
|
||||
{
|
||||
|
@ -256,7 +256,7 @@ static inline int i2c_suspend(struct device *dev)
|
|||
* @brief Resume an I2C driver.
|
||||
* @param dev Pointer to the device structure for the driver instance.
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
*/
|
||||
static inline int i2c_resume(struct device *dev)
|
||||
{
|
||||
|
|
|
@ -68,7 +68,7 @@ struct pwm_driver_api {
|
|||
* @param pwm PWM output.
|
||||
* @param flags PWM configuration flags.
|
||||
*
|
||||
* @retval DEV_OK If successful,
|
||||
* @retval 0 If successful,
|
||||
* @retval failed Otherwise.
|
||||
*/
|
||||
static inline int pwm_pin_configure(struct device *dev, uint8_t pwm,
|
||||
|
@ -88,7 +88,7 @@ static inline int pwm_pin_configure(struct device *dev, uint8_t pwm,
|
|||
* @param on ON value set to the PWM.
|
||||
* @param off OFF value set to the PWM.
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
* @retval failed Otherwise.
|
||||
*/
|
||||
static inline int pwm_pin_set_values(struct device *dev, uint32_t pwm,
|
||||
|
@ -110,7 +110,7 @@ static inline int pwm_pin_set_values(struct device *dev, uint32_t pwm,
|
|||
* @param duty Duty cycle to set to the PWM in %, for example,
|
||||
* 50 sets to 50%.
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
* @retval failed Otherwise.
|
||||
*/
|
||||
static inline int pwm_pin_set_duty_cycle(struct device *dev, uint32_t pwm,
|
||||
|
@ -131,7 +131,7 @@ static inline int pwm_pin_set_duty_cycle(struct device *dev, uint32_t pwm,
|
|||
* @param pwm PWM output.
|
||||
* @param phase The number of clock ticks to delay before the start of pulses.
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
* @retval failed Otherwise.
|
||||
*/
|
||||
static inline int pwm_pin_set_phase(struct device *dev, uint32_t pwm,
|
||||
|
@ -154,7 +154,7 @@ static inline int pwm_pin_set_phase(struct device *dev, uint32_t pwm,
|
|||
* @param dev Pointer to the device structure for the driver instance.
|
||||
* @param flags PWM configuration flags.
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
* @retval failed Otherwise.
|
||||
*/
|
||||
static inline int pwm_all_configure(struct device *dev, int flags)
|
||||
|
@ -172,7 +172,7 @@ static inline int pwm_all_configure(struct device *dev, int flags)
|
|||
* @param on ON value set to the PWM.
|
||||
* @param off OFF value set to the PWM.
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
* @retval failed Otherwise.
|
||||
*/
|
||||
static inline int pwm_all_set_values(struct device *dev,
|
||||
|
@ -193,7 +193,7 @@ static inline int pwm_all_set_values(struct device *dev,
|
|||
* @param duty Duty cycle to set to the PWM in %, for example,
|
||||
* 50 sets to 50%.
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
* @retval failed Otherwise.
|
||||
*/
|
||||
static inline int pwm_all_set_duty_cycle(struct device *dev, uint8_t duty)
|
||||
|
@ -213,7 +213,7 @@ static inline int pwm_all_set_duty_cycle(struct device *dev, uint8_t duty)
|
|||
* @param pwm PWM output.
|
||||
* @param phase The number of clock ticks to delay before the start of pulses.
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
* @retval failed Otherwise.
|
||||
*/
|
||||
static inline int pwm_all_set_phase(struct device *dev, uint8_t phase)
|
||||
|
@ -235,7 +235,7 @@ static inline int pwm_all_set_phase(struct device *dev, uint8_t phase)
|
|||
*
|
||||
* @param dev Pointer to the device structure for the driver instance.
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
* @retval failed Otherwise.
|
||||
*/
|
||||
static inline int pwm_suspend(struct device *dev)
|
||||
|
@ -251,7 +251,7 @@ static inline int pwm_suspend(struct device *dev)
|
|||
*
|
||||
* @param dev Pointer to the device structure for the driver instance.
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
* @retval failed Otherwise.
|
||||
*/
|
||||
static inline int pwm_resume(struct device *dev)
|
||||
|
|
|
@ -190,7 +190,7 @@ struct sensor_driver_api {
|
|||
* @param attr The attribute to set
|
||||
* @param val The value to set the attribute to
|
||||
*
|
||||
* @return DEV_OK if successful, another DEV_* code otherwise.
|
||||
* @return 0 if successful, another DEV_* code otherwise.
|
||||
*/
|
||||
static inline int sensor_attr_set(struct device *dev,
|
||||
enum sensor_channel chan,
|
||||
|
@ -220,7 +220,7 @@ static inline int sensor_attr_set(struct device *dev,
|
|||
* @param handler The function that should be called when the trigger
|
||||
* fires
|
||||
*
|
||||
* @return DEV_OK if successful, another DEV_* code otherwise.
|
||||
* @return 0 if successful, another DEV_* code otherwise.
|
||||
*/
|
||||
static inline int sensor_trigger_set(struct device *dev,
|
||||
struct sensor_trigger *trig,
|
||||
|
@ -250,7 +250,7 @@ static inline int sensor_trigger_set(struct device *dev,
|
|||
*
|
||||
* @param dev Pointer to the sensor device
|
||||
*
|
||||
* @return DEV_OK if successful, another DEV_* code otherwise.
|
||||
* @return 0 if successful, another DEV_* code otherwise.
|
||||
*/
|
||||
static inline int sensor_sample_fetch(struct device *dev)
|
||||
{
|
||||
|
@ -275,7 +275,7 @@ static inline int sensor_sample_fetch(struct device *dev)
|
|||
* @param chan The channel to read
|
||||
* @param val Where to store the value
|
||||
*
|
||||
* @return DEV_OK if successful, another DEV_* code otherwise.
|
||||
* @return 0 if successful, another DEV_* code otherwise.
|
||||
*/
|
||||
static inline int sensor_channel_get(struct device *dev,
|
||||
enum sensor_channel chan,
|
||||
|
|
|
@ -98,7 +98,7 @@ struct spi_driver_api {
|
|||
* @param dev Pointer to the device structure for the driver instance.
|
||||
* @param config Pointer to the configuration provided by the application.
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
* @retval DEV_* Code otherwise.
|
||||
*/
|
||||
static inline int spi_configure(struct device *dev,
|
||||
|
@ -120,7 +120,7 @@ static inline int spi_configure(struct device *dev,
|
|||
* @param dev Pointer to the device structure for the driver instance
|
||||
* @param slave An integer identifying the slave
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
* @retval DEV_* Code otherwise.
|
||||
*/
|
||||
static inline int spi_slave_select(struct device *dev, uint32_t slave)
|
||||
|
@ -128,7 +128,7 @@ static inline int spi_slave_select(struct device *dev, uint32_t slave)
|
|||
struct spi_driver_api *api = (struct spi_driver_api *)dev->driver_api;
|
||||
|
||||
if (!api->slave_select) {
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return api->slave_select(dev, slave);
|
||||
|
@ -140,7 +140,7 @@ static inline int spi_slave_select(struct device *dev, uint32_t slave)
|
|||
* @param buf Memory buffer where data will be transferred.
|
||||
* @param len Size of the memory buffer available for writing.
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
* @retval DEV_* Code otherwise.
|
||||
*/
|
||||
static inline int spi_read(struct device *dev, void *buf, uint32_t len)
|
||||
|
@ -156,7 +156,7 @@ static inline int spi_read(struct device *dev, void *buf, uint32_t len)
|
|||
* @param buf Memory buffer from where data is transferred.
|
||||
* @param len Size of the memory buffer available for reading.
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
* @retval DEV_* Code otherwise.
|
||||
*/
|
||||
static inline int spi_write(struct device *dev, const void *buf, uint32_t len)
|
||||
|
@ -177,7 +177,7 @@ static inline int spi_write(struct device *dev, const void *buf, uint32_t len)
|
|||
* @param rx_buf Memory buffer where data is transferred.
|
||||
* @param rx_buf_len Size of the memory buffer available for writing.
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
* @retval DEV_* Code otherwise.
|
||||
*/
|
||||
static inline int spi_transceive(struct device *dev,
|
||||
|
@ -193,7 +193,7 @@ static inline int spi_transceive(struct device *dev,
|
|||
* @brief Suspend the SPI host controller operations.
|
||||
* @param dev Pointer to the device structure for the driver instance.
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
* @retval DEV_* Code otherwise.
|
||||
*/
|
||||
static inline int spi_suspend(struct device *dev)
|
||||
|
@ -207,7 +207,7 @@ static inline int spi_suspend(struct device *dev)
|
|||
* @brief Resume the SPI host controller operations.
|
||||
* @param dev Pointer to the device structure for the driver instance.
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
* @retval DEV_* Code otherwise.
|
||||
*/
|
||||
static inline int spi_resume(struct device *dev)
|
||||
|
|
|
@ -568,7 +568,7 @@ static inline void uart_irq_callback_set(struct device *dev,
|
|||
* @param ctrl The line control to manipulate.
|
||||
* @param val Value to set to the line control.
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
* @retval failed Otherwise.
|
||||
*/
|
||||
static inline int uart_line_ctrl_set(struct device *dev,
|
||||
|
@ -599,7 +599,7 @@ static inline int uart_line_ctrl_set(struct device *dev,
|
|||
* @param cmd Command to driver.
|
||||
* @param p Parameter to the command.
|
||||
*
|
||||
* @retval DEV_OK If successful.
|
||||
* @retval 0 If successful.
|
||||
* @retval failed Otherwise.
|
||||
*/
|
||||
static inline int uart_drv_cmd(struct device *dev, uint32_t cmd, uint32_t p)
|
||||
|
|
|
@ -91,7 +91,7 @@ void main(void)
|
|||
nano_timer_init(&timer, data);
|
||||
adc_enable(adc);
|
||||
while (1) {
|
||||
if (adc_read(adc, &table) != DEV_OK) {
|
||||
if (adc_read(adc, &table) != 0) {
|
||||
DBG("Sampling could not proceed, an error occurred\n");
|
||||
} else {
|
||||
DBG("Sampling is done\n");
|
||||
|
|
|
@ -148,7 +148,7 @@ void main(void)
|
|||
printk("Read %d bytes from address 0x00.\n", sizeof(data));
|
||||
}
|
||||
|
||||
ret = DEV_OK;
|
||||
ret = 0;
|
||||
for (i = 0; i < sizeof(cmp_data); i++) {
|
||||
/* uncomment below if you want to see all the bytes */
|
||||
/* printk("0x%X ?= 0x%X\n", cmp_data[i], data[i]); */
|
||||
|
@ -157,7 +157,7 @@ void main(void)
|
|||
ret = DEV_FAIL;
|
||||
}
|
||||
}
|
||||
if (ret == DEV_OK) {
|
||||
if (ret == 0) {
|
||||
printk("Data comparison successful.\n");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,13 +29,13 @@ static void read_who_am_i(struct device *dev)
|
|||
uint8_t data;
|
||||
|
||||
data = WHO_AM_I_REG;
|
||||
if (i2c_write(dev, &data, sizeof(data), GYRO_I2C_ADDR) != DEV_OK) {
|
||||
if (i2c_write(dev, &data, sizeof(data), GYRO_I2C_ADDR) != 0) {
|
||||
printk("Error on i2c_write()\n");
|
||||
return;
|
||||
}
|
||||
|
||||
data = 0;
|
||||
if (i2c_read(dev, &data, sizeof(data), GYRO_I2C_ADDR) != DEV_OK) {
|
||||
if (i2c_read(dev, &data, sizeof(data), GYRO_I2C_ADDR) != 0) {
|
||||
printk("Error on i2c_read()\n");
|
||||
return;
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ static void read_who_am_i_by_transfer(struct device *dev)
|
|||
msg[1].buf = &read_data;
|
||||
msg[1].len = sizeof(read_data);
|
||||
|
||||
if (i2c_transfer(dev, msg, 2, GYRO_I2C_ADDR) != DEV_OK) {
|
||||
if (i2c_transfer(dev, msg, 2, GYRO_I2C_ADDR) != 0) {
|
||||
printk("Error on i2c_transfer()\n");
|
||||
return;
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ void main(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (i2c_configure(dev, cfg.raw) != DEV_OK) {
|
||||
if (i2c_configure(dev, cfg.raw) != 0) {
|
||||
printk("Error on i2c_configure()\n");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -29,13 +29,13 @@ static void read_temperature(struct device *dev)
|
|||
uint8_t data;
|
||||
|
||||
data = TEMP_VAL_HIGH_REG_ADDR;
|
||||
if (i2c_write(dev, &data, sizeof(data), STTS751_I2C_ADDR) != DEV_OK) {
|
||||
if (i2c_write(dev, &data, sizeof(data), STTS751_I2C_ADDR) != 0) {
|
||||
printk("Error on i2c_write()\n");
|
||||
return;
|
||||
}
|
||||
|
||||
data = 0;
|
||||
if (i2c_read(dev, &data, sizeof(data), STTS751_I2C_ADDR) != DEV_OK) {
|
||||
if (i2c_read(dev, &data, sizeof(data), STTS751_I2C_ADDR) != 0) {
|
||||
printk("Error on i2c_read()\n");
|
||||
return;
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ static void read_temperature_by_transfer(struct device *dev)
|
|||
msg[1].buf = &read_data;
|
||||
msg[1].len = sizeof(read_data);
|
||||
|
||||
if (i2c_transfer(dev, msg, 2, STTS751_I2C_ADDR) != DEV_OK) {
|
||||
if (i2c_transfer(dev, msg, 2, STTS751_I2C_ADDR) != 0) {
|
||||
printk("Error on i2c_transfer()\n");
|
||||
return;
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ void main(void)
|
|||
return;
|
||||
}
|
||||
|
||||
if (i2c_configure(dev, cfg.raw) != DEV_OK) {
|
||||
if (i2c_configure(dev, cfg.raw) != 0) {
|
||||
printk("Error on i2c_configure()\n");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -87,5 +87,5 @@ int main(void)
|
|||
printk("SPI Flash Manufacturer %x Device Id %x\n", manufacturer,
|
||||
device_id);
|
||||
|
||||
return DEV_OK;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue