diff options
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/via/via-gpio.c | 49 |
1 files changed, 25 insertions, 24 deletions
diff --git a/drivers/video/via/via-gpio.c b/drivers/video/via/via-gpio.c index c2a0a1cfd3b3..ab5341814c74 100644 --- a/drivers/video/via/via-gpio.c +++ b/drivers/video/via/via-gpio.c | |||
@@ -145,7 +145,7 @@ static int via_gpio_get(struct gpio_chip *chip, unsigned int nr) | |||
145 | } | 145 | } |
146 | 146 | ||
147 | 147 | ||
148 | static struct viafb_gpio_cfg gpio_config = { | 148 | static struct viafb_gpio_cfg viafb_gpio_config = { |
149 | .gpio_chip = { | 149 | .gpio_chip = { |
150 | .label = "VIAFB onboard GPIO", | 150 | .label = "VIAFB onboard GPIO", |
151 | .owner = THIS_MODULE, | 151 | .owner = THIS_MODULE, |
@@ -183,8 +183,8 @@ static int viafb_gpio_resume(void *private) | |||
183 | { | 183 | { |
184 | int i; | 184 | int i; |
185 | 185 | ||
186 | for (i = 0; i < gpio_config.gpio_chip.ngpio; i += 2) | 186 | for (i = 0; i < viafb_gpio_config.gpio_chip.ngpio; i += 2) |
187 | viafb_gpio_enable(gpio_config.active_gpios[i]); | 187 | viafb_gpio_enable(viafb_gpio_config.active_gpios[i]); |
188 | return 0; | 188 | return 0; |
189 | } | 189 | } |
190 | 190 | ||
@@ -201,9 +201,9 @@ int viafb_gpio_lookup(const char *name) | |||
201 | { | 201 | { |
202 | int i; | 202 | int i; |
203 | 203 | ||
204 | for (i = 0; i < gpio_config.gpio_chip.ngpio; i++) | 204 | for (i = 0; i < viafb_gpio_config.gpio_chip.ngpio; i++) |
205 | if (!strcmp(name, gpio_config.active_gpios[i]->vg_name)) | 205 | if (!strcmp(name, viafb_gpio_config.active_gpios[i]->vg_name)) |
206 | return gpio_config.gpio_chip.base + i; | 206 | return viafb_gpio_config.gpio_chip.base + i; |
207 | return -1; | 207 | return -1; |
208 | } | 208 | } |
209 | EXPORT_SYMBOL_GPL(viafb_gpio_lookup); | 209 | EXPORT_SYMBOL_GPL(viafb_gpio_lookup); |
@@ -229,14 +229,15 @@ static __devinit int viafb_gpio_probe(struct platform_device *platdev) | |||
229 | for (gpio = viafb_all_gpios; | 229 | for (gpio = viafb_all_gpios; |
230 | gpio < viafb_all_gpios + VIAFB_NUM_GPIOS; gpio++) | 230 | gpio < viafb_all_gpios + VIAFB_NUM_GPIOS; gpio++) |
231 | if (gpio->vg_port_index == port_cfg[i].ioport_index) { | 231 | if (gpio->vg_port_index == port_cfg[i].ioport_index) { |
232 | gpio_config.active_gpios[ngpio] = gpio; | 232 | viafb_gpio_config.active_gpios[ngpio] = gpio; |
233 | gpio_config.gpio_names[ngpio] = gpio->vg_name; | 233 | viafb_gpio_config.gpio_names[ngpio] = |
234 | gpio->vg_name; | ||
234 | ngpio++; | 235 | ngpio++; |
235 | } | 236 | } |
236 | } | 237 | } |
237 | gpio_config.gpio_chip.ngpio = ngpio; | 238 | viafb_gpio_config.gpio_chip.ngpio = ngpio; |
238 | gpio_config.gpio_chip.names = gpio_config.gpio_names; | 239 | viafb_gpio_config.gpio_chip.names = viafb_gpio_config.gpio_names; |
239 | gpio_config.vdev = vdev; | 240 | viafb_gpio_config.vdev = vdev; |
240 | if (ngpio == 0) { | 241 | if (ngpio == 0) { |
241 | printk(KERN_INFO "viafb: no GPIOs configured\n"); | 242 | printk(KERN_INFO "viafb: no GPIOs configured\n"); |
242 | return 0; | 243 | return 0; |
@@ -245,18 +246,18 @@ static __devinit int viafb_gpio_probe(struct platform_device *platdev) | |||
245 | * Enable the ports. They come in pairs, with a single | 246 | * Enable the ports. They come in pairs, with a single |
246 | * enable bit for both. | 247 | * enable bit for both. |
247 | */ | 248 | */ |
248 | spin_lock_irqsave(&gpio_config.vdev->reg_lock, flags); | 249 | spin_lock_irqsave(&viafb_gpio_config.vdev->reg_lock, flags); |
249 | for (i = 0; i < ngpio; i += 2) | 250 | for (i = 0; i < ngpio; i += 2) |
250 | viafb_gpio_enable(gpio_config.active_gpios[i]); | 251 | viafb_gpio_enable(viafb_gpio_config.active_gpios[i]); |
251 | spin_unlock_irqrestore(&gpio_config.vdev->reg_lock, flags); | 252 | spin_unlock_irqrestore(&viafb_gpio_config.vdev->reg_lock, flags); |
252 | /* | 253 | /* |
253 | * Get registered. | 254 | * Get registered. |
254 | */ | 255 | */ |
255 | gpio_config.gpio_chip.base = -1; /* Dynamic */ | 256 | viafb_gpio_config.gpio_chip.base = -1; /* Dynamic */ |
256 | ret = gpiochip_add(&gpio_config.gpio_chip); | 257 | ret = gpiochip_add(&viafb_gpio_config.gpio_chip); |
257 | if (ret) { | 258 | if (ret) { |
258 | printk(KERN_ERR "viafb: failed to add gpios (%d)\n", ret); | 259 | printk(KERN_ERR "viafb: failed to add gpios (%d)\n", ret); |
259 | gpio_config.gpio_chip.ngpio = 0; | 260 | viafb_gpio_config.gpio_chip.ngpio = 0; |
260 | } | 261 | } |
261 | #ifdef CONFIG_PM | 262 | #ifdef CONFIG_PM |
262 | viafb_pm_register(&viafb_gpio_pm_hooks); | 263 | viafb_pm_register(&viafb_gpio_pm_hooks); |
@@ -277,8 +278,8 @@ static int viafb_gpio_remove(struct platform_device *platdev) | |||
277 | /* | 278 | /* |
278 | * Get unregistered. | 279 | * Get unregistered. |
279 | */ | 280 | */ |
280 | if (gpio_config.gpio_chip.ngpio > 0) { | 281 | if (viafb_gpio_config.gpio_chip.ngpio > 0) { |
281 | ret = gpiochip_remove(&gpio_config.gpio_chip); | 282 | ret = gpiochip_remove(&viafb_gpio_config.gpio_chip); |
282 | if (ret) { /* Somebody still using it? */ | 283 | if (ret) { /* Somebody still using it? */ |
283 | printk(KERN_ERR "Viafb: GPIO remove failed\n"); | 284 | printk(KERN_ERR "Viafb: GPIO remove failed\n"); |
284 | return ret; | 285 | return ret; |
@@ -287,11 +288,11 @@ static int viafb_gpio_remove(struct platform_device *platdev) | |||
287 | /* | 288 | /* |
288 | * Disable the ports. | 289 | * Disable the ports. |
289 | */ | 290 | */ |
290 | spin_lock_irqsave(&gpio_config.vdev->reg_lock, flags); | 291 | spin_lock_irqsave(&viafb_gpio_config.vdev->reg_lock, flags); |
291 | for (i = 0; i < gpio_config.gpio_chip.ngpio; i += 2) | 292 | for (i = 0; i < viafb_gpio_config.gpio_chip.ngpio; i += 2) |
292 | viafb_gpio_disable(gpio_config.active_gpios[i]); | 293 | viafb_gpio_disable(viafb_gpio_config.active_gpios[i]); |
293 | gpio_config.gpio_chip.ngpio = 0; | 294 | viafb_gpio_config.gpio_chip.ngpio = 0; |
294 | spin_unlock_irqrestore(&gpio_config.vdev->reg_lock, flags); | 295 | spin_unlock_irqrestore(&viafb_gpio_config.vdev->reg_lock, flags); |
295 | return ret; | 296 | return ret; |
296 | } | 297 | } |
297 | 298 | ||