Commit b4333a3b authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by Mauro Carvalho Chehab

V4L/DVB (7217): Replace NO_GPIO with gpio_is_valid()

Upon suggestion by David Brownell use a gpio_is_valid() predicate
instead of an explicit NO_GPIO macro. The respective patch to
include/asm-generic/gpio.h has been accepted upstream.
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@pengutronix.de>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent 12afe378
...@@ -154,7 +154,7 @@ static int bus_switch_request(struct mt9m001 *mt9m001, ...@@ -154,7 +154,7 @@ static int bus_switch_request(struct mt9m001 *mt9m001,
int ret; int ret;
unsigned int gpio = icl->gpio; unsigned int gpio = icl->gpio;
if (gpio != NO_GPIO) { if (gpio_is_valid(gpio)) {
/* We have a data bus switch. */ /* We have a data bus switch. */
ret = gpio_request(gpio, "mt9m001"); ret = gpio_request(gpio, "mt9m001");
if (ret < 0) { if (ret < 0) {
...@@ -174,7 +174,7 @@ static int bus_switch_request(struct mt9m001 *mt9m001, ...@@ -174,7 +174,7 @@ static int bus_switch_request(struct mt9m001 *mt9m001,
mt9m001->switch_gpio = gpio; mt9m001->switch_gpio = gpio;
#else #else
mt9m001->switch_gpio = NO_GPIO; mt9m001->switch_gpio = -EINVAL;
#endif #endif
return 0; return 0;
} }
...@@ -182,7 +182,7 @@ static int bus_switch_request(struct mt9m001 *mt9m001, ...@@ -182,7 +182,7 @@ static int bus_switch_request(struct mt9m001 *mt9m001,
static void bus_switch_release(struct mt9m001 *mt9m001) static void bus_switch_release(struct mt9m001 *mt9m001)
{ {
#ifdef CONFIG_MT9M001_PCA9536_SWITCH #ifdef CONFIG_MT9M001_PCA9536_SWITCH
if (mt9m001->switch_gpio != NO_GPIO) if (gpio_is_valid(mt9m001->switch_gpio))
gpio_free(mt9m001->switch_gpio); gpio_free(mt9m001->switch_gpio);
#endif #endif
} }
...@@ -190,7 +190,7 @@ static void bus_switch_release(struct mt9m001 *mt9m001) ...@@ -190,7 +190,7 @@ static void bus_switch_release(struct mt9m001 *mt9m001)
static int bus_switch_act(struct mt9m001 *mt9m001, int go8bit) static int bus_switch_act(struct mt9m001 *mt9m001, int go8bit)
{ {
#ifdef CONFIG_MT9M001_PCA9536_SWITCH #ifdef CONFIG_MT9M001_PCA9536_SWITCH
if (mt9m001->switch_gpio == NO_GPIO) if (!gpio_is_valid(mt9m001->switch_gpio))
return -ENODEV; return -ENODEV;
gpio_set_value_cansleep(mt9m001->switch_gpio, go8bit); gpio_set_value_cansleep(mt9m001->switch_gpio, go8bit);
...@@ -224,7 +224,7 @@ static int mt9m001_set_capture_format(struct soc_camera_device *icd, ...@@ -224,7 +224,7 @@ static int mt9m001_set_capture_format(struct soc_camera_device *icd,
(mt9m001->datawidth != 9 && (width_flag == IS_DATAWIDTH_9)) || (mt9m001->datawidth != 9 && (width_flag == IS_DATAWIDTH_9)) ||
(mt9m001->datawidth != 8 && (width_flag == IS_DATAWIDTH_8))) { (mt9m001->datawidth != 8 && (width_flag == IS_DATAWIDTH_8))) {
/* data width switch requested */ /* data width switch requested */
if (mt9m001->switch_gpio == NO_GPIO) if (!gpio_is_valid(mt9m001->switch_gpio))
return -EINVAL; return -EINVAL;
/* Well, we actually only can do 10 or 8 bits... */ /* Well, we actually only can do 10 or 8 bits... */
......
...@@ -187,7 +187,7 @@ static int bus_switch_request(struct mt9v022 *mt9v022, struct soc_camera_link *i ...@@ -187,7 +187,7 @@ static int bus_switch_request(struct mt9v022 *mt9v022, struct soc_camera_link *i
int ret; int ret;
unsigned int gpio = icl->gpio; unsigned int gpio = icl->gpio;
if (gpio != NO_GPIO) { if (gpio_is_valid(gpio)) {
/* We have a data bus switch. */ /* We have a data bus switch. */
ret = gpio_request(gpio, "mt9v022"); ret = gpio_request(gpio, "mt9v022");
if (ret < 0) { if (ret < 0) {
...@@ -206,7 +206,7 @@ static int bus_switch_request(struct mt9v022 *mt9v022, struct soc_camera_link *i ...@@ -206,7 +206,7 @@ static int bus_switch_request(struct mt9v022 *mt9v022, struct soc_camera_link *i
mt9v022->switch_gpio = gpio; mt9v022->switch_gpio = gpio;
#else #else
mt9v022->switch_gpio = NO_GPIO; mt9v022->switch_gpio = -EINVAL;
#endif #endif
return 0; return 0;
} }
...@@ -214,7 +214,7 @@ static int bus_switch_request(struct mt9v022 *mt9v022, struct soc_camera_link *i ...@@ -214,7 +214,7 @@ static int bus_switch_request(struct mt9v022 *mt9v022, struct soc_camera_link *i
static void bus_switch_release(struct mt9v022 *mt9v022) static void bus_switch_release(struct mt9v022 *mt9v022)
{ {
#ifdef CONFIG_MT9V022_PCA9536_SWITCH #ifdef CONFIG_MT9V022_PCA9536_SWITCH
if (mt9v022->switch_gpio != NO_GPIO) if (gpio_is_valid(mt9v022->switch_gpio))
gpio_free(mt9v022->switch_gpio); gpio_free(mt9v022->switch_gpio);
#endif #endif
} }
...@@ -222,7 +222,7 @@ static void bus_switch_release(struct mt9v022 *mt9v022) ...@@ -222,7 +222,7 @@ static void bus_switch_release(struct mt9v022 *mt9v022)
static int bus_switch_act(struct mt9v022 *mt9v022, int go8bit) static int bus_switch_act(struct mt9v022 *mt9v022, int go8bit)
{ {
#ifdef CONFIG_MT9V022_PCA9536_SWITCH #ifdef CONFIG_MT9V022_PCA9536_SWITCH
if (mt9v022->switch_gpio == NO_GPIO) if (!gpio_is_valid(mt9v022->switch_gpio))
return -ENODEV; return -ENODEV;
gpio_set_value_cansleep(mt9v022->switch_gpio, go8bit); gpio_set_value_cansleep(mt9v022->switch_gpio, go8bit);
...@@ -303,7 +303,7 @@ static int mt9v022_set_capture_format(struct soc_camera_device *icd, ...@@ -303,7 +303,7 @@ static int mt9v022_set_capture_format(struct soc_camera_device *icd,
(mt9v022->datawidth != 9 && (width_flag == IS_DATAWIDTH_9)) || (mt9v022->datawidth != 9 && (width_flag == IS_DATAWIDTH_9)) ||
(mt9v022->datawidth != 8 && (width_flag == IS_DATAWIDTH_8))) { (mt9v022->datawidth != 8 && (width_flag == IS_DATAWIDTH_8))) {
/* data width switch requested */ /* data width switch requested */
if (mt9v022->switch_gpio == NO_GPIO) if (!gpio_is_valid(mt9v022->switch_gpio))
return -EINVAL; return -EINVAL;
/* Well, we actually only can do 10 or 8 bits... */ /* Well, we actually only can do 10 or 8 bits... */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment