diff options
author | Guennadi Liakhovetski <g.liakhovetski@pengutronix.de> | 2008-04-22 13:42:08 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-04-24 13:07:43 -0400 |
commit | b4333a3baecfeee35317c03cf08952cc04bd149a (patch) | |
tree | e3d779aab6705f9bab22b8381be76f310ac832b4 | |
parent | 12afe3781870cad7b6bbe83a2f8c4dd9ec7bf214 (diff) |
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: Guennadi Liakhovetski <g.liakhovetski@pengutronix.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | drivers/media/video/mt9m001.c | 10 | ||||
-rw-r--r-- | drivers/media/video/mt9v022.c | 10 |
2 files changed, 10 insertions, 10 deletions
diff --git a/drivers/media/video/mt9m001.c b/drivers/media/video/mt9m001.c index 3c5867c378d3..b65ff7745b8d 100644 --- a/drivers/media/video/mt9m001.c +++ b/drivers/media/video/mt9m001.c | |||
@@ -154,7 +154,7 @@ static int bus_switch_request(struct mt9m001 *mt9m001, | |||
154 | int ret; | 154 | int ret; |
155 | unsigned int gpio = icl->gpio; | 155 | unsigned int gpio = icl->gpio; |
156 | 156 | ||
157 | if (gpio != NO_GPIO) { | 157 | if (gpio_is_valid(gpio)) { |
158 | /* We have a data bus switch. */ | 158 | /* We have a data bus switch. */ |
159 | ret = gpio_request(gpio, "mt9m001"); | 159 | ret = gpio_request(gpio, "mt9m001"); |
160 | if (ret < 0) { | 160 | if (ret < 0) { |
@@ -174,7 +174,7 @@ static int bus_switch_request(struct mt9m001 *mt9m001, | |||
174 | 174 | ||
175 | mt9m001->switch_gpio = gpio; | 175 | mt9m001->switch_gpio = gpio; |
176 | #else | 176 | #else |
177 | mt9m001->switch_gpio = NO_GPIO; | 177 | mt9m001->switch_gpio = -EINVAL; |
178 | #endif | 178 | #endif |
179 | return 0; | 179 | return 0; |
180 | } | 180 | } |
@@ -182,7 +182,7 @@ static int bus_switch_request(struct mt9m001 *mt9m001, | |||
182 | static void bus_switch_release(struct mt9m001 *mt9m001) | 182 | static void bus_switch_release(struct mt9m001 *mt9m001) |
183 | { | 183 | { |
184 | #ifdef CONFIG_MT9M001_PCA9536_SWITCH | 184 | #ifdef CONFIG_MT9M001_PCA9536_SWITCH |
185 | if (mt9m001->switch_gpio != NO_GPIO) | 185 | if (gpio_is_valid(mt9m001->switch_gpio)) |
186 | gpio_free(mt9m001->switch_gpio); | 186 | gpio_free(mt9m001->switch_gpio); |
187 | #endif | 187 | #endif |
188 | } | 188 | } |
@@ -190,7 +190,7 @@ static void bus_switch_release(struct mt9m001 *mt9m001) | |||
190 | static int bus_switch_act(struct mt9m001 *mt9m001, int go8bit) | 190 | static int bus_switch_act(struct mt9m001 *mt9m001, int go8bit) |
191 | { | 191 | { |
192 | #ifdef CONFIG_MT9M001_PCA9536_SWITCH | 192 | #ifdef CONFIG_MT9M001_PCA9536_SWITCH |
193 | if (mt9m001->switch_gpio == NO_GPIO) | 193 | if (!gpio_is_valid(mt9m001->switch_gpio)) |
194 | return -ENODEV; | 194 | return -ENODEV; |
195 | 195 | ||
196 | gpio_set_value_cansleep(mt9m001->switch_gpio, go8bit); | 196 | gpio_set_value_cansleep(mt9m001->switch_gpio, go8bit); |
@@ -224,7 +224,7 @@ static int mt9m001_set_capture_format(struct soc_camera_device *icd, | |||
224 | (mt9m001->datawidth != 9 && (width_flag == IS_DATAWIDTH_9)) || | 224 | (mt9m001->datawidth != 9 && (width_flag == IS_DATAWIDTH_9)) || |
225 | (mt9m001->datawidth != 8 && (width_flag == IS_DATAWIDTH_8))) { | 225 | (mt9m001->datawidth != 8 && (width_flag == IS_DATAWIDTH_8))) { |
226 | /* data width switch requested */ | 226 | /* data width switch requested */ |
227 | if (mt9m001->switch_gpio == NO_GPIO) | 227 | if (!gpio_is_valid(mt9m001->switch_gpio)) |
228 | return -EINVAL; | 228 | return -EINVAL; |
229 | 229 | ||
230 | /* Well, we actually only can do 10 or 8 bits... */ | 230 | /* Well, we actually only can do 10 or 8 bits... */ |
diff --git a/drivers/media/video/mt9v022.c b/drivers/media/video/mt9v022.c index 9b406e41902a..5fbeaa305f35 100644 --- a/drivers/media/video/mt9v022.c +++ b/drivers/media/video/mt9v022.c | |||
@@ -187,7 +187,7 @@ static int bus_switch_request(struct mt9v022 *mt9v022, struct soc_camera_link *i | |||
187 | int ret; | 187 | int ret; |
188 | unsigned int gpio = icl->gpio; | 188 | unsigned int gpio = icl->gpio; |
189 | 189 | ||
190 | if (gpio != NO_GPIO) { | 190 | if (gpio_is_valid(gpio)) { |
191 | /* We have a data bus switch. */ | 191 | /* We have a data bus switch. */ |
192 | ret = gpio_request(gpio, "mt9v022"); | 192 | ret = gpio_request(gpio, "mt9v022"); |
193 | if (ret < 0) { | 193 | if (ret < 0) { |
@@ -206,7 +206,7 @@ static int bus_switch_request(struct mt9v022 *mt9v022, struct soc_camera_link *i | |||
206 | 206 | ||
207 | mt9v022->switch_gpio = gpio; | 207 | mt9v022->switch_gpio = gpio; |
208 | #else | 208 | #else |
209 | mt9v022->switch_gpio = NO_GPIO; | 209 | mt9v022->switch_gpio = -EINVAL; |
210 | #endif | 210 | #endif |
211 | return 0; | 211 | return 0; |
212 | } | 212 | } |
@@ -214,7 +214,7 @@ static int bus_switch_request(struct mt9v022 *mt9v022, struct soc_camera_link *i | |||
214 | static void bus_switch_release(struct mt9v022 *mt9v022) | 214 | static void bus_switch_release(struct mt9v022 *mt9v022) |
215 | { | 215 | { |
216 | #ifdef CONFIG_MT9V022_PCA9536_SWITCH | 216 | #ifdef CONFIG_MT9V022_PCA9536_SWITCH |
217 | if (mt9v022->switch_gpio != NO_GPIO) | 217 | if (gpio_is_valid(mt9v022->switch_gpio)) |
218 | gpio_free(mt9v022->switch_gpio); | 218 | gpio_free(mt9v022->switch_gpio); |
219 | #endif | 219 | #endif |
220 | } | 220 | } |
@@ -222,7 +222,7 @@ static void bus_switch_release(struct mt9v022 *mt9v022) | |||
222 | static int bus_switch_act(struct mt9v022 *mt9v022, int go8bit) | 222 | static int bus_switch_act(struct mt9v022 *mt9v022, int go8bit) |
223 | { | 223 | { |
224 | #ifdef CONFIG_MT9V022_PCA9536_SWITCH | 224 | #ifdef CONFIG_MT9V022_PCA9536_SWITCH |
225 | if (mt9v022->switch_gpio == NO_GPIO) | 225 | if (!gpio_is_valid(mt9v022->switch_gpio)) |
226 | return -ENODEV; | 226 | return -ENODEV; |
227 | 227 | ||
228 | gpio_set_value_cansleep(mt9v022->switch_gpio, go8bit); | 228 | gpio_set_value_cansleep(mt9v022->switch_gpio, go8bit); |
@@ -303,7 +303,7 @@ static int mt9v022_set_capture_format(struct soc_camera_device *icd, | |||
303 | (mt9v022->datawidth != 9 && (width_flag == IS_DATAWIDTH_9)) || | 303 | (mt9v022->datawidth != 9 && (width_flag == IS_DATAWIDTH_9)) || |
304 | (mt9v022->datawidth != 8 && (width_flag == IS_DATAWIDTH_8))) { | 304 | (mt9v022->datawidth != 8 && (width_flag == IS_DATAWIDTH_8))) { |
305 | /* data width switch requested */ | 305 | /* data width switch requested */ |
306 | if (mt9v022->switch_gpio == NO_GPIO) | 306 | if (!gpio_is_valid(mt9v022->switch_gpio)) |
307 | return -EINVAL; | 307 | return -EINVAL; |
308 | 308 | ||
309 | /* Well, we actually only can do 10 or 8 bits... */ | 309 | /* Well, we actually only can do 10 or 8 bits... */ |