1. 14 1月, 2015 5 次提交
    • J
      gpio: fix memory leak and sleep-while-atomic · 00acc3dc
      Johan Hovold 提交于
      Fix memory leak and sleep-while-atomic in gpiochip_remove.
      
      The memory leak was introduced by afa82fab ("gpio / ACPI: Move event
      handling registration to gpiolib irqchip helpers") that moved the
      release of acpi interrupt resources to gpiochip_irqchip_remove, but by
      then the resources are no longer accessible as the acpi_gpio_chip has
      already been freed by acpi_gpiochip_remove.
      
      Note that this also fixes a few potential sleep-while-atomics, which has
      been around since 14250520 ("gpio: add IRQ chip helpers in gpiolib")
      when the call to gpiochip_irqchip_remove while holding a spinlock was
      added (a couple of irq-domain paths can end up grabbing mutexes).
      
      Fixes: afa82fab ("gpio / ACPI: Move event handling registration to
      gpiolib irqchip helpers")
      Fixes: 14250520 ("gpio: add IRQ chip helpers in gpiolib")
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      00acc3dc
    • J
      gpio: clean up gpiochip_add error handling · 05aa5203
      Johan Hovold 提交于
      Clean up gpiochip_add error handling.
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      05aa5203
    • J
      gpio: fix gpio-chip list corruption · 225fce83
      Johan Hovold 提交于
      Fix potential corruption of gpio-chip list due to failure to remove the
      chip from the list before returning in gpiochip_add error path.
      
      The chip could be long gone when the global list is next traversed,
      something which could lead to a null-pointer dereference. In the best
      case (chip not deallocated) we are just leaking the gpio range.
      
      Fixes: 14e85c0e ("gpio: remove gpio_descs global array")
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      225fce83
    • J
      gpio: fix memory and reference leaks in gpiochip_add error path · 5539b3c9
      Johan Hovold 提交于
      Memory allocated and references taken by of_gpiochip_add and
      acpi_gpiochip_add were never released on errors in gpiochip_add (e.g.
      failure to find free gpio range).
      
      Fixes: 391c970c ("of/gpio: add default of_xlate function if device
      has a node pointer")
      Fixes: 664e3e5a ("gpio / ACPI: register to ACPI events
      automatically")
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      5539b3c9
    • A
      gpio: crystalcove: use handle_nested_irq · e733a2fb
      Aaron Lu 提交于
      The CrystalCove GPIO chip has can_sleep set so its demultiplexed irqs
      will have IRQ_NESTED_THREAD flag set, thus we should use the nested
      version handle_nested_irq in CrystalCove's irq handler instead of
      handle_generic_irq, or the following warning will be hit and the
      functionality is lost:
      
      [ 4089.639554] Hardware name: ASUSTeK COMPUTER INC. T100TA/T100TA, BIOS T100TA.313 08/13/2014
      [ 4089.639564]  00000002 00000000 c24fbdf4 c16e0257 c24fbe38 c24fbe28 c105390c c18ec480
      [ 4089.639596]  c24fbe54 00000048 c18f8e3b 00000295 c10a60fc 00000295 c10a60fc f4464540
      [ 4089.639626]  f446459c c278ad40 c24fbe40 c1053974 00000009 c24fbe38 c18ec480 c24fbe54
      [ 4089.639656] Call Trace:
      [ 4089.639685]  [<c16e0257>] dump_stack+0x41/0x52
      [ 4089.639707]  [<c105390c>] warn_slowpath_common+0x8c/0xc0
      [ 4089.639727]  [<c10a60fc>] ? irq_nested_primary_handler+0x2c/0x30
      [ 4089.639744]  [<c10a60fc>] ? irq_nested_primary_handler+0x2c/0x30
      [ 4089.639763]  [<c1053974>] warn_slowpath_fmt+0x34/0x40
      [ 4089.639781]  [<c10a60fc>] irq_nested_primary_handler+0x2c/0x30
      [ 4089.639800]  [<c10a5c56>] handle_irq_event_percpu+0x76/0x190
      [ 4089.639818]  [<c1461570>] ? regmap_format_10_14_write+0x30/0x30
      [ 4089.639836]  [<c1464f4c>] ? _regmap_bus_raw_write+0x4c/0x70
      [ 4089.639854]  [<c10a5da1>] handle_irq_event+0x31/0x50
      [ 4089.639872]  [<c10a83eb>] handle_simple_irq+0x4b/0x70
      [ 4089.639889]  [<c10a5384>] generic_handle_irq+0x24/0x40
      [ 4089.639908]  [<c1366d87>] crystalcove_gpio_irq_handler+0xa7/0xc0
      [ 4089.639927]  [<c10a85a7>] handle_nested_irq+0x77/0x190
      [ 4089.639947]  [<c1469801>] regmap_irq_thread+0x1b1/0x360
      [ 4089.639966]  [<c10a6ae8>] irq_thread_fn+0x18/0x30
      [ 4089.639983]  [<c10a6906>] irq_thread+0xf6/0x110
      [ 4089.640001]  [<c10a6ad0>] ? irq_finalize_oneshot.part.30+0x1b0/0x1b0
      [ 4089.640019]  [<c10a6b50>] ? irq_forced_thread_fn+0x50/0x50
      [ 4089.640037]  [<c10a6810>] ? irq_thread_check_affinity+0xc0/0xc0
      [ 4089.640054]  [<c106f389>] kthread+0xa9/0xc0
      [ 4089.640074]  [<c16e6401>] ret_from_kernel_thread+0x21/0x30
      [ 4089.640091]  [<c106f2e0>] ? kthread_create_on_node+0x110/0x110
      [ 4089.640105] ---[ end trace dca7946ad31eba7d ]---
      
      Buglink: https://bugzilla.kernel.org/show_bug.cgi?id=90521Reported-and-tested-by: NBrian Loften <bloften80@gmail.com>
      Cc: Stable <stable@vger.kernel.org>
      Signed-off-by: NAaron Lu <aaron.lu@intel.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      e733a2fb
  2. 12 12月, 2014 1 次提交
  3. 04 12月, 2014 2 次提交
  4. 03 12月, 2014 2 次提交
  5. 02 12月, 2014 1 次提交
  6. 28 11月, 2014 4 次提交
  7. 27 11月, 2014 8 次提交
  8. 26 11月, 2014 1 次提交
  9. 11 11月, 2014 1 次提交
  10. 06 11月, 2014 1 次提交
  11. 05 11月, 2014 4 次提交
    • R
      ACPI / GPIO: Driver GPIO mappings for ACPI GPIOs · f028d524
      Rafael J. Wysocki 提交于
      Provide a way for device drivers using GPIOs described by ACPI
      GpioIo resources in _CRS to tell the GPIO subsystem what names
      (connection IDs) to associate with specific GPIO pins defined
      in there.
      
      To do that, a driver needs to define a mapping table as a
      NULL-terminated array of struct acpi_gpio_mapping objects
      that each contain a name, a pointer to an array of line data
      (struct acpi_gpio_params) objects and the size of that array.
      
      Each struct acpi_gpio_params object consists of three fields,
      crs_entry_index, line_index, active_low, representing the index of
      the target GpioIo()/GpioInt() resource in _CRS starting from zero,
      the index of the target line in that resource starting from zero,
      and the active-low flag for that line, respectively.
      
      Next, the mapping table needs to be passed as the second
      argument to acpi_dev_add_driver_gpios() that will register it with
      the ACPI device object pointed to by its first argument.  That
      should be done in the driver's .probe() routine.
      
      On removal, the driver should unregister its GPIO mapping table
      by calling acpi_dev_remove_driver_gpios() on the ACPI device
      object where that table was previously registered.
      
      Included are fixes from Mika Westerberg.
      Acked-by: NAlexandre Courbot <acourbot@nvidia.com>
      Reviewed-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      f028d524
    • M
      gpio: Support for unified device properties interface · 40b73183
      Mika Westerberg 提交于
      Some drivers need to deal with only firmware representation of its
      GPIOs. An example would be a GPIO button array driver where each button
      is described as a separate firmware node in device tree. Typically these
      child nodes do not have physical representation in the Linux device
      model.
      
      In order to help device drivers to handle such firmware child nodes we
      add dev[m]_get_named_gpiod_from_child() that takes a child firmware
      node pointer as its second argument (the first one is the parent device
      itself), finds the GPIO using whatever is the underlying firmware
      method, and requests the GPIO properly.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Acked-by: NAlexandre Courbot <acourbot@nvidia.com>
      Acked-by: NGrant Likely <grant.likely@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      40b73183
    • M
      gpio: sch: Consolidate core and resume banks · c479ff09
      Mika Westerberg 提交于
      This is actually a single device with two sets of identical registers,
      which just happen to start from a different offset. Instead of having
      separate GPIO chips created we consolidate them to be single GPIO chip.
      
      In addition having a single GPIO chip allows us to handle ACPI GPIO
      translation in the core in a more generic way, since the two GPIO chips
      share the same parent ACPI device.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Acked-by: NLinus Walleij <linus.walleij@linaro.org>
      Acked-by: NGrant Likely <grant.likely@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      c479ff09
    • M
      gpio / ACPI: Add support for _DSD device properties · 0d9a693c
      Mika Westerberg 提交于
      With release of ACPI 5.1 and _DSD method we can finally name GPIOs (and
      other things as well) returned by _CRS. Previously we were only able to
      use integer index to find the corresponding GPIO, which is pretty error
      prone if the order changes.
      
      With _DSD we can now query GPIOs using name instead of an integer index,
      like the below example shows:
      
        // Bluetooth device with reset and shutdown GPIOs
        Device (BTH)
        {
            Name (_HID, ...)
      
            Name (_CRS, ResourceTemplate ()
            {
                GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionInputOnly,
                        "\\_SB.GPO0", 0, ResourceConsumer) {15}
                GpioIo (Exclusive, PullUp, 0, 0, IoRestrictionInputOnly,
                        "\\_SB.GPO0", 0, ResourceConsumer) {27, 31}
            })
      
            Name (_DSD, Package ()
            {
                ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                Package ()
      	  {
                    Package () {"reset-gpio", Package() {^BTH, 1, 1, 0 }},
                    Package () {"shutdown-gpio", Package() {^BTH, 0, 0, 0 }},
                }
            })
        }
      
      The format of the supported GPIO property is:
      
        Package () { "name", Package () { ref, index, pin, active_low }}
      
        ref - The device that has _CRS containing GpioIo()/GpioInt() resources,
              typically this is the device itself (BTH in our case).
        index - Index of the GpioIo()/GpioInt() resource in _CRS starting from zero.
        pin - Pin in the GpioIo()/GpioInt() resource. Typically this is zero.
        active_low - If 1 the GPIO is marked as active_low.
      
      Since ACPI GpioIo() resource does not have field saying whether it is
      active low or high, the "active_low" argument can be used here. Setting
      it to 1 marks the GPIO as active low.
      
      In our Bluetooth example the "reset-gpio" refers to the second GpioIo()
      resource, second pin in that resource with the GPIO number of 31.
      
      This patch implements necessary support to gpiolib for extracting GPIOs
      using _DSD device properties.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Acked-by: NLinus Walleij <linus.walleij@linaro.org>
      Acked-by: NGrant Likely <grant.likely@linaro.org>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      0d9a693c
  12. 04 11月, 2014 1 次提交
  13. 03 11月, 2014 1 次提交
  14. 31 10月, 2014 1 次提交
  15. 30 10月, 2014 1 次提交
  16. 29 10月, 2014 5 次提交
  17. 28 10月, 2014 1 次提交