1. 04 Dec, 2014 8 commits
    • Axel Lin's avatar
      iio: adc: men_z188_adc: Add terminating entry for men_z188_ids · 22945fa8
      Axel Lin authored
      commit fbbba1f8 upstream.
      
      The mcb_device_id table is supposed to be zero-terminated.
      Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      22945fa8
    • Cristina Ciocan's avatar
      iio: Fix IIO_EVENT_CODE_EXTRACT_DIR bit mask · 29ddd783
      Cristina Ciocan authored
      commit ccf54555 upstream.
      
      The direction field is set on 7 bits, thus we need to AND it with 0111 111 mask
      in order to retrieve it, that is 0x7F, not 0xCF as it is now.
      
      Fixes: ade7ef7b (staging:iio: Differential channel handling)
      Signed-off-by: default avatarCristina Ciocan <cristina.ciocan@intel.com>
      Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      29ddd783
    • Preston Fick's avatar
      2a9ba606
    • Thor Thayer's avatar
      spi: dw: Fix dynamic speed change. · de36a27a
      Thor Thayer authored
      commit 0a8727e6 upstream.
      
      An IOCTL call that calls spi_setup() and then dw_spi_setup() will
      overwrite the persisted last transfer speed. On each transfer, the
      SPI speed is compared to the last transfer speed to determine if the
      clock divider registers need to be updated (did the speed change?).
      This bug was observed with the spidev driver using spi-config to
      update the max transfer speed.
      
      This fix: Don't overwrite the persisted last transaction clock speed
      when updating the SPI parameters in dw_spi_setup(). On the next
      transaction, the new speed won't match the persisted last speed
      and the hardware registers will be updated.
      On initialization, the persisted last transaction clock
      speed will be 0 but will be updated after the first SPI
      transaction.
      
      Move zeroed clock divider check into clock change test because
      chip->clk_div is zero on startup and would cause a divide-by-zero
      error. The calculation was wrong as well (can't support odd #).
      Reported-by: default avatarVlastimil Setka <setka@vsis.cz>
      Signed-off-by: default avatarVlastimil Setka <setka@vsis.cz>
      Signed-off-by: default avatarThor Thayer <tthayer@opensource.altera.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      de36a27a
    • Thomas Petazzoni's avatar
      ARM: mvebu: add missing of_node_put() call in coherency.c · ab3403b1
      Thomas Petazzoni authored
      commit 2eb04ae0 upstream.
      
      There is a missing of_node_put() to decrement the device_node
      reference counter after a of_find_matching_node() in coherency_init().
      
      Fixes: 501f928e ("ARM: mvebu: add a coherency_available() call")
      Signed-off-by: default avatarThomas Petazzoni <thomas.petazzoni@free-electrons.com>
      Acked-by: default avatarGregory CLEMENT <gregory.clement@free-electrons.com>
      Link: https://lkml.kernel.org/r/1414423955-5933-4-git-send-email-thomas.petazzoni@free-electrons.comSigned-off-by: default avatarJason Cooper <jason@lakedaemon.net>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      ab3403b1
    • Gu Zheng's avatar
      aio: fix uncorrent dirty pages accouting when truncating AIO ring buffer · c60aa7e8
      Gu Zheng authored
      commit 835f252c upstream.
      
      https://bugzilla.kernel.org/show_bug.cgi?id=86831
      
      Markus reported that when shutting down mysqld (with AIO support,
      on a ext3 formatted Harddrive) leads to a negative number of dirty pages
      (underrun to the counter). The negative number results in a drastic reduction
      of the write performance because the page cache is not used, because the kernel
      thinks it is still 2 ^ 32 dirty pages open.
      
      Add a warn trace in __dec_zone_state will catch this easily:
      
      static inline void __dec_zone_state(struct zone *zone, enum
      	zone_stat_item item)
      {
           atomic_long_dec(&zone->vm_stat[item]);
      +    WARN_ON_ONCE(item == NR_FILE_DIRTY &&
      	atomic_long_read(&zone->vm_stat[item]) < 0);
           atomic_long_dec(&vm_stat[item]);
      }
      
      [   21.341632] ------------[ cut here ]------------
      [   21.346294] WARNING: CPU: 0 PID: 309 at include/linux/vmstat.h:242
      cancel_dirty_page+0x164/0x224()
      [   21.355296] Modules linked in: wutbox_cp sata_mv
      [   21.359968] CPU: 0 PID: 309 Comm: kworker/0:1 Not tainted 3.14.21-WuT #80
      [   21.366793] Workqueue: events free_ioctx
      [   21.370760] [<c0016a64>] (unwind_backtrace) from [<c0012f88>]
      (show_stack+0x20/0x24)
      [   21.378562] [<c0012f88>] (show_stack) from [<c03f8ccc>]
      (dump_stack+0x24/0x28)
      [   21.385840] [<c03f8ccc>] (dump_stack) from [<c0023ae4>]
      (warn_slowpath_common+0x84/0x9c)
      [   21.393976] [<c0023ae4>] (warn_slowpath_common) from [<c0023bb8>]
      (warn_slowpath_null+0x2c/0x34)
      [   21.402800] [<c0023bb8>] (warn_slowpath_null) from [<c00c0688>]
      (cancel_dirty_page+0x164/0x224)
      [   21.411524] [<c00c0688>] (cancel_dirty_page) from [<c00c080c>]
      (truncate_inode_page+0x8c/0x158)
      [   21.420272] [<c00c080c>] (truncate_inode_page) from [<c00c0a94>]
      (truncate_inode_pages_range+0x11c/0x53c)
      [   21.429890] [<c00c0a94>] (truncate_inode_pages_range) from
      [<c00c0f6c>] (truncate_pagecache+0x88/0xac)
      [   21.439252] [<c00c0f6c>] (truncate_pagecache) from [<c00c0fec>]
      (truncate_setsize+0x5c/0x74)
      [   21.447731] [<c00c0fec>] (truncate_setsize) from [<c013b3a8>]
      (put_aio_ring_file.isra.14+0x34/0x90)
      [   21.456826] [<c013b3a8>] (put_aio_ring_file.isra.14) from
      [<c013b424>] (aio_free_ring+0x20/0xcc)
      [   21.465660] [<c013b424>] (aio_free_ring) from [<c013b4f4>]
      (free_ioctx+0x24/0x44)
      [   21.473190] [<c013b4f4>] (free_ioctx) from [<c003d8d8>]
      (process_one_work+0x134/0x47c)
      [   21.481132] [<c003d8d8>] (process_one_work) from [<c003e988>]
      (worker_thread+0x130/0x414)
      [   21.489350] [<c003e988>] (worker_thread) from [<c00448ac>]
      (kthread+0xd4/0xec)
      [   21.496621] [<c00448ac>] (kthread) from [<c000ec18>]
      (ret_from_fork+0x14/0x20)
      [   21.503884] ---[ end trace 79c4bf42c038c9a1 ]---
      
      The cause is that we set the aio ring file pages as *DIRTY* via SetPageDirty
      (bypasses the VFS dirty pages increment) when init, and aio fs uses
      *default_backing_dev_info* as the backing dev, which does not disable
      the dirty pages accounting capability.
      So truncating aio ring file will contribute to accounting dirty pages (VFS
      dirty pages decrement), then error occurs.
      
      The original goal is keeping these pages in memory (can not be reclaimed
      or swapped) in life-time via marking it dirty. But thinking more, we have
      already pinned pages via elevating the page's refcount, which can already
      achieve the goal, so the SetPageDirty seems unnecessary.
      
      In order to fix the issue, using the __set_page_dirty_no_writeback instead
      of the nop .set_page_dirty, and dropped the SetPageDirty (don't manually
      set the dirty flags, don't disable set_page_dirty(), rely on default behaviour).
      
      With the above change, the dirty pages accounting can work well. But as we
      known, aio fs is an anonymous one, which should never cause any real write-back,
      we can ignore the dirty pages (write back) accounting by disabling the dirty
      pages (write back) accounting capability. So we introduce an aio private
      backing dev info (disabled the ACCT_DIRTY/WRITEBACK/ACCT_WB capabilities) to
      replace the default one.
      Reported-by: default avatarMarkus Königshaus <m.koenigshaus@wut.de>
      Signed-off-by: default avatarGu Zheng <guz.fnst@cn.fujitsu.com>
      Acked-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarBenjamin LaHaise <bcrl@kvack.org>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      c60aa7e8
    • Steven Capper's avatar
      ARM: 8109/1: mm: Modify pte_write and pmd_write logic for LPAE · 83daf276
      Steven Capper authored
      commit ded94779 upstream.
      
      For LPAE, we have the following means for encoding writable or dirty
      ptes:
                                    L_PTE_DIRTY       L_PTE_RDONLY
          !pte_dirty && !pte_write        0               1
          !pte_dirty && pte_write         0               1
          pte_dirty && !pte_write         1               1
          pte_dirty && pte_write          1               0
      
      So we can't distinguish between writeable clean ptes and read only
      ptes. This can cause problems with ptes being incorrectly flagged as
      read only when they are writeable but not dirty.
      
      This patch renumbers L_PTE_RDONLY from AP[2] to a software bit #58,
      and adds additional logic to set AP[2] whenever the pte is read only
      or not dirty. That way we can distinguish between clean writeable ptes
      and read only ptes.
      
      HugeTLB pages will use this new logic automatically.
      
      We need to add some logic to Transparent HugePages to ensure that they
      correctly interpret the revised pgprot permissions (L_PTE_RDONLY has
      moved and no longer matches PMD_SECT_AP2). In the process of revising
      THP, the names of the PMD software bits have been prefixed with L_ to
      make them easier to distinguish from their hardware bit counterparts.
      Signed-off-by: default avatarSteve Capper <steve.capper@linaro.org>
      Reviewed-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      Cc: Hou Pengyang <houpengyang@huawei.com>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      83daf276
    • Steven Capper's avatar
      ARM: 8108/1: mm: Introduce {pte,pmd}_isset and {pte,pmd}_isclear · bffaa640
      Steven Capper authored
      commit f2950706 upstream.
      
      Long descriptors on ARM are 64 bits, and some pte functions such as
      pte_dirty return a bitwise-and of a flag with the pte value. If the
      flag to be tested resides in the upper 32 bits of the pte, then we run
      into the danger of the result being dropped if downcast.
      
      For example:
      	gather_stats(page, md, pte_dirty(*pte), 1);
      where pte_dirty(*pte) is downcast to an int.
      
      This patch introduces a new macro pte_isset which performs the bitwise
      and, then performs a double logical invert (where needed) to ensure
      predictable downcasting. The logical inverse pte_isclear is also
      introduced.
      
      Equivalent pmd functions for Transparent HugePages have also been
      added.
      Signed-off-by: default avatarSteve Capper <steve.capper@linaro.org>
      Reviewed-by: default avatarWill Deacon <will.deacon@arm.com>
      Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
      Cc: Hou Pengyang <houpengyang@huawei.com>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      bffaa640
  2. 02 Dec, 2014 1 commit
  3. 01 Dec, 2014 31 commits
    • Richard Leitner's avatar
      Input: serio - avoid negative serio device numbers · 9ff7521d
      Richard Leitner authored
      commit 0224ec9e upstream.
      
      Fix the format string for serio device name generation to avoid negative
      device numbers when the id exceeds the maximum signed integer value.
      Signed-off-by: default avatarRichard Leitner <richard.leitner@skidata.com>
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      9ff7521d
    • Tommi Rantala's avatar
      Input: xpad - add USB ID for Thrustmaster Ferrari 458 Racing Wheel · 7fc749b2
      Tommi Rantala authored
      commit 4b546258 upstream.
      
      Add the USB ID for the Xbox 360 Thrustmaster Ferrari 458 Racing Wheel.
      Signed-off-by: default avatarTommi Rantala <tt.rantala@gmail.com>
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      7fc749b2
    • Benjamin Valentin's avatar
      Input: xpad - sync device IDs with xboxdrv · b7f84aad
      Benjamin Valentin authored
      commit f554f619 upstream.
      
      The userspace xboxdrv driver knows some more device ids than the kernel.
      This patch adds the missing xbox gamepads from [1] to xpad.c
      
      [1] https://github.com/Grumbel/xboxdrv/blob/master/src/xpad_device.cppSigned-off-by: default avatarBenjamin Valentin <benpicco@zedat.fu-berlin.de>
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      b7f84aad
    • Frank Razenberg's avatar
      Input: xpad - add VID/PID for Razer Sabertooth · d73acdbb
      Frank Razenberg authored
      commit a7b44738 upstream.
      
      The xpad driver recognizes Razer Sabertooth controllers as generic xbox
      controller, while it is really a 360 controller.  This patch adds pid/vid
      mappings for the controller so that it is correctly recognized.
      Signed-off-by: default avatarFrank Razenberg <frank@zzattack.org>
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      d73acdbb
    • Vincent Zwanenburg's avatar
      Add a new PID/VID 0227/0930 for AR3012. · e8856c4a
      Vincent Zwanenburg authored
      commit 89d2975f upstream.
      
      usb devices info:
      
      T:  Bus=01 Lev=02 Prnt=05 Port=00 Cnt=01 Dev#= 20 Spd=12   MxCh= 0
      D:  Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=0930 ProdID=0227 Rev= 0.02
      C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
      A:  FirstIf#= 0 IfCount= 2 Cls=e0(wlcon) Sub=01 Prot=01
      I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
      I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
      I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
      I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
      I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
      I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
      Signed-off-by: default avatarVincent Zwanenburg <vincentz@topmail.ie>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      e8856c4a
    • Anantha Krishnan's avatar
      Bluetooth: Add support for Acer [13D3:3432] · cb284ef2
      Anantha Krishnan authored
      commit fa2f1394 upstream.
      
      Add support for the QCA6174 chip.
      
          T:  Bus=04 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#= 30 Spd=12  MxCh= 0
          D:  Ver= 1.10 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
          P:  Vendor=13d3 ProdID=3432 Rev=00.02
          C:  #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
          I:  If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
          I:  If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      Signed-off-by: default avatarAnantha Krishnan <ananthk@codeaurora.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      cb284ef2
    • Anatol Pomozov's avatar
      Bluetooth: Fix crash in the Marvell driver initialization codepath · a7b25652
      Anatol Pomozov authored
      commit 8500d791 upstream.
      
      btmrvl_add_card() function calls kthread_run that might return error
      (e.g. if current thread is killed). If one tries to use the error
      value as a pointer then invalid memory access oops happens.
      
      Check kthread_run() return value, if it is an error then release resources
      correctly.
      
      TEST=boot computer with BT modules enabled. I see the error message that
      BT device initialization failed. Now kernel does not crash. Hint: to enable
      BT run 'rmmod btmrvl_sdio; modprobe btmrvl_sdio'
      Signed-off-by: default avatarAnatol Pomozov <anatol.pomozov@gmail.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      a7b25652
    • Marcel Holtmann's avatar
      Bluetooth: Add support for Broadcom device of Asus Z97-DELUXE motherboard · a25f0c0e
      Marcel Holtmann authored
      commit c2aef6e8 upstream.
      
      The Asus Z97-DELUXE motherboard contains a Broadcom based Bluetooth
      controller on the USB bus. However vendor and product ID are listed
      as ASUSTek Computer.
      
      T:  Bus=01 Lev=01 Prnt=01 Port=01 Cnt=02 Dev#=  3 Spd=12   MxCh= 0
      D:  Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=0b05 ProdID=17cf Rev= 1.12
      S:  Manufacturer=Broadcom Corp
      S:  Product=BCM20702A0
      S:  SerialNumber=54271E910064
      C:* #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=  0mA
      I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
      E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
      I:  If#= 1 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
      I:  If#= 1 Alt= 2 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
      I:  If#= 1 Alt= 3 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
      I:  If#= 1 Alt= 4 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
      I:  If#= 1 Alt= 5 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
      I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      E:  Ad=84(I) Atr=02(Bulk) MxPS=  32 Ivl=0ms
      E:  Ad=04(O) Atr=02(Bulk) MxPS=  32 Ivl=0ms
      I:* If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)
      Reported-by: default avatarJerome Leclanche <jerome@leclan.ch>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      a25f0c0e
    • Marcel Holtmann's avatar
      Bluetooth: Fix endian and alignment issue with ath3k version handling · 0c557568
      Marcel Holtmann authored
      commit 72dd2b2a upstream.
      
      The ath3k driver is treating the version information badly when it
      comes to loading the right firmware version and comparing that it
      actually matches with the hardware.
      
      Initially this showed up as this:
      
        CHECK   drivers/bluetooth/ath3k.c
      drivers/bluetooth/ath3k.c:373:17: warning: cast to restricted __le32
      drivers/bluetooth/ath3k.c:435:17: warning: cast to restricted __le32
      
      However when fixing this by actually using __packed and __le32 for
      the ath3_version structure, more issues came up:
      
        CHECK   drivers/bluetooth/ath3k.c
      drivers/bluetooth/ath3k.c:381:32: warning: incorrect type in assignment (different base types)
      drivers/bluetooth/ath3k.c:381:32:    expected restricted __le32 [usertype] rom_version
      drivers/bluetooth/ath3k.c:381:32:    got int [signed] <noident>
      drivers/bluetooth/ath3k.c:382:34: warning: incorrect type in assignment (different base types)
      drivers/bluetooth/ath3k.c:382:34:    expected restricted __le32 [usertype] build_version
      drivers/bluetooth/ath3k.c:382:34:    got int [signed] <noident>
      drivers/bluetooth/ath3k.c:386:28: warning: restricted __le32 degrades to integer
      drivers/bluetooth/ath3k.c:386:56: warning: restricted __le32 degrades to integer
      
      This patch fixes every instance of the firmware version handling and
      makes sure it is endian safe and uses proper unaligned access.
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      0c557568
    • Marcel Holtmann's avatar
      Bluetooth: Ignore isochronous endpoints for Intel USB bootloader · cfe9113b
      Marcel Holtmann authored
      commit d92f2df0 upstream.
      
      The isochronous endpoints are not valid when the Intel Bluetooth
      controller boots up in bootloader mode. So just mark these endpoints
      as broken and then they will not be configured.
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      cfe9113b
    • Marcel Holtmann's avatar
      Bluetooth: Handle Intel USB bootloader with buggy interrupt · 9d9d071c
      Marcel Holtmann authored
      commit 3a5ef20c upstream.
      
      The interrupt interface for the Intel USB bootloader devices is only
      enabled after receiving SetInterface(0, AltSetting=0). When this USB
      command is not send, then no HCI events will be received.
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      9d9d071c
    • Marcel Holtmann's avatar
      Bluetooth: Add support for Intel bootloader devices · b8405fb6
      Marcel Holtmann authored
      commit 40df783d upstream.
      
      Intel Bluetooth devices that boot up in bootloader mode can not
      be used as generic HCI devices, but their HCI transport is still
      valuable and so bring that up as raw-only devices.
      
      T:  Bus=02 Lev=02 Prnt=03 Port=00 Cnt=01 Dev#= 14 Spd=12   MxCh= 0
      D:  Ver= 1.10 Cls=ff(vend.) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
      P:  Vendor=8087 ProdID=0a5a Rev= 0.00
      S:  Manufacturer=Intel(R) Corporation
      S:  Product=Intel(R) Wilkins Peak 2x2
      S:  SerialNumber=001122334455 WP_A0
      C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
      I:* If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
      E:  Ad=81(I) Atr=03(Int.) MxPS=  64 Ivl=1ms
      E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
      E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
      I:* If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
      E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
      E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
      I:  If#= 1 Alt= 1 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
      E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
      E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
      I:  If#= 1 Alt= 2 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
      I:  If#= 1 Alt= 3 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
      I:  If#= 1 Alt= 4 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
      I:  If#= 1 Alt= 5 #EPs= 2 Cls=ff(vend.) Sub=00 Prot=00 Driver=(none)
      E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
      E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      b8405fb6
    • Reyad Attiyat's avatar
      HID: usbhid: Use flag HID_DISCONNECTED when a usb device is removed · 0948a8e2
      Reyad Attiyat authored
      commit 46df9ded upstream.
      
      Set disconnected flag in struct usbhid when a usb device is removed. Check for
      disconnected flag before sending urb requests. This prevents a kernel panic
      when a hid driver calls hid_hw_request() after removing a usb device.
      
       BUG: unable to handle kernel NULL pointer dereference at 0000000000000058
       IP: [<ffffffff8161746f>] hid_submit_ctrl+0x7f/0x290
       PGD 0
       Oops: 0002 [#1] PREEMPT SMP
       CPU: 2 PID: 39 Comm: khubd Tainted: G          IO  3.16.0-rc5+ #112
       Hardware name: Microsoft Corporation Surface Pro 2/Surface Pro 2, BIOS 2.03.0250 09/06/2013
       task: ffff880118aba6e0 ti: ffff8800daf80000 task.ti: ffff8800daf80000
       RIP: 0010:[<ffffffff8161746f>]  [<ffffffff8161746f>] hid_submit_ctrl+0x7f/0x290
       RSP: 0018:ffff8800daf83750  EFLAGS: 00010086
       RAX: 0000000080000300 RBX: ffff88003f60c000 RCX: 0000000000000000
       RDX: 0000000000000000 RSI: 0000000000000001 RDI: ffff880117f78000
       RBP: ffff8800daf83788 R08: 0000000000000001 R09: 0000000000000001
       R10: 0000000000000001 R11: 0000000000000000 R12: ffff880117f78000
       R13: ffff88003f11a290 R14: 000000000000000c R15: ffff880091cb3ab8
       FS:  0000000000000000(0000) GS:ffff88011b000000(0000) knlGS:0000000000000000
       CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
       CR2: 0000000000000058 CR3: 0000000001c11000 CR4: 00000000001407e0
       Stack:
        ffff880117f3dcd0 ffff880117f78000 ffff88003f60c000 ffff880117f78000
        ffff880117f78000 ffff88003f11a290 0000000000000000 ffff8800daf837b0
        ffffffff81617707 ffff880117f78000 ffff88003f60c000 0000000000000013
       Call Trace:
        [<ffffffff81617707>] usbhid_restart_ctrl_queue+0x87/0x140
        [<ffffffff81617a88>] usbhid_submit_report+0x2c8/0x370
        [<ffffffff81617b4a>] usbhid_request+0x1a/0x30
        [<ffffffffa020edfb>] sensor_hub_set_feature+0x8b/0xd0 [hid_sensor_hub]
        [<ffffffffa02d9084>] hid_sensor_power_state+0x84/0x110 [hid_sensor_trigger]
        [<ffffffffa02d9129>] hid_sensor_data_rdy_trigger_set_state+0x19/0x20 [hid_sensor_trigger]
        [<ffffffffa034d5b7>] iio_triggered_buffer_predisable+0xa7/0xb0 [industrialio]
        [<ffffffffa034cc4a>] iio_disable_all_buffers+0x3a/0xc0 [industrialio]
        [<ffffffffa03487d3>] iio_device_unregister+0x53/0x80 [industrialio]
        [<ffffffffa026c06a>] hid_accel_3d_remove+0x2a/0x50 [hid_sensor_accel_3d]
        [<ffffffff814f433d>] platform_drv_remove+0x1d/0x40
        [<ffffffff814f18bf>] __device_release_driver+0x7f/0xf0
        [<ffffffff814f1955>] device_release_driver+0x25/0x40
        [<ffffffff814f121c>] bus_remove_device+0x11c/0x1a0
        [<ffffffff814ed7d6>] device_del+0x136/0x1e0
        [<ffffffff81512190>] ? mfd_cell_disable+0x80/0x80
        [<ffffffff814f41d1>] platform_device_del+0x21/0xc0
        [<ffffffff814f4282>] platform_device_unregister+0x12/0x30
        [<ffffffff815121d3>] mfd_remove_devices_fn+0x43/0x50
        [<ffffffff814ed3e3>] device_for_each_child+0x43/0x70
        [<ffffffff81512105>] mfd_remove_devices+0x25/0x30
        [<ffffffffa020ebd7>] sensor_hub_remove+0x87/0x140 [hid_sensor_hub]
        [<ffffffff81607c5b>] hid_device_remove+0x6b/0xd0
        [<ffffffff814f18bf>] __device_release_driver+0x7f/0xf0
        [<ffffffff814f1955>] device_release_driver+0x25/0x40
        [<ffffffff814f121c>] bus_remove_device+0x11c/0x1a0
        [<ffffffff814ed7d6>] device_del+0x136/0x1e0
        [<ffffffff81607d47>] hid_destroy_device+0x27/0x60
        [<ffffffff81616972>] usbhid_disconnect+0x22/0x50
        [<ffffffff81568597>] usb_unbind_interface+0x77/0x2b0
        [<ffffffff814f18bf>] __device_release_driver+0x7f/0xf0
        [<ffffffff814f1955>] device_release_driver+0x25/0x40
        [<ffffffff814f121c>] bus_remove_device+0x11c/0x1a0
        [<ffffffff814ed7d6>] device_del+0x136/0x1e0
        [<ffffffff81565cd1>] usb_disable_device+0x91/0x2a0
        [<ffffffff8155b046>] usb_disconnect+0x96/0x2e0
        [<ffffffff8155d74a>] hub_thread+0xb5a/0x1840
      Signed-off-by: default avatarReyad Attiyat <reyad.attiyat@gmail.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      0948a8e2
    • Andreas Schwab's avatar
      arm64/crypto: fix makefile rule for aes-glue-%.o · d9d8d655
      Andreas Schwab authored
      commit 7c2105fb upstream.
      
      This fixes the following build failure when building with CONFIG_MODVERSIONS
      enabled:
      
        CC [M]  arch/arm64/crypto/aes-glue-ce.o
      ld: cannot find arch/arm64/crypto/aes-glue-ce.o: No such file or directory
      make[1]: *** [arch/arm64/crypto/aes-ce-blk.o] Error 1
      make: *** [arch/arm64/crypto] Error 2
      
      The $(obj)/aes-glue-%.o rule only creates $(obj)/.tmp_aes-glue-ce.o, it
      should use if_changed_rule instead of if_changed_dep.
      Signed-off-by: default avatarAndreas Schwab <schwab@suse.de>
      [ardb: mention CONFIG_MODVERSIONS in commit log]
      Signed-off-by: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
      Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      d9d8d655
    • Devin Ryles's avatar
      ALSA: hda_intel: Add DeviceIDs for Sunrise Point-LP · 7cea0c62
      Devin Ryles authored
      commit b4565913 upstream.
      
      This patch adds DeviceIDs for Sunrise Point-LP
      Signed-off-by: default avatarDevin Ryles <devin.ryles@intel.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      7cea0c62
    • James Ralston's avatar
      ALSA: hda_intel: Add Device IDs for Intel Sunrise Point PCH · 3fbe06bc
      James Ralston authored
      commit c8b00fd2 upstream.
      
      This patch adds the HD Audio Device IDs for the Intel Sunrise Point PCH.
      
      [the item position rearranged by tiwai]
      Signed-off-by: default avatarJames Ralston <james.d.ralston@intel.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      3fbe06bc
    • Robert Jarzmik's avatar
      ARM: pxa: fix hang on startup with DEBUG_LL · c6f4b45b
      Robert Jarzmik authored
      commit cde7fc87 upstream.
      
      The commit 2111667b ("ARM: pxa: call debug_ll_io_init for
      earlyprintk") triggers in the current kernel the attached backtrace on
      PXA/tosa early in the boot time when DEBUG_LL is enabled.
      
      It is due to overlap between uart virtual memory defined in
      DEBUG_UART_VIRT and mapped by debug_ll_io_init() and peripheral bus
      mapped by pxa_map_io at the same address, 0xf2100000.
      
      As hinted by Arnd, map early virtual memory for low level debug on
      address 0xf6200000, even if that means 2 virtual mappings will give
      access to the pxa internal UARTs (FFUART, BTUART, STUART, ...).
      
      ------------[ cut here ]------------
      kernel BUG at /home/lumag/linux/mm/vmalloc.c:1143!
      Internal error: Oops - BUG: 0 [#1] PREEMPT ARM
      Modules linked in:
      CPU: 0 PID: 0 Comm: swapper Not tainted 3.17.0-00032-g8e0d202-dirty #23
      task: c062a5a8 ti: c0620000 task.ti: c0620000
      PC is at vm_area_add_early+0x54/0x84
      LR is at add_static_vm_early+0xc/0x60
      pc : [<c03e1100>]    lr : [<c03d9ef4>]    psr: 800001d3
      sp : c0621f04  ip : c03efa74  fp : c03edf84
      r10: c0637e98  r9 : 40000001  r8 : c03da57c
      r7 : c3ffcfb0  r6 : 00000000  r5 : c3ffcfb0  r4 : 02000000
      r3 : c3ffcfd8  r2 : f2100000  r1 : f4000000  r0 : c3ffcfb0
      Flags: Nzcv  IRQs off  FIQs off  Mode SVC_32  ISA ARM  Segment kernel
      Control: 00007977  Table: a0004000  DAC: 00000017
      Process swapper (pid: 0, stack limit = 0xc06201c8)
      Stack: (0xc0621f04 to 0xc0622000)
      1f00:          c3ffcfd8 40000001 c3ffcfd8 c03ee08c c03da570 c03db90c c0637d24
      1f20: 00000000 c03ec7cc c066e654 a0700000 000a0700 c03db914 c03db90c c03daf84
      1f40: 00000000 000a0000 c0000000 c03ec7cc 000a0700 c0700000 ffff1000 000a3fff
      1f60: 00001000 00000007 00000000 c03ec7cc c0008000 c03ed748 c0621fd4 c03d5d18
      1f80: 69052d00 a03ec48c 00000000 c03d8ad0 0000006c 00007977 c036c6e8 00000001
      1fa0: c0621fd4 c03ed744 c0628000 a0004000 69052d00 a03ec48c 00000000 c03d68d4
      1fc0: 00000000 00000000 00000000 00000000 00000000 c03ed748 c0649894 c062801c
      1fe0: c03ed744 c062b2f0 a0004000 69052d00 a03ec48c a0008040 00000000 00000000
      [<c03e1100>] (vm_area_add_early) from [<c03d9ef4>] (add_static_vm_early+0xc/0x60)
      [<c03d9ef4>] (add_static_vm_early) from [<c03da570>] (iotable_init.part.6+0xa8/0xb4)
      [<c03da570>] (iotable_init.part.6) from [<c03db914>] (pxa25x_map_io+0x8/0x24)
      [<c03db914>] (pxa25x_map_io) from [<c03daf84>] (paging_init+0x744/0x8d8)
      [<c03daf84>] (paging_init) from [<c03d8ad0>] (setup_arch+0x354/0x608)
      [<c03d8ad0>] (setup_arch) from [<c03d68d4>] (start_kernel+0xa8/0x3dc)
      [<c03d68d4>] (start_kernel) from [<a0008040>] (0xa0008040)
      Code: e5904008 e0811004 e1520001 2a000005 (e7f001f2)
      ---[ end trace f24b6c88ae00fa9a ]---
      Kernel panic - not syncing: Attempted to kill the idle task!
      ---[ end Kernel panic - not syncing: Attempted to kill the idle task!
      Reported-by: default avatarDmitry Eremin-Solenikov <dbaryshkov@gmail.com>
      Signed-off-by: default avatarRobert Jarzmik <robert.jarzmik@free.fr>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      [ luis: backported to 3.16: adjusted context ]
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      c6f4b45b
    • Mikhail Efremov's avatar
      vfs: Don't exchange "short" filenames unconditionally. · f1052d21
      Mikhail Efremov authored
      commit d2fa4a84 upstream.
      
      Only exchange source and destination filenames
      if flags contain RENAME_EXCHANGE.
      In case if executable file was running and replaced by
      other file /proc/PID/exe should still show correct file name,
      not the old name of the file by which it was replaced.
      
      The scenario when this bug manifests itself was like this:
      * ALT Linux uses rpm and start-stop-daemon;
      * during a package upgrade rpm creates a temporary file
        for an executable to rename it upon successful unpacking;
      * start-stop-daemon is run subsequently and it obtains
        the (nonexistant) temporary filename via /proc/PID/exe
        thus failing to identify the running process.
      
      Note that "long" filenames (> DNAiME_INLINE_LEN) are still
      exchanged without RENAME_EXCHANGE and this behaviour exists
      long enough (should be fixed too apparently).
      So this patch is just an interim workaround that restores
      behavior for "short" names as it was before changes
      introduced by commit da1ce067 ("vfs: add cross-rename").
      
      See https://lkml.org/lkml/2014/9/7/6 for details.
      
      AV: the comments about being more careful with ->d_name.hash
      than with ->d_name.name are from back in 2.3.40s; they
      became obsolete by 2.3.60s, when we started to unhash the
      target instead of swapping hash chain positions followed
      by d_delete() as we used to do when dcache was first
      introduced.
      Acked-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Alexander Viro <viro@zeniv.linux.org.uk>
      Cc: linux-fsdevel@vger.kernel.org
      Fixes: da1ce067 "vfs: add cross-rename"
      Signed-off-by: default avatarMikhail Efremov <sem@altlinux.org>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
      [ luis: used Stefan's backport to 3.16 ]
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      f1052d21
    • Linus Torvalds's avatar
      fold swapping ->d_name.hash into switch_names() · dd83435a
      Linus Torvalds authored
      commit a28ddb87 upstream.
      
      and do it along with ->d_name.len there
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
      [ luis: used Stefan's backport to 3.16 ]
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      dd83435a
    • Andy Lutomirski's avatar
      x86_64, traps: Stop using IST for #SS · 09f581ba
      Andy Lutomirski authored
      commit 6f442be2 upstream.
      
      On a 32-bit kernel, this has no effect, since there are no IST stacks.
      
      On a 64-bit kernel, #SS can only happen in user code, on a failed iret
      to user space, a canonical violation on access via RSP or RBP, or a
      genuine stack segment violation in 32-bit kernel code.  The first two
      cases don't need IST, and the latter two cases are unlikely fatal bugs,
      and promoting them to double faults would be fine.
      
      This fixes a bug in which the espfix64 code mishandles a stack segment
      violation.
      
      This saves 4k of memory per CPU and a tiny bit of code.
      Signed-off-by: default avatarAndy Lutomirski <luto@amacapital.net>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      09f581ba
    • Alex Deucher's avatar
      drm/radeon: fix endian swapping in vbios fetch for tdp table · a085254f
      Alex Deucher authored
      commit 28731d58 upstream.
      
      Value needs to be swapped on BE.
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      a085254f
    • Chris Moore's avatar
      IB/isert: Adjust CQ size to HW limits · 7059b426
      Chris Moore authored
      commit b1a5ad00 upstream.
      
      isert has an issue of trying to create a CQ with more CQEs than are
      supported by the hardware, that currently results in failures during
      isert_device creation during first session login.
      
      This is the isert version of the patch that Minh Tran submitted for
      iser, and is simple a workaround required to function with existing
      ocrdma hardware.
      Signed-off-by: default avatarChris Moore <chris.moore@emulex.com>
      Reviewied-by: default avatarSagi Grimberg <sagig@mellanox.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      7059b426
    • Rafael J. Wysocki's avatar
      ACPI / PM: Ignore wakeup setting if the ACPI companion can't wake up · ab1e2dc0
      Rafael J. Wysocki authored
      commit 78579b7c upstream.
      
      As reported by Dmitry, on some Chromebooks there are devices with
      corresponding ACPI objects and with unusual system wakeup
      configuration.  Namely, they technically are wakeup-capable, but the
      wakeup is handled via a platform-specific out-of-band mechanism and
      the ACPI PM layer has no information on the wakeup capability.  As
      a result, device_may_wakeup(dev) called from acpi_dev_suspend_late()
      returns 'true' for those devices, but the wakeup.flags.valid flag is
      unset for the corresponding ACPI device objects, so acpi_device_wakeup()
      reproducibly fails for them causing acpi_dev_suspend_late() to return
      an error code.  The entire system suspend is then aborted and the
      machines in question cannot suspend at all.
      
      Address the problem by ignoring the device_may_wakeup(dev) return
      value in acpi_dev_suspend_late() if the ACPI companion of the device
      being handled has wakeup.flags.valid unset (in which case it is clear
      that the wakeup is supposed to be handled by other means).
      
      This fixes a regression introduced by commit a76e9bd8 (i2c:
      attach/detach I2C client device to the ACPI power domain) as the
      affected systems could suspend and resume successfully before that
      commit.
      
      Fixes: a76e9bd8 (i2c: attach/detach I2C client device to the ACPI power domain)
      Reported-by: default avatarDmitry Torokhov <dtor@chromium.org>
      Reviewed-by: default avatarDmitry Torokhov <dtor@chromium.org>
      Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      [ luis: backported to 3.16: adjusted context ]
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      ab1e2dc0
    • Yinghai Lu's avatar
      PCI: Support 64-bit bridge windows if we have 64-bit dma_addr_t · 1a233586
      Yinghai Lu authored
      commit 7fc986d8 upstream.
      
      Aaron reported that a 32-bit x86 kernel with Physical Address Extension
      (PAE) support complains about bridge prefetchable memory windows above 4GB:
      
        pci_bus 0000:00: root bus resource [mem 0x380000000000-0x383fffffffff]
        ...
        pci 0000:03:00.0: reg 0x10: [mem 0x383fffc00000-0x383fffdfffff 64bit pref]
        pci 0000:03:00.0: reg 0x20: [mem 0x383fffe04000-0x383fffe07fff 64bit pref]
        pci 0000:03:00.1: reg 0x10: [mem 0x383fffa00000-0x383fffbfffff 64bit pref]
        pci 0000:03:00.1: reg 0x20: [mem 0x383fffe00000-0x383fffe03fff 64bit pref]
        pci 0000:00:02.2: PCI bridge to [bus 03-04]
        pci 0000:00:02.2:   bridge window [io  0x1000-0x1fff]
        pci 0000:00:02.2:   bridge window [mem 0x91900000-0x91cfffff]
        pci 0000:00:02.2: can't handle 64-bit address space for bridge
      
      In this kernel, unsigned long is 32 bits and dma_addr_t is 64 bits.
      Previously we used "unsigned long" to hold the bridge window address.  But
      this is a bus address, so we should use dma_addr_t instead.
      
      Use dma_addr_t to hold the bridge window base and limit.
      
      The question of whether the CPU can actually *address* the window is
      separate and depends on what the physical address space of the CPU is and
      whether the host bridge does any address translation.
      
      [bhelgaas: fix "shift count > width of type", changelog, stable tag]
      Fixes: d56dbf5b ("PCI: Allocate 64-bit BARs above 4G when possible")
      Link: https://bugzilla.kernel.org/show_bug.cgi?id=88131Reported-by: default avatarAaron Ma <mapengyu@gmail.com>
      Tested-by: default avatarAaron Ma <mapengyu@gmail.com>
      Signed-off-by: default avatarYinghai Lu <yinghai@kernel.org>
      Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      1a233586
    • Chris Mason's avatar
      btrfs: fix lockups from btrfs_clear_path_blocking · 03813493
      Chris Mason authored
      commit f82c458a upstream.
      
      The fair reader/writer locks mean that btrfs_clear_path_blocking needs
      to strictly follow lock ordering rules even when we already have
      blocking locks on a given path.
      
      Before we can clear a blocking lock on the path, we need to make sure
      all of the locks have been converted to blocking.  This will remove lock
      inversions against anyone spinning in write_lock() against the buffers
      we're trying to get read locks on.  These inversions didn't exist before
      the fair read/writer locks, but now we need to be more careful.
      
      We papered over this deadlock in the past by changing
      btrfs_try_read_lock() to be a true trylock against both the spinlock and
      the blocking lock.  This was slower, and not sufficient to fix all the
      deadlocks.  This patch adds a btrfs_tree_read_lock_atomic(), which
      basically means get the spinlock but trylock on the blocking lock.
      Signed-off-by: default avatarChris Mason <clm@fb.com>
      Signed-off-by: default avatarJosef Bacik <jbacik@fb.com>
      Reported-by: default avatarPatrick Schmid <schmid@phys.ethz.ch>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      03813493
    • Markos Chandras's avatar
      MIPS: lib: memcpy: Restore NOP on delay slot before returning to caller · d5771489
      Markos Chandras authored
      commit 51b1029d upstream.
      
      Commit cf62a8b8 ("MIPS: lib: memcpy: Use macro to build the
      copy_user code") switched to a macro in order to build the memcpy
      symbols in preparation for the EVA support. However, this commit
      also removed the NOP instruction after the 'jr ra' when returning
      back to the caller. This had no visible side-effects since the next
      instruction was a load to the t0 register which was already in the
      clobbered list, but it may have undesired effects in the future
      if some other code is introduced in between the .Ldone and
      the .Ll_exc_copy labels.
      Signed-off-by: default avatarMarkos Chandras <markos.chandras@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/8512/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      d5771489
    • Markos Chandras's avatar
      MIPS: asm: uaccess: Add v1 register to clobber list on EVA · fe46ec99
      Markos Chandras authored
      commit 58563817 upstream.
      
      When EVA is turned on and prefetching is being used in memcpy.S,
      the v1 register is being used as a helper register to the PREFE
      instruction. However, v1 ($3) was not in the clobber list, which
      means that the compiler did not preserve it across function calls,
      and that could corrupt the value of the register leading to all
      sorts of userland crashes. We fix this problem by using the
      DADDI_SCRATCH macro to define the clobbered register when
      CONFIG_EVA && CONFIG_CPU_HAS_PREFETCH are enabled.
      Signed-off-by: default avatarMarkos Chandras <markos.chandras@imgtec.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/8510/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      fe46ec99
    • Aaro Koskinen's avatar
      MIPS: oprofile: Fix backtrace on 64-bit kernel · 541e166e
      Aaro Koskinen authored
      commit bbaf113a upstream.
      
      Fix incorrect cast that always results in wrong address for the new
      frame on 64-bit kernels.
      Signed-off-by: default avatarAaro Koskinen <aaro.koskinen@nsn.com>
      Cc: linux-mips@linux-mips.org
      Patchwork: https://patchwork.linux-mips.org/patch/8110/Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      541e166e
    • James Cowgill's avatar
      MIPS: IP27: Fix __node_distances undefined error · 56882fec
      James Cowgill authored
      commit 5829b0ec upstream.
      
      export the __node_distances symbol in the ip27 memory code to fix the
      build error:
      
        Building modules, stage 2.
        MODPOST 311 modules
      ERROR: "__node_distances" [drivers/block/nvme.ko] undefined!
      scripts/Makefile.modpost:90: recipe for target '__modpost' failed
      
      when building the kernel with:
       CONFIG_SGI_IP27=y
       CONFIG_BLK_DEV_NVME=m
      Signed-off-by: default avatarJames Cowgill <James.Cowgill@imgtec.com>
      Reviewed-by: default avatarJames Hogan <james.hogan@imgtec.com>
      Signed-off-by: default avatarRalf Baechle <ralf@linux-mips.org>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      56882fec
    • Maxime Ripard's avatar
      clockevent: sun4i: Fix race condition in the probe code · 8fb2face
      Maxime Ripard authored
      commit 6bab4a8a upstream.
      
      The interrupts were activated and the handler registered before the clockevent
      was registered in the probe function.
      
      The interrupt handler, however, was making the assumption that the clockevent
      device was registered.
      
      That could cause a null pointer dereference if the timer interrupt was firing
      during this narrow window.
      
      Fix that by moving the clockevent registration before the interrupt is enabled.
      Reported-by: default avatarRoman Byshko <rbyshko@gmail.com>
      Signed-off-by: default avatarMaxime Ripard <maxime.ripard@free-electrons.com>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      8fb2face
    • Benjamin Herrenschmidt's avatar
      of/base: Fix PowerPC address parsing hack · 2c94dd52
      Benjamin Herrenschmidt authored
      commit 746c9e9f upstream.
      
      We have a historical hack that treats missing ranges properties as the
      equivalent of an empty one. This is needed for ancient PowerMac "bad"
      device-trees, and shouldn't be enabled for any other PowerPC platform,
      otherwise we get some nasty layout of devices in sysfs or even
      duplication when a set of otherwise identically named devices is
      created multiple times under a different parent node with no ranges
      property.
      
      This fix is needed for the PowerNV i2c busses to be exposed properly
      and will fix a number of other embedded cases.
      Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Acked-by: default avatarGrant Likely <grant.likely@linaro.org>
      Signed-off-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      2c94dd52