1. 14 Sep, 2018 1 commit
    • Linus Walleij's avatar
      pinctrl: Include <linux/gpio/driver.h> nothing else · 1c5fb66a
      Linus Walleij authored
      These drivers are GPIO drivers, and the do not need to use the
      legacy header in <linux/gpio.h>, go directly for
      <linux/gpio/driver.h> instead.
      
      Replace any use of GPIOF_* with 0/1, these flags are for
      consumers, not drivers.
      
      Get rid of a few gpio_to_irq() users that was littering
      around the place, use local callbacks or avoid using it at
      all.
      Signed-off-by: 's avatarLinus Walleij <linus.walleij@linaro.org>
      1c5fb66a
  2. 29 Aug, 2018 1 commit
    • Rob Herring's avatar
      pinctrl: Convert to using %pOFn instead of device_node.name · 94f4e54c
      Rob Herring authored
      In preparation to remove the node name pointer from struct device_node,
      convert printf users to use the %pOFn format specifier.
      
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Dong Aisheng <aisheng.dong@nxp.com>
      Cc: Fabio Estevam <festevam@gmail.com>
      Cc: Shawn Guo <shawnguo@kernel.org>
      Cc: Stefan Agner <stefan@agner.ch>
      Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
      Cc: Sean Wang <sean.wang@mediatek.com>
      Cc: Matthias Brugger <matthias.bgg@gmail.com>
      Cc: Carlo Caione <carlo@caione.org>
      Cc: Kevin Hilman <khilman@baylibre.com>
      Cc: Jason Cooper <jason@lakedaemon.net>
      Cc: Andrew Lunn <andrew@lunn.ch>
      Cc: Gregory Clement <gregory.clement@bootlin.com>
      Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
      Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
      Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
      Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
      Cc: Heiko Stuebner <heiko@sntech.de>
      Cc: Tony Lindgren <tony@atomide.com>
      Cc: Haojian Zhuang <haojian.zhuang@linaro.org>
      Cc: Patrice Chotard <patrice.chotard@st.com>
      Cc: Barry Song <baohua@kernel.org>
      Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
      Cc: Alexandre Torgue <alexandre.torgue@st.com>
      Cc: Maxime Ripard <maxime.ripard@bootlin.com>
      Cc: Chen-Yu Tsai <wens@csie.org>
      Cc: linux-gpio@vger.kernel.org
      Cc: linux-mediatek@lists.infradead.org
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-amlogic@lists.infradead.org
      Cc: linux-rockchip@lists.infradead.org
      Cc: linux-omap@vger.kernel.org
      Acked-by: 's avatarDong Aisheng <aisheng.dong@nxp.com>
      Reviewed-by: 's avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
      Acked-by: 's avatarTony Lindgren <tony@atomide.com>
      Acked-by: 's avatarSean Wang <sean.wang@mediatek.com>
      Acked-by: 's avatarChen-Yu Tsai <wens@csie.org>
      Acked-by: 's avatarHeiko Stuebner <heiko@sntech.de>
      Signed-off-by: Rob Herring's avatarRob Herring <robh@kernel.org>
      Signed-off-by: 's avatarLinus Walleij <linus.walleij@linaro.org>
      94f4e54c
  3. 12 Jun, 2018 1 commit
    • Kees Cook's avatar
      treewide: devm_kzalloc() -> devm_kcalloc() · a86854d0
      Kees Cook authored
      The devm_kzalloc() function has a 2-factor argument form, devm_kcalloc().
      This patch replaces cases of:
      
              devm_kzalloc(handle, a * b, gfp)
      
      with:
              devm_kcalloc(handle, a * b, gfp)
      
      as well as handling cases of:
      
              devm_kzalloc(handle, a * b * c, gfp)
      
      with:
      
              devm_kzalloc(handle, array3_size(a, b, c), gfp)
      
      as it's slightly less ugly than:
      
              devm_kcalloc(handle, array_size(a, b), c, gfp)
      
      This does, however, attempt to ignore constant size factors like:
      
              devm_kzalloc(handle, 4 * 1024, gfp)
      
      though any constants defined via macros get caught up in the conversion.
      
      Any factors with a sizeof() of "unsigned char", "char", and "u8" were
      dropped, since they're redundant.
      
      Some manual whitespace fixes were needed in this patch, as Coccinelle
      really liked to write "=devm_kcalloc..." instead of "= devm_kcalloc...".
      
      The Coccinelle script used for this was:
      
      // Fix redundant parens around sizeof().
      @@
      expression HANDLE;
      type TYPE;
      expression THING, E;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	(sizeof(TYPE)) * E
      +	sizeof(TYPE) * E
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(sizeof(THING)) * E
      +	sizeof(THING) * E
        , ...)
      )
      
      // Drop single-byte sizes and redundant parens.
      @@
      expression HANDLE;
      expression COUNT;
      typedef u8;
      typedef __u8;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	sizeof(u8) * (COUNT)
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(__u8) * (COUNT)
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(char) * (COUNT)
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(unsigned char) * (COUNT)
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(u8) * COUNT
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(__u8) * COUNT
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(char) * COUNT
      +	COUNT
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(unsigned char) * COUNT
      +	COUNT
        , ...)
      )
      
      // 2-factor product with sizeof(type/expression) and identifier or constant.
      @@
      expression HANDLE;
      type TYPE;
      expression THING;
      identifier COUNT_ID;
      constant COUNT_CONST;
      @@
      
      (
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * (COUNT_ID)
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * COUNT_ID
      +	COUNT_ID, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * COUNT_CONST
      +	COUNT_CONST, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * (COUNT_ID)
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * COUNT_ID
      +	COUNT_ID, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * (COUNT_CONST)
      +	COUNT_CONST, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * COUNT_CONST
      +	COUNT_CONST, sizeof(THING)
        , ...)
      )
      
      // 2-factor product, only identifiers.
      @@
      expression HANDLE;
      identifier SIZE, COUNT;
      @@
      
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	SIZE * COUNT
      +	COUNT, SIZE
        , ...)
      
      // 3-factor product with 1 sizeof(type) or sizeof(expression), with
      // redundant parens removed.
      @@
      expression HANDLE;
      expression THING;
      identifier STRIDE, COUNT;
      type TYPE;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(TYPE))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING) * (COUNT) * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING) * (COUNT) * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING) * COUNT * (STRIDE)
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING) * COUNT * STRIDE
      +	array3_size(COUNT, STRIDE, sizeof(THING))
        , ...)
      )
      
      // 3-factor product with 2 sizeof(variable), with redundant parens removed.
      @@
      expression HANDLE;
      expression THING1, THING2;
      identifier COUNT;
      type TYPE1, TYPE2;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE1) * sizeof(TYPE2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(THING1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(THING1), sizeof(THING2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE1) * sizeof(THING2) * COUNT
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	sizeof(TYPE1) * sizeof(THING2) * (COUNT)
      +	array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
        , ...)
      )
      
      // 3-factor product, only identifiers, with redundant parens removed.
      @@
      expression HANDLE;
      identifier STRIDE, SIZE, COUNT;
      @@
      
      (
        devm_kzalloc(HANDLE,
      -	(COUNT) * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	COUNT * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	COUNT * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(COUNT) * (STRIDE) * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	COUNT * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(COUNT) * STRIDE * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(COUNT) * (STRIDE) * (SIZE)
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	COUNT * STRIDE * SIZE
      +	array3_size(COUNT, STRIDE, SIZE)
        , ...)
      )
      
      // Any remaining multi-factor products, first at least 3-factor products,
      // when they're not all constants...
      @@
      expression HANDLE;
      expression E1, E2, E3;
      constant C1, C2, C3;
      @@
      
      (
        devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
      |
        devm_kzalloc(HANDLE,
      -	(E1) * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(E1) * (E2) * E3
      +	array3_size(E1, E2, E3)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	(E1) * (E2) * (E3)
      +	array3_size(E1, E2, E3)
        , ...)
      |
        devm_kzalloc(HANDLE,
      -	E1 * E2 * E3
      +	array3_size(E1, E2, E3)
        , ...)
      )
      
      // And then all remaining 2 factors products when they're not all constants,
      // keeping sizeof() as the second factor argument.
      @@
      expression HANDLE;
      expression THING, E1, E2;
      type TYPE;
      constant C1, C2, C3;
      @@
      
      (
        devm_kzalloc(HANDLE, sizeof(THING) * C2, ...)
      |
        devm_kzalloc(HANDLE, sizeof(TYPE) * C2, ...)
      |
        devm_kzalloc(HANDLE, C1 * C2 * C3, ...)
      |
        devm_kzalloc(HANDLE, C1 * C2, ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * (E2)
      +	E2, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(TYPE) * E2
      +	E2, sizeof(TYPE)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * (E2)
      +	E2, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	sizeof(THING) * E2
      +	E2, sizeof(THING)
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	(E1) * E2
      +	E1, E2
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	(E1) * (E2)
      +	E1, E2
        , ...)
      |
      - devm_kzalloc
      + devm_kcalloc
        (HANDLE,
      -	E1 * E2
      +	E1, E2
        , ...)
      )
      Signed-off-by: 's avatarKees Cook <keescook@chromium.org>
      a86854d0
  4. 23 May, 2018 2 commits
  5. 03 Jan, 2018 3 commits
  6. 20 Dec, 2017 1 commit
  7. 31 Oct, 2017 1 commit
  8. 07 Oct, 2017 2 commits
  9. 31 Aug, 2017 1 commit
  10. 14 Aug, 2017 3 commits
  11. 29 Jun, 2017 1 commit
    • Brian Norris's avatar
      Revert "pinctrl: rockchip: avoid hardirq-unsafe functions in irq_chip" · 1d80df93
      Brian Norris authored
      This reverts commit 88bb9421.
      
      It introduced a new CONFIG_DEBUG_ATOMIC_SLEEP warning in v4.12-rc1:
      
      [ 7226.716713] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:238
      [ 7226.716716] in_atomic(): 0, irqs_disabled(): 0, pid: 1708, name: bash
      [ 7226.716722] CPU: 1 PID: 1708 Comm: bash Not tainted 4.12.0-rc6+ #1213
      [ 7226.716724] Hardware name: Google Kevin (DT)
      [ 7226.716726] Call trace:
      [ 7226.716738] [<ffffff8008089928>] dump_backtrace+0x0/0x24c
      [ 7226.716743] [<ffffff8008089b94>] show_stack+0x20/0x28
      [ 7226.716749] [<ffffff8008371370>] dump_stack+0x90/0xb0
      [ 7226.716755] [<ffffff80080cd2a0>] ___might_sleep+0x10c/0x124
      [ 7226.716760] [<ffffff80080cd330>] __might_sleep+0x78/0x88
      [ 7226.716765] [<ffffff800879e210>] mutex_lock+0x2c/0x64
      [ 7226.716771] [<ffffff80083ad678>] rockchip_irq_bus_lock+0x30/0x3c
      [ 7226.716777] [<ffffff80080f6d40>] __irq_get_desc_lock+0x78/0x98
      [ 7226.716782] [<ffffff80080f7e6c>] irq_set_irq_wake+0x44/0x12c
      [ 7226.716787] [<ffffff8008486e18>] dev_pm_arm_wake_irq+0x4c/0x58
      [ 7226.716792] [<ffffff800848b80c>] device_wakeup_arm_wake_irqs+0x3c/0x58
      [ 7226.716796] [<ffffff80084896fc>] dpm_suspend_noirq+0xf8/0x3a0
      [ 7226.716800] [<ffffff80080f1384>] suspend_devices_and_enter+0x1a4/0x9a8
      [ 7226.716803] [<ffffff80080f21ec>] pm_suspend+0x664/0x6a4
      [ 7226.716807] [<ffffff80080f04d8>] state_store+0xd4/0xf8
      ...
      
      It was reported on -rc1, and it's still not fixed in -rc6, so it should
      just be reverted.
      
      Cc: John Keeping <john@metanate.com>
      Signed-off-by: 's avatarBrian Norris <briannorris@chromium.org>
      Reviewed-by: 's avatarHeiko Stuebner <heiko@sntech.de>
      Signed-off-by: 's avatarLinus Walleij <linus.walleij@linaro.org>
      1d80df93
  12. 29 May, 2017 4 commits
  13. 22 May, 2017 1 commit
  14. 28 Mar, 2017 4 commits
  15. 23 Mar, 2017 2 commits
  16. 14 Mar, 2017 5 commits
  17. 26 Jan, 2017 1 commit
  18. 16 Nov, 2016 1 commit
  19. 27 Aug, 2016 1 commit
    • Paul Gortmaker's avatar
      pinctrl: rockchip: make it explicitly non-modular · 2f436204
      Paul Gortmaker authored
      The Kconfig currently controlling compilation of this code is:
      
      drivers/pinctrl/Kconfig:config PINCTRL_ROCKCHIP
      drivers/pinctrl/Kconfig:        bool
      
      ...meaning that it currently is not being built as a module by anyone.
      
      Lets remove the couple traces of modular infrastructure use, so that
      when reading the driver there is no doubt it is builtin-only.
      
      Note that MODULE_DEVICE_TABLE is a no-op for non-modular code.
      
      We also delete the MODULE_LICENSE tag etc. since all that information
      is already contained at the top of the file in the comments.
      
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Heiko Stuebner <heiko@sntech.de>
      Cc: linux-gpio@vger.kernel.org
      Cc: linux-rockchip@lists.infradead.org
      Signed-off-by: 's avatarPaul Gortmaker <paul.gortmaker@windriver.com>
      Signed-off-by: 's avatarLinus Walleij <linus.walleij@linaro.org>
      2f436204
  20. 23 Jun, 2016 1 commit
  21. 15 Jun, 2016 1 commit
  22. 11 May, 2016 1 commit
    • David Wu's avatar
      pinctrl: rockchip: fix pull setting error for rk3399 · 3ba6767a
      David Wu authored
      This patch fixes the pinctrl pull bias setting, since the pull up/down
      setting is the contrary for gpio0(just the gpio0a and gpio0b) and
      gpio2(just the gpio2c and gpio2d).
      
      From the TRM said, the gpio0a pull polarity setting:
      gpio0a_p
      GPIO0A PE/PS programmation section, every
      GPIO bit corresponding to 2bits[PS:PE]
      2'b00: Z(Normal operation);
      2'b11: weak 1(pull-up);
      2'b01: weak 0(pull-down);
      2'b10: Z(Normal operation);
      
      Then, the other gpios setting as the following:
      gpio1a_p (e.g.: gpio1, gpio2a, gpio2b, gpio3...)
      GPIO1A PU/PD programmation section, every
      GPIO bit corresponding to 2bits
      2'b00: Z(Normal operation);
      2'b01: weak 1(pull-up);
      2'b10: weak 0(pull-down);
      2'b11: Z(Normal operation);
      
      For example,(rk3399evb board)
      sdmmc_cd --->gpio0_a7
      localhost / # io -r -4 0xff320040
      ff320040: 00004d5f
      In general,the value should be 0x0000cd5f since the pin has been set
      in the dts.
      Signed-off-by: 's avatarDavid Wu <david.wu@rock-chips.com>
      Signed-off-by: 's avatarCaesar Wang <wxt@rock-chips.com>
      Cc: linux-gpio@vger.kernel.org
      Reviewed-by: 's avatarDouglas Anderson <dianders@chromium.org>
      Reviewed-by: 's avatarHeiko Stuebner <heiko@sntech.de>
      Signed-off-by: 's avatarLinus Walleij <linus.walleij@linaro.org>
      3ba6767a
  23. 21 Apr, 2016 1 commit