1. 27 3月, 2014 3 次提交
    • M
      gpio: mxs: Allow for recursive enable_irq_wake() call · a585f87c
      Marek Vasut 提交于
      The scenario here is that someone calls enable_irq_wake() from somewhere
      in the code. This will result in the lockdep producing a backtrace as can
      be seen below. In my case, this problem is triggered when using the wl1271
      (TI WlCore) driver found in drivers/net/wireless/ti/ .
      
      The problem cause is rather obvious from the backtrace, but let's outline
      the dependency. enable_irq_wake() grabs the IRQ buslock in irq_set_irq_wake(),
      which in turns calls mxs_gpio_set_wake_irq() . But mxs_gpio_set_wake_irq()
      calls enable_irq_wake() again on the one-level-higher IRQ , thus it tries to
      grab the IRQ buslock again in irq_set_irq_wake() . Because the spinlock in
      irq_set_irq_wake()->irq_get_desc_buslock()->__irq_get_desc_lock() is not
      marked as recursive, lockdep will spew the stuff below.
      
      We know we can safely re-enter the lock, so use IRQ_GC_INIT_NESTED_LOCK to
      fix the spew.
      
       =============================================
       [ INFO: possible recursive locking detected ]
       3.10.33-00012-gf06b763-dirty #61 Not tainted
       ---------------------------------------------
       kworker/0:1/18 is trying to acquire lock:
        (&irq_desc_lock_class){-.-...}, at: [<c00685f0>] __irq_get_desc_lock+0x48/0x88
      
       but task is already holding lock:
        (&irq_desc_lock_class){-.-...}, at: [<c00685f0>] __irq_get_desc_lock+0x48/0x88
      
       other info that might help us debug this:
        Possible unsafe locking scenario:
      
              CPU0
              ----
         lock(&irq_desc_lock_class);
         lock(&irq_desc_lock_class);
      
        *** DEADLOCK ***
      
        May be due to missing lock nesting notation
      
       3 locks held by kworker/0:1/18:
        #0:  (events){.+.+.+}, at: [<c0036308>] process_one_work+0x134/0x4a4
        #1:  ((&fw_work->work)){+.+.+.}, at: [<c0036308>] process_one_work+0x134/0x4a4
        #2:  (&irq_desc_lock_class){-.-...}, at: [<c00685f0>] __irq_get_desc_lock+0x48/0x88
      
       stack backtrace:
       CPU: 0 PID: 18 Comm: kworker/0:1 Not tainted 3.10.33-00012-gf06b763-dirty #61
       Workqueue: events request_firmware_work_func
       [<c0013eb4>] (unwind_backtrace+0x0/0xf0) from [<c0011c74>] (show_stack+0x10/0x14)
       [<c0011c74>] (show_stack+0x10/0x14) from [<c005bb08>] (__lock_acquire+0x140c/0x1a64)
       [<c005bb08>] (__lock_acquire+0x140c/0x1a64) from [<c005c6a8>] (lock_acquire+0x9c/0x104)
       [<c005c6a8>] (lock_acquire+0x9c/0x104) from [<c051d5a4>] (_raw_spin_lock_irqsave+0x44/0x58)
       [<c051d5a4>] (_raw_spin_lock_irqsave+0x44/0x58) from [<c00685f0>] (__irq_get_desc_lock+0x48/0x88)
       [<c00685f0>] (__irq_get_desc_lock+0x48/0x88) from [<c0068e78>] (irq_set_irq_wake+0x20/0xf4)
       [<c0068e78>] (irq_set_irq_wake+0x20/0xf4) from [<c027260c>] (mxs_gpio_set_wake_irq+0x1c/0x24)
       [<c027260c>] (mxs_gpio_set_wake_irq+0x1c/0x24) from [<c0068cf4>] (set_irq_wake_real+0x30/0x44)
       [<c0068cf4>] (set_irq_wake_real+0x30/0x44) from [<c0068ee4>] (irq_set_irq_wake+0x8c/0xf4)
       [<c0068ee4>] (irq_set_irq_wake+0x8c/0xf4) from [<c0310748>] (wlcore_nvs_cb+0x10c/0x97c)
       [<c0310748>] (wlcore_nvs_cb+0x10c/0x97c) from [<c02be5e8>] (request_firmware_work_func+0x38/0x58)
       [<c02be5e8>] (request_firmware_work_func+0x38/0x58) from [<c0036394>] (process_one_work+0x1c0/0x4a4)
       [<c0036394>] (process_one_work+0x1c0/0x4a4) from [<c0036a4c>] (worker_thread+0x138/0x394)
       [<c0036a4c>] (worker_thread+0x138/0x394) from [<c003cb74>] (kthread+0xa4/0xb0)
       [<c003cb74>] (kthread+0xa4/0xb0) from [<c000ee00>] (ret_from_fork+0x14/0x34)
       wlcore: loaded
      
      Cc: stable@vger.kernel.org
      Signed-off-by: NMarek Vasut <marex@denx.de>
      Acked-by: NShawn Guo <shawn.guo@linaro.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      a585f87c
    • A
      24016ab6
    • A
      gpio: twl4030: Remove redundant assignment · fd0f885b
      Alexander Shiyan 提交于
      Variable "status" is never used, so remove it and add warning if
      any error happen.
      Signed-off-by: NAlexander Shiyan <shc_work@mail.ru>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      fd0f885b
  2. 26 3月, 2014 6 次提交
  3. 25 3月, 2014 2 次提交
  4. 18 3月, 2014 4 次提交
  5. 15 3月, 2014 2 次提交
    • A
      gpio: gpio-dwapb size-cells should be two · 1d4a2166
      Alan Tull 提交于
      Fix size-cells to show use of OF_GPIO_ACTIVE_LOW flag.
      Signed-off-by: NAlan Tull <atull@altera.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      1d4a2166
    • M
      gpio / ACPI: Add support for ACPI GPIO operation regions · 473ed7be
      Mika Westerberg 提交于
      GPIO operation regions is a new feature introduced in ACPI 5.0
      specification. This feature adds a way for platform ASL code to call back
      to OS GPIO driver and toggle GPIO pins.
      
      An example ASL code from Lenovo Miix 2 tablet with only relevant part
      listed:
      
       Device (\_SB.GPO0)
       {
           Name (AVBL, Zero)
           Method (_REG, 2, NotSerialized)
           {
               If (LEqual (Arg0, 0x08))
               {
                   // Marks the region available
                   Store (Arg1, AVBL)
               }
           }
      
           OperationRegion (GPOP, GeneralPurposeIo, Zero, 0x0C)
           Field (GPOP, ByteAcc, NoLock, Preserve)
           {
               Connection (
                   GpioIo (Exclusive, PullDefault, 0, 0, IoRestrictionOutputOnly,
                           "\\_SB.GPO0", 0x00, ResourceConsumer,,)
                   {
                       0x003B
                   }
               ),
               SHD3,   1,
           }
       }
      
       Device (SHUB)
       {
           Method (_PS0, 0, Serialized)
           {
               If (LEqual (\_SB.GPO0.AVBL, One))
               {
                   Store (One, \_SB.GPO0.SHD3)
                   Sleep (0x32)
               }
           }
           Method (_PS3, 0, Serialized)
           {
               If (LEqual (\_SB.GPO0.AVBL, One))
               {
                   Store (Zero, \_SB.GPO0.SHD3)
               }
           }
       }
      
      How this works is that whenever _PS0 or _PS3 method is run (typically when
      SHUB device is transitioned to D0 or D3 respectively), ASL code checks if
      the GPIO operation region is available (\_SB.GPO0.AVBL). If it is we go and
      store either 0 or 1 to \_SB.GPO0.SHD3.
      
      Now, when ACPICA notices ACPI GPIO operation region access (the store
      above) it will call acpi_gpio_adr_space_handler() that then toggles the
      GPIO accordingly using standard gpiolib interfaces.
      
      Implement the support by registering GPIO operation region handlers for all
      GPIO devices that have an ACPI handle. First time the GPIO is used by the
      ASL code we make sure that the GPIO stays requested until the GPIO chip
      driver itself is unloaded. If we find out that the GPIO is already
      requested we just toggle it according to the value got from ASL code.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      473ed7be
  6. 14 3月, 2014 3 次提交
    • L
    • L
      Merge tag 'v3.14-rc6' into devel · 9e294427
      Linus Walleij 提交于
      Linux 3.14-rc6
      9e294427
    • A
      gpio: clamp returned values to the boolean range · 23600969
      Alexandre Courbot 提交于
      Nothing prevents GPIO drivers from returning values outside the
      boolean range, and as it turns out a few drivers are actually doing so.
      These values were passed as-is to unsuspecting consumers and created
      confusion.
      
      This patch makes the internal _gpiod_get_raw_value() function return a
      bool, effectively clamping the GPIO value to the boolean range no
      matter what the driver does.
      
      While we are at it, we also change the value parameter of
      _gpiod_set_raw_value() to bool type before drivers start doing funny
      things with it as well.
      
      Another way to fix this would be to change the prototypes of the driver
      interface to use bool directly, but this would require a huge
      cross-systems patch so this simpler solution is preferred.
      
      Changes since v1:
      - Change local variable type to bool as well, use boolean values in
        code
      - Also change prototype of open drain/open source setting functions
        since they are only called from _gpiod_set_raw_value()
      
      This probably calls for a larger booleanization of gpiolib, but let's
      keep that for a latter change - right now we need to address the issue
      of non-boolean values returned by drivers.
      Signed-off-by: NAlexandre Courbot <acourbot@nvidia.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      23600969
  7. 13 3月, 2014 4 次提交
    • M
      gpio / ACPI: Rework ACPI GPIO event handling · 6072b9dc
      Mika Westerberg 提交于
      The current ACPI GPIO event handling code was never tested against real
      hardware with functioning GPIO triggered events (at the time such hardware
      wasn't available). Thus it misses certain things like requesting the GPIOs
      properly, passing correct flags to the interrupt handler and so on.
      
      This patch reworks ACPI GPIO event handling so that we:
      
       1) Use struct acpi_gpio_event for all GPIO signaled events.
       2) Switch to use GPIO descriptor API and request GPIOs by calling
          gpiochip_request_own_desc() that we added in a previous patch.
       3) Pass proper flags from ACPI GPIO resource to request_threaded_irq().
      
      Also instead of open-coding the _AEI iteration loop we can use
      acpi_walk_resources(). This simplifies the code a bit and fixes memory leak
      that was caused by missing kfree() for buffer returned by
      acpi_get_event_resources().
      
      Since the remove path now calls gpiochip_free_own_desc() which takes GPIO
      spinlock we need to call acpi_gpiochip_remove() outside of that lock
      (analogous to acpi_gpiochip_add() path where the lock is released before
      those funtions are called).
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      6072b9dc
    • M
      gpio / ACPI: Rename acpi_gpio_evt_pin to acpi_gpio_event · 4b01a14b
      Mika Westerberg 提交于
      In order to consolidate _Exx, _Lxx and _EVT to use the same structure make
      the structure name to reflect that we are dealing with any event, not just
      _EVT.
      
      This is just rename, no functional changes.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      4b01a14b
    • M
      gpio / ACPI: Allocate ACPI specific data directly in acpi_gpiochip_add() · aa92b6f6
      Mika Westerberg 提交于
      We are going to add more ACPI specific data to accompany GPIO chip so
      instead of allocating it per each use-case we allocate it once when
      acpi_gpiochip_add() is called and release it when acpi_gpiochip_remove() is
      called.
      
      Doing this allows us to add more ACPI specific data by merely adding new
      fields to struct acpi_gpio_chip.
      
      In addition we embed evt_pins member directly to the structure instead of
      having it as a pointer. This simplifies the code a bit since we don't need
      to check against NULL.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      aa92b6f6
    • M
      gpiolib: Allow GPIO chips to request their own GPIOs · 77c2d792
      Mika Westerberg 提交于
      Sometimes it is useful to allow GPIO chips themselves to request GPIOs they
      own through gpiolib API. One use case is ACPI ASL code that should be able
      to toggle GPIOs through GPIO operation regions.
      
      We can't use gpio_request() because it will pin the module to the kernel
      forever (it calls try_module_get()). To solve this we move module refcount
      manipulation to gpiod_request() and let __gpiod_request() handle the actual
      request. This changes the sequence a bit as now try_module_get() is called
      outside of gpio_lock (I think this is safe, try_module_get() handles
      serialization it needs already).
      
      Then we provide gpiolib internal functions gpiochip_request/free_own_desc()
      that do the same as gpio_request() but don't manipulate module refrence
      count. This allows the GPIO chip driver to request and free descriptors it
      owns without being pinned to the kernel forever.
      Signed-off-by: NMika Westerberg <mika.westerberg@linux.intel.com>
      Reviewed-by: NAlexandre Courbot <acourbot@nvidia.com>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      77c2d792
  8. 12 3月, 2014 7 次提交
  9. 11 3月, 2014 2 次提交
  10. 10 3月, 2014 7 次提交
    • L
      Linux 3.14-rc6 · fa389e22
      Linus Torvalds 提交于
      fa389e22
    • L
      Merge tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc · 79e61542
      Linus Torvalds 提交于
      Pull ARM SoC fixes from from Olof Johansson:
       "A collection of fixes for ARM platforms.  A little large due to us
        missing to do one last week, but there's nothing in particular here
        that is in itself large and scary.
      
        Mostly a handful of smaller fixes all over the place.  The majority is
        made up of fixes for OMAP, but there are a few for others as well.  In
        particular, there was a decision to rename a binding for the Broadcom
        pinctrl block that we need to go in before the final release since we
        then treat it as ABI"
      
      * tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
        ARM: dts: omap3-gta04: Add ti,omap36xx to compatible property to avoid problems with booting
        ARM: tegra: add LED options back into tegra_defconfig
        ARM: dts: omap3-igep: fix boot fail due wrong compatible match
        ARM: OMAP3: Fix pinctrl interrupts for core2
        pinctrl: Rename Broadcom Capri pinctrl binding
        pinctrl: refer to updated dt binding string.
        Update dtsi with new pinctrl compatible string
        ARM: OMAP: Kill warning in CPUIDLE code with !CONFIG_SMP
        ARM: OMAP2+: Add support for thumb mode on DT booted N900
        ARM: OMAP2+: clock: fix clkoutx2 with CLK_SET_RATE_PARENT
        ARM: OMAP4: hwmod: Fix SOFTRESET logic for OMAP4
        ARM: DRA7: hwmod data: correct the sysc data for spinlock
        ARM: OMAP5: PRM: Fix reboot handling
        ARM: sunxi: dt: Change the touchscreen compatibles
        ARM: sun7i: dt: Fix interrupt trigger types
      79e61542
    • L
      Merge tag 'nfs-for-3.14-5' of git://git.linux-nfs.org/projects/trondmy/linux-nfs · fe9ea91c
      Linus Torvalds 提交于
      Pull NFS client bugfixes from Trond Myklebust:
       "Highlights include:
      
         - Fix another nfs4_sequence corruptor in RELEASE_LOCKOWNER
         - Fix an Oopsable delegation callback race
         - Fix another bad stateid infinite loop
         - Fail the data server I/O is the stateid represents a lost lock
         - Fix an Oopsable sunrpc trace event"
      
      * tag 'nfs-for-3.14-5' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
        SUNRPC: Fix oops when trace sunrpc_task events in nfs client
        NFSv4: Fail the truncate() if the lock/open stateid is invalid
        NFSv4.1 Fail data server I/O if stateid represents a lost lock
        NFSv4: Fix the return value of nfs4_select_rw_stateid
        NFSv4: nfs4_stateid_is_current should return 'true' for an invalid stateid
        NFS: Fix a delegation callback race
        NFSv4: Fix another nfs4_sequence corruptor
      fe9ea91c
    • L
      Merge tag 'usb-3.14-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · cf8bf7cd
      Linus Torvalds 提交于
      Pull USB fixes from Greg KH:
       "Here are 4 USB fixes for your current tree.
      
        Two of them are reverts to hopefully resolve the nasty XHCI
        regressions we have been having on some types of devices.  The other
        two are quirks for some Logitech video devices"
      
      * tag 'usb-3.14-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        Revert "USBNET: ax88179_178a: enable tso if usb host supports sg dma"
        Revert "xhci 1.0: Limit arbitrarily-aligned scatter gather."
        usb: Make DELAY_INIT quirk wait 100ms between Get Configuration requests
        usb: Add device quirk for Logitech HD Pro Webcams C920 and C930e
      cf8bf7cd
    • L
      Merge tag 'staging-3.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · a491ce72
      Linus Torvalds 提交于
      Pull staging driver tree fix from Greg KH:
       "Here is a single staging driver fix for your tree.
      
        It resolves an issue with arbritary writes to memory if a specific
        driver is loaded"
      
      * tag 'staging-3.15-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
        staging/cxt1e1/linux.c: Correct arbitrary memory write in c4_ioctl()
      a491ce72
    • D
      KEYS: Make the keyring cycle detector ignore other keyrings of the same name · 979e0d74
      David Howells 提交于
      This fixes CVE-2014-0102.
      
      The following command sequence produces an oops:
      
      	keyctl new_session
      	i=`keyctl newring _ses @s`
      	keyctl link @s $i
      
      The problem is that search_nested_keyrings() sees two keyrings that have
      matching type and description, so keyring_compare_object() returns true.
      s_n_k() then passes the key to the iterator function -
      keyring_detect_cycle_iterator() - which *should* check to see whether this is
      the keyring of interest, not just one with the same name.
      
      Because assoc_array_find() will return one and only one match, I assumed that
      the iterator function would only see an exact match or never be called - but
      the iterator isn't only called from assoc_array_find()...
      
      The oops looks something like this:
      
      	kernel BUG at /data/fs/linux-2.6-fscache/security/keys/keyring.c:1003!
      	invalid opcode: 0000 [#1] SMP
      	...
      	RIP: keyring_detect_cycle_iterator+0xe/0x1f
      	...
      	Call Trace:
      	  search_nested_keyrings+0x76/0x2aa
      	  __key_link_check_live_key+0x50/0x5f
      	  key_link+0x4e/0x85
      	  keyctl_keyring_link+0x60/0x81
      	  SyS_keyctl+0x65/0xe4
      	  tracesys+0xdd/0xe2
      
      The fix is to make keyring_detect_cycle_iterator() check that the key it
      has is the key it was actually looking for rather than calling BUG_ON().
      
      A testcase has been included in the keyutils testsuite for this:
      
      	http://git.kernel.org/cgit/linux/kernel/git/dhowells/keyutils.git/commit/?id=891f3365d07f1996778ade0e3428f01878a1790bReported-by: NTommi Rantala <tt.rantala@gmail.com>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Acked-by: NJames Morris <james.l.morris@oracle.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      979e0d74
    • L
      Merge branch 'for-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux · 1dc3217d
      Linus Torvalds 提交于
      Pull thermal fixes from Zhang Rui:
       "Specifics:
      
         - Update the help text of INT3403 Thermal driver, which was not
           friendly to users.  From Zhang Rui.
      
         - The "type" sysfs attribute of x86_pkg_temp_thermal registered
           thermal zones includes an instance number, which makes the
           thermal-to-hwmon bridge fails to group them all in a single hwmon
           device.  Fixed by Jean Delvare.
      
         - The hwmon device registered by x86_pkg_temp_thermal driver is
           redundant because the temperature value reported by
           x86_pkg_temp_thermal is already reported by the coretemp driver.
           Fixed by Jean Delvare.
      
         - Fix a problem that the cooling device can not be updated properly
           if it is initialized at max cooling state.  From Ni Wade.
      
         - Fix a problem that OF registered thermal zones are running without
           thermal governors.  From Zhang Rui.
      
         - Commit beeb5a1e ("thermal: rcar-thermal: Enable driver
           compilation with COMPILE_TEST") broke build on archs wihout io
           memory.  Thus make it depend on HAS_IOMEM to bypass build failures.
           Fixed by Richard Weinberger"
      
      * 'for-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux:
        Thermal: thermal zone governor fix
        Thermal: Allow first update of cooling device state
        thermal,rcar_thermal: Add dependency on HAS_IOMEM
        x86_pkg_temp_thermal: Fix the thermal zone type
        x86_pkg_temp_thermal: Do not expose as a hwmon device
        Thermal: update INT3404 thermal driver help text
      1dc3217d