Message ID | 1328101352-22274-1-git-send-email-thomas.abraham@linaro.org |
---|---|
State | New |
Headers | show |
On 01.02.2012 14:02, Thomas Abraham wrote: > Commit 15c9a0acc3f7 (of: create of_phandle_args to simplify return of phandle > parsing data) modifies the parameter list of of_xlate function pointer declaration > in gpio_chip. Adapt the gpio specifier translate function for this change. > > Reported-by: Tushar Behera<tushar.behera@linaro.org> > Signed-off-by: Thomas Abraham<thomas.abraham@linaro.org> Tested-by: Karol Lewandowski <k.lewandowsk@samsung.com> Fixes following Oops in i2c-s3c24xx. Thanks <1>Unable to handle kernel NULL pointer dereference at virtual address 00000000 <1>pgd = c0004000 <1>[00000000] *pgd=00000000 <0>Internal error: Oops: 5 [#1] PREEMPT SMP <d>Modules linked in: CPU: 0 Tainted: G W (3.3.0-rc1+ #20) PC is at exynos4_gpio_xlate+0x18/0xe8 LR is at of_get_named_gpio_flags+0xd0/0x190 pc : [<c025dd60>] lr : [<c03423a0>] psr: 60000013 sp : e9047d88 ip : e9047da8 fp : e9047da4 r10: 00000000 r9 : 00000000 r8 : c05ecf4c r7 : c0864ca8 r6 : 00000000 r5 : e9047db0 r4 : c025dd48 r3 : 00000004 r2 : 00000000 r1 : e9047db0 r0 : c05ecf4c Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel Control: 10c53c7d Table: 4000404a DAC: 00000015 <0>Process swapper/0 (pid: 1, stack limit = 0xe90462f0) <0>Stack: (0xe9047d88 to 0xe9048000) ... [<c025dd60>] (exynos4_gpio_xlate+0x18/0xe8) from [<c03423a0>] (of_get_named_gpio_flags+0xd0/0x190) [<c03423a0>] (of_get_named_gpio_flags+0xd0/0x190) from [<c02e77cc>] (s3c24xx_i2c_init+0x264/0x430) [<c02e77cc>] (s3c24xx_i2c_init+0x264/0x430) from [<c02e7c24>] (s3c24xx_i2c_probe+0x1c8/0x4ac) [<c02e7c24>] (s3c24xx_i2c_probe+0x1c8/0x4ac) from [<c02a4320>] (platform_drv_probe+0x28/0x2c)
On Wed, Feb 01, 2012 at 06:32:32PM +0530, Thomas Abraham wrote: > Commit 15c9a0acc3f7 (of: create of_phandle_args to simplify return of phandle > parsing data) modifies the parameter list of of_xlate function pointer declaration > in gpio_chip. Adapt the gpio specifier translate function for this change. > > Reported-by: Tushar Behera <tushar.behera@linaro.org> > Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org> Applied, thanks. g.
diff --git a/drivers/gpio/gpio-samsung.c b/drivers/gpio/gpio-samsung.c index a766177..0a79a11 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[] = { }; #if defined(CONFIG_ARCH_EXYNOS4) && defined(CONFIG_OF) -static int exynos4_gpio_xlate(struct gpio_chip *gc, struct device_node *np, - const void *gpio_spec, u32 *flags) +static int exynos4_gpio_xlate(struct gpio_chip *gc, + const struct of_phandle_args *gpiospec, u32 *flags) { - const __be32 *gpio = gpio_spec; - const u32 n = be32_to_cpup(gpio); - unsigned int pin = gc->base + be32_to_cpu(gpio[0]); + unsigned int pin; if (WARN_ON(gc->of_gpio_n_cells < 4)) return -EINVAL; - if (n > gc->ngpio) + if (WARN_ON(gpiospec->args_count < gc->of_gpio_n_cells)) return -EINVAL; - if (s3c_gpio_cfgpin(pin, S3C_GPIO_SFN(be32_to_cpu(gpio[1])))) + if (gpiospec->args[0] > gc->ngpio) + return -EINVAL; + + pin = gc->base + gpiospec->args[0]; + + if (s3c_gpio_cfgpin(pin, S3C_GPIO_SFN(gpiospec->args[1]))) pr_warn("gpio_xlate: failed to set pin function\n"); - if (s3c_gpio_setpull(pin, be32_to_cpu(gpio[2]))) + if (s3c_gpio_setpull(pin, gpiospec->args[2])) pr_warn("gpio_xlate: failed to set pin pull up/down\n"); - if (s5p_gpio_set_drvstr(pin, be32_to_cpu(gpio[3]))) + if (s5p_gpio_set_drvstr(pin, gpiospec->args[3])) pr_warn("gpio_xlate: failed to set pin drive strength\n"); - return n; + return gpiospec->args[0]; } static const struct of_device_id exynos4_gpio_dt_match[] __initdata = {
Commit 15c9a0acc3f7 (of: create of_phandle_args to simplify return of phandle parsing data) modifies the parameter list of of_xlate function pointer declaration in gpio_chip. Adapt the gpio specifier translate function for this change. Reported-by: Tushar Behera <tushar.behera@linaro.org> Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org> --- drivers/gpio/gpio-samsung.c | 23 +++++++++++++---------- 1 files changed, 13 insertions(+), 10 deletions(-)