Merge tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux-2.6

Pull a few more GPIO bug fixes from Grant Likely:
"Oops, missed a couple. Here's an updated pull req for GPIO"

A set of PCH bug fixes, and one patch to fix up compile warnings

* tag 'gpio-for-linus' of git://git.secretlab.ca/git/linux-2.6:
gpio/exynos: Fix compiler warnings when non-exynos machines are selected
gpio: pch9: Use proper flow type handlers

Changed files
+40 -35
drivers
+28 -29
drivers/gpio/gpio-pch.c
··· 230 230 231 231 static int pch_irq_type(struct irq_data *d, unsigned int type) 232 232 { 233 - u32 im; 234 - u32 __iomem *im_reg; 235 - u32 ien; 236 - u32 im_pos; 237 - int ch; 238 - unsigned long flags; 239 - u32 val; 240 - int irq = d->irq; 241 233 struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 242 234 struct pch_gpio *chip = gc->private; 235 + u32 im, im_pos, val; 236 + u32 __iomem *im_reg; 237 + unsigned long flags; 238 + int ch, irq = d->irq; 243 239 244 240 ch = irq - chip->irq_base; 245 241 if (irq <= chip->irq_base + 7) { ··· 266 270 case IRQ_TYPE_LEVEL_LOW: 267 271 val = PCH_LEVEL_L; 268 272 break; 269 - case IRQ_TYPE_PROBE: 270 - goto end; 271 273 default: 272 - dev_warn(chip->dev, "%s: unknown type(%dd)", 273 - __func__, type); 274 - goto end; 274 + goto unlock; 275 275 } 276 276 277 277 /* Set interrupt mode */ 278 278 im = ioread32(im_reg) & ~(PCH_IM_MASK << (im_pos * 4)); 279 279 iowrite32(im | (val << (im_pos * 4)), im_reg); 280 280 281 - /* iclr */ 282 - iowrite32(BIT(ch), &chip->reg->iclr); 281 + /* And the handler */ 282 + if (type & (IRQ_TYPE_LEVEL_LOW | IRQ_TYPE_LEVEL_HIGH)) 283 + __irq_set_handler_locked(d->irq, handle_level_irq); 284 + else if (type & (IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING)) 285 + __irq_set_handler_locked(d->irq, handle_edge_irq); 283 286 284 - /* IMASKCLR */ 285 - iowrite32(BIT(ch), &chip->reg->imaskclr); 286 - 287 - /* Enable interrupt */ 288 - ien = ioread32(&chip->reg->ien); 289 - iowrite32(ien | BIT(ch), &chip->reg->ien); 290 - end: 287 + unlock: 291 288 spin_unlock_irqrestore(&chip->spinlock, flags); 292 - 293 289 return 0; 294 290 } 295 291 ··· 301 313 iowrite32(1 << (d->irq - chip->irq_base), &chip->reg->imask); 302 314 } 303 315 316 + static void pch_irq_ack(struct irq_data *d) 317 + { 318 + struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); 319 + struct pch_gpio *chip = gc->private; 320 + 321 + iowrite32(1 << (d->irq - chip->irq_base), &chip->reg->iclr); 322 + } 323 + 304 324 static irqreturn_t pch_gpio_handler(int irq, void *dev_id) 305 325 { 306 326 struct pch_gpio *chip = dev_id; 307 327 u32 reg_val = ioread32(&chip->reg->istatus); 308 - int i; 309 - int ret = IRQ_NONE; 328 + int i, ret = IRQ_NONE; 310 329 311 330 for (i = 0; i < gpio_pins[chip->ioh]; i++) { 312 331 if (reg_val & BIT(i)) { 313 332 dev_dbg(chip->dev, "%s:[%d]:irq=%d status=0x%x\n", 314 333 __func__, i, irq, reg_val); 315 - iowrite32(BIT(i), &chip->reg->iclr); 316 334 generic_handle_irq(chip->irq_base + i); 317 335 ret = IRQ_HANDLED; 318 336 } ··· 337 343 gc->private = chip; 338 344 ct = gc->chip_types; 339 345 346 + ct->chip.irq_ack = pch_irq_ack; 340 347 ct->chip.irq_mask = pch_irq_mask; 341 348 ct->chip.irq_unmask = pch_irq_unmask; 342 349 ct->chip.irq_set_type = pch_irq_type; ··· 352 357 s32 ret; 353 358 struct pch_gpio *chip; 354 359 int irq_base; 360 + u32 msk; 355 361 356 362 chip = kzalloc(sizeof(*chip), GFP_KERNEL); 357 363 if (chip == NULL) ··· 404 408 } 405 409 chip->irq_base = irq_base; 406 410 411 + /* Mask all interrupts, but enable them */ 412 + msk = (1 << gpio_pins[chip->ioh]) - 1; 413 + iowrite32(msk, &chip->reg->imask); 414 + iowrite32(msk, &chip->reg->ien); 415 + 407 416 ret = request_irq(pdev->irq, pch_gpio_handler, 408 - IRQF_SHARED, KBUILD_MODNAME, chip); 417 + IRQF_SHARED, KBUILD_MODNAME, chip); 409 418 if (ret != 0) { 410 419 dev_err(&pdev->dev, 411 420 "%s request_irq failed\n", __func__); ··· 419 418 420 419 pch_gpio_alloc_generic_chip(chip, irq_base, gpio_pins[chip->ioh]); 421 420 422 - /* Initialize interrupt ien register */ 423 - iowrite32(0, &chip->reg->ien); 424 421 end: 425 422 return 0; 426 423
+12 -6
drivers/gpio/gpio-samsung.c
··· 452 452 }; 453 453 #endif 454 454 455 + #if defined(CONFIG_ARCH_EXYNOS4) || defined(CONFIG_ARCH_EXYNOS5) 455 456 static struct samsung_gpio_cfg exynos_gpio_cfg = { 456 457 .set_pull = exynos_gpio_setpull, 457 458 .get_pull = exynos_gpio_getpull, 458 459 .set_config = samsung_gpio_setcfg_4bit, 459 460 .get_config = samsung_gpio_getcfg_4bit, 460 461 }; 462 + #endif 461 463 462 464 #if defined(CONFIG_CPU_S5P6440) || defined(CONFIG_CPU_S5P6450) 463 465 static struct samsung_gpio_cfg s5p64x0_gpio_cfg_rbank = { ··· 2125 2123 * uses the above macro and depends on the banks being listed in order here. 2126 2124 */ 2127 2125 2128 - static struct samsung_gpio_chip exynos4_gpios_1[] = { 2129 2126 #ifdef CONFIG_ARCH_EXYNOS4 2127 + static struct samsung_gpio_chip exynos4_gpios_1[] = { 2130 2128 { 2131 2129 .chip = { 2132 2130 .base = EXYNOS4_GPA0(0), ··· 2224 2222 .label = "GPF3", 2225 2223 }, 2226 2224 }, 2227 - #endif 2228 2225 }; 2226 + #endif 2229 2227 2230 - static struct samsung_gpio_chip exynos4_gpios_2[] = { 2231 2228 #ifdef CONFIG_ARCH_EXYNOS4 2229 + static struct samsung_gpio_chip exynos4_gpios_2[] = { 2232 2230 { 2233 2231 .chip = { 2234 2232 .base = EXYNOS4_GPJ0(0), ··· 2369 2367 .to_irq = samsung_gpiolib_to_irq, 2370 2368 }, 2371 2369 }, 2372 - #endif 2373 2370 }; 2371 + #endif 2374 2372 2375 - static struct samsung_gpio_chip exynos4_gpios_3[] = { 2376 2373 #ifdef CONFIG_ARCH_EXYNOS4 2374 + static struct samsung_gpio_chip exynos4_gpios_3[] = { 2377 2375 { 2378 2376 .chip = { 2379 2377 .base = EXYNOS4_GPZ(0), ··· 2381 2379 .label = "GPZ", 2382 2380 }, 2383 2381 }, 2384 - #endif 2385 2382 }; 2383 + #endif 2386 2384 2387 2385 #ifdef CONFIG_ARCH_EXYNOS5 2388 2386 static struct samsung_gpio_chip exynos5_gpios_1[] = { ··· 2721 2719 { 2722 2720 struct samsung_gpio_chip *chip; 2723 2721 int i, nr_chips; 2722 + #if defined(CONFIG_CPU_EXYNOS4210) || defined(CONFIG_SOC_EXYNOS5250) 2724 2723 void __iomem *gpio_base1, *gpio_base2, *gpio_base3, *gpio_base4; 2724 + #endif 2725 2725 int group = 0; 2726 2726 2727 2727 samsung_gpiolib_set_cfg(samsung_gpio_cfgs, ARRAY_SIZE(samsung_gpio_cfgs)); ··· 2975 2971 2976 2972 return 0; 2977 2973 2974 + #if defined(CONFIG_CPU_EXYNOS4210) || defined(CONFIG_SOC_EXYNOS5250) 2978 2975 err_ioremap4: 2979 2976 iounmap(gpio_base3); 2980 2977 err_ioremap3: ··· 2984 2979 iounmap(gpio_base1); 2985 2980 err_ioremap1: 2986 2981 return -ENOMEM; 2982 + #endif 2987 2983 } 2988 2984 core_initcall(samsung_gpiolib_init); 2989 2985