drivers/gpio: Act relevantly if GPIO_INT is an unsupported flag

Using right error code, and no need to populate callback related API
functions.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2018-11-15 10:05:48 +01:00 committed by Anas Nashif
commit ea5d01b41c
4 changed files with 12 additions and 36 deletions

View file

@ -45,7 +45,7 @@ static int gpio_mcux_configure(struct device *dev,
/* Check if GPIO port supports interrupts */
if ((flags & GPIO_INT) && ((config->flags & GPIO_INT) == 0)) {
return -EINVAL;
return -ENOTSUP;
}
/* The flags contain options that require touching registers in the

View file

@ -48,10 +48,12 @@ static int gpio_mcux_lpc_configure(struct device *dev,
if ((flags & GPIO_INT) && (flags & GPIO_DIR_OUT)) {
return -EINVAL;
}
/* Check if GPIO port supports interrupts */
if (flags & GPIO_INT) {
return -EINVAL;
return -ENOTSUP;
}
/* supports access by pin now,you can add access by port when needed */
if (access_op == GPIO_ACCESS_BY_PIN) {
/* input-0,output-1 */

View file

@ -35,6 +35,10 @@ static int gpio_mmio32_config(struct device *dev, int access_op,
struct gpio_mmio32_context *context = dev->driver_data;
const struct gpio_mmio32_config *config = context->config;
if (flags & GPIO_INT) {
return -ENOTSUP;
}
if (access_op != GPIO_ACCESS_BY_PIN) {
return -ENOTSUP;
}

View file

@ -358,6 +358,10 @@ static int gpio_pcal9535a_config(struct device *dev, int access_op,
u16_t i2c_addr = config->i2c_slave_addr;
#endif
if (flags & GPIO_INT) {
return -ENOTSUP;
}
if (!_has_i2c_master(dev)) {
return -EINVAL;
}
@ -488,44 +492,10 @@ done:
return ret;
}
static int gpio_pcal9535a_manage_callback(struct device *dev,
struct gpio_callback *callback,
bool set)
{
ARG_UNUSED(dev);
ARG_UNUSED(callback);
ARG_UNUSED(set);
return -ENOTSUP;
}
static int gpio_pcal9535a_enable_callback(struct device *dev,
int access_op, u32_t pin)
{
ARG_UNUSED(dev);
ARG_UNUSED(access_op);
ARG_UNUSED(pin);
return -ENOTSUP;
}
static int gpio_pcal9535a_disable_callback(struct device *dev,
int access_op, u32_t pin)
{
ARG_UNUSED(dev);
ARG_UNUSED(access_op);
ARG_UNUSED(pin);
return -ENOTSUP;
}
static const struct gpio_driver_api gpio_pcal9535a_drv_api_funcs = {
.config = gpio_pcal9535a_config,
.write = gpio_pcal9535a_write,
.read = gpio_pcal9535a_read,
.manage_callback = gpio_pcal9535a_manage_callback,
.enable_callback = gpio_pcal9535a_enable_callback,
.disable_callback = gpio_pcal9535a_disable_callback,
};
/**