26 Sep, 2018

1 commit

  • [ Upstream commit dc4003d260594aa300028c3c5d040c5719abd19b ]

    We must use a mutex around the generic_add functions and save the
    function and group selector in case we need to remove them. Otherwise
    the selector use will be racy for deferred probe at least.

    Fixes: 5a49b644b307 ("pinctrl: Renesas RZ/A1 pin and gpio controller")
    Reported-by: H. Nikolaus Schaller
    Cc: Christ van Willegen
    Cc: Haojian Zhuang
    Cc: Paul Cercueil
    Cc: Sean Wang
    Acked-by: Jacopo Mondi
    Signed-off-by: Tony Lindgren
    Tested-By: H. Nikolaus Schaller
    Reviewed-by: Andy Shevchenko
    Signed-off-by: Linus Walleij
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Tony Lindgren
     

31 Aug, 2017

2 commits

  • The OF node name already contains the gpio chip identifier, no need to
    append it when creating the label.

    The following debug message clearly shows the suffix is not required
    "pinctrl-rza1 fcfe3000.pin-controller: Parsed gpiochip gpio-0-0 with 6
    pins"

    Signed-off-by: Jacopo Mondi
    Signed-off-by: Linus Walleij

    Jacopo Mondi
     
  • The rza1_pctl->ports[] array has RZA1_NPORTS (12) elements. The > here
    should be >= to prevent an out of bounds access.

    Fixes: 5a49b644b307 ("pinctrl: Renesas RZ/A1 pin and gpio controller")
    Signed-off-by: Dan Carpenter
    Reviewed-by: Geert Uytterhoeven
    Acked-by: Jacopo Mondi
    Signed-off-by: Linus Walleij

    Dan Carpenter
     

22 Aug, 2017

1 commit


14 Aug, 2017

1 commit

  • This structure is only used to copy into other structure, so declare
    it as const.

    This issue was detected using Coccinelle and the following semantic patch:

    @r disable optional_qualifier@
    identifier i;
    position p;
    @@
    static struct gpio_chip i@p = { ... };

    @ok@
    identifier r.i;
    expression e;
    position p;
    @@
    e = i@p;

    @bad@
    position p != {r.p,ok.p};
    identifier r.i;
    struct gpio_chip e;
    @@
    e@i@p

    @depends on !bad disable optional_qualifier@
    identifier r.i;
    @@
    static
    +const
    struct gpio_chip i = { ... };

    In the following log you can see a significant difference in the code size
    and data segment, hence in the dec segment. This log is the output
    of the size command, before and after the code change:

    before:
    text data bss dec hex filename
    11866 3520 128 15514 3c9a drivers/pinctrl/pinctrl-rza1.o

    after:
    text data bss dec hex filename
    11539 3464 128 15131 3b1b drivers/pinctrl/pinctrl-rza1.o

    Signed-off-by: Gustavo A. R. Silva
    Signed-off-by: Linus Walleij

    Gustavo A. R. Silva
     

30 Jun, 2017

2 commits

  • structures rza1_gpiochip_template and rza1_pinmux_ops do not need to be
    in global scope, so make them static.

    Cleans up sparse warnings:
    symbol 'rza1_gpiochip_template' was not declared. Should it be static?
    symbol 'rza1_pinmux_ops' was not declared. Should it be static?

    Signed-off-by: Colin Ian King
    Signed-off-by: Linus Walleij

    Colin Ian King
     
  • Depending on compiler version:

    drivers/pinctrl/pinctrl-rza1.c: In function ‘rza1_pinctrl_probe’:
    drivers/pinctrl/pinctrl-rza1.c:1260:5: warning: ‘ret’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    if (ret)
    ^

    Indeed, the result returned by platform_get_resource() was stored in
    "res", not "ret". In addition, the correct error check would be
    "if (!res)", as platform_get_resource() does not return an error code,
    but returns NULL on failure.

    However, as devm_ioremap_resource() verifies the validity of the passed
    resource pointer anyway, the check can just be removed.

    Reported-by: Stephen Rothwell
    Fixes: 5a49b644b3075f88 ("pinctrl: Renesas RZ/A1 pin and gpio controller")
    Signed-off-by: Geert Uytterhoeven
    Signed-off-by: Linus Walleij

    Geert Uytterhoeven
     

23 Jun, 2017

1 commit