1. 02 3月, 2013 1 次提交
  2. 28 2月, 2013 1 次提交
  3. 12 2月, 2013 3 次提交
  4. 09 2月, 2013 5 次提交
  5. 07 2月, 2013 1 次提交
  6. 05 2月, 2013 2 次提交
  7. 21 11月, 2012 5 次提交
  8. 12 11月, 2012 4 次提交
    • L
      gpiolib: separation of pin concerns · 1e63d7b9
      Linus Walleij 提交于
      The fact that of_gpiochip_add_pin_range() and
      gpiochip_add_pin_range() share too much code is fragile and
      will invariably mean that bugs need to be fixed in two places
      instead of one.
      
      So separate the concerns of gpiolib.c and gpiolib-of.c and
      have the latter call the former as back-end. This is necessary
      also when going forward with other device descriptions such
      as ACPI.
      
      This is done by:
      
      - Adding a return code to gpiochip_add_pin_range() so we can
        reliably check whether this succeeds.
      
      - Get rid of the custom of_pinctrl_add_gpio_range() from
        pinctrl. Instead create of_pinctrl_get() to just retrive the
        pin controller per se from an OF node. This composite
        function was just begging to be deleted, it was way to
        purpose-specific.
      
      - Use pinctrl_dev_get_name() to get the name of the retrieved
        pin controller and use that to call back into the generic
        gpiochip_add_pin_range().
      
      Now the pin range is only allocated and tied to a pin
      controller from the core implementation in gpiolib.c.
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      1e63d7b9
    • L
      gpiolib: call pin removal in chip removal function · 9ef0d6f7
      Linus Walleij 提交于
      This makes us call gpiochio_remove_pin_ranges() in the
      gpiochip_remove() function, so we get rid of ranges when
      freeing the chip.
      Reviewed-by: NStephen Warren <swarren@nvidia.com>
      Reviewed-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      9ef0d6f7
    • L
      gpiolib: fix up function prototypes etc · 165adc9c
      Linus Walleij 提交于
      Commit 69e1601bca88809dc118abd1becb02c15a02ec71
      "gpiolib: provide provision to register pin ranges"
      
      Got most of it's function prototypes wrong, so fix this up by:
      
      - Moving the void declarations into static inlines in
        <linux/gpio.h> (previously the actual prototypes were declared
        here...)
      
      - Declare the gpiochip_add_pin_range() and
        gpiochip_remove_pin_ranges() functions in <asm-generic/gpio.h>
        together with the pin range struct declaration itself.
      
      - Actually only implement these very functions in gpiolib.c
        if CONFIG_PINCTRL is set.
      
      - Additionally export the symbols since modules will need to
        be able to do this.
      Reviewed-by: NStephen Warren <swarren@nvidia.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      165adc9c
    • S
      gpiolib: provide provision to register pin ranges · f23f1516
      Shiraz Hashim 提交于
      pinctrl subsystem needs gpio chip base to prepare set of gpio
      pin ranges, which a given pinctrl driver can handle. This is
      important to handle pinctrl gpio request calls in order to
      program a given pin properly for gpio operation.
      
      As gpio base is allocated dynamically during gpiochip
      registration, presently there exists no clean way to pass this
      information to the pinctrl subsystem.
      
      After few discussions from [1], it was concluded that may be
      gpio controller reporting the pin range it supports, is a
      better way than pinctrl subsystem directly registering it.
      
      [1] http://comments.gmane.org/gmane.linux.ports.arm.kernel/184816
      
      Cc: Grant Likely <grant.likely@secretlab.ca>
      Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org>
      Signed-off-by: NShiraz Hashim <shiraz.hashim@st.com>
      [Edited documentation a bit]
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      f23f1516
  9. 26 10月, 2012 3 次提交
  10. 23 10月, 2012 1 次提交
    • R
      gpiolib: Refactor gpio_export · fc4e2514
      Ryan Mallon 提交于
      The gpio_export function uses nested if statements and the status
      variable to handle the failure cases. This makes the function logic
      difficult to follow. Refactor the code to abort immediately on failure
      using goto. This makes the code slightly longer, but significantly
      reduces the nesting and number of split lines and makes the code easier
      to read.
      Signed-off-by: NRyan Mallon <rmallon@gmail.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      fc4e2514
  11. 17 8月, 2012 1 次提交
  12. 18 7月, 2012 1 次提交
  13. 19 5月, 2012 3 次提交
  14. 06 4月, 2012 1 次提交
  15. 05 3月, 2012 3 次提交
  16. 03 3月, 2012 1 次提交
  17. 16 2月, 2012 1 次提交
    • M
      Fix circular locking dependency (3.3-rc2) · 864533ce
      Ming Lei 提交于
      Hi,
      
      On Wed, Feb 8, 2012 at 8:41 PM, Felipe Balbi <balbi@ti.com> wrote:
      > Hi guys,
      >
      > I have just triggered the folllowing:
      >
      > [   84.860321] ======================================================
      > [   84.860321] [ INFO: possible circular locking dependency detected ]
      > [   84.860321] 3.3.0-rc2-00026-ge4e8a39 #474 Not tainted
      > [   84.860321] -------------------------------------------------------
      > [   84.860321] bash/949 is trying to acquire lock:
      > [   84.860321]  (sysfs_lock){+.+.+.}, at: [<c0275358>] gpio_value_store+0x24/0xcc
      > [   84.860321]
      > [   84.860321] but task is already holding lock:
      > [   84.860321]  (s_active#22){++++.+}, at: [<c016996c>] sysfs_write_file+0xdc/0x184
      > [   84.911468]
      > [   84.911468] which lock already depends on the new lock.
      > [   84.911468]
      > [   84.920043]
      > [   84.920043] the existing dependency chain (in reverse order) is:
      > [   84.920043]
      > [   84.927886] -> #1 (s_active#22){++++.+}:
      > [   84.927886]        [<c008f640>] check_prevs_add+0xdc/0x150
      > [   84.927886]        [<c008fc18>] validate_chain.clone.24+0x564/0x694
      > [   84.927886]        [<c0090cdc>] __lock_acquire+0x49c/0x980
      > [   84.951660]        [<c0091838>] lock_acquire+0x98/0x100
      > [   84.951660]        [<c016a8e8>] sysfs_deactivate+0xb0/0x100
      > [   84.962982]        [<c016b1b4>] sysfs_addrm_finish+0x2c/0x6c
      > [   84.962982]        [<c016b8bc>] sysfs_remove_dir+0x84/0x98
      > [   84.962982]        [<c02590d8>] kobject_del+0x10/0x78
      > [   84.974670]        [<c02c29e8>] device_del+0x140/0x170
      > [   84.974670]        [<c02c2a24>] device_unregister+0xc/0x18
      > [   84.985382]        [<c0276894>] gpio_unexport+0xbc/0xdc
      > [   84.985382]        [<c02768c8>] gpio_free+0x14/0xfc
      > [   85.001708]        [<c0276a28>] unexport_store+0x78/0x8c
      > [   85.001708]        [<c02c5af8>] class_attr_store+0x18/0x24
      > [   85.007293]        [<c0169990>] sysfs_write_file+0x100/0x184
      > [   85.018981]        [<c0109d48>] vfs_write+0xb4/0x148
      > [   85.018981]        [<c0109fd0>] sys_write+0x40/0x70
      > [   85.018981]        [<c0013cc0>] ret_fast_syscall+0x0/0x3c
      > [   85.035003]
      > [   85.035003] -> #0 (sysfs_lock){+.+.+.}:
      > [   85.035003]        [<c008f54c>] check_prev_add+0x680/0x698
      > [   85.035003]        [<c008f640>] check_prevs_add+0xdc/0x150
      > [   85.052093]        [<c008fc18>] validate_chain.clone.24+0x564/0x694
      > [   85.052093]        [<c0090cdc>] __lock_acquire+0x49c/0x980
      > [   85.052093]        [<c0091838>] lock_acquire+0x98/0x100
      > [   85.069885]        [<c047e280>] mutex_lock_nested+0x3c/0x2f4
      > [   85.069885]        [<c0275358>] gpio_value_store+0x24/0xcc
      > [   85.069885]        [<c02c18dc>] dev_attr_store+0x18/0x24
      > [   85.087158]        [<c0169990>] sysfs_write_file+0x100/0x184
      > [   85.087158]        [<c0109d48>] vfs_write+0xb4/0x148
      > [   85.098297]        [<c0109fd0>] sys_write+0x40/0x70
      > [   85.098297]        [<c0013cc0>] ret_fast_syscall+0x0/0x3c
      > [   85.109069]
      > [   85.109069] other info that might help us debug this:
      > [   85.109069]
      > [   85.117462]  Possible unsafe locking scenario:
      > [   85.117462]
      > [   85.117462]        CPU0                    CPU1
      > [   85.128417]        ----                    ----
      > [   85.128417]   lock(s_active#22);
      > [   85.128417]                                lock(sysfs_lock);
      > [   85.128417]                                lock(s_active#22);
      > [   85.142486]   lock(sysfs_lock);
      > [   85.151794]
      > [   85.151794]  *** DEADLOCK ***
      > [   85.151794]
      > [   85.151794] 2 locks held by bash/949:
      > [   85.158020]  #0:  (&buffer->mutex){+.+.+.}, at: [<c01698b8>] sysfs_write_file+0x28/0x184
      > [   85.170349]  #1:  (s_active#22){++++.+}, at: [<c016996c>] sysfs_write_file+0xdc/0x184
      > [   85.170349]
      > [   85.178588] stack backtrace:
      > [   85.178588] [<c001b824>] (unwind_backtrace+0x0/0xf0) from [<c008de64>] (print_circular_bug+0x100/0x114)
      > [   85.193023] [<c008de64>] (print_circular_bug+0x100/0x114) from [<c008f54c>] (check_prev_add+0x680/0x698)
      > [   85.193023] [<c008f54c>] (check_prev_add+0x680/0x698) from [<c008f640>] (check_prevs_add+0xdc/0x150)
      > [   85.212524] [<c008f640>] (check_prevs_add+0xdc/0x150) from [<c008fc18>] (validate_chain.clone.24+0x564/0x694)
      > [   85.212524] [<c008fc18>] (validate_chain.clone.24+0x564/0x694) from [<c0090cdc>] (__lock_acquire+0x49c/0x980)
      > [   85.233306] [<c0090cdc>] (__lock_acquire+0x49c/0x980) from [<c0091838>] (lock_acquire+0x98/0x100)
      > [   85.233306] [<c0091838>] (lock_acquire+0x98/0x100) from [<c047e280>] (mutex_lock_nested+0x3c/0x2f4)
      > [   85.242614] [<c047e280>] (mutex_lock_nested+0x3c/0x2f4) from [<c0275358>] (gpio_value_store+0x24/0xcc)
      > [   85.261840] [<c0275358>] (gpio_value_store+0x24/0xcc) from [<c02c18dc>] (dev_attr_store+0x18/0x24)
      > [   85.261840] [<c02c18dc>] (dev_attr_store+0x18/0x24) from [<c0169990>] (sysfs_write_file+0x100/0x184)
      > [   85.271240] [<c0169990>] (sysfs_write_file+0x100/0x184) from [<c0109d48>] (vfs_write+0xb4/0x148)
      > [   85.290008] [<c0109d48>] (vfs_write+0xb4/0x148) from [<c0109fd0>] (sys_write+0x40/0x70)
      > [   85.298400] [<c0109fd0>] (sys_write+0x40/0x70) from [<c0013cc0>] (ret_fast_syscall+0x0/0x3c)
      > -bash: echo: write error: Operation not permitted
      >
      > the way to trigger is:
      >
      > root@legolas:~# cd /sys/class/gpio/
      > root@legolas:/sys/class/gpio# echo 2 > export
      > root@legolas:/sys/class/gpio# echo 2 > unexport
      > root@legolas:/sys/class/gpio# echo 2 > export
      > root@legolas:/sys/class/gpio# cd gpio2/
      > root@legolas:/sys/class/gpio/gpio2# echo 1 > value
      
      Looks 'sysfs_lock' needn't to be held for unregister, so the patch below may
      fix the problem.
      Acked-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NGrant Likely <grant.likely@secretlab.ca>
      864533ce
  18. 13 12月, 2011 2 次提交
  19. 28 5月, 2011 1 次提交