drivers: Replace DEV_INVALID_OP by -ENOTSUP

This patch replaces all occurences of the macro DEV_INVALID_OP by
-ENOTSUP at the driver level. So this patch touch the files under
drivers/, include/ and samples/drivers/ when applicable.

This patch is part of the effort to transition from DEV_* codes to
errno.h codes.

Change-Id: I46aec3c65963018c479b01602e4a3eec8650eaff
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
This commit is contained in:
Andre Guedes 2016-03-09 14:54:42 -03:00 committed by Anas Nashif
commit 245e140da6
25 changed files with 116 additions and 88 deletions

View file

@ -115,7 +115,7 @@ static int adc_qmsi_read(struct device *dev, struct adc_seq_table *seq_tbl)
struct adc_info *info = dev->driver_data; struct adc_info *info = dev->driver_data;
if (qm_adc_get_config(QM_ADC_0, &cfg) != QM_RC_OK) { if (qm_adc_get_config(QM_ADC_0, &cfg) != QM_RC_OK) {
return DEV_INVALID_OP; return -ENOTSUP;
} }
for (i = 0; i < seq_tbl->num_entries; i++) { for (i = 0; i < seq_tbl->num_entries; i++) {
@ -170,7 +170,7 @@ static int adc_qmsi_read(struct device *dev, struct adc_seq_table *seq_tbl)
struct adc_info *info = dev->driver_data; struct adc_info *info = dev->driver_data;
if (qm_adc_get_config(QM_ADC_0, &cfg) != QM_RC_OK) { if (qm_adc_get_config(QM_ADC_0, &cfg) != QM_RC_OK) {
return DEV_INVALID_OP; return -ENOTSUP;
} }
for (i = 0; i < seq_tbl->num_entries; i++) { for (i = 0; i < seq_tbl->num_entries; i++) {

View file

@ -157,7 +157,7 @@ static int spi_flash_wb_write(struct device *dev, off_t offset,
uint8_t *buf = driver_data->buf; uint8_t *buf = driver_data->buf;
if (len > CONFIG_SPI_FLASH_W25QXXDV_MAX_DATA_LEN || offset < 0) { if (len > CONFIG_SPI_FLASH_W25QXXDV_MAX_DATA_LEN || offset < 0) {
return DEV_INVALID_OP; return -ENOTSUP;
} }
nano_sem_take(&driver_data->sem, TICKS_UNLIMITED); nano_sem_take(&driver_data->sem, TICKS_UNLIMITED);
@ -235,7 +235,7 @@ static inline int spi_flash_wb_erase_internal(struct device *dev,
uint32_t len; uint32_t len;
if (offset < 0) { if (offset < 0) {
return DEV_INVALID_OP; return -ENOTSUP;
} }
wait_for_flash_idle(dev); wait_for_flash_idle(dev);

View file

@ -18,6 +18,8 @@
* @file Driver for the Atmel SAM3 PIO Controller. * @file Driver for the Atmel SAM3 PIO Controller.
*/ */
#include <errno.h>
#include <nanokernel.h> #include <nanokernel.h>
#include <device.h> #include <device.h>
@ -121,7 +123,7 @@ static int gpio_sam3_config(struct device *dev, int access_op,
_config(dev, (0xFFFFFFFF), flags); _config(dev, (0xFFFFFFFF), flags);
break; break;
default: default:
return DEV_INVALID_OP; return -ENOTSUP;
} }
return 0; return 0;
@ -162,7 +164,7 @@ static int gpio_sam3_write(struct device *dev, int access_op,
} }
break; break;
default: default:
return DEV_INVALID_OP; return -ENOTSUP;
} }
return 0; return 0;
@ -192,7 +194,7 @@ static int gpio_sam3_read(struct device *dev, int access_op,
case GPIO_ACCESS_BY_PORT: case GPIO_ACCESS_BY_PORT:
break; break;
default: default:
return DEV_INVALID_OP; return -ENOTSUP;
} }
return 0; return 0;
@ -250,7 +252,7 @@ static int gpio_sam3_enable_callback(struct device *dev,
mask = 0xFFFFFFFF; mask = 0xFFFFFFFF;
break; break;
default: default:
return DEV_INVALID_OP; return -ENOTSUP;
} }
cfg->enabled_cb |= mask; cfg->enabled_cb |= mask;
@ -273,7 +275,7 @@ static int gpio_sam3_disable_callback(struct device *dev,
mask = 0xFFFFFFFF; mask = 0xFFFFFFFF;
break; break;
default: default:
return DEV_INVALID_OP; return -ENOTSUP;
} }
cfg->enabled_cb &= ~mask; cfg->enabled_cb &= ~mask;
@ -286,14 +288,14 @@ static int gpio_sam3_suspend_port(struct device *dev)
{ {
ARG_UNUSED(dev); ARG_UNUSED(dev);
return DEV_INVALID_OP; return -ENOTSUP;
} }
static int gpio_sam3_resume_port(struct device *dev) static int gpio_sam3_resume_port(struct device *dev)
{ {
ARG_UNUSED(dev); ARG_UNUSED(dev);
return DEV_INVALID_OP; return -ENOTSUP;
} }
static struct gpio_driver_api gpio_sam3_drv_api_funcs = { static struct gpio_driver_api gpio_sam3_drv_api_funcs = {

View file

@ -18,6 +18,8 @@
* @file Driver for the Freescale K64 GPIO module. * @file Driver for the Freescale K64 GPIO module.
*/ */
#include <errno.h>
#include <nanokernel.h> #include <nanokernel.h>
#include <device.h> #include <device.h>
#include <init.h> #include <init.h>
@ -41,7 +43,7 @@ static int gpio_k64_config(struct device *dev, int access_op,
if (((flags & GPIO_INT) && (flags & GPIO_DIR_OUT)) || if (((flags & GPIO_INT) && (flags & GPIO_DIR_OUT)) ||
((flags & GPIO_DIR_IN) && (flags & GPIO_DIR_OUT))) { ((flags & GPIO_DIR_IN) && (flags & GPIO_DIR_OUT))) {
return DEV_INVALID_OP; return -ENOTSUP;
} }
/* /*
@ -79,7 +81,7 @@ static int gpio_k64_config(struct device *dev, int access_op,
} else if ((flags & GPIO_PUD_MASK) == GPIO_PUD_NORMAL) { } else if ((flags & GPIO_PUD_MASK) == GPIO_PUD_NORMAL) {
setting = K64_PINMUX_PULL_DISABLE; setting = K64_PINMUX_PULL_DISABLE;
} else { } else {
return DEV_INVALID_OP; return -ENOTSUP;
} }
/* /*
@ -243,7 +245,7 @@ static int gpio_k64_suspend_port(struct device *dev)
{ {
ARG_UNUSED(dev); ARG_UNUSED(dev);
return DEV_INVALID_OP; return -ENOTSUP;
} }
@ -251,7 +253,7 @@ static int gpio_k64_resume_port(struct device *dev)
{ {
ARG_UNUSED(dev); ARG_UNUSED(dev);
return DEV_INVALID_OP; return -ENOTSUP;
} }

View file

@ -18,6 +18,8 @@
* @file Driver for the MMIO-based GPIO driver. * @file Driver for the MMIO-based GPIO driver.
*/ */
#include <errno.h>
#include <nanokernel.h> #include <nanokernel.h>
#include <gpio.h> #include <gpio.h>
@ -141,7 +143,7 @@ static int gpio_mmio_config(struct device *dev, int access_op,
cfg->access.write(cfg->reg.dir, 0, value); cfg->access.write(cfg->reg.dir, 0, value);
break; break;
default: default:
return DEV_INVALID_OP; return -ENOTSUP;
} }
/* /*
@ -172,7 +174,7 @@ static int gpio_mmio_config(struct device *dev, int access_op,
cfg->access.write(cfg->reg.en, 0, value); cfg->access.write(cfg->reg.en, 0, value);
break; break;
default: default:
return DEV_INVALID_OP; return -ENOTSUP;
} }
return 0; return 0;
@ -206,7 +208,7 @@ static int gpio_mmio_write(struct device *dev, int access_op,
cfg->access.write(cfg->reg.output, 0, value); cfg->access.write(cfg->reg.output, 0, value);
break; break;
default: default:
return DEV_INVALID_OP; return -ENOTSUP;
} }
return 0; return 0;
@ -241,7 +243,7 @@ static int gpio_mmio_read(struct device *dev, int access_op,
*value = cfg->access.read(cfg->reg.input, 0, 0); *value = cfg->access.read(cfg->reg.input, 0, 0);
break; break;
default: default:
return DEV_INVALID_OP; return -ENOTSUP;
} }
return 0; return 0;
@ -253,7 +255,7 @@ static int gpio_mmio_set_callback(struct device *dev,
ARG_UNUSED(dev); ARG_UNUSED(dev);
ARG_UNUSED(callback); ARG_UNUSED(callback);
return DEV_INVALID_OP; return -ENOTSUP;
} }
static int gpio_mmio_enable_callback(struct device *dev, static int gpio_mmio_enable_callback(struct device *dev,
@ -263,7 +265,7 @@ static int gpio_mmio_enable_callback(struct device *dev,
ARG_UNUSED(access_op); ARG_UNUSED(access_op);
ARG_UNUSED(pin); ARG_UNUSED(pin);
return DEV_INVALID_OP; return -ENOTSUP;
} }
static int gpio_mmio_disable_callback(struct device *dev, static int gpio_mmio_disable_callback(struct device *dev,
@ -273,21 +275,21 @@ static int gpio_mmio_disable_callback(struct device *dev,
ARG_UNUSED(access_op); ARG_UNUSED(access_op);
ARG_UNUSED(pin); ARG_UNUSED(pin);
return DEV_INVALID_OP; return -ENOTSUP;
} }
static int gpio_mmio_suspend_port(struct device *dev) static int gpio_mmio_suspend_port(struct device *dev)
{ {
ARG_UNUSED(dev); ARG_UNUSED(dev);
return DEV_INVALID_OP; return -ENOTSUP;
} }
static int gpio_mmio_resume_port(struct device *dev) static int gpio_mmio_resume_port(struct device *dev)
{ {
ARG_UNUSED(dev); ARG_UNUSED(dev);
return DEV_INVALID_OP; return -ENOTSUP;
} }
static struct gpio_driver_api gpio_mmio_drv_api_funcs = { static struct gpio_driver_api gpio_mmio_drv_api_funcs = {

View file

@ -18,6 +18,8 @@
* @file Driver for PCAL9535A I2C-based GPIO driver. * @file Driver for PCAL9535A I2C-based GPIO driver.
*/ */
#include <errno.h>
#include <nanokernel.h> #include <nanokernel.h>
#include <gpio.h> #include <gpio.h>
@ -203,7 +205,7 @@ static int _setup_pin_dir(struct device *dev, int access_op,
} }
break; break;
default: default:
ret = DEV_INVALID_OP; ret = -ENOTSUP;
goto done; goto done;
} }
@ -264,7 +266,7 @@ static int _setup_pin_pullupdown(struct device *dev, int access_op,
} }
break; break;
default: default:
ret = DEV_INVALID_OP; ret = -ENOTSUP;
goto done; goto done;
} }
@ -296,7 +298,7 @@ en_dis:
} }
break; break;
default: default:
ret = DEV_INVALID_OP; ret = -ENOTSUP;
goto done; goto done;
} }
@ -348,7 +350,7 @@ static int _setup_pin_polarity(struct device *dev, int access_op,
} }
break; break;
default: default:
ret = DEV_INVALID_OP; ret = -ENOTSUP;
goto done; goto done;
} }
@ -461,7 +463,7 @@ static int gpio_pcal9535a_write(struct device *dev, int access_op,
break; break;
default: default:
ret = DEV_INVALID_OP; ret = -ENOTSUP;
goto done; goto done;
} }
@ -504,7 +506,7 @@ static int gpio_pcal9535a_read(struct device *dev, int access_op,
*value = buf.all; *value = buf.all;
break; break;
default: default:
ret = DEV_INVALID_OP; ret = -ENOTSUP;
break; break;
} }
@ -518,7 +520,7 @@ static int gpio_pcal9535a_set_callback(struct device *dev,
ARG_UNUSED(dev); ARG_UNUSED(dev);
ARG_UNUSED(callback); ARG_UNUSED(callback);
return DEV_INVALID_OP; return -ENOTSUP;
} }
static int gpio_pcal9535a_enable_callback(struct device *dev, static int gpio_pcal9535a_enable_callback(struct device *dev,
@ -528,7 +530,7 @@ static int gpio_pcal9535a_enable_callback(struct device *dev,
ARG_UNUSED(access_op); ARG_UNUSED(access_op);
ARG_UNUSED(pin); ARG_UNUSED(pin);
return DEV_INVALID_OP; return -ENOTSUP;
} }
static int gpio_pcal9535a_disable_callback(struct device *dev, static int gpio_pcal9535a_disable_callback(struct device *dev,
@ -538,7 +540,7 @@ static int gpio_pcal9535a_disable_callback(struct device *dev,
ARG_UNUSED(access_op); ARG_UNUSED(access_op);
ARG_UNUSED(pin); ARG_UNUSED(pin);
return DEV_INVALID_OP; return -ENOTSUP;
} }
static int gpio_pcal9535a_suspend_port(struct device *dev) static int gpio_pcal9535a_suspend_port(struct device *dev)
@ -547,7 +549,7 @@ static int gpio_pcal9535a_suspend_port(struct device *dev)
return DEV_INVALID_CONF; return DEV_INVALID_CONF;
} }
return DEV_INVALID_OP; return -ENOTSUP;
} }
static int gpio_pcal9535a_resume_port(struct device *dev) static int gpio_pcal9535a_resume_port(struct device *dev)
@ -556,7 +558,7 @@ static int gpio_pcal9535a_resume_port(struct device *dev)
return DEV_INVALID_CONF; return DEV_INVALID_CONF;
} }
return DEV_INVALID_OP; return -ENOTSUP;
} }
static struct gpio_driver_api gpio_pcal9535a_drv_api_funcs = { static struct gpio_driver_api gpio_pcal9535a_drv_api_funcs = {

View file

@ -16,6 +16,8 @@
* limitations under the License. * limitations under the License.
*/ */
#include <errno.h>
#include <nanokernel.h> #include <nanokernel.h>
#include <board.h> #include <board.h>
#include <init.h> #include <init.h>
@ -159,7 +161,7 @@ static int gpio_sch_write(struct device *dev,
if (access_op == GPIO_ACCESS_BY_PIN) { if (access_op == GPIO_ACCESS_BY_PIN) {
if (pin >= info->bits) { if (pin >= info->bits) {
return DEV_INVALID_OP; return -ENOTSUP;
} }
_set_bit_glvl(info->regs, pin, value); _set_bit_glvl(info->regs, pin, value);
@ -179,7 +181,7 @@ static int gpio_sch_read(struct device *dev,
if (access_op == GPIO_ACCESS_BY_PIN) { if (access_op == GPIO_ACCESS_BY_PIN) {
if (pin >= info->bits) { if (pin >= info->bits) {
return DEV_INVALID_OP; return -ENOTSUP;
} }
*value = !!(*value & BIT(pin)); *value = !!(*value & BIT(pin));
@ -272,7 +274,7 @@ static int gpio_sch_enable_callback(struct device *dev,
uint32_t bits = BIT(pin); uint32_t bits = BIT(pin);
if (pin >= info->bits) { if (pin >= info->bits) {
return DEV_INVALID_OP; return -ENOTSUP;
} }
gpio->cb_enabled |= bits; gpio->cb_enabled |= bits;
@ -298,7 +300,7 @@ static int gpio_sch_disable_callback(struct device *dev,
if (access_op == GPIO_ACCESS_BY_PIN) { if (access_op == GPIO_ACCESS_BY_PIN) {
if (pin >= info->bits) { if (pin >= info->bits) {
return DEV_INVALID_OP; return -ENOTSUP;
} }
gpio->cb_enabled &= ~BIT(pin); gpio->cb_enabled &= ~BIT(pin);

View file

@ -482,7 +482,7 @@ static int i2c_sam3_transfer(struct device *dev,
/* Why bother processing no messages */ /* Why bother processing no messages */
if (!msgs || !num_msgs) { if (!msgs || !num_msgs) {
return DEV_INVALID_OP; return -ENOTSUP;
} }
/* Device is busy servicing another transfer */ /* Device is busy servicing another transfer */

View file

@ -440,7 +440,7 @@ static int i2c_dw_transfer(struct device *dev,
/* Why bother processing no messages */ /* Why bother processing no messages */
if (!msgs || !num_msgs) { if (!msgs || !num_msgs) {
return DEV_INVALID_OP; return -ENOTSUP;
} }
/* First step, check if there is current activity */ /* First step, check if there is current activity */

View file

@ -148,7 +148,7 @@ static int i2c_qmsi_transfer(struct device *dev, struct i2c_msg *msgs,
return DEV_USED; return DEV_USED;
if (msgs == NULL || num_msgs == 0) if (msgs == NULL || num_msgs == 0)
return DEV_INVALID_OP; return -ENOTSUP;
for (int i = 0; i < num_msgs; i++) { for (int i = 0; i < num_msgs; i++) {
uint8_t *buf = msgs[i].buf; uint8_t *buf = msgs[i].buf;

View file

@ -438,7 +438,7 @@ static int i2c_qse_ss_intr_transfer(struct device *dev,
/* Why bother processing no messages */ /* Why bother processing no messages */
if (!msgs || !num_msgs) { if (!msgs || !num_msgs) {
return DEV_INVALID_OP; return -ENOTSUP;
} }
/* First step, check if device is idle */ /* First step, check if device is idle */

View file

@ -16,6 +16,8 @@
* limitations under the License. * limitations under the License.
*/ */
#include <errno.h>
#include <stdbool.h> #include <stdbool.h>
#include <nanokernel.h> #include <nanokernel.h>
#include <device.h> #include <device.h>
@ -168,7 +170,7 @@ static int _fsl_k64_set_pin(struct device *dev,
if (pin_id >= CONFIG_PINMUX_NUM_PINS) { if (pin_id >= CONFIG_PINMUX_NUM_PINS) {
return DEV_INVALID_OP; return -ENOTSUP;
} }
if ((func & K64_PINMUX_ALT_MASK) == K64_PINMUX_FUNC_GPIO) { if ((func & K64_PINMUX_ALT_MASK) == K64_PINMUX_FUNC_GPIO) {
@ -235,7 +237,7 @@ static int _fsl_k64_get_pin(struct device *dev,
uint32_t status; uint32_t status;
if (pin_id >= CONFIG_PINMUX_NUM_PINS) { if (pin_id >= CONFIG_PINMUX_NUM_PINS) {
return DEV_INVALID_OP; return -ENOTSUP;
} }
/* determine the pin's port register base address */ /* determine the pin's port register base address */

View file

@ -185,7 +185,7 @@ static int pwm_dw_set_values(struct device *dev, int access_op,
return 0; return 0;
} }
return DEV_INVALID_OP; return -ENOTSUP;
} }
static int pwm_dw_set_duty_cycle(struct device *dev, int access_op, static int pwm_dw_set_duty_cycle(struct device *dev, int access_op,
@ -200,21 +200,21 @@ static int pwm_dw_set_duty_cycle(struct device *dev, int access_op,
ARG_UNUSED(pwm); ARG_UNUSED(pwm);
ARG_UNUSED(duty); ARG_UNUSED(duty);
return DEV_INVALID_OP; return -ENOTSUP;
} }
static int pwm_dw_suspend(struct device *dev) static int pwm_dw_suspend(struct device *dev)
{ {
ARG_UNUSED(dev); ARG_UNUSED(dev);
return DEV_INVALID_OP; return -ENOTSUP;
} }
static int pwm_dw_resume(struct device *dev) static int pwm_dw_resume(struct device *dev)
{ {
ARG_UNUSED(dev); ARG_UNUSED(dev);
return DEV_INVALID_OP; return -ENOTSUP;
} }
static struct pwm_driver_api pwm_dw_drv_api_funcs = { static struct pwm_driver_api pwm_dw_drv_api_funcs = {

View file

@ -42,6 +42,8 @@
* - CONFIG_PWM_K64_FTM_x_PHASE_ENABLE_3 support non-zero phase on channel 3 * - CONFIG_PWM_K64_FTM_x_PHASE_ENABLE_3 support non-zero phase on channel 3
*/ */
#include <errno.h>
#include <nanokernel.h> #include <nanokernel.h>
#include <board.h> #include <board.h>
@ -199,7 +201,7 @@ static int pwm_ftm_configure(struct device *dev, int access_op,
default: default:
/* Illegal prescale value. Default to 1. */ /* Illegal prescale value. Default to 1. */
prescale = PWM_K64_FTM_SC_PS_D1; prescale = PWM_K64_FTM_SC_PS_D1;
return_val = DEV_INVALID_OP; return_val = -ENOTSUP;
break; break;
} }
@ -294,9 +296,9 @@ static int pwm_ftm_set_values(struct device *dev, int access_op,
case PWM_ACCESS_BY_PIN: case PWM_ACCESS_BY_PIN:
break; break;
case PWM_ACCESS_ALL: case PWM_ACCESS_ALL:
return DEV_INVALID_OP; return -ENOTSUP;
default: default:
return DEV_INVALID_OP; return -ENOTSUP;
} }
/* If either ON and/or OFF > max ticks, treat PWM as 100%. /* If either ON and/or OFF > max ticks, treat PWM as 100%.
@ -523,7 +525,7 @@ static int pwm_ftm_set_duty_cycle(struct device *dev, int access_op,
/* check for valid off value */ /* check for valid off value */
if (off > config->period) if (off > config->period)
return DEV_INVALID_OP; return -ENOTSUP;
} }
return pwm_ftm_set_values(dev, access_op, channel, on, off); return pwm_ftm_set_values(dev, access_op, channel, on, off);
@ -567,36 +569,36 @@ static int pwm_ftm_set_phase(struct device *dev, int access_op,
DBG("pwm_ftm_set_phase...\n"); DBG("pwm_ftm_set_phase...\n");
if ((phase < 0) || (phase > config->period)) if ((phase < 0) || (phase > config->period))
return DEV_INVALID_OP; return -ENOTSUP;
switch (channel) { switch (channel) {
case 0: case 0:
if (!config->phase_enable0) if (!config->phase_enable0)
return DEV_INVALID_OP; return -ENOTSUP;
drv_data->phase[0] = phase; drv_data->phase[0] = phase;
break; break;
case 2: case 2:
if (!config->phase_enable2) if (!config->phase_enable2)
return DEV_INVALID_OP; return -ENOTSUP;
drv_data->phase[1] = phase; drv_data->phase[1] = phase;
break; break;
case 4: case 4:
if (!config->phase_enable4) if (!config->phase_enable4)
return DEV_INVALID_OP; return -ENOTSUP;
drv_data->phase[2] = phase; drv_data->phase[2] = phase;
break; break;
case 6: case 6:
if (!config->phase_enable6) if (!config->phase_enable6)
return DEV_INVALID_OP; return -ENOTSUP;
drv_data->phase[3] = phase; drv_data->phase[3] = phase;
break; break;
default: default:
/* channel must be 0, 2, 4, or 6 */ /* channel must be 0, 2, 4, or 6 */
return DEV_INVALID_OP; return -ENOTSUP;
} }
DBG("pwm_ftm_set_phase done.\n"); DBG("pwm_ftm_set_phase done.\n");
@ -611,7 +613,7 @@ static int pwm_ftm_set_phase(struct device *dev, int access_op,
DBG("ERROR: non-zero phase is not supported.\n"); DBG("ERROR: non-zero phase is not supported.\n");
return DEV_INVALID_OP; return -ENOTSUP;
#endif /*COMBINE_MODE_SUPPORT*/ #endif /*COMBINE_MODE_SUPPORT*/
} }

View file

@ -18,6 +18,8 @@
* @file Driver for PCA9685 I2C-based PWM driver. * @file Driver for PCA9685 I2C-based PWM driver.
*/ */
#include <errno.h>
#include <nanokernel.h> #include <nanokernel.h>
#include <i2c.h> #include <i2c.h>
@ -100,7 +102,7 @@ static int pwm_pca9685_set_values(struct device *dev, int access_op,
buf[0] = REG_ALL_LED_ON_L; buf[0] = REG_ALL_LED_ON_L;
break; break;
default: default:
return DEV_INVALID_OP; return -ENOTSUP;
} }
/* If either ON and/or OFF > max ticks, treat PWM as 100%. /* If either ON and/or OFF > max ticks, treat PWM as 100%.
@ -160,7 +162,7 @@ static int pwm_pca9685_suspend(struct device *dev)
return DEV_INVALID_CONF; return DEV_INVALID_CONF;
} }
return DEV_INVALID_OP; return -ENOTSUP;
} }
static int pwm_pca9685_resume(struct device *dev) static int pwm_pca9685_resume(struct device *dev)
@ -169,7 +171,7 @@ static int pwm_pca9685_resume(struct device *dev)
return DEV_INVALID_CONF; return DEV_INVALID_CONF;
} }
return DEV_INVALID_OP; return -ENOTSUP;
} }
static struct pwm_driver_api pwm_pca9685_drv_api_funcs = { static struct pwm_driver_api pwm_pca9685_drv_api_funcs = {

View file

@ -84,7 +84,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) * on: Duration for pin to stay high (must be >= 2)
* off: Duration for pin to stay low (must be >= 2) * off: Duration for pin to stay low (must be >= 2)
* *
* return 0, DEV_INVALID_OP * return 0, -ENOTSUP
*/ */
static int pwm_qmsi_set_values(struct device *dev, int access_op, static int pwm_qmsi_set_values(struct device *dev, int access_op,
uint32_t pwm, uint32_t on, uint32_t off) uint32_t pwm, uint32_t on, uint32_t off)
@ -105,7 +105,7 @@ static int pwm_qmsi_set_values(struct device *dev, int access_op,
} }
break; break;
default: default:
return DEV_INVALID_OP; return -ENOTSUP;
} }
return 0; return 0;
@ -124,7 +124,7 @@ static int pwm_qmsi_set_duty_cycle(struct device *dev, int access_op,
ARG_UNUSED(pwm); ARG_UNUSED(pwm);
ARG_UNUSED(duty); ARG_UNUSED(duty);
return DEV_INVALID_OP; return -ENOTSUP;
} }
/* /*
@ -133,13 +133,13 @@ static int pwm_qmsi_set_duty_cycle(struct device *dev, int access_op,
* *
* Parameters * Parameters
* dev: Device struct * dev: Device struct
* return DEV_INVALID_OP * return -ENOTSUP
*/ */
static int pwm_qmsi_suspend(struct device *dev) static int pwm_qmsi_suspend(struct device *dev)
{ {
ARG_UNUSED(dev); ARG_UNUSED(dev);
return DEV_INVALID_OP; return -ENOTSUP;
} }
/* /*
@ -148,13 +148,13 @@ static int pwm_qmsi_suspend(struct device *dev)
* *
* Parameters * Parameters
* dev: Device struct * dev: Device struct
* return DEV_INVALID_OP * return -ENOTSUP
*/ */
static int pwm_qmsi_resume(struct device *dev) static int pwm_qmsi_resume(struct device *dev)
{ {
ARG_UNUSED(dev); ARG_UNUSED(dev);
return DEV_INVALID_OP; return -ENOTSUP;
} }
static struct pwm_driver_api pwm_qmsi_drv_api_funcs = { static struct pwm_driver_api pwm_qmsi_drv_api_funcs = {

View file

@ -16,6 +16,8 @@
* limitations under the License. * limitations under the License.
*/ */
#include <errno.h>
#include <nanokernel.h> #include <nanokernel.h>
#include <i2c.h> #include <i2c.h>
#include <init.h> #include <init.h>
@ -66,7 +68,7 @@ static int mcp9808_channel_get(struct device *dev,
#ifdef CONFIG_SENSOR_DEBUG #ifdef CONFIG_SENSOR_DEBUG
if (chan != SENSOR_CHAN_TEMP) { if (chan != SENSOR_CHAN_TEMP) {
return DEV_INVALID_OP; return -ENOTSUP;
} }
#endif #endif

View file

@ -17,6 +17,8 @@
#ifndef __SENSOR_MCP9808_H__ #ifndef __SENSOR_MCP9808_H__
#define __SENSOR_MCP9808_H__ #define __SENSOR_MCP9808_H__
#include <errno.h>
#include <stdint.h> #include <stdint.h>
#include <device.h> #include <device.h>
#include <sensor.h> #include <sensor.h>
@ -82,14 +84,14 @@ static inline int mcp9808_attr_set(struct device *dev,
enum sensor_attribute attr, enum sensor_attribute attr,
const struct sensor_value *val) const struct sensor_value *val)
{ {
return DEV_INVALID_OP; return -ENOTSUP;
} }
static inline int mcp9808_trigger_set(struct device *dev, static inline int mcp9808_trigger_set(struct device *dev,
const struct sensor_trigger *trig, const struct sensor_trigger *trig,
sensor_trigger_handler_t handler) sensor_trigger_handler_t handler)
{ {
return DEV_INVALID_OP; return -ENOTSUP;
} }
static void mcp9808_setup_interrupt(struct device *dev) static void mcp9808_setup_interrupt(struct device *dev)

View file

@ -16,6 +16,8 @@
* limitations under the License. * limitations under the License.
*/ */
#include <errno.h>
#include <nanokernel.h> #include <nanokernel.h>
#include <i2c.h> #include <i2c.h>
#include <sensor.h> #include <sensor.h>
@ -108,7 +110,7 @@ static int sx9500_channel_get(struct device *dev,
#ifdef CONFIG_SENSOR_DEBUG #ifdef CONFIG_SENSOR_DEBUG
if (chan != SENSOR_CHAN_PROX) { if (chan != SENSOR_CHAN_PROX) {
return DEV_INVALID_OP; return -ENOTSUP;
} }
#endif #endif

View file

@ -30,6 +30,8 @@
* UART_REG_ADDR_INTERVAL * UART_REG_ADDR_INTERVAL
*/ */
#include <errno.h>
#include <nanokernel.h> #include <nanokernel.h>
#include <arch/cpu.h> #include <arch/cpu.h>
#include <stdint.h> #include <stdint.h>
@ -297,7 +299,7 @@ static int uart_ns16550_init(struct device *dev)
uint8_t mdc = 0; uint8_t mdc = 0;
if (!ns16550_pci_uart_scan(dev)) { if (!ns16550_pci_uart_scan(dev)) {
return DEV_INVALID_OP; return -ENOTSUP;
} }
#ifdef CONFIG_UART_INTERRUPT_DRIVEN #ifdef CONFIG_UART_INTERRUPT_DRIVEN
@ -658,7 +660,7 @@ static int uart_ns16550_line_ctrl_set(struct device *dev,
return 0; return 0;
} }
return DEV_INVALID_OP; return -ENOTSUP;
} }
#endif /* CONFIG_UART_NS16550_LINE_CTRL */ #endif /* CONFIG_UART_NS16550_LINE_CTRL */
@ -686,7 +688,7 @@ static int uart_ns16550_drv_cmd(struct device *dev, uint32_t cmd, uint32_t p)
} }
return DEV_INVALID_OP; return -ENOTSUP;
} }
#endif /* CONFIG_UART_NS16550_DRV_CMD */ #endif /* CONFIG_UART_NS16550_DRV_CMD */

View file

@ -14,6 +14,8 @@
* limitations under the License. * limitations under the License.
*/ */
#include <errno.h>
#include <nanokernel.h> #include <nanokernel.h>
#include <arch/cpu.h> #include <arch/cpu.h>
#include <sections.h> #include <sections.h>
@ -70,7 +72,7 @@ unsigned char uart_nsim_poll_out(struct device *dev, unsigned char c)
static int uart_nsim_poll_in(struct device *dev, unsigned char *c) static int uart_nsim_poll_in(struct device *dev, unsigned char *c)
{ {
return -DEV_INVALID_OP; return -ENOTSUP;
} }

View file

@ -489,7 +489,7 @@ static int spi_k64_configure(struct device *dev, struct spi_config *config)
frame_sz = SPI_WORD_SIZE_GET(flags); frame_sz = SPI_WORD_SIZE_GET(flags);
if (frame_sz > SPI_K64_WORD_SIZE_MAX) { if (frame_sz > SPI_K64_WORD_SIZE_MAX) {
return DEV_INVALID_OP; return -ENOTSUP;
} }
spi_data->frame_sz = frame_sz; spi_data->frame_sz = frame_sz;
@ -499,7 +499,7 @@ static int spi_k64_configure(struct device *dev, struct spi_config *config)
/* Set baud rate and signal timing parameters (delays) */ /* Set baud rate and signal timing parameters (delays) */
if (spi_k64_set_baud_rate(config->max_sys_freq, &ctar) == 0) { if (spi_k64_set_baud_rate(config->max_sys_freq, &ctar) == 0) {
return DEV_INVALID_OP; return -ENOTSUP;
} }
/* /*
@ -513,7 +513,7 @@ static int spi_k64_configure(struct device *dev, struct spi_config *config)
if (spi_k64_set_delay(DELAY_AFTER_SCK, if (spi_k64_set_delay(DELAY_AFTER_SCK,
(NSEC_PER_SEC / 2) / config->max_sys_freq, (NSEC_PER_SEC / 2) / config->max_sys_freq,
&ctar) == 0) { &ctar) == 0) {
return DEV_INVALID_OP; return -ENOTSUP;
} }

View file

@ -36,6 +36,7 @@ extern "C" {
#define PWM_ACCESS_BY_PIN 0 #define PWM_ACCESS_BY_PIN 0
#define PWM_ACCESS_ALL 1 #define PWM_ACCESS_ALL 1
#include <errno.h>
#include <stdint.h> #include <stdint.h>
#include <stddef.h> #include <stddef.h>
#include <device.h> #include <device.h>
@ -145,7 +146,7 @@ static inline int pwm_pin_set_phase(struct device *dev, uint32_t pwm,
return api->set_phase(dev, PWM_ACCESS_BY_PIN, pwm, phase); return api->set_phase(dev, PWM_ACCESS_BY_PIN, pwm, phase);
} }
return DEV_INVALID_OP; return -ENOTSUP;
} }
/** /**
@ -226,7 +227,7 @@ static inline int pwm_all_set_phase(struct device *dev, uint8_t phase)
return api->set_phase(dev, PWM_ACCESS_ALL, 0, phase); return api->set_phase(dev, PWM_ACCESS_ALL, 0, phase);
} }
return DEV_INVALID_OP; return -ENOTSUP;
} }
/** /**

View file

@ -201,7 +201,7 @@ static inline int sensor_attr_set(struct device *dev,
api = (struct sensor_driver_api *)dev->driver_api; api = (struct sensor_driver_api *)dev->driver_api;
if (!api->attr_set) { if (!api->attr_set) {
return DEV_INVALID_OP; return -ENOTSUP;
} }
return api->attr_set(dev, chan, attr, val); return api->attr_set(dev, chan, attr, val);
@ -230,7 +230,7 @@ static inline int sensor_trigger_set(struct device *dev,
api = (struct sensor_driver_api *)dev->driver_api; api = (struct sensor_driver_api *)dev->driver_api;
if (!api->trigger_set) { if (!api->trigger_set) {
return DEV_INVALID_OP; return -ENOTSUP;
} }
return api->trigger_set(dev, trig, handler); return api->trigger_set(dev, trig, handler);

View file

@ -33,6 +33,7 @@
extern "C" { extern "C" {
#endif #endif
#include <errno.h>
#include <stddef.h> #include <stddef.h>
#include <device.h> #include <device.h>
@ -205,7 +206,7 @@ static inline int uart_err_check(struct device *dev)
* *
* @retval 0 If a character arrived. * @retval 0 If a character arrived.
* @retval -1 If the input buffer if empty. * @retval -1 If the input buffer if empty.
* @retval DEV_INVALID_OP If the operation is not supported. * @retval -ENOTSUP If the operation is not supported.
*/ */
static inline int uart_poll_in(struct device *dev, unsigned char *p_char) static inline int uart_poll_in(struct device *dev, unsigned char *p_char)
{ {
@ -582,7 +583,7 @@ static inline int uart_line_ctrl_set(struct device *dev,
return api->line_ctrl_set(dev, ctrl, val); return api->line_ctrl_set(dev, ctrl, val);
} }
return DEV_INVALID_OP; return -ENOTSUP;
} }
#endif /* CONFIG_UART_LINE_CTRL */ #endif /* CONFIG_UART_LINE_CTRL */
@ -612,7 +613,7 @@ static inline int uart_drv_cmd(struct device *dev, uint32_t cmd, uint32_t p)
return api->drv_cmd(dev, cmd, p); return api->drv_cmd(dev, cmd, p);
} }
return DEV_INVALID_OP; return -ENOTSUP;
} }
#endif /* CONFIG_UART_DRV_CMD */ #endif /* CONFIG_UART_DRV_CMD */