diff options
Diffstat (limited to 'drivers/gpio/gpio-samsung.c')
-rw-r--r-- | drivers/gpio/gpio-samsung.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c index a7661773c052..0a79a1167a25 100644 --- a/drivers/gpio/gpio-samsung.c +++ b/drivers/gpio/gpio-samsung.c | |||
@@ -2387,27 +2387,30 @@ static struct samsung_gpio_chip exynos4_gpios_3[] = { | |||
2387 | }; | 2387 | }; |
2388 | 2388 | ||
2389 | #if defined(CONFIG_ARCH_EXYNOS4) && defined(CONFIG_OF) | 2389 | #if defined(CONFIG_ARCH_EXYNOS4) && defined(CONFIG_OF) |
2390 | static int exynos4_gpio_xlate(struct gpio_chip *gc, struct device_node *np, | 2390 | static int exynos4_gpio_xlate(struct gpio_chip *gc, |
2391 | const void *gpio_spec, u32 *flags) | 2391 | const struct of_phandle_args *gpiospec, u32 *flags) |
2392 | { | 2392 | { |
2393 | const __be32 *gpio = gpio_spec; | 2393 | unsigned int pin; |
2394 | const u32 n = be32_to_cpup(gpio); | ||
2395 | unsigned int pin = gc->base + be32_to_cpu(gpio[0]); | ||
2396 | 2394 | ||
2397 | if (WARN_ON(gc->of_gpio_n_cells < 4)) | 2395 | if (WARN_ON(gc->of_gpio_n_cells < 4)) |
2398 | return -EINVAL; | 2396 | return -EINVAL; |
2399 | 2397 | ||
2400 | if (n > gc->ngpio) | 2398 | if (WARN_ON(gpiospec->args_count < gc->of_gpio_n_cells)) |
2401 | return -EINVAL; | 2399 | return -EINVAL; |
2402 | 2400 | ||
2403 | if (s3c_gpio_cfgpin(pin, S3C_GPIO_SFN(be32_to_cpu(gpio[1])))) | 2401 | if (gpiospec->args[0] > gc->ngpio) |
2402 | return -EINVAL; | ||
2403 | |||
2404 | pin = gc->base + gpiospec->args[0]; | ||
2405 | |||
2406 | if (s3c_gpio_cfgpin(pin, S3C_GPIO_SFN(gpiospec->args[1]))) | ||
2404 | pr_warn("gpio_xlate: failed to set pin function\n"); | 2407 | pr_warn("gpio_xlate: failed to set pin function\n"); |
2405 | if (s3c_gpio_setpull(pin, be32_to_cpu(gpio[2]))) | 2408 | if (s3c_gpio_setpull(pin, gpiospec->args[2])) |
2406 | pr_warn("gpio_xlate: failed to set pin pull up/down\n"); | 2409 | pr_warn("gpio_xlate: failed to set pin pull up/down\n"); |
2407 | if (s5p_gpio_set_drvstr(pin, be32_to_cpu(gpio[3]))) | 2410 | if (s5p_gpio_set_drvstr(pin, gpiospec->args[3])) |
2408 | pr_warn("gpio_xlate: failed to set pin drive strength\n"); | 2411 | pr_warn("gpio_xlate: failed to set pin drive strength\n"); |
2409 | 2412 | ||
2410 | return n; | 2413 | return gpiospec->args[0]; |
2411 | } | 2414 | } |
2412 | 2415 | ||
2413 | static const struct of_device_id exynos4_gpio_dt_match[] __initdata = { | 2416 | static const struct of_device_id exynos4_gpio_dt_match[] __initdata = { |