History

Merge v3.7-rc5 into tty-next

This pulls in the 3.7-rc5 fixes into tty-next to make it easier to test.

Greg Kroah-Hartman committed 14 years ago

Commit 54d5f882 parents 76cc438 77b6706388 files · +3861 −2313Browse files

Unified · Split

388 files
  1. Documentation/arm64/memory.txt +6 −6
  2. Documentation/devicetree/bindings/input/touchscreen/egalax-ts.txt +19 −0
  3. Documentation/hwmon/fam15h_power +1 −1
  4. MAINTAINERS +3 −2
  5. Makefile +1 −1
  6. arch/arm/include/asm/io.h +2 −2
  7. arch/arm/include/asm/sched_clock.h +0 −2
  8. arch/arm/include/asm/vfpmacros.h +6 −6
  9. arch/arm/include/uapi/asm/hwcap.h +2 −1
  10. arch/arm/kernel/sched_clock.c +4 −14
  11. arch/arm/mm/alignment.c +1 −1
  12. arch/arm/vfp/vfpmodule.c +6 −3
  13. arch/arm/xen/enlighten.c +11 −0
  14. arch/arm/xen/hypercall.S +5 −9
  15. arch/arm64/Kconfig +1 −0
  16. arch/arm64/include/asm/elf.h +1 −4
  17. arch/arm64/include/asm/fpsimd.h +2 −3
  18. arch/arm64/include/asm/io.h +4 −4
  19. arch/arm64/include/asm/processor.h +2 −0
  20. arch/arm64/include/asm/unistd.h +0 −1
  21. arch/arm64/kernel/perf_event.c +2 −8
  22. arch/arm64/kernel/process.c +0 −18
  23. arch/arm64/kernel/smp.c +1 −2
  24. arch/arm64/mm/init.c +1 −1
  25. arch/frv/Kconfig +1 −0
  26. arch/frv/boot/Makefile +6 −4
  27. arch/frv/include/asm/unistd.h +0 −1
  28. arch/frv/kernel/entry.S +3 −25
  29. arch/frv/kernel/process.c +3 −2
  30. arch/frv/mb93090-mb00/pci-dma-nommu.c +1 −0
  31. arch/h8300/include/asm/cache.h +2 −1
  32. arch/s390/include/asm/cio.h +2 −0
  33. arch/s390/include/asm/pgtable.h +22 −13
  34. arch/s390/kernel/sclp.S +7 −1
  35. arch/s390/lib/uaccess_pt.c +1 −1
  36. arch/s390/mm/gup.c +1 −1
  37. arch/sparc/Kconfig +1 −0
  38. arch/sparc/crypto/Makefile +8 −8
  39. arch/sparc/crypto/aes_glue.c +2 −0
  40. arch/sparc/crypto/camellia_glue.c +2 −0
  41. arch/sparc/crypto/crc32c_glue.c +2 −0
  42. arch/sparc/crypto/des_glue.c +2 −0
  43. arch/sparc/crypto/md5_glue.c +2 −0
  44. arch/sparc/crypto/sha1_glue.c +2 −0
  45. arch/sparc/crypto/sha256_glue.c +2 −0
  46. arch/sparc/crypto/sha512_glue.c +2 −0
  47. arch/sparc/include/asm/atomic_64.h +3 −1
  48. arch/sparc/include/asm/backoff.h +59 −10
  49. arch/sparc/include/asm/compat.h +3 −2
  50. arch/sparc/include/asm/processor_64.h +16 −1
  51. arch/sparc/include/asm/prom.h +5 −0
  52. arch/sparc/include/asm/thread_info_64.h +5 −0
  53. arch/sparc/include/asm/ttable.h +16 −8
  54. arch/sparc/include/uapi/asm/unistd.h +6 −1
  55. arch/sparc/kernel/entry.h +7 −0
  56. arch/sparc/kernel/leon_kernel.c +4 −2
  57. arch/sparc/kernel/perf_event.c +16 −6
  58. arch/sparc/kernel/process_64.c +23 −19
  59. arch/sparc/kernel/ptrace_64.c +2 −2
  60. arch/sparc/kernel/setup_64.c +21 −0
  61. arch/sparc/kernel/sys_sparc_64.c +5 −0
  62. arch/sparc/kernel/systbls_32.S +1 −0
  63. arch/sparc/kernel/systbls_64.S +2 −0
  64. arch/sparc/kernel/unaligned_64.c +23 −13
  65. arch/sparc/kernel/visemul.c +14 −9
  66. arch/sparc/kernel/vmlinux.lds.S +5 −0
  67. arch/sparc/kernel/winfixup.S +2 −0
  68. arch/sparc/lib/atomic_64.S +15 −1
  69. arch/sparc/lib/ksyms.c +1 −0
  70. arch/sparc/math-emu/math_64.c +1 −1
  71. arch/x86/include/asm/xen/hypercall.h +7 −14
  72. arch/x86/include/asm/xen/hypervisor.h +0 −1
  73. arch/x86/kvm/x86.c +34 −26
  74. arch/x86/xen/mmu.c +20 −1
  75. arch/xtensa/Kconfig +2 −0
  76. arch/xtensa/include/asm/io.h +4 −0
  77. arch/xtensa/include/asm/processor.h +1 −3
  78. arch/xtensa/include/asm/syscall.h +1 −1
  79. arch/xtensa/include/asm/unistd.h +5 −10
  80. arch/xtensa/include/uapi/asm/unistd.h +4 −12
  81. arch/xtensa/kernel/entry.S +13 −44
  82. arch/xtensa/kernel/process.c +71 −57
  83. arch/xtensa/kernel/syscall.c +3 −4
  84. arch/xtensa/kernel/xtensa_ksyms.c +0 −1
  85. block/Kconfig +1 −1
  86. block/blk-cgroup.c +10 −0
  87. block/blk-core.c +2 −1
  88. crypto/cryptd.c +8 −3
  89. drivers/acpi/video.c +7 −4
  90. drivers/base/platform.c +7 −0
  91. drivers/block/Kconfig +8 −7
  92. drivers/block/cciss.c +0 −1
  93. drivers/block/floppy.c +48 −42
  94. drivers/block/loop.c +15 −2
  95. drivers/block/mtip32xx/mtip32xx.c +15 −4
  96. drivers/block/mtip32xx/mtip32xx.h +3 −0
  97. drivers/block/xen-blkback/common.h +2 −2
  98. drivers/block/xen-blkback/xenbus.c +4 −5
  99. drivers/cpufreq/powernow-k8.c +1 −1
  100. drivers/gpio/Kconfig +1 −1
  101. drivers/gpio/gpio-74x164.c +1 −1
  102. drivers/gpio/gpio-mvebu.c +3 −1
  103. drivers/gpio/gpio-omap.c +35 −0
  104. drivers/gpio/gpio-timberdale.c +2 −2
  105. drivers/gpio/gpiolib.c +7 −3
  106. drivers/gpu/drm/drm_fops.c +30 −14
  107. drivers/gpu/drm/exynos/Kconfig +1 −1
  108. drivers/gpu/drm/exynos/exynos_drm_connector.c +1 −0
  109. drivers/gpu/drm/exynos/exynos_drm_encoder.c +17 −16
  110. drivers/gpu/drm/exynos/exynos_mixer.c +1 −1
  111. drivers/gpu/drm/i915/i915_dma.c +2 −1
  112. drivers/gpu/drm/i915/intel_crt.c +1 −1
  113. drivers/gpu/drm/i915/intel_overlay.c +11 −3
  114. drivers/gpu/drm/i915/intel_panel.c +1 −1
  115. drivers/gpu/drm/i915/intel_sdvo.c +42 −20
  116. drivers/gpu/drm/i915/intel_sdvo_regs.h +2 −0
  117. drivers/gpu/drm/nouveau/core/core/mm.c +6 −3
  118. drivers/gpu/drm/nouveau/core/engine/disp/nv50.c +12 −8
  119. drivers/gpu/drm/nouveau/core/engine/graph/nv40.c +2 −2
  120. drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c +1 −1
  121. drivers/gpu/drm/nouveau/core/include/core/mm.h +0 −1
  122. drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c +4 −6
  123. drivers/gpu/drm/nouveau/core/subdev/i2c/base.c +1 −1
  124. drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c +1 −1
  125. drivers/gpu/drm/nouveau/nouveau_connector.c +1 −1
  126. drivers/gpu/drm/nouveau/nouveau_display.c +21 −15
  127. drivers/gpu/drm/nouveau/nouveau_drm.c +21 −15
  128. drivers/gpu/drm/nouveau/nouveau_drm.h +2 −0
  129. drivers/gpu/drm/nouveau/nouveau_irq.c +9 −7
  130. drivers/gpu/drm/nouveau/nv04_dac.c +8 −8
  131. drivers/gpu/drm/nouveau/nv04_dfp.c +7 −7
  132. drivers/gpu/drm/nouveau/nv04_tv.c +4 −5
  133. drivers/gpu/drm/radeon/atombios_crtc.c +31 −23
  134. drivers/gpu/drm/radeon/evergreen.c +1 −1
  135. drivers/gpu/drm/radeon/evergreen_cs.c +4 −1
  136. drivers/gpu/drm/radeon/evergreend.h +4 −0
  137. drivers/gpu/drm/radeon/radeon_atpx_handler.c +2 −2
  138. drivers/gpu/drm/radeon/radeon_connectors.c +21 −7
  139. drivers/gpu/drm/radeon/radeon_legacy_crtc.c +13 −2
  140. drivers/gpu/drm/radeon/radeon_legacy_encoders.c +147 −28
  141. drivers/gpu/drm/radeon/si.c +1 −0
  142. drivers/gpu/drm/radeon/sid.h +1 −0
  143. drivers/gpu/drm/udl/udl_drv.h +1 −1
  144. drivers/gpu/drm/udl/udl_fb.c +7 −5
  145. drivers/gpu/drm/udl/udl_transfer.c +3 −2
  146. drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c +1 −1
  147. drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +5 −0
  148. drivers/hid/hid-apple.c +6 −0
  149. drivers/hid/hid-core.c +6 −0
  150. drivers/hid/hid-ids.h +3 −0
  151. drivers/hid/hid-microsoft.c +13 −5
  152. drivers/hid/hid-multitouch.c +2 −3
  153. drivers/hid/hidraw.c +43 −26
  154. drivers/hwmon/asb100.c +1 −1
  155. drivers/hwmon/fam15h_power.c +2 −2
  156. drivers/hwmon/gpio-fan.c +2 −0
  157. drivers/hwmon/w83627ehf.c +1 −0
  158. drivers/hwmon/w83627hf.c +1 −1
  159. drivers/hwmon/w83781d.c +1 −1
  160. drivers/hwmon/w83791d.c +1 −1
  161. drivers/hwmon/w83792d.c +1 −1
  162. drivers/hwmon/w83l786ng.c +1 −1
  163. drivers/i2c/Makefile +1 −0
  164. drivers/i2c/busses/Kconfig +0 −1
  165. drivers/i2c/busses/Makefile +0 −1
  166. drivers/i2c/busses/i2c-i801.c +7 −4
  167. drivers/i2c/busses/i2c-mxs.c +14 −172
  168. drivers/i2c/busses/i2c-nomadik.c +7 −2
  169. drivers/i2c/busses/i2c-tegra.c +1 −1
  170. drivers/i2c/i2c-stub.c +32 −34
  171. drivers/input/keyboard/Kconfig +1 −0
  172. drivers/input/keyboard/pxa27x_keypad.c +3 −0
  173. drivers/input/misc/xen-kbdfront.c +4 −1
  174. drivers/input/mouse/bcm5974.c +21 −0
  175. drivers/input/tablet/wacom_sys.c +1 −1
  176. drivers/input/tablet/wacom_wac.c +3 −0
  177. drivers/input/touchscreen/Kconfig +1 −1
  178. drivers/input/touchscreen/egalax_ts.c +21 −2
  179. drivers/input/touchscreen/tsc40.c +0 −1
  180. drivers/isdn/Kconfig +1 −1
  181. drivers/isdn/i4l/Kconfig +1 −1
  182. drivers/isdn/i4l/isdn_common.c +0 −4
  183. drivers/md/faulty.c +4 −1
  184. drivers/md/raid1.c +1 −1
  185. drivers/md/raid10.c +9 −6
  186. drivers/mmc/host/dw_mmc-exynos.c +4 −4
  187. drivers/mmc/host/dw_mmc-pltfm.c +3 −3
  188. drivers/mmc/host/dw_mmc-pltfm.h +1 −1
  189. drivers/mmc/host/dw_mmc.c +34 −28
  190. drivers/mmc/host/mxcmmc.c +1 −1
  191. drivers/mmc/host/omap_hsmmc.c +12 −7
  192. drivers/mmc/host/sdhci-dove.c +20 −18
  193. drivers/mmc/host/sdhci-of-esdhc.c +11 −0
  194. drivers/mmc/host/sdhci-pci.c +1 −1
  195. drivers/mmc/host/sdhci-pltfm.c +7 −0
  196. drivers/mmc/host/sdhci-s3c.c +16 −14
  197. drivers/mmc/host/sdhci.c +28 −16
  198. drivers/mmc/host/sdhci.h +1 −0
  199. drivers/mmc/host/sh_mmcif.c +1 −1
  200. drivers/net/bonding/bond_sysfs.c +2 −2
  201. drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c +1 −1
  202. drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c +115 −47
  203. drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +11 −2
  204. drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +0 −10
  205. drivers/net/ethernet/chelsio/cxgb4/t4_hw.c +5 −1
  206. drivers/net/ethernet/freescale/gianfar.c +4 −1
  207. drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c +3 −0
  208. drivers/net/ethernet/jme.c +4 −4
  209. drivers/net/ethernet/marvell/skge.c +1 −1
  210. drivers/net/ethernet/micrel/ksz884x.c +2 −2
  211. drivers/net/ethernet/nxp/lpc_eth.c +1 −0
  212. drivers/net/ethernet/realtek/r8169.c +5 −0
  213. drivers/net/ethernet/xilinx/xilinx_axienet_main.c +1 −1
  214. drivers/net/phy/mdio-bitbang.c +1 −0
  215. drivers/net/usb/cdc_eem.c +2 −1
  216. drivers/net/usb/smsc95xx.c +1 −0
  217. drivers/net/usb/usbnet.c +5 −3
  218. drivers/net/vmxnet3/vmxnet3_drv.c +45 −20
  219. drivers/net/vxlan.c +1 −1
  220. drivers/net/wireless/ath/ath9k/xmit.c +8 −2
  221. drivers/net/wireless/b43legacy/pio.c +1 −1
  222. drivers/net/wireless/rt2x00/rt2800lib.c +1 −1
  223. drivers/pci/bus.c +0 −3
  224. drivers/pci/pci-driver.c +2 −10
  225. drivers/pci/pci-sysfs.c +0 −34
  226. drivers/pci/pci.c +32 −0
  227. drivers/pci/pci.h +2 −0
  228. drivers/pci/pcie/aer/aerdrv_core.c +16 −4
  229. drivers/pci/pcie/portdrv_core.c +2 −1
  230. drivers/pci/proc.c +8 −0
  231. drivers/pinctrl/Kconfig +2 −0
  232. drivers/pinctrl/spear/pinctrl-spear.c +1 −1
  233. drivers/pinctrl/spear/pinctrl-spear1310.c +320 −45
  234. drivers/pinctrl/spear/pinctrl-spear1340.c +39 −2
  235. drivers/pinctrl/spear/pinctrl-spear320.c +6 −2
  236. drivers/pinctrl/spear/pinctrl-spear3xx.h +1 −0
  237. drivers/s390/cio/css.h +0 −3
  238. drivers/s390/cio/device.c +1 −7
  239. drivers/s390/cio/idset.c +1 −2
  240. drivers/scsi/qla2xxx/qla_mid.c +3 −0
  241. drivers/scsi/qla2xxx/qla_target.c +11 −14
  242. drivers/scsi/qla2xxx/qla_target.h +1 −0
  243. drivers/scsi/qla2xxx/tcm_qla2xxx.c +76 −1
  244. drivers/scsi/qla2xxx/tcm_qla2xxx.h +2 −0
  245. drivers/scsi/qlogicpti.c +1 −12
  246. drivers/target/iscsi/iscsi_target.c +3 −1
  247. drivers/target/iscsi/iscsi_target_core.h +1 −0
  248. drivers/target/iscsi/iscsi_target_login.c +1 −0
  249. drivers/target/iscsi/iscsi_target_util.c +20 −2
  250. drivers/target/iscsi/iscsi_target_util.h +1 −0
  251. drivers/target/target_core_configfs.c +2 −1
  252. drivers/target/target_core_device.c +9 −9
  253. drivers/target/target_core_sbc.c +18 −0
  254. drivers/target/target_core_spc.c +2 −0
  255. drivers/target/target_core_tmr.c +3 −3
  256. drivers/target/target_core_transport.c +0 −1
  257. drivers/thermal/exynos_thermal.c +1 −1
  258. drivers/thermal/rcar_thermal.c +1 −1
  259. drivers/usb/gadget/u_ether.c +2 −1
  260. drivers/video/xen-fbfront.c +4 −1
  261. drivers/virtio/virtio.c +3 −1
  262. drivers/xen/Makefile +1 −0
  263. drivers/xen/events.c +1 −1
  264. drivers/xen/fallback.c +80 −0
  265. drivers/xen/gntdev.c +19 −17
  266. drivers/xen/xenbus/xenbus_dev_frontend.c +1 −1
  267. fs/bio.c +4 −2
  268. fs/ceph/export.c +2 −0
  269. fs/cifs/cifsacl.c +20 −29
  270. fs/cifs/dir.c +10 −1
  271. fs/eventpoll.c +3 −35
  272. fs/ext4/ialloc.c +9 −10
  273. fs/file.c +2 −2
  274. fs/gfs2/file.c +5 −9
  275. fs/gfs2/lops.c +2 −14
  276. fs/gfs2/quota.c +5 −2
  277. fs/gfs2/rgrp.c +21 −12
  278. fs/gfs2/super.c +2 −1
  279. fs/gfs2/trans.c +8 −0
  280. fs/nfs/dns_resolve.c +3 −2
  281. fs/nfs/inode.c +4 −1
  282. fs/nfs/internal.h +4 −2
  283. fs/nfs/mount_clnt.c +1 −1
  284. fs/nfs/namespace.c +14 −5
  285. fs/nfs/nfs4namespace.c +2 −1
  286. fs/nfs/nfs4proc.c +28 −18
  287. fs/nfs/pnfs.c +2 −2
  288. fs/nfs/super.c +50 −1
  289. fs/nfs/unlink.c +1 −1
  290. fs/notify/fanotify/fanotify.c +1 −0
  291. fs/xfs/xfs_alloc.c +2 −41
  292. fs/xfs/xfs_alloc.h +0 −3
  293. fs/xfs/xfs_alloc_btree.c +2 −0
  294. fs/xfs/xfs_bmap.c +54 −9
  295. fs/xfs/xfs_bmap.h +8 −1
  296. fs/xfs/xfs_buf_item.c +18 −0
  297. fs/xfs/xfs_fsops.c +19 −2
  298. fs/xfs/xfs_ialloc.c +1 −0
  299. fs/xfs/xfs_inode.c +2 −1
  300. fs/xfs/xfs_ioctl.c +1 −1
  301. fs/xfs/xfs_iomap.c +3 −1
  302. fs/xfs/xfs_log.c +16 −3
  303. fs/xfs/xfs_log_recover.c +1 −1
  304. include/linux/hashtable.h +192 −0
  305. include/linux/kvm_host.h +2 −13
  306. include/linux/mmc/dw_mmc.h +3 −3
  307. include/linux/mmc/sdhci.h +1 −0
  308. include/linux/of_address.h +2 −0
  309. include/linux/ptp_clock_kernel.h +2 −1
  310. include/linux/raid/Kbuild +0 −2
  311. include/linux/raid/md_u.h +1 −140
  312. include/net/cfg80211.h +9 −0
  313. include/sound/core.h +3 −0
  314. include/trace/events/xen.h +8 −0
  315. include/uapi/linux/eventpoll.h +0 −1
  316. include/uapi/linux/raid/Kbuild +2 −0
  317. include/uapi/linux/raid/md_p.h +0 −0
  318. include/uapi/linux/raid/md_u.h +155 −0
  319. include/xen/hvm.h +32 −2
  320. init/main.c +2 −0
  321. kernel/module.c +16 −11
  322. mm/vmscan.c +2 −0
  323. net/ceph/messenger.c +4 −2
  324. net/core/dev.c +1 −1
  325. net/core/rtnetlink.c +2 −1
  326. net/ipv4/inet_diag.c +4 −1
  327. net/ipv4/netfilter/iptable_nat.c +3 −1
  328. net/ipv4/tcp_illinois.c +5 −3
  329. net/ipv4/tcp_input.c +3 −0
  330. net/ipv4/tcp_metrics.c +1 −1
  331. net/ipv6/ip6_gre.c +4 −4
  332. net/ipv6/ndisc.c +1 −2
  333. net/ipv6/netfilter/ip6table_nat.c +3 −1
  334. net/ipv6/netfilter/nf_conntrack_reasm.c +2 −2
  335. net/l2tp/l2tp_eth.c +1 −0
  336. net/mac80211/ibss.c +1 −1
  337. net/mac80211/rx.c +56 −18
  338. net/mac80211/util.c +35 −7
  339. net/netfilter/nf_conntrack_h323_main.c +2 −1
  340. net/sched/sch_qfq.c +79 −30
  341. net/sctp/socket.c +1 −1
  342. net/sunrpc/backchannel_rqst.c +1 −1
  343. net/tipc/handler.c +0 −1
  344. net/wireless/core.c +1 −2
  345. net/wireless/reg.c +3 −2
  346. net/wireless/util.c +8 −6
  347. scripts/Makefile.modinst +2 −1
  348. scripts/checkpatch.pl +4 −2
  349. sound/core/compress_offload.c +7 −2
  350. sound/core/control.c +5 −0
  351. sound/core/hwdep.c +11 −1
  352. sound/core/init.c +30 −20
  353. sound/core/oss/mixer_oss.c +9 −2
  354. sound/core/oss/pcm_oss.c +7 −0
  355. sound/core/pcm.c +11 −2
  356. sound/core/pcm_native.c +29 −6
  357. sound/core/rawmidi.c +25 −1
  358. sound/core/sound.c +9 −2
  359. sound/core/sound_oss.c +8 −2
  360. sound/i2c/other/ak4113.c +1 −1
  361. sound/i2c/other/ak4114.c +1 −1
  362. sound/i2c/other/ak4117.c +1 −1
  363. sound/pci/es1968.c +2 −0
  364. sound/pci/hda/hda_intel.c +2 −0
  365. sound/pci/hda/patch_analog.c +1 −0
  366. sound/pci/hda/patch_cirrus.c +12 −9
  367. sound/pci/hda/patch_realtek.c +13 −13
  368. sound/pci/hda/patch_sigmatel.c +2 −0
  369. sound/pci/hda/patch_via.c +29 −7
  370. sound/pci/ice1712/ice1724.c +6 −1
  371. sound/pci/rme9652/hdspm.c +3 −2
  372. sound/soc/codecs/cs42l52.c +1 −1
  373. sound/soc/codecs/wm8994.c +1 −1
  374. sound/soc/omap/omap-dmic.c +2 −2
  375. sound/soc/omap/zoom2.c +2 −3
  376. sound/usb/card.c +8 −4
  377. sound/usb/card.h +1 −0
  378. sound/usb/endpoint.c +13 −0
  379. sound/usb/endpoint.h +1 −0
  380. sound/usb/mixer.c +43 −22
  381. sound/usb/mixer_quirks.c +51 −7
  382. sound/usb/pcm.c +37 −19
  383. sound/usb/proc.c +2 −2
  384. sound/usb/stream.c +1 −0
  385. sound/usb/usbaudio.h +1 −1
  386. tools/testing/selftests/Makefile +1 −1
  387. tools/testing/selftests/epoll/Makefile +0 −11
  388. tools/testing/selftests/epoll/test_epoll.c +0 −344
Documentation/arm64/memory.txt+6−6
@@ -27,17 +27,17 @@ Start End Size Use · 26 unmodified lines
2727 -----------------------------------------------------------------------
2828 0000000000000000 0000007fffffffff 512GB user
2929
30−ffffff8000000000 ffffffbbfffcffff ~240GB vmalloc
30+ffffff8000000000 ffffffbbfffeffff ~240GB vmalloc
3131
32−ffffffbbfffd0000 ffffffbcfffdffff 64KB [guard page]
32+ffffffbbffff0000 ffffffbbffffffff 64KB [guard page]
3333
34−ffffffbbfffe0000 ffffffbcfffeffff 64KB PCI I/O space
34+ffffffbc00000000 ffffffbdffffffff 8GB vmemmap
3535
36−ffffffbbffff0000 ffffffbcffffffff 64KB [guard page]
36+ffffffbe00000000 ffffffbffbbfffff ~8GB [guard, future vmmemap]
3737
38−ffffffbc00000000 ffffffbdffffffff 8GB vmemmap
38+ffffffbffbe00000 ffffffbffbe0ffff 64KB PCI I/O space
3939
40−ffffffbe00000000 ffffffbffbffffff ~8GB [guard, future vmmemap]
40+ffffffbbffff0000 ffffffbcffffffff ~2MB [guard]
4141
4242 ffffffbffc000000 ffffffbfffffffff 64MB modules
4343
Documentation/devicetree/bindings/input/touchscreen/egalax-ts.txt+19−0
@@ -0,0 +1,19 @@
1+* EETI eGalax Multiple Touch Controller
2+
3+Required properties:
4+- compatible: must be "eeti,egalax_ts"
5+- reg: i2c slave address
6+- interrupt-parent: the phandle for the interrupt controller
7+- interrupts: touch controller interrupt
8+- wakeup-gpios: the gpio pin to be used for waking up the controller
9+ as well as uased as irq pin
10+
11+Example:
12+
13+ egalax_ts@04 {
14+ compatible = "eeti,egalax_ts";
15+ reg = <0x04>;
16+ interrupt-parent = <&gpio1>;
17+ interrupts = <9 2>;
18+ wakeup-gpios = <&gpio1 9 0>;
19+ };
Documentation/hwmon/fam15h_power+1−1
@@ -10,7 +10,7 @@ Supported chips: · 9 unmodified lines
1010 BIOS and Kernel Developer's Guide (BKDG) For AMD Family 15h Processors
1111 (not yet published)
1212
13−Author: Andreas Herrmann <andreas.herrmann3@amd.com>
13+Author: Andreas Herrmann <herrmann.der.user@googlemail.com>
1414
1515 Description
1616 -----------
MAINTAINERS+3−2
@@ -503,7 +503,7 @@ F: include/linux/altera_uart.h · 502 unmodified lines
503503 F: include/linux/altera_jtaguart.h
504504
505505 AMD FAM15H PROCESSOR POWER MONITORING DRIVER
506−M: Andreas Herrmann <andreas.herrmann3@amd.com>
506+M: Andreas Herrmann <herrmann.der.user@googlemail.com>
507507 L: lm-sensors@lm-sensors.org
508508 S: Maintained
509509 F: Documentation/hwmon/fam15h_power
@@ -2507,6 +2507,7 @@ M: Joonyoung Shim <jy0922.shim@samsung.com> · 1997 unmodified lines
25072507 M: Seung-Woo Kim <sw0312.kim@samsung.com>
25082508 M: Kyungmin Park <kyungmin.park@samsung.com>
25092509 L: dri-devel@lists.freedesktop.org
2510+T: git git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos.git
25102511 S: Supported
25112512 F: drivers/gpu/drm/exynos
25122513 F: include/drm/exynos*
@@ -5647,7 +5648,7 @@ S: Maintained · 3134 unmodified lines
56475648 F: drivers/pinctrl/spear/
56485649
56495650 PKTCDVD DRIVER
5650−M: Peter Osterlund <petero2@telia.com>
5651+M: Jiri Kosina <jkosina@suse.cz>
56515652 S: Maintained
56525653 F: drivers/block/pktcdvd.c
56535654 F: include/linux/pktcdvd.h
Makefile+1−1
@@ -1,7 +1,7 @@
11 VERSION = 3
22 PATCHLEVEL = 7
33 SUBLEVEL = 0
4−EXTRAVERSION = -rc3
4+EXTRAVERSION = -rc5
55 NAME = Terrified Chipmunk
66
77 # *DOCUMENTATION*
arch/arm/include/asm/io.h+2−2
@@ -64,7 +64,7 @@ extern void __raw_readsl(const void __iomem *addr, void *data, int longlen); · 63 unmodified lines
6464 static inline void __raw_writew(u16 val, volatile void __iomem *addr)
6565 {
6666 asm volatile("strh %1, %0"
67− : "+Qo" (*(volatile u16 __force *)addr)
67+ : "+Q" (*(volatile u16 __force *)addr)
6868 : "r" (val));
6969 }
7070
@@ -72,7 +72,7 @@ static inline u16 __raw_readw(const volatile void __iomem *addr) · 1 unmodified line
7272 {
7373 u16 val;
7474 asm volatile("ldrh %1, %0"
75− : "+Qo" (*(volatile u16 __force *)addr),
75+ : "+Q" (*(volatile u16 __force *)addr),
7676 "=r" (val));
7777 return val;
7878 }
arch/arm/include/asm/sched_clock.h+0−2
@@ -10,7 +10,5 @@ · 9 unmodified lines
1010
1111 extern void sched_clock_postinit(void);
1212 extern void setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate);
13−extern void setup_sched_clock_needs_suspend(u32 (*read)(void), int bits,
14− unsigned long rate);
1513
1614 #endif
arch/arm/include/asm/vfpmacros.h+6−6
@@ -27,9 +27,9 @@ · 26 unmodified lines
2727 #if __LINUX_ARM_ARCH__ <= 6
2828 ldr \tmp, =elf_hwcap @ may not have MVFR regs
2929 ldr \tmp, [\tmp, #0]
30− tst \tmp, #HWCAP_VFPv3D16
31− ldceql p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31}
32− addne \base, \base, #32*4 @ step over unused register space
30+ tst \tmp, #HWCAP_VFPD32
31+ ldcnel p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31}
32+ addeq \base, \base, #32*4 @ step over unused register space
3333 #else
3434 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0
3535 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field
@@ -51,9 +51,9 @@ · 15 unmodified lines
5151 #if __LINUX_ARM_ARCH__ <= 6
5252 ldr \tmp, =elf_hwcap @ may not have MVFR regs
5353 ldr \tmp, [\tmp, #0]
54− tst \tmp, #HWCAP_VFPv3D16
55− stceql p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31}
56− addne \base, \base, #32*4 @ step over unused register space
54+ tst \tmp, #HWCAP_VFPD32
55+ stcnel p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31}
56+ addeq \base, \base, #32*4 @ step over unused register space
5757 #else
5858 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0
5959 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field
arch/arm/include/uapi/asm/hwcap.h+2−1
@@ -18,11 +18,12 @@ · 17 unmodified lines
1818 #define HWCAP_THUMBEE (1 << 11)
1919 #define HWCAP_NEON (1 << 12)
2020 #define HWCAP_VFPv3 (1 << 13)
21−#define HWCAP_VFPv3D16 (1 << 14)
21+#define HWCAP_VFPv3D16 (1 << 14) /* also set for VFPv4-D16 */
2222 #define HWCAP_TLS (1 << 15)
2323 #define HWCAP_VFPv4 (1 << 16)
2424 #define HWCAP_IDIVA (1 << 17)
2525 #define HWCAP_IDIVT (1 << 18)
26+#define HWCAP_VFPD32 (1 << 19) /* set if VFP has 32 regs (not 16) */
2627 #define HWCAP_IDIV (HWCAP_IDIVA | HWCAP_IDIVT)
2728
2829
arch/arm/kernel/sched_clock.c+4−14
@@ -107,13 +107,6 @@ static void sched_clock_poll(unsigned long wrap_ticks) · 106 unmodified lines
107107 update_sched_clock();
108108 }
109109
110−void __init setup_sched_clock_needs_suspend(u32 (*read)(void), int bits,
111− unsigned long rate)
112−{
113− setup_sched_clock(read, bits, rate);
114− cd.needs_suspend = true;
115−}
116−
117110 void __init setup_sched_clock(u32 (*read)(void), int bits, unsigned long rate)
118111 {
119112 unsigned long r, w;
@@ -189,18 +182,15 @@ void __init sched_clock_postinit(void) · 69 unmodified lines
189182 static int sched_clock_suspend(void)
190183 {
191184 sched_clock_poll(sched_clock_timer.data);
192− if (cd.needs_suspend)
193− cd.suspended = true;
185+ cd.suspended = true;
194186 return 0;
195187 }
196188
197189 static void sched_clock_resume(void)
198190 {
199− if (cd.needs_suspend) {
200− cd.epoch_cyc = read_sched_clock();
201− cd.epoch_cyc_copy = cd.epoch_cyc;
202− cd.suspended = false;
203− }
191+ cd.epoch_cyc = read_sched_clock();
192+ cd.epoch_cyc_copy = cd.epoch_cyc;
193+ cd.suspended = false;
204194 }
205195
206196 static struct syscore_ops sched_clock_ops = {
arch/arm/mm/alignment.c+1−1
@@ -745,7 +745,7 @@ do_alignment_t32_to_handler(unsigned long *pinstr, struct pt_regs *regs, · 744 unmodified lines
745745 static int
746746 do_alignment(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
747747 {
748− union offset_union offset;
748+ union offset_union uninitialized_var(offset);
749749 unsigned long instr = 0, instrptr;
750750 int (*handler)(unsigned long addr, unsigned long instr, struct pt_regs *regs);
751751 unsigned int type;
arch/arm/vfp/vfpmodule.c+6−3
@@ -701,11 +701,14 @@ static int __init vfp_init(void) · 700 unmodified lines
701701 elf_hwcap |= HWCAP_VFPv3;
702702
703703 /*
704− * Check for VFPv3 D16. CPUs in this configuration
705− * only have 16 x 64bit registers.
704+ * Check for VFPv3 D16 and VFPv4 D16. CPUs in
705+ * this configuration only have 16 x 64bit
706+ * registers.
706707 */
707708 if (((fmrx(MVFR0) & MVFR0_A_SIMD_MASK)) == 1)
708− elf_hwcap |= HWCAP_VFPv3D16;
709+ elf_hwcap |= HWCAP_VFPv3D16; /* also v4-D16 */
710+ else
711+ elf_hwcap |= HWCAP_VFPD32;
709712 }
710713 #endif
711714 /*
arch/arm/xen/enlighten.c+11−0
@@ -166,3 +166,14 @@ void free_xenballooned_pages(int nr_pages, struct page **pages) · 165 unmodified lines
166166 *pages = NULL;
167167 }
168168 EXPORT_SYMBOL_GPL(free_xenballooned_pages);
169+
170+/* In the hypervisor.S file. */
171+EXPORT_SYMBOL_GPL(HYPERVISOR_event_channel_op);
172+EXPORT_SYMBOL_GPL(HYPERVISOR_grant_table_op);
173+EXPORT_SYMBOL_GPL(HYPERVISOR_xen_version);
174+EXPORT_SYMBOL_GPL(HYPERVISOR_console_io);
175+EXPORT_SYMBOL_GPL(HYPERVISOR_sched_op);
176+EXPORT_SYMBOL_GPL(HYPERVISOR_hvm_op);
177+EXPORT_SYMBOL_GPL(HYPERVISOR_memory_op);
178+EXPORT_SYMBOL_GPL(HYPERVISOR_physdev_op);
179+EXPORT_SYMBOL_GPL(privcmd_call);
arch/arm/xen/hypercall.S+5−9
@@ -48,20 +48,16 @@ · 47 unmodified lines
4848
4949 #include <linux/linkage.h>
5050 #include <asm/assembler.h>
51+#include <asm/opcodes-virt.h>
5152 #include <xen/interface/xen.h>
5253
5354
54−/* HVC 0xEA1 */
55−#ifdef CONFIG_THUMB2_KERNEL
56−#define xen_hvc .word 0xf7e08ea1
57−#else
58−#define xen_hvc .word 0xe140ea71
59−#endif
55+#define XEN_IMM 0xEA1
6056
6157 #define HYPERCALL_SIMPLE(hypercall) \
6258 ENTRY(HYPERVISOR_##hypercall) \
6359 mov r12, #__HYPERVISOR_##hypercall; \
64− xen_hvc; \
60+ __HVC(XEN_IMM); \
6561 mov pc, lr; \
6662 ENDPROC(HYPERVISOR_##hypercall)
6763
@@ -76,7 +72,7 @@ ENTRY(HYPERVISOR_##hypercall) \ · 8 unmodified lines
7672 stmdb sp!, {r4} \
7773 ldr r4, [sp, #4] \
7874 mov r12, #__HYPERVISOR_##hypercall; \
79− xen_hvc \
75+ __HVC(XEN_IMM); \
8076 ldm sp!, {r4} \
8177 mov pc, lr \
8278 ENDPROC(HYPERVISOR_##hypercall)
@@ -100,7 +96,7 @@ ENTRY(privcmd_call) · 17 unmodified lines
10096 mov r2, r3
10197 ldr r3, [sp, #8]
10298 ldr r4, [sp, #4]
103− xen_hvc
99+ __HVC(XEN_IMM)
104100 ldm sp!, {r4}
105101 mov pc, lr
106102 ENDPROC(privcmd_call);
arch/arm64/Kconfig+1−0
@@ -1,6 +1,7 @@
11 config ARM64
22 def_bool y
33 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
4+ select ARCH_WANT_COMPAT_IPC_PARSE_VERSION
45 select GENERIC_CLOCKEVENTS
56 select GENERIC_HARDIRQS_NO_DEPRECATED
67 select GENERIC_IOMAP
arch/arm64/include/asm/elf.h+1−4
@@ -25,12 +25,10 @@ · 24 unmodified lines
2525 #include <asm/user.h>
2626
2727 typedef unsigned long elf_greg_t;
28−typedef unsigned long elf_freg_t[3];
2928
3029 #define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
3130 typedef elf_greg_t elf_gregset_t[ELF_NGREG];
32−
33−typedef struct user_fp elf_fpregset_t;
31+typedef struct user_fpsimd_state elf_fpregset_t;
3432
3533 #define EM_AARCH64 183
3634
@@ -87,7 +85,6 @@ typedef struct user_fp elf_fpregset_t; · 50 unmodified lines
8785 #define R_AARCH64_MOVW_PREL_G2_NC 292
8886 #define R_AARCH64_MOVW_PREL_G3 293
8987
90−
9188 /*
9289 * These are used to set parameters in the core dumps.
9390 */
arch/arm64/include/asm/fpsimd.h+2−3
@@ -25,9 +25,8 @@ · 24 unmodified lines
2525 * - FPSR and FPCR
2626 * - 32 128-bit data registers
2727 *
28− * Note that user_fp forms a prefix of this structure, which is relied
29− * upon in the ptrace FP/SIMD accessors. struct user_fpsimd_state must
30− * form a prefix of struct fpsimd_state.
28+ * Note that user_fpsimd forms a prefix of this structure, which is
29+ * relied upon in the ptrace FP/SIMD accessors.
3130 */
3231 struct fpsimd_state {
3332 union {
arch/arm64/include/asm/io.h+4−4
@@ -114,7 +114,7 @@ static inline u64 __raw_readq(const volatile void __iomem *addr) · 113 unmodified lines
114114 * I/O port access primitives.
115115 */
116116 #define IO_SPACE_LIMIT 0xffff
117−#define PCI_IOBASE ((void __iomem *)0xffffffbbfffe0000UL)
117+#define PCI_IOBASE ((void __iomem *)(MODULES_VADDR - SZ_2M))
118118
119119 static inline u8 inb(unsigned long addr)
120120 {
@@ -225,9 +225,9 @@ extern void __iounmap(volatile void __iomem *addr); · 104 unmodified lines
225225 #define PROT_DEVICE_nGnRE (PROT_DEFAULT | PTE_XN | PTE_ATTRINDX(MT_DEVICE_nGnRE))
226226 #define PROT_NORMAL_NC (PROT_DEFAULT | PTE_ATTRINDX(MT_NORMAL_NC))
227227
228−#define ioremap(addr, size) __ioremap((addr), (size), PROT_DEVICE_nGnRE)
229−#define ioremap_nocache(addr, size) __ioremap((addr), (size), PROT_DEVICE_nGnRE)
230−#define ioremap_wc(addr, size) __ioremap((addr), (size), PROT_NORMAL_NC)
228+#define ioremap(addr, size) __ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
229+#define ioremap_nocache(addr, size) __ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
230+#define ioremap_wc(addr, size) __ioremap((addr), (size), __pgprot(PROT_NORMAL_NC))
231231 #define iounmap __iounmap
232232
233233 #define ARCH_HAS_IOREMAP_WC
arch/arm64/include/asm/processor.h+2−0
@@ -43,6 +43,8 @@ · 42 unmodified lines
4343 #else
4444 #define STACK_TOP STACK_TOP_MAX
4545 #endif /* CONFIG_COMPAT */
46+
47+#define ARCH_LOW_ADDRESS_LIMIT PHYS_MASK
4648 #endif /* __KERNEL__ */
4749
4850 struct debug_info {
arch/arm64/include/asm/unistd.h+0−1
@@ -14,7 +14,6 @@ · 13 unmodified lines
1414 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1515 */
1616 #ifdef CONFIG_COMPAT
17−#define __ARCH_WANT_COMPAT_IPC_PARSE_VERSION
1817 #define __ARCH_WANT_COMPAT_STAT64
1918 #define __ARCH_WANT_SYS_GETHOSTNAME
2019 #define __ARCH_WANT_SYS_PAUSE
arch/arm64/kernel/perf_event.c+2−8
@@ -613,17 +613,11 @@ enum armv8_pmuv3_perf_types { · 612 unmodified lines
613613 ARMV8_PMUV3_PERFCTR_BUS_ACCESS = 0x19,
614614 ARMV8_PMUV3_PERFCTR_MEM_ERROR = 0x1A,
615615 ARMV8_PMUV3_PERFCTR_BUS_CYCLES = 0x1D,
616−
617− /*
618− * This isn't an architected event.
619− * We detect this event number and use the cycle counter instead.
620− */
621− ARMV8_PMUV3_PERFCTR_CPU_CYCLES = 0xFF,
622616 };
623617
624618 /* PMUv3 HW events mapping. */
625619 static const unsigned armv8_pmuv3_perf_map[PERF_COUNT_HW_MAX] = {
626− [PERF_COUNT_HW_CPU_CYCLES] = ARMV8_PMUV3_PERFCTR_CPU_CYCLES,
620+ [PERF_COUNT_HW_CPU_CYCLES] = ARMV8_PMUV3_PERFCTR_CLOCK_CYCLES,
627621 [PERF_COUNT_HW_INSTRUCTIONS] = ARMV8_PMUV3_PERFCTR_INSTR_EXECUTED,
628622 [PERF_COUNT_HW_CACHE_REFERENCES] = ARMV8_PMUV3_PERFCTR_L1_DCACHE_ACCESS,
629623 [PERF_COUNT_HW_CACHE_MISSES] = ARMV8_PMUV3_PERFCTR_L1_DCACHE_REFILL,
@@ -1106,7 +1100,7 @@ static int armv8pmu_get_event_idx(struct pmu_hw_events *cpuc, · 476 unmodified lines
11061100 unsigned long evtype = event->config_base & ARMV8_EVTYPE_EVENT;
11071101
11081102 /* Always place a cycle counter into the cycle counter. */
1109− if (evtype == ARMV8_PMUV3_PERFCTR_CPU_CYCLES) {
1103+ if (evtype == ARMV8_PMUV3_PERFCTR_CLOCK_CYCLES) {
11101104 if (test_and_set_bit(ARMV8_IDX_CYCLE_COUNTER, cpuc->used_mask))
11111105 return -EAGAIN;
11121106
arch/arm64/kernel/process.c+0−18
@@ -309,24 +309,6 @@ struct task_struct *__switch_to(struct task_struct *prev, · 308 unmodified lines
309309 return last;
310310 }
311311
312−/*
313− * Fill in the task's elfregs structure for a core dump.
314− */
315−int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs)
316−{
317− elf_core_copy_regs(elfregs, task_pt_regs(t));
318− return 1;
319−}
320−
321−/*
322− * fill in the fpe structure for a core dump...
323− */
324−int dump_fpu (struct pt_regs *regs, struct user_fp *fp)
325−{
326− return 0;
327−}
328−EXPORT_SYMBOL(dump_fpu);
329−
330312 /*
331313 * Shuffle the argument into the correct register before calling the
332314 * thread function. x1 is the thread argument, x2 is the pointer to
arch/arm64/kernel/smp.c+1−2
@@ -211,8 +211,7 @@ asmlinkage void __cpuinit secondary_start_kernel(void) · 210 unmodified lines
211211 * before we continue.
212212 */
213213 set_cpu_online(cpu, true);
214− while (!cpu_active(cpu))
215− cpu_relax();
214+ complete(&cpu_running);
216215
217216 /*
218217 * OK, it's off to the idle thread for us
arch/arm64/mm/init.c+1−1
@@ -80,7 +80,7 @@ static void __init zone_sizes_init(unsigned long min, unsigned long max) · 79 unmodified lines
8080 #ifdef CONFIG_ZONE_DMA32
8181 /* 4GB maximum for 32-bit only capable devices */
8282 max_dma32 = min(max, MAX_DMA32_PFN);
83− zone_size[ZONE_DMA32] = max_dma32 - min;
83+ zone_size[ZONE_DMA32] = max(min, max_dma32) - min;
8484 #endif
8585 zone_size[ZONE_NORMAL] = max - max_dma32;
8686
arch/frv/Kconfig+1−0
@@ -13,6 +13,7 @@ config FRV · 12 unmodified lines
1313 select GENERIC_CPU_DEVICES
1414 select ARCH_WANT_IPC_PARSE_VERSION
1515 select GENERIC_KERNEL_THREAD
16+ select GENERIC_KERNEL_EXECVE
1617
1718 config ZONE_DMA
1819 bool
arch/frv/boot/Makefile+6−4
@@ -17,6 +17,8 @@ PARAMS_PHYS = 0x0207c000 · 16 unmodified lines
1717 INITRD_PHYS = 0x02180000
1818 INITRD_VIRT = 0x02180000
1919
20+OBJCOPYFLAGS :=-O binary -R .note -R .note.gnu.build-id -R .comment
21+
2022 #
2123 # If you don't define ZRELADDR above,
2224 # then it defaults to ZTEXTADDR
@@ -32,18 +34,18 @@ Image: $(obj)/Image · 9 unmodified lines
3234 targets: $(obj)/Image
3335
3436 $(obj)/Image: vmlinux FORCE
35− $(OBJCOPY) -O binary -R .note -R .comment -S vmlinux $@
37+ $(OBJCOPY) $(OBJCOPYFLAGS) -S vmlinux $@
3638
3739 #$(obj)/Image: $(CONFIGURE) $(SYSTEM)
38−# $(OBJCOPY) -O binary -R .note -R .comment -g -S $(SYSTEM) $@
40+# $(OBJCOPY) $(OBJCOPYFLAGS) -g -S $(SYSTEM) $@
3941
4042 bzImage: zImage
4143
4244 zImage: $(CONFIGURE) compressed/$(LINUX)
43− $(OBJCOPY) -O binary -R .note -R .comment -S compressed/$(LINUX) $@
45+ $(OBJCOPY) $(OBJCOPYFLAGS) -S compressed/$(LINUX) $@
4446
4547 bootpImage: bootp/bootp
46− $(OBJCOPY) -O binary -R .note -R .comment -S bootp/bootp $@
48+ $(OBJCOPY) $(OBJCOPYFLAGS) -S bootp/bootp $@
4749
4850 compressed/$(LINUX): $(LINUX) dep
4951 @$(MAKE) -C compressed $(LINUX)
arch/frv/include/asm/unistd.h+0−1
@@ -30,7 +30,6 @@ · 29 unmodified lines
3030 #define __ARCH_WANT_SYS_RT_SIGACTION
3131 #define __ARCH_WANT_SYS_RT_SIGSUSPEND
3232 #define __ARCH_WANT_SYS_EXECVE
33−#define __ARCH_WANT_KERNEL_EXECVE
3433
3534 /*
3635 * "Conditional" syscalls
arch/frv/kernel/entry.S+3−25
@@ -869,11 +869,6 @@ ret_from_kernel_thread: · 868 unmodified lines
869869 call schedule_tail
870870 calll.p @(gr21,gr0)
871871 or gr20,gr20,gr8
872− bra sys_exit
873−
874− .globl ret_from_kernel_execve
875−ret_from_kernel_execve:
876− ori gr28,0,sp
877872 bra __syscall_exit
878873
879874 ###################################################################################################
@@ -1080,27 +1075,10 @@ __entry_return_from_kernel_interrupt: · 200 unmodified lines
10801075 subicc gr5,#0,gr0,icc0
10811076 beq icc0,#0,__entry_return_direct
10821077
1083−__entry_preempt_need_resched:
1084− ldi @(gr15,#TI_FLAGS),gr4
1085− andicc gr4,#_TIF_NEED_RESCHED,gr0,icc0
1086− beq icc0,#1,__entry_return_direct
1087−
1088− setlos #PREEMPT_ACTIVE,gr5
1089− sti gr5,@(gr15,#TI_FLAGS)
1090−
1091− andi gr23,#~PSR_PIL,gr23
1092− movgs gr23,psr
1093−
1094− call schedule
1095− sti gr0,@(gr15,#TI_PRE_COUNT)
1096−
1097− movsg psr,gr23
1098− ori gr23,#PSR_PIL_14,gr23
1099− movgs gr23,psr
1100− bra __entry_preempt_need_resched
1101−#else
1102− bra __entry_return_direct
1078+ subcc gr0,gr0,gr0,icc2 /* set Z and clear C */
1079+ call preempt_schedule_irq
11031080 #endif
1081+ bra __entry_return_direct
11041082
11051083
11061084 ###############################################################################
arch/frv/kernel/process.c+3−2
@@ -181,6 +181,9 @@ int copy_thread(unsigned long clone_flags, · 180 unmodified lines
181181 childregs = (struct pt_regs *)
182182 (task_stack_page(p) + THREAD_SIZE - FRV_FRAME0_SIZE);
183183
184+ /* set up the userspace frame (the only place that the USP is stored) */
185+ *childregs = *__kernel_frame0_ptr;
186+
184187 p->set_child_tid = p->clear_child_tid = NULL;
185188
186189 p->thread.frame = childregs;
@@ -191,10 +194,8 @@ int copy_thread(unsigned long clone_flags, · 4 unmodified lines
191194 p->thread.frame0 = childregs;
192195
193196 if (unlikely(!regs)) {
194− memset(childregs, 0, sizeof(struct pt_regs));
195197 childregs->gr9 = usp; /* function */
196198 childregs->gr8 = arg;
197− childregs->psr = PSR_S;
198199 p->thread.pc = (unsigned long) ret_from_kernel_thread;
199200 save_user_regs(p->thread.user);
200201 return 0;
arch/frv/mb93090-mb00/pci-dma-nommu.c+1−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111
1212 #include <linux/types.h>
1313 #include <linux/slab.h>
14+#include <linux/export.h>
1415 #include <linux/dma-mapping.h>
1516 #include <linux/list.h>
1617 #include <linux/pci.h>
arch/h8300/include/asm/cache.h+2−1
@@ -2,7 +2,8 @@ · 1 unmodified line
22 #define __ARCH_H8300_CACHE_H
33
44 /* bytes per L1 cache line */
5−#define L1_CACHE_BYTES 4
5+#define L1_CACHE_SHIFT 2
6+#define L1_CACHE_BYTES (1 << L1_CACHE_SHIFT)
67
78 /* m68k-elf-gcc 2.95.2 doesn't like these */
89
arch/s390/include/asm/cio.h+2−0
@@ -9,6 +9,8 @@ · 8 unmodified lines
99
1010 #define LPM_ANYPATH 0xff
1111 #define __MAX_CSSID 0
12+#define __MAX_SUBCHANNEL 65535
13+#define __MAX_SSID 3
1214
1315 #include <asm/scsw.h>
1416
arch/s390/include/asm/pgtable.h+22−13
@@ -506,12 +506,15 @@ static inline int pud_bad(pud_t pud) · 505 unmodified lines
506506
507507 static inline int pmd_present(pmd_t pmd)
508508 {
509− return (pmd_val(pmd) & _SEGMENT_ENTRY_ORIGIN) != 0UL;
509+ unsigned long mask = _SEGMENT_ENTRY_INV | _SEGMENT_ENTRY_RO;
510+ return (pmd_val(pmd) & mask) == _HPAGE_TYPE_NONE ||
511+ !(pmd_val(pmd) & _SEGMENT_ENTRY_INV);
510512 }
511513
512514 static inline int pmd_none(pmd_t pmd)
513515 {
514− return (pmd_val(pmd) & _SEGMENT_ENTRY_INV) != 0UL;
516+ return (pmd_val(pmd) & _SEGMENT_ENTRY_INV) &&
517+ !(pmd_val(pmd) & _SEGMENT_ENTRY_RO);
515518 }
516519
517520 static inline int pmd_large(pmd_t pmd)
@@ -1223,6 +1226,11 @@ static inline void __pmd_idte(unsigned long address, pmd_t *pmdp) · 705 unmodified lines
12231226 }
12241227
12251228 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
1229+
1230+#define SEGMENT_NONE __pgprot(_HPAGE_TYPE_NONE)
1231+#define SEGMENT_RO __pgprot(_HPAGE_TYPE_RO)
1232+#define SEGMENT_RW __pgprot(_HPAGE_TYPE_RW)
1233+
12261234 #define __HAVE_ARCH_PGTABLE_DEPOSIT
12271235 extern void pgtable_trans_huge_deposit(struct mm_struct *mm, pgtable_t pgtable);
12281236
@@ -1242,16 +1250,15 @@ static inline void set_pmd_at(struct mm_struct *mm, unsigned long addr, · 13 unmodified lines
12421250
12431251 static inline unsigned long massage_pgprot_pmd(pgprot_t pgprot)
12441252 {
1245− unsigned long pgprot_pmd = 0;
1246−
1247− if (pgprot_val(pgprot) & _PAGE_INVALID) {
1248− if (pgprot_val(pgprot) & _PAGE_SWT)
1249− pgprot_pmd |= _HPAGE_TYPE_NONE;
1250− pgprot_pmd |= _SEGMENT_ENTRY_INV;
1251− }
1252− if (pgprot_val(pgprot) & _PAGE_RO)
1253− pgprot_pmd |= _SEGMENT_ENTRY_RO;
1254− return pgprot_pmd;
1253+ /*
1254+ * pgprot is PAGE_NONE, PAGE_RO, or PAGE_RW (see __Pxxx / __Sxxx)
1255+ * Convert to segment table entry format.
1256+ */
1257+ if (pgprot_val(pgprot) == pgprot_val(PAGE_NONE))
1258+ return pgprot_val(SEGMENT_NONE);
1259+ if (pgprot_val(pgprot) == pgprot_val(PAGE_RO))
1260+ return pgprot_val(SEGMENT_RO);
1261+ return pgprot_val(SEGMENT_RW);
12551262 }
12561263
12571264 static inline pmd_t pmd_modify(pmd_t pmd, pgprot_t newprot)
@@ -1269,7 +1276,9 @@ static inline pmd_t pmd_mkhuge(pmd_t pmd) · 11 unmodified lines
12691276
12701277 static inline pmd_t pmd_mkwrite(pmd_t pmd)
12711278 {
1272− pmd_val(pmd) &= ~_SEGMENT_ENTRY_RO;
1279+ /* Do not clobber _HPAGE_TYPE_NONE pages! */
1280+ if (!(pmd_val(pmd) & _SEGMENT_ENTRY_INV))
1281+ pmd_val(pmd) &= ~_SEGMENT_ENTRY_RO;
12731282 return pmd;
12741283 }
12751284
arch/s390/kernel/sclp.S+7−1
@@ -44,6 +44,12 @@ _sclp_wait_int: · 43 unmodified lines
4444 #endif
4545 mvc .LoldpswS1-.LbaseS1(16,%r13),0(%r8)
4646 mvc 0(16,%r8),0(%r9)
47+#ifdef CONFIG_64BIT
48+ epsw %r6,%r7 # set current addressing mode
49+ nill %r6,0x1 # in new psw (31 or 64 bit mode)
50+ nilh %r7,0x8000
51+ stm %r6,%r7,0(%r8)
52+#endif
4753 lhi %r6,0x0200 # cr mask for ext int (cr0.54)
4854 ltr %r2,%r2
4955 jz .LsetctS1
@@ -87,7 +93,7 @@ _sclp_wait_int: · 37 unmodified lines
8793 .long 0x00080000, 0x80000000+.LwaitS1 # PSW to handle ext int
8894 #ifdef CONFIG_64BIT
8995 .LextpswS1_64:
90− .quad 0x0000000180000000, .LwaitS1 # PSW to handle ext int, 64 bit
96+ .quad 0, .LwaitS1 # PSW to handle ext int, 64 bit
9197 #endif
9298 .LwaitpswS1:
9399 .long 0x010a0000, 0x00000000+.LloopS1 # PSW to wait for ext int
arch/s390/lib/uaccess_pt.c+1−1
@@ -39,7 +39,7 @@ static __always_inline unsigned long follow_table(struct mm_struct *mm, · 38 unmodified lines
3939 pmd = pmd_offset(pud, addr);
4040 if (pmd_none(*pmd))
4141 return -0x10UL;
42− if (pmd_huge(*pmd)) {
42+ if (pmd_large(*pmd)) {
4343 if (write && (pmd_val(*pmd) & _SEGMENT_ENTRY_RO))
4444 return -0x04UL;
4545 return (pmd_val(*pmd) & HPAGE_MASK) + (addr & ~HPAGE_MASK);
arch/s390/mm/gup.c+1−1
@@ -126,7 +126,7 @@ static inline int gup_pmd_range(pud_t *pudp, pud_t pud, unsigned long addr, · 125 unmodified lines
126126 */
127127 if (pmd_none(pmd) || pmd_trans_splitting(pmd))
128128 return 0;
129− if (unlikely(pmd_huge(pmd))) {
129+ if (unlikely(pmd_large(pmd))) {
130130 if (!gup_huge_pmd(pmdp, pmd, addr, next,
131131 write, pages, nr))
132132 return 0;
arch/sparc/Kconfig+1−0
@@ -20,6 +20,7 @@ config SPARC · 19 unmodified lines
2020 select HAVE_ARCH_TRACEHOOK
2121 select SYSCTL_EXCEPTION_TRACE
2222 select ARCH_WANT_OPTIONAL_GPIOLIB
23+ select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
2324 select RTC_CLASS
2425 select RTC_DRV_M48T59
2526 select HAVE_IRQ_WORK
arch/sparc/crypto/Makefile+8−8
@@ -13,13 +13,13 @@ obj-$(CONFIG_CRYPTO_DES_SPARC64) += camellia-sparc64.o · 12 unmodified lines
1313
1414 obj-$(CONFIG_CRYPTO_CRC32C_SPARC64) += crc32c-sparc64.o
1515
16−sha1-sparc64-y := sha1_asm.o sha1_glue.o crop_devid.o
17−sha256-sparc64-y := sha256_asm.o sha256_glue.o crop_devid.o
18−sha512-sparc64-y := sha512_asm.o sha512_glue.o crop_devid.o
19−md5-sparc64-y := md5_asm.o md5_glue.o crop_devid.o
16+sha1-sparc64-y := sha1_asm.o sha1_glue.o
17+sha256-sparc64-y := sha256_asm.o sha256_glue.o
18+sha512-sparc64-y := sha512_asm.o sha512_glue.o
19+md5-sparc64-y := md5_asm.o md5_glue.o
2020
21−aes-sparc64-y := aes_asm.o aes_glue.o crop_devid.o
22−des-sparc64-y := des_asm.o des_glue.o crop_devid.o
23−camellia-sparc64-y := camellia_asm.o camellia_glue.o crop_devid.o
21+aes-sparc64-y := aes_asm.o aes_glue.o
22+des-sparc64-y := des_asm.o des_glue.o
23+camellia-sparc64-y := camellia_asm.o camellia_glue.o
2424
25−crc32c-sparc64-y := crc32c_asm.o crc32c_glue.o crop_devid.o
25+crc32c-sparc64-y := crc32c_asm.o crc32c_glue.o
arch/sparc/crypto/aes_glue.c+2−0
@@ -475,3 +475,5 @@ MODULE_LICENSE("GPL"); · 474 unmodified lines
475475 MODULE_DESCRIPTION("AES Secure Hash Algorithm, sparc64 aes opcode accelerated");
476476
477477 MODULE_ALIAS("aes");
478+
479+#include "crop_devid.c"
arch/sparc/crypto/camellia_glue.c+2−0
@@ -320,3 +320,5 @@ MODULE_LICENSE("GPL"); · 319 unmodified lines
320320 MODULE_DESCRIPTION("Camellia Cipher Algorithm, sparc64 camellia opcode accelerated");
321321
322322 MODULE_ALIAS("aes");
323+
324+#include "crop_devid.c"
arch/sparc/crypto/crc32c_glue.c+2−0
@@ -177,3 +177,5 @@ MODULE_LICENSE("GPL"); · 176 unmodified lines
177177 MODULE_DESCRIPTION("CRC32c (Castagnoli), sparc64 crc32c opcode accelerated");
178178
179179 MODULE_ALIAS("crc32c");
180+
181+#include "crop_devid.c"
arch/sparc/crypto/des_glue.c+2−0
@@ -527,3 +527,5 @@ MODULE_LICENSE("GPL"); · 526 unmodified lines
527527 MODULE_DESCRIPTION("DES & Triple DES EDE Cipher Algorithms, sparc64 des opcode accelerated");
528528
529529 MODULE_ALIAS("des");
530+
531+#include "crop_devid.c"
arch/sparc/crypto/md5_glue.c+2−0
@@ -186,3 +186,5 @@ MODULE_LICENSE("GPL"); · 185 unmodified lines
186186 MODULE_DESCRIPTION("MD5 Secure Hash Algorithm, sparc64 md5 opcode accelerated");
187187
188188 MODULE_ALIAS("md5");
189+
190+#include "crop_devid.c"
arch/sparc/crypto/sha1_glue.c+2−0
@@ -181,3 +181,5 @@ MODULE_LICENSE("GPL"); · 180 unmodified lines
181181 MODULE_DESCRIPTION("SHA1 Secure Hash Algorithm, sparc64 sha1 opcode accelerated");
182182
183183 MODULE_ALIAS("sha1");
184+
185+#include "crop_devid.c"
arch/sparc/crypto/sha256_glue.c+2−0
@@ -239,3 +239,5 @@ MODULE_DESCRIPTION("SHA-224 and SHA-256 Secure Hash Algorithm, sparc64 sha256 op · 238 unmodified lines
239239
240240 MODULE_ALIAS("sha224");
241241 MODULE_ALIAS("sha256");
242+
243+#include "crop_devid.c"
arch/sparc/crypto/sha512_glue.c+2−0
@@ -224,3 +224,5 @@ MODULE_DESCRIPTION("SHA-384 and SHA-512 Secure Hash Algorithm, sparc64 sha512 op · 223 unmodified lines
224224
225225 MODULE_ALIAS("sha384");
226226 MODULE_ALIAS("sha512");
227+
228+#include "crop_devid.c"
arch/sparc/include/asm/atomic_64.h+3−1
@@ -1,7 +1,7 @@
11 /* atomic.h: Thankfully the V9 is at least reasonable for this
22 * stuff.
33 *
4− * Copyright (C) 1996, 1997, 2000 David S. Miller (davem@redhat.com)
4+ * Copyright (C) 1996, 1997, 2000, 2012 David S. Miller (davem@redhat.com)
55 */
66
77 #ifndef __ARCH_SPARC64_ATOMIC__
@@ -106,6 +106,8 @@ static inline long atomic64_add_unless(atomic64_t *v, long a, long u) · 98 unmodified lines
106106
107107 #define atomic64_inc_not_zero(v) atomic64_add_unless((v), 1, 0)
108108
109+extern long atomic64_dec_if_positive(atomic64_t *v);
110+
109111 /* Atomic operations are already serializing */
110112 #define smp_mb__before_atomic_dec() barrier()
111113 #define smp_mb__after_atomic_dec() barrier()
arch/sparc/include/asm/backoff.h+59−10
@@ -1,6 +1,46 @@
11 #ifndef _SPARC64_BACKOFF_H
22 #define _SPARC64_BACKOFF_H
33
4+/* The macros in this file implement an exponential backoff facility
5+ * for atomic operations.
6+ *
7+ * When multiple threads compete on an atomic operation, it is
8+ * possible for one thread to be continually denied a successful
9+ * completion of the compare-and-swap instruction. Heavily
10+ * threaded cpu implementations like Niagara can compound this
11+ * problem even further.
12+ *
13+ * When an atomic operation fails and needs to be retried, we spin a
14+ * certain number of times. At each subsequent failure of the same
15+ * operation we double the spin count, realizing an exponential
16+ * backoff.
17+ *
18+ * When we spin, we try to use an operation that will cause the
19+ * current cpu strand to block, and therefore make the core fully
20+ * available to any other other runnable strands. There are two
21+ * options, based upon cpu capabilities.
22+ *
23+ * On all cpus prior to SPARC-T4 we do three dummy reads of the
24+ * condition code register. Each read blocks the strand for something
25+ * between 40 and 50 cpu cycles.
26+ *
27+ * For SPARC-T4 and later we have a special "pause" instruction
28+ * available. This is implemented using writes to register %asr27.
29+ * The cpu will block the number of cycles written into the register,
30+ * unless a disrupting trap happens first. SPARC-T4 specifically
31+ * implements pause with a granularity of 8 cycles. Each strand has
32+ * an internal pause counter which decrements every 8 cycles. So the
33+ * chip shifts the %asr27 value down by 3 bits, and writes the result
34+ * into the pause counter. If a value smaller than 8 is written, the
35+ * chip blocks for 1 cycle.
36+ *
37+ * To achieve the same amount of backoff as the three %ccr reads give
38+ * on earlier chips, we shift the backoff value up by 7 bits. (Three
39+ * %ccr reads block for about 128 cycles, 1 << 7 == 128) We write the
40+ * whole amount we want to block into the pause register, rather than
41+ * loop writing 128 each time.
42+ */
43+
444 #define BACKOFF_LIMIT (4 * 1024)
545
646 #ifdef CONFIG_SMP
@@ -11,16 +51,25 @@ · 4 unmodified lines
1151 #define BACKOFF_LABEL(spin_label, continue_label) \
1252 spin_label
1353
14−#define BACKOFF_SPIN(reg, tmp, label) \
15− mov reg, tmp; \
16−88: brnz,pt tmp, 88b; \
17− sub tmp, 1, tmp; \
18− set BACKOFF_LIMIT, tmp; \
19− cmp reg, tmp; \
20− bg,pn %xcc, label; \
21− nop; \
22− ba,pt %xcc, label; \
23− sllx reg, 1, reg;
54+#define BACKOFF_SPIN(reg, tmp, label) \
55+ mov reg, tmp; \
56+88: rd %ccr, %g0; \
57+ rd %ccr, %g0; \
58+ rd %ccr, %g0; \
59+ .section .pause_3insn_patch,"ax";\
60+ .word 88b; \
61+ sllx tmp, 7, tmp; \
62+ wr tmp, 0, %asr27; \
63+ clr tmp; \
64+ .previous; \
65+ brnz,pt tmp, 88b; \
66+ sub tmp, 1, tmp; \
67+ set BACKOFF_LIMIT, tmp; \
68+ cmp reg, tmp; \
69+ bg,pn %xcc, label; \
70+ nop; \
71+ ba,pt %xcc, label; \
72+ sllx reg, 1, reg;
2473
2574 #else
2675
arch/sparc/include/asm/compat.h+3−2
@@ -232,9 +232,10 @@ static inline void __user *arch_compat_alloc_user_space(long len) · 231 unmodified lines
232232 struct pt_regs *regs = current_thread_info()->kregs;
233233 unsigned long usp = regs->u_regs[UREG_I6];
234234
235− if (!(test_thread_flag(TIF_32BIT)))
235+ if (test_thread_64bit_stack(usp))
236236 usp += STACK_BIAS;
237− else
237+
238+ if (test_thread_flag(TIF_32BIT))
238239 usp &= 0xffffffffUL;
239240
240241 usp -= len;
arch/sparc/include/asm/processor_64.h+16−1
@@ -196,7 +196,22 @@ extern unsigned long get_wchan(struct task_struct *task); · 195 unmodified lines
196196 #define KSTK_EIP(tsk) (task_pt_regs(tsk)->tpc)
197197 #define KSTK_ESP(tsk) (task_pt_regs(tsk)->u_regs[UREG_FP])
198198
199−#define cpu_relax() barrier()
199+/* Please see the commentary in asm/backoff.h for a description of
200+ * what these instructions are doing and how they have been choosen.
201+ * To make a long story short, we are trying to yield the current cpu
202+ * strand during busy loops.
203+ */
204+#define cpu_relax() asm volatile("\n99:\n\t" \
205+ "rd %%ccr, %%g0\n\t" \
206+ "rd %%ccr, %%g0\n\t" \
207+ "rd %%ccr, %%g0\n\t" \
208+ ".section .pause_3insn_patch,\"ax\"\n\t"\
209+ ".word 99b\n\t" \
210+ "wr %%g0, 128, %%asr27\n\t" \
211+ "nop\n\t" \
212+ "nop\n\t" \
213+ ".previous" \
214+ ::: "memory")
200215
201216 /* Prefetch support. This is tuned for UltraSPARC-III and later.
202217 * UltraSPARC-I will treat these as nops, and UltraSPARC-II has
arch/sparc/include/asm/prom.h+5−0
@@ -63,5 +63,10 @@ extern char *of_console_options; · 62 unmodified lines
6363 extern void irq_trans_init(struct device_node *dp);
6464 extern char *build_path_component(struct device_node *dp);
6565
66+/* SPARC has a local implementation */
67+extern int of_address_to_resource(struct device_node *dev, int index,
68+ struct resource *r);
69+#define of_address_to_resource of_address_to_resource
70+
6671 #endif /* __KERNEL__ */
6772 #endif /* _SPARC_PROM_H */
arch/sparc/include/asm/thread_info_64.h+5−0
@@ -259,6 +259,11 @@ static inline bool test_and_clear_restore_sigmask(void) · 258 unmodified lines
259259
260260 #define tsk_is_polling(t) test_tsk_thread_flag(t, TIF_POLLING_NRFLAG)
261261
262+#define thread32_stack_is_64bit(__SP) (((__SP) & 0x1) != 0)
263+#define test_thread_64bit_stack(__SP) \
264+ ((test_thread_flag(TIF_32BIT) && !thread32_stack_is_64bit(__SP)) ? \
265+ false : true)
266+
262267 #endif /* !__ASSEMBLY__ */
263268
264269 #endif /* __KERNEL__ */
arch/sparc/include/asm/ttable.h+16−8
@@ -372,7 +372,9 @@ etrap_spill_fixup_64bit: \ · 371 unmodified lines
372372
373373 /* Normal 32bit spill */
374374 #define SPILL_2_GENERIC(ASI) \
375− srl %sp, 0, %sp; \
375+ and %sp, 1, %g3; \
376+ brnz,pn %g3, (. - (128 + 4)); \
377+ srl %sp, 0, %sp; \
376378 stwa %l0, [%sp + %g0] ASI; \
377379 mov 0x04, %g3; \
378380 stwa %l1, [%sp + %g3] ASI; \
@@ -398,14 +400,16 @@ etrap_spill_fixup_64bit: \ · 19 unmodified lines
398400 stwa %i6, [%g1 + %g0] ASI; \
399401 stwa %i7, [%g1 + %g3] ASI; \
400402 saved; \
401− retry; nop; nop; \
403+ retry; \
402404 b,a,pt %xcc, spill_fixup_dax; \
403405 b,a,pt %xcc, spill_fixup_mna; \
404406 b,a,pt %xcc, spill_fixup;
405407
406408 #define SPILL_2_GENERIC_ETRAP \
407409 etrap_user_spill_32bit: \
408− srl %sp, 0, %sp; \
410+ and %sp, 1, %g3; \
411+ brnz,pn %g3, etrap_user_spill_64bit; \
412+ srl %sp, 0, %sp; \
409413 stwa %l0, [%sp + 0x00] %asi; \
410414 stwa %l1, [%sp + 0x04] %asi; \
411415 stwa %l2, [%sp + 0x08] %asi; \
@@ -427,7 +431,7 @@ etrap_user_spill_32bit: \ · 15 unmodified lines
427431 ba,pt %xcc, etrap_save; \
428432 wrpr %g1, %cwp; \
429433 nop; nop; nop; nop; \
430− nop; nop; nop; nop; \
434+ nop; nop; \
431435 ba,a,pt %xcc, etrap_spill_fixup_32bit; \
432436 ba,a,pt %xcc, etrap_spill_fixup_32bit; \
433437 ba,a,pt %xcc, etrap_spill_fixup_32bit;
@@ -592,7 +596,9 @@ user_rtt_fill_64bit: \ · 158 unmodified lines
592596
593597 /* Normal 32bit fill */
594598 #define FILL_2_GENERIC(ASI) \
595− srl %sp, 0, %sp; \
599+ and %sp, 1, %g3; \
600+ brnz,pn %g3, (. - (128 + 4)); \
601+ srl %sp, 0, %sp; \
596602 lduwa [%sp + %g0] ASI, %l0; \
597603 mov 0x04, %g2; \
598604 mov 0x08, %g3; \
@@ -616,14 +622,16 @@ user_rtt_fill_64bit: \ · 17 unmodified lines
616622 lduwa [%g1 + %g3] ASI, %i6; \
617623 lduwa [%g1 + %g5] ASI, %i7; \
618624 restored; \
619− retry; nop; nop; nop; nop; \
625+ retry; nop; nop; \
620626 b,a,pt %xcc, fill_fixup_dax; \
621627 b,a,pt %xcc, fill_fixup_mna; \
622628 b,a,pt %xcc, fill_fixup;
623629
624630 #define FILL_2_GENERIC_RTRAP \
625631 user_rtt_fill_32bit: \
626− srl %sp, 0, %sp; \
632+ and %sp, 1, %g3; \
633+ brnz,pn %g3, user_rtt_fill_64bit; \
634+ srl %sp, 0, %sp; \
627635 lduwa [%sp + 0x00] %asi, %l0; \
628636 lduwa [%sp + 0x04] %asi, %l1; \
629637 lduwa [%sp + 0x08] %asi, %l2; \
@@ -643,7 +651,7 @@ user_rtt_fill_32bit: \ · 13 unmodified lines
643651 ba,pt %xcc, user_rtt_pre_restore; \
644652 restored; \
645653 nop; nop; nop; nop; nop; \
646− nop; nop; nop; nop; nop; \
654+ nop; nop; nop; \
647655 ba,a,pt %xcc, user_rtt_fill_fixup; \
648656 ba,a,pt %xcc, user_rtt_fill_fixup; \
649657 ba,a,pt %xcc, user_rtt_fill_fixup;
arch/sparc/include/uapi/asm/unistd.h+6−1
@@ -405,8 +405,13 @@ · 404 unmodified lines
405405 #define __NR_setns 337
406406 #define __NR_process_vm_readv 338
407407 #define __NR_process_vm_writev 339
408+#define __NR_kern_features 340
409+#define __NR_kcmp 341
408410
409−#define NR_syscalls 340
411+#define NR_syscalls 342
412+
413+/* Bitmask values returned from kern_features system call. */
414+#define KERN_FEATURE_MIXED_MODE_STACK 0x00000001
410415
411416 #ifdef __32bit_syscall_numbers__
412417 /* Sparc 32-bit only has the "setresuid32", "getresuid32" variants,
arch/sparc/kernel/entry.h+7−0
@@ -59,6 +59,13 @@ struct popc_6insn_patch_entry { · 58 unmodified lines
5959 extern struct popc_6insn_patch_entry __popc_6insn_patch,
6060 __popc_6insn_patch_end;
6161
62+struct pause_patch_entry {
63+ unsigned int addr;
64+ unsigned int insns[3];
65+};
66+extern struct pause_patch_entry __pause_3insn_patch,
67+ __pause_3insn_patch_end;
68+
6269 extern void __init per_cpu_patch(void);
6370 extern void sun4v_patch_1insn_range(struct sun4v_1insn_patch_entry *,
6471 struct sun4v_1insn_patch_entry *);
arch/sparc/kernel/leon_kernel.c+4−2
@@ -56,11 +56,13 @@ static inline unsigned int leon_eirq_get(int cpu) · 55 unmodified lines
5656 static void leon_handle_ext_irq(unsigned int irq, struct irq_desc *desc)
5757 {
5858 unsigned int eirq;
59+ struct irq_bucket *p;
5960 int cpu = sparc_leon3_cpuid();
6061
6162 eirq = leon_eirq_get(cpu);
62− if ((eirq & 0x10) && irq_map[eirq]->irq) /* bit4 tells if IRQ happened */
63− generic_handle_irq(irq_map[eirq]->irq);
63+ p = irq_map[eirq];
64+ if ((eirq & 0x10) && p && p->irq) /* bit4 tells if IRQ happened */
65+ generic_handle_irq(p->irq);
6466 }
6567
6668 /* The extended IRQ controller has been found, this function registers it */
arch/sparc/kernel/perf_event.c+16−6
@@ -1762,15 +1762,25 @@ static void perf_callchain_user_32(struct perf_callchain_entry *entry, · 1761 unmodified lines
17621762
17631763 ufp = regs->u_regs[UREG_I6] & 0xffffffffUL;
17641764 do {
1765− struct sparc_stackf32 *usf, sf;
17661765 unsigned long pc;
17671766
1768− usf = (struct sparc_stackf32 *) ufp;
1769− if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))
1770− break;
1767+ if (thread32_stack_is_64bit(ufp)) {
1768+ struct sparc_stackf *usf, sf;
17711769
1772− pc = sf.callers_pc;
1773− ufp = (unsigned long)sf.fp;
1770+ ufp += STACK_BIAS;
1771+ usf = (struct sparc_stackf *) ufp;
1772+ if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))
1773+ break;
1774+ pc = sf.callers_pc & 0xffffffff;
1775+ ufp = ((unsigned long) sf.fp) & 0xffffffff;
1776+ } else {
1777+ struct sparc_stackf32 *usf, sf;
1778+ usf = (struct sparc_stackf32 *) ufp;
1779+ if (__copy_from_user_inatomic(&sf, usf, sizeof(sf)))
1780+ break;
1781+ pc = sf.callers_pc;
1782+ ufp = (unsigned long)sf.fp;
1783+ }
17741784 perf_callchain_store(entry, pc);
17751785 } while (entry->nr < PERF_MAX_STACK_DEPTH);
17761786 }
arch/sparc/kernel/process_64.c+23−19
@@ -452,13 +452,16 @@ void flush_thread(void) · 451 unmodified lines
452452 /* It's a bit more tricky when 64-bit tasks are involved... */
453453 static unsigned long clone_stackframe(unsigned long csp, unsigned long psp)
454454 {
455+ bool stack_64bit = test_thread_64bit_stack(psp);
455456 unsigned long fp, distance, rval;
456457
457− if (!(test_thread_flag(TIF_32BIT))) {
458+ if (stack_64bit) {
458459 csp += STACK_BIAS;
459460 psp += STACK_BIAS;
460461 __get_user(fp, &(((struct reg_window __user *)psp)->ins[6]));
461462 fp += STACK_BIAS;
463+ if (test_thread_flag(TIF_32BIT))
464+ fp &= 0xffffffff;
462465 } else
463466 __get_user(fp, &(((struct reg_window32 __user *)psp)->ins[6]));
464467
@@ -472,7 +475,7 @@ static unsigned long clone_stackframe(unsigned long csp, unsigned long psp) · 7 unmodified lines
472475 rval = (csp - distance);
473476 if (copy_in_user((void __user *) rval, (void __user *) psp, distance))
474477 rval = 0;
475− else if (test_thread_flag(TIF_32BIT)) {
478+ else if (!stack_64bit) {
476479 if (put_user(((u32)csp),
477480 &(((struct reg_window32 __user *)rval)->ins[6])))
478481 rval = 0;
@@ -507,18 +510,18 @@ void synchronize_user_stack(void) · 28 unmodified lines
507510
508511 flush_user_windows();
509512 if ((window = get_thread_wsaved()) != 0) {
510− int winsize = sizeof(struct reg_window);
511− int bias = 0;
512−
513− if (test_thread_flag(TIF_32BIT))
514− winsize = sizeof(struct reg_window32);
515− else
516− bias = STACK_BIAS;
517−
518513 window -= 1;
519514 do {
520− unsigned long sp = (t->rwbuf_stkptrs[window] + bias);
521515 struct reg_window *rwin = &t->reg_window[window];
516+ int winsize = sizeof(struct reg_window);
517+ unsigned long sp;
518+
519+ sp = t->rwbuf_stkptrs[window];
520+
521+ if (test_thread_64bit_stack(sp))
522+ sp += STACK_BIAS;
523+ else
524+ winsize = sizeof(struct reg_window32);
522525
523526 if (!copy_to_user((char __user *)sp, rwin, winsize)) {
524527 shift_window_buffer(window, get_thread_wsaved() - 1, t);
@@ -544,13 +547,6 @@ void fault_in_user_windows(void) · 19 unmodified lines
544547 {
545548 struct thread_info *t = current_thread_info();
546549 unsigned long window;
547− int winsize = sizeof(struct reg_window);
548− int bias = 0;
549−
550− if (test_thread_flag(TIF_32BIT))
551− winsize = sizeof(struct reg_window32);
552− else
553− bias = STACK_BIAS;
554550
555551 flush_user_windows();
556552 window = get_thread_wsaved();
@@ -558,8 +554,16 @@ void fault_in_user_windows(void) · 1 unmodified line
558554 if (likely(window != 0)) {
559555 window -= 1;
560556 do {
561− unsigned long sp = (t->rwbuf_stkptrs[window] + bias);
562557 struct reg_window *rwin = &t->reg_window[window];
558+ int winsize = sizeof(struct reg_window);
559+ unsigned long sp;
560+
561+ sp = t->rwbuf_stkptrs[window];
562+
563+ if (test_thread_64bit_stack(sp))
564+ sp += STACK_BIAS;
565+ else
566+ winsize = sizeof(struct reg_window32);
563567
564568 if (unlikely(sp & 0x7UL))
565569 stack_unaligned(sp);
arch/sparc/kernel/ptrace_64.c+2−2
@@ -151,7 +151,7 @@ static int regwindow64_get(struct task_struct *target, · 150 unmodified lines
151151 {
152152 unsigned long rw_addr = regs->u_regs[UREG_I6];
153153
154− if (test_tsk_thread_flag(current, TIF_32BIT)) {
154+ if (!test_thread_64bit_stack(rw_addr)) {
155155 struct reg_window32 win32;
156156 int i;
157157
@@ -176,7 +176,7 @@ static int regwindow64_set(struct task_struct *target, · 18 unmodified lines
176176 {
177177 unsigned long rw_addr = regs->u_regs[UREG_I6];
178178
179− if (test_tsk_thread_flag(current, TIF_32BIT)) {
179+ if (!test_thread_64bit_stack(rw_addr)) {
180180 struct reg_window32 win32;
181181 int i;
182182
arch/sparc/kernel/setup_64.c+21−0
@@ -316,6 +316,25 @@ static void __init popc_patch(void) · 315 unmodified lines
316316 }
317317 }
318318
319+static void __init pause_patch(void)
320+{
321+ struct pause_patch_entry *p;
322+
323+ p = &__pause_3insn_patch;
324+ while (p < &__pause_3insn_patch_end) {
325+ unsigned long i, addr = p->addr;
326+
327+ for (i = 0; i < 3; i++) {
328+ *(unsigned int *) (addr + (i * 4)) = p->insns[i];
329+ wmb();
330+ __asm__ __volatile__("flush %0"
331+ : : "r" (addr + (i * 4)));
332+ }
333+
334+ p++;
335+ }
336+}
337+
319338 #ifdef CONFIG_SMP
320339 void __init boot_cpu_id_too_large(int cpu)
321340 {
@@ -528,6 +547,8 @@ static void __init init_sparc64_elf_hwcap(void) · 206 unmodified lines
528547
529548 if (sparc64_elf_hwcap & AV_SPARC_POPC)
530549 popc_patch();
550+ if (sparc64_elf_hwcap & AV_SPARC_PAUSE)
551+ pause_patch();
531552 }
532553
533554 void __init setup_arch(char **cmdline_p)
arch/sparc/kernel/sys_sparc_64.c+5−0
@@ -751,3 +751,8 @@ int kernel_execve(const char *filename, · 750 unmodified lines
751751 : "cc");
752752 return __res;
753753 }
754+
755+asmlinkage long sys_kern_features(void)
756+{
757+ return KERN_FEATURE_MIXED_MODE_STACK;
758+}
arch/sparc/kernel/systbls_32.S+1−0
@@ -85,3 +85,4 @@ sys_call_table: · 84 unmodified lines
8585 /*325*/ .long sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init
8686 /*330*/ .long sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime
8787 /*335*/ .long sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev
88+/*340*/ .long sys_ni_syscall, sys_kcmp
arch/sparc/kernel/systbls_64.S+2−0
@@ -86,6 +86,7 @@ sys_call_table32: · 85 unmodified lines
8686 .word compat_sys_pwritev, compat_sys_rt_tgsigqueueinfo, sys_perf_event_open, compat_sys_recvmmsg, sys_fanotify_init
8787 /*330*/ .word sys32_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, compat_sys_open_by_handle_at, compat_sys_clock_adjtime
8888 .word sys_syncfs, compat_sys_sendmmsg, sys_setns, compat_sys_process_vm_readv, compat_sys_process_vm_writev
89+/*340*/ .word sys_kern_features, sys_kcmp
8990
9091 #endif /* CONFIG_COMPAT */
9192
@@ -163,3 +164,4 @@ sys_call_table: · 71 unmodified lines
163164 .word sys_pwritev, sys_rt_tgsigqueueinfo, sys_perf_event_open, sys_recvmmsg, sys_fanotify_init
164165 /*330*/ .word sys_fanotify_mark, sys_prlimit64, sys_name_to_handle_at, sys_open_by_handle_at, sys_clock_adjtime
165166 .word sys_syncfs, sys_sendmmsg, sys_setns, sys_process_vm_readv, sys_process_vm_writev
167+/*340*/ .word sys_kern_features, sys_kcmp
arch/sparc/kernel/unaligned_64.c+23−13
@@ -113,21 +113,24 @@ static inline long sign_extend_imm13(long imm) · 112 unmodified lines
113113
114114 static unsigned long fetch_reg(unsigned int reg, struct pt_regs *regs)
115115 {
116− unsigned long value;
116+ unsigned long value, fp;
117117
118118 if (reg < 16)
119119 return (!reg ? 0 : regs->u_regs[reg]);
120+
121+ fp = regs->u_regs[UREG_FP];
122+
120123 if (regs->tstate & TSTATE_PRIV) {
121124 struct reg_window *win;
122− win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS);
125+ win = (struct reg_window *)(fp + STACK_BIAS);
123126 value = win->locals[reg - 16];
124− } else if (test_thread_flag(TIF_32BIT)) {
127+ } else if (!test_thread_64bit_stack(fp)) {
125128 struct reg_window32 __user *win32;
126− win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
129+ win32 = (struct reg_window32 __user *)((unsigned long)((u32)fp));
127130 get_user(value, &win32->locals[reg - 16]);
128131 } else {
129132 struct reg_window __user *win;
130− win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS);
133+ win = (struct reg_window __user *)(fp + STACK_BIAS);
131134 get_user(value, &win->locals[reg - 16]);
132135 }
133136 return value;
@@ -135,19 +138,24 @@ static unsigned long fetch_reg(unsigned int reg, struct pt_regs *regs) · 1 unmodified line
135138
136139 static unsigned long *fetch_reg_addr(unsigned int reg, struct pt_regs *regs)
137140 {
141+ unsigned long fp;
142+
138143 if (reg < 16)
139144 return &regs->u_regs[reg];
145+
146+ fp = regs->u_regs[UREG_FP];
147+
140148 if (regs->tstate & TSTATE_PRIV) {
141149 struct reg_window *win;
142− win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS);
150+ win = (struct reg_window *)(fp + STACK_BIAS);
143151 return &win->locals[reg - 16];
144− } else if (test_thread_flag(TIF_32BIT)) {
152+ } else if (!test_thread_64bit_stack(fp)) {
145153 struct reg_window32 *win32;
146− win32 = (struct reg_window32 *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
154+ win32 = (struct reg_window32 *)((unsigned long)((u32)fp));
147155 return (unsigned long *)&win32->locals[reg - 16];
148156 } else {
149157 struct reg_window *win;
150− win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS);
158+ win = (struct reg_window *)(fp + STACK_BIAS);
151159 return &win->locals[reg - 16];
152160 }
153161 }
@@ -392,13 +400,15 @@ int handle_popc(u32 insn, struct pt_regs *regs) · 238 unmodified lines
392400 if (rd)
393401 regs->u_regs[rd] = ret;
394402 } else {
395− if (test_thread_flag(TIF_32BIT)) {
403+ unsigned long fp = regs->u_regs[UREG_FP];
404+
405+ if (!test_thread_64bit_stack(fp)) {
396406 struct reg_window32 __user *win32;
397− win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
407+ win32 = (struct reg_window32 __user *)((unsigned long)((u32)fp));
398408 put_user(ret, &win32->locals[rd - 16]);
399409 } else {
400410 struct reg_window __user *win;
401− win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS);
411+ win = (struct reg_window __user *)(fp + STACK_BIAS);
402412 put_user(ret, &win->locals[rd - 16]);
403413 }
404414 }
@@ -554,7 +564,7 @@ void handle_ld_nf(u32 insn, struct pt_regs *regs) · 149 unmodified lines
554564 reg[0] = 0;
555565 if ((insn & 0x780000) == 0x180000)
556566 reg[1] = 0;
557− } else if (test_thread_flag(TIF_32BIT)) {
567+ } else if (!test_thread_64bit_stack(regs->u_regs[UREG_FP])) {
558568 put_user(0, (int __user *) reg);
559569 if ((insn & 0x780000) == 0x180000)
560570 put_user(0, ((int __user *) reg) + 1);
arch/sparc/kernel/visemul.c+14−9
@@ -149,21 +149,24 @@ static inline void maybe_flush_windows(unsigned int rs1, unsigned int rs2, · 148 unmodified lines
149149
150150 static unsigned long fetch_reg(unsigned int reg, struct pt_regs *regs)
151151 {
152− unsigned long value;
152+ unsigned long value, fp;
153153
154154 if (reg < 16)
155155 return (!reg ? 0 : regs->u_regs[reg]);
156+
157+ fp = regs->u_regs[UREG_FP];
158+
156159 if (regs->tstate & TSTATE_PRIV) {
157160 struct reg_window *win;
158− win = (struct reg_window *)(regs->u_regs[UREG_FP] + STACK_BIAS);
161+ win = (struct reg_window *)(fp + STACK_BIAS);
159162 value = win->locals[reg - 16];
160− } else if (test_thread_flag(TIF_32BIT)) {
163+ } else if (!test_thread_64bit_stack(fp)) {
161164 struct reg_window32 __user *win32;
162− win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
165+ win32 = (struct reg_window32 __user *)((unsigned long)((u32)fp));
163166 get_user(value, &win32->locals[reg - 16]);
164167 } else {
165168 struct reg_window __user *win;
166− win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS);
169+ win = (struct reg_window __user *)(fp + STACK_BIAS);
167170 get_user(value, &win->locals[reg - 16]);
168171 }
169172 return value;
@@ -172,16 +175,18 @@ static unsigned long fetch_reg(unsigned int reg, struct pt_regs *regs) · 2 unmodified lines
172175 static inline unsigned long __user *__fetch_reg_addr_user(unsigned int reg,
173176 struct pt_regs *regs)
174177 {
178+ unsigned long fp = regs->u_regs[UREG_FP];
179+
175180 BUG_ON(reg < 16);
176181 BUG_ON(regs->tstate & TSTATE_PRIV);
177182
178− if (test_thread_flag(TIF_32BIT)) {
183+ if (!test_thread_64bit_stack(fp)) {
179184 struct reg_window32 __user *win32;
180− win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
185+ win32 = (struct reg_window32 __user *)((unsigned long)((u32)fp));
181186 return (unsigned long __user *)&win32->locals[reg - 16];
182187 } else {
183188 struct reg_window __user *win;
184− win = (struct reg_window __user *)(regs->u_regs[UREG_FP] + STACK_BIAS);
189+ win = (struct reg_window __user *)(fp + STACK_BIAS);
185190 return &win->locals[reg - 16];
186191 }
187192 }
@@ -204,7 +209,7 @@ static void store_reg(struct pt_regs *regs, unsigned long val, unsigned long rd) · 16 unmodified lines
204209 } else {
205210 unsigned long __user *rd_user = __fetch_reg_addr_user(rd, regs);
206211
207− if (test_thread_flag(TIF_32BIT))
212+ if (!test_thread_64bit_stack(regs->u_regs[UREG_FP]))
208213 __put_user((u32)val, (u32 __user *)rd_user);
209214 else
210215 __put_user(val, rd_user);
arch/sparc/kernel/vmlinux.lds.S+5−0
@@ -132,6 +132,11 @@ SECTIONS · 131 unmodified lines
132132 *(.popc_6insn_patch)
133133 __popc_6insn_patch_end = .;
134134 }
135+ .pause_3insn_patch : {
136+ __pause_3insn_patch = .;
137+ *(.pause_3insn_patch)
138+ __pause_3insn_patch_end = .;
139+ }
135140 PERCPU_SECTION(SMP_CACHE_BYTES)
136141
137142 . = ALIGN(PAGE_SIZE);
arch/sparc/kernel/winfixup.S+2−0
@@ -43,6 +43,8 @@ spill_fixup_mna: · 42 unmodified lines
4343 spill_fixup_dax:
4444 TRAP_LOAD_THREAD_REG(%g6, %g1)
4545 ldx [%g6 + TI_FLAGS], %g1
46+ andcc %sp, 0x1, %g0
47+ movne %icc, 0, %g1
4648 andcc %g1, _TIF_32BIT, %g0
4749 ldub [%g6 + TI_WSAVED], %g1
4850 sll %g1, 3, %g3
arch/sparc/lib/atomic_64.S+15−1
@@ -1,6 +1,6 @@
11 /* atomic.S: These things are too big to do inline.
22 *
3− * Copyright (C) 1999, 2007 David S. Miller (davem@davemloft.net)
3+ * Copyright (C) 1999, 2007 2012 David S. Miller (davem@davemloft.net)
44 */
55
66 #include <linux/linkage.h>
@@ -117,3 +117,17 @@ ENTRY(atomic64_sub_ret) /* %o0 = decrement, %o1 = atomic_ptr */ · 110 unmodified lines
117117 sub %g1, %o0, %o0
118118 2: BACKOFF_SPIN(%o2, %o3, 1b)
119119 ENDPROC(atomic64_sub_ret)
120+
121+ENTRY(atomic64_dec_if_positive) /* %o0 = atomic_ptr */
122+ BACKOFF_SETUP(%o2)
123+1: ldx [%o0], %g1
124+ brlez,pn %g1, 3f
125+ sub %g1, 1, %g7
126+ casx [%o0], %g1, %g7
127+ cmp %g1, %g7
128+ bne,pn %xcc, BACKOFF_LABEL(2f, 1b)
129+ nop
130+3: retl
131+ sub %g1, 1, %o0
132+2: BACKOFF_SPIN(%o2, %o3, 1b)
133+ENDPROC(atomic64_dec_if_positive)
arch/sparc/lib/ksyms.c+1−0
@@ -116,6 +116,7 @@ EXPORT_SYMBOL(atomic64_add); · 115 unmodified lines
116116 EXPORT_SYMBOL(atomic64_add_ret);
117117 EXPORT_SYMBOL(atomic64_sub);
118118 EXPORT_SYMBOL(atomic64_sub_ret);
119+EXPORT_SYMBOL(atomic64_dec_if_positive);
119120
120121 /* Atomic bit operations. */
121122 EXPORT_SYMBOL(test_and_set_bit);
arch/sparc/math-emu/math_64.c+1−1
@@ -320,7 +320,7 @@ int do_mathemu(struct pt_regs *regs, struct fpustate *f, bool illegal_insn_trap) · 319 unmodified lines
320320 XR = 0;
321321 else if (freg < 16)
322322 XR = regs->u_regs[freg];
323− else if (test_thread_flag(TIF_32BIT)) {
323+ else if (!test_thread_64bit_stack(regs->u_regs[UREG_FP])) {
324324 struct reg_window32 __user *win32;
325325 flushw_user ();
326326 win32 = (struct reg_window32 __user *)((unsigned long)((u32)regs->u_regs[UREG_FP]));
arch/x86/include/asm/xen/hypercall.h+7−14
@@ -359,18 +359,14 @@ HYPERVISOR_update_va_mapping(unsigned long va, pte_t new_val, · 358 unmodified lines
359359 return _hypercall4(int, update_va_mapping, va,
360360 new_val.pte, new_val.pte >> 32, flags);
361361 }
362+extern int __must_check xen_event_channel_op_compat(int, void *);
362363
363364 static inline int
364365 HYPERVISOR_event_channel_op(int cmd, void *arg)
365366 {
366367 int rc = _hypercall2(int, event_channel_op, cmd, arg);
367− if (unlikely(rc == -ENOSYS)) {
368− struct evtchn_op op;
369− op.cmd = cmd;
370− memcpy(&op.u, arg, sizeof(op.u));
371− rc = _hypercall1(int, event_channel_op_compat, &op);
372− memcpy(arg, &op.u, sizeof(op.u));
373− }
368+ if (unlikely(rc == -ENOSYS))
369+ rc = xen_event_channel_op_compat(cmd, arg);
374370 return rc;
375371 }
376372
@@ -386,17 +382,14 @@ HYPERVISOR_console_io(int cmd, int count, char *str) · 9 unmodified lines
386382 return _hypercall3(int, console_io, cmd, count, str);
387383 }
388384
385+extern int __must_check HYPERVISOR_physdev_op_compat(int, void *);
386+
389387 static inline int
390388 HYPERVISOR_physdev_op(int cmd, void *arg)
391389 {
392390 int rc = _hypercall2(int, physdev_op, cmd, arg);
393− if (unlikely(rc == -ENOSYS)) {
394− struct physdev_op op;
395− op.cmd = cmd;
396− memcpy(&op.u, arg, sizeof(op.u));
397− rc = _hypercall1(int, physdev_op_compat, &op);
398− memcpy(arg, &op.u, sizeof(op.u));
399− }
391+ if (unlikely(rc == -ENOSYS))
392+ rc = HYPERVISOR_physdev_op_compat(cmd, arg);
400393 return rc;
401394 }
402395
arch/x86/include/asm/xen/hypervisor.h+0−1
@@ -33,7 +33,6 @@ · 32 unmodified lines
3333 #ifndef _ASM_X86_XEN_HYPERVISOR_H
3434 #define _ASM_X86_XEN_HYPERVISOR_H
3535
36−/* arch/i386/kernel/setup.c */
3736 extern struct shared_info *HYPERVISOR_shared_info;
3837 extern struct start_info *xen_start_info;
3938
arch/x86/kvm/x86.c+34−26
@@ -3779,7 +3779,7 @@ static int write_exit_mmio(struct kvm_vcpu *vcpu, gpa_t gpa, · 3778 unmodified lines
37793779 {
37803780 struct kvm_mmio_fragment *frag = &vcpu->mmio_fragments[0];
37813781
3782− memcpy(vcpu->run->mmio.data, frag->data, frag->len);
3782+ memcpy(vcpu->run->mmio.data, frag->data, min(8u, frag->len));
37833783 return X86EMUL_CONTINUE;
37843784 }
37853785
@@ -3832,18 +3832,11 @@ mmio: · 46 unmodified lines
38323832 bytes -= handled;
38333833 val += handled;
38343834
3835− while (bytes) {
3836− unsigned now = min(bytes, 8U);
3837−
3838− frag = &vcpu->mmio_fragments[vcpu->mmio_nr_fragments++];
3839− frag->gpa = gpa;
3840− frag->data = val;
3841− frag->len = now;
3842−
3843− gpa += now;
3844− val += now;
3845− bytes -= now;
3846− }
3835+ WARN_ON(vcpu->mmio_nr_fragments >= KVM_MAX_MMIO_FRAGMENTS);
3836+ frag = &vcpu->mmio_fragments[vcpu->mmio_nr_fragments++];
3837+ frag->gpa = gpa;
3838+ frag->data = val;
3839+ frag->len = bytes;
38473840 return X86EMUL_CONTINUE;
38483841 }
38493842
@@ -3890,7 +3883,7 @@ int emulator_read_write(struct x86_emulate_ctxt *ctxt, unsigned long addr, · 40 unmodified lines
38903883 vcpu->mmio_needed = 1;
38913884 vcpu->mmio_cur_fragment = 0;
38923885
3893− vcpu->run->mmio.len = vcpu->mmio_fragments[0].len;
3886+ vcpu->run->mmio.len = min(8u, vcpu->mmio_fragments[0].len);
38943887 vcpu->run->mmio.is_write = vcpu->mmio_is_write = ops->write;
38953888 vcpu->run->exit_reason = KVM_EXIT_MMIO;
38963889 vcpu->run->mmio.phys_addr = gpa;
@@ -5522,28 +5515,44 @@ static int complete_emulated_pio(struct kvm_vcpu *vcpu) · 1625 unmodified lines
55225515 *
55235516 * read:
55245517 * for each fragment
5525− * write gpa, len
5526− * exit
5527− * copy data
5518+ * for each mmio piece in the fragment
5519+ * write gpa, len
5520+ * exit
5521+ * copy data
55285522 * execute insn
55295523 *
55305524 * write:
55315525 * for each fragment
5532− * write gpa, len
5533− * copy data
5534− * exit
5526+ * for each mmio piece in the fragment
5527+ * write gpa, len
5528+ * copy data
5529+ * exit
55355530 */
55365531 static int complete_emulated_mmio(struct kvm_vcpu *vcpu)
55375532 {
55385533 struct kvm_run *run = vcpu->run;
55395534 struct kvm_mmio_fragment *frag;
5535+ unsigned len;
55405536
55415537 BUG_ON(!vcpu->mmio_needed);
55425538
55435539 /* Complete previous fragment */
5544− frag = &vcpu->mmio_fragments[vcpu->mmio_cur_fragment++];
5540+ frag = &vcpu->mmio_fragments[vcpu->mmio_cur_fragment];
5541+ len = min(8u, frag->len);
55455542 if (!vcpu->mmio_is_write)
5546− memcpy(frag->data, run->mmio.data, frag->len);
5543+ memcpy(frag->data, run->mmio.data, len);
5544+
5545+ if (frag->len <= 8) {
5546+ /* Switch to the next fragment. */
5547+ frag++;
5548+ vcpu->mmio_cur_fragment++;
5549+ } else {
5550+ /* Go forward to the next mmio piece. */
5551+ frag->data += len;
5552+ frag->gpa += len;
5553+ frag->len -= len;
5554+ }
5555+
55475556 if (vcpu->mmio_cur_fragment == vcpu->mmio_nr_fragments) {
55485557 vcpu->mmio_needed = 0;
55495558 if (vcpu->mmio_is_write)
@@ -5551,13 +5560,12 @@ static int complete_emulated_mmio(struct kvm_vcpu *vcpu) · 1 unmodified line
55515560 vcpu->mmio_read_completed = 1;
55525561 return complete_emulated_io(vcpu);
55535562 }
5554− /* Initiate next fragment */
5555− ++frag;
5563+
55565564 run->exit_reason = KVM_EXIT_MMIO;
55575565 run->mmio.phys_addr = frag->gpa;
55585566 if (vcpu->mmio_is_write)
5559− memcpy(run->mmio.data, frag->data, frag->len);
5560− run->mmio.len = frag->len;
5567+ memcpy(run->mmio.data, frag->data, min(8u, frag->len));
5568+ run->mmio.len = min(8u, frag->len);
55615569 run->mmio.is_write = vcpu->mmio_is_write;
55625570 vcpu->arch.complete_userspace_io = complete_emulated_mmio;
55635571 return 0;
arch/x86/xen/mmu.c+20−1
@@ -1288,6 +1288,25 @@ unsigned long xen_read_cr2_direct(void) · 1287 unmodified lines
12881288 return this_cpu_read(xen_vcpu_info.arch.cr2);
12891289 }
12901290
1291+void xen_flush_tlb_all(void)
1292+{
1293+ struct mmuext_op *op;
1294+ struct multicall_space mcs;
1295+
1296+ trace_xen_mmu_flush_tlb_all(0);
1297+
1298+ preempt_disable();
1299+
1300+ mcs = xen_mc_entry(sizeof(*op));
1301+
1302+ op = mcs.args;
1303+ op->cmd = MMUEXT_TLB_FLUSH_ALL;
1304+ MULTI_mmuext_op(mcs.mc, op, 1, NULL, DOMID_SELF);
1305+
1306+ xen_mc_issue(PARAVIRT_LAZY_MMU);
1307+
1308+ preempt_enable();
1309+}
12911310 static void xen_flush_tlb(void)
12921311 {
12931312 struct mmuext_op *op;
@@ -2518,7 +2537,7 @@ int xen_remap_domain_mfn_range(struct vm_area_struct *vma, · 1224 unmodified lines
25182537 err = 0;
25192538 out:
25202539
2521− flush_tlb_all();
2540+ xen_flush_tlb_all();
25222541
25232542 return err;
25242543 }
arch/xtensa/Kconfig+2−0
@@ -13,6 +13,8 @@ config XTENSA · 12 unmodified lines
1313 select GENERIC_CPU_DEVICES
1414 select MODULES_USE_ELF_RELA
1515 select GENERIC_PCI_IOMAP
16+ select GENERIC_KERNEL_THREAD
17+ select GENERIC_KERNEL_EXECVE
1618 select ARCH_WANT_OPTIONAL_GPIOLIB
1719 help
1820 Xtensa processors are 32-bit RISC machines designed by Tensilica
arch/xtensa/include/asm/io.h+4−0
@@ -62,6 +62,10 @@ static inline void __iomem *ioremap(unsigned long offset, unsigned long size) · 61 unmodified lines
6262 static inline void iounmap(volatile void __iomem *addr)
6363 {
6464 }
65+
66+#define virt_to_bus virt_to_phys
67+#define bus_to_virt phys_to_virt
68+
6569 #endif /* CONFIG_MMU */
6670
6771 /*
arch/xtensa/include/asm/processor.h+1−3
@@ -152,6 +152,7 @@ struct thread_struct { · 151 unmodified lines
152152
153153 /* Clearing a0 terminates the backtrace. */
154154 #define start_thread(regs, new_pc, new_sp) \
155+ memset(regs, 0, sizeof(*regs)); \
155156 regs->pc = new_pc; \
156157 regs->ps = USER_PS_VALUE; \
157158 regs->areg[1] = new_sp; \
@@ -168,9 +169,6 @@ struct mm_struct; · 10 unmodified lines
168169 /* Free all resources held by a thread. */
169170 #define release_thread(thread) do { } while(0)
170171
171−/* Create a kernel thread without removing it from tasklists */
172−extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
173−
174172 /* Copy and release all segment info associated with a VM */
175173 #define copy_segments(p, mm) do { } while(0)
176174 #define release_segments(mm) do { } while(0)
arch/xtensa/include/asm/syscall.h+1−1
@@ -10,7 +10,7 @@ · 9 unmodified lines
1010
1111 struct pt_regs;
1212 struct sigaction;
13−asmlinkage long xtensa_execve(char*, char**, char**, struct pt_regs*);
13+asmlinkage long sys_execve(char*, char**, char**, struct pt_regs*);
1414 asmlinkage long xtensa_clone(unsigned long, unsigned long, struct pt_regs*);
1515 asmlinkage long xtensa_ptrace(long, long, long, long);
1616 asmlinkage long xtensa_sigreturn(struct pt_regs*);
arch/xtensa/include/asm/unistd.h+5−10
@@ -1,16 +1,9 @@
1−/*
2− * include/asm-xtensa/unistd.h
3− *
4− * This file is subject to the terms and conditions of the GNU General Public
5− * License. See the file "COPYING" in the main directory of this archive
6− * for more details.
7− *
8− * Copyright (C) 2001 - 2005 Tensilica Inc.
9− */
1+#ifndef _XTENSA_UNISTD_H
2+#define _XTENSA_UNISTD_H
103
4+#define __ARCH_WANT_SYS_EXECVE
115 #include <uapi/asm/unistd.h>
126
13−
147 /*
158 * "Conditional" syscalls
169 *
@@ -37,3 +30,5 @@ · 20 unmodified lines
3730 #define __IGNORE_mmap /* use mmap2 */
3831 #define __IGNORE_vfork /* use clone */
3932 #define __IGNORE_fadvise64 /* use fadvise64_64 */
33+
34+#endif /* _XTENSA_UNISTD_H */
arch/xtensa/include/uapi/asm/unistd.h+4−12
@@ -1,14 +1,4 @@
1−/*
2− * include/asm-xtensa/unistd.h
3− *
4− * This file is subject to the terms and conditions of the GNU General Public
5− * License. See the file "COPYING" in the main directory of this archive
6− * for more details.
7− *
8− * Copyright (C) 2001 - 2012 Tensilica Inc.
9− */
10−
11−#ifndef _UAPI_XTENSA_UNISTD_H
1+#if !defined(_UAPI_XTENSA_UNISTD_H) || defined(__SYSCALL)
122 #define _UAPI_XTENSA_UNISTD_H
133
144 #ifndef __SYSCALL
@@ -272,7 +262,7 @@ __SYSCALL(115, sys_sendmmsg, 4) · 257 unmodified lines
272262 #define __NR_clone 116
273263 __SYSCALL(116, xtensa_clone, 5)
274264 #define __NR_execve 117
275−__SYSCALL(117, xtensa_execve, 3)
265+__SYSCALL(117, sys_execve, 3)
276266 #define __NR_exit 118
277267 __SYSCALL(118, sys_exit, 1)
278268 #define __NR_exit_group 119
@@ -759,4 +749,6 @@ __SYSCALL(331, sys_kcmp, 5) · 480 unmodified lines
759749
760750 #define SYS_XTENSA_COUNT 5 /* count */
761751
752+#undef __SYSCALL
753+
762754 #endif /* _UAPI_XTENSA_UNISTD_H */
arch/xtensa/kernel/entry.S+13−44
@@ -1832,50 +1832,6 @@ ENTRY(system_call) · 1831 unmodified lines
18321832 retw
18331833
18341834
1835−/*
1836− * Create a kernel thread
1837− *
1838− * int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
1839− * a2 a2 a3 a4
1840− */
1841−
1842−ENTRY(kernel_thread)
1843− entry a1, 16
1844−
1845− mov a5, a2 # preserve fn over syscall
1846− mov a7, a3 # preserve args over syscall
1847−
1848− movi a3, _CLONE_VM | _CLONE_UNTRACED
1849− movi a2, __NR_clone
1850− or a6, a4, a3 # arg0: flags
1851− mov a3, a1 # arg1: sp
1852− syscall
1853−
1854− beq a3, a1, 1f # branch if parent
1855− mov a6, a7 # args
1856− callx4 a5 # fn(args)
1857−
1858− movi a2, __NR_exit
1859− syscall # return value of fn(args) still in a6
1860−
1861−1: retw
1862−
1863−/*
1864− * Do a system call from kernel instead of calling sys_execve, so we end up
1865− * with proper pt_regs.
1866− *
1867− * int kernel_execve(const char *fname, char *const argv[], charg *const envp[])
1868− * a2 a2 a3 a4
1869− */
1870−
1871−ENTRY(kernel_execve)
1872− entry a1, 16
1873− mov a6, a2 # arg0 is in a6
1874− movi a2, __NR_execve
1875− syscall
1876−
1877− retw
1878−
18791835 /*
18801836 * Task switch.
18811837 *
@@ -1958,3 +1914,16 @@ ENTRY(ret_from_fork) · 76 unmodified lines
19581914
19591915 j common_exception_return
19601916
1917+/*
1918+ * Kernel thread creation helper
1919+ * On entry, set up by copy_thread: a2 = thread_fn, a3 = thread_fn arg
1920+ * left from _switch_to: a6 = prev
1921+ */
1922+ENTRY(ret_from_kernel_thread)
1923+
1924+ call4 schedule_tail
1925+ mov a6, a3
1926+ callx4 a2
1927+ j common_exception_return
1928+
1929+ENDPROC(ret_from_kernel_thread)
arch/xtensa/kernel/process.c+71−57
@@ -45,6 +45,7 @@ · 44 unmodified lines
4545 #include <asm/regs.h>
4646
4747 extern void ret_from_fork(void);
48+extern void ret_from_kernel_thread(void);
4849
4950 struct task_struct *current_set[NR_CPUS] = {&init_task, };
5051
@@ -158,18 +159,30 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) · 107 unmodified lines
158159 /*
159160 * Copy thread.
160161 *
162+ * There are two modes in which this function is called:
163+ * 1) Userspace thread creation,
164+ * regs != NULL, usp_thread_fn is userspace stack pointer.
165+ * It is expected to copy parent regs (in case CLONE_VM is not set
166+ * in the clone_flags) and set up passed usp in the childregs.
167+ * 2) Kernel thread creation,
168+ * regs == NULL, usp_thread_fn is the function to run in the new thread
169+ * and thread_fn_arg is its parameter.
170+ * childregs are not used for the kernel threads.
171+ *
161172 * The stack layout for the new thread looks like this:
162173 *
163− * +------------------------+ <- sp in childregs (= tos)
174+ * +------------------------+
164175 * | childregs |
165176 * +------------------------+ <- thread.sp = sp in dummy-frame
166177 * | dummy-frame | (saved in dummy-frame spill-area)
167178 * +------------------------+
168179 *
169− * We create a dummy frame to return to ret_from_fork:
170− * a0 points to ret_from_fork (simulating a call4)
180+ * We create a dummy frame to return to either ret_from_fork or
181+ * ret_from_kernel_thread:
182+ * a0 points to ret_from_fork/ret_from_kernel_thread (simulating a call4)
171183 * sp points to itself (thread.sp)
172− * a2, a3 are unused.
184+ * a2, a3 are unused for userspace threads,
185+ * a2 points to thread_fn, a3 holds thread_fn arg for kernel threads.
173186 *
174187 * Note: This is a pristine frame, so we don't need any spill region on top of
175188 * childregs.
@@ -185,43 +198,63 @@ int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) · 9 unmodified lines
185198 * involved. Much simpler to just not copy those live frames across.
186199 */
187200
188−int copy_thread(unsigned long clone_flags, unsigned long usp,
189− unsigned long unused,
190− struct task_struct * p, struct pt_regs * regs)
201+int copy_thread(unsigned long clone_flags, unsigned long usp_thread_fn,
202+ unsigned long thread_fn_arg,
203+ struct task_struct *p, struct pt_regs *unused)
191204 {
192− struct pt_regs *childregs;
193− unsigned long tos;
194− int user_mode = user_mode(regs);
205+ struct pt_regs *childregs = task_pt_regs(p);
195206
196207 #if (XTENSA_HAVE_COPROCESSORS || XTENSA_HAVE_IO_PORTS)
197208 struct thread_info *ti;
198209 #endif
199210
200− /* Set up new TSS. */
201− tos = (unsigned long)task_stack_page(p) + THREAD_SIZE;
202− if (user_mode)
203− childregs = (struct pt_regs*)(tos - PT_USER_SIZE);
204− else
205− childregs = (struct pt_regs*)tos - 1;
206−
207− /* This does not copy all the regs. In a bout of brilliance or madness,
208− ARs beyond a0-a15 exist past the end of the struct. */
209− *childregs = *regs;
210−
211211 /* Create a call4 dummy-frame: a0 = 0, a1 = childregs. */
212212 *((int*)childregs - 3) = (unsigned long)childregs;
213213 *((int*)childregs - 4) = 0;
214214
215− childregs->areg[2] = 0;
216− p->set_child_tid = p->clear_child_tid = NULL;
217− p->thread.ra = MAKE_RA_FOR_CALL((unsigned long)ret_from_fork, 0x1);
218215 p->thread.sp = (unsigned long)childregs;
219216
220− if (user_mode(regs)) {
217+ if (!(p->flags & PF_KTHREAD)) {
218+ struct pt_regs *regs = current_pt_regs();
219+ unsigned long usp = usp_thread_fn ?
220+ usp_thread_fn : regs->areg[1];
221221
222+ p->thread.ra = MAKE_RA_FOR_CALL(
223+ (unsigned long)ret_from_fork, 0x1);
224+
225+ /* This does not copy all the regs.
226+ * In a bout of brilliance or madness,
227+ * ARs beyond a0-a15 exist past the end of the struct.
228+ */
229+ *childregs = *regs;
222230 childregs->areg[1] = usp;
231+ childregs->areg[2] = 0;
232+
233+ /* When sharing memory with the parent thread, the child
234+ usually starts on a pristine stack, so we have to reset
235+ windowbase, windowstart and wmask.
236+ (Note that such a new thread is required to always create
237+ an initial call4 frame)
238+ The exception is vfork, where the new thread continues to
239+ run on the parent's stack until it calls execve. This could
240+ be a call8 or call12, which requires a legal stack frame
241+ of the previous caller for the overflow handlers to work.
242+ (Note that it's always legal to overflow live registers).
243+ In this case, ensure to spill at least the stack pointer
244+ of that frame. */
245+
223246 if (clone_flags & CLONE_VM) {
224− childregs->wmask = 1; /* can't share live windows */
247+ /* check that caller window is live and same stack */
248+ int len = childregs->wmask & ~0xf;
249+ if (regs->areg[1] == usp && len != 0) {
250+ int callinc = (regs->areg[0] >> 30) & 3;
251+ int caller_ars = XCHAL_NUM_AREGS - callinc * 4;
252+ put_user(regs->areg[caller_ars+1],
253+ (unsigned __user*)(usp - 12));
254+ }
255+ childregs->wmask = 1;
256+ childregs->windowstart = 1;
257+ childregs->windowbase = 0;
225258 } else {
226259 int len = childregs->wmask & ~0xf;
227260 memcpy(&childregs->areg[XCHAL_NUM_AREGS - len/4],
@@ -230,11 +263,19 @@ int copy_thread(unsigned long clone_flags, unsigned long usp, · 2 unmodified lines
230263 // FIXME: we need to set THREADPTR in thread_info...
231264 if (clone_flags & CLONE_SETTLS)
232265 childregs->areg[2] = childregs->areg[6];
233−
234266 } else {
235− /* In kernel space, we start a new thread with a new stack. */
236− childregs->wmask = 1;
237− childregs->areg[1] = tos;
267+ p->thread.ra = MAKE_RA_FOR_CALL(
268+ (unsigned long)ret_from_kernel_thread, 1);
269+
270+ /* pass parameters to ret_from_kernel_thread:
271+ * a2 = thread_fn, a3 = thread_fn arg
272+ */
273+ *((int *)childregs - 1) = thread_fn_arg;
274+ *((int *)childregs - 2) = usp_thread_fn;
275+
276+ /* Childregs are only used when we're going to userspace
277+ * in which case start_thread will set them up.
278+ */
238279 }
239280
240281 #if (XTENSA_HAVE_COPROCESSORS || XTENSA_HAVE_IO_PORTS)
@@ -330,32 +371,5 @@ long xtensa_clone(unsigned long clone_flags, unsigned long newsp, · 89 unmodified lines
330371 void __user *child_tid, long a5,
331372 struct pt_regs *regs)
332373 {
333− if (!newsp)
334− newsp = regs->areg[1];
335374 return do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid);
336375 }
337−
338−/*
339− * xtensa_execve() executes a new program.
340− */
341−
342−asmlinkage
343−long xtensa_execve(const char __user *name,
344− const char __user *const __user *argv,
345− const char __user *const __user *envp,
346− long a3, long a4, long a5,
347− struct pt_regs *regs)
348−{
349− long error;
350− struct filename *filename;
351−
352− filename = getname(name);
353− error = PTR_ERR(filename);
354− if (IS_ERR(filename))
355− goto out;
356− error = do_execve(filename->name, argv, envp, regs);
357− putname(filename);
358−out:
359− return error;
360−}
361−
arch/xtensa/kernel/syscall.c+3−4
@@ -32,10 +32,8 @@ typedef void (*syscall_t)(void); · 31 unmodified lines
3232 syscall_t sys_call_table[__NR_syscall_count] /* FIXME __cacheline_aligned */= {
3333 [0 ... __NR_syscall_count - 1] = (syscall_t)&sys_ni_syscall,
3434
35−#undef __SYSCALL
3635 #define __SYSCALL(nr,symbol,nargs) [ nr ] = (syscall_t)symbol,
37−#undef __KERNEL_SYSCALLS__
38−#include <asm/unistd.h>
36+#include <uapi/asm/unistd.h>
3937 };
4038
4139 asmlinkage long xtensa_shmat(int shmid, char __user *shmaddr, int shmflg)
@@ -49,7 +47,8 @@ asmlinkage long xtensa_shmat(int shmid, char __user *shmaddr, int shmflg) · 7 unmodified lines
4947 return (long)ret;
5048 }
5149
52−asmlinkage long xtensa_fadvise64_64(int fd, int advice, unsigned long long offset, unsigned long long len)
50+asmlinkage long xtensa_fadvise64_64(int fd, int advice,
51+ unsigned long long offset, unsigned long long len)
5352 {
5453 return sys_fadvise64_64(fd, offset, len, advice);
5554 }
arch/xtensa/kernel/xtensa_ksyms.c+0−1
@@ -43,7 +43,6 @@ EXPORT_SYMBOL(__strncpy_user); · 42 unmodified lines
4343 EXPORT_SYMBOL(clear_page);
4444 EXPORT_SYMBOL(copy_page);
4545
46−EXPORT_SYMBOL(kernel_thread);
4746 EXPORT_SYMBOL(empty_zero_page);
4847
4948 /*
block/Kconfig+1−1
@@ -89,7 +89,7 @@ config BLK_DEV_INTEGRITY · 88 unmodified lines
8989
9090 config BLK_DEV_THROTTLING
9191 bool "Block layer bio throttling support"
92− depends on BLK_CGROUP=y && EXPERIMENTAL
92+ depends on BLK_CGROUP=y
9393 default n
9494 ---help---
9595 Block layer bio throttling support. It can be used to limit
block/blk-cgroup.c+10−0
@@ -285,6 +285,13 @@ static void blkg_destroy_all(struct request_queue *q) · 284 unmodified lines
285285 blkg_destroy(blkg);
286286 spin_unlock(&blkcg->lock);
287287 }
288+
289+ /*
290+ * root blkg is destroyed. Just clear the pointer since
291+ * root_rl does not take reference on root blkg.
292+ */
293+ q->root_blkg = NULL;
294+ q->root_rl.blkg = NULL;
288295 }
289296
290297 static void blkg_rcu_free(struct rcu_head *rcu_head)
@@ -326,6 +333,9 @@ struct request_list *__blk_queue_next_rl(struct request_list *rl, · 35 unmodified lines
326333 */
327334 if (rl == &q->root_rl) {
328335 ent = &q->blkg_list;
336+ /* There are no more block groups, hence no request lists */
337+ if (list_empty(ent))
338+ return NULL;
329339 } else {
330340 blkg = container_of(rl, struct blkcg_gq, rl);
331341 ent = &blkg->q_node;
block/blk-core.c+2−1
@@ -2868,7 +2868,8 @@ static int plug_rq_cmp(void *priv, struct list_head *a, struct list_head *b) · 2867 unmodified lines
28682868 struct request *rqa = container_of(a, struct request, queuelist);
28692869 struct request *rqb = container_of(b, struct request, queuelist);
28702870
2871− return !(rqa->q <= rqb->q);
2871+ return !(rqa->q < rqb->q ||
2872+ (rqa->q == rqb->q && blk_rq_pos(rqa) < blk_rq_pos(rqb)));
28722873 }
28732874
28742875 /*
crypto/cryptd.c+8−3
@@ -137,13 +137,18 @@ static void cryptd_queue_worker(struct work_struct *work) · 136 unmodified lines
137137 struct crypto_async_request *req, *backlog;
138138
139139 cpu_queue = container_of(work, struct cryptd_cpu_queue, work);
140− /* Only handle one request at a time to avoid hogging crypto
141− * workqueue. preempt_disable/enable is used to prevent
142− * being preempted by cryptd_enqueue_request() */
140+ /*
141+ * Only handle one request at a time to avoid hogging crypto workqueue.
142+ * preempt_disable/enable is used to prevent being preempted by
143+ * cryptd_enqueue_request(). local_bh_disable/enable is used to prevent
144+ * cryptd_enqueue_request() being accessed from software interrupts.
145+ */
146+ local_bh_disable();
143147 preempt_disable();
144148 backlog = crypto_get_backlog(&cpu_queue->queue);
145149 req = crypto_dequeue_request(&cpu_queue->queue);
146150 preempt_enable();
151+ local_bh_enable();
147152
148153 if (!req)
149154 return;
drivers/acpi/video.c+7−4
@@ -1345,12 +1345,15 @@ static int · 1344 unmodified lines
13451345 acpi_video_bus_get_devices(struct acpi_video_bus *video,
13461346 struct acpi_device *device)
13471347 {
1348− int status;
1348+ int status = 0;
13491349 struct acpi_device *dev;
13501350
1351− status = acpi_video_device_enumerate(video);
1352− if (status)
1353− return status;
1351+ /*
1352+ * There are systems where video module known to work fine regardless
1353+ * of broken _DOD and ignoring returned value here doesn't cause
1354+ * any issues later.
1355+ */
1356+ acpi_video_device_enumerate(video);
13541357
13551358 list_for_each_entry(dev, &device->children, node) {
13561359
drivers/base/platform.c+7−0
@@ -83,9 +83,16 @@ EXPORT_SYMBOL_GPL(platform_get_resource); · 82 unmodified lines
8383 */
8484 int platform_get_irq(struct platform_device *dev, unsigned int num)
8585 {
86+#ifdef CONFIG_SPARC
87+ /* sparc does not have irqs represented as IORESOURCE_IRQ resources */
88+ if (!dev || num >= dev->archdata.num_irqs)
89+ return -ENXIO;
90+ return dev->archdata.irqs[num];
91+#else
8692 struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num);
8793
8894 return r ? r->start : -ENXIO;
95+#endif
8996 }
9097 EXPORT_SYMBOL_GPL(platform_get_irq);
9198
drivers/block/Kconfig+8−7
@@ -131,6 +131,7 @@ config BLK_CPQ_DA · 130 unmodified lines
131131 config BLK_CPQ_CISS_DA
132132 tristate "Compaq Smart Array 5xxx support"
133133 depends on PCI
134+ select CHECK_SIGNATURE
134135 help
135136 This is the driver for Compaq Smart Array 5xxx controllers.
136137 Everyone using these boards should say Y here.
@@ -166,8 +167,8 @@ config BLK_DEV_DAC960 · 29 unmodified lines
166167 module will be called DAC960.
167168
168169 config BLK_DEV_UMEM
169− tristate "Micro Memory MM5415 Battery Backed RAM support (EXPERIMENTAL)"
170− depends on PCI && EXPERIMENTAL
170+ tristate "Micro Memory MM5415 Battery Backed RAM support"
171+ depends on PCI
171172 ---help---
172173 Saying Y here will include support for the MM5415 family of
173174 battery backed (Non-volatile) RAM cards.
@@ -430,8 +431,8 @@ config CDROM_PKTCDVD_BUFFERS · 256 unmodified lines
430431 a disc is opened for writing.
431432
432433 config CDROM_PKTCDVD_WCACHE
433− bool "Enable write caching (EXPERIMENTAL)"
434− depends on CDROM_PKTCDVD && EXPERIMENTAL
434+ bool "Enable write caching"
435+ depends on CDROM_PKTCDVD
435436 help
436437 If enabled, write caching will be set for the CD-R/W device. For now
437438 this option is dangerous unless the CD-RW media is known good, as we
@@ -508,8 +509,8 @@ config XEN_BLKDEV_BACKEND · 70 unmodified lines
508509
509510
510511 config VIRTIO_BLK
511− tristate "Virtio block driver (EXPERIMENTAL)"
512− depends on EXPERIMENTAL && VIRTIO
512+ tristate "Virtio block driver"
513+ depends on VIRTIO
513514 ---help---
514515 This is the virtual block driver for virtio. It can be used with
515516 lguest or QEMU based VMMs (like KVM or Xen). Say Y or M.
@@ -528,7 +529,7 @@ config BLK_DEV_HD · 12 unmodified lines
528529
529530 config BLK_DEV_RBD
530531 tristate "Rados block device (RBD)"
531− depends on INET && EXPERIMENTAL && BLOCK
532+ depends on INET && BLOCK
532533 select CEPH_LIB
533534 select LIBCRC32C
534535 select CRYPTO_AES
drivers/block/cciss.c+0−1
@@ -5205,7 +5205,6 @@ static void cciss_shutdown(struct pci_dev *pdev) · 5204 unmodified lines
52055205 return;
52065206 }
52075207 /* write all data in the battery backed cache to disk */
5208− memset(flush_buf, 0, 4);
52095208 return_code = sendcmd_withirq(h, CCISS_CACHE_FLUSH, flush_buf,
52105209 4, 0, CTLR_LUNID, TYPE_CMD);
52115210 kfree(flush_buf);
drivers/block/floppy.c+48−42
@@ -4109,12 +4109,19 @@ static struct platform_driver floppy_driver = { · 4108 unmodified lines
41094109
41104110 static struct platform_device floppy_device[N_DRIVE];
41114111
4112+static bool floppy_available(int drive)
4113+{
4114+ if (!(allowed_drive_mask & (1 << drive)))
4115+ return false;
4116+ if (fdc_state[FDC(drive)].version == FDC_NONE)
4117+ return false;
4118+ return true;
4119+}
4120+
41124121 static struct kobject *floppy_find(dev_t dev, int *part, void *data)
41134122 {
41144123 int drive = (*part & 3) | ((*part & 0x80) >> 5);
4115− if (drive >= N_DRIVE ||
4116− !(allowed_drive_mask & (1 << drive)) ||
4117− fdc_state[FDC(drive)].version == FDC_NONE)
4124+ if (drive >= N_DRIVE || !floppy_available(drive))
41184125 return NULL;
41194126 if (((*part >> 2) & 0x1f) >= ARRAY_SIZE(floppy_type))
41204127 return NULL;
@@ -4124,8 +4131,7 @@ static struct kobject *floppy_find(dev_t dev, int *part, void *data) · 3 unmodified lines
41244131
41254132 static int __init do_floppy_init(void)
41264133 {
4127− int i, unit, drive;
4128− int err, dr;
4134+ int i, unit, drive, err;
41294135
41304136 set_debugt();
41314137 interruptjiffies = resultjiffies = jiffies;
@@ -4137,34 +4143,32 @@ static int __init do_floppy_init(void) · 5 unmodified lines
41374143
41384144 raw_cmd = NULL;
41394145
4140− for (dr = 0; dr < N_DRIVE; dr++) {
4141− disks[dr] = alloc_disk(1);
4142− if (!disks[dr]) {
4143− err = -ENOMEM;
4144− goto out_put_disk;
4145− }
4146+ floppy_wq = alloc_ordered_workqueue("floppy", 0);
4147+ if (!floppy_wq)
4148+ return -ENOMEM;
41464149
4147− floppy_wq = alloc_ordered_workqueue("floppy", 0);
4148− if (!floppy_wq) {
4150+ for (drive = 0; drive < N_DRIVE; drive++) {
4151+ disks[drive] = alloc_disk(1);
4152+ if (!disks[drive]) {
41494153 err = -ENOMEM;
41504154 goto out_put_disk;
41514155 }
41524156
4153− disks[dr]->queue = blk_init_queue(do_fd_request, &floppy_lock);
4154− if (!disks[dr]->queue) {
4157+ disks[drive]->queue = blk_init_queue(do_fd_request, &floppy_lock);
4158+ if (!disks[drive]->queue) {
41554159 err = -ENOMEM;
4156− goto out_destroy_workq;
4160+ goto out_put_disk;
41574161 }
41584162
4159− blk_queue_max_hw_sectors(disks[dr]->queue, 64);
4160− disks[dr]->major = FLOPPY_MAJOR;
4161− disks[dr]->first_minor = TOMINOR(dr);
4162− disks[dr]->fops = &floppy_fops;
4163− sprintf(disks[dr]->disk_name, "fd%d", dr);
4163+ blk_queue_max_hw_sectors(disks[drive]->queue, 64);
4164+ disks[drive]->major = FLOPPY_MAJOR;
4165+ disks[drive]->first_minor = TOMINOR(drive);
4166+ disks[drive]->fops = &floppy_fops;
4167+ sprintf(disks[drive]->disk_name, "fd%d", drive);
41644168
4165− init_timer(&motor_off_timer[dr]);
4166− motor_off_timer[dr].data = dr;
4167− motor_off_timer[dr].function = motor_off_callback;
4169+ init_timer(&motor_off_timer[drive]);
4170+ motor_off_timer[drive].data = drive;
4171+ motor_off_timer[drive].function = motor_off_callback;
41684172 }
41694173
41704174 err = register_blkdev(FLOPPY_MAJOR, "fd");
@@ -4282,9 +4286,7 @@ static int __init do_floppy_init(void) · 111 unmodified lines
42824286 }
42834287
42844288 for (drive = 0; drive < N_DRIVE; drive++) {
4285− if (!(allowed_drive_mask & (1 << drive)))
4286− continue;
4287− if (fdc_state[FDC(drive)].version == FDC_NONE)
4289+ if (!floppy_available(drive))
42884290 continue;
42894291
42904292 floppy_device[drive].name = floppy_device_name;
@@ -4293,7 +4295,7 @@ static int __init do_floppy_init(void) · 2 unmodified lines
42934295
42944296 err = platform_device_register(&floppy_device[drive]);
42954297 if (err)
4296− goto out_release_dma;
4298+ goto out_remove_drives;
42974299
42984300 err = device_create_file(&floppy_device[drive].dev,
42994301 &dev_attr_cmos);
@@ -4311,29 +4313,34 @@ static int __init do_floppy_init(void) · 11 unmodified lines
43114313
43124314 out_unreg_platform_dev:
43134315 platform_device_unregister(&floppy_device[drive]);
4316+out_remove_drives:
4317+ while (drive--) {
4318+ if (floppy_available(drive)) {
4319+ del_gendisk(disks[drive]);
4320+ device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos);
4321+ platform_device_unregister(&floppy_device[drive]);
4322+ }
4323+ }
43144324 out_release_dma:
43154325 if (atomic_read(&usage_count))
43164326 floppy_release_irq_and_dma();
43174327 out_unreg_region:
43184328 blk_unregister_region(MKDEV(FLOPPY_MAJOR, 0), 256);
43194329 platform_driver_unregister(&floppy_driver);
4320−out_destroy_workq:
4321− destroy_workqueue(floppy_wq);
43224330 out_unreg_blkdev:
43234331 unregister_blkdev(FLOPPY_MAJOR, "fd");
43244332 out_put_disk:
4325− while (dr--) {
4326− del_timer_sync(&motor_off_timer[dr]);
4327− if (disks[dr]->queue) {
4328− blk_cleanup_queue(disks[dr]->queue);
4329− /*
4330− * put_disk() is not paired with add_disk() and
4331− * will put queue reference one extra time. fix it.
4332− */
4333− disks[dr]->queue = NULL;
4333+ for (drive = 0; drive < N_DRIVE; drive++) {
4334+ if (!disks[drive])
4335+ break;
4336+ if (disks[drive]->queue) {
4337+ del_timer_sync(&motor_off_timer[drive]);
4338+ blk_cleanup_queue(disks[drive]->queue);
4339+ disks[drive]->queue = NULL;
43344340 }
4335− put_disk(disks[dr]);
4341+ put_disk(disks[drive]);
43364342 }
4343+ destroy_workqueue(floppy_wq);
43374344 return err;
43384345 }
43394346
@@ -4551,8 +4558,7 @@ static void __exit floppy_module_exit(void) · 211 unmodified lines
45514558 for (drive = 0; drive < N_DRIVE; drive++) {
45524559 del_timer_sync(&motor_off_timer[drive]);
45534560
4554− if ((allowed_drive_mask & (1 << drive)) &&
4555− fdc_state[FDC(drive)].version != FDC_NONE) {
4561+ if (floppy_available(drive)) {
45564562 del_gendisk(disks[drive]);
45574563 device_remove_file(&floppy_device[drive].dev, &dev_attr_cmos);
45584564 platform_device_unregister(&floppy_device[drive]);
drivers/block/loop.c+15−2
@@ -976,8 +976,21 @@ static int loop_clr_fd(struct loop_device *lo) · 975 unmodified lines
976976 if (lo->lo_state != Lo_bound)
977977 return -ENXIO;
978978
979− if (lo->lo_refcnt > 1) /* we needed one fd for the ioctl */
980− return -EBUSY;
979+ /*
980+ * If we've explicitly asked to tear down the loop device,
981+ * and it has an elevated reference count, set it for auto-teardown when
982+ * the last reference goes away. This stops $!~#$@ udev from
983+ * preventing teardown because it decided that it needs to run blkid on
984+ * the loopback device whenever they appear. xfstests is notorious for
985+ * failing tests because blkid via udev races with a losetup
986+ * <dev>/do something like mkfs/losetup -d <dev> causing the losetup -d
987+ * command to fail with EBUSY.
988+ */
989+ if (lo->lo_refcnt > 1) {
990+ lo->lo_flags |= LO_FLAGS_AUTOCLEAR;
991+ mutex_unlock(&lo->lo_ctl_mutex);
992+ return 0;
993+ }
981994
982995 if (filp == NULL)
983996 return -EINVAL;
drivers/block/mtip32xx/mtip32xx.c+15−4
@@ -2035,8 +2035,9 @@ static unsigned int implicit_sector(unsigned char command, · 2034 unmodified lines
20352035 }
20362036 return rv;
20372037 }
2038−
2039−static void mtip_set_timeout(struct host_to_dev_fis *fis, unsigned int *timeout)
2038+static void mtip_set_timeout(struct driver_data *dd,
2039+ struct host_to_dev_fis *fis,
2040+ unsigned int *timeout, u8 erasemode)
20402041 {
20412042 switch (fis->command) {
20422043 case ATA_CMD_DOWNLOAD_MICRO:
@@ -2044,7 +2045,10 @@ static void mtip_set_timeout(struct host_to_dev_fis *fis, unsigned int *timeout) · 1 unmodified line
20442045 break;
20452046 case ATA_CMD_SEC_ERASE_UNIT:
20462047 case 0xFC:
2047− *timeout = 240000; /* 4 minutes */
2048+ if (erasemode)
2049+ *timeout = ((*(dd->port->identify + 90) * 2) * 60000);
2050+ else
2051+ *timeout = ((*(dd->port->identify + 89) * 2) * 60000);
20482052 break;
20492053 case ATA_CMD_STANDBYNOW1:
20502054 *timeout = 120000; /* 2 minutes */
@@ -2087,6 +2091,7 @@ static int exec_drive_taskfile(struct driver_data *dd, · 36 unmodified lines
20872091 unsigned int transfer_size;
20882092 unsigned long task_file_data;
20892093 int intotal = outtotal + req_task->out_size;
2094+ int erasemode = 0;
20902095
20912096 taskout = req_task->out_size;
20922097 taskin = req_task->in_size;
@@ -2212,7 +2217,13 @@ static int exec_drive_taskfile(struct driver_data *dd, · 119 unmodified lines
22122217 fis.lba_hi,
22132218 fis.device);
22142219
2215− mtip_set_timeout(&fis, &timeout);
2220+ /* check for erase mode support during secure erase.*/
2221+ if ((fis.command == ATA_CMD_SEC_ERASE_UNIT)
2222+ && (outbuf[0] & MTIP_SEC_ERASE_MODE)) {
2223+ erasemode = 1;
2224+ }
2225+
2226+ mtip_set_timeout(dd, &fis, &timeout, erasemode);
22162227
22172228 /* Determine the correct transfer size.*/
22182229 if (force_single_sector)
drivers/block/mtip32xx/mtip32xx.h+3−0
@@ -33,6 +33,9 @@ · 32 unmodified lines
3333 /* offset of Device Control register in PCIe extended capabilites space */
3434 #define PCIE_CONFIG_EXT_DEVICE_CONTROL_OFFSET 0x48
3535
36+/* check for erase mode support during secure erase */
37+#define MTIP_SEC_ERASE_MODE 0x3
38+
3639 /* # of times to retry timed out/failed IOs */
3740 #define MTIP_MAX_RETRIES 2
3841
drivers/block/xen-blkback/common.h+2−2
@@ -158,8 +158,8 @@ struct xen_vbd { · 157 unmodified lines
158158 struct block_device *bdev;
159159 /* Cached size parameter. */
160160 sector_t size;
161− bool flush_support;
162− bool discard_secure;
161+ unsigned int flush_support:1;
162+ unsigned int discard_secure:1;
163163 };
164164
165165 struct backend_info;
drivers/block/xen-blkback/xenbus.c+4−5
@@ -105,11 +105,10 @@ static struct xen_blkif *xen_blkif_alloc(domid_t domid) · 104 unmodified lines
105105 {
106106 struct xen_blkif *blkif;
107107
108− blkif = kmem_cache_alloc(xen_blkif_cachep, GFP_KERNEL);
108+ blkif = kmem_cache_zalloc(xen_blkif_cachep, GFP_KERNEL);
109109 if (!blkif)
110110 return ERR_PTR(-ENOMEM);
111111
112− memset(blkif, 0, sizeof(*blkif));
113112 blkif->domid = domid;
114113 spin_lock_init(&blkif->blk_ring_lock);
115114 atomic_set(&blkif->refcnt, 1);
@@ -196,7 +195,7 @@ static void xen_blkif_disconnect(struct xen_blkif *blkif) · 80 unmodified lines
196195 }
197196 }
198197
199−void xen_blkif_free(struct xen_blkif *blkif)
198+static void xen_blkif_free(struct xen_blkif *blkif)
200199 {
201200 if (!atomic_dec_and_test(&blkif->refcnt))
202201 BUG();
@@ -257,7 +256,7 @@ static struct attribute_group xen_vbdstat_group = { · 54 unmodified lines
257256 VBD_SHOW(physical_device, "%x:%x\n", be->major, be->minor);
258257 VBD_SHOW(mode, "%s\n", be->mode);
259258
260−int xenvbd_sysfs_addif(struct xenbus_device *dev)
259+static int xenvbd_sysfs_addif(struct xenbus_device *dev)
261260 {
262261 int error;
263262
@@ -281,7 +280,7 @@ fail1: device_remove_file(&dev->dev, &dev_attr_physical_device); · 17 unmodified lines
281280 return error;
282281 }
283282
284−void xenvbd_sysfs_delif(struct xenbus_device *dev)
283+static void xenvbd_sysfs_delif(struct xenbus_device *dev)
285284 {
286285 sysfs_remove_group(&dev->dev.kobj, &xen_vbdstat_group);
287286 device_remove_file(&dev->dev, &dev_attr_mode);
drivers/cpufreq/powernow-k8.c+1−1
@@ -5,7 +5,7 @@ · 4 unmodified lines
55 * http://www.gnu.org/licenses/gpl.html
66 *
77 * Maintainer:
8− * Andreas Herrmann <andreas.herrmann3@amd.com>
8+ * Andreas Herrmann <herrmann.der.user@googlemail.com>
99 *
1010 * Based on the powernow-k7.c module written by Dave Jones.
1111 * (C) 2003 Dave Jones on behalf of SuSE Labs
drivers/gpio/Kconfig+1−1
@@ -47,7 +47,7 @@ if GPIOLIB · 46 unmodified lines
4747
4848 config OF_GPIO
4949 def_bool y
50− depends on OF && !SPARC
50+ depends on OF
5151
5252 config DEBUG_GPIO
5353 bool "Debug GPIO calls"
drivers/gpio/gpio-74x164.c+1−1
@@ -153,7 +153,7 @@ static int __devinit gen_74x164_probe(struct spi_device *spi) · 152 unmodified lines
153153 }
154154
155155 chip->gpio_chip.ngpio = GEN_74X164_NUMBER_GPIOS * chip->registers;
156− chip->buffer = devm_kzalloc(&spi->dev, chip->gpio_chip.ngpio, GFP_KERNEL);
156+ chip->buffer = devm_kzalloc(&spi->dev, chip->registers, GFP_KERNEL);
157157 if (!chip->buffer) {
158158 ret = -ENOMEM;
159159 goto exit_destroy;
drivers/gpio/gpio-mvebu.c+3−1
@@ -244,6 +244,8 @@ static int mvebu_gpio_direction_output(struct gpio_chip *chip, unsigned pin, · 243 unmodified lines
244244 if (ret)
245245 return ret;
246246
247+ mvebu_gpio_set(chip, pin, value);
248+
247249 spin_lock_irqsave(&mvchip->lock, flags);
248250 u = readl_relaxed(mvebu_gpioreg_io_conf(mvchip));
249251 u &= ~(1 << pin);
@@ -644,7 +646,7 @@ static int __devinit mvebu_gpio_probe(struct platform_device *pdev) · 394 unmodified lines
644646 ct->handler = handle_edge_irq;
645647 ct->chip.name = mvchip->chip.label;
646648
647− irq_setup_generic_chip(gc, IRQ_MSK(ngpios), IRQ_GC_INIT_MASK_CACHE,
649+ irq_setup_generic_chip(gc, IRQ_MSK(ngpios), 0,
648650 IRQ_NOREQUEST, IRQ_LEVEL | IRQ_NOPROBE);
649651
650652 /* Setup irq domain on top of the generic chip. */
drivers/gpio/gpio-omap.c+35−0
@@ -251,6 +251,40 @@ static void _set_gpio_debounce(struct gpio_bank *bank, unsigned gpio, · 250 unmodified lines
251251 }
252252 }
253253
254+/**
255+ * _clear_gpio_debounce - clear debounce settings for a gpio
256+ * @bank: the gpio bank we're acting upon
257+ * @gpio: the gpio number on this @gpio
258+ *
259+ * If a gpio is using debounce, then clear the debounce enable bit and if
260+ * this is the only gpio in this bank using debounce, then clear the debounce
261+ * time too. The debounce clock will also be disabled when calling this function
262+ * if this is the only gpio in the bank using debounce.
263+ */
264+static void _clear_gpio_debounce(struct gpio_bank *bank, unsigned gpio)
265+{
266+ u32 gpio_bit = GPIO_BIT(bank, gpio);
267+
268+ if (!bank->dbck_flag)
269+ return;
270+
271+ if (!(bank->dbck_enable_mask & gpio_bit))
272+ return;
273+
274+ bank->dbck_enable_mask &= ~gpio_bit;
275+ bank->context.debounce_en &= ~gpio_bit;
276+ __raw_writel(bank->context.debounce_en,
277+ bank->base + bank->regs->debounce_en);
278+
279+ if (!bank->dbck_enable_mask) {
280+ bank->context.debounce = 0;
281+ __raw_writel(bank->context.debounce, bank->base +
282+ bank->regs->debounce);
283+ clk_disable(bank->dbck);
284+ bank->dbck_enabled = false;
285+ }
286+}
287+
254288 static inline void set_gpio_trigger(struct gpio_bank *bank, int gpio,
255289 unsigned trigger)
256290 {
@@ -539,6 +573,7 @@ static void _reset_gpio(struct gpio_bank *bank, int gpio) · 282 unmodified lines
539573 _set_gpio_irqenable(bank, gpio, 0);
540574 _clear_gpio_irqstatus(bank, gpio);
541575 _set_gpio_triggering(bank, GPIO_INDEX(bank, gpio), IRQ_TYPE_NONE);
576+ _clear_gpio_debounce(bank, gpio);
542577 }
543578
544579 /* Use disable_irq_wake() and enable_irq_wake() functions from drivers */
drivers/gpio/gpio-timberdale.c+2−2
@@ -116,7 +116,7 @@ static void timbgpio_irq_disable(struct irq_data *d) · 115 unmodified lines
116116 unsigned long flags;
117117
118118 spin_lock_irqsave(&tgpio->lock, flags);
119− tgpio->last_ier &= ~(1 << offset);
119+ tgpio->last_ier &= ~(1UL << offset);
120120 iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER);
121121 spin_unlock_irqrestore(&tgpio->lock, flags);
122122 }
@@ -128,7 +128,7 @@ static void timbgpio_irq_enable(struct irq_data *d) · 5 unmodified lines
128128 unsigned long flags;
129129
130130 spin_lock_irqsave(&tgpio->lock, flags);
131− tgpio->last_ier |= 1 << offset;
131+ tgpio->last_ier |= 1UL << offset;
132132 iowrite32(tgpio->last_ier, tgpio->membase + TGPIO_IER);
133133 spin_unlock_irqrestore(&tgpio->lock, flags);
134134 }
drivers/gpio/gpiolib.c+7−3
@@ -623,9 +623,11 @@ static ssize_t export_store(struct class *class, · 622 unmodified lines
623623 */
624624
625625 status = gpio_request(gpio, "sysfs");
626− if (status < 0)
626+ if (status < 0) {
627+ if (status == -EPROBE_DEFER)
628+ status = -ENODEV;
627629 goto done;
628−
630+ }
629631 status = gpio_export(gpio, true);
630632 if (status < 0)
631633 gpio_free(gpio);
@@ -1191,8 +1193,10 @@ int gpio_request(unsigned gpio, const char *label) · 559 unmodified lines
11911193
11921194 spin_lock_irqsave(&gpio_lock, flags);
11931195
1194− if (!gpio_is_valid(gpio))
1196+ if (!gpio_is_valid(gpio)) {
1197+ status = -EINVAL;
11951198 goto done;
1199+ }
11961200 desc = &gpio_desc[gpio];
11971201 chip = desc->chip;
11981202 if (chip == NULL)
drivers/gpu/drm/drm_fops.c+30−14
@@ -121,6 +121,8 @@ int drm_open(struct inode *inode, struct file *filp) · 120 unmodified lines
121121 int minor_id = iminor(inode);
122122 struct drm_minor *minor;
123123 int retcode = 0;
124+ int need_setup = 0;
125+ struct address_space *old_mapping;
124126
125127 minor = idr_find(&drm_minors_idr, minor_id);
126128 if (!minor)
@@ -132,23 +134,37 @@ int drm_open(struct inode *inode, struct file *filp) · 5 unmodified lines
132134 if (drm_device_is_unplugged(dev))
133135 return -ENODEV;
134136
137+ if (!dev->open_count++)
138+ need_setup = 1;
139+ mutex_lock(&dev->struct_mutex);
140+ old_mapping = dev->dev_mapping;
141+ if (old_mapping == NULL)
142+ dev->dev_mapping = &inode->i_data;
143+ /* ihold ensures nobody can remove inode with our i_data */
144+ ihold(container_of(dev->dev_mapping, struct inode, i_data));
145+ inode->i_mapping = dev->dev_mapping;
146+ filp->f_mapping = dev->dev_mapping;
147+ mutex_unlock(&dev->struct_mutex);
148+
135149 retcode = drm_open_helper(inode, filp, dev);
136− if (!retcode) {
137− atomic_inc(&dev->counts[_DRM_STAT_OPENS]);
138− if (!dev->open_count++)
139− retcode = drm_setup(dev);
140− }
141− if (!retcode) {
142− mutex_lock(&dev->struct_mutex);
143− if (dev->dev_mapping == NULL)
144− dev->dev_mapping = &inode->i_data;
145− /* ihold ensures nobody can remove inode with our i_data */
146− ihold(container_of(dev->dev_mapping, struct inode, i_data));
147− inode->i_mapping = dev->dev_mapping;
148− filp->f_mapping = dev->dev_mapping;
149− mutex_unlock(&dev->struct_mutex);
150+ if (retcode)
151+ goto err_undo;
152+ atomic_inc(&dev->counts[_DRM_STAT_OPENS]);
153+ if (need_setup) {
154+ retcode = drm_setup(dev);
155+ if (retcode)
156+ goto err_undo;
150157 }
158+ return 0;
151159
160+err_undo:
161+ mutex_lock(&dev->struct_mutex);
162+ filp->f_mapping = old_mapping;
163+ inode->i_mapping = old_mapping;
164+ iput(container_of(dev->dev_mapping, struct inode, i_data));
165+ dev->dev_mapping = old_mapping;
166+ mutex_unlock(&dev->struct_mutex);
167+ dev->open_count--;
152168 return retcode;
153169 }
154170 EXPORT_SYMBOL(drm_open);
drivers/gpu/drm/exynos/Kconfig+1−1
@@ -1,6 +1,6 @@
11 config DRM_EXYNOS
22 tristate "DRM Support for Samsung SoC EXYNOS Series"
3− depends on DRM && PLAT_SAMSUNG
3+ depends on DRM && (PLAT_SAMSUNG || ARCH_MULTIPLATFORM)
44 select DRM_KMS_HELPER
55 select FB_CFB_FILLRECT
66 select FB_CFB_COPYAREA
drivers/gpu/drm/exynos/exynos_drm_connector.c+1−0
@@ -374,6 +374,7 @@ struct drm_connector *exynos_drm_connector_create(struct drm_device *dev, · 373 unmodified lines
374374 exynos_connector->encoder_id = encoder->base.id;
375375 exynos_connector->manager = manager;
376376 exynos_connector->dpms = DRM_MODE_DPMS_OFF;
377+ connector->dpms = DRM_MODE_DPMS_OFF;
377378 connector->encoder = encoder;
378379
379380 err = drm_mode_connector_attach_encoder(connector, encoder);
drivers/gpu/drm/exynos/exynos_drm_encoder.c+17−16
@@ -43,12 +43,14 @@ · 42 unmodified lines
4343 * @manager: specific encoder has its own manager to control a hardware
4444 * appropriately and we can access a hardware drawing on this manager.
4545 * @dpms: store the encoder dpms value.
46+ * @updated: indicate whether overlay data updating is needed or not.
4647 */
4748 struct exynos_drm_encoder {
4849 struct drm_crtc *old_crtc;
4950 struct drm_encoder drm_encoder;
5051 struct exynos_drm_manager *manager;
51− int dpms;
52+ int dpms;
53+ bool updated;
5254 };
5355
5456 static void exynos_drm_connector_power(struct drm_encoder *encoder, int mode)
@@ -85,7 +87,9 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode) · 30 unmodified lines
8587 switch (mode) {
8688 case DRM_MODE_DPMS_ON:
8789 if (manager_ops && manager_ops->apply)
88− manager_ops->apply(manager->dev);
90+ if (!exynos_encoder->updated)
91+ manager_ops->apply(manager->dev);
92+
8993 exynos_drm_connector_power(encoder, mode);
9094 exynos_encoder->dpms = mode;
9195 break;
@@ -94,6 +98,7 @@ static void exynos_drm_encoder_dpms(struct drm_encoder *encoder, int mode) · 2 unmodified lines
9498 case DRM_MODE_DPMS_OFF:
9599 exynos_drm_connector_power(encoder, mode);
96100 exynos_encoder->dpms = mode;
101+ exynos_encoder->updated = false;
97102 break;
98103 default:
99104 DRM_ERROR("unspecified mode %d\n", mode);
@@ -205,13 +210,22 @@ static void exynos_drm_encoder_prepare(struct drm_encoder *encoder) · 105 unmodified lines
205210
206211 static void exynos_drm_encoder_commit(struct drm_encoder *encoder)
207212 {
208− struct exynos_drm_manager *manager = exynos_drm_get_manager(encoder);
213+ struct exynos_drm_encoder *exynos_encoder = to_exynos_encoder(encoder);
214+ struct exynos_drm_manager *manager = exynos_encoder->manager;
209215 struct exynos_drm_manager_ops *manager_ops = manager->ops;
210216
211217 DRM_DEBUG_KMS("%s\n", __FILE__);
212218
213219 if (manager_ops && manager_ops->commit)
214220 manager_ops->commit(manager->dev);
221+
222+ /*
223+ * this will avoid one issue that overlay data is updated to
224+ * real hardware two times.
225+ * And this variable will be used to check if the data was
226+ * already updated or not by exynos_drm_encoder_dpms function.
227+ */
228+ exynos_encoder->updated = true;
215229 }
216230
217231 static void exynos_drm_encoder_disable(struct drm_encoder *encoder)
@@ -400,19 +414,6 @@ void exynos_drm_encoder_crtc_dpms(struct drm_encoder *encoder, void *data) · 182 unmodified lines
400414 if (manager_ops && manager_ops->dpms)
401415 manager_ops->dpms(manager->dev, mode);
402416
403− /*
404− * set current mode to new one so that data aren't updated into
405− * registers by drm_helper_connector_dpms two times.
406− *
407− * in case that drm_crtc_helper_set_mode() is called,
408− * overlay_ops->commit() and manager_ops->commit() callbacks
409− * can be called two times, first at drm_crtc_helper_set_mode()
410− * and second at drm_helper_connector_dpms().
411− * so with this setting, when drm_helper_connector_dpms() is called
412− * encoder->funcs->dpms() will be ignored.
413− */
414− exynos_encoder->dpms = mode;
415−
416417 /*
417418 * if this condition is ok then it means that the crtc is already
418419 * detached from encoder and last function for detaching is properly
drivers/gpu/drm/exynos/exynos_mixer.c+1−1
@@ -1142,7 +1142,7 @@ static int __devinit mixer_probe(struct platform_device *pdev) · 1141 unmodified lines
11421142 const struct of_device_id *match;
11431143 match = of_match_node(of_match_ptr(mixer_match_types),
11441144 pdev->dev.of_node);
1145− drv = match->data;
1145+ drv = (struct mixer_drv_data *)match->data;
11461146 } else {
11471147 drv = (struct mixer_drv_data *)
11481148 platform_get_device_id(pdev)->driver_data;
drivers/gpu/drm/i915/i915_dma.c+2−1
@@ -1505,7 +1505,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) · 1504 unmodified lines
15051505 goto put_gmch;
15061506 }
15071507
1508− i915_kick_out_firmware_fb(dev_priv);
1508+ if (drm_core_check_feature(dev, DRIVER_MODESET))
1509+ i915_kick_out_firmware_fb(dev_priv);
15091510
15101511 pci_set_master(dev->pdev);
15111512
drivers/gpu/drm/i915/intel_crt.c+1−1
@@ -729,7 +729,7 @@ void intel_crt_init(struct drm_device *dev) · 728 unmodified lines
729729
730730 crt->base.type = INTEL_OUTPUT_ANALOG;
731731 crt->base.cloneable = true;
732− if (IS_HASWELL(dev))
732+ if (IS_HASWELL(dev) || IS_I830(dev))
733733 crt->base.crtc_mask = (1 << 0);
734734 else
735735 crt->base.crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
drivers/gpu/drm/i915/intel_overlay.c+11−3
@@ -341,9 +341,17 @@ static int intel_overlay_off(struct intel_overlay *overlay) · 340 unmodified lines
341341 intel_ring_emit(ring, flip_addr);
342342 intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
343343 /* turn overlay off */
344− intel_ring_emit(ring, MI_OVERLAY_FLIP | MI_OVERLAY_OFF);
345− intel_ring_emit(ring, flip_addr);
346− intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
344+ if (IS_I830(dev)) {
345+ /* Workaround: Don't disable the overlay fully, since otherwise
346+ * it dies on the next OVERLAY_ON cmd. */
347+ intel_ring_emit(ring, MI_NOOP);
348+ intel_ring_emit(ring, MI_NOOP);
349+ intel_ring_emit(ring, MI_NOOP);
350+ } else {
351+ intel_ring_emit(ring, MI_OVERLAY_FLIP | MI_OVERLAY_OFF);
352+ intel_ring_emit(ring, flip_addr);
353+ intel_ring_emit(ring, MI_WAIT_FOR_EVENT | MI_WAIT_FOR_OVERLAY_FLIP);
354+ }
347355 intel_ring_advance(ring);
348356
349357 return intel_overlay_do_wait_request(overlay, intel_overlay_off_tail);
drivers/gpu/drm/i915/intel_panel.c+1−1
@@ -435,7 +435,7 @@ int intel_panel_setup_backlight(struct drm_device *dev) · 434 unmodified lines
435435 props.type = BACKLIGHT_RAW;
436436 props.max_brightness = _intel_panel_get_max_backlight(dev);
437437 if (props.max_brightness == 0) {
438− DRM_ERROR("Failed to get maximum backlight value\n");
438+ DRM_DEBUG_DRIVER("Failed to get maximum backlight value\n");
439439 return -ENODEV;
440440 }
441441 dev_priv->backlight =
drivers/gpu/drm/i915/intel_sdvo.c+42−20
@@ -894,6 +894,45 @@ static void intel_sdvo_dump_hdmi_buf(struct intel_sdvo *intel_sdvo) · 893 unmodified lines
894894 }
895895 #endif
896896
897+static bool intel_sdvo_write_infoframe(struct intel_sdvo *intel_sdvo,
898+ unsigned if_index, uint8_t tx_rate,
899+ uint8_t *data, unsigned length)
900+{
901+ uint8_t set_buf_index[2] = { if_index, 0 };
902+ uint8_t hbuf_size, tmp[8];
903+ int i;
904+
905+ if (!intel_sdvo_set_value(intel_sdvo,
906+ SDVO_CMD_SET_HBUF_INDEX,
907+ set_buf_index, 2))
908+ return false;
909+
910+ if (!intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_HBUF_INFO,
911+ &hbuf_size, 1))
912+ return false;
913+
914+ /* Buffer size is 0 based, hooray! */
915+ hbuf_size++;
916+
917+ DRM_DEBUG_KMS("writing sdvo hbuf: %i, hbuf_size %i, hbuf_size: %i\n",
918+ if_index, length, hbuf_size);
919+
920+ for (i = 0; i < hbuf_size; i += 8) {
921+ memset(tmp, 0, 8);
922+ if (i < length)
923+ memcpy(tmp, data + i, min_t(unsigned, 8, length - i));
924+
925+ if (!intel_sdvo_set_value(intel_sdvo,
926+ SDVO_CMD_SET_HBUF_DATA,
927+ tmp, 8))
928+ return false;
929+ }
930+
931+ return intel_sdvo_set_value(intel_sdvo,
932+ SDVO_CMD_SET_HBUF_TXRATE,
933+ &tx_rate, 1);
934+}
935+
897936 static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo)
898937 {
899938 struct dip_infoframe avi_if = {
@@ -901,11 +940,7 @@ static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo) · 1 unmodified line
901940 .ver = DIP_VERSION_AVI,
902941 .len = DIP_LEN_AVI,
903942 };
904− uint8_t tx_rate = SDVO_HBUF_TX_VSYNC;
905− uint8_t set_buf_index[2] = { 1, 0 };
906943 uint8_t sdvo_data[4 + sizeof(avi_if.body.avi)];
907− uint64_t *data = (uint64_t *)sdvo_data;
908− unsigned i;
909944
910945 intel_dip_infoframe_csum(&avi_if);
911946
@@ -915,22 +950,9 @@ static bool intel_sdvo_set_avi_infoframe(struct intel_sdvo *intel_sdvo) · 3 unmodified lines
915950 sdvo_data[3] = avi_if.checksum;
916951 memcpy(&sdvo_data[4], &avi_if.body, sizeof(avi_if.body.avi));
917952
918− if (!intel_sdvo_set_value(intel_sdvo,
919− SDVO_CMD_SET_HBUF_INDEX,
920− set_buf_index, 2))
921− return false;
922−
923− for (i = 0; i < sizeof(sdvo_data); i += 8) {
924− if (!intel_sdvo_set_value(intel_sdvo,
925− SDVO_CMD_SET_HBUF_DATA,
926− data, 8))
927− return false;
928− data++;
929− }
930−
931− return intel_sdvo_set_value(intel_sdvo,
932− SDVO_CMD_SET_HBUF_TXRATE,
933− &tx_rate, 1);
953+ return intel_sdvo_write_infoframe(intel_sdvo, SDVO_HBUF_INDEX_AVI_IF,
954+ SDVO_HBUF_TX_VSYNC,
955+ sdvo_data, sizeof(sdvo_data));
934956 }
935957
936958 static bool intel_sdvo_set_tv_format(struct intel_sdvo *intel_sdvo)
drivers/gpu/drm/i915/intel_sdvo_regs.h+2−0
@@ -708,6 +708,8 @@ struct intel_sdvo_enhancements_arg { · 707 unmodified lines
708708 #define SDVO_CMD_SET_AUDIO_STAT 0x91
709709 #define SDVO_CMD_GET_AUDIO_STAT 0x92
710710 #define SDVO_CMD_SET_HBUF_INDEX 0x93
711+ #define SDVO_HBUF_INDEX_ELD 0
712+ #define SDVO_HBUF_INDEX_AVI_IF 1
711713 #define SDVO_CMD_GET_HBUF_INDEX 0x94
712714 #define SDVO_CMD_GET_HBUF_INFO 0x95
713715 #define SDVO_CMD_SET_HBUF_AV_SPLIT 0x96
drivers/gpu/drm/nouveau/core/core/mm.c+6−3
@@ -218,13 +218,16 @@ nouveau_mm_init(struct nouveau_mm *mm, u32 offset, u32 length, u32 block) · 217 unmodified lines
218218 node = kzalloc(sizeof(*node), GFP_KERNEL);
219219 if (!node)
220220 return -ENOMEM;
221− node->offset = roundup(offset, mm->block_size);
222− node->length = rounddown(offset + length, mm->block_size) - node->offset;
221+
222+ if (length) {
223+ node->offset = roundup(offset, mm->block_size);
224+ node->length = rounddown(offset + length, mm->block_size);
225+ node->length -= node->offset;
226+ }
223227
224228 list_add_tail(&node->nl_entry, &mm->nodes);
225229 list_add_tail(&node->fl_entry, &mm->free);
226230 mm->heap_nodes++;
227− mm->heap_size += length;
228231 return 0;
229232 }
230233
drivers/gpu/drm/nouveau/core/engine/disp/nv50.c+12−8
@@ -22,6 +22,8 @@ · 21 unmodified lines
2222 * Authors: Ben Skeggs
2323 */
2424
25+#include <subdev/bar.h>
26+
2527 #include <engine/software.h>
2628 #include <engine/disp.h>
2729
@@ -37,6 +39,7 @@ nv50_disp_sclass[] = { · 9 unmodified lines
3739 static void
3840 nv50_disp_intr_vblank(struct nv50_disp_priv *priv, int crtc)
3941 {
42+ struct nouveau_bar *bar = nouveau_bar(priv);
4043 struct nouveau_disp *disp = &priv->base;
4144 struct nouveau_software_chan *chan, *temp;
4245 unsigned long flags;
@@ -46,18 +49,19 @@ nv50_disp_intr_vblank(struct nv50_disp_priv *priv, int crtc) · 3 unmodified lines
4649 if (chan->vblank.crtc != crtc)
4750 continue;
4851
49− nv_wr32(priv, 0x001704, chan->vblank.channel);
50− nv_wr32(priv, 0x001710, 0x80000000 | chan->vblank.ctxdma);
51−
5252 if (nv_device(priv)->chipset == 0x50) {
53+ nv_wr32(priv, 0x001704, chan->vblank.channel);
54+ nv_wr32(priv, 0x001710, 0x80000000 | chan->vblank.ctxdma);
55+ bar->flush(bar);
5356 nv_wr32(priv, 0x001570, chan->vblank.offset);
5457 nv_wr32(priv, 0x001574, chan->vblank.value);
5558 } else {
56− if (nv_device(priv)->chipset >= 0xc0) {
57− nv_wr32(priv, 0x06000c,
58− upper_32_bits(chan->vblank.offset));
59− }
60− nv_wr32(priv, 0x060010, chan->vblank.offset);
59+ nv_wr32(priv, 0x001718, 0x80000000 | chan->vblank.channel);
60+ bar->flush(bar);
61+ nv_wr32(priv, 0x06000c,
62+ upper_32_bits(chan->vblank.offset));
63+ nv_wr32(priv, 0x060010,
64+ lower_32_bits(chan->vblank.offset));
6165 nv_wr32(priv, 0x060014, chan->vblank.value);
6266 }
6367
drivers/gpu/drm/nouveau/core/engine/graph/nv40.c+2−2
@@ -156,8 +156,8 @@ nv40_graph_context_ctor(struct nouveau_object *parent, · 155 unmodified lines
156156 static int
157157 nv40_graph_context_fini(struct nouveau_object *object, bool suspend)
158158 {
159− struct nv04_graph_priv *priv = (void *)object->engine;
160− struct nv04_graph_chan *chan = (void *)object;
159+ struct nv40_graph_priv *priv = (void *)object->engine;
160+ struct nv40_graph_chan *chan = (void *)object;
161161 u32 inst = 0x01000000 | nv_gpuobj(chan)->addr >> 4;
162162 int ret = 0;
163163
drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c+1−1
@@ -38,7 +38,7 @@ struct nv40_mpeg_priv { · 37 unmodified lines
3838 };
3939
4040 struct nv40_mpeg_chan {
41− struct nouveau_mpeg base;
41+ struct nouveau_mpeg_chan base;
4242 };
4343
4444 /*******************************************************************************
drivers/gpu/drm/nouveau/core/include/core/mm.h+0−1
@@ -19,7 +19,6 @@ struct nouveau_mm { · 18 unmodified lines
1919
2020 u32 block_size;
2121 int heap_nodes;
22− u32 heap_size;
2322 };
2423
2524 int nouveau_mm_init(struct nouveau_mm *, u32 offset, u32 length, u32 block);
drivers/gpu/drm/nouveau/core/subdev/fb/nv50.c+4−6
@@ -219,13 +219,11 @@ nv50_fb_ctor(struct nouveau_object *parent, struct nouveau_object *engine, · 218 unmodified lines
219219 ((priv->base.ram.size & 0x000000ff) << 32);
220220
221221 tags = nv_rd32(priv, 0x100320);
222− if (tags) {
223− ret = nouveau_mm_init(&priv->base.tags, 0, tags, 1);
224− if (ret)
225− return ret;
222+ ret = nouveau_mm_init(&priv->base.tags, 0, tags, 1);
223+ if (ret)
224+ return ret;
226225
227− nv_debug(priv, "%d compression tags\n", tags);
228− }
226+ nv_debug(priv, "%d compression tags\n", tags);
229227
230228 size = (priv->base.ram.size >> 12) - rsvd_head - rsvd_tail;
231229 switch (device->chipset) {
drivers/gpu/drm/nouveau/core/subdev/i2c/base.c+1−1
@@ -292,7 +292,7 @@ nouveau_i2c_ctor(struct nouveau_object *parent, struct nouveau_object *engine, · 291 unmodified lines
292292 case DCB_I2C_NVIO_BIT:
293293 port->drive = info.drive & 0x0f;
294294 if (device->card_type < NV_D0) {
295− if (info.drive >= ARRAY_SIZE(nv50_i2c_port))
295+ if (port->drive >= ARRAY_SIZE(nv50_i2c_port))
296296 break;
297297 port->drive = nv50_i2c_port[port->drive];
298298 port->sense = port->drive;
drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c+1−1
@@ -67,7 +67,7 @@ nv41_vm_unmap(struct nouveau_gpuobj *pgt, u32 pte, u32 cnt) · 66 unmodified lines
6767 static void
6868 nv41_vm_flush(struct nouveau_vm *vm)
6969 {
70− struct nv04_vm_priv *priv = (void *)vm->vmm;
70+ struct nv04_vmmgr_priv *priv = (void *)vm->vmm;
7171
7272 mutex_lock(&nv_subdev(priv)->mutex);
7373 nv_wr32(priv, 0x100810, 0x00000022);
drivers/gpu/drm/nouveau/nouveau_connector.c+1−1
@@ -355,7 +355,7 @@ nouveau_connector_detect_lvds(struct drm_connector *connector, bool force) · 354 unmodified lines
355355 * valid - it's not (rh#613284)
356356 */
357357 if (nv_encoder->dcb->lvdsconf.use_acpi_for_edid) {
358− if (!(nv_connector->edid = nouveau_acpi_edid(dev, connector))) {
358+ if ((nv_connector->edid = nouveau_acpi_edid(dev, connector))) {
359359 status = connector_status_connected;
360360 goto out;
361361 }
drivers/gpu/drm/nouveau/nouveau_display.c+21−15
@@ -290,6 +290,7 @@ nouveau_display_create(struct drm_device *dev) · 289 unmodified lines
290290 struct nouveau_drm *drm = nouveau_drm(dev);
291291 struct nouveau_disp *pdisp = nouveau_disp(drm->device);
292292 struct nouveau_display *disp;
293+ u32 pclass = dev->pdev->class >> 8;
293294 int ret, gen;
294295
295296 disp = drm->display = kzalloc(sizeof(*disp), GFP_KERNEL);
@@ -360,23 +361,27 @@ nouveau_display_create(struct drm_device *dev) · 64 unmodified lines
360361 drm_kms_helper_poll_init(dev);
361362 drm_kms_helper_poll_disable(dev);
362363
363− if (nv_device(drm->device)->card_type < NV_50)
364− ret = nv04_display_create(dev);
365− else
366− if (nv_device(drm->device)->card_type < NV_D0)
367− ret = nv50_display_create(dev);
368− else
369− ret = nvd0_display_create(dev);
370− if (ret)
371− goto disp_create_err;
372−
373− if (dev->mode_config.num_crtc) {
374− ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
364+ if (nouveau_modeset == 1 ||
365+ (nouveau_modeset < 0 && pclass == PCI_CLASS_DISPLAY_VGA)) {
366+ if (nv_device(drm->device)->card_type < NV_50)
367+ ret = nv04_display_create(dev);
368+ else
369+ if (nv_device(drm->device)->card_type < NV_D0)
370+ ret = nv50_display_create(dev);
371+ else
372+ ret = nvd0_display_create(dev);
375373 if (ret)
376− goto vblank_err;
374+ goto disp_create_err;
375+
376+ if (dev->mode_config.num_crtc) {
377+ ret = drm_vblank_init(dev, dev->mode_config.num_crtc);
378+ if (ret)
379+ goto vblank_err;
380+ }
381+
382+ nouveau_backlight_init(dev);
377383 }
378384
379− nouveau_backlight_init(dev);
380385 return 0;
381386
382387 vblank_err:
@@ -395,7 +400,8 @@ nouveau_display_destroy(struct drm_device *dev) · 12 unmodified lines
395400 nouveau_backlight_exit(dev);
396401 drm_vblank_cleanup(dev);
397402
398− disp->dtor(dev);
403+ if (disp->dtor)
404+ disp->dtor(dev);
399405
400406 drm_kms_helper_poll_fini(dev);
401407 drm_mode_config_cleanup(dev);
drivers/gpu/drm/nouveau/nouveau_drm.c+21−15
@@ -63,8 +63,9 @@ MODULE_PARM_DESC(noaccel, "disable kernel/abi16 acceleration"); · 62 unmodified lines
6363 static int nouveau_noaccel = 0;
6464 module_param_named(noaccel, nouveau_noaccel, int, 0400);
6565
66−MODULE_PARM_DESC(modeset, "enable driver");
67−static int nouveau_modeset = -1;
66+MODULE_PARM_DESC(modeset, "enable driver (default: auto, "
67+ "0 = disabled, 1 = enabled, 2 = headless)");
68+int nouveau_modeset = -1;
6869 module_param_named(modeset, nouveau_modeset, int, 0400);
6970
7071 static struct drm_driver driver;
@@ -363,7 +364,8 @@ nouveau_drm_unload(struct drm_device *dev) · 292 unmodified lines
363364
364365 nouveau_pm_fini(dev);
365366
366− nouveau_display_fini(dev);
367+ if (dev->mode_config.num_crtc)
368+ nouveau_display_fini(dev);
367369 nouveau_display_destroy(dev);
368370
369371 nouveau_irq_fini(dev);
@@ -403,13 +405,15 @@ nouveau_drm_suspend(struct pci_dev *pdev, pm_message_t pm_state) · 33 unmodified lines
403405 pm_state.event == PM_EVENT_PRETHAW)
404406 return 0;
405407
406− NV_INFO(drm, "suspending fbcon...\n");
407− nouveau_fbcon_set_suspend(dev, 1);
408+ if (dev->mode_config.num_crtc) {
409+ NV_INFO(drm, "suspending fbcon...\n");
410+ nouveau_fbcon_set_suspend(dev, 1);
408411
409− NV_INFO(drm, "suspending display...\n");
410− ret = nouveau_display_suspend(dev);
411− if (ret)
412− return ret;
412+ NV_INFO(drm, "suspending display...\n");
413+ ret = nouveau_display_suspend(dev);
414+ if (ret)
415+ return ret;
416+ }
413417
414418 NV_INFO(drm, "evicting buffers...\n");
415419 ttm_bo_evict_mm(&drm->ttm.bdev, TTM_PL_VRAM);
@@ -445,8 +449,10 @@ fail_client: · 29 unmodified lines
445449 nouveau_client_init(&cli->base);
446450 }
447451
448− NV_INFO(drm, "resuming display...\n");
449− nouveau_display_resume(dev);
452+ if (dev->mode_config.num_crtc) {
453+ NV_INFO(drm, "resuming display...\n");
454+ nouveau_display_resume(dev);
455+ }
450456 return ret;
451457 }
452458
@@ -486,8 +492,10 @@ nouveau_drm_resume(struct pci_dev *pdev) · 33 unmodified lines
486492 nouveau_irq_postinstall(dev);
487493 nouveau_pm_resume(dev);
488494
489− NV_INFO(drm, "resuming display...\n");
490− nouveau_display_resume(dev);
495+ if (dev->mode_config.num_crtc) {
496+ NV_INFO(drm, "resuming display...\n");
497+ nouveau_display_resume(dev);
498+ }
491499 return 0;
492500 }
493501
@@ -662,9 +670,7 @@ nouveau_drm_init(void) · 168 unmodified lines
662670 #ifdef CONFIG_VGA_CONSOLE
663671 if (vgacon_text_force())
664672 nouveau_modeset = 0;
665− else
666673 #endif
667− nouveau_modeset = 1;
668674 }
669675
670676 if (!nouveau_modeset)
drivers/gpu/drm/nouveau/nouveau_drm.h+2−0
@@ -141,4 +141,6 @@ int nouveau_drm_resume(struct pci_dev *); · 140 unmodified lines
141141 nv_info((cli), fmt, ##args); \
142142 } while (0)
143143
144+extern int nouveau_modeset;
145+
144146 #endif
drivers/gpu/drm/nouveau/nouveau_irq.c+9−7
@@ -61,13 +61,15 @@ nouveau_irq_handler(DRM_IRQ_ARGS) · 60 unmodified lines
6161
6262 nv_subdev(pmc)->intr(nv_subdev(pmc));
6363
64− if (device->card_type >= NV_D0) {
65− if (nv_rd32(device, 0x000100) & 0x04000000)
66− nvd0_display_intr(dev);
67− } else
68− if (device->card_type >= NV_50) {
69− if (nv_rd32(device, 0x000100) & 0x04000000)
70− nv50_display_intr(dev);
64+ if (dev->mode_config.num_crtc) {
65+ if (device->card_type >= NV_D0) {
66+ if (nv_rd32(device, 0x000100) & 0x04000000)
67+ nvd0_display_intr(dev);
68+ } else
69+ if (device->card_type >= NV_50) {
70+ if (nv_rd32(device, 0x000100) & 0x04000000)
71+ nv50_display_intr(dev);
72+ }
7173 }
7274
7375 return IRQ_HANDLED;
drivers/gpu/drm/nouveau/nv04_dac.c+8−8
@@ -220,7 +220,7 @@ out: · 219 unmodified lines
220220 NVWriteVgaCrtc(dev, 0, NV_CIO_CR_MODE_INDEX, saved_cr_mode);
221221
222222 if (blue == 0x18) {
223− NV_INFO(drm, "Load detected on head A\n");
223+ NV_DEBUG(drm, "Load detected on head A\n");
224224 return connector_status_connected;
225225 }
226226
@@ -338,8 +338,8 @@ nv17_dac_detect(struct drm_encoder *encoder, struct drm_connector *connector) · 111 unmodified lines
338338
339339 if (nv17_dac_sample_load(encoder) &
340340 NV_PRAMDAC_TEST_CONTROL_SENSEB_ALLHI) {
341− NV_INFO(drm, "Load detected on output %c\n",
342− '@' + ffs(dcb->or));
341+ NV_DEBUG(drm, "Load detected on output %c\n",
342+ '@' + ffs(dcb->or));
343343 return connector_status_connected;
344344 } else {
345345 return connector_status_disconnected;
@@ -413,9 +413,9 @@ static void nv04_dac_commit(struct drm_encoder *encoder) · 67 unmodified lines
413413
414414 helper->dpms(encoder, DRM_MODE_DPMS_ON);
415415
416− NV_INFO(drm, "Output %s is running on CRTC %d using output %c\n",
417− drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base),
418− nv_crtc->index, '@' + ffs(nv_encoder->dcb->or));
416+ NV_DEBUG(drm, "Output %s is running on CRTC %d using output %c\n",
417+ drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base),
418+ nv_crtc->index, '@' + ffs(nv_encoder->dcb->or));
419419 }
420420
421421 void nv04_dac_update_dacclk(struct drm_encoder *encoder, bool enable)
@@ -461,8 +461,8 @@ static void nv04_dac_dpms(struct drm_encoder *encoder, int mode) · 39 unmodified lines
461461 return;
462462 nv_encoder->last_dpms = mode;
463463
464− NV_INFO(drm, "Setting dpms mode %d on vga encoder (output %d)\n",
465− mode, nv_encoder->dcb->index);
464+ NV_DEBUG(drm, "Setting dpms mode %d on vga encoder (output %d)\n",
465+ mode, nv_encoder->dcb->index);
466466
467467 nv04_dac_update_dacclk(encoder, mode == DRM_MODE_DPMS_ON);
468468 }
drivers/gpu/drm/nouveau/nv04_dfp.c+7−7
@@ -476,9 +476,9 @@ static void nv04_dfp_commit(struct drm_encoder *encoder) · 475 unmodified lines
476476
477477 helper->dpms(encoder, DRM_MODE_DPMS_ON);
478478
479− NV_INFO(drm, "Output %s is running on CRTC %d using output %c\n",
480− drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base),
481− nv_crtc->index, '@' + ffs(nv_encoder->dcb->or));
479+ NV_DEBUG(drm, "Output %s is running on CRTC %d using output %c\n",
480+ drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base),
481+ nv_crtc->index, '@' + ffs(nv_encoder->dcb->or));
482482 }
483483
484484 static void nv04_dfp_update_backlight(struct drm_encoder *encoder, int mode)
@@ -520,8 +520,8 @@ static void nv04_lvds_dpms(struct drm_encoder *encoder, int mode) · 35 unmodified lines
520520 return;
521521 nv_encoder->last_dpms = mode;
522522
523− NV_INFO(drm, "Setting dpms mode %d on lvds encoder (output %d)\n",
524− mode, nv_encoder->dcb->index);
523+ NV_DEBUG(drm, "Setting dpms mode %d on lvds encoder (output %d)\n",
524+ mode, nv_encoder->dcb->index);
525525
526526 if (was_powersaving && is_powersaving_dpms(mode))
527527 return;
@@ -565,8 +565,8 @@ static void nv04_tmds_dpms(struct drm_encoder *encoder, int mode) · 37 unmodified lines
565565 return;
566566 nv_encoder->last_dpms = mode;
567567
568− NV_INFO(drm, "Setting dpms mode %d on tmds encoder (output %d)\n",
569− mode, nv_encoder->dcb->index);
568+ NV_DEBUG(drm, "Setting dpms mode %d on tmds encoder (output %d)\n",
569+ mode, nv_encoder->dcb->index);
570570
571571 nv04_dfp_update_backlight(encoder, mode);
572572 nv04_dfp_update_fp_control(encoder, mode);
drivers/gpu/drm/nouveau/nv04_tv.c+4−5
@@ -75,8 +75,8 @@ static void nv04_tv_dpms(struct drm_encoder *encoder, int mode) · 74 unmodified lines
7575 struct nv04_mode_state *state = &nv04_display(dev)->mode_reg;
7676 uint8_t crtc1A;
7777
78− NV_INFO(drm, "Setting dpms mode %d on TV encoder (output %d)\n",
79− mode, nv_encoder->dcb->index);
78+ NV_DEBUG(drm, "Setting dpms mode %d on TV encoder (output %d)\n",
79+ mode, nv_encoder->dcb->index);
8080
8181 state->pllsel &= ~(PLLSEL_TV_CRTC1_MASK | PLLSEL_TV_CRTC2_MASK);
8282
@@ -167,9 +167,8 @@ static void nv04_tv_commit(struct drm_encoder *encoder) · 84 unmodified lines
167167
168168 helper->dpms(encoder, DRM_MODE_DPMS_ON);
169169
170− NV_INFO(drm, "Output %s is running on CRTC %d using output %c\n",
171− drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), nv_crtc->index,
172− '@' + ffs(nv_encoder->dcb->or));
170+ NV_DEBUG(drm, "Output %s is running on CRTC %d using output %c\n",
171+ drm_get_connector_name(&nouveau_encoder_connector_get(nv_encoder)->base), nv_crtc->index, '@' + ffs(nv_encoder->dcb->or));
173172 }
174173
175174 static void nv04_tv_destroy(struct drm_encoder *encoder)
drivers/gpu/drm/radeon/atombios_crtc.c+31−23
@@ -1696,35 +1696,43 @@ static int radeon_atom_pick_pll(struct drm_crtc *crtc) · 1695 unmodified lines
16961696 return ATOM_PPLL2;
16971697 DRM_ERROR("unable to allocate a PPLL\n");
16981698 return ATOM_PPLL_INVALID;
1699− } else {
1700− if (ASIC_IS_AVIVO(rdev)) {
1701− /* in DP mode, the DP ref clock can come from either PPLL
1702− * depending on the asic:
1703− * DCE3: PPLL1 or PPLL2
1704− */
1705− if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(radeon_crtc->encoder))) {
1706− /* use the same PPLL for all DP monitors */
1707− pll = radeon_get_shared_dp_ppll(crtc);
1708− if (pll != ATOM_PPLL_INVALID)
1709− return pll;
1710− } else {
1711− /* use the same PPLL for all monitors with the same clock */
1712− pll = radeon_get_shared_nondp_ppll(crtc);
1713− if (pll != ATOM_PPLL_INVALID)
1714− return pll;
1715− }
1716− /* all other cases */
1717− pll_in_use = radeon_get_pll_use_mask(crtc);
1699+ } else if (ASIC_IS_AVIVO(rdev)) {
1700+ /* in DP mode, the DP ref clock can come from either PPLL
1701+ * depending on the asic:
1702+ * DCE3: PPLL1 or PPLL2
1703+ */
1704+ if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(radeon_crtc->encoder))) {
1705+ /* use the same PPLL for all DP monitors */
1706+ pll = radeon_get_shared_dp_ppll(crtc);
1707+ if (pll != ATOM_PPLL_INVALID)
1708+ return pll;
1709+ } else {
1710+ /* use the same PPLL for all monitors with the same clock */
1711+ pll = radeon_get_shared_nondp_ppll(crtc);
1712+ if (pll != ATOM_PPLL_INVALID)
1713+ return pll;
1714+ }
1715+ /* all other cases */
1716+ pll_in_use = radeon_get_pll_use_mask(crtc);
1717+ /* the order shouldn't matter here, but we probably
1718+ * need this until we have atomic modeset
1719+ */
1720+ if (rdev->flags & RADEON_IS_IGP) {
17181721 if (!(pll_in_use & (1 << ATOM_PPLL1)))
17191722 return ATOM_PPLL1;
17201723 if (!(pll_in_use & (1 << ATOM_PPLL2)))
17211724 return ATOM_PPLL2;
1722− DRM_ERROR("unable to allocate a PPLL\n");
1723− return ATOM_PPLL_INVALID;
17241725 } else {
1725− /* on pre-R5xx asics, the crtc to pll mapping is hardcoded */
1726− return radeon_crtc->crtc_id;
1726+ if (!(pll_in_use & (1 << ATOM_PPLL2)))
1727+ return ATOM_PPLL2;
1728+ if (!(pll_in_use & (1 << ATOM_PPLL1)))
1729+ return ATOM_PPLL1;
17271730 }
1731+ DRM_ERROR("unable to allocate a PPLL\n");
1732+ return ATOM_PPLL_INVALID;
1733+ } else {
1734+ /* on pre-R5xx asics, the crtc to pll mapping is hardcoded */
1735+ return radeon_crtc->crtc_id;
17281736 }
17291737 }
17301738
drivers/gpu/drm/radeon/evergreen.c+1−1
@@ -1372,7 +1372,7 @@ void evergreen_mc_resume(struct radeon_device *rdev, struct evergreen_mc_save *s · 1371 unmodified lines
13721372 WREG32(BIF_FB_EN, FB_READ_EN | FB_WRITE_EN);
13731373
13741374 for (i = 0; i < rdev->num_crtc; i++) {
1375− if (save->crtc_enabled) {
1375+ if (save->crtc_enabled[i]) {
13761376 if (ASIC_IS_DCE6(rdev)) {
13771377 tmp = RREG32(EVERGREEN_CRTC_BLANK_CONTROL + crtc_offsets[i]);
13781378 tmp |= EVERGREEN_CRTC_BLANK_DATA_EN;
drivers/gpu/drm/radeon/evergreen_cs.c+4−1
@@ -264,7 +264,7 @@ static int evergreen_surface_check_2d(struct radeon_cs_parser *p, · 263 unmodified lines
264264 /* macro tile width & height */
265265 palign = (8 * surf->bankw * track->npipes) * surf->mtilea;
266266 halign = (8 * surf->bankh * surf->nbanks) / surf->mtilea;
267− mtileb = (palign / 8) * (halign / 8) * tileb;;
267+ mtileb = (palign / 8) * (halign / 8) * tileb;
268268 mtile_pr = surf->nbx / palign;
269269 mtile_ps = (mtile_pr * surf->nby) / halign;
270270 surf->layer_size = mtile_ps * mtileb * slice_pt;
@@ -2725,6 +2725,9 @@ static bool evergreen_vm_reg_valid(u32 reg) · 2454 unmodified lines
27252725 /* check config regs */
27262726 switch (reg) {
27272727 case GRBM_GFX_INDEX:
2728+ case CP_STRMOUT_CNTL:
2729+ case CP_COHER_CNTL:
2730+ case CP_COHER_SIZE:
27282731 case VGT_VTX_VECT_EJECT_REG:
27292732 case VGT_CACHE_INVALIDATION:
27302733 case VGT_GS_VERTEX_REUSE:
drivers/gpu/drm/radeon/evergreend.h+4−0
@@ -91,6 +91,10 @@ · 90 unmodified lines
9191 #define FB_READ_EN (1 << 0)
9292 #define FB_WRITE_EN (1 << 1)
9393
94+#define CP_STRMOUT_CNTL 0x84FC
95+
96+#define CP_COHER_CNTL 0x85F0
97+#define CP_COHER_SIZE 0x85F4
9498 #define CP_COHER_BASE 0x85F8
9599 #define CP_STALLED_STAT1 0x8674
96100 #define CP_STALLED_STAT2 0x8678
drivers/gpu/drm/radeon/radeon_atpx_handler.c+2−2
@@ -352,9 +352,9 @@ static int radeon_atpx_switchto(enum vga_switcheroo_client_id id) · 351 unmodified lines
352352 }
353353
354354 /**
355− * radeon_atpx_switchto - switch to the requested GPU
355+ * radeon_atpx_power_state - power down/up the requested GPU
356356 *
357− * @id: GPU to switch to
357+ * @id: GPU to power down/up
358358 * @state: requested power state (0 = off, 1 = on)
359359 *
360360 * Execute the necessary ATPX function to power down/up the discrete GPU
drivers/gpu/drm/radeon/radeon_connectors.c+21−7
@@ -941,7 +941,7 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) · 940 unmodified lines
941941 struct drm_mode_object *obj;
942942 int i;
943943 enum drm_connector_status ret = connector_status_disconnected;
944− bool dret = false;
944+ bool dret = false, broken_edid = false;
945945
946946 if (!force && radeon_check_hpd_status_unchanged(connector))
947947 return connector->status;
@@ -965,6 +965,9 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) · 17 unmodified lines
965965 ret = connector_status_disconnected;
966966 DRM_ERROR("%s: detected RS690 floating bus bug, stopping ddc detect\n", drm_get_connector_name(connector));
967967 radeon_connector->ddc_bus = NULL;
968+ } else {
969+ ret = connector_status_connected;
970+ broken_edid = true; /* defer use_digital to later */
968971 }
969972 } else {
970973 radeon_connector->use_digital = !!(radeon_connector->edid->input & DRM_EDID_INPUT_DIGITAL);
@@ -1047,13 +1050,24 @@ radeon_dvi_detect(struct drm_connector *connector, bool force) · 76 unmodified lines
10471050
10481051 encoder_funcs = encoder->helper_private;
10491052 if (encoder_funcs->detect) {
1050− if (ret != connector_status_connected) {
1051− ret = encoder_funcs->detect(encoder, connector);
1052− if (ret == connector_status_connected) {
1053− radeon_connector->use_digital = false;
1053+ if (!broken_edid) {
1054+ if (ret != connector_status_connected) {
1055+ /* deal with analog monitors without DDC */
1056+ ret = encoder_funcs->detect(encoder, connector);
1057+ if (ret == connector_status_connected) {
1058+ radeon_connector->use_digital = false;
1059+ }
1060+ if (ret != connector_status_disconnected)
1061+ radeon_connector->detected_by_load = true;
10541062 }
1055− if (ret != connector_status_disconnected)
1056− radeon_connector->detected_by_load = true;
1063+ } else {
1064+ enum drm_connector_status lret;
1065+ /* assume digital unless load detected otherwise */
1066+ radeon_connector->use_digital = true;
1067+ lret = encoder_funcs->detect(encoder, connector);
1068+ DRM_DEBUG_KMS("load_detect %x returned: %x\n",encoder->encoder_type,lret);
1069+ if (lret == connector_status_connected)
1070+ radeon_connector->use_digital = false;
10571071 }
10581072 break;
10591073 }
drivers/gpu/drm/radeon/radeon_legacy_crtc.c+13−2
@@ -295,6 +295,7 @@ static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode) · 294 unmodified lines
295295 struct radeon_crtc *radeon_crtc = to_radeon_crtc(crtc);
296296 struct drm_device *dev = crtc->dev;
297297 struct radeon_device *rdev = dev->dev_private;
298+ uint32_t crtc_ext_cntl = 0;
298299 uint32_t mask;
299300
300301 if (radeon_crtc->crtc_id)
@@ -307,6 +308,16 @@ static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode) · 6 unmodified lines
307308 RADEON_CRTC_VSYNC_DIS |
308309 RADEON_CRTC_HSYNC_DIS);
309310
311+ /*
312+ * On all dual CRTC GPUs this bit controls the CRTC of the primary DAC.
313+ * Therefore it is set in the DAC DMPS function.
314+ * This is different for GPU's with a single CRTC but a primary and a
315+ * TV DAC: here it controls the single CRTC no matter where it is
316+ * routed. Therefore we set it here.
317+ */
318+ if (rdev->flags & RADEON_SINGLE_CRTC)
319+ crtc_ext_cntl = RADEON_CRTC_CRT_ON;
320+
310321 switch (mode) {
311322 case DRM_MODE_DPMS_ON:
312323 radeon_crtc->enabled = true;
@@ -317,7 +328,7 @@ static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode) · 4 unmodified lines
317328 else {
318329 WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_EN, ~(RADEON_CRTC_EN |
319330 RADEON_CRTC_DISP_REQ_EN_B));
320− WREG32_P(RADEON_CRTC_EXT_CNTL, 0, ~mask);
331+ WREG32_P(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl, ~(mask | crtc_ext_cntl));
321332 }
322333 drm_vblank_post_modeset(dev, radeon_crtc->crtc_id);
323334 radeon_crtc_load_lut(crtc);
@@ -331,7 +342,7 @@ static void radeon_crtc_dpms(struct drm_crtc *crtc, int mode) · 7 unmodified lines
331342 else {
332343 WREG32_P(RADEON_CRTC_GEN_CNTL, RADEON_CRTC_DISP_REQ_EN_B, ~(RADEON_CRTC_EN |
333344 RADEON_CRTC_DISP_REQ_EN_B));
334− WREG32_P(RADEON_CRTC_EXT_CNTL, mask, ~mask);
345+ WREG32_P(RADEON_CRTC_EXT_CNTL, mask, ~(mask | crtc_ext_cntl));
335346 }
336347 radeon_crtc->enabled = false;
337348 /* adjust pm to dpms changes AFTER disabling crtcs */
drivers/gpu/drm/radeon/radeon_legacy_encoders.c+147−28
@@ -537,7 +537,9 @@ static void radeon_legacy_primary_dac_dpms(struct drm_encoder *encoder, int mode · 536 unmodified lines
537537 break;
538538 }
539539
540− WREG32(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl);
540+ /* handled in radeon_crtc_dpms() */
541+ if (!(rdev->flags & RADEON_SINGLE_CRTC))
542+ WREG32(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl);
541543 WREG32(RADEON_DAC_CNTL, dac_cntl);
542544 WREG32(RADEON_DAC_MACRO_CNTL, dac_macro_cntl);
543545
@@ -662,6 +664,8 @@ static enum drm_connector_status radeon_legacy_primary_dac_detect(struct drm_enc · 118 unmodified lines
662664
663665 if (ASIC_IS_R300(rdev))
664666 tmp |= (0x1b6 << RADEON_DAC_FORCE_DATA_SHIFT);
667+ else if (ASIC_IS_RV100(rdev))
668+ tmp |= (0x1ac << RADEON_DAC_FORCE_DATA_SHIFT);
665669 else
666670 tmp |= (0x180 << RADEON_DAC_FORCE_DATA_SHIFT);
667671
@@ -671,6 +675,7 @@ static enum drm_connector_status radeon_legacy_primary_dac_detect(struct drm_enc · 3 unmodified lines
671675 tmp |= RADEON_DAC_RANGE_CNTL_PS2 | RADEON_DAC_CMP_EN;
672676 WREG32(RADEON_DAC_CNTL, tmp);
673677
678+ tmp = dac_macro_cntl;
674679 tmp &= ~(RADEON_DAC_PDWN_R |
675680 RADEON_DAC_PDWN_G |
676681 RADEON_DAC_PDWN_B);
@@ -1092,7 +1097,8 @@ static void radeon_legacy_tv_dac_dpms(struct drm_encoder *encoder, int mode) · 415 unmodified lines
10921097 } else {
10931098 if (is_tv)
10941099 WREG32(RADEON_TV_MASTER_CNTL, tv_master_cntl);
1095− else
1100+ /* handled in radeon_crtc_dpms() */
1101+ else if (!(rdev->flags & RADEON_SINGLE_CRTC))
10961102 WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl);
10971103 WREG32(RADEON_TV_DAC_CNTL, tv_dac_cntl);
10981104 }
@@ -1416,13 +1422,104 @@ static bool radeon_legacy_tv_detect(struct drm_encoder *encoder, · 317 unmodified lines
14161422 return found;
14171423 }
14181424
1425+static bool radeon_legacy_ext_dac_detect(struct drm_encoder *encoder,
1426+ struct drm_connector *connector)
1427+{
1428+ struct drm_device *dev = encoder->dev;
1429+ struct radeon_device *rdev = dev->dev_private;
1430+ uint32_t gpio_monid, fp2_gen_cntl, disp_output_cntl, crtc2_gen_cntl;
1431+ uint32_t disp_lin_trans_grph_a, disp_lin_trans_grph_b, disp_lin_trans_grph_c;
1432+ uint32_t disp_lin_trans_grph_d, disp_lin_trans_grph_e, disp_lin_trans_grph_f;
1433+ uint32_t tmp, crtc2_h_total_disp, crtc2_v_total_disp;
1434+ uint32_t crtc2_h_sync_strt_wid, crtc2_v_sync_strt_wid;
1435+ bool found = false;
1436+ int i;
1437+
1438+ /* save the regs we need */
1439+ gpio_monid = RREG32(RADEON_GPIO_MONID);
1440+ fp2_gen_cntl = RREG32(RADEON_FP2_GEN_CNTL);
1441+ disp_output_cntl = RREG32(RADEON_DISP_OUTPUT_CNTL);
1442+ crtc2_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL);
1443+ disp_lin_trans_grph_a = RREG32(RADEON_DISP_LIN_TRANS_GRPH_A);
1444+ disp_lin_trans_grph_b = RREG32(RADEON_DISP_LIN_TRANS_GRPH_B);
1445+ disp_lin_trans_grph_c = RREG32(RADEON_DISP_LIN_TRANS_GRPH_C);
1446+ disp_lin_trans_grph_d = RREG32(RADEON_DISP_LIN_TRANS_GRPH_D);
1447+ disp_lin_trans_grph_e = RREG32(RADEON_DISP_LIN_TRANS_GRPH_E);
1448+ disp_lin_trans_grph_f = RREG32(RADEON_DISP_LIN_TRANS_GRPH_F);
1449+ crtc2_h_total_disp = RREG32(RADEON_CRTC2_H_TOTAL_DISP);
1450+ crtc2_v_total_disp = RREG32(RADEON_CRTC2_V_TOTAL_DISP);
1451+ crtc2_h_sync_strt_wid = RREG32(RADEON_CRTC2_H_SYNC_STRT_WID);
1452+ crtc2_v_sync_strt_wid = RREG32(RADEON_CRTC2_V_SYNC_STRT_WID);
1453+
1454+ tmp = RREG32(RADEON_GPIO_MONID);
1455+ tmp &= ~RADEON_GPIO_A_0;
1456+ WREG32(RADEON_GPIO_MONID, tmp);
1457+
1458+ WREG32(RADEON_FP2_GEN_CNTL, (RADEON_FP2_ON |
1459+ RADEON_FP2_PANEL_FORMAT |
1460+ R200_FP2_SOURCE_SEL_TRANS_UNIT |
1461+ RADEON_FP2_DVO_EN |
1462+ R200_FP2_DVO_RATE_SEL_SDR));
1463+
1464+ WREG32(RADEON_DISP_OUTPUT_CNTL, (RADEON_DISP_DAC_SOURCE_RMX |
1465+ RADEON_DISP_TRANS_MATRIX_GRAPHICS));
1466+
1467+ WREG32(RADEON_CRTC2_GEN_CNTL, (RADEON_CRTC2_EN |
1468+ RADEON_CRTC2_DISP_REQ_EN_B));
1469+
1470+ WREG32(RADEON_DISP_LIN_TRANS_GRPH_A, 0x00000000);
1471+ WREG32(RADEON_DISP_LIN_TRANS_GRPH_B, 0x000003f0);
1472+ WREG32(RADEON_DISP_LIN_TRANS_GRPH_C, 0x00000000);
1473+ WREG32(RADEON_DISP_LIN_TRANS_GRPH_D, 0x000003f0);
1474+ WREG32(RADEON_DISP_LIN_TRANS_GRPH_E, 0x00000000);
1475+ WREG32(RADEON_DISP_LIN_TRANS_GRPH_F, 0x000003f0);
1476+
1477+ WREG32(RADEON_CRTC2_H_TOTAL_DISP, 0x01000008);
1478+ WREG32(RADEON_CRTC2_H_SYNC_STRT_WID, 0x00000800);
1479+ WREG32(RADEON_CRTC2_V_TOTAL_DISP, 0x00080001);
1480+ WREG32(RADEON_CRTC2_V_SYNC_STRT_WID, 0x00000080);
1481+
1482+ for (i = 0; i < 200; i++) {
1483+ tmp = RREG32(RADEON_GPIO_MONID);
1484+ if (tmp & RADEON_GPIO_Y_0)
1485+ found = true;
1486+
1487+ if (found)
1488+ break;
1489+
1490+ if (!drm_can_sleep())
1491+ mdelay(1);
1492+ else
1493+ msleep(1);
1494+ }
1495+
1496+ /* restore the regs we used */
1497+ WREG32(RADEON_DISP_LIN_TRANS_GRPH_A, disp_lin_trans_grph_a);
1498+ WREG32(RADEON_DISP_LIN_TRANS_GRPH_B, disp_lin_trans_grph_b);
1499+ WREG32(RADEON_DISP_LIN_TRANS_GRPH_C, disp_lin_trans_grph_c);
1500+ WREG32(RADEON_DISP_LIN_TRANS_GRPH_D, disp_lin_trans_grph_d);
1501+ WREG32(RADEON_DISP_LIN_TRANS_GRPH_E, disp_lin_trans_grph_e);
1502+ WREG32(RADEON_DISP_LIN_TRANS_GRPH_F, disp_lin_trans_grph_f);
1503+ WREG32(RADEON_CRTC2_H_TOTAL_DISP, crtc2_h_total_disp);
1504+ WREG32(RADEON_CRTC2_V_TOTAL_DISP, crtc2_v_total_disp);
1505+ WREG32(RADEON_CRTC2_H_SYNC_STRT_WID, crtc2_h_sync_strt_wid);
1506+ WREG32(RADEON_CRTC2_V_SYNC_STRT_WID, crtc2_v_sync_strt_wid);
1507+ WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl);
1508+ WREG32(RADEON_DISP_OUTPUT_CNTL, disp_output_cntl);
1509+ WREG32(RADEON_FP2_GEN_CNTL, fp2_gen_cntl);
1510+ WREG32(RADEON_GPIO_MONID, gpio_monid);
1511+
1512+ return found;
1513+}
1514+
14191515 static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder *encoder,
14201516 struct drm_connector *connector)
14211517 {
14221518 struct drm_device *dev = encoder->dev;
14231519 struct radeon_device *rdev = dev->dev_private;
1424− uint32_t crtc2_gen_cntl, tv_dac_cntl, dac_cntl2, dac_ext_cntl;
1425− uint32_t disp_hw_debug, disp_output_cntl, gpiopad_a, pixclks_cntl, tmp;
1520+ uint32_t crtc2_gen_cntl = 0, tv_dac_cntl, dac_cntl2, dac_ext_cntl;
1521+ uint32_t gpiopad_a = 0, pixclks_cntl, tmp;
1522+ uint32_t disp_output_cntl = 0, disp_hw_debug = 0, crtc_ext_cntl = 0;
14261523 enum drm_connector_status found = connector_status_disconnected;
14271524 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
14281525 struct radeon_encoder_tv_dac *tv_dac = radeon_encoder->enc_priv;
@@ -1459,12 +1556,27 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder · 30 unmodified lines
14591556 return connector_status_disconnected;
14601557 }
14611558
1559+ /* R200 uses an external DAC for secondary DAC */
1560+ if (rdev->family == CHIP_R200) {
1561+ if (radeon_legacy_ext_dac_detect(encoder, connector))
1562+ found = connector_status_connected;
1563+ return found;
1564+ }
1565+
14621566 /* save the regs we need */
14631567 pixclks_cntl = RREG32_PLL(RADEON_PIXCLKS_CNTL);
1464− gpiopad_a = ASIC_IS_R300(rdev) ? RREG32(RADEON_GPIOPAD_A) : 0;
1465− disp_output_cntl = ASIC_IS_R300(rdev) ? RREG32(RADEON_DISP_OUTPUT_CNTL) : 0;
1466− disp_hw_debug = ASIC_IS_R300(rdev) ? 0 : RREG32(RADEON_DISP_HW_DEBUG);
1467− crtc2_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL);
1568+
1569+ if (rdev->flags & RADEON_SINGLE_CRTC) {
1570+ crtc_ext_cntl = RREG32(RADEON_CRTC_EXT_CNTL);
1571+ } else {
1572+ if (ASIC_IS_R300(rdev)) {
1573+ gpiopad_a = RREG32(RADEON_GPIOPAD_A);
1574+ disp_output_cntl = RREG32(RADEON_DISP_OUTPUT_CNTL);
1575+ } else {
1576+ disp_hw_debug = RREG32(RADEON_DISP_HW_DEBUG);
1577+ }
1578+ crtc2_gen_cntl = RREG32(RADEON_CRTC2_GEN_CNTL);
1579+ }
14681580 tv_dac_cntl = RREG32(RADEON_TV_DAC_CNTL);
14691581 dac_ext_cntl = RREG32(RADEON_DAC_EXT_CNTL);
14701582 dac_cntl2 = RREG32(RADEON_DAC_CNTL2);
@@ -1473,22 +1585,24 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder · 2 unmodified lines
14731585 | RADEON_PIX2CLK_DAC_ALWAYS_ONb);
14741586 WREG32_PLL(RADEON_PIXCLKS_CNTL, tmp);
14751587
1476− if (ASIC_IS_R300(rdev))
1477− WREG32_P(RADEON_GPIOPAD_A, 1, ~1);
1478−
1479− tmp = crtc2_gen_cntl & ~RADEON_CRTC2_PIX_WIDTH_MASK;
1480− tmp |= RADEON_CRTC2_CRT2_ON |
1481− (2 << RADEON_CRTC2_PIX_WIDTH_SHIFT);
1482−
1483− WREG32(RADEON_CRTC2_GEN_CNTL, tmp);
1484−
1485− if (ASIC_IS_R300(rdev)) {
1486− tmp = disp_output_cntl & ~RADEON_DISP_TVDAC_SOURCE_MASK;
1487− tmp |= RADEON_DISP_TVDAC_SOURCE_CRTC2;
1488− WREG32(RADEON_DISP_OUTPUT_CNTL, tmp);
1588+ if (rdev->flags & RADEON_SINGLE_CRTC) {
1589+ tmp = crtc_ext_cntl | RADEON_CRTC_CRT_ON;
1590+ WREG32(RADEON_CRTC_EXT_CNTL, tmp);
14891591 } else {
1490− tmp = disp_hw_debug & ~RADEON_CRT2_DISP1_SEL;
1491− WREG32(RADEON_DISP_HW_DEBUG, tmp);
1592+ tmp = crtc2_gen_cntl & ~RADEON_CRTC2_PIX_WIDTH_MASK;
1593+ tmp |= RADEON_CRTC2_CRT2_ON |
1594+ (2 << RADEON_CRTC2_PIX_WIDTH_SHIFT);
1595+ WREG32(RADEON_CRTC2_GEN_CNTL, tmp);
1596+
1597+ if (ASIC_IS_R300(rdev)) {
1598+ WREG32_P(RADEON_GPIOPAD_A, 1, ~1);
1599+ tmp = disp_output_cntl & ~RADEON_DISP_TVDAC_SOURCE_MASK;
1600+ tmp |= RADEON_DISP_TVDAC_SOURCE_CRTC2;
1601+ WREG32(RADEON_DISP_OUTPUT_CNTL, tmp);
1602+ } else {
1603+ tmp = disp_hw_debug & ~RADEON_CRT2_DISP1_SEL;
1604+ WREG32(RADEON_DISP_HW_DEBUG, tmp);
1605+ }
14921606 }
14931607
14941608 tmp = RADEON_TV_DAC_NBLANK |
@@ -1530,14 +1644,19 @@ static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder · 35 unmodified lines
15301644 WREG32(RADEON_DAC_CNTL2, dac_cntl2);
15311645 WREG32(RADEON_DAC_EXT_CNTL, dac_ext_cntl);
15321646 WREG32(RADEON_TV_DAC_CNTL, tv_dac_cntl);
1533− WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl);
15341647
1535− if (ASIC_IS_R300(rdev)) {
1536− WREG32(RADEON_DISP_OUTPUT_CNTL, disp_output_cntl);
1537− WREG32_P(RADEON_GPIOPAD_A, gpiopad_a, ~1);
1648+ if (rdev->flags & RADEON_SINGLE_CRTC) {
1649+ WREG32(RADEON_CRTC_EXT_CNTL, crtc_ext_cntl);
15381650 } else {
1539− WREG32(RADEON_DISP_HW_DEBUG, disp_hw_debug);
1651+ WREG32(RADEON_CRTC2_GEN_CNTL, crtc2_gen_cntl);
1652+ if (ASIC_IS_R300(rdev)) {
1653+ WREG32(RADEON_DISP_OUTPUT_CNTL, disp_output_cntl);
1654+ WREG32_P(RADEON_GPIOPAD_A, gpiopad_a, ~1);
1655+ } else {
1656+ WREG32(RADEON_DISP_HW_DEBUG, disp_hw_debug);
1657+ }
15401658 }
1659+
15411660 WREG32_PLL(RADEON_PIXCLKS_CNTL, pixclks_cntl);
15421661
15431662 return found;
drivers/gpu/drm/radeon/si.c+1−0
@@ -2474,6 +2474,7 @@ static bool si_vm_reg_valid(u32 reg) · 2473 unmodified lines
24742474 /* check config regs */
24752475 switch (reg) {
24762476 case GRBM_GFX_INDEX:
2477+ case CP_STRMOUT_CNTL:
24772478 case VGT_VTX_VECT_EJECT_REG:
24782479 case VGT_CACHE_INVALIDATION:
24792480 case VGT_ESGS_RING_SIZE:
drivers/gpu/drm/radeon/sid.h+1−0
@@ -424,6 +424,7 @@ · 423 unmodified lines
424424 # define RDERR_INT_ENABLE (1 << 0)
425425 # define GUI_IDLE_INT_ENABLE (1 << 19)
426426
427+#define CP_STRMOUT_CNTL 0x84FC
427428 #define SCRATCH_REG0 0x8500
428429 #define SCRATCH_REG1 0x8504
429430 #define SCRATCH_REG2 0x8508
drivers/gpu/drm/udl/udl_drv.h+1−1
@@ -104,7 +104,7 @@ udl_fb_user_fb_create(struct drm_device *dev, · 103 unmodified lines
104104
105105 int udl_render_hline(struct drm_device *dev, int bpp, struct urb **urb_ptr,
106106 const char *front, char **urb_buf_ptr,
107− u32 byte_offset, u32 byte_width,
107+ u32 byte_offset, u32 device_byte_offset, u32 byte_width,
108108 int *ident_ptr, int *sent_ptr);
109109
110110 int udl_dumb_create(struct drm_file *file_priv,
drivers/gpu/drm/udl/udl_fb.c+7−5
@@ -114,9 +114,10 @@ static void udlfb_dpy_deferred_io(struct fb_info *info, · 113 unmodified lines
114114 list_for_each_entry(cur, &fbdefio->pagelist, lru) {
115115
116116 if (udl_render_hline(dev, (ufbdev->ufb.base.bits_per_pixel / 8),
117− &urb, (char *) info->fix.smem_start,
118− &cmd, cur->index << PAGE_SHIFT,
119− PAGE_SIZE, &bytes_identical, &bytes_sent))
117+ &urb, (char *) info->fix.smem_start,
118+ &cmd, cur->index << PAGE_SHIFT,
119+ cur->index << PAGE_SHIFT,
120+ PAGE_SIZE, &bytes_identical, &bytes_sent))
120121 goto error;
121122 bytes_rendered += PAGE_SIZE;
122123 }
@@ -187,10 +188,11 @@ int udl_handle_damage(struct udl_framebuffer *fb, int x, int y, · 64 unmodified lines
187188 for (i = y; i < y + height ; i++) {
188189 const int line_offset = fb->base.pitches[0] * i;
189190 const int byte_offset = line_offset + (x * bpp);
190−
191+ const int dev_byte_offset = (fb->base.width * bpp * i) + (x * bpp);
191192 if (udl_render_hline(dev, bpp, &urb,
192193 (char *) fb->obj->vmapping,
193− &cmd, byte_offset, width * bpp,
194+ &cmd, byte_offset, dev_byte_offset,
195+ width * bpp,
194196 &bytes_identical, &bytes_sent))
195197 goto error;
196198 }
drivers/gpu/drm/udl/udl_transfer.c+3−2
@@ -213,11 +213,12 @@ static void udl_compress_hline16( · 212 unmodified lines
213213 */
214214 int udl_render_hline(struct drm_device *dev, int bpp, struct urb **urb_ptr,
215215 const char *front, char **urb_buf_ptr,
216− u32 byte_offset, u32 byte_width,
216+ u32 byte_offset, u32 device_byte_offset,
217+ u32 byte_width,
217218 int *ident_ptr, int *sent_ptr)
218219 {
219220 const u8 *line_start, *line_end, *next_pixel;
220− u32 base16 = 0 + (byte_offset / bpp) * 2;
221+ u32 base16 = 0 + (device_byte_offset / bpp) * 2;
221222 struct urb *urb = *urb_ptr;
222223 u8 *cmd = *urb_buf_ptr;
223224 u8 *cmd_end = (u8 *) urb->transfer_buffer + urb->transfer_buffer_length;
drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c+1−1
@@ -306,7 +306,7 @@ void vmw_bo_pin(struct ttm_buffer_object *bo, bool pin) · 305 unmodified lines
306306
307307 BUG_ON(!atomic_read(&bo->reserved));
308308 BUG_ON(old_mem_type != TTM_PL_VRAM &&
309− old_mem_type != VMW_PL_FLAG_GMR);
309+ old_mem_type != VMW_PL_GMR);
310310
311311 pl_flags = TTM_PL_FLAG_VRAM | VMW_PL_FLAG_GMR | TTM_PL_FLAG_CACHED;
312312 if (pin)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c+5−0
@@ -1098,6 +1098,11 @@ static void vmw_pm_complete(struct device *kdev) · 1097 unmodified lines
10981098 struct drm_device *dev = pci_get_drvdata(pdev);
10991099 struct vmw_private *dev_priv = vmw_priv(dev);
11001100
1101+ mutex_lock(&dev_priv->hw_mutex);
1102+ vmw_write(dev_priv, SVGA_REG_ID, SVGA_ID_2);
1103+ (void) vmw_read(dev_priv, SVGA_REG_ID);
1104+ mutex_unlock(&dev_priv->hw_mutex);
1105+
11011106 /**
11021107 * Reclaim 3d reference held by fbdev and potentially
11031108 * start fifo.
drivers/hid/hid-apple.c+6−0
@@ -522,6 +522,12 @@ static const struct hid_device_id apple_devices[] = { · 521 unmodified lines
522522 .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
523523 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS),
524524 .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
525+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI),
526+ .driver_data = APPLE_HAS_FN },
527+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO),
528+ .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
529+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS),
530+ .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
525531 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
526532 .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
527533 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
drivers/hid/hid-core.c+6−0
@@ -1532,6 +1532,9 @@ static const struct hid_device_id hid_have_special_driver[] = { · 1531 unmodified lines
15321532 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) },
15331533 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) },
15341534 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) },
1535+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI) },
1536+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO) },
1537+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS) },
15351538 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) },
15361539 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) },
15371540 { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) },
@@ -2139,6 +2142,9 @@ static const struct hid_device_id hid_mouse_ignore_list[] = { · 601 unmodified lines
21392142 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) },
21402143 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) },
21412144 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) },
2145+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI) },
2146+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO) },
2147+ { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS) },
21422148 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
21432149 { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
21442150 { }
drivers/hid/hid-ids.h+3−0
@@ -118,6 +118,9 @@ · 117 unmodified lines
118118 #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI 0x0252
119119 #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO 0x0253
120120 #define USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS 0x0254
121+#define USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI 0x0259
122+#define USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO 0x025a
123+#define USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS 0x025b
121124 #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI 0x0249
122125 #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO 0x024a
123126 #define USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS 0x024b
drivers/hid/hid-microsoft.c+13−5
@@ -28,22 +28,30 @@ · 27 unmodified lines
2828 #define MS_RDESC 0x08
2929 #define MS_NOGET 0x10
3030 #define MS_DUPLICATE_USAGES 0x20
31+#define MS_RDESC_3K 0x40
3132
32−/*
33− * Microsoft Wireless Desktop Receiver (Model 1028) has
34− * 'Usage Min/Max' where it ought to have 'Physical Min/Max'
35− */
3633 static __u8 *ms_report_fixup(struct hid_device *hdev, __u8 *rdesc,
3734 unsigned int *rsize)
3835 {
3936 unsigned long quirks = (unsigned long)hid_get_drvdata(hdev);
4037
38+ /*
39+ * Microsoft Wireless Desktop Receiver (Model 1028) has
40+ * 'Usage Min/Max' where it ought to have 'Physical Min/Max'
41+ */
4142 if ((quirks & MS_RDESC) && *rsize == 571 && rdesc[557] == 0x19 &&
4243 rdesc[559] == 0x29) {
4344 hid_info(hdev, "fixing up Microsoft Wireless Receiver Model 1028 report descriptor\n");
4445 rdesc[557] = 0x35;
4546 rdesc[559] = 0x45;
4647 }
48+ /* the same as above (s/usage/physical/) */
49+ if ((quirks & MS_RDESC_3K) && *rsize == 106 &&
50+ !memcmp((char []){ 0x19, 0x00, 0x29, 0xff },
51+ &rdesc[94], 4)) {
52+ rdesc[94] = 0x35;
53+ rdesc[96] = 0x45;
54+ }
4755 return rdesc;
4856 }
4957
@@ -192,7 +200,7 @@ static const struct hid_device_id ms_devices[] = { · 142 unmodified lines
192200 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB),
193201 .driver_data = MS_PRESENTER },
194202 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K),
195− .driver_data = MS_ERGONOMY },
203+ .driver_data = MS_ERGONOMY | MS_RDESC_3K },
196204 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0),
197205 .driver_data = MS_NOGET },
198206 { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500),
drivers/hid/hid-multitouch.c+2−3
@@ -210,8 +210,7 @@ static struct mt_class mt_classes[] = { · 209 unmodified lines
210210 },
211211 { .name = MT_CLS_GENERALTOUCH_PWT_TENFINGERS,
212212 .quirks = MT_QUIRK_NOT_SEEN_MEANS_UP |
213− MT_QUIRK_SLOT_IS_CONTACTNUMBER,
214− .maxcontacts = 10
213+ MT_QUIRK_SLOT_IS_CONTACTNUMBER
215214 },
216215
217216 { .name = MT_CLS_FLATFROG,
@@ -421,11 +420,11 @@ static int mt_input_mapping(struct hid_device *hdev, struct hid_input *hi, · 203 unmodified lines
421420 * contact max are global to the report */
422421 td->last_field_index = field->index;
423422 return -1;
424− }
425423 case HID_DG_TOUCH:
426424 /* Legacy devices use TIPSWITCH and not TOUCH.
427425 * Let's just ignore this field. */
428426 return -1;
427+ }
429428 /* let hid-input decide for the others */
430429 return 0;
431430
drivers/hid/hidraw.c+43−26
@@ -42,7 +42,6 @@ static struct cdev hidraw_cdev; · 41 unmodified lines
4242 static struct class *hidraw_class;
4343 static struct hidraw *hidraw_table[HIDRAW_MAX_DEVICES];
4444 static DEFINE_MUTEX(minors_lock);
45−static void drop_ref(struct hidraw *hid, int exists_bit);
4645
4746 static ssize_t hidraw_read(struct file *file, char __user *buffer, size_t count, loff_t *ppos)
4847 {
@@ -114,7 +113,7 @@ static ssize_t hidraw_send_report(struct file *file, const char __user *buffer, · 65 unmodified lines
114113 __u8 *buf;
115114 int ret = 0;
116115
117− if (!hidraw_table[minor] || !hidraw_table[minor]->exist) {
116+ if (!hidraw_table[minor]) {
118117 ret = -ENODEV;
119118 goto out;
120119 }
@@ -262,7 +261,7 @@ static int hidraw_open(struct inode *inode, struct file *file) · 141 unmodified lines
262261 }
263262
264263 mutex_lock(&minors_lock);
265− if (!hidraw_table[minor] || !hidraw_table[minor]->exist) {
264+ if (!hidraw_table[minor]) {
266265 err = -ENODEV;
267266 goto out_unlock;
268267 }
@@ -299,12 +298,36 @@ out: · 30 unmodified lines
299298 static int hidraw_release(struct inode * inode, struct file * file)
300299 {
301300 unsigned int minor = iminor(inode);
301+ struct hidraw *dev;
302302 struct hidraw_list *list = file->private_data;
303+ int ret;
304+ int i;
305+
306+ mutex_lock(&minors_lock);
307+ if (!hidraw_table[minor]) {
308+ ret = -ENODEV;
309+ goto unlock;
310+ }
303311
304− drop_ref(hidraw_table[minor], 0);
305312 list_del(&list->node);
313+ dev = hidraw_table[minor];
314+ if (!--dev->open) {
315+ if (list->hidraw->exist) {
316+ hid_hw_power(dev->hid, PM_HINT_NORMAL);
317+ hid_hw_close(dev->hid);
318+ } else {
319+ kfree(list->hidraw);
320+ }
321+ }
322+
323+ for (i = 0; i < HIDRAW_BUFFER_SIZE; ++i)
324+ kfree(list->buffer[i].value);
306325 kfree(list);
307− return 0;
326+ ret = 0;
327+unlock:
328+ mutex_unlock(&minors_lock);
329+
330+ return ret;
308331 }
309332
310333 static long hidraw_ioctl(struct file *file, unsigned int cmd,
@@ -506,7 +529,21 @@ EXPORT_SYMBOL_GPL(hidraw_connect); · 195 unmodified lines
506529 void hidraw_disconnect(struct hid_device *hid)
507530 {
508531 struct hidraw *hidraw = hid->hidraw;
509− drop_ref(hidraw, 1);
532+
533+ mutex_lock(&minors_lock);
534+ hidraw->exist = 0;
535+
536+ device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor));
537+
538+ hidraw_table[hidraw->minor] = NULL;
539+
540+ if (hidraw->open) {
541+ hid_hw_close(hid);
542+ wake_up_interruptible(&hidraw->wait);
543+ } else {
544+ kfree(hidraw);
545+ }
546+ mutex_unlock(&minors_lock);
510547 }
511548 EXPORT_SYMBOL_GPL(hidraw_disconnect);
512549
@@ -555,23 +592,3 @@ void hidraw_exit(void) · 42 unmodified lines
555592 unregister_chrdev_region(dev_id, HIDRAW_MAX_DEVICES);
556593
557594 }
558−
559−static void drop_ref(struct hidraw *hidraw, int exists_bit)
560−{
561− mutex_lock(&minors_lock);
562− if (exists_bit) {
563− hid_hw_close(hidraw->hid);
564− hidraw->exist = 0;
565− if (hidraw->open)
566− wake_up_interruptible(&hidraw->wait);
567− } else {
568− --hidraw->open;
569− }
570−
571− if (!hidraw->open && !hidraw->exist) {
572− device_destroy(hidraw_class, MKDEV(hidraw_major, hidraw->minor));
573− hidraw_table[hidraw->minor] = NULL;
574− kfree(hidraw);
575− }
576− mutex_unlock(&minors_lock);
577−}
drivers/hwmon/asb100.c+1−1
@@ -32,7 +32,7 @@ · 31 unmodified lines
3232 * ASB100-A supports pwm1, while plain ASB100 does not. There is no known
3333 * way for the driver to tell which one is there.
3434 *
35− * Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA
35+ * Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA
3636 * asb100 7 3 1 4 0x31 0x0694 yes no
3737 */
3838
drivers/hwmon/fam15h_power.c+2−2
@@ -2,7 +2,7 @@ · 1 unmodified line
22 * fam15h_power.c - AMD Family 15h processor power monitoring
33 *
44 * Copyright (c) 2011 Advanced Micro Devices, Inc.
5− * Author: Andreas Herrmann <andreas.herrmann3@amd.com>
5+ * Author: Andreas Herrmann <herrmann.der.user@googlemail.com>
66 *
77 *
88 * This driver is free software; you can redistribute it and/or
@@ -28,7 +28,7 @@ · 19 unmodified lines
2828 #include <asm/processor.h>
2929
3030 MODULE_DESCRIPTION("AMD Family 15h CPU processor power monitor");
31−MODULE_AUTHOR("Andreas Herrmann <andreas.herrmann3@amd.com>");
31+MODULE_AUTHOR("Andreas Herrmann <herrmann.der.user@googlemail.com>");
3232 MODULE_LICENSE("GPL");
3333
3434 /* D18F3 */
drivers/hwmon/gpio-fan.c+2−0
@@ -630,7 +630,9 @@ static struct platform_driver gpio_fan_driver = { · 629 unmodified lines
630630 .driver = {
631631 .name = "gpio-fan",
632632 .pm = GPIO_FAN_PM,
633+#ifdef CONFIG_OF_GPIO
633634 .of_match_table = of_match_ptr(of_gpio_fan_match),
635+#endif
634636 },
635637 };
636638
drivers/hwmon/w83627ehf.c+1−0
@@ -2083,6 +2083,7 @@ static int __devinit w83627ehf_probe(struct platform_device *pdev) · 2082 unmodified lines
20832083 mutex_init(&data->lock);
20842084 mutex_init(&data->update_lock);
20852085 data->name = w83627ehf_device_names[sio_data->kind];
2086+ data->bank = 0xff; /* Force initial bank selection */
20862087 platform_set_drvdata(pdev, data);
20872088
20882089 /* 627EHG and 627EHF have 10 voltage inputs; 627DHG and 667HG have 9 */
drivers/hwmon/w83627hf.c+1−1
@@ -25,7 +25,7 @@ · 24 unmodified lines
2525 /*
2626 * Supports following chips:
2727 *
28− * Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA
28+ * Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA
2929 * w83627hf 9 3 2 3 0x20 0x5ca3 no yes(LPC)
3030 * w83627thf 7 3 3 3 0x90 0x5ca3 no yes(LPC)
3131 * w83637hf 7 3 3 3 0x80 0x5ca3 no yes(LPC)
drivers/hwmon/w83781d.c+1−1
@@ -24,7 +24,7 @@ · 23 unmodified lines
2424 /*
2525 * Supports following chips:
2626 *
27− * Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA
27+ * Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA
2828 * as99127f 7 3 0 3 0x31 0x12c3 yes no
2929 * as99127f rev.2 (type_name = as99127f) 0x31 0x5ca3 yes no
3030 * w83781d 7 3 0 3 0x10-1 0x5ca3 yes yes
drivers/hwmon/w83791d.c+1−1
@@ -22,7 +22,7 @@ · 21 unmodified lines
2222 /*
2323 * Supports following chips:
2424 *
25− * Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA
25+ * Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA
2626 * w83791d 10 5 5 3 0x71 0x5ca3 yes no
2727 *
2828 * The w83791d chip appears to be part way between the 83781d and the
drivers/hwmon/w83792d.c+1−1
@@ -31,7 +31,7 @@ · 30 unmodified lines
3131 /*
3232 * Supports following chips:
3333 *
34− * Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA
34+ * Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA
3535 * w83792d 9 7 7 3 0x7a 0x5ca3 yes no
3636 */
3737
drivers/hwmon/w83l786ng.c+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
2020 /*
2121 * Supports following chips:
2222 *
23− * Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA
23+ * Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA
2424 * w83l786ng 3 2 2 2 0x7b 0x5ca3 yes no
2525 */
2626
drivers/i2c/Makefile+1−0
@@ -8,6 +8,7 @@ obj-$(CONFIG_I2C_SMBUS) += i2c-smbus.o · 7 unmodified lines
88 obj-$(CONFIG_I2C_CHARDEV) += i2c-dev.o
99 obj-$(CONFIG_I2C_MUX) += i2c-mux.o
1010 obj-y += algos/ busses/ muxes/
11+obj-$(CONFIG_I2C_STUB) += i2c-stub.o
1112
1213 ccflags-$(CONFIG_I2C_DEBUG_CORE) := -DDEBUG
1314 CFLAGS_i2c-core.o := -Wno-deprecated-declarations
drivers/i2c/busses/Kconfig+0−1
@@ -81,7 +81,6 @@ config I2C_I801 · 80 unmodified lines
8181 tristate "Intel 82801 (ICH/PCH)"
8282 depends on PCI
8383 select CHECK_SIGNATURE if X86 && DMI
84− select GPIOLIB if I2C_MUX
8584 help
8685 If you say yes to this option, support will be included for the Intel
8786 801 family of mainboard I2C interfaces. Specifically, the following
drivers/i2c/busses/Makefile+0−1
@@ -85,7 +85,6 @@ obj-$(CONFIG_I2C_ACORN) += i2c-acorn.o · 84 unmodified lines
8585 obj-$(CONFIG_I2C_ELEKTOR) += i2c-elektor.o
8686 obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o
8787 obj-$(CONFIG_I2C_SIBYTE) += i2c-sibyte.o
88−obj-$(CONFIG_I2C_STUB) += i2c-stub.o
8988 obj-$(CONFIG_SCx200_ACB) += scx200_acb.o
9089 obj-$(CONFIG_SCx200_I2C) += scx200_i2c.o
9190
drivers/i2c/busses/i2c-i801.c+7−4
@@ -82,7 +82,8 @@ · 81 unmodified lines
8282 #include <linux/wait.h>
8383 #include <linux/err.h>
8484
85−#if defined CONFIG_I2C_MUX || defined CONFIG_I2C_MUX_MODULE
85+#if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \
86+ defined CONFIG_DMI
8687 #include <linux/gpio.h>
8788 #include <linux/i2c-mux-gpio.h>
8889 #include <linux/platform_device.h>
@@ -192,7 +193,8 @@ struct i801_priv { · 103 unmodified lines
192193 int len;
193194 u8 *data;
194195
195−#if defined CONFIG_I2C_MUX || defined CONFIG_I2C_MUX_MODULE
196+#if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \
197+ defined CONFIG_DMI
196198 const struct i801_mux_config *mux_drvdata;
197199 struct platform_device *mux_pdev;
198200 #endif
@@ -921,7 +923,8 @@ static void __init input_apanel_init(void) {} · 722 unmodified lines
921923 static void __devinit i801_probe_optional_slaves(struct i801_priv *priv) {}
922924 #endif /* CONFIG_X86 && CONFIG_DMI */
923925
924−#if defined CONFIG_I2C_MUX || defined CONFIG_I2C_MUX_MODULE
926+#if (defined CONFIG_I2C_MUX_GPIO || defined CONFIG_I2C_MUX_GPIO_MODULE) && \
927+ defined CONFIG_DMI
925928 static struct i801_mux_config i801_mux_config_asus_z8_d12 = {
926929 .gpio_chip = "gpio_ich",
927930 .values = { 0x02, 0x03 },
@@ -1059,7 +1062,7 @@ static unsigned int __devinit i801_get_adapter_class(struct i801_priv *priv) · 131 unmodified lines
10591062
10601063 id = dmi_first_match(mux_dmi_table);
10611064 if (id) {
1062− /* Remove from branch classes from trunk */
1065+ /* Remove branch classes from trunk */
10631066 mux_config = id->driver_data;
10641067 for (i = 0; i < mux_config->n_values; i++)
10651068 class &= ~mux_config->classes[i];
drivers/i2c/busses/i2c-mxs.c+14−172
@@ -1,7 +1,7 @@
11 /*
22 * Freescale MXS I2C bus driver
33 *
4− * Copyright (C) 2011 Wolfram Sang, Pengutronix e.K.
4+ * Copyright (C) 2011-2012 Wolfram Sang, Pengutronix e.K.
55 *
66 * based on a (non-working) driver which was:
77 *
@@ -35,10 +35,6 @@ · 27 unmodified lines
3535
3636 #define DRIVER_NAME "mxs-i2c"
3737
38−static bool use_pioqueue;
39−module_param(use_pioqueue, bool, 0);
40−MODULE_PARM_DESC(use_pioqueue, "Use PIOQUEUE mode for transfer instead of DMA");
41−
4238 #define MXS_I2C_CTRL0 (0x00)
4339 #define MXS_I2C_CTRL0_SET (0x04)
4440
@@ -75,23 +71,6 @@ MODULE_PARM_DESC(use_pioqueue, "Use PIOQUEUE mode for transfer instead of DMA"); · 30 unmodified lines
7571 MXS_I2C_CTRL1_SLAVE_STOP_IRQ | \
7672 MXS_I2C_CTRL1_SLAVE_IRQ)
7773
78−#define MXS_I2C_QUEUECTRL (0x60)
79−#define MXS_I2C_QUEUECTRL_SET (0x64)
80−#define MXS_I2C_QUEUECTRL_CLR (0x68)
81−
82−#define MXS_I2C_QUEUECTRL_QUEUE_RUN 0x20
83−#define MXS_I2C_QUEUECTRL_PIO_QUEUE_MODE 0x04
84−
85−#define MXS_I2C_QUEUESTAT (0x70)
86−#define MXS_I2C_QUEUESTAT_RD_QUEUE_EMPTY 0x00002000
87−#define MXS_I2C_QUEUESTAT_WRITE_QUEUE_CNT_MASK 0x0000001F
88−
89−#define MXS_I2C_QUEUECMD (0x80)
90−
91−#define MXS_I2C_QUEUEDATA (0x90)
92−
93−#define MXS_I2C_DATA (0xa0)
94−
9574
9675 #define MXS_CMD_I2C_SELECT (MXS_I2C_CTRL0_RETAIN_CLOCK | \
9776 MXS_I2C_CTRL0_PRE_SEND_START | \
@@ -153,7 +132,6 @@ struct mxs_i2c_dev { · 55 unmodified lines
153132 const struct mxs_i2c_speed_config *speed;
154133
155134 /* DMA support components */
156− bool dma_mode;
157135 int dma_channel;
158136 struct dma_chan *dmach;
159137 struct mxs_dma_data dma_data;
@@ -172,99 +150,6 @@ static void mxs_i2c_reset(struct mxs_i2c_dev *i2c) · 12 unmodified lines
172150 writel(i2c->speed->timing2, i2c->regs + MXS_I2C_TIMING2);
173151
174152 writel(MXS_I2C_IRQ_MASK << 8, i2c->regs + MXS_I2C_CTRL1_SET);
175− if (i2c->dma_mode)
176− writel(MXS_I2C_QUEUECTRL_PIO_QUEUE_MODE,
177− i2c->regs + MXS_I2C_QUEUECTRL_CLR);
178− else
179− writel(MXS_I2C_QUEUECTRL_PIO_QUEUE_MODE,
180− i2c->regs + MXS_I2C_QUEUECTRL_SET);
181−}
182−
183−static void mxs_i2c_pioq_setup_read(struct mxs_i2c_dev *i2c, u8 addr, int len,
184− int flags)
185−{
186− u32 data;
187−
188− writel(MXS_CMD_I2C_SELECT, i2c->regs + MXS_I2C_QUEUECMD);
189−
190− data = (addr << 1) | I2C_SMBUS_READ;
191− writel(data, i2c->regs + MXS_I2C_DATA);
192−
193− data = MXS_CMD_I2C_READ | MXS_I2C_CTRL0_XFER_COUNT(len) | flags;
194− writel(data, i2c->regs + MXS_I2C_QUEUECMD);
195−}
196−
197−static void mxs_i2c_pioq_setup_write(struct mxs_i2c_dev *i2c,
198− u8 addr, u8 *buf, int len, int flags)
199−{
200− u32 data;
201− int i, shifts_left;
202−
203− data = MXS_CMD_I2C_WRITE | MXS_I2C_CTRL0_XFER_COUNT(len + 1) | flags;
204− writel(data, i2c->regs + MXS_I2C_QUEUECMD);
205−
206− /*
207− * We have to copy the slave address (u8) and buffer (arbitrary number
208− * of u8) into the data register (u32). To achieve that, the u8 are put
209− * into the MSBs of 'data' which is then shifted for the next u8. When
210− * appropriate, 'data' is written to MXS_I2C_DATA. So, the first u32
211− * looks like this:
212− *
213− * 3 2 1 0
214− * 10987654|32109876|54321098|76543210
215− * --------+--------+--------+--------
216− * buffer+2|buffer+1|buffer+0|slave_addr
217− */
218−
219− data = ((addr << 1) | I2C_SMBUS_WRITE) << 24;
220−
221− for (i = 0; i < len; i++) {
222− data >>= 8;
223− data |= buf[i] << 24;
224− if ((i & 3) == 2)
225− writel(data, i2c->regs + MXS_I2C_DATA);
226− }
227−
228− /* Write out the remaining bytes if any */
229− shifts_left = 24 - (i & 3) * 8;
230− if (shifts_left)
231− writel(data >> shifts_left, i2c->regs + MXS_I2C_DATA);
232−}
233−
234−/*
235− * TODO: should be replaceable with a waitqueue and RD_QUEUE_IRQ (setting the
236− * rd_threshold to 1). Couldn't get this to work, though.
237− */
238−static int mxs_i2c_wait_for_data(struct mxs_i2c_dev *i2c)
239−{
240− unsigned long timeout = jiffies + msecs_to_jiffies(1000);
241−
242− while (readl(i2c->regs + MXS_I2C_QUEUESTAT)
243− & MXS_I2C_QUEUESTAT_RD_QUEUE_EMPTY) {
244− if (time_after(jiffies, timeout))
245− return -ETIMEDOUT;
246− cond_resched();
247− }
248−
249− return 0;
250−}
251−
252−static int mxs_i2c_finish_read(struct mxs_i2c_dev *i2c, u8 *buf, int len)
253−{
254− u32 uninitialized_var(data);
255− int i;
256−
257− for (i = 0; i < len; i++) {
258− if ((i & 3) == 0) {
259− if (mxs_i2c_wait_for_data(i2c))
260− return -ETIMEDOUT;
261− data = readl(i2c->regs + MXS_I2C_QUEUEDATA);
262− }
263− buf[i] = data & 0xff;
264− data >>= 8;
265− }
266−
267− return 0;
268153 }
269154
270155 static void mxs_i2c_dma_finish(struct mxs_i2c_dev *i2c)
@@ -432,39 +317,17 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, · 161 unmodified lines
432317 init_completion(&i2c->cmd_complete);
433318 i2c->cmd_err = 0;
434319
435− if (i2c->dma_mode) {
436− ret = mxs_i2c_dma_setup_xfer(adap, msg, flags);
437− if (ret)
438− return ret;
439− } else {
440− if (msg->flags & I2C_M_RD) {
441− mxs_i2c_pioq_setup_read(i2c, msg->addr,
442− msg->len, flags);
443− } else {
444− mxs_i2c_pioq_setup_write(i2c, msg->addr, msg->buf,
445− msg->len, flags);
446− }
447−
448− writel(MXS_I2C_QUEUECTRL_QUEUE_RUN,
449− i2c->regs + MXS_I2C_QUEUECTRL_SET);
450− }
320+ ret = mxs_i2c_dma_setup_xfer(adap, msg, flags);
321+ if (ret)
322+ return ret;
451323
452324 ret = wait_for_completion_timeout(&i2c->cmd_complete,
453325 msecs_to_jiffies(1000));
454326 if (ret == 0)
455327 goto timeout;
456328
457− if (!i2c->dma_mode && !i2c->cmd_err && (msg->flags & I2C_M_RD)) {
458− ret = mxs_i2c_finish_read(i2c, msg->buf, msg->len);
459− if (ret)
460− goto timeout;
461− }
462−
463329 if (i2c->cmd_err == -ENXIO)
464330 mxs_i2c_reset(i2c);
465− else
466− writel(MXS_I2C_QUEUECTRL_QUEUE_RUN,
467− i2c->regs + MXS_I2C_QUEUECTRL_CLR);
468331
469332 dev_dbg(i2c->dev, "Done with err=%d\n", i2c->cmd_err);
470333
@@ -472,8 +335,7 @@ static int mxs_i2c_xfer_msg(struct i2c_adapter *adap, struct i2c_msg *msg, · 1 unmodified line
472335
473336 timeout:
474337 dev_dbg(i2c->dev, "Timeout!\n");
475− if (i2c->dma_mode)
476− mxs_i2c_dma_finish(i2c);
338+ mxs_i2c_dma_finish(i2c);
477339 mxs_i2c_reset(i2c);
478340 return -ETIMEDOUT;
479341 }
@@ -502,7 +364,6 @@ static irqreturn_t mxs_i2c_isr(int this_irq, void *dev_id) · 22 unmodified lines
502364 {
503365 struct mxs_i2c_dev *i2c = dev_id;
504366 u32 stat = readl(i2c->regs + MXS_I2C_CTRL1) & MXS_I2C_IRQ_MASK;
505− bool is_last_cmd;
506367
507368 if (!stat)
508369 return IRQ_NONE;
@@ -515,14 +376,6 @@ static irqreturn_t mxs_i2c_isr(int this_irq, void *dev_id) · 6 unmodified lines
515376 /* MXS_I2C_CTRL1_OVERSIZE_XFER_TERM_IRQ is only for slaves */
516377 i2c->cmd_err = -EIO;
517378
518− if (!i2c->dma_mode) {
519− is_last_cmd = (readl(i2c->regs + MXS_I2C_QUEUESTAT) &
520− MXS_I2C_QUEUESTAT_WRITE_QUEUE_CNT_MASK) == 0;
521−
522− if (is_last_cmd || i2c->cmd_err)
523− complete(&i2c->cmd_complete);
524− }
525−
526379 writel(stat, i2c->regs + MXS_I2C_CTRL1_CLR);
527380
528381 return IRQ_HANDLED;
@@ -555,15 +408,6 @@ static int mxs_i2c_get_ofdata(struct mxs_i2c_dev *i2c) · 26 unmodified lines
555408 struct device_node *node = dev->of_node;
556409 int ret;
557410
558− /*
559− * The MXS I2C DMA mode is prefered and enabled by default.
560− * The PIO mode is still supported, but should be used only
561− * for debuging purposes etc.
562− */
563− i2c->dma_mode = !use_pioqueue;
564− if (!i2c->dma_mode)
565− dev_info(dev, "Using PIOQUEUE mode for I2C transfers!\n");
566−
567411 /*
568412 * TODO: This is a temporary solution and should be changed
569413 * to use generic DMA binding later when the helpers get in.
@@ -571,8 +415,8 @@ static int mxs_i2c_get_ofdata(struct mxs_i2c_dev *i2c) · 1 unmodified line
571415 ret = of_property_read_u32(node, "fsl,i2c-dma-channel",
572416 &i2c->dma_channel);
573417 if (ret) {
574− dev_warn(dev, "Failed to get DMA channel, using PIOQUEUE!\n");
575− i2c->dma_mode = 0;
418+ dev_err(dev, "Failed to get DMA channel!\n");
419+ return -ENODEV;
576420 }
577421
578422 ret = of_property_read_u32(node, "clock-frequency", &speed);
@@ -634,15 +478,13 @@ static int __devinit mxs_i2c_probe(struct platform_device *pdev) · 55 unmodified lines
634478 }
635479
636480 /* Setup the DMA */
637− if (i2c->dma_mode) {
638− dma_cap_zero(mask);
639− dma_cap_set(DMA_SLAVE, mask);
640− i2c->dma_data.chan_irq = dmairq;
641− i2c->dmach = dma_request_channel(mask, mxs_i2c_dma_filter, i2c);
642− if (!i2c->dmach) {
643− dev_err(dev, "Failed to request dma\n");
644− return -ENODEV;
645− }
481+ dma_cap_zero(mask);
482+ dma_cap_set(DMA_SLAVE, mask);
483+ i2c->dma_data.chan_irq = dmairq;
484+ i2c->dmach = dma_request_channel(mask, mxs_i2c_dma_filter, i2c);
485+ if (!i2c->dmach) {
486+ dev_err(dev, "Failed to request dma\n");
487+ return -ENODEV;
646488 }
647489
648490 platform_set_drvdata(pdev, i2c);
drivers/i2c/busses/i2c-nomadik.c+7−2
@@ -644,7 +644,11 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap, · 643 unmodified lines
644644
645645 pm_runtime_get_sync(&dev->adev->dev);
646646
647− clk_enable(dev->clk);
647+ status = clk_prepare_enable(dev->clk);
648+ if (status) {
649+ dev_err(&dev->adev->dev, "can't prepare_enable clock\n");
650+ goto out_clk;
651+ }
648652
649653 status = init_hw(dev);
650654 if (status)
@@ -671,7 +675,8 @@ static int nmk_i2c_xfer(struct i2c_adapter *i2c_adap, · 20 unmodified lines
671675 }
672676
673677 out:
674− clk_disable(dev->clk);
678+ clk_disable_unprepare(dev->clk);
679+out_clk:
675680 pm_runtime_put_sync(&dev->adev->dev);
676681
677682 dev->busy = false;
drivers/i2c/busses/i2c-tegra.c+1−1
@@ -742,7 +742,7 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev) · 741 unmodified lines
742742 }
743743
744744 ret = devm_request_irq(&pdev->dev, i2c_dev->irq,
745− tegra_i2c_isr, 0, pdev->name, i2c_dev);
745+ tegra_i2c_isr, 0, dev_name(&pdev->dev), i2c_dev);
746746 if (ret) {
747747 dev_err(&pdev->dev, "Failed to request irq %i\n", i2c_dev->irq);
748748 return ret;
drivers/i2c/i2c-stub.crenamed from drivers/i2c/busses/i2c-stub.c+32−34
@@ -2,7 +2,7 @@ · 1 unmodified line
22 i2c-stub.c - I2C/SMBus chip emulator
33
44 Copyright (c) 2004 Mark M. Hoffman <mhoffman@lightlink.com>
5− Copyright (C) 2007 Jean Delvare <khali@linux-fr.org>
5+ Copyright (C) 2007, 2012 Jean Delvare <khali@linux-fr.org>
66
77 This program is free software; you can redistribute it and/or modify
88 it under the terms of the GNU General Public License as published by
@@ -51,8 +51,8 @@ struct stub_chip { · 42 unmodified lines
5151 static struct stub_chip *stub_chips;
5252
5353 /* Return negative errno on error. */
54−static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags,
55− char read_write, u8 command, int size, union i2c_smbus_data * data)
54+static s32 stub_xfer(struct i2c_adapter *adap, u16 addr, unsigned short flags,
55+ char read_write, u8 command, int size, union i2c_smbus_data *data)
5656 {
5757 s32 ret;
5858 int i, len;
@@ -78,14 +78,14 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, · 19 unmodified lines
7878 case I2C_SMBUS_BYTE:
7979 if (read_write == I2C_SMBUS_WRITE) {
8080 chip->pointer = command;
81− dev_dbg(&adap->dev, "smbus byte - addr 0x%02x, "
82− "wrote 0x%02x.\n",
83− addr, command);
81+ dev_dbg(&adap->dev,
82+ "smbus byte - addr 0x%02x, wrote 0x%02x.\n",
83+ addr, command);
8484 } else {
8585 data->byte = chip->words[chip->pointer++] & 0xff;
86− dev_dbg(&adap->dev, "smbus byte - addr 0x%02x, "
87− "read 0x%02x.\n",
88− addr, data->byte);
86+ dev_dbg(&adap->dev,
87+ "smbus byte - addr 0x%02x, read 0x%02x.\n",
88+ addr, data->byte);
8989 }
9090
9191 ret = 0;
@@ -95,14 +95,14 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, · 3 unmodified lines
9595 if (read_write == I2C_SMBUS_WRITE) {
9696 chip->words[command] &= 0xff00;
9797 chip->words[command] |= data->byte;
98− dev_dbg(&adap->dev, "smbus byte data - addr 0x%02x, "
99− "wrote 0x%02x at 0x%02x.\n",
100− addr, data->byte, command);
98+ dev_dbg(&adap->dev,
99+ "smbus byte data - addr 0x%02x, wrote 0x%02x at 0x%02x.\n",
100+ addr, data->byte, command);
101101 } else {
102102 data->byte = chip->words[command] & 0xff;
103− dev_dbg(&adap->dev, "smbus byte data - addr 0x%02x, "
104− "read 0x%02x at 0x%02x.\n",
105− addr, data->byte, command);
103+ dev_dbg(&adap->dev,
104+ "smbus byte data - addr 0x%02x, read 0x%02x at 0x%02x.\n",
105+ addr, data->byte, command);
106106 }
107107 chip->pointer = command + 1;
108108
@@ -112,14 +112,14 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, · 3 unmodified lines
112112 case I2C_SMBUS_WORD_DATA:
113113 if (read_write == I2C_SMBUS_WRITE) {
114114 chip->words[command] = data->word;
115− dev_dbg(&adap->dev, "smbus word data - addr 0x%02x, "
116− "wrote 0x%04x at 0x%02x.\n",
117− addr, data->word, command);
115+ dev_dbg(&adap->dev,
116+ "smbus word data - addr 0x%02x, wrote 0x%04x at 0x%02x.\n",
117+ addr, data->word, command);
118118 } else {
119119 data->word = chip->words[command];
120− dev_dbg(&adap->dev, "smbus word data - addr 0x%02x, "
121− "read 0x%04x at 0x%02x.\n",
122− addr, data->word, command);
120+ dev_dbg(&adap->dev,
121+ "smbus word data - addr 0x%02x, read 0x%04x at 0x%02x.\n",
122+ addr, data->word, command);
123123 }
124124
125125 ret = 0;
@@ -132,17 +132,17 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, · 6 unmodified lines
132132 chip->words[command + i] &= 0xff00;
133133 chip->words[command + i] |= data->block[1 + i];
134134 }
135− dev_dbg(&adap->dev, "i2c block data - addr 0x%02x, "
136− "wrote %d bytes at 0x%02x.\n",
137− addr, len, command);
135+ dev_dbg(&adap->dev,
136+ "i2c block data - addr 0x%02x, wrote %d bytes at 0x%02x.\n",
137+ addr, len, command);
138138 } else {
139139 for (i = 0; i < len; i++) {
140140 data->block[1 + i] =
141141 chip->words[command + i] & 0xff;
142142 }
143− dev_dbg(&adap->dev, "i2c block data - addr 0x%02x, "
144− "read %d bytes at 0x%02x.\n",
145− addr, len, command);
143+ dev_dbg(&adap->dev,
144+ "i2c block data - addr 0x%02x, read %d bytes at 0x%02x.\n",
145+ addr, len, command);
146146 }
147147
148148 ret = 0;
@@ -179,25 +179,24 @@ static int __init i2c_stub_init(void) · 30 unmodified lines
179179 int i, ret;
180180
181181 if (!chip_addr[0]) {
182− printk(KERN_ERR "i2c-stub: Please specify a chip address\n");
182+ pr_err("i2c-stub: Please specify a chip address\n");
183183 return -ENODEV;
184184 }
185185
186186 for (i = 0; i < MAX_CHIPS && chip_addr[i]; i++) {
187187 if (chip_addr[i] < 0x03 || chip_addr[i] > 0x77) {
188− printk(KERN_ERR "i2c-stub: Invalid chip address "
189− "0x%02x\n", chip_addr[i]);
188+ pr_err("i2c-stub: Invalid chip address 0x%02x\n",
189+ chip_addr[i]);
190190 return -EINVAL;
191191 }
192192
193− printk(KERN_INFO "i2c-stub: Virtual chip at 0x%02x\n",
194− chip_addr[i]);
193+ pr_info("i2c-stub: Virtual chip at 0x%02x\n", chip_addr[i]);
195194 }
196195
197196 /* Allocate memory for all chips at once */
198197 stub_chips = kzalloc(i * sizeof(struct stub_chip), GFP_KERNEL);
199198 if (!stub_chips) {
200− printk(KERN_ERR "i2c-stub: Out of memory\n");
199+ pr_err("i2c-stub: Out of memory\n");
201200 return -ENOMEM;
202201 }
203202
@@ -219,4 +218,3 @@ MODULE_LICENSE("GPL"); · 15 unmodified lines
219218
220219 module_init(i2c_stub_init);
221220 module_exit(i2c_stub_exit);
222−
drivers/input/keyboard/Kconfig+1−0
@@ -335,6 +335,7 @@ config KEYBOARD_LOCOMO · 334 unmodified lines
335335 config KEYBOARD_LPC32XX
336336 tristate "LPC32XX matrix key scanner support"
337337 depends on ARCH_LPC32XX && OF
338+ select INPUT_MATRIXKMAP
338339 help
339340 Say Y here if you want to use NXP LPC32XX SoC key scanner interface,
340341 connected to a key matrix.
drivers/input/keyboard/pxa27x_keypad.c+3−0
@@ -368,6 +368,9 @@ static void pxa27x_keypad_config(struct pxa27x_keypad *keypad) · 367 unmodified lines
368368 unsigned int mask = 0, direct_key_num = 0;
369369 unsigned long kpc = 0;
370370
371+ /* clear pending interrupt bit */
372+ keypad_readl(KPC);
373+
371374 /* enable matrix keys with automatic scan */
372375 if (pdata->matrix_key_rows && pdata->matrix_key_cols) {
373376 kpc |= KPC_ASACT | KPC_MIE | KPC_ME | KPC_MS_ALL;
drivers/input/misc/xen-kbdfront.c+4−1
@@ -311,7 +311,6 @@ static void xenkbd_backend_changed(struct xenbus_device *dev, · 310 unmodified lines
311311 case XenbusStateReconfiguring:
312312 case XenbusStateReconfigured:
313313 case XenbusStateUnknown:
314− case XenbusStateClosed:
315314 break;
316315
317316 case XenbusStateInitWait:
@@ -350,6 +349,10 @@ InitWait: · 32 unmodified lines
350349
351350 break;
352351
352+ case XenbusStateClosed:
353+ if (dev->state == XenbusStateClosed)
354+ break;
355+ /* Missed the backend's CLOSING state -- fallthrough */
353356 case XenbusStateClosing:
354357 xenbus_frontend_closed(dev);
355358 break;
drivers/input/mouse/bcm5974.c+21−0
@@ -84,6 +84,10 @@ · 83 unmodified lines
8484 #define USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI 0x0262
8585 #define USB_DEVICE_ID_APPLE_WELLSPRING7_ISO 0x0263
8686 #define USB_DEVICE_ID_APPLE_WELLSPRING7_JIS 0x0264
87+/* MacbookPro10,2 (unibody, October 2012) */
88+#define USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI 0x0259
89+#define USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO 0x025a
90+#define USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS 0x025b
8791
8892 #define BCM5974_DEVICE(prod) { \
8993 .match_flags = (USB_DEVICE_ID_MATCH_DEVICE | \
@@ -137,6 +141,10 @@ static const struct usb_device_id bcm5974_table[] = { · 47 unmodified lines
137141 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI),
138142 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_ISO),
139143 BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7_JIS),
144+ /* MacbookPro10,2 */
145+ BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI),
146+ BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO),
147+ BCM5974_DEVICE(USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS),
140148 /* Terminating entry */
141149 {}
142150 };
@@ -379,6 +387,19 @@ static const struct bcm5974_config bcm5974_config_table[] = { · 236 unmodified lines
379387 { SN_COORD, -150, 6730 },
380388 { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION }
381389 },
390+ {
391+ USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI,
392+ USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO,
393+ USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS,
394+ HAS_INTEGRATED_BUTTON,
395+ 0x84, sizeof(struct bt_data),
396+ 0x81, TYPE2, FINGER_TYPE2, FINGER_TYPE2 + SIZEOF_ALL_FINGERS,
397+ { SN_PRESSURE, 0, 300 },
398+ { SN_WIDTH, 0, 2048 },
399+ { SN_COORD, -4750, 5280 },
400+ { SN_COORD, -150, 6730 },
401+ { SN_ORIENT, -MAX_FINGER_ORIENTATION, MAX_FINGER_ORIENTATION }
402+ },
382403 {}
383404 };
384405
drivers/input/tablet/wacom_sys.c+1−1
@@ -391,7 +391,7 @@ static int wacom_parse_hid(struct usb_interface *intf, · 390 unmodified lines
391391 features->pktlen = WACOM_PKGLEN_TPC2FG;
392392 }
393393
394− if (features->type == MTSCREEN || WACOM_24HDT)
394+ if (features->type == MTSCREEN || features->type == WACOM_24HDT)
395395 features->pktlen = WACOM_PKGLEN_MTOUCH;
396396
397397 if (features->type == BAMBOO_PT) {
drivers/input/tablet/wacom_wac.c+3−0
@@ -1518,6 +1518,9 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev, · 1517 unmodified lines
15181518
15191519 input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
15201520 input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0);
1521+
1522+ __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
1523+
15211524 wacom_setup_cintiq(wacom_wac);
15221525 break;
15231526
drivers/input/touchscreen/Kconfig+1−1
@@ -239,7 +239,7 @@ config TOUCHSCREEN_EETI · 238 unmodified lines
239239
240240 config TOUCHSCREEN_EGALAX
241241 tristate "EETI eGalax multi-touch panel support"
242− depends on I2C
242+ depends on I2C && OF
243243 help
244244 Say Y here to enable support for I2C connected EETI
245245 eGalax multi-touch panels.
drivers/input/touchscreen/egalax_ts.c+21−2
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 #include <linux/slab.h>
2929 #include <linux/bitops.h>
3030 #include <linux/input/mt.h>
31+#include <linux/of_gpio.h>
3132
3233 /*
3334 * Mouse Mode: some panel may configure the controller to mouse mode,
@@ -122,9 +123,17 @@ static irqreturn_t egalax_ts_interrupt(int irq, void *dev_id) · 88 unmodified lines
122123 /* wake up controller by an falling edge of interrupt gpio. */
123124 static int egalax_wake_up_device(struct i2c_client *client)
124125 {
125− int gpio = irq_to_gpio(client->irq);
126+ struct device_node *np = client->dev.of_node;
127+ int gpio;
126128 int ret;
127129
130+ if (!np)
131+ return -ENODEV;
132+
133+ gpio = of_get_named_gpio(np, "wakeup-gpios", 0);
134+ if (!gpio_is_valid(gpio))
135+ return -ENODEV;
136+
128137 ret = gpio_request(gpio, "egalax_irq");
129138 if (ret < 0) {
130139 dev_err(&client->dev,
@@ -181,7 +190,11 @@ static int __devinit egalax_ts_probe(struct i2c_client *client, · 50 unmodified lines
181190 ts->input_dev = input_dev;
182191
183192 /* controller may be in sleep, wake it up. */
184− egalax_wake_up_device(client);
193+ error = egalax_wake_up_device(client);
194+ if (error) {
195+ dev_err(&client->dev, "Failed to wake up the controller\n");
196+ goto err_free_dev;
197+ }
185198
186199 ret = egalax_firmware_version(client);
187200 if (ret < 0) {
@@ -274,11 +287,17 @@ static int egalax_ts_resume(struct device *dev) · 86 unmodified lines
274287
275288 static SIMPLE_DEV_PM_OPS(egalax_ts_pm_ops, egalax_ts_suspend, egalax_ts_resume);
276289
290+static struct of_device_id egalax_ts_dt_ids[] = {
291+ { .compatible = "eeti,egalax_ts" },
292+ { /* sentinel */ }
293+};
294+
277295 static struct i2c_driver egalax_ts_driver = {
278296 .driver = {
279297 .name = "egalax_ts",
280298 .owner = THIS_MODULE,
281299 .pm = &egalax_ts_pm_ops,
300+ .of_match_table = of_match_ptr(egalax_ts_dt_ids),
282301 },
283302 .id_table = egalax_ts_id,
284303 .probe = egalax_ts_probe,
drivers/input/touchscreen/tsc40.c+0−1
@@ -107,7 +107,6 @@ static int tsc_connect(struct serio *serio, struct serio_driver *drv) · 106 unmodified lines
107107 __set_bit(BTN_TOUCH, input_dev->keybit);
108108 input_set_abs_params(ptsc->dev, ABS_X, 0, 0x3ff, 0, 0);
109109 input_set_abs_params(ptsc->dev, ABS_Y, 0, 0x3ff, 0, 0);
110− input_set_abs_params(ptsc->dev, ABS_PRESSURE, 0, 0, 0, 0);
111110
112111 serio_set_drvdata(serio, ptsc);
113112
drivers/isdn/Kconfig+1−1
@@ -4,7 +4,7 @@ · 3 unmodified lines
44
55 menuconfig ISDN
66 bool "ISDN support"
7− depends on NET
7+ depends on NET && NETDEVICES
88 depends on !S390 && !UML
99 ---help---
1010 ISDN ("Integrated Services Digital Network", called RNIS in France)
drivers/isdn/i4l/Kconfig+1−1
@@ -6,7 +6,7 @@ if ISDN_I4L · 5 unmodified lines
66
77 config ISDN_PPP
88 bool "Support synchronous PPP"
9− depends on INET && NETDEVICES
9+ depends on INET
1010 select SLHC
1111 help
1212 Over digital connections such as ISDN, there is no need to
drivers/isdn/i4l/isdn_common.c+0−4
@@ -1312,7 +1312,6 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg) · 1311 unmodified lines
13121312 } else
13131313 return -EINVAL;
13141314 break;
1315−#ifdef CONFIG_NETDEVICES
13161315 case IIOCNETGPN:
13171316 /* Get peer phone number of a connected
13181317 * isdn network interface */
@@ -1322,7 +1321,6 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg) · 3 unmodified lines
13221321 return isdn_net_getpeer(&phone, argp);
13231322 } else
13241323 return -EINVAL;
1325−#endif
13261324 default:
13271325 return -EINVAL;
13281326 }
@@ -1352,7 +1350,6 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg) · 23 unmodified lines
13521350 case IIOCNETLCR:
13531351 printk(KERN_INFO "INFO: ISDN_ABC_LCR_SUPPORT not enabled\n");
13541352 return -ENODEV;
1355−#ifdef CONFIG_NETDEVICES
13561353 case IIOCNETAIF:
13571354 /* Add a network-interface */
13581355 if (arg) {
@@ -1491,7 +1488,6 @@ isdn_ioctl(struct file *file, uint cmd, ulong arg) · 132 unmodified lines
14911488 return -EFAULT;
14921489 return isdn_net_force_hangup(name);
14931490 break;
1494−#endif /* CONFIG_NETDEVICES */
14951491 case IIOCSETVER:
14961492 dev->net_verbose = arg;
14971493 printk(KERN_INFO "isdn: Verbose-Level is %d\n", dev->net_verbose);
drivers/md/faulty.c+4−1
@@ -315,8 +315,11 @@ static int run(struct mddev *mddev) · 314 unmodified lines
315315 }
316316 conf->nfaults = 0;
317317
318− rdev_for_each(rdev, mddev)
318+ rdev_for_each(rdev, mddev) {
319319 conf->rdev = rdev;
320+ disk_stack_limits(mddev->gendisk, rdev->bdev,
321+ rdev->data_offset << 9);
322+ }
320323
321324 md_set_array_sectors(mddev, faulty_size(mddev, 0, 0));
322325 mddev->private = conf;
drivers/md/raid1.c+1−1
@@ -2710,7 +2710,7 @@ static struct r1conf *setup_conf(struct mddev *mddev) · 2709 unmodified lines
27102710 || disk_idx < 0)
27112711 continue;
27122712 if (test_bit(Replacement, &rdev->flags))
2713− disk = conf->mirrors + conf->raid_disks + disk_idx;
2713+ disk = conf->mirrors + mddev->raid_disks + disk_idx;
27142714 else
27152715 disk = conf->mirrors + disk_idx;
27162716
drivers/md/raid10.c+9−6
@@ -1783,7 +1783,7 @@ static int raid10_add_disk(struct mddev *mddev, struct md_rdev *rdev) · 1782 unmodified lines
17831783 clear_bit(Unmerged, &rdev->flags);
17841784 }
17851785 md_integrity_add_rdev(rdev, mddev);
1786− if (blk_queue_discard(bdev_get_queue(rdev->bdev)))
1786+ if (mddev->queue && blk_queue_discard(bdev_get_queue(rdev->bdev)))
17871787 queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);
17881788
17891789 print_conf(conf);
@@ -3613,11 +3613,14 @@ static int run(struct mddev *mddev) · 1823 unmodified lines
36133613 discard_supported = true;
36143614 }
36153615
3616− if (discard_supported)
3617− queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);
3618− else
3619− queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD, mddev->queue);
3620−
3616+ if (mddev->queue) {
3617+ if (discard_supported)
3618+ queue_flag_set_unlocked(QUEUE_FLAG_DISCARD,
3619+ mddev->queue);
3620+ else
3621+ queue_flag_clear_unlocked(QUEUE_FLAG_DISCARD,
3622+ mddev->queue);
3623+ }
36213624 /* need to check that every block has at least one working mirror */
36223625 if (!enough(conf, -1)) {
36233626 printk(KERN_ERR "md/raid10:%s: not enough operational mirrors.\n",
drivers/mmc/host/dw_mmc-exynos.c+4−4
@@ -208,7 +208,7 @@ static unsigned long exynos5250_dwmmc_caps[4] = { · 207 unmodified lines
208208 MMC_CAP_CMD23,
209209 };
210210
211−static struct dw_mci_drv_data exynos5250_drv_data = {
211+static const struct dw_mci_drv_data exynos5250_drv_data = {
212212 .caps = exynos5250_dwmmc_caps,
213213 .init = dw_mci_exynos_priv_init,
214214 .setup_clock = dw_mci_exynos_setup_clock,
@@ -220,14 +220,14 @@ static struct dw_mci_drv_data exynos5250_drv_data = { · 5 unmodified lines
220220
221221 static const struct of_device_id dw_mci_exynos_match[] = {
222222 { .compatible = "samsung,exynos5250-dw-mshc",
223− .data = (void *)&exynos5250_drv_data, },
223+ .data = &exynos5250_drv_data, },
224224 {},
225225 };
226−MODULE_DEVICE_TABLE(of, dw_mci_pltfm_match);
226+MODULE_DEVICE_TABLE(of, dw_mci_exynos_match);
227227
228228 int dw_mci_exynos_probe(struct platform_device *pdev)
229229 {
230− struct dw_mci_drv_data *drv_data;
230+ const struct dw_mci_drv_data *drv_data;
231231 const struct of_device_id *match;
232232
233233 match = of_match_node(dw_mci_exynos_match, pdev->dev.of_node);
drivers/mmc/host/dw_mmc-pltfm.c+3−3
@@ -24,7 +24,7 @@ · 23 unmodified lines
2424 #include "dw_mmc.h"
2525
2626 int dw_mci_pltfm_register(struct platform_device *pdev,
27− struct dw_mci_drv_data *drv_data)
27+ const struct dw_mci_drv_data *drv_data)
2828 {
2929 struct dw_mci *host;
3030 struct resource *regs;
@@ -50,8 +50,8 @@ int dw_mci_pltfm_register(struct platform_device *pdev, · 19 unmodified lines
5050 if (!host->regs)
5151 return -ENOMEM;
5252
53− if (host->drv_data->init) {
54− ret = host->drv_data->init(host);
53+ if (drv_data && drv_data->init) {
54+ ret = drv_data->init(host);
5555 if (ret)
5656 return ret;
5757 }
drivers/mmc/host/dw_mmc-pltfm.h+1−1
@@ -13,7 +13,7 @@ · 12 unmodified lines
1313 #define _DW_MMC_PLTFM_H_
1414
1515 extern int dw_mci_pltfm_register(struct platform_device *pdev,
16− struct dw_mci_drv_data *drv_data);
16+ const struct dw_mci_drv_data *drv_data);
1717 extern int __devexit dw_mci_pltfm_remove(struct platform_device *pdev);
1818 extern const struct dev_pm_ops dw_mci_pltfm_pmops;
1919
drivers/mmc/host/dw_mmc.c+34−28
@@ -232,6 +232,7 @@ static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd) · 231 unmodified lines
232232 {
233233 struct mmc_data *data;
234234 struct dw_mci_slot *slot = mmc_priv(mmc);
235+ struct dw_mci_drv_data *drv_data = slot->host->drv_data;
235236 u32 cmdr;
236237 cmd->error = -EINPROGRESS;
237238
@@ -261,8 +262,8 @@ static u32 dw_mci_prepare_command(struct mmc_host *mmc, struct mmc_command *cmd) · 23 unmodified lines
261262 cmdr |= SDMMC_CMD_DAT_WR;
262263 }
263264
264− if (slot->host->drv_data->prepare_command)
265− slot->host->drv_data->prepare_command(slot->host, &cmdr);
265+ if (drv_data && drv_data->prepare_command)
266+ drv_data->prepare_command(slot->host, &cmdr);
266267
267268 return cmdr;
268269 }
@@ -434,7 +435,7 @@ static int dw_mci_idmac_init(struct dw_mci *host) · 165 unmodified lines
434435 return 0;
435436 }
436437
437−static struct dw_mci_dma_ops dw_mci_idmac_ops = {
438+static const struct dw_mci_dma_ops dw_mci_idmac_ops = {
438439 .init = dw_mci_idmac_init,
439440 .start = dw_mci_idmac_start_dma,
440441 .stop = dw_mci_idmac_stop_dma,
@@ -772,6 +773,7 @@ static void dw_mci_request(struct mmc_host *mmc, struct mmc_request *mrq) · 331 unmodified lines
772773 static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
773774 {
774775 struct dw_mci_slot *slot = mmc_priv(mmc);
776+ struct dw_mci_drv_data *drv_data = slot->host->drv_data;
775777 u32 regs;
776778
777779 /* set default 1 bit mode */
@@ -807,8 +809,8 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) · 29 unmodified lines
807809 slot->clock = ios->clock;
808810 }
809811
810− if (slot->host->drv_data->set_ios)
811− slot->host->drv_data->set_ios(slot->host, ios);
812+ if (drv_data && drv_data->set_ios)
813+ drv_data->set_ios(slot->host, ios);
812814
813815 switch (ios->power_mode) {
814816 case MMC_POWER_UP:
@@ -1815,6 +1817,7 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id) · 1000 unmodified lines
18151817 {
18161818 struct mmc_host *mmc;
18171819 struct dw_mci_slot *slot;
1820+ struct dw_mci_drv_data *drv_data = host->drv_data;
18181821 int ctrl_id, ret;
18191822 u8 bus_width;
18201823
@@ -1854,8 +1857,8 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id) · 33 unmodified lines
18541857 } else {
18551858 ctrl_id = to_platform_device(host->dev)->id;
18561859 }
1857− if (host->drv_data && host->drv_data->caps)
1858− mmc->caps |= host->drv_data->caps[ctrl_id];
1860+ if (drv_data && drv_data->caps)
1861+ mmc->caps |= drv_data->caps[ctrl_id];
18591862
18601863 if (host->pdata->caps2)
18611864 mmc->caps2 = host->pdata->caps2;
@@ -1867,10 +1870,10 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id) · 5 unmodified lines
18671870 else
18681871 bus_width = 1;
18691872
1870− if (host->drv_data->setup_bus) {
1873+ if (drv_data && drv_data->setup_bus) {
18711874 struct device_node *slot_np;
18721875 slot_np = dw_mci_of_find_slot_node(host->dev, slot->id);
1873− ret = host->drv_data->setup_bus(host, slot_np, bus_width);
1876+ ret = drv_data->setup_bus(host, slot_np, bus_width);
18741877 if (ret)
18751878 goto err_setup_bus;
18761879 }
@@ -1968,7 +1971,7 @@ static void dw_mci_init_dma(struct dw_mci *host) · 91 unmodified lines
19681971 /* Determine which DMA interface to use */
19691972 #ifdef CONFIG_MMC_DW_IDMAC
19701973 host->dma_ops = &dw_mci_idmac_ops;
1971− dev_info(&host->dev, "Using internal DMA controller.\n");
1974+ dev_info(host->dev, "Using internal DMA controller.\n");
19721975 #endif
19731976
19741977 if (!host->dma_ops)
@@ -2035,6 +2038,7 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host) · 60 unmodified lines
20352038 struct dw_mci_board *pdata;
20362039 struct device *dev = host->dev;
20372040 struct device_node *np = dev->of_node;
2041+ struct dw_mci_drv_data *drv_data = host->drv_data;
20382042 int idx, ret;
20392043
20402044 pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
@@ -2062,8 +2066,8 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host) · 21 unmodified lines
20622066
20632067 of_property_read_u32(np, "card-detect-delay", &pdata->detect_delay_ms);
20642068
2065− if (host->drv_data->parse_dt) {
2066− ret = host->drv_data->parse_dt(host);
2069+ if (drv_data && drv_data->parse_dt) {
2070+ ret = drv_data->parse_dt(host);
20672071 if (ret)
20682072 return ERR_PTR(ret);
20692073 }
@@ -2080,6 +2084,7 @@ static struct dw_mci_board *dw_mci_parse_dt(struct dw_mci *host) · 10 unmodified lines
20802084
20812085 int dw_mci_probe(struct dw_mci *host)
20822086 {
2087+ struct dw_mci_drv_data *drv_data = host->drv_data;
20832088 int width, i, ret = 0;
20842089 u32 fifo_size;
20852090 int init_slots = 0;
@@ -2127,8 +2132,8 @@ int dw_mci_probe(struct dw_mci *host) · 41 unmodified lines
21272132 else
21282133 host->bus_hz = clk_get_rate(host->ciu_clk);
21292134
2130− if (host->drv_data->setup_clock) {
2131− ret = host->drv_data->setup_clock(host);
2135+ if (drv_data && drv_data->setup_clock) {
2136+ ret = drv_data->setup_clock(host);
21322137 if (ret) {
21332138 dev_err(host->dev,
21342139 "implementation specific clock setup failed\n");
@@ -2228,6 +2233,21 @@ int dw_mci_probe(struct dw_mci *host) · 93 unmodified lines
22282233 else
22292234 host->num_slots = ((mci_readl(host, HCON) >> 1) & 0x1F) + 1;
22302235
2236+ /*
2237+ * Enable interrupts for command done, data over, data empty, card det,
2238+ * receive ready and error such as transmit, receive timeout, crc error
2239+ */
2240+ mci_writel(host, RINTSTS, 0xFFFFFFFF);
2241+ mci_writel(host, INTMASK, SDMMC_INT_CMD_DONE | SDMMC_INT_DATA_OVER |
2242+ SDMMC_INT_TXDR | SDMMC_INT_RXDR |
2243+ DW_MCI_ERROR_FLAGS | SDMMC_INT_CD);
2244+ mci_writel(host, CTRL, SDMMC_CTRL_INT_ENABLE); /* Enable mci interrupt */
2245+
2246+ dev_info(host->dev, "DW MMC controller at irq %d, "
2247+ "%d bit host data width, "
2248+ "%u deep fifo\n",
2249+ host->irq, width, fifo_size);
2250+
22312251 /* We need at least one slot to succeed */
22322252 for (i = 0; i < host->num_slots; i++) {
22332253 ret = dw_mci_init_slot(host, i);
@@ -2257,20 +2277,6 @@ int dw_mci_probe(struct dw_mci *host) · 23 unmodified lines
22572277 else
22582278 host->data_offset = DATA_240A_OFFSET;
22592279
2260− /*
2261− * Enable interrupts for command done, data over, data empty, card det,
2262− * receive ready and error such as transmit, receive timeout, crc error
2263− */
2264− mci_writel(host, RINTSTS, 0xFFFFFFFF);
2265− mci_writel(host, INTMASK, SDMMC_INT_CMD_DONE | SDMMC_INT_DATA_OVER |
2266− SDMMC_INT_TXDR | SDMMC_INT_RXDR |
2267− DW_MCI_ERROR_FLAGS | SDMMC_INT_CD);
2268− mci_writel(host, CTRL, SDMMC_CTRL_INT_ENABLE); /* Enable mci interrupt */
2269−
2270− dev_info(host->dev, "DW MMC controller at irq %d, "
2271− "%d bit host data width, "
2272− "%u deep fifo\n",
2273− host->irq, width, fifo_size);
22742280 if (host->quirks & DW_MCI_QUIRK_IDMAC_DTO)
22752281 dev_info(host->dev, "Internal DMAC interrupt fix enabled.\n");
22762282
drivers/mmc/host/mxcmmc.c+1−1
@@ -1134,4 +1134,4 @@ module_platform_driver(mxcmci_driver); · 1133 unmodified lines
11341134 MODULE_DESCRIPTION("i.MX Multimedia Card Interface Driver");
11351135 MODULE_AUTHOR("Sascha Hauer, Pengutronix");
11361136 MODULE_LICENSE("GPL");
1137−MODULE_ALIAS("platform:imx-mmc");
1137+MODULE_ALIAS("platform:mxc-mmc");
drivers/mmc/host/omap_hsmmc.c+12−7
@@ -178,7 +178,8 @@ struct omap_hsmmc_host { · 177 unmodified lines
178178
179179 static int omap_hsmmc_card_detect(struct device *dev, int slot)
180180 {
181− struct omap_mmc_platform_data *mmc = dev->platform_data;
181+ struct omap_hsmmc_host *host = dev_get_drvdata(dev);
182+ struct omap_mmc_platform_data *mmc = host->pdata;
182183
183184 /* NOTE: assumes card detect signal is active-low */
184185 return !gpio_get_value_cansleep(mmc->slots[0].switch_pin);
@@ -186,7 +187,8 @@ static int omap_hsmmc_card_detect(struct device *dev, int slot) · 1 unmodified line
186187
187188 static int omap_hsmmc_get_wp(struct device *dev, int slot)
188189 {
189− struct omap_mmc_platform_data *mmc = dev->platform_data;
190+ struct omap_hsmmc_host *host = dev_get_drvdata(dev);
191+ struct omap_mmc_platform_data *mmc = host->pdata;
190192
191193 /* NOTE: assumes write protect signal is active-high */
192194 return gpio_get_value_cansleep(mmc->slots[0].gpio_wp);
@@ -194,7 +196,8 @@ static int omap_hsmmc_get_wp(struct device *dev, int slot) · 1 unmodified line
194196
195197 static int omap_hsmmc_get_cover_state(struct device *dev, int slot)
196198 {
197− struct omap_mmc_platform_data *mmc = dev->platform_data;
199+ struct omap_hsmmc_host *host = dev_get_drvdata(dev);
200+ struct omap_mmc_platform_data *mmc = host->pdata;
198201
199202 /* NOTE: assumes card detect signal is active-low */
200203 return !gpio_get_value_cansleep(mmc->slots[0].switch_pin);
@@ -204,7 +207,8 @@ static int omap_hsmmc_get_cover_state(struct device *dev, int slot) · 3 unmodified lines
204207
205208 static int omap_hsmmc_suspend_cdirq(struct device *dev, int slot)
206209 {
207− struct omap_mmc_platform_data *mmc = dev->platform_data;
210+ struct omap_hsmmc_host *host = dev_get_drvdata(dev);
211+ struct omap_mmc_platform_data *mmc = host->pdata;
208212
209213 disable_irq(mmc->slots[0].card_detect_irq);
210214 return 0;
@@ -212,7 +216,8 @@ static int omap_hsmmc_suspend_cdirq(struct device *dev, int slot) · 1 unmodified line
212216
213217 static int omap_hsmmc_resume_cdirq(struct device *dev, int slot)
214218 {
215− struct omap_mmc_platform_data *mmc = dev->platform_data;
219+ struct omap_hsmmc_host *host = dev_get_drvdata(dev);
220+ struct omap_mmc_platform_data *mmc = host->pdata;
216221
217222 enable_irq(mmc->slots[0].card_detect_irq);
218223 return 0;
@@ -2009,9 +2014,9 @@ static int __devexit omap_hsmmc_remove(struct platform_device *pdev) · 1790 unmodified lines
20092014 clk_put(host->dbclk);
20102015 }
20112016
2012− mmc_free_host(host->mmc);
2017+ omap_hsmmc_gpio_free(host->pdata);
20132018 iounmap(host->base);
2014− omap_hsmmc_gpio_free(pdev->dev.platform_data);
2019+ mmc_free_host(host->mmc);
20152020
20162021 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
20172022 if (res)
drivers/mmc/host/sdhci-dove.c+20−18
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2020 */
2121
22+#include <linux/err.h>
2223 #include <linux/io.h>
2324 #include <linux/clk.h>
2425 #include <linux/err.h>
@@ -84,30 +85,32 @@ static int __devinit sdhci_dove_probe(struct platform_device *pdev) · 59 unmodified lines
8485 struct sdhci_dove_priv *priv;
8586 int ret;
8687
87− ret = sdhci_pltfm_register(pdev, &sdhci_dove_pdata);
88− if (ret)
89− goto sdhci_dove_register_fail;
90−
9188 priv = devm_kzalloc(&pdev->dev, sizeof(struct sdhci_dove_priv),
9289 GFP_KERNEL);
9390 if (!priv) {
9491 dev_err(&pdev->dev, "unable to allocate private data");
95− ret = -ENOMEM;
96− goto sdhci_dove_allocate_fail;
92+ return -ENOMEM;
9793 }
9894
95+ priv->clk = clk_get(&pdev->dev, NULL);
96+ if (!IS_ERR(priv->clk))
97+ clk_prepare_enable(priv->clk);
98+
99+ ret = sdhci_pltfm_register(pdev, &sdhci_dove_pdata);
100+ if (ret)
101+ goto sdhci_dove_register_fail;
102+
99103 host = platform_get_drvdata(pdev);
100104 pltfm_host = sdhci_priv(host);
101105 pltfm_host->priv = priv;
102106
103− priv->clk = clk_get(&pdev->dev, NULL);
104− if (!IS_ERR(priv->clk))
105− clk_prepare_enable(priv->clk);
106107 return 0;
107108
108−sdhci_dove_allocate_fail:
109− sdhci_pltfm_unregister(pdev);
110109 sdhci_dove_register_fail:
110+ if (!IS_ERR(priv->clk)) {
111+ clk_disable_unprepare(priv->clk);
112+ clk_put(priv->clk);
113+ }
111114 return ret;
112115 }
113116
@@ -117,14 +120,13 @@ static int __devexit sdhci_dove_remove(struct platform_device *pdev) · 3 unmodified lines
117120 struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
118121 struct sdhci_dove_priv *priv = pltfm_host->priv;
119122
120− if (priv->clk) {
121− if (!IS_ERR(priv->clk)) {
122− clk_disable_unprepare(priv->clk);
123− clk_put(priv->clk);
124− }
125− devm_kfree(&pdev->dev, priv->clk);
123+ sdhci_pltfm_unregister(pdev);
124+
125+ if (!IS_ERR(priv->clk)) {
126+ clk_disable_unprepare(priv->clk);
127+ clk_put(priv->clk);
126128 }
127− return sdhci_pltfm_unregister(pdev);
129+ return 0;
128130 }
129131
130132 static const struct of_device_id sdhci_dove_of_match_table[] __devinitdata = {
drivers/mmc/host/sdhci-of-esdhc.c+11−0
@@ -169,6 +169,16 @@ static void esdhc_of_resume(struct sdhci_host *host) · 168 unmodified lines
169169 }
170170 #endif
171171
172+static void esdhc_of_platform_init(struct sdhci_host *host)
173+{
174+ u32 vvn;
175+
176+ vvn = in_be32(host->ioaddr + SDHCI_SLOT_INT_STATUS);
177+ vvn = (vvn & SDHCI_VENDOR_VER_MASK) >> SDHCI_VENDOR_VER_SHIFT;
178+ if (vvn == VENDOR_V_22)
179+ host->quirks2 |= SDHCI_QUIRK2_HOST_NO_CMD23;
180+}
181+
172182 static struct sdhci_ops sdhci_esdhc_ops = {
173183 .read_l = esdhc_readl,
174184 .read_w = esdhc_readw,
@@ -180,6 +190,7 @@ static struct sdhci_ops sdhci_esdhc_ops = { · 5 unmodified lines
180190 .enable_dma = esdhc_of_enable_dma,
181191 .get_max_clock = esdhc_of_get_max_clock,
182192 .get_min_clock = esdhc_of_get_min_clock,
193+ .platform_init = esdhc_of_platform_init,
183194 #ifdef CONFIG_PM
184195 .platform_suspend = esdhc_of_suspend,
185196 .platform_resume = esdhc_of_resume,
drivers/mmc/host/sdhci-pci.c+1−1
@@ -1196,7 +1196,7 @@ static struct sdhci_pci_slot * __devinit sdhci_pci_probe_slot( · 1195 unmodified lines
11961196 return ERR_PTR(-ENODEV);
11971197 }
11981198
1199− if (pci_resource_len(pdev, bar) != 0x100) {
1199+ if (pci_resource_len(pdev, bar) < 0x100) {
12001200 dev_err(&pdev->dev, "Invalid iomem size. You may "
12011201 "experience problems.\n");
12021202 }
drivers/mmc/host/sdhci-pltfm.c+7−0
@@ -150,6 +150,13 @@ struct sdhci_host *sdhci_pltfm_init(struct platform_device *pdev, · 149 unmodified lines
150150 goto err_remap;
151151 }
152152
153+ /*
154+ * Some platforms need to probe the controller to be able to
155+ * determine which caps should be used.
156+ */
157+ if (host->ops && host->ops->platform_init)
158+ host->ops->platform_init(host);
159+
153160 platform_set_drvdata(pdev, host);
154161
155162 return host;
drivers/mmc/host/sdhci-s3c.c+16−14
@@ -211,8 +211,8 @@ static void sdhci_s3c_set_clock(struct sdhci_host *host, unsigned int clock) · 210 unmodified lines
211211 if (ourhost->cur_clk != best_src) {
212212 struct clk *clk = ourhost->clk_bus[best_src];
213213
214− clk_enable(clk);
215− clk_disable(ourhost->clk_bus[ourhost->cur_clk]);
214+ clk_prepare_enable(clk);
215+ clk_disable_unprepare(ourhost->clk_bus[ourhost->cur_clk]);
216216
217217 /* turn clock off to card before changing clock source */
218218 writew(0, host->ioaddr + SDHCI_CLOCK_CONTROL);
@@ -607,7 +607,7 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) · 388 unmodified lines
607607 }
608608
609609 /* enable the local io clock and keep it running for the moment. */
610− clk_enable(sc->clk_io);
610+ clk_prepare_enable(sc->clk_io);
611611
612612 for (clks = 0, ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
613613 struct clk *clk;
@@ -638,7 +638,7 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) · 24 unmodified lines
638638 }
639639
640640 #ifndef CONFIG_PM_RUNTIME
641− clk_enable(sc->clk_bus[sc->cur_clk]);
641+ clk_prepare_enable(sc->clk_bus[sc->cur_clk]);
642642 #endif
643643
644644 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -747,13 +747,14 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) · 102 unmodified lines
747747 sdhci_s3c_setup_card_detect_gpio(sc);
748748
749749 #ifdef CONFIG_PM_RUNTIME
750− clk_disable(sc->clk_io);
750+ if (pdata->cd_type != S3C_SDHCI_CD_INTERNAL)
751+ clk_disable_unprepare(sc->clk_io);
751752 #endif
752753 return 0;
753754
754755 err_req_regs:
755756 #ifndef CONFIG_PM_RUNTIME
756− clk_disable(sc->clk_bus[sc->cur_clk]);
757+ clk_disable_unprepare(sc->clk_bus[sc->cur_clk]);
757758 #endif
758759 for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
759760 if (sc->clk_bus[ptr]) {
@@ -762,7 +763,7 @@ static int __devinit sdhci_s3c_probe(struct platform_device *pdev) · 2 unmodified lines
762763 }
763764
764765 err_no_busclks:
765− clk_disable(sc->clk_io);
766+ clk_disable_unprepare(sc->clk_io);
766767 clk_put(sc->clk_io);
767768
768769 err_io_clk:
@@ -794,7 +795,8 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev) · 25 unmodified lines
794795 gpio_free(sc->ext_cd_gpio);
795796
796797 #ifdef CONFIG_PM_RUNTIME
797− clk_enable(sc->clk_io);
798+ if (pdata->cd_type != S3C_SDHCI_CD_INTERNAL)
799+ clk_prepare_enable(sc->clk_io);
798800 #endif
799801 sdhci_remove_host(host, 1);
800802
@@ -802,14 +804,14 @@ static int __devexit sdhci_s3c_remove(struct platform_device *pdev) · 1 unmodified line
802804 pm_runtime_disable(&pdev->dev);
803805
804806 #ifndef CONFIG_PM_RUNTIME
805− clk_disable(sc->clk_bus[sc->cur_clk]);
807+ clk_disable_unprepare(sc->clk_bus[sc->cur_clk]);
806808 #endif
807809 for (ptr = 0; ptr < MAX_BUS_CLK; ptr++) {
808810 if (sc->clk_bus[ptr]) {
809811 clk_put(sc->clk_bus[ptr]);
810812 }
811813 }
812− clk_disable(sc->clk_io);
814+ clk_disable_unprepare(sc->clk_io);
813815 clk_put(sc->clk_io);
814816
815817 if (pdev->dev.of_node) {
@@ -849,8 +851,8 @@ static int sdhci_s3c_runtime_suspend(struct device *dev) · 33 unmodified lines
849851
850852 ret = sdhci_runtime_suspend_host(host);
851853
852− clk_disable(ourhost->clk_bus[ourhost->cur_clk]);
853− clk_disable(busclk);
854+ clk_disable_unprepare(ourhost->clk_bus[ourhost->cur_clk]);
855+ clk_disable_unprepare(busclk);
854856 return ret;
855857 }
856858
@@ -861,8 +863,8 @@ static int sdhci_s3c_runtime_resume(struct device *dev) · 4 unmodified lines
861863 struct clk *busclk = ourhost->clk_io;
862864 int ret;
863865
864− clk_enable(busclk);
865− clk_enable(ourhost->clk_bus[ourhost->cur_clk]);
866+ clk_prepare_enable(busclk);
867+ clk_prepare_enable(ourhost->clk_bus[ourhost->cur_clk]);
866868 ret = sdhci_runtime_resume_host(host);
867869 return ret;
868870 }
drivers/mmc/host/sdhci.c+28−16
@@ -1315,16 +1315,19 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) · 1314 unmodified lines
13151315 */
13161316 if ((host->flags & SDHCI_NEEDS_RETUNING) &&
13171317 !(present_state & (SDHCI_DOING_WRITE | SDHCI_DOING_READ))) {
1318− /* eMMC uses cmd21 while sd and sdio use cmd19 */
1319− tuning_opcode = mmc->card->type == MMC_TYPE_MMC ?
1320− MMC_SEND_TUNING_BLOCK_HS200 :
1321− MMC_SEND_TUNING_BLOCK;
1322− spin_unlock_irqrestore(&host->lock, flags);
1323− sdhci_execute_tuning(mmc, tuning_opcode);
1324− spin_lock_irqsave(&host->lock, flags);
1325−
1326− /* Restore original mmc_request structure */
1327− host->mrq = mrq;
1318+ if (mmc->card) {
1319+ /* eMMC uses cmd21 but sd and sdio use cmd19 */
1320+ tuning_opcode =
1321+ mmc->card->type == MMC_TYPE_MMC ?
1322+ MMC_SEND_TUNING_BLOCK_HS200 :
1323+ MMC_SEND_TUNING_BLOCK;
1324+ spin_unlock_irqrestore(&host->lock, flags);
1325+ sdhci_execute_tuning(mmc, tuning_opcode);
1326+ spin_lock_irqsave(&host->lock, flags);
1327+
1328+ /* Restore original mmc_request structure */
1329+ host->mrq = mrq;
1330+ }
13281331 }
13291332
13301333 if (mrq->sbc && !(host->flags & SDHCI_AUTO_CMD23))
@@ -2837,6 +2840,9 @@ int sdhci_add_host(struct sdhci_host *host) · 1506 unmodified lines
28372840 if (!(host->quirks & SDHCI_QUIRK_FORCE_1_BIT_DATA))
28382841 mmc->caps |= MMC_CAP_4_BIT_DATA;
28392842
2843+ if (host->quirks2 & SDHCI_QUIRK2_HOST_NO_CMD23)
2844+ mmc->caps &= ~MMC_CAP_CMD23;
2845+
28402846 if (caps[0] & SDHCI_CAN_DO_HISPD)
28412847 mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;
28422848
@@ -2846,9 +2852,12 @@ int sdhci_add_host(struct sdhci_host *host) · 3 unmodified lines
28462852
28472853 /* If vqmmc regulator and no 1.8V signalling, then there's no UHS */
28482854 host->vqmmc = regulator_get(mmc_dev(mmc), "vqmmc");
2849− if (IS_ERR(host->vqmmc)) {
2850− pr_info("%s: no vqmmc regulator found\n", mmc_hostname(mmc));
2851− host->vqmmc = NULL;
2855+ if (IS_ERR_OR_NULL(host->vqmmc)) {
2856+ if (PTR_ERR(host->vqmmc) < 0) {
2857+ pr_info("%s: no vqmmc regulator found\n",
2858+ mmc_hostname(mmc));
2859+ host->vqmmc = NULL;
2860+ }
28522861 }
28532862 else if (regulator_is_supported_voltage(host->vqmmc, 1800000, 1800000))
28542863 regulator_enable(host->vqmmc);
@@ -2904,9 +2913,12 @@ int sdhci_add_host(struct sdhci_host *host) · 49 unmodified lines
29042913 ocr_avail = 0;
29052914
29062915 host->vmmc = regulator_get(mmc_dev(mmc), "vmmc");
2907− if (IS_ERR(host->vmmc)) {
2908− pr_info("%s: no vmmc regulator found\n", mmc_hostname(mmc));
2909− host->vmmc = NULL;
2916+ if (IS_ERR_OR_NULL(host->vmmc)) {
2917+ if (PTR_ERR(host->vmmc) < 0) {
2918+ pr_info("%s: no vmmc regulator found\n",
2919+ mmc_hostname(mmc));
2920+ host->vmmc = NULL;
2921+ }
29102922 } else
29112923 regulator_enable(host->vmmc);
29122924
drivers/mmc/host/sdhci.h+1−0
@@ -278,6 +278,7 @@ struct sdhci_ops { · 277 unmodified lines
278278 void (*hw_reset)(struct sdhci_host *host);
279279 void (*platform_suspend)(struct sdhci_host *host);
280280 void (*platform_resume)(struct sdhci_host *host);
281+ void (*platform_init)(struct sdhci_host *host);
281282 };
282283
283284 #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS
drivers/mmc/host/sh_mmcif.c+1−1
@@ -1466,9 +1466,9 @@ static int __devexit sh_mmcif_remove(struct platform_device *pdev) · 1465 unmodified lines
14661466
14671467 platform_set_drvdata(pdev, NULL);
14681468
1469+ clk_disable(host->hclk);
14691470 mmc_free_host(host->mmc);
14701471 pm_runtime_put_sync(&pdev->dev);
1471− clk_disable(host->hclk);
14721472 pm_runtime_disable(&pdev->dev);
14731473
14741474 return 0;
drivers/net/bonding/bond_sysfs.c+2−2
@@ -1060,7 +1060,7 @@ static ssize_t bonding_store_primary(struct device *d, · 1059 unmodified lines
10601060 goto out;
10611061 }
10621062
1063− sscanf(buf, "%16s", ifname); /* IFNAMSIZ */
1063+ sscanf(buf, "%15s", ifname); /* IFNAMSIZ */
10641064
10651065 /* check to see if we are clearing primary */
10661066 if (!strlen(ifname) || buf[0] == '\n') {
@@ -1237,7 +1237,7 @@ static ssize_t bonding_store_active_slave(struct device *d, · 170 unmodified lines
12371237 goto out;
12381238 }
12391239
1240− sscanf(buf, "%16s", ifname); /* IFNAMSIZ */
1240+ sscanf(buf, "%15s", ifname); /* IFNAMSIZ */
12411241
12421242 /* check to see if we are clearing active */
12431243 if (!strlen(ifname) || buf[0] == '\n') {
drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c+1−1
@@ -1702,7 +1702,7 @@ static int bnx2x_set_eee(struct net_device *dev, struct ethtool_eee *edata) · 1701 unmodified lines
17021702 SHMEM_EEE_ADV_STATUS_SHIFT);
17031703 if ((advertised != (eee_cfg & SHMEM_EEE_ADV_STATUS_MASK))) {
17041704 DP(BNX2X_MSG_ETHTOOL,
1705− "Direct manipulation of EEE advertisment is not supported\n");
1705+ "Direct manipulation of EEE advertisement is not supported\n");
17061706 return -EINVAL;
17071707 }
17081708
drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c+115−47
@@ -137,7 +137,16 @@ · 136 unmodified lines
137137 #define LINK_20GTFD LINK_STATUS_SPEED_AND_DUPLEX_20GTFD
138138 #define LINK_20GXFD LINK_STATUS_SPEED_AND_DUPLEX_20GXFD
139139
140−
140+#define LINK_UPDATE_MASK \
141+ (LINK_STATUS_SPEED_AND_DUPLEX_MASK | \
142+ LINK_STATUS_LINK_UP | \
143+ LINK_STATUS_PHYSICAL_LINK_FLAG | \
144+ LINK_STATUS_AUTO_NEGOTIATE_COMPLETE | \
145+ LINK_STATUS_RX_FLOW_CONTROL_FLAG_MASK | \
146+ LINK_STATUS_TX_FLOW_CONTROL_FLAG_MASK | \
147+ LINK_STATUS_PARALLEL_DETECTION_FLAG_MASK | \
148+ LINK_STATUS_LINK_PARTNER_SYMMETRIC_PAUSE | \
149+ LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE)
141150
142151 #define SFP_EEPROM_CON_TYPE_ADDR 0x2
143152 #define SFP_EEPROM_CON_TYPE_VAL_LC 0x7
@@ -3295,6 +3304,21 @@ static void bnx2x_serdes_deassert(struct bnx2x *bp, u8 port) · 3151 unmodified lines
32953304 DEFAULT_PHY_DEV_ADDR);
32963305 }
32973306
3307+static void bnx2x_xgxs_specific_func(struct bnx2x_phy *phy,
3308+ struct link_params *params,
3309+ u32 action)
3310+{
3311+ struct bnx2x *bp = params->bp;
3312+ switch (action) {
3313+ case PHY_INIT:
3314+ /* Set correct devad */
3315+ REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_ST + params->port*0x18, 0);
3316+ REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_DEVAD + params->port*0x18,
3317+ phy->def_md_devad);
3318+ break;
3319+ }
3320+}
3321+
32983322 static void bnx2x_xgxs_deassert(struct link_params *params)
32993323 {
33003324 struct bnx2x *bp = params->bp;
@@ -3309,10 +3333,8 @@ static void bnx2x_xgxs_deassert(struct link_params *params) · 8 unmodified lines
33093333 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_3_CLEAR, val);
33103334 udelay(500);
33113335 REG_WR(bp, GRCBASE_MISC + MISC_REGISTERS_RESET_REG_3_SET, val);
3312−
3313− REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_ST + port*0x18, 0);
3314− REG_WR(bp, NIG_REG_XGXS0_CTRL_MD_DEVAD + port*0x18,
3315− params->phy[INT_PHY].def_md_devad);
3336+ bnx2x_xgxs_specific_func(&params->phy[INT_PHY], params,
3337+ PHY_INIT);
33163338 }
33173339
33183340 static void bnx2x_calc_ieee_aneg_adv(struct bnx2x_phy *phy,
@@ -3545,14 +3567,11 @@ static void bnx2x_warpcore_set_lpi_passthrough(struct bnx2x_phy *phy, · 226 unmodified lines
35453567 static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy,
35463568 struct link_params *params,
35473569 struct link_vars *vars) {
3548− u16 val16 = 0, lane, i;
3570+ u16 lane, i, cl72_ctrl, an_adv = 0;
3571+ u16 ucode_ver;
35493572 struct bnx2x *bp = params->bp;
35503573 static struct bnx2x_reg_set reg_set[] = {
35513574 {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2, 0x7},
3552− {MDIO_AN_DEVAD, MDIO_WC_REG_PAR_DET_10G_CTRL, 0},
3553− {MDIO_WC_DEVAD, MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, 0},
3554− {MDIO_WC_DEVAD, MDIO_WC_REG_XGXSBLK1_LANECTRL0, 0xff},
3555− {MDIO_WC_DEVAD, MDIO_WC_REG_XGXSBLK1_LANECTRL1, 0x5555},
35563575 {MDIO_PMA_DEVAD, MDIO_WC_REG_IEEE0BLK_AUTONEGNP, 0x0},
35573576 {MDIO_WC_DEVAD, MDIO_WC_REG_RX66_CONTROL, 0x7415},
35583577 {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_MISC2, 0x6190},
@@ -3565,12 +3584,19 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, · 6 unmodified lines
35653584 bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg,
35663585 reg_set[i].val);
35673586
3587+ bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD,
3588+ MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, &cl72_ctrl);
3589+ cl72_ctrl &= 0xf8ff;
3590+ cl72_ctrl |= 0x3800;
3591+ bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
3592+ MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL, cl72_ctrl);
3593+
35683594 /* Check adding advertisement for 1G KX */
35693595 if (((vars->line_speed == SPEED_AUTO_NEG) &&
35703596 (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_1G)) ||
35713597 (vars->line_speed == SPEED_1000)) {
35723598 u32 addr = MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2;
3573− val16 |= (1<<5);
3599+ an_adv |= (1<<5);
35743600
35753601 /* Enable CL37 1G Parallel Detect */
35763602 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD, addr, 0x1);
@@ -3580,11 +3606,14 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, · 3 unmodified lines
35803606 (phy->speed_cap_mask & PORT_HW_CFG_SPEED_CAPABILITY_D0_10G)) ||
35813607 (vars->line_speed == SPEED_10000)) {
35823608 /* Check adding advertisement for 10G KR */
3583− val16 |= (1<<7);
3609+ an_adv |= (1<<7);
35843610 /* Enable 10G Parallel Detect */
3611+ CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK,
3612+ MDIO_AER_BLOCK_AER_REG, 0);
3613+
35853614 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD,
35863615 MDIO_WC_REG_PAR_DET_10G_CTRL, 1);
3587−
3616+ bnx2x_set_aer_mmd(params, phy);
35883617 DP(NETIF_MSG_LINK, "Advertize 10G\n");
35893618 }
35903619
@@ -3604,7 +3633,7 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, · 13 unmodified lines
36043633
36053634 /* Advertised speeds */
36063635 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD,
3607− MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT1, val16);
3636+ MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT1, an_adv);
36083637
36093638 /* Advertised and set FEC (Forward Error Correction) */
36103639 bnx2x_cl45_write(bp, phy, MDIO_AN_DEVAD,
@@ -3628,9 +3657,10 @@ static void bnx2x_warpcore_enable_AN_KR(struct bnx2x_phy *phy, · 17 unmodified lines
36283657 /* Set KR Autoneg Work-Around flag for Warpcore version older than D108
36293658 */
36303659 bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD,
3631− MDIO_WC_REG_UC_INFO_B1_VERSION, &val16);
3632− if (val16 < 0xd108) {
3633− DP(NETIF_MSG_LINK, "Enable AN KR work-around\n");
3660+ MDIO_WC_REG_UC_INFO_B1_VERSION, &ucode_ver);
3661+ if (ucode_ver < 0xd108) {
3662+ DP(NETIF_MSG_LINK, "Enable AN KR work-around. WC ver:0x%x\n",
3663+ ucode_ver);
36343664 vars->rx_tx_asic_rst = MAX_KR_LINK_RETRY;
36353665 }
36363666 bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD,
@@ -3651,21 +3681,16 @@ static void bnx2x_warpcore_set_10G_KR(struct bnx2x_phy *phy, · 14 unmodified lines
36513681 struct link_vars *vars)
36523682 {
36533683 struct bnx2x *bp = params->bp;
3654− u16 i;
3684+ u16 val16, i, lane;
36553685 static struct bnx2x_reg_set reg_set[] = {
36563686 /* Disable Autoneg */
36573687 {MDIO_WC_DEVAD, MDIO_WC_REG_SERDESDIGITAL_CONTROL1000X2, 0x7},
3658− {MDIO_AN_DEVAD, MDIO_WC_REG_PAR_DET_10G_CTRL, 0},
36593688 {MDIO_WC_DEVAD, MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL,
36603689 0x3f00},
36613690 {MDIO_AN_DEVAD, MDIO_WC_REG_AN_IEEE1BLK_AN_ADVERTISEMENT1, 0},
36623691 {MDIO_AN_DEVAD, MDIO_WC_REG_IEEE0BLK_MIICNTL, 0x0},
36633692 {MDIO_WC_DEVAD, MDIO_WC_REG_DIGITAL3_UP1, 0x1},
36643693 {MDIO_WC_DEVAD, MDIO_WC_REG_DIGITAL5_MISC7, 0xa},
3665− /* Disable CL36 PCS Tx */
3666− {MDIO_WC_DEVAD, MDIO_WC_REG_XGXSBLK1_LANECTRL0, 0x0},
3667− /* Double Wide Single Data Rate @ pll rate */
3668− {MDIO_WC_DEVAD, MDIO_WC_REG_XGXSBLK1_LANECTRL1, 0xFFFF},
36693694 /* Leave cl72 training enable, needed for KR */
36703695 {MDIO_PMA_DEVAD,
36713696 MDIO_WC_REG_PMD_IEEE9BLK_TENGBASE_KR_PMD_CONTROL_REGISTER_150,
@@ -3676,11 +3701,24 @@ static void bnx2x_warpcore_set_10G_KR(struct bnx2x_phy *phy, · 4 unmodified lines
36763701 bnx2x_cl45_write(bp, phy, reg_set[i].devad, reg_set[i].reg,
36773702 reg_set[i].val);
36783703
3679− /* Leave CL72 enabled */
3680− bnx2x_cl45_read_or_write(bp, phy, MDIO_WC_DEVAD,
3681− MDIO_WC_REG_CL72_USERB0_CL72_MISC1_CONTROL,
3682− 0x3800);
3704+ lane = bnx2x_get_warpcore_lane(phy, params);
3705+ /* Global registers */
3706+ CL22_WR_OVER_CL45(bp, phy, MDIO_REG_BANK_AER_BLOCK,
3707+ MDIO_AER_BLOCK_AER_REG, 0);
3708+ /* Disable CL36 PCS Tx */
3709+ bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD,
3710+ MDIO_WC_REG_XGXSBLK1_LANECTRL0, &val16);
3711+ val16 &= ~(0x0011 << lane);
3712+ bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
3713+ MDIO_WC_REG_XGXSBLK1_LANECTRL0, val16);
36833714
3715+ bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD,
3716+ MDIO_WC_REG_XGXSBLK1_LANECTRL1, &val16);
3717+ val16 |= (0x0303 << (lane << 1));
3718+ bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
3719+ MDIO_WC_REG_XGXSBLK1_LANECTRL1, val16);
3720+ /* Restore AER */
3721+ bnx2x_set_aer_mmd(params, phy);
36843722 /* Set speed via PMA/PMD register */
36853723 bnx2x_cl45_write(bp, phy, MDIO_PMA_DEVAD,
36863724 MDIO_WC_REG_IEEE0BLK_MIICNTL, 0x2040);
@@ -4303,7 +4341,7 @@ static void bnx2x_warpcore_link_reset(struct bnx2x_phy *phy, · 616 unmodified lines
43034341 struct link_params *params)
43044342 {
43054343 struct bnx2x *bp = params->bp;
4306− u16 val16;
4344+ u16 val16, lane;
43074345 bnx2x_sfp_e3_set_transmitter(params, phy, 0);
43084346 bnx2x_set_mdio_clk(bp, params->chip_id, params->port);
43094347 bnx2x_set_aer_mmd(params, phy);
@@ -4340,6 +4378,30 @@ static void bnx2x_warpcore_link_reset(struct bnx2x_phy *phy, · 30 unmodified lines
43404378 MDIO_WC_REG_XGXSBLK1_LANECTRL2,
43414379 val16 & 0xff00);
43424380
4381+ lane = bnx2x_get_warpcore_lane(phy, params);
4382+ /* Disable CL36 PCS Tx */
4383+ bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD,
4384+ MDIO_WC_REG_XGXSBLK1_LANECTRL0, &val16);
4385+ val16 |= (0x11 << lane);
4386+ if (phy->flags & FLAGS_WC_DUAL_MODE)
4387+ val16 |= (0x22 << lane);
4388+ bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
4389+ MDIO_WC_REG_XGXSBLK1_LANECTRL0, val16);
4390+
4391+ bnx2x_cl45_read(bp, phy, MDIO_WC_DEVAD,
4392+ MDIO_WC_REG_XGXSBLK1_LANECTRL1, &val16);
4393+ val16 &= ~(0x0303 << (lane << 1));
4394+ val16 |= (0x0101 << (lane << 1));
4395+ if (phy->flags & FLAGS_WC_DUAL_MODE) {
4396+ val16 &= ~(0x0c0c << (lane << 1));
4397+ val16 |= (0x0404 << (lane << 1));
4398+ }
4399+
4400+ bnx2x_cl45_write(bp, phy, MDIO_WC_DEVAD,
4401+ MDIO_WC_REG_XGXSBLK1_LANECTRL1, val16);
4402+ /* Restore AER */
4403+ bnx2x_set_aer_mmd(params, phy);
4404+
43434405 }
43444406
43454407 static void bnx2x_set_warpcore_loopback(struct bnx2x_phy *phy,
@@ -6296,15 +6358,7 @@ static int bnx2x_update_link_down(struct link_params *params, · 1950 unmodified lines
62966358 vars->mac_type = MAC_TYPE_NONE;
62976359
62986360 /* Update shared memory */
6299− vars->link_status &= ~(LINK_STATUS_SPEED_AND_DUPLEX_MASK |
6300− LINK_STATUS_LINK_UP |
6301− LINK_STATUS_PHYSICAL_LINK_FLAG |
6302− LINK_STATUS_AUTO_NEGOTIATE_COMPLETE |
6303− LINK_STATUS_RX_FLOW_CONTROL_FLAG_MASK |
6304− LINK_STATUS_TX_FLOW_CONTROL_FLAG_MASK |
6305− LINK_STATUS_PARALLEL_DETECTION_FLAG_MASK |
6306− LINK_STATUS_LINK_PARTNER_SYMMETRIC_PAUSE |
6307− LINK_STATUS_LINK_PARTNER_ASYMMETRIC_PAUSE);
6361+ vars->link_status &= ~LINK_UPDATE_MASK;
63086362 vars->line_speed = 0;
63096363 bnx2x_update_mng(params, vars->link_status);
63106364
@@ -6452,6 +6506,7 @@ int bnx2x_link_update(struct link_params *params, struct link_vars *vars) · 141 unmodified lines
64526506 u16 ext_phy_line_speed = 0, prev_line_speed = vars->line_speed;
64536507 u8 active_external_phy = INT_PHY;
64546508 vars->phy_flags &= ~PHY_HALF_OPEN_CONN_FLAG;
6509+ vars->link_status &= ~LINK_UPDATE_MASK;
64556510 for (phy_index = INT_PHY; phy_index < params->num_phys;
64566511 phy_index++) {
64576512 phy_vars[phy_index].flow_ctrl = 0;
@@ -7579,7 +7634,7 @@ static void bnx2x_warpcore_power_module(struct link_params *params, · 1121 unmodified lines
75797634 static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy,
75807635 struct link_params *params,
75817636 u16 addr, u8 byte_cnt,
7582− u8 *o_buf)
7637+ u8 *o_buf, u8 is_init)
75837638 {
75847639 int rc = 0;
75857640 u8 i, j = 0, cnt = 0;
@@ -7596,10 +7651,10 @@ static int bnx2x_warpcore_read_sfp_module_eeprom(struct bnx2x_phy *phy, · 10 unmodified lines
75967651 /* 4 byte aligned address */
75977652 addr32 = addr & (~0x3);
75987653 do {
7599− if (cnt == I2C_WA_PWR_ITER) {
7654+ if ((!is_init) && (cnt == I2C_WA_PWR_ITER)) {
76007655 bnx2x_warpcore_power_module(params, phy, 0);
76017656 /* Note that 100us are not enough here */
7602− usleep_range(1000,1000);
7657+ usleep_range(1000, 2000);
76037658 bnx2x_warpcore_power_module(params, phy, 1);
76047659 }
76057660 rc = bnx2x_bsc_read(params, phy, 0xa0, addr32, 0, byte_cnt,
@@ -7719,7 +7774,7 @@ int bnx2x_read_sfp_module_eeprom(struct bnx2x_phy *phy, · 113 unmodified lines
77197774 break;
77207775 case PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT:
77217776 rc = bnx2x_warpcore_read_sfp_module_eeprom(phy, params, addr,
7722− byte_cnt, o_buf);
7777+ byte_cnt, o_buf, 0);
77237778 break;
77247779 }
77257780 return rc;
@@ -7923,6 +7978,7 @@ static int bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy, · 197 unmodified lines
79237978
79247979 {
79257980 u8 val;
7981+ int rc;
79267982 struct bnx2x *bp = params->bp;
79277983 u16 timeout;
79287984 /* Initialization time after hot-plug may take up to 300ms for
@@ -7930,8 +7986,14 @@ static int bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy, · 1 unmodified line
79307986 */
79317987
79327988 for (timeout = 0; timeout < 60; timeout++) {
7933− if (bnx2x_read_sfp_module_eeprom(phy, params, 1, 1, &val)
7934− == 0) {
7989+ if (phy->type == PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT)
7990+ rc = bnx2x_warpcore_read_sfp_module_eeprom(phy,
7991+ params, 1,
7992+ 1, &val, 1);
7993+ else
7994+ rc = bnx2x_read_sfp_module_eeprom(phy, params, 1, 1,
7995+ &val);
7996+ if (rc == 0) {
79357997 DP(NETIF_MSG_LINK,
79367998 "SFP+ module initialization took %d ms\n",
79377999 timeout * 5);
@@ -7939,7 +8001,8 @@ static int bnx2x_wait_for_sfp_module_initialized(struct bnx2x_phy *phy, · 1 unmodified line
79398001 }
79408002 usleep_range(5000, 10000);
79418003 }
7942− return -EINVAL;
8004+ rc = bnx2x_read_sfp_module_eeprom(phy, params, 1, 1, &val);
8005+ return rc;
79438006 }
79448007
79458008 static void bnx2x_8727_power_module(struct bnx2x *bp,
@@ -9878,7 +9941,7 @@ static int bnx2x_848x3_config_init(struct bnx2x_phy *phy, · 1932 unmodified lines
98789941 else
98799942 rc = bnx2x_8483x_disable_eee(phy, params, vars);
98809943 if (rc) {
9881− DP(NETIF_MSG_LINK, "Failed to set EEE advertisment\n");
9944+ DP(NETIF_MSG_LINK, "Failed to set EEE advertisement\n");
98829945 return rc;
98839946 }
98849947 } else {
@@ -10993,7 +11056,7 @@ static struct bnx2x_phy phy_xgxs = { · 1108 unmodified lines
1099311056 .format_fw_ver = (format_fw_ver_t)NULL,
1099411057 .hw_reset = (hw_reset_t)NULL,
1099511058 .set_link_led = (set_link_led_t)NULL,
10996− .phy_specific_func = (phy_specific_func_t)NULL
11059+ .phy_specific_func = (phy_specific_func_t)bnx2x_xgxs_specific_func
1099711060 };
1099811061 static struct bnx2x_phy phy_warpcore = {
1099911062 .type = PORT_HW_CFG_XGXS_EXT_PHY_TYPE_DIRECT,
@@ -11465,6 +11528,11 @@ static int bnx2x_populate_int_phy(struct bnx2x *bp, u32 shmem_base, u8 port, · 465 unmodified lines
1146511528 phy->media_type = ETH_PHY_BASE_T;
1146611529 break;
1146711530 case PORT_HW_CFG_NET_SERDES_IF_XFI:
11531+ phy->supported &= (SUPPORTED_1000baseT_Full |
11532+ SUPPORTED_10000baseT_Full |
11533+ SUPPORTED_FIBRE |
11534+ SUPPORTED_Pause |
11535+ SUPPORTED_Asym_Pause);
1146811536 phy->media_type = ETH_PHY_XFP_FIBER;
1146911537 break;
1147011538 case PORT_HW_CFG_NET_SERDES_IF_SFI:
@@ -12919,7 +12987,7 @@ static u8 bnx2x_analyze_link_error(struct link_params *params, · 1448 unmodified lines
1291912987 DP(NETIF_MSG_LINK, "Analyze TX Fault\n");
1292012988 break;
1292112989 default:
12922− DP(NETIF_MSG_LINK, "Analyze UNKOWN\n");
12990+ DP(NETIF_MSG_LINK, "Analyze UNKNOWN\n");
1292312991 }
1292412992 DP(NETIF_MSG_LINK, "Link changed:[%x %x]->%x\n", vars->link_up,
1292512993 old_status, status);
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c+11−2
@@ -6794,8 +6794,9 @@ static int bnx2x_init_hw_port(struct bnx2x *bp) · 6793 unmodified lines
67946794
67956795 bnx2x_init_block(bp, BLOCK_DORQ, init_phase);
67966796
6797+ bnx2x_init_block(bp, BLOCK_BRB1, init_phase);
6798+
67976799 if (CHIP_IS_E1(bp) || CHIP_IS_E1H(bp)) {
6798− bnx2x_init_block(bp, BLOCK_BRB1, init_phase);
67996800
68006801 if (IS_MF(bp))
68016802 low = ((bp->flags & ONE_PORT_FLAG) ? 160 : 246);
@@ -11902,7 +11903,15 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev, · 5100 unmodified lines
1190211903 /* disable FCOE L2 queue for E1x */
1190311904 if (CHIP_IS_E1x(bp))
1190411905 bp->flags |= NO_FCOE_FLAG;
11905−
11906+ /* disable FCOE for 57840 device, until FW supports it */
11907+ switch (ent->driver_data) {
11908+ case BCM57840_O:
11909+ case BCM57840_4_10:
11910+ case BCM57840_2_20:
11911+ case BCM57840_MFO:
11912+ case BCM57840_MF:
11913+ bp->flags |= NO_FCOE_FLAG;
11914+ }
1190611915 #endif
1190711916
1190811917
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c+0−10
@@ -3415,16 +3415,6 @@ static int adap_init0_config(struct adapter *adapter, int reset) · 3414 unmodified lines
34153415 "mismatch: [fini] csum=%#x, computed csum=%#x\n",
34163416 finicsum, cfcsum);
34173417
3418− /*
3419− * If we're a pure NIC driver then disable all offloading facilities.
3420− * This will allow the firmware to optimize aspects of the hardware
3421− * configuration which will result in improved performance.
3422− */
3423− caps_cmd.ofldcaps = 0;
3424− caps_cmd.iscsicaps = 0;
3425− caps_cmd.rdmacaps = 0;
3426− caps_cmd.fcoecaps = 0;
3427−
34283418 /*
34293419 * And now tell the firmware to use the configuration we just loaded.
34303420 */
drivers/net/ethernet/chelsio/cxgb4/t4_hw.c+5−1
@@ -2519,6 +2519,7 @@ int t4_fw_bye(struct adapter *adap, unsigned int mbox) · 2518 unmodified lines
25192519 {
25202520 struct fw_bye_cmd c;
25212521
2522+ memset(&c, 0, sizeof(c));
25222523 INIT_CMD(c, BYE, WRITE);
25232524 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL);
25242525 }
@@ -2535,6 +2536,7 @@ int t4_early_init(struct adapter *adap, unsigned int mbox) · 10 unmodified lines
25352536 {
25362537 struct fw_initialize_cmd c;
25372538
2539+ memset(&c, 0, sizeof(c));
25382540 INIT_CMD(c, INITIALIZE, WRITE);
25392541 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL);
25402542 }
@@ -2551,6 +2553,7 @@ int t4_fw_reset(struct adapter *adap, unsigned int mbox, int reset) · 10 unmodified lines
25512553 {
25522554 struct fw_reset_cmd c;
25532555
2556+ memset(&c, 0, sizeof(c));
25542557 INIT_CMD(c, RESET, WRITE);
25552558 c.val = htonl(reset);
25562559 return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL);
@@ -2828,7 +2831,7 @@ int t4_fixup_host_params(struct adapter *adap, unsigned int page_size, · 271 unmodified lines
28282831 HOSTPAGESIZEPF7(sge_hps));
28292832
28302833 t4_set_reg_field(adap, SGE_CONTROL,
2831− INGPADBOUNDARY(INGPADBOUNDARY_MASK) |
2834+ INGPADBOUNDARY_MASK |
28322835 EGRSTATUSPAGESIZE_MASK,
28332836 INGPADBOUNDARY(fl_align_log - 5) |
28342837 EGRSTATUSPAGESIZE(stat_len != 64));
@@ -3278,6 +3281,7 @@ int t4_identify_port(struct adapter *adap, unsigned int mbox, unsigned int viid, · 443 unmodified lines
32783281 {
32793282 struct fw_vi_enable_cmd c;
32803283
3284+ memset(&c, 0, sizeof(c));
32813285 c.op_to_viid = htonl(FW_CMD_OP(FW_VI_ENABLE_CMD) | FW_CMD_REQUEST |
32823286 FW_CMD_EXEC | FW_VI_ENABLE_CMD_VIID(viid));
32833287 c.ien_to_len16 = htonl(FW_VI_ENABLE_CMD_LED | FW_LEN16(c));
drivers/net/ethernet/freescale/gianfar.c+4−1
@@ -1353,8 +1353,11 @@ static int gfar_restore(struct device *dev) · 1352 unmodified lines
13531353 struct gfar_private *priv = dev_get_drvdata(dev);
13541354 struct net_device *ndev = priv->ndev;
13551355
1356− if (!netif_running(ndev))
1356+ if (!netif_running(ndev)) {
1357+ netif_device_attach(ndev);
1358+
13571359 return 0;
1360+ }
13581361
13591362 gfar_init_bds(ndev);
13601363 init_registers(ndev);
drivers/net/ethernet/intel/ixgbe/ixgbe_ethtool.c+3−0
@@ -2673,6 +2673,9 @@ static int ixgbe_get_ts_info(struct net_device *dev, · 2672 unmodified lines
26732673 case ixgbe_mac_X540:
26742674 case ixgbe_mac_82599EB:
26752675 info->so_timestamping =
2676+ SOF_TIMESTAMPING_TX_SOFTWARE |
2677+ SOF_TIMESTAMPING_RX_SOFTWARE |
2678+ SOF_TIMESTAMPING_SOFTWARE |
26762679 SOF_TIMESTAMPING_TX_HARDWARE |
26772680 SOF_TIMESTAMPING_RX_HARDWARE |
26782681 SOF_TIMESTAMPING_RAW_HARDWARE;
drivers/net/ethernet/jme.c+4−4
@@ -1948,10 +1948,10 @@ jme_close(struct net_device *netdev) · 1947 unmodified lines
19481948
19491949 JME_NAPI_DISABLE(jme);
19501950
1951− tasklet_disable(&jme->linkch_task);
1952− tasklet_disable(&jme->txclean_task);
1953− tasklet_disable(&jme->rxclean_task);
1954− tasklet_disable(&jme->rxempty_task);
1951+ tasklet_kill(&jme->linkch_task);
1952+ tasklet_kill(&jme->txclean_task);
1953+ tasklet_kill(&jme->rxclean_task);
1954+ tasklet_kill(&jme->rxempty_task);
19551955
19561956 jme_disable_rx_engine(jme);
19571957 jme_disable_tx_engine(jme);
drivers/net/ethernet/marvell/skge.c+1−1
@@ -4026,7 +4026,7 @@ static void __devexit skge_remove(struct pci_dev *pdev) · 4025 unmodified lines
40264026 dev0 = hw->dev[0];
40274027 unregister_netdev(dev0);
40284028
4029− tasklet_disable(&hw->phy_task);
4029+ tasklet_kill(&hw->phy_task);
40304030
40314031 spin_lock_irq(&hw->hw_lock);
40324032 hw->intr_mask = 0;
drivers/net/ethernet/micrel/ksz884x.c+2−2
@@ -5407,8 +5407,8 @@ static int netdev_close(struct net_device *dev) · 5406 unmodified lines
54075407 /* Delay for receive task to stop scheduling itself. */
54085408 msleep(2000 / HZ);
54095409
5410− tasklet_disable(&hw_priv->rx_tasklet);
5411− tasklet_disable(&hw_priv->tx_tasklet);
5410+ tasklet_kill(&hw_priv->rx_tasklet);
5411+ tasklet_kill(&hw_priv->tx_tasklet);
54125412 free_irq(dev->irq, hw_priv->dev);
54135413
54145414 transmit_cleanup(hw_priv, 0);
drivers/net/ethernet/nxp/lpc_eth.c+1−0
@@ -1524,6 +1524,7 @@ static int lpc_eth_drv_remove(struct platform_device *pdev) · 1523 unmodified lines
15241524 pldat->dma_buff_base_p);
15251525 free_irq(ndev->irq, ndev);
15261526 iounmap(pldat->net_base);
1527+ mdiobus_unregister(pldat->mii_bus);
15271528 mdiobus_free(pldat->mii_bus);
15281529 clk_disable(pldat->clk);
15291530 clk_put(pldat->clk);
drivers/net/ethernet/realtek/r8169.c+5−0
@@ -3827,6 +3827,8 @@ static void rtl_wol_suspend_quirk(struct rtl8169_private *tp) · 3826 unmodified lines
38273827 void __iomem *ioaddr = tp->mmio_addr;
38283828
38293829 switch (tp->mac_version) {
3830+ case RTL_GIGA_MAC_VER_25:
3831+ case RTL_GIGA_MAC_VER_26:
38303832 case RTL_GIGA_MAC_VER_29:
38313833 case RTL_GIGA_MAC_VER_30:
38323834 case RTL_GIGA_MAC_VER_32:
@@ -4519,6 +4521,9 @@ static void rtl_set_rx_mode(struct net_device *dev) · 686 unmodified lines
45194521 mc_filter[1] = swab32(data);
45204522 }
45214523
4524+ if (tp->mac_version == RTL_GIGA_MAC_VER_35)
4525+ mc_filter[1] = mc_filter[0] = 0xffffffff;
4526+
45224527 RTL_W32(MAR0 + 4, mc_filter[1]);
45234528 RTL_W32(MAR0 + 0, mc_filter[0]);
45244529
drivers/net/ethernet/xilinx/xilinx_axienet_main.c+1−1
@@ -990,7 +990,7 @@ static int axienet_stop(struct net_device *ndev) · 989 unmodified lines
990990 axienet_setoptions(ndev, lp->options &
991991 ~(XAE_OPTION_TXEN | XAE_OPTION_RXEN));
992992
993− tasklet_disable(&lp->dma_err_tasklet);
993+ tasklet_kill(&lp->dma_err_tasklet);
994994
995995 free_irq(lp->tx_irq, ndev);
996996 free_irq(lp->rx_irq, ndev);
drivers/net/phy/mdio-bitbang.c+1−0
@@ -234,6 +234,7 @@ void free_mdio_bitbang(struct mii_bus *bus) · 233 unmodified lines
234234 struct mdiobb_ctrl *ctrl = bus->priv;
235235
236236 module_put(ctrl->ops->owner);
237+ mdiobus_unregister(bus);
237238 mdiobus_free(bus);
238239 }
239240 EXPORT_SYMBOL(free_mdio_bitbang);
drivers/net/usb/cdc_eem.c+2−1
@@ -31,6 +31,7 @@ · 30 unmodified lines
3131 #include <linux/usb/cdc.h>
3232 #include <linux/usb/usbnet.h>
3333 #include <linux/gfp.h>
34+#include <linux/if_vlan.h>
3435
3536
3637 /*
@@ -92,7 +93,7 @@ static int eem_bind(struct usbnet *dev, struct usb_interface *intf) · 55 unmodified lines
9293
9394 /* no jumbogram (16K) support for now */
9495
95− dev->net->hard_header_len += EEM_HEAD + ETH_FCS_LEN;
96+ dev->net->hard_header_len += EEM_HEAD + ETH_FCS_LEN + VLAN_HLEN;
9697 dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
9798
9899 return 0;
drivers/net/usb/smsc95xx.c+1−0
@@ -1344,6 +1344,7 @@ static struct sk_buff *smsc95xx_tx_fixup(struct usbnet *dev, · 1343 unmodified lines
13441344 } else {
13451345 u32 csum_preamble = smsc95xx_calc_csum_preamble(skb);
13461346 skb_push(skb, 4);
1347+ cpu_to_le32s(&csum_preamble);
13471348 memcpy(skb->data, &csum_preamble, 4);
13481349 }
13491350 }
drivers/net/usb/usbnet.c+5−3
@@ -359,10 +359,12 @@ static enum skb_state defer_bh(struct usbnet *dev, struct sk_buff *skb, · 358 unmodified lines
359359 void usbnet_defer_kevent (struct usbnet *dev, int work)
360360 {
361361 set_bit (work, &dev->flags);
362− if (!schedule_work (&dev->kevent))
363− netdev_err(dev->net, "kevent %d may have been dropped\n", work);
364− else
362+ if (!schedule_work (&dev->kevent)) {
363+ if (net_ratelimit())
364+ netdev_err(dev->net, "kevent %d may have been dropped\n", work);
365+ } else {
365366 netdev_dbg(dev->net, "kevent %d scheduled\n", work);
367+ }
366368 }
367369 EXPORT_SYMBOL_GPL(usbnet_defer_kevent);
368370
drivers/net/vmxnet3/vmxnet3_drv.c+45−20
@@ -744,28 +744,43 @@ vmxnet3_map_pkt(struct sk_buff *skb, struct vmxnet3_tx_ctx *ctx, · 743 unmodified lines
744744
745745 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
746746 const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
747+ u32 buf_size;
747748
748− tbi = tq->buf_info + tq->tx_ring.next2fill;
749− tbi->map_type = VMXNET3_MAP_PAGE;
750− tbi->dma_addr = skb_frag_dma_map(&adapter->pdev->dev, frag,
751− 0, skb_frag_size(frag),
752− DMA_TO_DEVICE);
749+ buf_offset = 0;
750+ len = skb_frag_size(frag);
751+ while (len) {
752+ tbi = tq->buf_info + tq->tx_ring.next2fill;
753+ if (len < VMXNET3_MAX_TX_BUF_SIZE) {
754+ buf_size = len;
755+ dw2 |= len;
756+ } else {
757+ buf_size = VMXNET3_MAX_TX_BUF_SIZE;
758+ /* spec says that for TxDesc.len, 0 == 2^14 */
759+ }
760+ tbi->map_type = VMXNET3_MAP_PAGE;
761+ tbi->dma_addr = skb_frag_dma_map(&adapter->pdev->dev, frag,
762+ buf_offset, buf_size,
763+ DMA_TO_DEVICE);
753764
754− tbi->len = skb_frag_size(frag);
765+ tbi->len = buf_size;
755766
756− gdesc = tq->tx_ring.base + tq->tx_ring.next2fill;
757− BUG_ON(gdesc->txd.gen == tq->tx_ring.gen);
767+ gdesc = tq->tx_ring.base + tq->tx_ring.next2fill;
768+ BUG_ON(gdesc->txd.gen == tq->tx_ring.gen);
758769
759− gdesc->txd.addr = cpu_to_le64(tbi->dma_addr);
760− gdesc->dword[2] = cpu_to_le32(dw2 | skb_frag_size(frag));
761− gdesc->dword[3] = 0;
770+ gdesc->txd.addr = cpu_to_le64(tbi->dma_addr);
771+ gdesc->dword[2] = cpu_to_le32(dw2);
772+ gdesc->dword[3] = 0;
762773
763− dev_dbg(&adapter->netdev->dev,
764− "txd[%u]: 0x%llu %u %u\n",
765− tq->tx_ring.next2fill, le64_to_cpu(gdesc->txd.addr),
766− le32_to_cpu(gdesc->dword[2]), gdesc->dword[3]);
767− vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring);
768− dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT;
774+ dev_dbg(&adapter->netdev->dev,
775+ "txd[%u]: 0x%llu %u %u\n",
776+ tq->tx_ring.next2fill, le64_to_cpu(gdesc->txd.addr),
777+ le32_to_cpu(gdesc->dword[2]), gdesc->dword[3]);
778+ vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring);
779+ dw2 = tq->tx_ring.gen << VMXNET3_TXD_GEN_SHIFT;
780+
781+ len -= buf_size;
782+ buf_offset += buf_size;
783+ }
769784 }
770785
771786 ctx->eop_txd = gdesc;
@@ -886,6 +901,18 @@ vmxnet3_prepare_tso(struct sk_buff *skb, · 114 unmodified lines
886901 }
887902 }
888903
904+static int txd_estimate(const struct sk_buff *skb)
905+{
906+ int count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) + 1;
907+ int i;
908+
909+ for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
910+ const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
911+
912+ count += VMXNET3_TXD_NEEDED(skb_frag_size(frag));
913+ }
914+ return count;
915+}
889916
890917 /*
891918 * Transmits a pkt thru a given tq
@@ -914,9 +941,7 @@ vmxnet3_tq_xmit(struct sk_buff *skb, struct vmxnet3_tx_queue *tq, · 22 unmodified lines
914941 union Vmxnet3_GenericDesc tempTxDesc;
915942 #endif
916943
917− /* conservatively estimate # of descriptors to use */
918− count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) +
919− skb_shinfo(skb)->nr_frags + 1;
944+ count = txd_estimate(skb);
920945
921946 ctx.ipv4 = (vlan_get_protocol(skb) == cpu_to_be16(ETH_P_IP));
922947
drivers/net/vxlan.c+1−1
@@ -816,7 +816,7 @@ static void vxlan_cleanup(unsigned long arg) · 815 unmodified lines
816816 = container_of(p, struct vxlan_fdb, hlist);
817817 unsigned long timeout;
818818
819− if (f->state == NUD_PERMANENT)
819+ if (f->state & NUD_PERMANENT)
820820 continue;
821821
822822 timeout = f->used + vxlan->age_interval * HZ;
drivers/net/wireless/ath/ath9k/xmit.c+8−2
@@ -312,6 +312,7 @@ static struct ath_buf *ath_tx_get_buffer(struct ath_softc *sc) · 311 unmodified lines
312312 }
313313
314314 bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list);
315+ bf->bf_next = NULL;
315316 list_del(&bf->list);
316317
317318 spin_unlock_bh(&sc->tx.txbuflock);
@@ -393,7 +394,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, · 75 unmodified lines
393394 u16 seq_st = 0, acked_cnt = 0, txfail_cnt = 0, seq_first;
394395 u32 ba[WME_BA_BMP_SIZE >> 5];
395396 int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0;
396− bool rc_update = true;
397+ bool rc_update = true, isba;
397398 struct ieee80211_tx_rate rates[4];
398399 struct ath_frame_info *fi;
399400 int nframes;
@@ -437,13 +438,17 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq, · 37 unmodified lines
437438 tidno = ieee80211_get_qos_ctl(hdr)[0] & IEEE80211_QOS_CTL_TID_MASK;
438439 tid = ATH_AN_2_TID(an, tidno);
439440 seq_first = tid->seq_start;
441+ isba = ts->ts_flags & ATH9K_TX_BA;
440442
441443 /*
442444 * The hardware occasionally sends a tx status for the wrong TID.
443445 * In this case, the BA status cannot be considered valid and all
444446 * subframes need to be retransmitted
447+ *
448+ * Only BlockAcks have a TID and therefore normal Acks cannot be
449+ * checked
445450 */
446− if (tidno != ts->tid)
451+ if (isba && tidno != ts->tid)
447452 txok = false;
448453
449454 isaggr = bf_isaggr(bf);
@@ -1774,6 +1779,7 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq, · 1324 unmodified lines
17741779 list_add_tail(&bf->list, &bf_head);
17751780 bf->bf_state.bf_type = 0;
17761781
1782+ bf->bf_next = NULL;
17771783 bf->bf_lastbf = bf;
17781784 ath_tx_fill_desc(sc, bf, txq, fi->framelen);
17791785 ath_tx_txqaddbuf(sc, txq, &bf_head, false);
drivers/net/wireless/b43legacy/pio.c+1−1
@@ -382,7 +382,7 @@ static void cancel_transfers(struct b43legacy_pioqueue *queue) · 381 unmodified lines
382382 {
383383 struct b43legacy_pio_txpacket *packet, *tmp_packet;
384384
385− tasklet_disable(&queue->txtask);
385+ tasklet_kill(&queue->txtask);
386386
387387 list_for_each_entry_safe(packet, tmp_packet, &queue->txrunning, list)
388388 free_txpacket(packet, 0);
drivers/net/wireless/rt2x00/rt2800lib.c+1−1
@@ -2449,7 +2449,7 @@ static int rt2800_get_gain_calibration_delta(struct rt2x00_dev *rt2x00dev) · 2448 unmodified lines
24492449 /*
24502450 * Check if temperature compensation is supported.
24512451 */
2452− if (tssi_bounds[4] == 0xff)
2452+ if (tssi_bounds[4] == 0xff || step == 0xff)
24532453 return 0;
24542454
24552455 /*
drivers/pci/bus.c+0−3
@@ -320,10 +320,7 @@ void pci_walk_bus(struct pci_bus *top, int (*cb)(struct pci_dev *, void *), · 319 unmodified lines
320320 } else
321321 next = dev->bus_list.next;
322322
323− /* Run device routines with the device locked */
324− device_lock(&dev->dev);
325323 retval = cb(dev, userdata);
326− device_unlock(&dev->dev);
327324 if (retval)
328325 break;
329326 }
drivers/pci/pci-driver.c+2−10
@@ -398,6 +398,8 @@ static void pci_device_shutdown(struct device *dev) · 397 unmodified lines
398398 struct pci_dev *pci_dev = to_pci_dev(dev);
399399 struct pci_driver *drv = pci_dev->driver;
400400
401+ pm_runtime_resume(dev);
402+
401403 if (drv && drv->shutdown)
402404 drv->shutdown(pci_dev);
403405 pci_msi_shutdown(pci_dev);
@@ -408,16 +410,6 @@ static void pci_device_shutdown(struct device *dev) · 4 unmodified lines
408410 * continue to do DMA
409411 */
410412 pci_disable_device(pci_dev);
411−
412− /*
413− * Devices may be enabled to wake up by runtime PM, but they need not
414− * be supposed to wake up the system from its "power off" state (e.g.
415− * ACPI S5). Therefore disable wakeup for all devices that aren't
416− * supposed to wake up the system at this point. The state argument
417− * will be ignored by pci_enable_wake().
418− */
419− if (!device_may_wakeup(dev))
420− pci_enable_wake(pci_dev, PCI_UNKNOWN, false);
421413 }
422414
423415 #ifdef CONFIG_PM
drivers/pci/pci-sysfs.c+0−34
@@ -458,40 +458,6 @@ boot_vga_show(struct device *dev, struct device_attribute *attr, char *buf) · 457 unmodified lines
458458 }
459459 struct device_attribute vga_attr = __ATTR_RO(boot_vga);
460460
461−static void
462−pci_config_pm_runtime_get(struct pci_dev *pdev)
463−{
464− struct device *dev = &pdev->dev;
465− struct device *parent = dev->parent;
466−
467− if (parent)
468− pm_runtime_get_sync(parent);
469− pm_runtime_get_noresume(dev);
470− /*
471− * pdev->current_state is set to PCI_D3cold during suspending,
472− * so wait until suspending completes
473− */
474− pm_runtime_barrier(dev);
475− /*
476− * Only need to resume devices in D3cold, because config
477− * registers are still accessible for devices suspended but
478− * not in D3cold.
479− */
480− if (pdev->current_state == PCI_D3cold)
481− pm_runtime_resume(dev);
482−}
483−
484−static void
485−pci_config_pm_runtime_put(struct pci_dev *pdev)
486−{
487− struct device *dev = &pdev->dev;
488− struct device *parent = dev->parent;
489−
490− pm_runtime_put(dev);
491− if (parent)
492− pm_runtime_put_sync(parent);
493−}
494−
495461 static ssize_t
496462 pci_read_config(struct file *filp, struct kobject *kobj,
497463 struct bin_attribute *bin_attr,
drivers/pci/pci.c+32−0
@@ -1858,6 +1858,38 @@ bool pci_dev_run_wake(struct pci_dev *dev) · 1857 unmodified lines
18581858 }
18591859 EXPORT_SYMBOL_GPL(pci_dev_run_wake);
18601860
1861+void pci_config_pm_runtime_get(struct pci_dev *pdev)
1862+{
1863+ struct device *dev = &pdev->dev;
1864+ struct device *parent = dev->parent;
1865+
1866+ if (parent)
1867+ pm_runtime_get_sync(parent);
1868+ pm_runtime_get_noresume(dev);
1869+ /*
1870+ * pdev->current_state is set to PCI_D3cold during suspending,
1871+ * so wait until suspending completes
1872+ */
1873+ pm_runtime_barrier(dev);
1874+ /*
1875+ * Only need to resume devices in D3cold, because config
1876+ * registers are still accessible for devices suspended but
1877+ * not in D3cold.
1878+ */
1879+ if (pdev->current_state == PCI_D3cold)
1880+ pm_runtime_resume(dev);
1881+}
1882+
1883+void pci_config_pm_runtime_put(struct pci_dev *pdev)
1884+{
1885+ struct device *dev = &pdev->dev;
1886+ struct device *parent = dev->parent;
1887+
1888+ pm_runtime_put(dev);
1889+ if (parent)
1890+ pm_runtime_put_sync(parent);
1891+}
1892+
18611893 /**
18621894 * pci_pm_init - Initialize PM functions of given PCI device
18631895 * @dev: PCI device to handle.
drivers/pci/pci.h+2−0
@@ -72,6 +72,8 @@ extern void pci_disable_enabled_device(struct pci_dev *dev); · 71 unmodified lines
7272 extern int pci_finish_runtime_suspend(struct pci_dev *dev);
7373 extern int __pci_pme_wakeup(struct pci_dev *dev, void *ign);
7474 extern void pci_wakeup_bus(struct pci_bus *bus);
75+extern void pci_config_pm_runtime_get(struct pci_dev *dev);
76+extern void pci_config_pm_runtime_put(struct pci_dev *dev);
7577 extern void pci_pm_init(struct pci_dev *dev);
7678 extern void platform_pci_wakeup_init(struct pci_dev *dev);
7779 extern void pci_allocate_cap_save_buffers(struct pci_dev *dev);
drivers/pci/pcie/aer/aerdrv_core.c+16−4
@@ -213,6 +213,7 @@ static int report_error_detected(struct pci_dev *dev, void *data) · 212 unmodified lines
213213 struct aer_broadcast_data *result_data;
214214 result_data = (struct aer_broadcast_data *) data;
215215
216+ device_lock(&dev->dev);
216217 dev->error_state = result_data->state;
217218
218219 if (!dev->driver ||
@@ -231,12 +232,14 @@ static int report_error_detected(struct pci_dev *dev, void *data) · 12 unmodified lines
231232 dev->driver ?
232233 "no AER-aware driver" : "no driver");
233234 }
234− return 0;
235+ goto out;
235236 }
236237
237238 err_handler = dev->driver->err_handler;
238239 vote = err_handler->error_detected(dev, result_data->state);
239240 result_data->result = merge_result(result_data->result, vote);
241+out:
242+ device_unlock(&dev->dev);
240243 return 0;
241244 }
242245
@@ -247,14 +250,17 @@ static int report_mmio_enabled(struct pci_dev *dev, void *data) · 4 unmodified lines
247250 struct aer_broadcast_data *result_data;
248251 result_data = (struct aer_broadcast_data *) data;
249252
253+ device_lock(&dev->dev);
250254 if (!dev->driver ||
251255 !dev->driver->err_handler ||
252256 !dev->driver->err_handler->mmio_enabled)
253− return 0;
257+ goto out;
254258
255259 err_handler = dev->driver->err_handler;
256260 vote = err_handler->mmio_enabled(dev);
257261 result_data->result = merge_result(result_data->result, vote);
262+out:
263+ device_unlock(&dev->dev);
258264 return 0;
259265 }
260266
@@ -265,14 +271,17 @@ static int report_slot_reset(struct pci_dev *dev, void *data) · 4 unmodified lines
265271 struct aer_broadcast_data *result_data;
266272 result_data = (struct aer_broadcast_data *) data;
267273
274+ device_lock(&dev->dev);
268275 if (!dev->driver ||
269276 !dev->driver->err_handler ||
270277 !dev->driver->err_handler->slot_reset)
271− return 0;
278+ goto out;
272279
273280 err_handler = dev->driver->err_handler;
274281 vote = err_handler->slot_reset(dev);
275282 result_data->result = merge_result(result_data->result, vote);
283+out:
284+ device_unlock(&dev->dev);
276285 return 0;
277286 }
278287
@@ -280,15 +289,18 @@ static int report_resume(struct pci_dev *dev, void *data) · 1 unmodified line
280289 {
281290 const struct pci_error_handlers *err_handler;
282291
292+ device_lock(&dev->dev);
283293 dev->error_state = pci_channel_io_normal;
284294
285295 if (!dev->driver ||
286296 !dev->driver->err_handler ||
287297 !dev->driver->err_handler->resume)
288− return 0;
298+ goto out;
289299
290300 err_handler = dev->driver->err_handler;
291301 err_handler->resume(dev);
302+out:
303+ device_unlock(&dev->dev);
292304 return 0;
293305 }
294306
drivers/pci/pcie/portdrv_core.c+2−1
@@ -272,7 +272,8 @@ static int get_port_device_capability(struct pci_dev *dev) · 271 unmodified lines
272272 }
273273
274274 /* Hot-Plug Capable */
275− if (cap_mask & PCIE_PORT_SERVICE_HP) {
275+ if ((cap_mask & PCIE_PORT_SERVICE_HP) &&
276+ dev->pcie_flags_reg & PCI_EXP_FLAGS_SLOT) {
276277 pcie_capability_read_dword(dev, PCI_EXP_SLTCAP, &reg32);
277278 if (reg32 & PCI_EXP_SLTCAP_HPC) {
278279 services |= PCIE_PORT_SERVICE_HP;
drivers/pci/proc.c+8−0
@@ -76,6 +76,8 @@ proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *pp · 75 unmodified lines
7676 if (!access_ok(VERIFY_WRITE, buf, cnt))
7777 return -EINVAL;
7878
79+ pci_config_pm_runtime_get(dev);
80+
7981 if ((pos & 1) && cnt) {
8082 unsigned char val;
8183 pci_user_read_config_byte(dev, pos, &val);
@@ -121,6 +123,8 @@ proc_bus_pci_read(struct file *file, char __user *buf, size_t nbytes, loff_t *pp · 39 unmodified lines
121123 cnt--;
122124 }
123125
126+ pci_config_pm_runtime_put(dev);
127+
124128 *ppos = pos;
125129 return nbytes;
126130 }
@@ -146,6 +150,8 @@ proc_bus_pci_write(struct file *file, const char __user *buf, size_t nbytes, lof · 19 unmodified lines
146150 if (!access_ok(VERIFY_READ, buf, cnt))
147151 return -EINVAL;
148152
153+ pci_config_pm_runtime_get(dev);
154+
149155 if ((pos & 1) && cnt) {
150156 unsigned char val;
151157 __get_user(val, buf);
@@ -191,6 +197,8 @@ proc_bus_pci_write(struct file *file, const char __user *buf, size_t nbytes, lof · 39 unmodified lines
191197 cnt--;
192198 }
193199
200+ pci_config_pm_runtime_put(dev);
201+
194202 *ppos = pos;
195203 i_size_write(ino, dp->size);
196204 return nbytes;
drivers/pinctrl/Kconfig+2−0
@@ -179,11 +179,13 @@ config PINCTRL_COH901 · 178 unmodified lines
179179
180180 config PINCTRL_SAMSUNG
181181 bool "Samsung pinctrl driver"
182+ depends on OF && GPIOLIB
182183 select PINMUX
183184 select PINCONF
184185
185186 config PINCTRL_EXYNOS4
186187 bool "Pinctrl driver data for Exynos4 SoC"
188+ depends on OF && GPIOLIB
187189 select PINCTRL_SAMSUNG
188190
189191 config PINCTRL_MVEBU
drivers/pinctrl/spear/pinctrl-spear.c+1−1
@@ -244,7 +244,7 @@ static int spear_pinctrl_endisable(struct pinctrl_dev *pctldev, · 243 unmodified lines
244244 else
245245 temp = ~muxreg->val;
246246
247− val |= temp;
247+ val |= muxreg->mask & temp;
248248 pmx_writel(pmx, val, muxreg->reg);
249249 }
250250 }
drivers/pinctrl/spear/pinctrl-spear1310.c+320−45
@@ -25,8 +25,8 @@ static const struct pinctrl_pin_desc spear1310_pins[] = { · 24 unmodified lines
2525 };
2626
2727 /* registers */
28−#define PERIP_CFG 0x32C
29− #define MCIF_SEL_SHIFT 3
28+#define PERIP_CFG 0x3B0
29+ #define MCIF_SEL_SHIFT 5
3030 #define MCIF_SEL_SD (0x1 << MCIF_SEL_SHIFT)
3131 #define MCIF_SEL_CF (0x2 << MCIF_SEL_SHIFT)
3232 #define MCIF_SEL_XD (0x3 << MCIF_SEL_SHIFT)
@@ -164,6 +164,10 @@ static const struct pinctrl_pin_desc spear1310_pins[] = { · 131 unmodified lines
164164 #define PMX_SSP0_CS0_MASK (1 << 29)
165165 #define PMX_SSP0_CS1_2_MASK (1 << 30)
166166
167+#define PAD_DIRECTION_SEL_0 0x65C
168+#define PAD_DIRECTION_SEL_1 0x660
169+#define PAD_DIRECTION_SEL_2 0x664
170+
167171 /* combined macros */
168172 #define PMX_GMII_MASK (PMX_GMIICLK_MASK | \
169173 PMX_GMIICOL_CRS_XFERER_MIITXCLK_MASK | \
@@ -237,6 +241,10 @@ static struct spear_muxreg i2c0_muxreg[] = { · 67 unmodified lines
237241 .reg = PAD_FUNCTION_EN_0,
238242 .mask = PMX_I2C0_MASK,
239243 .val = PMX_I2C0_MASK,
244+ }, {
245+ .reg = PAD_DIRECTION_SEL_0,
246+ .mask = PMX_I2C0_MASK,
247+ .val = PMX_I2C0_MASK,
240248 },
241249 };
242250
@@ -269,6 +277,10 @@ static struct spear_muxreg ssp0_muxreg[] = { · 26 unmodified lines
269277 .reg = PAD_FUNCTION_EN_0,
270278 .mask = PMX_SSP0_MASK,
271279 .val = PMX_SSP0_MASK,
280+ }, {
281+ .reg = PAD_DIRECTION_SEL_0,
282+ .mask = PMX_SSP0_MASK,
283+ .val = PMX_SSP0_MASK,
272284 },
273285 };
274286
@@ -294,6 +306,10 @@ static struct spear_muxreg ssp0_cs0_muxreg[] = { · 19 unmodified lines
294306 .reg = PAD_FUNCTION_EN_2,
295307 .mask = PMX_SSP0_CS0_MASK,
296308 .val = PMX_SSP0_CS0_MASK,
309+ }, {
310+ .reg = PAD_DIRECTION_SEL_2,
311+ .mask = PMX_SSP0_CS0_MASK,
312+ .val = PMX_SSP0_CS0_MASK,
297313 },
298314 };
299315
@@ -319,6 +335,10 @@ static struct spear_muxreg ssp0_cs1_2_muxreg[] = { · 19 unmodified lines
319335 .reg = PAD_FUNCTION_EN_2,
320336 .mask = PMX_SSP0_CS1_2_MASK,
321337 .val = PMX_SSP0_CS1_2_MASK,
338+ }, {
339+ .reg = PAD_DIRECTION_SEL_2,
340+ .mask = PMX_SSP0_CS1_2_MASK,
341+ .val = PMX_SSP0_CS1_2_MASK,
322342 },
323343 };
324344
@@ -352,6 +372,10 @@ static struct spear_muxreg i2s0_muxreg[] = { · 27 unmodified lines
352372 .reg = PAD_FUNCTION_EN_0,
353373 .mask = PMX_I2S0_MASK,
354374 .val = PMX_I2S0_MASK,
375+ }, {
376+ .reg = PAD_DIRECTION_SEL_0,
377+ .mask = PMX_I2S0_MASK,
378+ .val = PMX_I2S0_MASK,
355379 },
356380 };
357381
@@ -384,6 +408,10 @@ static struct spear_muxreg i2s1_muxreg[] = { · 26 unmodified lines
384408 .reg = PAD_FUNCTION_EN_1,
385409 .mask = PMX_I2S1_MASK,
386410 .val = PMX_I2S1_MASK,
411+ }, {
412+ .reg = PAD_DIRECTION_SEL_1,
413+ .mask = PMX_I2S1_MASK,
414+ .val = PMX_I2S1_MASK,
387415 },
388416 };
389417
@@ -418,6 +446,10 @@ static struct spear_muxreg clcd_muxreg[] = { · 28 unmodified lines
418446 .reg = PAD_FUNCTION_EN_0,
419447 .mask = PMX_CLCD1_MASK,
420448 .val = PMX_CLCD1_MASK,
449+ }, {
450+ .reg = PAD_DIRECTION_SEL_0,
451+ .mask = PMX_CLCD1_MASK,
452+ .val = PMX_CLCD1_MASK,
421453 },
422454 };
423455
@@ -443,6 +475,10 @@ static struct spear_muxreg clcd_high_res_muxreg[] = { · 19 unmodified lines
443475 .reg = PAD_FUNCTION_EN_1,
444476 .mask = PMX_CLCD2_MASK,
445477 .val = PMX_CLCD2_MASK,
478+ }, {
479+ .reg = PAD_DIRECTION_SEL_1,
480+ .mask = PMX_CLCD2_MASK,
481+ .val = PMX_CLCD2_MASK,
446482 },
447483 };
448484
@@ -461,7 +497,7 @@ static struct spear_pingroup clcd_high_res_pingroup = { · 12 unmodified lines
461497 .nmodemuxs = ARRAY_SIZE(clcd_high_res_modemux),
462498 };
463499
464−static const char *const clcd_grps[] = { "clcd_grp", "clcd_high_res" };
500+static const char *const clcd_grps[] = { "clcd_grp", "clcd_high_res_grp" };
465501 static struct spear_function clcd_function = {
466502 .name = "clcd",
467503 .groups = clcd_grps,
@@ -479,6 +515,14 @@ static struct spear_muxreg arm_gpio_muxreg[] = { · 11 unmodified lines
479515 .reg = PAD_FUNCTION_EN_1,
480516 .mask = PMX_EGPIO_1_GRP_MASK,
481517 .val = PMX_EGPIO_1_GRP_MASK,
518+ }, {
519+ .reg = PAD_DIRECTION_SEL_0,
520+ .mask = PMX_EGPIO_0_GRP_MASK,
521+ .val = PMX_EGPIO_0_GRP_MASK,
522+ }, {
523+ .reg = PAD_DIRECTION_SEL_1,
524+ .mask = PMX_EGPIO_1_GRP_MASK,
525+ .val = PMX_EGPIO_1_GRP_MASK,
482526 },
483527 };
484528
@@ -511,6 +555,10 @@ static struct spear_muxreg smi_2_chips_muxreg[] = { · 26 unmodified lines
511555 .reg = PAD_FUNCTION_EN_0,
512556 .mask = PMX_SMI_MASK,
513557 .val = PMX_SMI_MASK,
558+ }, {
559+ .reg = PAD_DIRECTION_SEL_0,
560+ .mask = PMX_SMI_MASK,
561+ .val = PMX_SMI_MASK,
514562 },
515563 };
516564
@@ -539,6 +587,14 @@ static struct spear_muxreg smi_4_chips_muxreg[] = { · 22 unmodified lines
539587 .reg = PAD_FUNCTION_EN_1,
540588 .mask = PMX_SMINCS2_MASK | PMX_SMINCS3_MASK,
541589 .val = PMX_SMINCS2_MASK | PMX_SMINCS3_MASK,
590+ }, {
591+ .reg = PAD_DIRECTION_SEL_0,
592+ .mask = PMX_SMI_MASK,
593+ .val = PMX_SMI_MASK,
594+ }, {
595+ .reg = PAD_DIRECTION_SEL_1,
596+ .mask = PMX_SMINCS2_MASK | PMX_SMINCS3_MASK,
597+ .val = PMX_SMINCS2_MASK | PMX_SMINCS3_MASK,
542598 },
543599 };
544600
@@ -573,6 +629,10 @@ static struct spear_muxreg gmii_muxreg[] = { · 28 unmodified lines
573629 .reg = PAD_FUNCTION_EN_0,
574630 .mask = PMX_GMII_MASK,
575631 .val = PMX_GMII_MASK,
632+ }, {
633+ .reg = PAD_DIRECTION_SEL_0,
634+ .mask = PMX_GMII_MASK,
635+ .val = PMX_GMII_MASK,
576636 },
577637 };
578638
@@ -615,6 +675,18 @@ static struct spear_muxreg rgmii_muxreg[] = { · 36 unmodified lines
615675 .reg = PAD_FUNCTION_EN_2,
616676 .mask = PMX_RGMII_REG2_MASK,
617677 .val = 0,
678+ }, {
679+ .reg = PAD_DIRECTION_SEL_0,
680+ .mask = PMX_RGMII_REG0_MASK,
681+ .val = PMX_RGMII_REG0_MASK,
682+ }, {
683+ .reg = PAD_DIRECTION_SEL_1,
684+ .mask = PMX_RGMII_REG1_MASK,
685+ .val = PMX_RGMII_REG1_MASK,
686+ }, {
687+ .reg = PAD_DIRECTION_SEL_2,
688+ .mask = PMX_RGMII_REG2_MASK,
689+ .val = PMX_RGMII_REG2_MASK,
618690 },
619691 };
620692
@@ -649,6 +721,10 @@ static struct spear_muxreg smii_0_1_2_muxreg[] = { · 28 unmodified lines
649721 .reg = PAD_FUNCTION_EN_1,
650722 .mask = PMX_SMII_0_1_2_MASK,
651723 .val = 0,
724+ }, {
725+ .reg = PAD_DIRECTION_SEL_1,
726+ .mask = PMX_SMII_0_1_2_MASK,
727+ .val = PMX_SMII_0_1_2_MASK,
652728 },
653729 };
654730
@@ -681,6 +757,10 @@ static struct spear_muxreg ras_mii_txclk_muxreg[] = { · 26 unmodified lines
681757 .reg = PAD_FUNCTION_EN_1,
682758 .mask = PMX_NFCE2_MASK,
683759 .val = 0,
760+ }, {
761+ .reg = PAD_DIRECTION_SEL_1,
762+ .mask = PMX_NFCE2_MASK,
763+ .val = PMX_NFCE2_MASK,
684764 },
685765 };
686766
@@ -721,6 +801,14 @@ static struct spear_muxreg nand_8bit_muxreg[] = { · 34 unmodified lines
721801 .reg = PAD_FUNCTION_EN_1,
722802 .mask = PMX_NAND8BIT_1_MASK,
723803 .val = PMX_NAND8BIT_1_MASK,
804+ }, {
805+ .reg = PAD_DIRECTION_SEL_0,
806+ .mask = PMX_NAND8BIT_0_MASK,
807+ .val = PMX_NAND8BIT_0_MASK,
808+ }, {
809+ .reg = PAD_DIRECTION_SEL_1,
810+ .mask = PMX_NAND8BIT_1_MASK,
811+ .val = PMX_NAND8BIT_1_MASK,
724812 },
725813 };
726814
@@ -747,6 +835,10 @@ static struct spear_muxreg nand_16bit_muxreg[] = { · 20 unmodified lines
747835 .reg = PAD_FUNCTION_EN_1,
748836 .mask = PMX_NAND16BIT_1_MASK,
749837 .val = PMX_NAND16BIT_1_MASK,
838+ }, {
839+ .reg = PAD_DIRECTION_SEL_1,
840+ .mask = PMX_NAND16BIT_1_MASK,
841+ .val = PMX_NAND16BIT_1_MASK,
750842 },
751843 };
752844
@@ -772,6 +864,10 @@ static struct spear_muxreg nand_4_chips_muxreg[] = { · 19 unmodified lines
772864 .reg = PAD_FUNCTION_EN_1,
773865 .mask = PMX_NAND_4CHIPS_MASK,
774866 .val = PMX_NAND_4CHIPS_MASK,
867+ }, {
868+ .reg = PAD_DIRECTION_SEL_1,
869+ .mask = PMX_NAND_4CHIPS_MASK,
870+ .val = PMX_NAND_4CHIPS_MASK,
775871 },
776872 };
777873
@@ -833,6 +929,10 @@ static struct spear_muxreg keyboard_rowcol6_8_muxreg[] = { · 55 unmodified lines
833929 .reg = PAD_FUNCTION_EN_1,
834930 .mask = PMX_KBD_ROWCOL68_MASK,
835931 .val = PMX_KBD_ROWCOL68_MASK,
932+ }, {
933+ .reg = PAD_DIRECTION_SEL_1,
934+ .mask = PMX_KBD_ROWCOL68_MASK,
935+ .val = PMX_KBD_ROWCOL68_MASK,
836936 },
837937 };
838938
@@ -866,6 +966,10 @@ static struct spear_muxreg uart0_muxreg[] = { · 27 unmodified lines
866966 .reg = PAD_FUNCTION_EN_0,
867967 .mask = PMX_UART0_MASK,
868968 .val = PMX_UART0_MASK,
969+ }, {
970+ .reg = PAD_DIRECTION_SEL_0,
971+ .mask = PMX_UART0_MASK,
972+ .val = PMX_UART0_MASK,
869973 },
870974 };
871975
@@ -891,6 +995,10 @@ static struct spear_muxreg uart0_modem_muxreg[] = { · 19 unmodified lines
891995 .reg = PAD_FUNCTION_EN_1,
892996 .mask = PMX_UART0_MODEM_MASK,
893997 .val = PMX_UART0_MODEM_MASK,
998+ }, {
999+ .reg = PAD_DIRECTION_SEL_1,
1000+ .mask = PMX_UART0_MODEM_MASK,
1001+ .val = PMX_UART0_MODEM_MASK,
8941002 },
8951003 };
8961004
@@ -923,6 +1031,10 @@ static struct spear_muxreg gpt0_tmr0_muxreg[] = { · 26 unmodified lines
9231031 .reg = PAD_FUNCTION_EN_1,
9241032 .mask = PMX_GPT0_TMR0_MASK,
9251033 .val = PMX_GPT0_TMR0_MASK,
1034+ }, {
1035+ .reg = PAD_DIRECTION_SEL_1,
1036+ .mask = PMX_GPT0_TMR0_MASK,
1037+ .val = PMX_GPT0_TMR0_MASK,
9261038 },
9271039 };
9281040
@@ -948,6 +1060,10 @@ static struct spear_muxreg gpt0_tmr1_muxreg[] = { · 19 unmodified lines
9481060 .reg = PAD_FUNCTION_EN_1,
9491061 .mask = PMX_GPT0_TMR1_MASK,
9501062 .val = PMX_GPT0_TMR1_MASK,
1063+ }, {
1064+ .reg = PAD_DIRECTION_SEL_1,
1065+ .mask = PMX_GPT0_TMR1_MASK,
1066+ .val = PMX_GPT0_TMR1_MASK,
9511067 },
9521068 };
9531069
@@ -980,6 +1096,10 @@ static struct spear_muxreg gpt1_tmr0_muxreg[] = { · 26 unmodified lines
9801096 .reg = PAD_FUNCTION_EN_1,
9811097 .mask = PMX_GPT1_TMR0_MASK,
9821098 .val = PMX_GPT1_TMR0_MASK,
1099+ }, {
1100+ .reg = PAD_DIRECTION_SEL_1,
1101+ .mask = PMX_GPT1_TMR0_MASK,
1102+ .val = PMX_GPT1_TMR0_MASK,
9831103 },
9841104 };
9851105
@@ -1005,6 +1125,10 @@ static struct spear_muxreg gpt1_tmr1_muxreg[] = { · 19 unmodified lines
10051125 .reg = PAD_FUNCTION_EN_1,
10061126 .mask = PMX_GPT1_TMR1_MASK,
10071127 .val = PMX_GPT1_TMR1_MASK,
1128+ }, {
1129+ .reg = PAD_DIRECTION_SEL_1,
1130+ .mask = PMX_GPT1_TMR1_MASK,
1131+ .val = PMX_GPT1_TMR1_MASK,
10081132 },
10091133 };
10101134
@@ -1049,6 +1173,20 @@ static const unsigned mcif_pins[] = { 86, 87, 88, 89, 90, 91, 92, 93, 213, 214, · 38 unmodified lines
10491173 .reg = PAD_FUNCTION_EN_2, \
10501174 .mask = PMX_MCIFALL_2_MASK, \
10511175 .val = PMX_MCIFALL_2_MASK, \
1176+ }, { \
1177+ .reg = PAD_DIRECTION_SEL_0, \
1178+ .mask = PMX_MCI_DATA8_15_MASK, \
1179+ .val = PMX_MCI_DATA8_15_MASK, \
1180+ }, { \
1181+ .reg = PAD_DIRECTION_SEL_1, \
1182+ .mask = PMX_MCIFALL_1_MASK | PMX_NFWPRT1_MASK | \
1183+ PMX_NFWPRT2_MASK, \
1184+ .val = PMX_MCIFALL_1_MASK | PMX_NFWPRT1_MASK | \
1185+ PMX_NFWPRT2_MASK, \
1186+ }, { \
1187+ .reg = PAD_DIRECTION_SEL_2, \
1188+ .mask = PMX_MCIFALL_2_MASK, \
1189+ .val = PMX_MCIFALL_2_MASK, \
10521190 }
10531191
10541192 /* sdhci device */
@@ -1154,6 +1292,10 @@ static struct spear_muxreg touch_xy_muxreg[] = { · 99 unmodified lines
11541292 .reg = PAD_FUNCTION_EN_2,
11551293 .mask = PMX_TOUCH_XY_MASK,
11561294 .val = PMX_TOUCH_XY_MASK,
1295+ }, {
1296+ .reg = PAD_DIRECTION_SEL_2,
1297+ .mask = PMX_TOUCH_XY_MASK,
1298+ .val = PMX_TOUCH_XY_MASK,
11571299 },
11581300 };
11591301
@@ -1187,6 +1329,10 @@ static struct spear_muxreg uart1_dis_i2c_muxreg[] = { · 27 unmodified lines
11871329 .reg = PAD_FUNCTION_EN_0,
11881330 .mask = PMX_I2C0_MASK,
11891331 .val = 0,
1332+ }, {
1333+ .reg = PAD_DIRECTION_SEL_0,
1334+ .mask = PMX_I2C0_MASK,
1335+ .val = PMX_I2C0_MASK,
11901336 },
11911337 };
11921338
@@ -1213,6 +1359,12 @@ static struct spear_muxreg uart1_dis_sd_muxreg[] = { · 20 unmodified lines
12131359 .mask = PMX_MCIDATA1_MASK |
12141360 PMX_MCIDATA2_MASK,
12151361 .val = 0,
1362+ }, {
1363+ .reg = PAD_DIRECTION_SEL_1,
1364+ .mask = PMX_MCIDATA1_MASK |
1365+ PMX_MCIDATA2_MASK,
1366+ .val = PMX_MCIDATA1_MASK |
1367+ PMX_MCIDATA2_MASK,
12161368 },
12171369 };
12181370
@@ -1246,6 +1398,10 @@ static struct spear_muxreg uart2_3_muxreg[] = { · 27 unmodified lines
12461398 .reg = PAD_FUNCTION_EN_0,
12471399 .mask = PMX_I2S0_MASK,
12481400 .val = 0,
1401+ }, {
1402+ .reg = PAD_DIRECTION_SEL_0,
1403+ .mask = PMX_I2S0_MASK,
1404+ .val = PMX_I2S0_MASK,
12491405 },
12501406 };
12511407
@@ -1278,6 +1434,10 @@ static struct spear_muxreg uart4_muxreg[] = { · 26 unmodified lines
12781434 .reg = PAD_FUNCTION_EN_0,
12791435 .mask = PMX_I2S0_MASK | PMX_CLCD1_MASK,
12801436 .val = 0,
1437+ }, {
1438+ .reg = PAD_DIRECTION_SEL_0,
1439+ .mask = PMX_I2S0_MASK | PMX_CLCD1_MASK,
1440+ .val = PMX_I2S0_MASK | PMX_CLCD1_MASK,
12811441 },
12821442 };
12831443
@@ -1310,6 +1470,10 @@ static struct spear_muxreg uart5_muxreg[] = { · 26 unmodified lines
13101470 .reg = PAD_FUNCTION_EN_0,
13111471 .mask = PMX_CLCD1_MASK,
13121472 .val = 0,
1473+ }, {
1474+ .reg = PAD_DIRECTION_SEL_0,
1475+ .mask = PMX_CLCD1_MASK,
1476+ .val = PMX_CLCD1_MASK,
13131477 },
13141478 };
13151479
@@ -1344,6 +1508,10 @@ static struct spear_muxreg rs485_0_1_tdm_0_1_muxreg[] = { · 28 unmodified lines
13441508 .reg = PAD_FUNCTION_EN_0,
13451509 .mask = PMX_CLCD1_MASK,
13461510 .val = 0,
1511+ }, {
1512+ .reg = PAD_DIRECTION_SEL_0,
1513+ .mask = PMX_CLCD1_MASK,
1514+ .val = PMX_CLCD1_MASK,
13471515 },
13481516 };
13491517
@@ -1376,6 +1544,10 @@ static struct spear_muxreg i2c_1_2_muxreg[] = { · 26 unmodified lines
13761544 .reg = PAD_FUNCTION_EN_0,
13771545 .mask = PMX_CLCD1_MASK,
13781546 .val = 0,
1547+ }, {
1548+ .reg = PAD_DIRECTION_SEL_0,
1549+ .mask = PMX_CLCD1_MASK,
1550+ .val = PMX_CLCD1_MASK,
13791551 },
13801552 };
13811553
@@ -1409,6 +1581,10 @@ static struct spear_muxreg i2c3_dis_smi_clcd_muxreg[] = { · 27 unmodified lines
14091581 .reg = PAD_FUNCTION_EN_0,
14101582 .mask = PMX_CLCD1_MASK | PMX_SMI_MASK,
14111583 .val = 0,
1584+ }, {
1585+ .reg = PAD_DIRECTION_SEL_0,
1586+ .mask = PMX_CLCD1_MASK | PMX_SMI_MASK,
1587+ .val = PMX_CLCD1_MASK | PMX_SMI_MASK,
14121588 },
14131589 };
14141590
@@ -1435,6 +1611,10 @@ static struct spear_muxreg i2c3_dis_sd_i2s0_muxreg[] = { · 20 unmodified lines
14351611 .reg = PAD_FUNCTION_EN_1,
14361612 .mask = PMX_I2S1_MASK | PMX_MCIDATA3_MASK,
14371613 .val = 0,
1614+ }, {
1615+ .reg = PAD_DIRECTION_SEL_1,
1616+ .mask = PMX_I2S1_MASK | PMX_MCIDATA3_MASK,
1617+ .val = PMX_I2S1_MASK | PMX_MCIDATA3_MASK,
14381618 },
14391619 };
14401620
@@ -1469,6 +1649,10 @@ static struct spear_muxreg i2c_4_5_dis_smi_muxreg[] = { · 28 unmodified lines
14691649 .reg = PAD_FUNCTION_EN_0,
14701650 .mask = PMX_SMI_MASK,
14711651 .val = 0,
1652+ }, {
1653+ .reg = PAD_DIRECTION_SEL_0,
1654+ .mask = PMX_SMI_MASK,
1655+ .val = PMX_SMI_MASK,
14721656 },
14731657 };
14741658
@@ -1499,6 +1683,14 @@ static struct spear_muxreg i2c4_dis_sd_muxreg[] = { · 24 unmodified lines
14991683 .reg = PAD_FUNCTION_EN_2,
15001684 .mask = PMX_MCIDATA5_MASK,
15011685 .val = 0,
1686+ }, {
1687+ .reg = PAD_DIRECTION_SEL_1,
1688+ .mask = PMX_MCIDATA4_MASK,
1689+ .val = PMX_MCIDATA4_MASK,
1690+ }, {
1691+ .reg = PAD_DIRECTION_SEL_2,
1692+ .mask = PMX_MCIDATA5_MASK,
1693+ .val = PMX_MCIDATA5_MASK,
15021694 },
15031695 };
15041696
@@ -1526,6 +1718,12 @@ static struct spear_muxreg i2c5_dis_sd_muxreg[] = { · 21 unmodified lines
15261718 .mask = PMX_MCIDATA6_MASK |
15271719 PMX_MCIDATA7_MASK,
15281720 .val = 0,
1721+ }, {
1722+ .reg = PAD_DIRECTION_SEL_2,
1723+ .mask = PMX_MCIDATA6_MASK |
1724+ PMX_MCIDATA7_MASK,
1725+ .val = PMX_MCIDATA6_MASK |
1726+ PMX_MCIDATA7_MASK,
15291727 },
15301728 };
15311729
@@ -1560,6 +1758,10 @@ static struct spear_muxreg i2c_6_7_dis_kbd_muxreg[] = { · 28 unmodified lines
15601758 .reg = PAD_FUNCTION_EN_1,
15611759 .mask = PMX_KBD_ROWCOL25_MASK,
15621760 .val = 0,
1761+ }, {
1762+ .reg = PAD_DIRECTION_SEL_1,
1763+ .mask = PMX_KBD_ROWCOL25_MASK,
1764+ .val = PMX_KBD_ROWCOL25_MASK,
15631765 },
15641766 };
15651767
@@ -1587,6 +1789,12 @@ static struct spear_muxreg i2c6_dis_sd_muxreg[] = { · 21 unmodified lines
15871789 .mask = PMX_MCIIORDRE_MASK |
15881790 PMX_MCIIOWRWE_MASK,
15891791 .val = 0,
1792+ }, {
1793+ .reg = PAD_DIRECTION_SEL_2,
1794+ .mask = PMX_MCIIORDRE_MASK |
1795+ PMX_MCIIOWRWE_MASK,
1796+ .val = PMX_MCIIORDRE_MASK |
1797+ PMX_MCIIOWRWE_MASK,
15901798 },
15911799 };
15921800
@@ -1613,6 +1821,12 @@ static struct spear_muxreg i2c7_dis_sd_muxreg[] = { · 20 unmodified lines
16131821 .mask = PMX_MCIRESETCF_MASK |
16141822 PMX_MCICS0CE_MASK,
16151823 .val = 0,
1824+ }, {
1825+ .reg = PAD_DIRECTION_SEL_2,
1826+ .mask = PMX_MCIRESETCF_MASK |
1827+ PMX_MCICS0CE_MASK,
1828+ .val = PMX_MCIRESETCF_MASK |
1829+ PMX_MCICS0CE_MASK,
16161830 },
16171831 };
16181832
@@ -1651,6 +1865,14 @@ static struct spear_muxreg can0_dis_nor_muxreg[] = { · 32 unmodified lines
16511865 .reg = PAD_FUNCTION_EN_1,
16521866 .mask = PMX_NFRSTPWDWN3_MASK,
16531867 .val = 0,
1868+ }, {
1869+ .reg = PAD_DIRECTION_SEL_0,
1870+ .mask = PMX_NFRSTPWDWN2_MASK,
1871+ .val = PMX_NFRSTPWDWN2_MASK,
1872+ }, {
1873+ .reg = PAD_DIRECTION_SEL_1,
1874+ .mask = PMX_NFRSTPWDWN3_MASK,
1875+ .val = PMX_NFRSTPWDWN3_MASK,
16541876 },
16551877 };
16561878
@@ -1677,6 +1899,10 @@ static struct spear_muxreg can0_dis_sd_muxreg[] = { · 20 unmodified lines
16771899 .reg = PAD_FUNCTION_EN_2,
16781900 .mask = PMX_MCICFINTR_MASK | PMX_MCIIORDY_MASK,
16791901 .val = 0,
1902+ }, {
1903+ .reg = PAD_DIRECTION_SEL_2,
1904+ .mask = PMX_MCICFINTR_MASK | PMX_MCIIORDY_MASK,
1905+ .val = PMX_MCICFINTR_MASK | PMX_MCIIORDY_MASK,
16801906 },
16811907 };
16821908
@@ -1711,6 +1937,10 @@ static struct spear_muxreg can1_dis_sd_muxreg[] = { · 28 unmodified lines
17111937 .reg = PAD_FUNCTION_EN_2,
17121938 .mask = PMX_MCICS1_MASK | PMX_MCIDMAACK_MASK,
17131939 .val = 0,
1940+ }, {
1941+ .reg = PAD_DIRECTION_SEL_2,
1942+ .mask = PMX_MCICS1_MASK | PMX_MCIDMAACK_MASK,
1943+ .val = PMX_MCICS1_MASK | PMX_MCIDMAACK_MASK,
17141944 },
17151945 };
17161946
@@ -1737,6 +1967,10 @@ static struct spear_muxreg can1_dis_kbd_muxreg[] = { · 20 unmodified lines
17371967 .reg = PAD_FUNCTION_EN_1,
17381968 .mask = PMX_KBD_ROWCOL25_MASK,
17391969 .val = 0,
1970+ }, {
1971+ .reg = PAD_DIRECTION_SEL_1,
1972+ .mask = PMX_KBD_ROWCOL25_MASK,
1973+ .val = PMX_KBD_ROWCOL25_MASK,
17401974 },
17411975 };
17421976
@@ -1763,29 +1997,64 @@ static struct spear_function can1_function = { · 20 unmodified lines
17631997 .ngroups = ARRAY_SIZE(can1_grps),
17641998 };
17651999
1766−/* Pad multiplexing for pci device */
1767−static const unsigned pci_sata_pins[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 18,
2000+/* Pad multiplexing for (ras-ip) pci device */
2001+static const unsigned pci_pins[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 18,
17682002 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
17692003 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
17702004 55, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99 };
1771−#define PCI_SATA_MUXREG \
1772− { \
1773− .reg = PAD_FUNCTION_EN_0, \
1774− .mask = PMX_MCI_DATA8_15_MASK, \
1775− .val = 0, \
1776− }, { \
1777− .reg = PAD_FUNCTION_EN_1, \
1778− .mask = PMX_PCI_REG1_MASK, \
1779− .val = 0, \
1780− }, { \
1781− .reg = PAD_FUNCTION_EN_2, \
1782− .mask = PMX_PCI_REG2_MASK, \
1783− .val = 0, \
1784− }
17852005
1786−/* pad multiplexing for pcie0 device */
2006+static struct spear_muxreg pci_muxreg[] = {
2007+ {
2008+ .reg = PAD_FUNCTION_EN_0,
2009+ .mask = PMX_MCI_DATA8_15_MASK,
2010+ .val = 0,
2011+ }, {
2012+ .reg = PAD_FUNCTION_EN_1,
2013+ .mask = PMX_PCI_REG1_MASK,
2014+ .val = 0,
2015+ }, {
2016+ .reg = PAD_FUNCTION_EN_2,
2017+ .mask = PMX_PCI_REG2_MASK,
2018+ .val = 0,
2019+ }, {
2020+ .reg = PAD_DIRECTION_SEL_0,
2021+ .mask = PMX_MCI_DATA8_15_MASK,
2022+ .val = PMX_MCI_DATA8_15_MASK,
2023+ }, {
2024+ .reg = PAD_DIRECTION_SEL_1,
2025+ .mask = PMX_PCI_REG1_MASK,
2026+ .val = PMX_PCI_REG1_MASK,
2027+ }, {
2028+ .reg = PAD_DIRECTION_SEL_2,
2029+ .mask = PMX_PCI_REG2_MASK,
2030+ .val = PMX_PCI_REG2_MASK,
2031+ },
2032+};
2033+
2034+static struct spear_modemux pci_modemux[] = {
2035+ {
2036+ .muxregs = pci_muxreg,
2037+ .nmuxregs = ARRAY_SIZE(pci_muxreg),
2038+ },
2039+};
2040+
2041+static struct spear_pingroup pci_pingroup = {
2042+ .name = "pci_grp",
2043+ .pins = pci_pins,
2044+ .npins = ARRAY_SIZE(pci_pins),
2045+ .modemuxs = pci_modemux,
2046+ .nmodemuxs = ARRAY_SIZE(pci_modemux),
2047+};
2048+
2049+static const char *const pci_grps[] = { "pci_grp" };
2050+static struct spear_function pci_function = {
2051+ .name = "pci",
2052+ .groups = pci_grps,
2053+ .ngroups = ARRAY_SIZE(pci_grps),
2054+};
2055+
2056+/* pad multiplexing for (fix-part) pcie0 device */
17872057 static struct spear_muxreg pcie0_muxreg[] = {
1788− PCI_SATA_MUXREG,
17892058 {
17902059 .reg = PCIE_SATA_CFG,
17912060 .mask = PCIE_CFG_VAL(0),
@@ -1802,15 +2071,12 @@ static struct spear_modemux pcie0_modemux[] = { · 10 unmodified lines
18022071
18032072 static struct spear_pingroup pcie0_pingroup = {
18042073 .name = "pcie0_grp",
1805− .pins = pci_sata_pins,
1806− .npins = ARRAY_SIZE(pci_sata_pins),
18072074 .modemuxs = pcie0_modemux,
18082075 .nmodemuxs = ARRAY_SIZE(pcie0_modemux),
18092076 };
18102077
1811−/* pad multiplexing for pcie1 device */
2078+/* pad multiplexing for (fix-part) pcie1 device */
18122079 static struct spear_muxreg pcie1_muxreg[] = {
1813− PCI_SATA_MUXREG,
18142080 {
18152081 .reg = PCIE_SATA_CFG,
18162082 .mask = PCIE_CFG_VAL(1),
@@ -1827,15 +2093,12 @@ static struct spear_modemux pcie1_modemux[] = { · 10 unmodified lines
18272093
18282094 static struct spear_pingroup pcie1_pingroup = {
18292095 .name = "pcie1_grp",
1830− .pins = pci_sata_pins,
1831− .npins = ARRAY_SIZE(pci_sata_pins),
18322096 .modemuxs = pcie1_modemux,
18332097 .nmodemuxs = ARRAY_SIZE(pcie1_modemux),
18342098 };
18352099
1836−/* pad multiplexing for pcie2 device */
2100+/* pad multiplexing for (fix-part) pcie2 device */
18372101 static struct spear_muxreg pcie2_muxreg[] = {
1838− PCI_SATA_MUXREG,
18392102 {
18402103 .reg = PCIE_SATA_CFG,
18412104 .mask = PCIE_CFG_VAL(2),
@@ -1852,22 +2115,20 @@ static struct spear_modemux pcie2_modemux[] = { · 10 unmodified lines
18522115
18532116 static struct spear_pingroup pcie2_pingroup = {
18542117 .name = "pcie2_grp",
1855− .pins = pci_sata_pins,
1856− .npins = ARRAY_SIZE(pci_sata_pins),
18572118 .modemuxs = pcie2_modemux,
18582119 .nmodemuxs = ARRAY_SIZE(pcie2_modemux),
18592120 };
18602121
1861−static const char *const pci_grps[] = { "pcie0_grp", "pcie1_grp", "pcie2_grp" };
1862−static struct spear_function pci_function = {
1863− .name = "pci",
1864− .groups = pci_grps,
1865− .ngroups = ARRAY_SIZE(pci_grps),
2122+static const char *const pcie_grps[] = { "pcie0_grp", "pcie1_grp", "pcie2_grp"
2123+};
2124+static struct spear_function pcie_function = {
2125+ .name = "pci_express",
2126+ .groups = pcie_grps,
2127+ .ngroups = ARRAY_SIZE(pcie_grps),
18662128 };
18672129
18682130 /* pad multiplexing for sata0 device */
18692131 static struct spear_muxreg sata0_muxreg[] = {
1870− PCI_SATA_MUXREG,
18712132 {
18722133 .reg = PCIE_SATA_CFG,
18732134 .mask = SATA_CFG_VAL(0),
@@ -1884,15 +2145,12 @@ static struct spear_modemux sata0_modemux[] = { · 10 unmodified lines
18842145
18852146 static struct spear_pingroup sata0_pingroup = {
18862147 .name = "sata0_grp",
1887− .pins = pci_sata_pins,
1888− .npins = ARRAY_SIZE(pci_sata_pins),
18892148 .modemuxs = sata0_modemux,
18902149 .nmodemuxs = ARRAY_SIZE(sata0_modemux),
18912150 };
18922151
18932152 /* pad multiplexing for sata1 device */
18942153 static struct spear_muxreg sata1_muxreg[] = {
1895− PCI_SATA_MUXREG,
18962154 {
18972155 .reg = PCIE_SATA_CFG,
18982156 .mask = SATA_CFG_VAL(1),
@@ -1909,15 +2167,12 @@ static struct spear_modemux sata1_modemux[] = { · 10 unmodified lines
19092167
19102168 static struct spear_pingroup sata1_pingroup = {
19112169 .name = "sata1_grp",
1912− .pins = pci_sata_pins,
1913− .npins = ARRAY_SIZE(pci_sata_pins),
19142170 .modemuxs = sata1_modemux,
19152171 .nmodemuxs = ARRAY_SIZE(sata1_modemux),
19162172 };
19172173
19182174 /* pad multiplexing for sata2 device */
19192175 static struct spear_muxreg sata2_muxreg[] = {
1920− PCI_SATA_MUXREG,
19212176 {
19222177 .reg = PCIE_SATA_CFG,
19232178 .mask = SATA_CFG_VAL(2),
@@ -1934,8 +2189,6 @@ static struct spear_modemux sata2_modemux[] = { · 10 unmodified lines
19342189
19352190 static struct spear_pingroup sata2_pingroup = {
19362191 .name = "sata2_grp",
1937− .pins = pci_sata_pins,
1938− .npins = ARRAY_SIZE(pci_sata_pins),
19392192 .modemuxs = sata2_modemux,
19402193 .nmodemuxs = ARRAY_SIZE(sata2_modemux),
19412194 };
@@ -1957,6 +2210,14 @@ static struct spear_muxreg ssp1_dis_kbd_muxreg[] = { · 15 unmodified lines
19572210 PMX_KBD_COL0_MASK | PMX_NFIO8_15_MASK | PMX_NFCE1_MASK |
19582211 PMX_NFCE2_MASK,
19592212 .val = 0,
2213+ }, {
2214+ .reg = PAD_DIRECTION_SEL_1,
2215+ .mask = PMX_KBD_ROWCOL25_MASK | PMX_KBD_COL1_MASK |
2216+ PMX_KBD_COL0_MASK | PMX_NFIO8_15_MASK | PMX_NFCE1_MASK |
2217+ PMX_NFCE2_MASK,
2218+ .val = PMX_KBD_ROWCOL25_MASK | PMX_KBD_COL1_MASK |
2219+ PMX_KBD_COL0_MASK | PMX_NFIO8_15_MASK | PMX_NFCE1_MASK |
2220+ PMX_NFCE2_MASK,
19602221 },
19612222 };
19622223
@@ -1983,6 +2244,12 @@ static struct spear_muxreg ssp1_dis_sd_muxreg[] = { · 20 unmodified lines
19832244 .mask = PMX_MCIADDR0ALE_MASK | PMX_MCIADDR2_MASK |
19842245 PMX_MCICECF_MASK | PMX_MCICEXD_MASK,
19852246 .val = 0,
2247+ }, {
2248+ .reg = PAD_DIRECTION_SEL_2,
2249+ .mask = PMX_MCIADDR0ALE_MASK | PMX_MCIADDR2_MASK |
2250+ PMX_MCICECF_MASK | PMX_MCICEXD_MASK,
2251+ .val = PMX_MCIADDR0ALE_MASK | PMX_MCIADDR2_MASK |
2252+ PMX_MCICECF_MASK | PMX_MCICEXD_MASK,
19862253 },
19872254 };
19882255
@@ -2017,6 +2284,12 @@ static struct spear_muxreg gpt64_muxreg[] = { · 28 unmodified lines
20172284 .mask = PMX_MCICDCF1_MASK | PMX_MCICDCF2_MASK | PMX_MCICDXD_MASK
20182285 | PMX_MCILEDS_MASK,
20192286 .val = 0,
2287+ }, {
2288+ .reg = PAD_DIRECTION_SEL_2,
2289+ .mask = PMX_MCICDCF1_MASK | PMX_MCICDCF2_MASK | PMX_MCICDXD_MASK
2290+ | PMX_MCILEDS_MASK,
2291+ .val = PMX_MCICDCF1_MASK | PMX_MCICDCF2_MASK | PMX_MCICDXD_MASK
2292+ | PMX_MCILEDS_MASK,
20202293 },
20212294 };
20222295
@@ -2093,6 +2366,7 @@ static struct spear_pingroup *spear1310_pingroups[] = { · 70 unmodified lines
20932366 &can0_dis_sd_pingroup,
20942367 &can1_dis_sd_pingroup,
20952368 &can1_dis_kbd_pingroup,
2369+ &pci_pingroup,
20962370 &pcie0_pingroup,
20972371 &pcie1_pingroup,
20982372 &pcie2_pingroup,
@@ -2138,6 +2412,7 @@ static struct spear_function *spear1310_functions[] = { · 39 unmodified lines
21382412 &can0_function,
21392413 &can1_function,
21402414 &pci_function,
2415+ &pcie_function,
21412416 &sata_function,
21422417 &ssp1_function,
21432418 &gpt64_function,
drivers/pinctrl/spear/pinctrl-spear1340.c+39−2
@@ -213,7 +213,7 @@ static const struct pinctrl_pin_desc spear1340_pins[] = { · 212 unmodified lines
213213 * Pad multiplexing for making all pads as gpio's. This is done to override the
214214 * values passed from bootloader and start from scratch.
215215 */
216−static const unsigned pads_as_gpio_pins[] = { 251 };
216+static const unsigned pads_as_gpio_pins[] = { 12, 88, 89, 251 };
217217 static struct spear_muxreg pads_as_gpio_muxreg[] = {
218218 {
219219 .reg = PAD_FUNCTION_EN_1,
@@ -1692,7 +1692,43 @@ static struct spear_pingroup clcd_pingroup = { · 1472 unmodified lines
16921692 .nmodemuxs = ARRAY_SIZE(clcd_modemux),
16931693 };
16941694
1695−static const char *const clcd_grps[] = { "clcd_grp" };
1695+/* Disable cld runtime to save panel damage */
1696+static struct spear_muxreg clcd_sleep_muxreg[] = {
1697+ {
1698+ .reg = PAD_SHARED_IP_EN_1,
1699+ .mask = ARM_TRACE_MASK | MIPHY_DBG_MASK,
1700+ .val = 0,
1701+ }, {
1702+ .reg = PAD_FUNCTION_EN_5,
1703+ .mask = CLCD_REG4_MASK | CLCD_AND_ARM_TRACE_REG4_MASK,
1704+ .val = 0x0,
1705+ }, {
1706+ .reg = PAD_FUNCTION_EN_6,
1707+ .mask = CLCD_AND_ARM_TRACE_REG5_MASK,
1708+ .val = 0x0,
1709+ }, {
1710+ .reg = PAD_FUNCTION_EN_7,
1711+ .mask = CLCD_AND_ARM_TRACE_REG6_MASK,
1712+ .val = 0x0,
1713+ },
1714+};
1715+
1716+static struct spear_modemux clcd_sleep_modemux[] = {
1717+ {
1718+ .muxregs = clcd_sleep_muxreg,
1719+ .nmuxregs = ARRAY_SIZE(clcd_sleep_muxreg),
1720+ },
1721+};
1722+
1723+static struct spear_pingroup clcd_sleep_pingroup = {
1724+ .name = "clcd_sleep_grp",
1725+ .pins = clcd_pins,
1726+ .npins = ARRAY_SIZE(clcd_pins),
1727+ .modemuxs = clcd_sleep_modemux,
1728+ .nmodemuxs = ARRAY_SIZE(clcd_sleep_modemux),
1729+};
1730+
1731+static const char *const clcd_grps[] = { "clcd_grp", "clcd_sleep_grp" };
16961732 static struct spear_function clcd_function = {
16971733 .name = "clcd",
16981734 .groups = clcd_grps,
@@ -1893,6 +1929,7 @@ static struct spear_pingroup *spear1340_pingroups[] = { · 194 unmodified lines
18931929 &sdhci_pingroup,
18941930 &cf_pingroup,
18951931 &xd_pingroup,
1932+ &clcd_sleep_pingroup,
18961933 &clcd_pingroup,
18971934 &arm_trace_pingroup,
18981935 &miphy_dbg_pingroup,
drivers/pinctrl/spear/pinctrl-spear320.c+6−2
@@ -2239,6 +2239,10 @@ static struct spear_muxreg pwm2_pin_34_muxreg[] = { · 2238 unmodified lines
22392239 .reg = PMX_CONFIG_REG,
22402240 .mask = PMX_SSP_CS_MASK,
22412241 .val = 0,
2242+ }, {
2243+ .reg = MODE_CONFIG_REG,
2244+ .mask = PMX_PWM_MASK,
2245+ .val = PMX_PWM_MASK,
22422246 }, {
22432247 .reg = IP_SEL_PAD_30_39_REG,
22442248 .mask = PMX_PL_34_MASK,
@@ -2956,9 +2960,9 @@ static struct spear_function mii2_function = { · 711 unmodified lines
29562960 };
29572961
29582962 /* Pad multiplexing for cadence mii 1_2 as smii or rmii device */
2959−static const unsigned smii0_1_pins[] = { 10, 11, 13, 14, 15, 16, 17, 18, 19, 20,
2963+static const unsigned rmii0_1_pins[] = { 10, 11, 13, 14, 15, 16, 17, 18, 19, 20,
29602964 21, 22, 23, 24, 25, 26, 27 };
2961−static const unsigned rmii0_1_pins[] = { 10, 11, 21, 22, 23, 24, 25, 26, 27 };
2965+static const unsigned smii0_1_pins[] = { 10, 11, 21, 22, 23, 24, 25, 26, 27 };
29622966 static struct spear_muxreg mii0_1_muxreg[] = {
29632967 {
29642968 .reg = PMX_CONFIG_REG,
drivers/pinctrl/spear/pinctrl-spear3xx.h+1−0
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include "pinctrl-spear.h"
1616
1717 /* pad mux declarations */
18+#define PMX_PWM_MASK (1 << 16)
1819 #define PMX_FIRDA_MASK (1 << 14)
1920 #define PMX_I2C_MASK (1 << 13)
2021 #define PMX_SSP_CS_MASK (1 << 12)
drivers/s390/cio/css.h+0−3
@@ -112,9 +112,6 @@ extern int for_each_subchannel(int(*fn)(struct subchannel_id, void *), void *); · 111 unmodified lines
112112 extern void css_reiterate_subchannels(void);
113113 void css_update_ssd_info(struct subchannel *sch);
114114
115−#define __MAX_SUBCHANNEL 65535
116−#define __MAX_SSID 3
117−
118115 struct channel_subsystem {
119116 u8 cssid;
120117 int valid;
drivers/s390/cio/device.c+1−7
@@ -1424,7 +1424,7 @@ static enum io_sch_action sch_get_action(struct subchannel *sch) · 1423 unmodified lines
14241424 }
14251425 if (device_is_disconnected(cdev))
14261426 return IO_SCH_REPROBE;
1427− if (cdev->online)
1427+ if (cdev->online && !cdev->private->flags.resuming)
14281428 return IO_SCH_VERIFY;
14291429 if (cdev->private->state == DEV_STATE_NOT_OPER)
14301430 return IO_SCH_UNREG_ATTACH;
@@ -1469,12 +1469,6 @@ static int io_subchannel_sch_event(struct subchannel *sch, int process) · 38 unmodified lines
14691469 rc = 0;
14701470 goto out_unlock;
14711471 case IO_SCH_VERIFY:
1472− if (cdev->private->flags.resuming == 1) {
1473− if (cio_enable_subchannel(sch, (u32)(addr_t)sch)) {
1474− ccw_device_set_notoper(cdev);
1475− break;
1476− }
1477− }
14781472 /* Trigger path verification. */
14791473 io_subchannel_verify(sch);
14801474 rc = 0;
drivers/s390/cio/idset.c+1−2
@@ -125,8 +125,7 @@ int idset_is_empty(struct idset *set) · 124 unmodified lines
125125
126126 void idset_add_set(struct idset *to, struct idset *from)
127127 {
128− int len = min(__BITOPS_WORDS(to->num_ssid * to->num_id),
129− __BITOPS_WORDS(from->num_ssid * from->num_id));
128+ int len = min(to->num_ssid * to->num_id, from->num_ssid * from->num_id);
130129
131130 bitmap_or(to->bitmap, to->bitmap, from->bitmap, len);
132131 }
drivers/scsi/qla2xxx/qla_mid.c+3−0
@@ -149,6 +149,7 @@ qla2x00_mark_vp_devices_dead(scsi_qla_host_t *vha) · 148 unmodified lines
149149 int
150150 qla24xx_disable_vp(scsi_qla_host_t *vha)
151151 {
152+ unsigned long flags;
152153 int ret;
153154
154155 ret = qla24xx_control_vp(vha, VCE_COMMAND_DISABLE_VPS_LOGO_ALL);
@@ -156,7 +157,9 @@ qla24xx_disable_vp(scsi_qla_host_t *vha) · 1 unmodified line
156157 atomic_set(&vha->loop_down_timer, LOOP_DOWN_TIME);
157158
158159 /* Remove port id from vp target map */
160+ spin_lock_irqsave(&vha->hw->vport_slock, flags);
159161 qlt_update_vp_map(vha, RESET_AL_PA);
162+ spin_unlock_irqrestore(&vha->hw->vport_slock, flags);
160163
161164 qla2x00_mark_vp_devices_dead(vha);
162165 atomic_set(&vha->vp_state, VP_FAILED);
drivers/scsi/qla2xxx/qla_target.c+11−14
@@ -557,6 +557,7 @@ static bool qlt_check_fcport_exist(struct scsi_qla_host *vha, · 556 unmodified lines
557557 int pmap_len;
558558 fc_port_t *fcport;
559559 int global_resets;
560+ unsigned long flags;
560561
561562 retry:
562563 global_resets = atomic_read(&ha->tgt.qla_tgt->tgt_global_resets_count);
@@ -625,10 +626,10 @@ retry: · 62 unmodified lines
625626 sess->s_id.b.area, sess->loop_id, fcport->d_id.b.domain,
626627 fcport->d_id.b.al_pa, fcport->d_id.b.area, fcport->loop_id);
627628
628− sess->s_id = fcport->d_id;
629− sess->loop_id = fcport->loop_id;
630− sess->conf_compl_supported = !!(fcport->flags &
631− FCF_CONF_COMP_SUPPORTED);
629+ spin_lock_irqsave(&ha->hardware_lock, flags);
630+ ha->tgt.tgt_ops->update_sess(sess, fcport->d_id, fcport->loop_id,
631+ (fcport->flags & FCF_CONF_COMP_SUPPORTED));
632+ spin_unlock_irqrestore(&ha->hardware_lock, flags);
632633
633634 res = true;
634635
@@ -740,10 +741,9 @@ static struct qla_tgt_sess *qlt_create_sess( · 105 unmodified lines
740741 qlt_undelete_sess(sess);
741742
742743 kref_get(&sess->se_sess->sess_kref);
743− sess->s_id = fcport->d_id;
744− sess->loop_id = fcport->loop_id;
745− sess->conf_compl_supported = !!(fcport->flags &
746− FCF_CONF_COMP_SUPPORTED);
744+ ha->tgt.tgt_ops->update_sess(sess, fcport->d_id, fcport->loop_id,
745+ (fcport->flags & FCF_CONF_COMP_SUPPORTED));
746+
747747 if (sess->local && !local)
748748 sess->local = 0;
749749 spin_unlock_irqrestore(&ha->hardware_lock, flags);
@@ -796,8 +796,7 @@ static struct qla_tgt_sess *qlt_create_sess( · 46 unmodified lines
796796 */
797797 kref_get(&sess->se_sess->sess_kref);
798798
799− sess->conf_compl_supported = !!(fcport->flags &
800− FCF_CONF_COMP_SUPPORTED);
799+ sess->conf_compl_supported = (fcport->flags & FCF_CONF_COMP_SUPPORTED);
801800 BUILD_BUG_ON(sizeof(sess->port_name) != sizeof(fcport->port_name));
802801 memcpy(sess->port_name, fcport->port_name, sizeof(sess->port_name));
803802
@@ -869,10 +868,8 @@ void qlt_fc_port_added(struct scsi_qla_host *vha, fc_port_t *fcport) · 65 unmodified lines
869868 ql_dbg(ql_dbg_tgt_mgt, vha, 0xf007,
870869 "Reappeared sess %p\n", sess);
871870 }
872− sess->s_id = fcport->d_id;
873− sess->loop_id = fcport->loop_id;
874− sess->conf_compl_supported = !!(fcport->flags &
875− FCF_CONF_COMP_SUPPORTED);
871+ ha->tgt.tgt_ops->update_sess(sess, fcport->d_id, fcport->loop_id,
872+ (fcport->flags & FCF_CONF_COMP_SUPPORTED));
876873 }
877874
878875 if (sess && sess->local) {
drivers/scsi/qla2xxx/qla_target.h+1−0
@@ -648,6 +648,7 @@ struct qla_tgt_func_tmpl { · 647 unmodified lines
648648
649649 int (*check_initiator_node_acl)(struct scsi_qla_host *, unsigned char *,
650650 void *, uint8_t *, uint16_t);
651+ void (*update_sess)(struct qla_tgt_sess *, port_id_t, uint16_t, bool);
651652 struct qla_tgt_sess *(*find_sess_by_loop_id)(struct scsi_qla_host *,
652653 const uint16_t);
653654 struct qla_tgt_sess *(*find_sess_by_s_id)(struct scsi_qla_host *,
drivers/scsi/qla2xxx/tcm_qla2xxx.c+76−1
@@ -237,7 +237,7 @@ static char *tcm_qla2xxx_get_fabric_wwn(struct se_portal_group *se_tpg) · 236 unmodified lines
237237 struct tcm_qla2xxx_tpg, se_tpg);
238238 struct tcm_qla2xxx_lport *lport = tpg->lport;
239239
240− return &lport->lport_name[0];
240+ return lport->lport_naa_name;
241241 }
242242
243243 static char *tcm_qla2xxx_npiv_get_fabric_wwn(struct se_portal_group *se_tpg)
@@ -1457,6 +1457,78 @@ static int tcm_qla2xxx_check_initiator_node_acl( · 1213 unmodified lines
14571457 return 0;
14581458 }
14591459
1460+static void tcm_qla2xxx_update_sess(struct qla_tgt_sess *sess, port_id_t s_id,
1461+ uint16_t loop_id, bool conf_compl_supported)
1462+{
1463+ struct qla_tgt *tgt = sess->tgt;
1464+ struct qla_hw_data *ha = tgt->ha;
1465+ struct tcm_qla2xxx_lport *lport = ha->tgt.target_lport_ptr;
1466+ struct se_node_acl *se_nacl = sess->se_sess->se_node_acl;
1467+ struct tcm_qla2xxx_nacl *nacl = container_of(se_nacl,
1468+ struct tcm_qla2xxx_nacl, se_node_acl);
1469+ u32 key;
1470+
1471+
1472+ if (sess->loop_id != loop_id || sess->s_id.b24 != s_id.b24)
1473+ pr_info("Updating session %p from port %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x loop_id %d -> %d s_id %x:%x:%x -> %x:%x:%x\n",
1474+ sess,
1475+ sess->port_name[0], sess->port_name[1],
1476+ sess->port_name[2], sess->port_name[3],
1477+ sess->port_name[4], sess->port_name[5],
1478+ sess->port_name[6], sess->port_name[7],
1479+ sess->loop_id, loop_id,
1480+ sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa,
1481+ s_id.b.domain, s_id.b.area, s_id.b.al_pa);
1482+
1483+ if (sess->loop_id != loop_id) {
1484+ /*
1485+ * Because we can shuffle loop IDs around and we
1486+ * update different sessions non-atomically, we might
1487+ * have overwritten this session's old loop ID
1488+ * already, and we might end up overwriting some other
1489+ * session that will be updated later. So we have to
1490+ * be extra careful and we can't warn about those things...
1491+ */
1492+ if (lport->lport_loopid_map[sess->loop_id].se_nacl == se_nacl)
1493+ lport->lport_loopid_map[sess->loop_id].se_nacl = NULL;
1494+
1495+ lport->lport_loopid_map[loop_id].se_nacl = se_nacl;
1496+
1497+ sess->loop_id = loop_id;
1498+ }
1499+
1500+ if (sess->s_id.b24 != s_id.b24) {
1501+ key = (((u32) sess->s_id.b.domain << 16) |
1502+ ((u32) sess->s_id.b.area << 8) |
1503+ ((u32) sess->s_id.b.al_pa));
1504+
1505+ if (btree_lookup32(&lport->lport_fcport_map, key))
1506+ WARN(btree_remove32(&lport->lport_fcport_map, key) != se_nacl,
1507+ "Found wrong se_nacl when updating s_id %x:%x:%x\n",
1508+ sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa);
1509+ else
1510+ WARN(1, "No lport_fcport_map entry for s_id %x:%x:%x\n",
1511+ sess->s_id.b.domain, sess->s_id.b.area, sess->s_id.b.al_pa);
1512+
1513+ key = (((u32) s_id.b.domain << 16) |
1514+ ((u32) s_id.b.area << 8) |
1515+ ((u32) s_id.b.al_pa));
1516+
1517+ if (btree_lookup32(&lport->lport_fcport_map, key)) {
1518+ WARN(1, "Already have lport_fcport_map entry for s_id %x:%x:%x\n",
1519+ s_id.b.domain, s_id.b.area, s_id.b.al_pa);
1520+ btree_update32(&lport->lport_fcport_map, key, se_nacl);
1521+ } else {
1522+ btree_insert32(&lport->lport_fcport_map, key, se_nacl, GFP_ATOMIC);
1523+ }
1524+
1525+ sess->s_id = s_id;
1526+ nacl->nport_id = key;
1527+ }
1528+
1529+ sess->conf_compl_supported = conf_compl_supported;
1530+}
1531+
14601532 /*
14611533 * Calls into tcm_qla2xxx used by qla2xxx LLD I/O path.
14621534 */
@@ -1467,6 +1539,7 @@ static struct qla_tgt_func_tmpl tcm_qla2xxx_template = { · 4 unmodified lines
14671539 .free_cmd = tcm_qla2xxx_free_cmd,
14681540 .free_mcmd = tcm_qla2xxx_free_mcmd,
14691541 .free_session = tcm_qla2xxx_free_session,
1542+ .update_sess = tcm_qla2xxx_update_sess,
14701543 .check_initiator_node_acl = tcm_qla2xxx_check_initiator_node_acl,
14711544 .find_sess_by_s_id = tcm_qla2xxx_find_sess_by_s_id,
14721545 .find_sess_by_loop_id = tcm_qla2xxx_find_sess_by_loop_id,
@@ -1534,6 +1607,7 @@ static struct se_wwn *tcm_qla2xxx_make_lport( · 61 unmodified lines
15341607 lport->lport_wwpn = wwpn;
15351608 tcm_qla2xxx_format_wwn(&lport->lport_name[0], TCM_QLA2XXX_NAMELEN,
15361609 wwpn);
1610+ sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) wwpn);
15371611
15381612 ret = tcm_qla2xxx_init_lport(lport);
15391613 if (ret != 0)
@@ -1601,6 +1675,7 @@ static struct se_wwn *tcm_qla2xxx_npiv_make_lport( · 61 unmodified lines
16011675 lport->lport_npiv_wwnn = npiv_wwnn;
16021676 tcm_qla2xxx_npiv_format_wwn(&lport->lport_npiv_name[0],
16031677 TCM_QLA2XXX_NAMELEN, npiv_wwpn, npiv_wwnn);
1678+ sprintf(lport->lport_naa_name, "naa.%016llx", (unsigned long long) npiv_wwpn);
16041679
16051680 /* FIXME: tcm_qla2xxx_npiv_make_lport */
16061681 ret = -ENOSYS;
drivers/scsi/qla2xxx/tcm_qla2xxx.h+2−0
@@ -61,6 +61,8 @@ struct tcm_qla2xxx_lport { · 60 unmodified lines
6161 u64 lport_npiv_wwnn;
6262 /* ASCII formatted WWPN for FC Target Lport */
6363 char lport_name[TCM_QLA2XXX_NAMELEN];
64+ /* ASCII formatted naa WWPN for VPD page 83 etc */
65+ char lport_naa_name[TCM_QLA2XXX_NAMELEN];
6466 /* ASCII formatted WWPN+WWNN for NPIV FC Target Lport */
6567 char lport_npiv_name[TCM_QLA2XXX_NPIV_NAMELEN];
6668 /* map for fc_port pointers in 24-bit FC Port ID space */
drivers/scsi/qlogicpti.c+1−12
@@ -1294,26 +1294,19 @@ static struct scsi_host_template qpti_template = { · 1293 unmodified lines
12941294 static const struct of_device_id qpti_match[];
12951295 static int __devinit qpti_sbus_probe(struct platform_device *op)
12961296 {
1297− const struct of_device_id *match;
1298− struct scsi_host_template *tpnt;
12991297 struct device_node *dp = op->dev.of_node;
13001298 struct Scsi_Host *host;
13011299 struct qlogicpti *qpti;
13021300 static int nqptis;
13031301 const char *fcode;
13041302
1305− match = of_match_device(qpti_match, &op->dev);
1306− if (!match)
1307− return -EINVAL;
1308− tpnt = match->data;
1309−
13101303 /* Sometimes Antares cards come up not completely
13111304 * setup, and we get a report of a zero IRQ.
13121305 */
13131306 if (op->archdata.irqs[0] == 0)
13141307 return -ENODEV;
13151308
1316− host = scsi_host_alloc(tpnt, sizeof(struct qlogicpti));
1309+ host = scsi_host_alloc(&qpti_template, sizeof(struct qlogicpti));
13171310 if (!host)
13181311 return -ENOMEM;
13191312
@@ -1445,19 +1438,15 @@ static int __devexit qpti_sbus_remove(struct platform_device *op) · 125 unmodified lines
14451438 static const struct of_device_id qpti_match[] = {
14461439 {
14471440 .name = "ptisp",
1448− .data = &qpti_template,
14491441 },
14501442 {
14511443 .name = "PTI,ptisp",
1452− .data = &qpti_template,
14531444 },
14541445 {
14551446 .name = "QLGC,isp",
1456− .data = &qpti_template,
14571447 },
14581448 {
14591449 .name = "SUNW,isp",
1460− .data = &qpti_template,
14611450 },
14621451 {},
14631452 };
drivers/target/iscsi/iscsi_target.c+3−1
@@ -3719,7 +3719,9 @@ restart: · 3718 unmodified lines
37193719 */
37203720 iscsit_thread_check_cpumask(conn, current, 1);
37213721
3722− schedule_timeout_interruptible(MAX_SCHEDULE_TIMEOUT);
3722+ wait_event_interruptible(conn->queues_wq,
3723+ !iscsit_conn_all_queues_empty(conn) ||
3724+ ts->status == ISCSI_THREAD_SET_RESET);
37233725
37243726 if ((ts->status == ISCSI_THREAD_SET_RESET) ||
37253727 signal_pending(current))
drivers/target/iscsi/iscsi_target_core.h+1−0
@@ -486,6 +486,7 @@ struct iscsi_tmr_req { · 485 unmodified lines
486486 };
487487
488488 struct iscsi_conn {
489+ wait_queue_head_t queues_wq;
489490 /* Authentication Successful for this connection */
490491 u8 auth_complete;
491492 /* State connection is currently in */
drivers/target/iscsi/iscsi_target_login.c+1−0
@@ -41,6 +41,7 @@ · 40 unmodified lines
4141
4242 static int iscsi_login_init_conn(struct iscsi_conn *conn)
4343 {
44+ init_waitqueue_head(&conn->queues_wq);
4445 INIT_LIST_HEAD(&conn->conn_list);
4546 INIT_LIST_HEAD(&conn->conn_cmd_list);
4647 INIT_LIST_HEAD(&conn->immed_queue_list);
drivers/target/iscsi/iscsi_target_util.c+20−2
@@ -488,7 +488,7 @@ void iscsit_add_cmd_to_immediate_queue( · 487 unmodified lines
488488 atomic_set(&conn->check_immediate_queue, 1);
489489 spin_unlock_bh(&conn->immed_queue_lock);
490490
491− wake_up_process(conn->thread_set->tx_thread);
491+ wake_up(&conn->queues_wq);
492492 }
493493
494494 struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_conn *conn)
@@ -562,7 +562,7 @@ void iscsit_add_cmd_to_response_queue( · 67 unmodified lines
562562 atomic_inc(&cmd->response_queue_count);
563563 spin_unlock_bh(&conn->response_queue_lock);
564564
565− wake_up_process(conn->thread_set->tx_thread);
565+ wake_up(&conn->queues_wq);
566566 }
567567
568568 struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *conn)
@@ -616,6 +616,24 @@ static void iscsit_remove_cmd_from_response_queue( · 47 unmodified lines
616616 }
617617 }
618618
619+bool iscsit_conn_all_queues_empty(struct iscsi_conn *conn)
620+{
621+ bool empty;
622+
623+ spin_lock_bh(&conn->immed_queue_lock);
624+ empty = list_empty(&conn->immed_queue_list);
625+ spin_unlock_bh(&conn->immed_queue_lock);
626+
627+ if (!empty)
628+ return empty;
629+
630+ spin_lock_bh(&conn->response_queue_lock);
631+ empty = list_empty(&conn->response_queue_list);
632+ spin_unlock_bh(&conn->response_queue_lock);
633+
634+ return empty;
635+}
636+
619637 void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *conn)
620638 {
621639 struct iscsi_queue_req *qr, *qr_tmp;
drivers/target/iscsi/iscsi_target_util.h+1−0
@@ -25,6 +25,7 @@ extern struct iscsi_queue_req *iscsit_get_cmd_from_immediate_queue(struct iscsi_ · 24 unmodified lines
2525 extern void iscsit_add_cmd_to_response_queue(struct iscsi_cmd *, struct iscsi_conn *, u8);
2626 extern struct iscsi_queue_req *iscsit_get_cmd_from_response_queue(struct iscsi_conn *);
2727 extern void iscsit_remove_cmd_from_tx_queues(struct iscsi_cmd *, struct iscsi_conn *);
28+extern bool iscsit_conn_all_queues_empty(struct iscsi_conn *);
2829 extern void iscsit_free_queue_reqs_for_conn(struct iscsi_conn *);
2930 extern void iscsit_release_cmd(struct iscsi_cmd *);
3031 extern void iscsit_free_cmd(struct iscsi_cmd *);
drivers/target/target_core_configfs.c+2−1
@@ -3206,7 +3206,8 @@ static int __init target_core_init_configfs(void) · 3205 unmodified lines
32063206 if (ret < 0)
32073207 goto out;
32083208
3209− if (core_dev_setup_virtual_lun0() < 0)
3209+ ret = core_dev_setup_virtual_lun0();
3210+ if (ret < 0)
32103211 goto out;
32113212
32123213 return 0;
drivers/target/target_core_device.c+9−9
@@ -850,20 +850,20 @@ int se_dev_check_shutdown(struct se_device *dev) · 849 unmodified lines
850850
851851 static u32 se_dev_align_max_sectors(u32 max_sectors, u32 block_size)
852852 {
853− u32 tmp, aligned_max_sectors;
853+ u32 aligned_max_sectors;
854+ u32 alignment;
854855 /*
855856 * Limit max_sectors to a PAGE_SIZE aligned value for modern
856857 * transport_allocate_data_tasks() operation.
857858 */
858− tmp = rounddown((max_sectors * block_size), PAGE_SIZE);
859− aligned_max_sectors = (tmp / block_size);
860− if (max_sectors != aligned_max_sectors) {
861− printk(KERN_INFO "Rounding down aligned max_sectors from %u"
862− " to %u\n", max_sectors, aligned_max_sectors);
863− return aligned_max_sectors;
864− }
859+ alignment = max(1ul, PAGE_SIZE / block_size);
860+ aligned_max_sectors = rounddown(max_sectors, alignment);
861+
862+ if (max_sectors != aligned_max_sectors)
863+ pr_info("Rounding down aligned max_sectors from %u to %u\n",
864+ max_sectors, aligned_max_sectors);
865865
866− return max_sectors;
866+ return aligned_max_sectors;
867867 }
868868
869869 void se_dev_set_default_attribs(
drivers/target/target_core_sbc.c+18−0
@@ -135,6 +135,12 @@ static int sbc_emulate_verify(struct se_cmd *cmd) · 134 unmodified lines
135135 return 0;
136136 }
137137
138+static int sbc_emulate_noop(struct se_cmd *cmd)
139+{
140+ target_complete_cmd(cmd, GOOD);
141+ return 0;
142+}
143+
138144 static inline u32 sbc_get_size(struct se_cmd *cmd, u32 sectors)
139145 {
140146 return cmd->se_dev->se_sub_dev->se_dev_attrib.block_size * sectors;
@@ -531,6 +537,18 @@ int sbc_parse_cdb(struct se_cmd *cmd, struct spc_ops *ops) · 390 unmodified lines
531537 size = 0;
532538 cmd->execute_cmd = sbc_emulate_verify;
533539 break;
540+ case REZERO_UNIT:
541+ case SEEK_6:
542+ case SEEK_10:
543+ /*
544+ * There are still clients out there which use these old SCSI-2
545+ * commands. This mainly happens when running VMs with legacy
546+ * guest systems, connected via SCSI command pass-through to
547+ * iSCSI targets. Make them happy and return status GOOD.
548+ */
549+ size = 0;
550+ cmd->execute_cmd = sbc_emulate_noop;
551+ break;
534552 default:
535553 ret = spc_parse_cdb(cmd, &size);
536554 if (ret)
drivers/target/target_core_spc.c+2−0
@@ -605,6 +605,8 @@ static int spc_emulate_inquiry(struct se_cmd *cmd) · 604 unmodified lines
605605 unsigned char buf[SE_INQUIRY_BUF];
606606 int p, ret;
607607
608+ memset(buf, 0, SE_INQUIRY_BUF);
609+
608610 if (dev == tpg->tpg_virt_lun0.lun_se_dev)
609611 buf[0] = 0x3f; /* Not connected */
610612 else
drivers/target/target_core_tmr.c+3−3
@@ -140,15 +140,15 @@ void core_tmr_abort_task( · 139 unmodified lines
140140 printk("ABORT_TASK: Found referenced %s task_tag: %u\n",
141141 se_cmd->se_tfo->get_fabric_name(), ref_tag);
142142
143− spin_lock_irq(&se_cmd->t_state_lock);
143+ spin_lock(&se_cmd->t_state_lock);
144144 if (se_cmd->transport_state & CMD_T_COMPLETE) {
145145 printk("ABORT_TASK: ref_tag: %u already complete, skipping\n", ref_tag);
146− spin_unlock_irq(&se_cmd->t_state_lock);
146+ spin_unlock(&se_cmd->t_state_lock);
147147 spin_unlock_irqrestore(&se_sess->sess_cmd_lock, flags);
148148 goto out;
149149 }
150150 se_cmd->transport_state |= CMD_T_ABORTED;
151− spin_unlock_irq(&se_cmd->t_state_lock);
151+ spin_unlock(&se_cmd->t_state_lock);
152152
153153 list_del_init(&se_cmd->se_cmd_list);
154154 kref_get(&se_cmd->cmd_kref);
drivers/target/target_core_transport.c+0−1
@@ -1616,7 +1616,6 @@ static void target_complete_tmr_failure(struct work_struct *work) · 1615 unmodified lines
16161616
16171617 se_cmd->se_tmr_req->response = TMR_LUN_DOES_NOT_EXIST;
16181618 se_cmd->se_tfo->queue_tm_rsp(se_cmd);
1619− transport_generic_free_cmd(se_cmd, 0);
16201619 }
16211620
16221621 /**
drivers/thermal/exynos_thermal.c+1−1
@@ -815,7 +815,7 @@ static struct platform_device_id exynos_tmu_driver_ids[] = { · 814 unmodified lines
815815 },
816816 { },
817817 };
818−MODULE_DEVICE_TABLE(platform, exynos4_tmu_driver_ids);
818+MODULE_DEVICE_TABLE(platform, exynos_tmu_driver_ids);
819819
820820 static inline struct exynos_tmu_platform_data *exynos_get_driver_data(
821821 struct platform_device *pdev)
drivers/thermal/rcar_thermal.c+1−1
@@ -210,7 +210,7 @@ static int rcar_thermal_probe(struct platform_device *pdev) · 209 unmodified lines
210210 goto error_free_priv;
211211 }
212212
213− zone = thermal_zone_device_register("rcar_thermal", 0, priv,
213+ zone = thermal_zone_device_register("rcar_thermal", 0, 0, priv,
214214 &rcar_thermal_zone_ops, 0, 0);
215215 if (IS_ERR(zone)) {
216216 dev_err(&pdev->dev, "thermal zone device is NULL\n");
drivers/usb/gadget/u_ether.c+2−1
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020 #include <linux/ctype.h>
2121 #include <linux/etherdevice.h>
2222 #include <linux/ethtool.h>
23+#include <linux/if_vlan.h>
2324
2425 #include "u_ether.h"
2526
@@ -295,7 +296,7 @@ static void rx_complete(struct usb_ep *ep, struct usb_request *req) · 269 unmodified lines
295296 while (skb2) {
296297 if (status < 0
297298 || ETH_HLEN > skb2->len
298− || skb2->len > ETH_FRAME_LEN) {
299+ || skb2->len > VLAN_ETH_FRAME_LEN) {
299300 dev->net->stats.rx_errors++;
300301 dev->net->stats.rx_length_errors++;
301302 DBG(dev, "rx length %d\n", skb2->len);
drivers/video/xen-fbfront.c+4−1
@@ -641,7 +641,6 @@ static void xenfb_backend_changed(struct xenbus_device *dev, · 640 unmodified lines
641641 case XenbusStateReconfiguring:
642642 case XenbusStateReconfigured:
643643 case XenbusStateUnknown:
644− case XenbusStateClosed:
645644 break;
646645
647646 case XenbusStateInitWait:
@@ -670,6 +669,10 @@ InitWait: · 22 unmodified lines
670669 info->feature_resize = val;
671670 break;
672671
672+ case XenbusStateClosed:
673+ if (dev->state == XenbusStateClosed)
674+ break;
675+ /* Missed the backend's CLOSING state -- fallthrough */
673676 case XenbusStateClosing:
674677 xenbus_frontend_closed(dev);
675678 break;
drivers/virtio/virtio.c+3−1
@@ -225,8 +225,10 @@ EXPORT_SYMBOL_GPL(register_virtio_device); · 224 unmodified lines
225225
226226 void unregister_virtio_device(struct virtio_device *dev)
227227 {
228+ int index = dev->index; /* save for after device release */
229+
228230 device_unregister(&dev->dev);
229− ida_simple_remove(&virtio_index_ida, dev->index);
231+ ida_simple_remove(&virtio_index_ida, index);
230232 }
231233 EXPORT_SYMBOL_GPL(unregister_virtio_device);
232234
drivers/xen/Makefile+1−0
@@ -2,6 +2,7 @@ ifneq ($(CONFIG_ARM),y) · 1 unmodified line
22 obj-y += manage.o balloon.o
33 obj-$(CONFIG_HOTPLUG_CPU) += cpu_hotplug.o
44 endif
5+obj-$(CONFIG_X86) += fallback.o
56 obj-y += grant-table.o features.o events.o
67 obj-y += xenbus/
78
drivers/xen/events.c+1−1
@@ -1395,10 +1395,10 @@ void xen_evtchn_do_upcall(struct pt_regs *regs) · 1394 unmodified lines
13951395 {
13961396 struct pt_regs *old_regs = set_irq_regs(regs);
13971397
1398+ irq_enter();
13981399 #ifdef CONFIG_X86
13991400 exit_idle();
14001401 #endif
1401− irq_enter();
14021402
14031403 __xen_evtchn_do_upcall();
14041404
drivers/xen/fallback.c+80−0
@@ -0,0 +1,80 @@
1+#include <linux/kernel.h>
2+#include <linux/string.h>
3+#include <linux/bug.h>
4+#include <linux/export.h>
5+#include <asm/hypervisor.h>
6+#include <asm/xen/hypercall.h>
7+
8+int xen_event_channel_op_compat(int cmd, void *arg)
9+{
10+ struct evtchn_op op;
11+ int rc;
12+
13+ op.cmd = cmd;
14+ memcpy(&op.u, arg, sizeof(op.u));
15+ rc = _hypercall1(int, event_channel_op_compat, &op);
16+
17+ switch (cmd) {
18+ case EVTCHNOP_close:
19+ case EVTCHNOP_send:
20+ case EVTCHNOP_bind_vcpu:
21+ case EVTCHNOP_unmask:
22+ /* no output */
23+ break;
24+
25+#define COPY_BACK(eop) \
26+ case EVTCHNOP_##eop: \
27+ memcpy(arg, &op.u.eop, sizeof(op.u.eop)); \
28+ break
29+
30+ COPY_BACK(bind_interdomain);
31+ COPY_BACK(bind_virq);
32+ COPY_BACK(bind_pirq);
33+ COPY_BACK(status);
34+ COPY_BACK(alloc_unbound);
35+ COPY_BACK(bind_ipi);
36+#undef COPY_BACK
37+
38+ default:
39+ WARN_ON(rc != -ENOSYS);
40+ break;
41+ }
42+
43+ return rc;
44+}
45+EXPORT_SYMBOL_GPL(xen_event_channel_op_compat);
46+
47+int HYPERVISOR_physdev_op_compat(int cmd, void *arg)
48+{
49+ struct physdev_op op;
50+ int rc;
51+
52+ op.cmd = cmd;
53+ memcpy(&op.u, arg, sizeof(op.u));
54+ rc = _hypercall1(int, physdev_op_compat, &op);
55+
56+ switch (cmd) {
57+ case PHYSDEVOP_IRQ_UNMASK_NOTIFY:
58+ case PHYSDEVOP_set_iopl:
59+ case PHYSDEVOP_set_iobitmap:
60+ case PHYSDEVOP_apic_write:
61+ /* no output */
62+ break;
63+
64+#define COPY_BACK(pop, fld) \
65+ case PHYSDEVOP_##pop: \
66+ memcpy(arg, &op.u.fld, sizeof(op.u.fld)); \
67+ break
68+
69+ COPY_BACK(irq_status_query, irq_status_query);
70+ COPY_BACK(apic_read, apic_op);
71+ COPY_BACK(ASSIGN_VECTOR, irq_op);
72+#undef COPY_BACK
73+
74+ default:
75+ WARN_ON(rc != -ENOSYS);
76+ break;
77+ }
78+
79+ return rc;
80+}
drivers/xen/gntdev.c+19−17
@@ -105,6 +105,21 @@ static void gntdev_print_maps(struct gntdev_priv *priv, · 104 unmodified lines
105105 #endif
106106 }
107107
108+static void gntdev_free_map(struct grant_map *map)
109+{
110+ if (map == NULL)
111+ return;
112+
113+ if (map->pages)
114+ free_xenballooned_pages(map->count, map->pages);
115+ kfree(map->pages);
116+ kfree(map->grants);
117+ kfree(map->map_ops);
118+ kfree(map->unmap_ops);
119+ kfree(map->kmap_ops);
120+ kfree(map);
121+}
122+
108123 static struct grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count)
109124 {
110125 struct grant_map *add;
@@ -142,12 +157,7 @@ static struct grant_map *gntdev_alloc_map(struct gntdev_priv *priv, int count) · 31 unmodified lines
142157 return add;
143158
144159 err:
145− kfree(add->pages);
146− kfree(add->grants);
147− kfree(add->map_ops);
148− kfree(add->unmap_ops);
149− kfree(add->kmap_ops);
150− kfree(add);
160+ gntdev_free_map(add);
151161 return NULL;
152162 }
153163
@@ -198,17 +208,9 @@ static void gntdev_put_map(struct grant_map *map) · 44 unmodified lines
198208 evtchn_put(map->notify.event);
199209 }
200210
201− if (map->pages) {
202− if (!use_ptemod)
203− unmap_grant_pages(map, 0, map->count);
204−
205− free_xenballooned_pages(map->count, map->pages);
206− }
207− kfree(map->pages);
208− kfree(map->grants);
209− kfree(map->map_ops);
210− kfree(map->unmap_ops);
211− kfree(map);
211+ if (map->pages && !use_ptemod)
212+ unmap_grant_pages(map, 0, map->count);
213+ gntdev_free_map(map);
212214 }
213215
214216 /* ------------------------------------------------------------------ */
drivers/xen/xenbus/xenbus_dev_frontend.c+1−1
@@ -458,7 +458,7 @@ static ssize_t xenbus_file_write(struct file *filp, · 457 unmodified lines
458458 goto out;
459459
460460 /* Can't write a xenbus message larger we can buffer */
461− if ((len + u->len) > sizeof(u->u.buffer)) {
461+ if (len > sizeof(u->u.buffer) - u->len) {
462462 /* On error, dump existing buffer */
463463 u->len = 0;
464464 rc = -EINVAL;
fs/bio.c+4−2
@@ -75,6 +75,7 @@ static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size) · 74 unmodified lines
7575 unsigned int sz = sizeof(struct bio) + extra_size;
7676 struct kmem_cache *slab = NULL;
7777 struct bio_slab *bslab, *new_bio_slabs;
78+ unsigned int new_bio_slab_max;
7879 unsigned int i, entry = -1;
7980
8081 mutex_lock(&bio_slab_lock);
@@ -97,12 +98,13 @@ static struct kmem_cache *bio_find_or_create_slab(unsigned int extra_size) · 16 unmodified lines
9798 goto out_unlock;
9899
99100 if (bio_slab_nr == bio_slab_max && entry == -1) {
100− bio_slab_max <<= 1;
101+ new_bio_slab_max = bio_slab_max << 1;
101102 new_bio_slabs = krealloc(bio_slabs,
102− bio_slab_max * sizeof(struct bio_slab),
103+ new_bio_slab_max * sizeof(struct bio_slab),
103104 GFP_KERNEL);
104105 if (!new_bio_slabs)
105106 goto out_unlock;
107+ bio_slab_max = new_bio_slab_max;
106108 bio_slabs = new_bio_slabs;
107109 }
108110 if (entry == -1)
fs/ceph/export.c+2−0
@@ -90,6 +90,8 @@ static int ceph_encode_fh(struct inode *inode, u32 *rawfh, int *max_len, · 89 unmodified lines
9090 *max_len = handle_length;
9191 type = 255;
9292 }
93+ if (dentry)
94+ dput(dentry);
9395 return type;
9496 }
9597
fs/cifs/cifsacl.c+20−29
@@ -224,6 +224,13 @@ sid_to_str(struct cifs_sid *sidptr, char *sidstr) · 223 unmodified lines
224224 }
225225 }
226226
227+static void
228+cifs_copy_sid(struct cifs_sid *dst, const struct cifs_sid *src)
229+{
230+ memcpy(dst, src, sizeof(*dst));
231+ dst->num_subauth = min_t(u8, src->num_subauth, NUM_SUBAUTHS);
232+}
233+
227234 static void
228235 id_rb_insert(struct rb_root *root, struct cifs_sid *sidptr,
229236 struct cifs_sid_id **psidid, char *typestr)
@@ -248,7 +255,7 @@ id_rb_insert(struct rb_root *root, struct cifs_sid *sidptr, · 18 unmodified lines
248255 }
249256 }
250257
251− memcpy(&(*psidid)->sid, sidptr, sizeof(struct cifs_sid));
258+ cifs_copy_sid(&(*psidid)->sid, sidptr);
252259 (*psidid)->time = jiffies - (SID_MAP_RETRY + 1);
253260 (*psidid)->refcount = 0;
254261
@@ -354,7 +361,7 @@ id_to_sid(unsigned long cid, uint sidtype, struct cifs_sid *ssid) · 99 unmodified lines
354361 * any fields of the node after a reference is put .
355362 */
356363 if (test_bit(SID_ID_MAPPED, &psidid->state)) {
357− memcpy(ssid, &psidid->sid, sizeof(struct cifs_sid));
364+ cifs_copy_sid(ssid, &psidid->sid);
358365 psidid->time = jiffies; /* update ts for accessing */
359366 goto id_sid_out;
360367 }
@@ -370,14 +377,14 @@ id_to_sid(unsigned long cid, uint sidtype, struct cifs_sid *ssid) · 9 unmodified lines
370377 if (IS_ERR(sidkey)) {
371378 rc = -EINVAL;
372379 cFYI(1, "%s: Can't map and id to a SID", __func__);
380+ } else if (sidkey->datalen < sizeof(struct cifs_sid)) {
381+ rc = -EIO;
382+ cFYI(1, "%s: Downcall contained malformed key "
383+ "(datalen=%hu)", __func__, sidkey->datalen);
373384 } else {
374385 lsid = (struct cifs_sid *)sidkey->payload.data;
375− memcpy(&psidid->sid, lsid,
376− sidkey->datalen < sizeof(struct cifs_sid) ?
377− sidkey->datalen : sizeof(struct cifs_sid));
378− memcpy(ssid, &psidid->sid,
379− sidkey->datalen < sizeof(struct cifs_sid) ?
380− sidkey->datalen : sizeof(struct cifs_sid));
386+ cifs_copy_sid(&psidid->sid, lsid);
387+ cifs_copy_sid(ssid, &psidid->sid);
381388 set_bit(SID_ID_MAPPED, &psidid->state);
382389 key_put(sidkey);
383390 kfree(psidid->sidstr);
@@ -396,7 +403,7 @@ id_to_sid(unsigned long cid, uint sidtype, struct cifs_sid *ssid) · 12 unmodified lines
396403 return rc;
397404 }
398405 if (test_bit(SID_ID_MAPPED, &psidid->state))
399− memcpy(ssid, &psidid->sid, sizeof(struct cifs_sid));
406+ cifs_copy_sid(ssid, &psidid->sid);
400407 else
401408 rc = -EINVAL;
402409 }
@@ -675,8 +682,6 @@ int compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid) · 272 unmodified lines
675682 static void copy_sec_desc(const struct cifs_ntsd *pntsd,
676683 struct cifs_ntsd *pnntsd, __u32 sidsoffset)
677684 {
678− int i;
679−
680685 struct cifs_sid *owner_sid_ptr, *group_sid_ptr;
681686 struct cifs_sid *nowner_sid_ptr, *ngroup_sid_ptr;
682687
@@ -692,26 +697,14 @@ static void copy_sec_desc(const struct cifs_ntsd *pntsd, · 9 unmodified lines
692697 owner_sid_ptr = (struct cifs_sid *)((char *)pntsd +
693698 le32_to_cpu(pntsd->osidoffset));
694699 nowner_sid_ptr = (struct cifs_sid *)((char *)pnntsd + sidsoffset);
695−
696− nowner_sid_ptr->revision = owner_sid_ptr->revision;
697− nowner_sid_ptr->num_subauth = owner_sid_ptr->num_subauth;
698− for (i = 0; i < 6; i++)
699− nowner_sid_ptr->authority[i] = owner_sid_ptr->authority[i];
700− for (i = 0; i < 5; i++)
701− nowner_sid_ptr->sub_auth[i] = owner_sid_ptr->sub_auth[i];
700+ cifs_copy_sid(nowner_sid_ptr, owner_sid_ptr);
702701
703702 /* copy group sid */
704703 group_sid_ptr = (struct cifs_sid *)((char *)pntsd +
705704 le32_to_cpu(pntsd->gsidoffset));
706705 ngroup_sid_ptr = (struct cifs_sid *)((char *)pnntsd + sidsoffset +
707706 sizeof(struct cifs_sid));
708−
709− ngroup_sid_ptr->revision = group_sid_ptr->revision;
710− ngroup_sid_ptr->num_subauth = group_sid_ptr->num_subauth;
711− for (i = 0; i < 6; i++)
712− ngroup_sid_ptr->authority[i] = group_sid_ptr->authority[i];
713− for (i = 0; i < 5; i++)
714− ngroup_sid_ptr->sub_auth[i] = group_sid_ptr->sub_auth[i];
707+ cifs_copy_sid(ngroup_sid_ptr, group_sid_ptr);
715708
716709 return;
717710 }
@@ -1120,8 +1113,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd, · 402 unmodified lines
11201113 kfree(nowner_sid_ptr);
11211114 return rc;
11221115 }
1123− memcpy(owner_sid_ptr, nowner_sid_ptr,
1124− sizeof(struct cifs_sid));
1116+ cifs_copy_sid(owner_sid_ptr, nowner_sid_ptr);
11251117 kfree(nowner_sid_ptr);
11261118 *aclflag = CIFS_ACL_OWNER;
11271119 }
@@ -1139,8 +1131,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd, · 11 unmodified lines
11391131 kfree(ngroup_sid_ptr);
11401132 return rc;
11411133 }
1142− memcpy(group_sid_ptr, ngroup_sid_ptr,
1143− sizeof(struct cifs_sid));
1134+ cifs_copy_sid(group_sid_ptr, ngroup_sid_ptr);
11441135 kfree(ngroup_sid_ptr);
11451136 *aclflag = CIFS_ACL_GROUP;
11461137 }
fs/cifs/dir.c+10−1
@@ -398,7 +398,16 @@ cifs_atomic_open(struct inode *inode, struct dentry *direntry, · 397 unmodified lines
398398 * in network traffic in the other paths.
399399 */
400400 if (!(oflags & O_CREAT)) {
401− struct dentry *res = cifs_lookup(inode, direntry, 0);
401+ struct dentry *res;
402+
403+ /*
404+ * Check for hashed negative dentry. We have already revalidated
405+ * the dentry and it is fine. No need to perform another lookup.
406+ */
407+ if (!d_unhashed(direntry))
408+ return -ENOENT;
409+
410+ res = cifs_lookup(inode, direntry, 0);
402411 if (IS_ERR(res))
403412 return PTR_ERR(res);
404413
fs/eventpoll.c+3−35
@@ -346,7 +346,7 @@ static inline struct epitem *ep_item_from_epqueue(poll_table *p) · 345 unmodified lines
346346 /* Tells if the epoll_ctl(2) operation needs an event copy from userspace */
347347 static inline int ep_op_has_event(int op)
348348 {
349− return op == EPOLL_CTL_ADD || op == EPOLL_CTL_MOD;
349+ return op != EPOLL_CTL_DEL;
350350 }
351351
352352 /* Initialize the poll safe wake up structure */
@@ -676,34 +676,6 @@ static int ep_remove(struct eventpoll *ep, struct epitem *epi) · 323 unmodified lines
676676 return 0;
677677 }
678678
679−/*
680− * Disables a "struct epitem" in the eventpoll set. Returns -EBUSY if the item
681− * had no event flags set, indicating that another thread may be currently
682− * handling that item's events (in the case that EPOLLONESHOT was being
683− * used). Otherwise a zero result indicates that the item has been disabled
684− * from receiving events. A disabled item may be re-enabled via
685− * EPOLL_CTL_MOD. Must be called with "mtx" held.
686− */
687−static int ep_disable(struct eventpoll *ep, struct epitem *epi)
688−{
689− int result = 0;
690− unsigned long flags;
691−
692− spin_lock_irqsave(&ep->lock, flags);
693− if (epi->event.events & ~EP_PRIVATE_BITS) {
694− if (ep_is_linked(&epi->rdllink))
695− list_del_init(&epi->rdllink);
696− /* Ensure ep_poll_callback will not add epi back onto ready
697− list: */
698− epi->event.events &= EP_PRIVATE_BITS;
699− }
700− else
701− result = -EBUSY;
702− spin_unlock_irqrestore(&ep->lock, flags);
703−
704− return result;
705−}
706−
707679 static void ep_free(struct eventpoll *ep)
708680 {
709681 struct rb_node *rbp;
@@ -1048,6 +1020,8 @@ static void ep_rbtree_insert(struct eventpoll *ep, struct epitem *epi) · 338 unmodified lines
10481020 rb_insert_color(&epi->rbn, &ep->rbr);
10491021 }
10501022
1023+
1024+
10511025 #define PATH_ARR_SIZE 5
10521026 /*
10531027 * These are the number paths of length 1 to 5, that we are allowing to emanate
@@ -1813,12 +1787,6 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, · 759 unmodified lines
18131787 } else
18141788 error = -ENOENT;
18151789 break;
1816− case EPOLL_CTL_DISABLE:
1817− if (epi)
1818− error = ep_disable(ep, epi);
1819− else
1820− error = -ENOENT;
1821− break;
18221790 }
18231791 mutex_unlock(&ep->mtx);
18241792
fs/ext4/ialloc.c+9−10
@@ -725,6 +725,10 @@ repeat_in_this_group: · 724 unmodified lines
725725 "inode=%lu", ino + 1);
726726 continue;
727727 }
728+ BUFFER_TRACE(inode_bitmap_bh, "get_write_access");
729+ err = ext4_journal_get_write_access(handle, inode_bitmap_bh);
730+ if (err)
731+ goto fail;
728732 ext4_lock_group(sb, group);
729733 ret2 = ext4_test_and_set_bit(ino, inode_bitmap_bh->b_data);
730734 ext4_unlock_group(sb, group);
@@ -738,6 +742,11 @@ repeat_in_this_group: · 7 unmodified lines
738742 goto out;
739743
740744 got:
745+ BUFFER_TRACE(inode_bitmap_bh, "call ext4_handle_dirty_metadata");
746+ err = ext4_handle_dirty_metadata(handle, NULL, inode_bitmap_bh);
747+ if (err)
748+ goto fail;
749+
741750 /* We may have to initialize the block bitmap if it isn't already */
742751 if (ext4_has_group_desc_csum(sb) &&
743752 gdp->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
@@ -771,11 +780,6 @@ got: · 27 unmodified lines
771780 goto fail;
772781 }
773782
774− BUFFER_TRACE(inode_bitmap_bh, "get_write_access");
775− err = ext4_journal_get_write_access(handle, inode_bitmap_bh);
776− if (err)
777− goto fail;
778−
779783 BUFFER_TRACE(group_desc_bh, "get_write_access");
780784 err = ext4_journal_get_write_access(handle, group_desc_bh);
781785 if (err)
@@ -823,11 +827,6 @@ got: · 41 unmodified lines
823827 }
824828 ext4_unlock_group(sb, group);
825829
826− BUFFER_TRACE(inode_bitmap_bh, "call ext4_handle_dirty_metadata");
827− err = ext4_handle_dirty_metadata(handle, NULL, inode_bitmap_bh);
828− if (err)
829− goto fail;
830−
831830 BUFFER_TRACE(group_desc_bh, "call ext4_handle_dirty_metadata");
832831 err = ext4_handle_dirty_metadata(handle, NULL, group_desc_bh);
833832 if (err)
fs/file.c+2−2
@@ -900,7 +900,7 @@ int replace_fd(unsigned fd, struct file *file, unsigned flags) · 899 unmodified lines
900900 return __close_fd(files, fd);
901901
902902 if (fd >= rlimit(RLIMIT_NOFILE))
903− return -EMFILE;
903+ return -EBADF;
904904
905905 spin_lock(&files->file_lock);
906906 err = expand_files(files, fd);
@@ -926,7 +926,7 @@ SYSCALL_DEFINE3(dup3, unsigned int, oldfd, unsigned int, newfd, int, flags) · 19 unmodified lines
926926 return -EINVAL;
927927
928928 if (newfd >= rlimit(RLIMIT_NOFILE))
929− return -EMFILE;
929+ return -EBADF;
930930
931931 spin_lock(&files->file_lock);
932932 err = expand_files(files, newfd);
fs/gfs2/file.c+5−9
@@ -516,15 +516,13 @@ static int gfs2_mmap(struct file *file, struct vm_area_struct *vma) · 515 unmodified lines
516516 struct gfs2_holder i_gh;
517517 int error;
518518
519− gfs2_holder_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh);
520− error = gfs2_glock_nq(&i_gh);
521− if (error == 0) {
522− file_accessed(file);
523− gfs2_glock_dq(&i_gh);
524− }
525− gfs2_holder_uninit(&i_gh);
519+ error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY,
520+ &i_gh);
526521 if (error)
527522 return error;
523+ /* grab lock to update inode */
524+ gfs2_glock_dq_uninit(&i_gh);
525+ file_accessed(file);
528526 }
529527 vma->vm_ops = &gfs2_vm_ops;
530528
@@ -677,10 +675,8 @@ static ssize_t gfs2_file_aio_write(struct kiocb *iocb, const struct iovec *iov, · 146 unmodified lines
677675 size_t writesize = iov_length(iov, nr_segs);
678676 struct dentry *dentry = file->f_dentry;
679677 struct gfs2_inode *ip = GFS2_I(dentry->d_inode);
680− struct gfs2_sbd *sdp;
681678 int ret;
682679
683− sdp = GFS2_SB(file->f_mapping->host);
684680 ret = gfs2_rs_alloc(ip);
685681 if (ret)
686682 return ret;
fs/gfs2/lops.c+2−14
@@ -393,12 +393,10 @@ static void buf_lo_add(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd) · 392 unmodified lines
393393 struct gfs2_meta_header *mh;
394394 struct gfs2_trans *tr;
395395
396− lock_buffer(bd->bd_bh);
397− gfs2_log_lock(sdp);
398396 tr = current->journal_info;
399397 tr->tr_touched = 1;
400398 if (!list_empty(&bd->bd_list))
401− goto out;
399+ return;
402400 set_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags);
403401 set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags);
404402 mh = (struct gfs2_meta_header *)bd->bd_bh->b_data;
@@ -414,9 +412,6 @@ static void buf_lo_add(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd) · 9 unmodified lines
414412 sdp->sd_log_num_buf++;
415413 list_add(&bd->bd_list, &sdp->sd_log_le_buf);
416414 tr->tr_num_buf_new++;
417−out:
418− gfs2_log_unlock(sdp);
419− unlock_buffer(bd->bd_bh);
420415 }
421416
422417 static void gfs2_check_magic(struct buffer_head *bh)
@@ -621,7 +616,6 @@ static void revoke_lo_add(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd) · 198 unmodified lines
621616
622617 static void revoke_lo_before_commit(struct gfs2_sbd *sdp)
623618 {
624− struct gfs2_log_descriptor *ld;
625619 struct gfs2_meta_header *mh;
626620 unsigned int offset;
627621 struct list_head *head = &sdp->sd_log_le_revoke;
@@ -634,7 +628,6 @@ static void revoke_lo_before_commit(struct gfs2_sbd *sdp) · 6 unmodified lines
634628
635629 length = gfs2_struct2blk(sdp, sdp->sd_log_num_revoke, sizeof(u64));
636630 page = gfs2_get_log_desc(sdp, GFS2_LOG_DESC_REVOKE, length, sdp->sd_log_num_revoke);
637− ld = page_address(page);
638631 offset = sizeof(struct gfs2_log_descriptor);
639632
640633 list_for_each_entry(bd, head, bd_list) {
@@ -777,12 +770,10 @@ static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd) · 136 unmodified lines
777770 struct address_space *mapping = bd->bd_bh->b_page->mapping;
778771 struct gfs2_inode *ip = GFS2_I(mapping->host);
779772
780− lock_buffer(bd->bd_bh);
781− gfs2_log_lock(sdp);
782773 if (tr)
783774 tr->tr_touched = 1;
784775 if (!list_empty(&bd->bd_list))
785− goto out;
776+ return;
786777 set_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags);
787778 set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags);
788779 if (gfs2_is_jdata(ip)) {
@@ -793,9 +784,6 @@ static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd) · 4 unmodified lines
793784 } else {
794785 list_add_tail(&bd->bd_list, &sdp->sd_log_le_ordered);
795786 }
796−out:
797− gfs2_log_unlock(sdp);
798− unlock_buffer(bd->bd_bh);
799787 }
800788
801789 /**
fs/gfs2/quota.c+5−2
@@ -497,8 +497,11 @@ int gfs2_quota_hold(struct gfs2_inode *ip, u32 uid, u32 gid) · 496 unmodified lines
497497 struct gfs2_quota_data **qd;
498498 int error;
499499
500− if (ip->i_res == NULL)
501− gfs2_rs_alloc(ip);
500+ if (ip->i_res == NULL) {
501+ error = gfs2_rs_alloc(ip);
502+ if (error)
503+ return error;
504+ }
502505
503506 qd = ip->i_res->rs_qa_qd;
504507
fs/gfs2/rgrp.c+21−12
@@ -553,7 +553,6 @@ void gfs2_free_clones(struct gfs2_rgrpd *rgd) · 552 unmodified lines
553553 */
554554 int gfs2_rs_alloc(struct gfs2_inode *ip)
555555 {
556− int error = 0;
557556 struct gfs2_blkreserv *res;
558557
559558 if (ip->i_res)
@@ -561,7 +560,7 @@ int gfs2_rs_alloc(struct gfs2_inode *ip) · 1 unmodified line
561560
562561 res = kmem_cache_zalloc(gfs2_rsrv_cachep, GFP_NOFS);
563562 if (!res)
564− error = -ENOMEM;
563+ return -ENOMEM;
565564
566565 RB_CLEAR_NODE(&res->rs_node);
567566
@@ -571,7 +570,7 @@ int gfs2_rs_alloc(struct gfs2_inode *ip) · 3 unmodified lines
571570 else
572571 ip->i_res = res;
573572 up_write(&ip->i_rw_mutex);
574− return error;
573+ return 0;
575574 }
576575
577576 static void dump_rs(struct seq_file *seq, const struct gfs2_blkreserv *rs)
@@ -1263,7 +1262,9 @@ int gfs2_fitrim(struct file *filp, void __user *argp) · 685 unmodified lines
12631262 int ret = 0;
12641263 u64 amt;
12651264 u64 trimmed = 0;
1265+ u64 start, end, minlen;
12661266 unsigned int x;
1267+ unsigned bs_shift = sdp->sd_sb.sb_bsize_shift;
12671268
12681269 if (!capable(CAP_SYS_ADMIN))
12691270 return -EPERM;
@@ -1271,19 +1272,25 @@ int gfs2_fitrim(struct file *filp, void __user *argp) · 1 unmodified line
12711272 if (!blk_queue_discard(q))
12721273 return -EOPNOTSUPP;
12731274
1274− if (argp == NULL) {
1275− r.start = 0;
1276− r.len = ULLONG_MAX;
1277− r.minlen = 0;
1278− } else if (copy_from_user(&r, argp, sizeof(r)))
1275+ if (copy_from_user(&r, argp, sizeof(r)))
12791276 return -EFAULT;
12801277
12811278 ret = gfs2_rindex_update(sdp);
12821279 if (ret)
12831280 return ret;
12841281
1285− rgd = gfs2_blk2rgrpd(sdp, r.start, 0);
1286− rgd_end = gfs2_blk2rgrpd(sdp, r.start + r.len, 0);
1282+ start = r.start >> bs_shift;
1283+ end = start + (r.len >> bs_shift);
1284+ minlen = max_t(u64, r.minlen,
1285+ q->limits.discard_granularity) >> bs_shift;
1286+
1287+ rgd = gfs2_blk2rgrpd(sdp, start, 0);
1288+ rgd_end = gfs2_blk2rgrpd(sdp, end - 1, 0);
1289+
1290+ if (end <= start ||
1291+ minlen > sdp->sd_max_rg_data ||
1292+ start > rgd_end->rd_data0 + rgd_end->rd_data)
1293+ return -EINVAL;
12871294
12881295 while (1) {
12891296
@@ -1295,7 +1302,9 @@ int gfs2_fitrim(struct file *filp, void __user *argp) · 5 unmodified lines
12951302 /* Trim each bitmap in the rgrp */
12961303 for (x = 0; x < rgd->rd_length; x++) {
12971304 struct gfs2_bitmap *bi = rgd->rd_bits + x;
1298− ret = gfs2_rgrp_send_discards(sdp, rgd->rd_data0, NULL, bi, r.minlen, &amt);
1305+ ret = gfs2_rgrp_send_discards(sdp,
1306+ rgd->rd_data0, NULL, bi, minlen,
1307+ &amt);
12991308 if (ret) {
13001309 gfs2_glock_dq_uninit(&gh);
13011310 goto out;
@@ -1324,7 +1333,7 @@ int gfs2_fitrim(struct file *filp, void __user *argp) · 22 unmodified lines
13241333
13251334 out:
13261335 r.len = trimmed << 9;
1327− if (argp && copy_to_user(argp, &r, sizeof(r)))
1336+ if (copy_to_user(argp, &r, sizeof(r)))
13281337 return -EFAULT;
13291338
13301339 return ret;
fs/gfs2/super.c+2−1
@@ -810,7 +810,8 @@ static void gfs2_dirty_inode(struct inode *inode, int flags) · 809 unmodified lines
810810 return;
811811 }
812812 need_unlock = 1;
813− }
813+ } else if (WARN_ON_ONCE(ip->i_gl->gl_state != LM_ST_EXCLUSIVE))
814+ return;
814815
815816 if (current->journal_info == NULL) {
816817 ret = gfs2_trans_begin(sdp, RES_DINODE, 0);
fs/gfs2/trans.c+8−0
@@ -155,14 +155,22 @@ void gfs2_trans_add_bh(struct gfs2_glock *gl, struct buffer_head *bh, int meta) · 154 unmodified lines
155155 struct gfs2_sbd *sdp = gl->gl_sbd;
156156 struct gfs2_bufdata *bd;
157157
158+ lock_buffer(bh);
159+ gfs2_log_lock(sdp);
158160 bd = bh->b_private;
159161 if (bd)
160162 gfs2_assert(sdp, bd->bd_gl == gl);
161163 else {
164+ gfs2_log_unlock(sdp);
165+ unlock_buffer(bh);
162166 gfs2_attach_bufdata(gl, bh, meta);
163167 bd = bh->b_private;
168+ lock_buffer(bh);
169+ gfs2_log_lock(sdp);
164170 }
165171 lops_add(sdp, bd);
172+ gfs2_log_unlock(sdp);
173+ unlock_buffer(bh);
166174 }
167175
168176 void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)
fs/nfs/dns_resolve.c+3−2
@@ -217,7 +217,7 @@ static int nfs_dns_parse(struct cache_detail *cd, char *buf, int buflen) · 216 unmodified lines
217217 {
218218 char buf1[NFS_DNS_HOSTNAME_MAXLEN+1];
219219 struct nfs_dns_ent key, *item;
220− unsigned long ttl;
220+ unsigned int ttl;
221221 ssize_t len;
222222 int ret = -EINVAL;
223223
@@ -240,7 +240,8 @@ static int nfs_dns_parse(struct cache_detail *cd, char *buf, int buflen) · 16 unmodified lines
240240 key.namelen = len;
241241 memset(&key.h, 0, sizeof(key.h));
242242
243− ttl = get_expiry(&buf);
243+ if (get_uint(&buf, &ttl) < 0)
244+ goto out;
244245 if (ttl == 0)
245246 goto out;
246247 key.h.expiry_time = ttl + seconds_since_boot();
fs/nfs/inode.c+4−1
@@ -685,7 +685,10 @@ static void __put_nfs_open_context(struct nfs_open_context *ctx, int is_sync) · 684 unmodified lines
685685 if (ctx->cred != NULL)
686686 put_rpccred(ctx->cred);
687687 dput(ctx->dentry);
688− nfs_sb_deactive(sb);
688+ if (is_sync)
689+ nfs_sb_deactive(sb);
690+ else
691+ nfs_sb_deactive_async(sb);
689692 kfree(ctx->mdsthreshold);
690693 kfree(ctx);
691694 }
fs/nfs/internal.h+4−2
@@ -351,10 +351,12 @@ extern int __init register_nfs_fs(void); · 350 unmodified lines
351351 extern void __exit unregister_nfs_fs(void);
352352 extern void nfs_sb_active(struct super_block *sb);
353353 extern void nfs_sb_deactive(struct super_block *sb);
354+extern void nfs_sb_deactive_async(struct super_block *sb);
354355
355356 /* namespace.c */
357+#define NFS_PATH_CANONICAL 1
356358 extern char *nfs_path(char **p, struct dentry *dentry,
357− char *buffer, ssize_t buflen);
359+ char *buffer, ssize_t buflen, unsigned flags);
358360 extern struct vfsmount *nfs_d_automount(struct path *path);
359361 struct vfsmount *nfs_submount(struct nfs_server *, struct dentry *,
360362 struct nfs_fh *, struct nfs_fattr *);
@@ -498,7 +500,7 @@ static inline char *nfs_devname(struct dentry *dentry, · 137 unmodified lines
498500 char *buffer, ssize_t buflen)
499501 {
500502 char *dummy;
501− return nfs_path(&dummy, dentry, buffer, buflen);
503+ return nfs_path(&dummy, dentry, buffer, buflen, NFS_PATH_CANONICAL);
502504 }
503505
504506 /*
fs/nfs/mount_clnt.c+1−1
@@ -181,7 +181,7 @@ int nfs_mount(struct nfs_mount_request *info) · 180 unmodified lines
181181 else
182182 msg.rpc_proc = &mnt_clnt->cl_procinfo[MOUNTPROC_MNT];
183183
184− status = rpc_call_sync(mnt_clnt, &msg, 0);
184+ status = rpc_call_sync(mnt_clnt, &msg, RPC_TASK_SOFT|RPC_TASK_TIMEOUT);
185185 rpc_shutdown_client(mnt_clnt);
186186
187187 if (status < 0)
fs/nfs/namespace.c+14−5
@@ -33,6 +33,7 @@ int nfs_mountpoint_expiry_timeout = 500 * HZ; · 32 unmodified lines
3333 * @dentry - pointer to dentry
3434 * @buffer - result buffer
3535 * @buflen - length of buffer
36+ * @flags - options (see below)
3637 *
3738 * Helper function for constructing the server pathname
3839 * by arbitrary hashed dentry.
@@ -40,8 +41,14 @@ int nfs_mountpoint_expiry_timeout = 500 * HZ; · 1 unmodified line
4041 * This is mainly for use in figuring out the path on the
4142 * server side when automounting on top of an existing partition
4243 * and in generating /proc/mounts and friends.
44+ *
45+ * Supported flags:
46+ * NFS_PATH_CANONICAL: ensure there is exactly one slash after
47+ * the original device (export) name
48+ * (if unset, the original name is returned verbatim)
4349 */
44−char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen)
50+char *nfs_path(char **p, struct dentry *dentry, char *buffer, ssize_t buflen,
51+ unsigned flags)
4552 {
4653 char *end;
4754 int namelen;
@@ -74,7 +81,7 @@ rename_retry: · 26 unmodified lines
7481 rcu_read_unlock();
7582 goto rename_retry;
7683 }
77− if (*end != '/') {
84+ if ((flags & NFS_PATH_CANONICAL) && *end != '/') {
7885 if (--buflen < 0) {
7986 spin_unlock(&dentry->d_lock);
8087 rcu_read_unlock();
@@ -91,9 +98,11 @@ rename_retry: · 10 unmodified lines
9198 return end;
9299 }
93100 namelen = strlen(base);
94− /* Strip off excess slashes in base string */
95− while (namelen > 0 && base[namelen - 1] == '/')
96− namelen--;
101+ if (flags & NFS_PATH_CANONICAL) {
102+ /* Strip off excess slashes in base string */
103+ while (namelen > 0 && base[namelen - 1] == '/')
104+ namelen--;
105+ }
97106 buflen -= namelen;
98107 if (buflen < 0) {
99108 spin_unlock(&dentry->d_lock);
fs/nfs/nfs4namespace.c+2−1
@@ -81,7 +81,8 @@ static char *nfs_path_component(const char *nfspath, const char *end) · 80 unmodified lines
8181 static char *nfs4_path(struct dentry *dentry, char *buffer, ssize_t buflen)
8282 {
8383 char *limit;
84− char *path = nfs_path(&limit, dentry, buffer, buflen);
84+ char *path = nfs_path(&limit, dentry, buffer, buflen,
85+ NFS_PATH_CANONICAL);
8586 if (!IS_ERR(path)) {
8687 char *path_component = nfs_path_component(path, limit);
8788 if (path_component)
fs/nfs/nfs4proc.c+28−18
@@ -339,8 +339,7 @@ static int nfs4_handle_exception(struct nfs_server *server, int errorcode, struc · 338 unmodified lines
339339 dprintk("%s ERROR: %d Reset session\n", __func__,
340340 errorcode);
341341 nfs4_schedule_session_recovery(clp->cl_session, errorcode);
342− exception->retry = 1;
343− break;
342+ goto wait_on_recovery;
344343 #endif /* defined(CONFIG_NFS_V4_1) */
345344 case -NFS4ERR_FILE_OPEN:
346345 if (exception->timeout > HZ) {
@@ -1572,9 +1571,11 @@ static void nfs4_open_prepare(struct rpc_task *task, void *calldata) · 1225 unmodified lines
15721571 data->timestamp = jiffies;
15731572 if (nfs4_setup_sequence(data->o_arg.server,
15741573 &data->o_arg.seq_args,
1575− &data->o_res.seq_res, task))
1576− return;
1577− rpc_call_start(task);
1574+ &data->o_res.seq_res,
1575+ task) != 0)
1576+ nfs_release_seqid(data->o_arg.seqid);
1577+ else
1578+ rpc_call_start(task);
15781579 return;
15791580 unlock_no_action:
15801581 rcu_read_unlock();
@@ -1748,7 +1749,7 @@ static int nfs4_opendata_access(struct rpc_cred *cred, · 167 unmodified lines
17481749
17491750 /* even though OPEN succeeded, access is denied. Close the file */
17501751 nfs4_close_state(state, fmode);
1751− return -NFS4ERR_ACCESS;
1752+ return -EACCES;
17521753 }
17531754
17541755 /*
@@ -2196,7 +2197,7 @@ static void nfs4_free_closedata(void *data) · 441 unmodified lines
21962197 nfs4_put_open_state(calldata->state);
21972198 nfs_free_seqid(calldata->arg.seqid);
21982199 nfs4_put_state_owner(sp);
2199− nfs_sb_deactive(sb);
2200+ nfs_sb_deactive_async(sb);
22002201 kfree(calldata);
22012202 }
22022203
@@ -2296,9 +2297,10 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data) · 93 unmodified lines
22962297 if (nfs4_setup_sequence(NFS_SERVER(inode),
22972298 &calldata->arg.seq_args,
22982299 &calldata->res.seq_res,
2299− task))
2300− goto out;
2301− rpc_call_start(task);
2300+ task) != 0)
2301+ nfs_release_seqid(calldata->arg.seqid);
2302+ else
2303+ rpc_call_start(task);
23022304 out:
23032305 dprintk("%s: done!\n", __func__);
23042306 }
@@ -4529,6 +4531,7 @@ static void nfs4_locku_done(struct rpc_task *task, void *data) · 2224 unmodified lines
45294531 if (nfs4_async_handle_error(task, calldata->server, NULL) == -EAGAIN)
45304532 rpc_restart_call_prepare(task);
45314533 }
4534+ nfs_release_seqid(calldata->arg.seqid);
45324535 }
45334536
45344537 static void nfs4_locku_prepare(struct rpc_task *task, void *data)
@@ -4545,9 +4548,11 @@ static void nfs4_locku_prepare(struct rpc_task *task, void *data) · 10 unmodified lines
45454548 calldata->timestamp = jiffies;
45464549 if (nfs4_setup_sequence(calldata->server,
45474550 &calldata->arg.seq_args,
4548− &calldata->res.seq_res, task))
4549− return;
4550− rpc_call_start(task);
4551+ &calldata->res.seq_res,
4552+ task) != 0)
4553+ nfs_release_seqid(calldata->arg.seqid);
4554+ else
4555+ rpc_call_start(task);
45514556 }
45524557
45534558 static const struct rpc_call_ops nfs4_locku_ops = {
@@ -4692,7 +4697,7 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata) · 138 unmodified lines
46924697 /* Do we need to do an open_to_lock_owner? */
46934698 if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED)) {
46944699 if (nfs_wait_on_sequence(data->arg.open_seqid, task) != 0)
4695− return;
4700+ goto out_release_lock_seqid;
46964701 data->arg.open_stateid = &state->stateid;
46974702 data->arg.new_lock_owner = 1;
46984703 data->res.open_seqid = data->arg.open_seqid;
@@ -4701,10 +4706,15 @@ static void nfs4_lock_prepare(struct rpc_task *task, void *calldata) · 2 unmodified lines
47014706 data->timestamp = jiffies;
47024707 if (nfs4_setup_sequence(data->server,
47034708 &data->arg.seq_args,
4704− &data->res.seq_res, task))
4709+ &data->res.seq_res,
4710+ task) == 0) {
4711+ rpc_call_start(task);
47054712 return;
4706− rpc_call_start(task);
4707− dprintk("%s: done!, ret = %d\n", __func__, data->rpc_status);
4713+ }
4714+ nfs_release_seqid(data->arg.open_seqid);
4715+out_release_lock_seqid:
4716+ nfs_release_seqid(data->arg.lock_seqid);
4717+ dprintk("%s: done!, ret = %d\n", __func__, task->tk_status);
47084718 }
47094719
47104720 static void nfs4_recover_lock_prepare(struct rpc_task *task, void *calldata)
@@ -5667,7 +5677,7 @@ static void nfs4_add_and_init_slots(struct nfs4_slot_table *tbl, · 956 unmodified lines
56675677 tbl->slots = new;
56685678 tbl->max_slots = max_slots;
56695679 }
5670− tbl->highest_used_slotid = -1; /* no slot is currently used */
5680+ tbl->highest_used_slotid = NFS4_NO_SLOT;
56715681 for (i = 0; i < tbl->max_slots; i++)
56725682 tbl->slots[i].seq_nr = ivalue;
56735683 spin_unlock(&tbl->slot_tbl_lock);
fs/nfs/pnfs.c+2−2
@@ -925,8 +925,8 @@ pnfs_find_alloc_layout(struct inode *ino, · 924 unmodified lines
925925 if (likely(nfsi->layout == NULL)) { /* Won the race? */
926926 nfsi->layout = new;
927927 return new;
928− }
929− pnfs_free_layout_hdr(new);
928+ } else if (new != NULL)
929+ pnfs_free_layout_hdr(new);
930930 out_existing:
931931 pnfs_get_layout_hdr(nfsi->layout);
932932 return nfsi->layout;
fs/nfs/super.c+50−1
@@ -54,6 +54,7 @@ · 53 unmodified lines
5454 #include <linux/parser.h>
5555 #include <linux/nsproxy.h>
5656 #include <linux/rcupdate.h>
57+#include <linux/kthread.h>
5758
5859 #include <asm/uaccess.h>
5960
@@ -415,6 +416,54 @@ void nfs_sb_deactive(struct super_block *sb) · 355 unmodified lines
415416 }
416417 EXPORT_SYMBOL_GPL(nfs_sb_deactive);
417418
419+static int nfs_deactivate_super_async_work(void *ptr)
420+{
421+ struct super_block *sb = ptr;
422+
423+ deactivate_super(sb);
424+ module_put_and_exit(0);
425+ return 0;
426+}
427+
428+/*
429+ * same effect as deactivate_super, but will do final unmount in kthread
430+ * context
431+ */
432+static void nfs_deactivate_super_async(struct super_block *sb)
433+{
434+ struct task_struct *task;
435+ char buf[INET6_ADDRSTRLEN + 1];
436+ struct nfs_server *server = NFS_SB(sb);
437+ struct nfs_client *clp = server->nfs_client;
438+
439+ if (!atomic_add_unless(&sb->s_active, -1, 1)) {
440+ rcu_read_lock();
441+ snprintf(buf, sizeof(buf),
442+ rpc_peeraddr2str(clp->cl_rpcclient, RPC_DISPLAY_ADDR));
443+ rcu_read_unlock();
444+
445+ __module_get(THIS_MODULE);
446+ task = kthread_run(nfs_deactivate_super_async_work, sb,
447+ "%s-deactivate-super", buf);
448+ if (IS_ERR(task)) {
449+ pr_err("%s: kthread_run: %ld\n",
450+ __func__, PTR_ERR(task));
451+ /* make synchronous call and hope for the best */
452+ deactivate_super(sb);
453+ module_put(THIS_MODULE);
454+ }
455+ }
456+}
457+
458+void nfs_sb_deactive_async(struct super_block *sb)
459+{
460+ struct nfs_server *server = NFS_SB(sb);
461+
462+ if (atomic_dec_and_test(&server->active))
463+ nfs_deactivate_super_async(sb);
464+}
465+EXPORT_SYMBOL_GPL(nfs_sb_deactive_async);
466+
418467 /*
419468 * Deliver file system statistics to userspace
420469 */
@@ -771,7 +820,7 @@ int nfs_show_devname(struct seq_file *m, struct dentry *root) · 350 unmodified lines
771820 int err = 0;
772821 if (!page)
773822 return -ENOMEM;
774− devname = nfs_path(&dummy, root, page, PAGE_SIZE);
823+ devname = nfs_path(&dummy, root, page, PAGE_SIZE, 0);
775824 if (IS_ERR(devname))
776825 err = PTR_ERR(devname);
777826 else
fs/nfs/unlink.c+1−1
@@ -95,7 +95,7 @@ static void nfs_async_unlink_release(void *calldata) · 94 unmodified lines
9595
9696 nfs_dec_sillycount(data->dir);
9797 nfs_free_unlinkdata(data);
98− nfs_sb_deactive(sb);
98+ nfs_sb_deactive_async(sb);
9999 }
100100
101101 static void nfs_unlink_prepare(struct rpc_task *task, void *calldata)
fs/notify/fanotify/fanotify.c+1−0
@@ -21,6 +21,7 @@ static bool should_merge(struct fsnotify_event *old, struct fsnotify_event *new) · 20 unmodified lines
2121 if ((old->path.mnt == new->path.mnt) &&
2222 (old->path.dentry == new->path.dentry))
2323 return true;
24+ break;
2425 case (FSNOTIFY_EVENT_NONE):
2526 return true;
2627 default:
fs/xfs/xfs_alloc.c+2−41
@@ -1866,6 +1866,7 @@ xfs_alloc_fix_freelist( · 1865 unmodified lines
18661866 /*
18671867 * Initialize the args structure.
18681868 */
1869+ memset(&targs, 0, sizeof(targs));
18691870 targs.tp = tp;
18701871 targs.mp = mp;
18711872 targs.agbp = agbp;
@@ -2207,7 +2208,7 @@ xfs_alloc_read_agf( · 335 unmodified lines
22072208 * group or loop over the allocation groups to find the result.
22082209 */
22092210 int /* error */
2210−__xfs_alloc_vextent(
2211+xfs_alloc_vextent(
22112212 xfs_alloc_arg_t *args) /* allocation argument structure */
22122213 {
22132214 xfs_agblock_t agsize; /* allocation group size */
@@ -2417,46 +2418,6 @@ error0: · 203 unmodified lines
24172418 return error;
24182419 }
24192420
2420−static void
2421−xfs_alloc_vextent_worker(
2422− struct work_struct *work)
2423−{
2424− struct xfs_alloc_arg *args = container_of(work,
2425− struct xfs_alloc_arg, work);
2426− unsigned long pflags;
2427−
2428− /* we are in a transaction context here */
2429− current_set_flags_nested(&pflags, PF_FSTRANS);
2430−
2431− args->result = __xfs_alloc_vextent(args);
2432− complete(args->done);
2433−
2434− current_restore_flags_nested(&pflags, PF_FSTRANS);
2435−}
2436−
2437−/*
2438− * Data allocation requests often come in with little stack to work on. Push
2439− * them off to a worker thread so there is lots of stack to use. Metadata
2440− * requests, OTOH, are generally from low stack usage paths, so avoid the
2441− * context switch overhead here.
2442− */
2443−int
2444−xfs_alloc_vextent(
2445− struct xfs_alloc_arg *args)
2446−{
2447− DECLARE_COMPLETION_ONSTACK(done);
2448−
2449− if (!args->userdata)
2450− return __xfs_alloc_vextent(args);
2451−
2452−
2453− args->done = &done;
2454− INIT_WORK_ONSTACK(&args->work, xfs_alloc_vextent_worker);
2455− queue_work(xfs_alloc_wq, &args->work);
2456− wait_for_completion(&done);
2457− return args->result;
2458−}
2459−
24602421 /*
24612422 * Free an extent.
24622423 * Just break up the extent address and hand off to xfs_free_ag_extent
fs/xfs/xfs_alloc.h+0−3
@@ -120,9 +120,6 @@ typedef struct xfs_alloc_arg { · 119 unmodified lines
120120 char isfl; /* set if is freelist blocks - !acctg */
121121 char userdata; /* set if this is user data */
122122 xfs_fsblock_t firstblock; /* io first block allocated */
123− struct completion *done;
124− struct work_struct work;
125− int result;
126123 } xfs_alloc_arg_t;
127124
128125 /*
fs/xfs/xfs_alloc_btree.c+2−0
@@ -121,6 +121,8 @@ xfs_allocbt_free_block( · 120 unmodified lines
121121 xfs_extent_busy_insert(cur->bc_tp, be32_to_cpu(agf->agf_seqno), bno, 1,
122122 XFS_EXTENT_BUSY_SKIP_DISCARD);
123123 xfs_trans_agbtree_delta(cur->bc_tp, -1);
124+
125+ xfs_trans_binval(cur->bc_tp, bp);
124126 return 0;
125127 }
126128
fs/xfs/xfs_bmap.c+54−9
@@ -2437,6 +2437,7 @@ xfs_bmap_btalloc( · 2436 unmodified lines
24372437 * Normal allocation, done through xfs_alloc_vextent.
24382438 */
24392439 tryagain = isaligned = 0;
2440+ memset(&args, 0, sizeof(args));
24402441 args.tp = ap->tp;
24412442 args.mp = mp;
24422443 args.fsbno = ap->blkno;
@@ -3082,6 +3083,7 @@ xfs_bmap_extents_to_btree( · 639 unmodified lines
30823083 * Convert to a btree with two levels, one record in root.
30833084 */
30843085 XFS_IFORK_FMT_SET(ip, whichfork, XFS_DINODE_FMT_BTREE);
3086+ memset(&args, 0, sizeof(args));
30853087 args.tp = tp;
30863088 args.mp = mp;
30873089 args.firstblock = *firstblock;
@@ -3237,6 +3239,7 @@ xfs_bmap_local_to_extents( · 149 unmodified lines
32373239 xfs_buf_t *bp; /* buffer for extent block */
32383240 xfs_bmbt_rec_host_t *ep;/* extent record pointer */
32393241
3242+ memset(&args, 0, sizeof(args));
32403243 args.tp = tp;
32413244 args.mp = ip->i_mount;
32423245 args.firstblock = *firstblock;
@@ -4616,12 +4619,11 @@ xfs_bmapi_delay( · 1373 unmodified lines
46164619
46174620
46184621 STATIC int
4619−xfs_bmapi_allocate(
4620− struct xfs_bmalloca *bma,
4621− int flags)
4622+__xfs_bmapi_allocate(
4623+ struct xfs_bmalloca *bma)
46224624 {
46234625 struct xfs_mount *mp = bma->ip->i_mount;
4624− int whichfork = (flags & XFS_BMAPI_ATTRFORK) ?
4626+ int whichfork = (bma->flags & XFS_BMAPI_ATTRFORK) ?
46254627 XFS_ATTR_FORK : XFS_DATA_FORK;
46264628 struct xfs_ifork *ifp = XFS_IFORK_PTR(bma->ip, whichfork);
46274629 int tmp_logflags = 0;
@@ -4654,24 +4656,27 @@ xfs_bmapi_allocate( · 26 unmodified lines
46544656 * Indicate if this is the first user data in the file, or just any
46554657 * user data.
46564658 */
4657− if (!(flags & XFS_BMAPI_METADATA)) {
4659+ if (!(bma->flags & XFS_BMAPI_METADATA)) {
46584660 bma->userdata = (bma->offset == 0) ?
46594661 XFS_ALLOC_INITIAL_USER_DATA : XFS_ALLOC_USERDATA;
46604662 }
46614663
4662− bma->minlen = (flags & XFS_BMAPI_CONTIG) ? bma->length : 1;
4664+ bma->minlen = (bma->flags & XFS_BMAPI_CONTIG) ? bma->length : 1;
46634665
46644666 /*
46654667 * Only want to do the alignment at the eof if it is userdata and
46664668 * allocation length is larger than a stripe unit.
46674669 */
46684670 if (mp->m_dalign && bma->length >= mp->m_dalign &&
4669− !(flags & XFS_BMAPI_METADATA) && whichfork == XFS_DATA_FORK) {
4671+ !(bma->flags & XFS_BMAPI_METADATA) && whichfork == XFS_DATA_FORK) {
46704672 error = xfs_bmap_isaeof(bma, whichfork);
46714673 if (error)
46724674 return error;
46734675 }
46744676
4677+ if (bma->flags & XFS_BMAPI_STACK_SWITCH)
4678+ bma->stack_switch = 1;
4679+
46754680 error = xfs_bmap_alloc(bma);
46764681 if (error)
46774682 return error;
@@ -4706,7 +4711,7 @@ xfs_bmapi_allocate( · 28 unmodified lines
47064711 * A wasdelay extent has been initialized, so shouldn't be flagged
47074712 * as unwritten.
47084713 */
4709− if (!bma->wasdel && (flags & XFS_BMAPI_PREALLOC) &&
4714+ if (!bma->wasdel && (bma->flags & XFS_BMAPI_PREALLOC) &&
47104715 xfs_sb_version_hasextflgbit(&mp->m_sb))
47114716 bma->got.br_state = XFS_EXT_UNWRITTEN;
47124717
@@ -4734,6 +4739,45 @@ xfs_bmapi_allocate( · 21 unmodified lines
47344739 return 0;
47354740 }
47364741
4742+static void
4743+xfs_bmapi_allocate_worker(
4744+ struct work_struct *work)
4745+{
4746+ struct xfs_bmalloca *args = container_of(work,
4747+ struct xfs_bmalloca, work);
4748+ unsigned long pflags;
4749+
4750+ /* we are in a transaction context here */
4751+ current_set_flags_nested(&pflags, PF_FSTRANS);
4752+
4753+ args->result = __xfs_bmapi_allocate(args);
4754+ complete(args->done);
4755+
4756+ current_restore_flags_nested(&pflags, PF_FSTRANS);
4757+}
4758+
4759+/*
4760+ * Some allocation requests often come in with little stack to work on. Push
4761+ * them off to a worker thread so there is lots of stack to use. Otherwise just
4762+ * call directly to avoid the context switch overhead here.
4763+ */
4764+int
4765+xfs_bmapi_allocate(
4766+ struct xfs_bmalloca *args)
4767+{
4768+ DECLARE_COMPLETION_ONSTACK(done);
4769+
4770+ if (!args->stack_switch)
4771+ return __xfs_bmapi_allocate(args);
4772+
4773+
4774+ args->done = &done;
4775+ INIT_WORK_ONSTACK(&args->work, xfs_bmapi_allocate_worker);
4776+ queue_work(xfs_alloc_wq, &args->work);
4777+ wait_for_completion(&done);
4778+ return args->result;
4779+}
4780+
47374781 STATIC int
47384782 xfs_bmapi_convert_unwritten(
47394783 struct xfs_bmalloca *bma,
@@ -4919,6 +4963,7 @@ xfs_bmapi_write( · 179 unmodified lines
49194963 bma.conv = !!(flags & XFS_BMAPI_CONVERT);
49204964 bma.wasdel = wasdelay;
49214965 bma.offset = bno;
4966+ bma.flags = flags;
49224967
49234968 /*
49244969 * There's a 32/64 bit type mismatch between the
@@ -4934,7 +4979,7 @@ xfs_bmapi_write( · 9 unmodified lines
49344979
49354980 ASSERT(len > 0);
49364981 ASSERT(bma.length > 0);
4937− error = xfs_bmapi_allocate(&bma, flags);
4982+ error = xfs_bmapi_allocate(&bma);
49384983 if (error)
49394984 goto error0;
49404985 if (bma.blkno == NULLFSBLOCK)
fs/xfs/xfs_bmap.h+8−1
@@ -77,6 +77,7 @@ typedef struct xfs_bmap_free · 76 unmodified lines
7777 * from written to unwritten, otherwise convert from unwritten to written.
7878 */
7979 #define XFS_BMAPI_CONVERT 0x040
80+#define XFS_BMAPI_STACK_SWITCH 0x080
8081
8182 #define XFS_BMAPI_FLAGS \
8283 { XFS_BMAPI_ENTIRE, "ENTIRE" }, \
@@ -85,7 +86,8 @@ typedef struct xfs_bmap_free · 2 unmodified lines
8586 { XFS_BMAPI_PREALLOC, "PREALLOC" }, \
8687 { XFS_BMAPI_IGSTATE, "IGSTATE" }, \
8788 { XFS_BMAPI_CONTIG, "CONTIG" }, \
88− { XFS_BMAPI_CONVERT, "CONVERT" }
89+ { XFS_BMAPI_CONVERT, "CONVERT" }, \
90+ { XFS_BMAPI_STACK_SWITCH, "STACK_SWITCH" }
8991
9092
9193 static inline int xfs_bmapi_aflag(int w)
@@ -133,6 +135,11 @@ typedef struct xfs_bmalloca { · 41 unmodified lines
133135 char userdata;/* set if is user data */
134136 char aeof; /* allocated space at eof */
135137 char conv; /* overwriting unwritten extents */
138+ char stack_switch;
139+ int flags;
140+ struct completion *done;
141+ struct work_struct work;
142+ int result;
136143 } xfs_bmalloca_t;
137144
138145 /*
fs/xfs/xfs_buf_item.c+18−0
@@ -526,7 +526,25 @@ xfs_buf_item_unpin( · 525 unmodified lines
526526 }
527527 xfs_buf_relse(bp);
528528 } else if (freed && remove) {
529+ /*
530+ * There are currently two references to the buffer - the active
531+ * LRU reference and the buf log item. What we are about to do
532+ * here - simulate a failed IO completion - requires 3
533+ * references.
534+ *
535+ * The LRU reference is removed by the xfs_buf_stale() call. The
536+ * buf item reference is removed by the xfs_buf_iodone()
537+ * callback that is run by xfs_buf_do_callbacks() during ioend
538+ * processing (via the bp->b_iodone callback), and then finally
539+ * the ioend processing will drop the IO reference if the buffer
540+ * is marked XBF_ASYNC.
541+ *
542+ * Hence we need to take an additional reference here so that IO
543+ * completion processing doesn't free the buffer prematurely.
544+ */
529545 xfs_buf_lock(bp);
546+ xfs_buf_hold(bp);
547+ bp->b_flags |= XBF_ASYNC;
530548 xfs_buf_ioerror(bp, EIO);
531549 XFS_BUF_UNDONE(bp);
532550 xfs_buf_stale(bp);
fs/xfs/xfs_fsops.c+19−2
@@ -399,9 +399,26 @@ xfs_growfs_data_private( · 398 unmodified lines
399399
400400 /* update secondary superblocks. */
401401 for (agno = 1; agno < nagcount; agno++) {
402− error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp,
402+ error = 0;
403+ /*
404+ * new secondary superblocks need to be zeroed, not read from
405+ * disk as the contents of the new area we are growing into is
406+ * completely unknown.
407+ */
408+ if (agno < oagcount) {
409+ error = xfs_trans_read_buf(mp, NULL, mp->m_ddev_targp,
403410 XFS_AGB_TO_DADDR(mp, agno, XFS_SB_BLOCK(mp)),
404411 XFS_FSS_TO_BB(mp, 1), 0, &bp);
412+ } else {
413+ bp = xfs_trans_get_buf(NULL, mp->m_ddev_targp,
414+ XFS_AGB_TO_DADDR(mp, agno, XFS_SB_BLOCK(mp)),
415+ XFS_FSS_TO_BB(mp, 1), 0);
416+ if (bp)
417+ xfs_buf_zero(bp, 0, BBTOB(bp->b_length));
418+ else
419+ error = ENOMEM;
420+ }
421+
405422 if (error) {
406423 xfs_warn(mp,
407424 "error %d reading secondary superblock for ag %d",
@@ -423,7 +440,7 @@ xfs_growfs_data_private( · 15 unmodified lines
423440 break; /* no point in continuing */
424441 }
425442 }
426− return 0;
443+ return error;
427444
428445 error0:
429446 xfs_trans_cancel(tp, XFS_TRANS_ABORT);
fs/xfs/xfs_ialloc.c+1−0
@@ -250,6 +250,7 @@ xfs_ialloc_ag_alloc( · 249 unmodified lines
250250 /* boundary */
251251 struct xfs_perag *pag;
252252
253+ memset(&args, 0, sizeof(args));
253254 args.tp = tp;
254255 args.mp = tp->t_mountp;
255256
fs/xfs/xfs_inode.c+2−1
@@ -1509,7 +1509,8 @@ xfs_ifree_cluster( · 1508 unmodified lines
15091509 * to mark all the active inodes on the buffer stale.
15101510 */
15111511 bp = xfs_trans_get_buf(tp, mp->m_ddev_targp, blkno,
1512− mp->m_bsize * blks_per_cluster, 0);
1512+ mp->m_bsize * blks_per_cluster,
1513+ XBF_UNMAPPED);
15131514
15141515 if (!bp)
15151516 return ENOMEM;
fs/xfs/xfs_ioctl.c+1−1
@@ -70,7 +70,7 @@ xfs_find_handle( · 69 unmodified lines
7070 int hsize;
7171 xfs_handle_t handle;
7272 struct inode *inode;
73− struct fd f;
73+ struct fd f = {0};
7474 struct path path;
7575 int error;
7676 struct xfs_inode *ip;
fs/xfs/xfs_iomap.c+3−1
@@ -584,7 +584,9 @@ xfs_iomap_write_allocate( · 583 unmodified lines
584584 * pointer that the caller gave to us.
585585 */
586586 error = xfs_bmapi_write(tp, ip, map_start_fsb,
587− count_fsb, 0, &first_block, 1,
587+ count_fsb,
588+ XFS_BMAPI_STACK_SWITCH,
589+ &first_block, 1,
588590 imap, &nimaps, &free_list);
589591 if (error)
590592 goto trans_cancel;
fs/xfs/xfs_log.c+16−3
@@ -2387,14 +2387,27 @@ xlog_state_do_callback( · 2386 unmodified lines
23872387
23882388
23892389 /*
2390− * update the last_sync_lsn before we drop the
2390+ * Completion of a iclog IO does not imply that
2391+ * a transaction has completed, as transactions
2392+ * can be large enough to span many iclogs. We
2393+ * cannot change the tail of the log half way
2394+ * through a transaction as this may be the only
2395+ * transaction in the log and moving th etail to
2396+ * point to the middle of it will prevent
2397+ * recovery from finding the start of the
2398+ * transaction. Hence we should only update the
2399+ * last_sync_lsn if this iclog contains
2400+ * transaction completion callbacks on it.
2401+ *
2402+ * We have to do this before we drop the
23912403 * icloglock to ensure we are the only one that
23922404 * can update it.
23932405 */
23942406 ASSERT(XFS_LSN_CMP(atomic64_read(&log->l_last_sync_lsn),
23952407 be64_to_cpu(iclog->ic_header.h_lsn)) <= 0);
2396− atomic64_set(&log->l_last_sync_lsn,
2397− be64_to_cpu(iclog->ic_header.h_lsn));
2408+ if (iclog->ic_callback)
2409+ atomic64_set(&log->l_last_sync_lsn,
2410+ be64_to_cpu(iclog->ic_header.h_lsn));
23982411
23992412 } else
24002413 ioerrors++;
fs/xfs/xfs_log_recover.c+1−1
@@ -3541,7 +3541,7 @@ xlog_do_recovery_pass( · 3540 unmodified lines
35413541 * - order is important.
35423542 */
35433543 error = xlog_bread_offset(log, 0,
3544− bblks - split_bblks, hbp,
3544+ bblks - split_bblks, dbp,
35453545 offset + BBTOB(split_bblks));
35463546 if (error)
35473547 goto bread_err2;
include/linux/hashtable.h+192−0
@@ -0,0 +1,192 @@
1+/*
2+ * Statically sized hash table implementation
3+ * (C) 2012 Sasha Levin <levinsasha928@gmail.com>
4+ */
5+
6+#ifndef _LINUX_HASHTABLE_H
7+#define _LINUX_HASHTABLE_H
8+
9+#include <linux/list.h>
10+#include <linux/types.h>
11+#include <linux/kernel.h>
12+#include <linux/hash.h>
13+#include <linux/rculist.h>
14+
15+#define DEFINE_HASHTABLE(name, bits) \
16+ struct hlist_head name[1 << (bits)] = \
17+ { [0 ... ((1 << (bits)) - 1)] = HLIST_HEAD_INIT }
18+
19+#define DECLARE_HASHTABLE(name, bits) \
20+ struct hlist_head name[1 << (bits)]
21+
22+#define HASH_SIZE(name) (ARRAY_SIZE(name))
23+#define HASH_BITS(name) ilog2(HASH_SIZE(name))
24+
25+/* Use hash_32 when possible to allow for fast 32bit hashing in 64bit kernels. */
26+#define hash_min(val, bits) \
27+ (sizeof(val) <= 4 ? hash_32(val, bits) : hash_long(val, bits))
28+
29+static inline void __hash_init(struct hlist_head *ht, unsigned int sz)
30+{
31+ unsigned int i;
32+
33+ for (i = 0; i < sz; i++)
34+ INIT_HLIST_HEAD(&ht[i]);
35+}
36+
37+/**
38+ * hash_init - initialize a hash table
39+ * @hashtable: hashtable to be initialized
40+ *
41+ * Calculates the size of the hashtable from the given parameter, otherwise
42+ * same as hash_init_size.
43+ *
44+ * This has to be a macro since HASH_BITS() will not work on pointers since
45+ * it calculates the size during preprocessing.
46+ */
47+#define hash_init(hashtable) __hash_init(hashtable, HASH_SIZE(hashtable))
48+
49+/**
50+ * hash_add - add an object to a hashtable
51+ * @hashtable: hashtable to add to
52+ * @node: the &struct hlist_node of the object to be added
53+ * @key: the key of the object to be added
54+ */
55+#define hash_add(hashtable, node, key) \
56+ hlist_add_head(node, &hashtable[hash_min(key, HASH_BITS(hashtable))])
57+
58+/**
59+ * hash_add_rcu - add an object to a rcu enabled hashtable
60+ * @hashtable: hashtable to add to
61+ * @node: the &struct hlist_node of the object to be added
62+ * @key: the key of the object to be added
63+ */
64+#define hash_add_rcu(hashtable, node, key) \
65+ hlist_add_head_rcu(node, &hashtable[hash_min(key, HASH_BITS(hashtable))])
66+
67+/**
68+ * hash_hashed - check whether an object is in any hashtable
69+ * @node: the &struct hlist_node of the object to be checked
70+ */
71+static inline bool hash_hashed(struct hlist_node *node)
72+{
73+ return !hlist_unhashed(node);
74+}
75+
76+static inline bool __hash_empty(struct hlist_head *ht, unsigned int sz)
77+{
78+ unsigned int i;
79+
80+ for (i = 0; i < sz; i++)
81+ if (!hlist_empty(&ht[i]))
82+ return false;
83+
84+ return true;
85+}
86+
87+/**
88+ * hash_empty - check whether a hashtable is empty
89+ * @hashtable: hashtable to check
90+ *
91+ * This has to be a macro since HASH_BITS() will not work on pointers since
92+ * it calculates the size during preprocessing.
93+ */
94+#define hash_empty(hashtable) __hash_empty(hashtable, HASH_SIZE(hashtable))
95+
96+/**
97+ * hash_del - remove an object from a hashtable
98+ * @node: &struct hlist_node of the object to remove
99+ */
100+static inline void hash_del(struct hlist_node *node)
101+{
102+ hlist_del_init(node);
103+}
104+
105+/**
106+ * hash_del_rcu - remove an object from a rcu enabled hashtable
107+ * @node: &struct hlist_node of the object to remove
108+ */
109+static inline void hash_del_rcu(struct hlist_node *node)
110+{
111+ hlist_del_init_rcu(node);
112+}
113+
114+/**
115+ * hash_for_each - iterate over a hashtable
116+ * @name: hashtable to iterate
117+ * @bkt: integer to use as bucket loop cursor
118+ * @node: the &struct list_head to use as a loop cursor for each entry
119+ * @obj: the type * to use as a loop cursor for each entry
120+ * @member: the name of the hlist_node within the struct
121+ */
122+#define hash_for_each(name, bkt, node, obj, member) \
123+ for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\
124+ hlist_for_each_entry(obj, node, &name[bkt], member)
125+
126+/**
127+ * hash_for_each_rcu - iterate over a rcu enabled hashtable
128+ * @name: hashtable to iterate
129+ * @bkt: integer to use as bucket loop cursor
130+ * @node: the &struct list_head to use as a loop cursor for each entry
131+ * @obj: the type * to use as a loop cursor for each entry
132+ * @member: the name of the hlist_node within the struct
133+ */
134+#define hash_for_each_rcu(name, bkt, node, obj, member) \
135+ for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\
136+ hlist_for_each_entry_rcu(obj, node, &name[bkt], member)
137+
138+/**
139+ * hash_for_each_safe - iterate over a hashtable safe against removal of
140+ * hash entry
141+ * @name: hashtable to iterate
142+ * @bkt: integer to use as bucket loop cursor
143+ * @node: the &struct list_head to use as a loop cursor for each entry
144+ * @tmp: a &struct used for temporary storage
145+ * @obj: the type * to use as a loop cursor for each entry
146+ * @member: the name of the hlist_node within the struct
147+ */
148+#define hash_for_each_safe(name, bkt, node, tmp, obj, member) \
149+ for ((bkt) = 0, node = NULL; node == NULL && (bkt) < HASH_SIZE(name); (bkt)++)\
150+ hlist_for_each_entry_safe(obj, node, tmp, &name[bkt], member)
151+
152+/**
153+ * hash_for_each_possible - iterate over all possible objects hashing to the
154+ * same bucket
155+ * @name: hashtable to iterate
156+ * @obj: the type * to use as a loop cursor for each entry
157+ * @node: the &struct list_head to use as a loop cursor for each entry
158+ * @member: the name of the hlist_node within the struct
159+ * @key: the key of the objects to iterate over
160+ */
161+#define hash_for_each_possible(name, obj, node, member, key) \
162+ hlist_for_each_entry(obj, node, &name[hash_min(key, HASH_BITS(name))], member)
163+
164+/**
165+ * hash_for_each_possible_rcu - iterate over all possible objects hashing to the
166+ * same bucket in an rcu enabled hashtable
167+ * in a rcu enabled hashtable
168+ * @name: hashtable to iterate
169+ * @obj: the type * to use as a loop cursor for each entry
170+ * @node: the &struct list_head to use as a loop cursor for each entry
171+ * @member: the name of the hlist_node within the struct
172+ * @key: the key of the objects to iterate over
173+ */
174+#define hash_for_each_possible_rcu(name, obj, node, member, key) \
175+ hlist_for_each_entry_rcu(obj, node, &name[hash_min(key, HASH_BITS(name))], member)
176+
177+/**
178+ * hash_for_each_possible_safe - iterate over all possible objects hashing to the
179+ * same bucket safe against removals
180+ * @name: hashtable to iterate
181+ * @obj: the type * to use as a loop cursor for each entry
182+ * @node: the &struct list_head to use as a loop cursor for each entry
183+ * @tmp: a &struct used for temporary storage
184+ * @member: the name of the hlist_node within the struct
185+ * @key: the key of the objects to iterate over
186+ */
187+#define hash_for_each_possible_safe(name, obj, node, tmp, member, key) \
188+ hlist_for_each_entry_safe(obj, node, tmp, \
189+ &name[hash_min(key, HASH_BITS(name))], member)
190+
191+
192+#endif
include/linux/kvm_host.h+2−13
@@ -42,19 +42,8 @@ · 41 unmodified lines
4242 */
4343 #define KVM_MEMSLOT_INVALID (1UL << 16)
4444
45−/*
46− * If we support unaligned MMIO, at most one fragment will be split into two:
47− */
48−#ifdef KVM_UNALIGNED_MMIO
49−# define KVM_EXTRA_MMIO_FRAGMENTS 1
50−#else
51−# define KVM_EXTRA_MMIO_FRAGMENTS 0
52−#endif
53−
54−#define KVM_USER_MMIO_SIZE 8
55−
56−#define KVM_MAX_MMIO_FRAGMENTS \
57− (KVM_MMIO_SIZE / KVM_USER_MMIO_SIZE + KVM_EXTRA_MMIO_FRAGMENTS)
45+/* Two fragments for cross MMIO pages. */
46+#define KVM_MAX_MMIO_FRAGMENTS 2
5847
5948 /*
6049 * For the normal pfn, the highest 12 bits should be zero,
include/linux/mmc/dw_mmc.h+3−3
@@ -137,7 +137,7 @@ struct dw_mci { · 136 unmodified lines
137137
138138 dma_addr_t sg_dma;
139139 void *sg_cpu;
140− struct dw_mci_dma_ops *dma_ops;
140+ const struct dw_mci_dma_ops *dma_ops;
141141 #ifdef CONFIG_MMC_DW_IDMAC
142142 unsigned int ring_size;
143143 #else
@@ -162,7 +162,7 @@ struct dw_mci { · 18 unmodified lines
162162 u16 data_offset;
163163 struct device *dev;
164164 struct dw_mci_board *pdata;
165− struct dw_mci_drv_data *drv_data;
165+ const struct dw_mci_drv_data *drv_data;
166166 void *priv;
167167 struct clk *biu_clk;
168168 struct clk *ciu_clk;
@@ -186,7 +186,7 @@ struct dw_mci { · 17 unmodified lines
186186
187187 struct regulator *vmmc; /* Power regulator */
188188 unsigned long irq_flags; /* IRQ flags */
189− unsigned int irq;
189+ int irq;
190190 };
191191
192192 /* DMA ops for Internal/External DMAC interface */
include/linux/mmc/sdhci.h+1−0
@@ -91,6 +91,7 @@ struct sdhci_host { · 90 unmodified lines
9191 unsigned int quirks2; /* More deviations from spec. */
9292
9393 #define SDHCI_QUIRK2_HOST_OFF_CARD_ON (1<<0)
94+#define SDHCI_QUIRK2_HOST_NO_CMD23 (1<<1)
9495
9596 int irq; /* Device IRQ */
9697 void __iomem *ioaddr; /* Mapped address */
include/linux/of_address.h+2−0
@@ -28,11 +28,13 @@ static inline unsigned long pci_address_to_pio(phys_addr_t addr) { return -1; } · 27 unmodified lines
2828 #endif
2929
3030 #else /* CONFIG_OF_ADDRESS */
31+#ifndef of_address_to_resource
3132 static inline int of_address_to_resource(struct device_node *dev, int index,
3233 struct resource *r)
3334 {
3435 return -EINVAL;
3536 }
37+#endif
3638 static inline struct device_node *of_find_matching_node_by_address(
3739 struct device_node *from,
3840 const struct of_device_id *matches,
include/linux/ptp_clock_kernel.h+2−1
@@ -54,7 +54,8 @@ struct ptp_clock_request { · 53 unmodified lines
5454 * clock operations
5555 *
5656 * @adjfreq: Adjusts the frequency of the hardware clock.
57− * parameter delta: Desired period change in parts per billion.
57+ * parameter delta: Desired frequency offset from nominal frequency
58+ * in parts per billion
5859 *
5960 * @adjtime: Shifts the time of the hardware clock.
6061 * parameter delta: Desired change in nanoseconds.
include/linux/raid/Kbuild+0−2
@@ -1,2 +0,0 @@
1−header-y += md_p.h
2−header-y += md_u.h
include/linux/raid/md_u.h+1−140
@@ -11,149 +11,10 @@ · 10 unmodified lines
1111 (for example /usr/src/linux/COPYING); if not, write to the Free
1212 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1313 */
14−
1514 #ifndef _MD_U_H
1615 #define _MD_U_H
1716
18−/*
19− * Different major versions are not compatible.
20− * Different minor versions are only downward compatible.
21− * Different patchlevel versions are downward and upward compatible.
22− */
23−#define MD_MAJOR_VERSION 0
24−#define MD_MINOR_VERSION 90
25−/*
26− * MD_PATCHLEVEL_VERSION indicates kernel functionality.
27− * >=1 means different superblock formats are selectable using SET_ARRAY_INFO
28− * and major_version/minor_version accordingly
29− * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT
30− * in the super status byte
31− * >=3 means that bitmap superblock version 4 is supported, which uses
32− * little-ending representation rather than host-endian
33− */
34−#define MD_PATCHLEVEL_VERSION 3
35−
36−/* ioctls */
37−
38−/* status */
39−#define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t)
40−#define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t)
41−#define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t)
42−#define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13)
43−#define RAID_AUTORUN _IO (MD_MAJOR, 0x14)
44−#define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t)
45−
46−/* configuration */
47−#define CLEAR_ARRAY _IO (MD_MAJOR, 0x20)
48−#define ADD_NEW_DISK _IOW (MD_MAJOR, 0x21, mdu_disk_info_t)
49−#define HOT_REMOVE_DISK _IO (MD_MAJOR, 0x22)
50−#define SET_ARRAY_INFO _IOW (MD_MAJOR, 0x23, mdu_array_info_t)
51−#define SET_DISK_INFO _IO (MD_MAJOR, 0x24)
52−#define WRITE_RAID_INFO _IO (MD_MAJOR, 0x25)
53−#define UNPROTECT_ARRAY _IO (MD_MAJOR, 0x26)
54−#define PROTECT_ARRAY _IO (MD_MAJOR, 0x27)
55−#define HOT_ADD_DISK _IO (MD_MAJOR, 0x28)
56−#define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29)
57−#define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a)
58−#define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int)
17+#include <uapi/linux/raid/md_u.h>
5918
60−/* usage */
61−#define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t)
62−/* 0x31 was START_ARRAY */
63−#define STOP_ARRAY _IO (MD_MAJOR, 0x32)
64−#define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33)
65−#define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34)
66−
67−/* 63 partitions with the alternate major number (mdp) */
68−#define MdpMinorShift 6
69−#ifdef __KERNEL__
7019 extern int mdp_major;
71−#endif
72−
73−typedef struct mdu_version_s {
74− int major;
75− int minor;
76− int patchlevel;
77−} mdu_version_t;
78−
79−typedef struct mdu_array_info_s {
80− /*
81− * Generic constant information
82− */
83− int major_version;
84− int minor_version;
85− int patch_version;
86− int ctime;
87− int level;
88− int size;
89− int nr_disks;
90− int raid_disks;
91− int md_minor;
92− int not_persistent;
93−
94− /*
95− * Generic state information
96− */
97− int utime; /* 0 Superblock update time */
98− int state; /* 1 State bits (clean, ...) */
99− int active_disks; /* 2 Number of currently active disks */
100− int working_disks; /* 3 Number of working disks */
101− int failed_disks; /* 4 Number of failed disks */
102− int spare_disks; /* 5 Number of spare disks */
103−
104− /*
105− * Personality information
106− */
107− int layout; /* 0 the array's physical layout */
108− int chunk_size; /* 1 chunk size in bytes */
109−
110−} mdu_array_info_t;
111−
112−/* non-obvious values for 'level' */
113−#define LEVEL_MULTIPATH (-4)
114−#define LEVEL_LINEAR (-1)
115−#define LEVEL_FAULTY (-5)
116−
117−/* we need a value for 'no level specified' and 0
118− * means 'raid0', so we need something else. This is
119− * for internal use only
120− */
121−#define LEVEL_NONE (-1000000)
122−
123−typedef struct mdu_disk_info_s {
124− /*
125− * configuration/status of one particular disk
126− */
127− int number;
128− int major;
129− int minor;
130− int raid_disk;
131− int state;
132−
133−} mdu_disk_info_t;
134−
135−typedef struct mdu_start_info_s {
136− /*
137− * configuration/status of one particular disk
138− */
139− int major;
140− int minor;
141− int raid_disk;
142− int state;
143−
144−} mdu_start_info_t;
145−
146−typedef struct mdu_bitmap_file_s
147−{
148− char pathname[4096];
149−} mdu_bitmap_file_t;
150−
151−typedef struct mdu_param_s
152−{
153− int personality; /* 1,2,3,4 */
154− int chunk_size; /* in bytes */
155− int max_fault; /* unused for now */
156−} mdu_param_t;
157−
15820 #endif
159−
include/net/cfg80211.h+9−0
@@ -2651,6 +2651,15 @@ unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb); · 2650 unmodified lines
26512651 */
26522652 unsigned int __attribute_const__ ieee80211_hdrlen(__le16 fc);
26532653
2654+/**
2655+ * ieee80211_get_mesh_hdrlen - get mesh extension header length
2656+ * @meshhdr: the mesh extension header, only the flags field
2657+ * (first byte) will be accessed
2658+ * Returns the length of the extension header, which is always at
2659+ * least 6 bytes and at most 18 if address 5 and 6 are present.
2660+ */
2661+unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr);
2662+
26542663 /**
26552664 * DOC: Data path helpers
26562665 *
include/sound/core.h+3−0
@@ -132,6 +132,7 @@ struct snd_card { · 131 unmodified lines
132132 int shutdown; /* this card is going down */
133133 int free_on_last_close; /* free in context of file_release */
134134 wait_queue_head_t shutdown_sleep;
135+ atomic_t refcount; /* refcount for disconnection */
135136 struct device *dev; /* device assigned to this card */
136137 struct device *card_dev; /* cardX object for sysfs */
137138
@@ -189,6 +190,7 @@ struct snd_minor { · 51 unmodified lines
189190 const struct file_operations *f_ops; /* file operations */
190191 void *private_data; /* private data for f_ops->open */
191192 struct device *dev; /* device for sysfs */
193+ struct snd_card *card_ptr; /* assigned card instance */
192194 };
193195
194196 /* return a device pointer linked to each sound device as a parent */
@@ -295,6 +297,7 @@ int snd_card_info_done(void); · 100 unmodified lines
295297 int snd_component_add(struct snd_card *card, const char *component);
296298 int snd_card_file_add(struct snd_card *card, struct file *file);
297299 int snd_card_file_remove(struct snd_card *card, struct file *file);
300+void snd_card_unref(struct snd_card *card);
298301
299302 #define snd_card_set_dev(card, devptr) ((card)->dev = (devptr))
300303
include/trace/events/xen.h+8−0
@@ -377,6 +377,14 @@ DECLARE_EVENT_CLASS(xen_mmu_pgd, · 376 unmodified lines
377377 DEFINE_XEN_MMU_PGD_EVENT(xen_mmu_pgd_pin);
378378 DEFINE_XEN_MMU_PGD_EVENT(xen_mmu_pgd_unpin);
379379
380+TRACE_EVENT(xen_mmu_flush_tlb_all,
381+ TP_PROTO(int x),
382+ TP_ARGS(x),
383+ TP_STRUCT__entry(__array(char, x, 0)),
384+ TP_fast_assign((void)x),
385+ TP_printk("%s", "")
386+ );
387+
380388 TRACE_EVENT(xen_mmu_flush_tlb,
381389 TP_PROTO(int x),
382390 TP_ARGS(x),
include/uapi/linux/eventpoll.h+0−1
@@ -25,7 +25,6 @@ · 24 unmodified lines
2525 #define EPOLL_CTL_ADD 1
2626 #define EPOLL_CTL_DEL 2
2727 #define EPOLL_CTL_MOD 3
28−#define EPOLL_CTL_DISABLE 4
2928
3029 /*
3130 * Request the handling of system wakeup events so as to prevent system suspends
include/uapi/linux/raid/Kbuild+2−0
@@ -1 +1,3 @@
11 # UAPI Header export list
2+header-y += md_p.h
3+header-y += md_u.h
include/uapi/linux/raid/md_p.hrenamed from include/linux/raid/md_p.h+0−0

File renamed without changes.

include/uapi/linux/raid/md_u.h+155−0
@@ -0,0 +1,155 @@
1+/*
2+ md_u.h : user <=> kernel API between Linux raidtools and RAID drivers
3+ Copyright (C) 1998 Ingo Molnar
4+
5+ This program is free software; you can redistribute it and/or modify
6+ it under the terms of the GNU General Public License as published by
7+ the Free Software Foundation; either version 2, or (at your option)
8+ any later version.
9+
10+ You should have received a copy of the GNU General Public License
11+ (for example /usr/src/linux/COPYING); if not, write to the Free
12+ Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
13+*/
14+
15+#ifndef _UAPI_MD_U_H
16+#define _UAPI_MD_U_H
17+
18+/*
19+ * Different major versions are not compatible.
20+ * Different minor versions are only downward compatible.
21+ * Different patchlevel versions are downward and upward compatible.
22+ */
23+#define MD_MAJOR_VERSION 0
24+#define MD_MINOR_VERSION 90
25+/*
26+ * MD_PATCHLEVEL_VERSION indicates kernel functionality.
27+ * >=1 means different superblock formats are selectable using SET_ARRAY_INFO
28+ * and major_version/minor_version accordingly
29+ * >=2 means that Internal bitmaps are supported by setting MD_SB_BITMAP_PRESENT
30+ * in the super status byte
31+ * >=3 means that bitmap superblock version 4 is supported, which uses
32+ * little-ending representation rather than host-endian
33+ */
34+#define MD_PATCHLEVEL_VERSION 3
35+
36+/* ioctls */
37+
38+/* status */
39+#define RAID_VERSION _IOR (MD_MAJOR, 0x10, mdu_version_t)
40+#define GET_ARRAY_INFO _IOR (MD_MAJOR, 0x11, mdu_array_info_t)
41+#define GET_DISK_INFO _IOR (MD_MAJOR, 0x12, mdu_disk_info_t)
42+#define PRINT_RAID_DEBUG _IO (MD_MAJOR, 0x13)
43+#define RAID_AUTORUN _IO (MD_MAJOR, 0x14)
44+#define GET_BITMAP_FILE _IOR (MD_MAJOR, 0x15, mdu_bitmap_file_t)
45+
46+/* configuration */
47+#define CLEAR_ARRAY _IO (MD_MAJOR, 0x20)
48+#define ADD_NEW_DISK _IOW (MD_MAJOR, 0x21, mdu_disk_info_t)
49+#define HOT_REMOVE_DISK _IO (MD_MAJOR, 0x22)
50+#define SET_ARRAY_INFO _IOW (MD_MAJOR, 0x23, mdu_array_info_t)
51+#define SET_DISK_INFO _IO (MD_MAJOR, 0x24)
52+#define WRITE_RAID_INFO _IO (MD_MAJOR, 0x25)
53+#define UNPROTECT_ARRAY _IO (MD_MAJOR, 0x26)
54+#define PROTECT_ARRAY _IO (MD_MAJOR, 0x27)
55+#define HOT_ADD_DISK _IO (MD_MAJOR, 0x28)
56+#define SET_DISK_FAULTY _IO (MD_MAJOR, 0x29)
57+#define HOT_GENERATE_ERROR _IO (MD_MAJOR, 0x2a)
58+#define SET_BITMAP_FILE _IOW (MD_MAJOR, 0x2b, int)
59+
60+/* usage */
61+#define RUN_ARRAY _IOW (MD_MAJOR, 0x30, mdu_param_t)
62+/* 0x31 was START_ARRAY */
63+#define STOP_ARRAY _IO (MD_MAJOR, 0x32)
64+#define STOP_ARRAY_RO _IO (MD_MAJOR, 0x33)
65+#define RESTART_ARRAY_RW _IO (MD_MAJOR, 0x34)
66+
67+/* 63 partitions with the alternate major number (mdp) */
68+#define MdpMinorShift 6
69+
70+typedef struct mdu_version_s {
71+ int major;
72+ int minor;
73+ int patchlevel;
74+} mdu_version_t;
75+
76+typedef struct mdu_array_info_s {
77+ /*
78+ * Generic constant information
79+ */
80+ int major_version;
81+ int minor_version;
82+ int patch_version;
83+ int ctime;
84+ int level;
85+ int size;
86+ int nr_disks;
87+ int raid_disks;
88+ int md_minor;
89+ int not_persistent;
90+
91+ /*
92+ * Generic state information
93+ */
94+ int utime; /* 0 Superblock update time */
95+ int state; /* 1 State bits (clean, ...) */
96+ int active_disks; /* 2 Number of currently active disks */
97+ int working_disks; /* 3 Number of working disks */
98+ int failed_disks; /* 4 Number of failed disks */
99+ int spare_disks; /* 5 Number of spare disks */
100+
101+ /*
102+ * Personality information
103+ */
104+ int layout; /* 0 the array's physical layout */
105+ int chunk_size; /* 1 chunk size in bytes */
106+
107+} mdu_array_info_t;
108+
109+/* non-obvious values for 'level' */
110+#define LEVEL_MULTIPATH (-4)
111+#define LEVEL_LINEAR (-1)
112+#define LEVEL_FAULTY (-5)
113+
114+/* we need a value for 'no level specified' and 0
115+ * means 'raid0', so we need something else. This is
116+ * for internal use only
117+ */
118+#define LEVEL_NONE (-1000000)
119+
120+typedef struct mdu_disk_info_s {
121+ /*
122+ * configuration/status of one particular disk
123+ */
124+ int number;
125+ int major;
126+ int minor;
127+ int raid_disk;
128+ int state;
129+
130+} mdu_disk_info_t;
131+
132+typedef struct mdu_start_info_s {
133+ /*
134+ * configuration/status of one particular disk
135+ */
136+ int major;
137+ int minor;
138+ int raid_disk;
139+ int state;
140+
141+} mdu_start_info_t;
142+
143+typedef struct mdu_bitmap_file_s
144+{
145+ char pathname[4096];
146+} mdu_bitmap_file_t;
147+
148+typedef struct mdu_param_s
149+{
150+ int personality; /* 1,2,3,4 */
151+ int chunk_size; /* in bytes */
152+ int max_fault; /* unused for now */
153+} mdu_param_t;
154+
155+#endif /* _UAPI_MD_U_H */
include/xen/hvm.h+32−2
@@ -5,6 +5,36 @@ · 4 unmodified lines
55 #include <xen/interface/hvm/params.h>
66 #include <asm/xen/hypercall.h>
77
8+static const char *param_name(int op)
9+{
10+#define PARAM(x) [HVM_PARAM_##x] = #x
11+ static const char *const names[] = {
12+ PARAM(CALLBACK_IRQ),
13+ PARAM(STORE_PFN),
14+ PARAM(STORE_EVTCHN),
15+ PARAM(PAE_ENABLED),
16+ PARAM(IOREQ_PFN),
17+ PARAM(BUFIOREQ_PFN),
18+ PARAM(TIMER_MODE),
19+ PARAM(HPET_ENABLED),
20+ PARAM(IDENT_PT),
21+ PARAM(DM_DOMAIN),
22+ PARAM(ACPI_S_STATE),
23+ PARAM(VM86_TSS),
24+ PARAM(VPT_ALIGN),
25+ PARAM(CONSOLE_PFN),
26+ PARAM(CONSOLE_EVTCHN),
27+ };
28+#undef PARAM
29+
30+ if (op >= ARRAY_SIZE(names))
31+ return "unknown";
32+
33+ if (!names[op])
34+ return "reserved";
35+
36+ return names[op];
37+}
838 static inline int hvm_get_parameter(int idx, uint64_t *value)
939 {
1040 struct xen_hvm_param xhv;
@@ -14,8 +44,8 @@ static inline int hvm_get_parameter(int idx, uint64_t *value) · 3 unmodified lines
1444 xhv.index = idx;
1545 r = HYPERVISOR_hvm_op(HVMOP_get_param, &xhv);
1646 if (r < 0) {
17− printk(KERN_ERR "Cannot get hvm parameter %d: %d!\n",
18− idx, r);
47+ printk(KERN_ERR "Cannot get hvm parameter %s (%d): %d!\n",
48+ param_name(idx), idx, r);
1949 return r;
2050 }
2151 *value = xhv.value;
init/main.c+2−0
@@ -442,9 +442,11 @@ void __init __weak smp_setup_processor_id(void) · 441 unmodified lines
442442 {
443443 }
444444
445+# if THREAD_SIZE >= PAGE_SIZE
445446 void __init __weak thread_info_cache_init(void)
446447 {
447448 }
449+#endif
448450
449451 /*
450452 * Set up kernel memory allocators
kernel/module.c+16−11
@@ -2293,12 +2293,17 @@ static void layout_symtab(struct module *mod, struct load_info *info) · 2292 unmodified lines
22932293 src = (void *)info->hdr + symsect->sh_offset;
22942294 nsrc = symsect->sh_size / sizeof(*src);
22952295
2296+ /* strtab always starts with a nul, so offset 0 is the empty string. */
2297+ strtab_size = 1;
2298+
22962299 /* Compute total space required for the core symbols' strtab. */
2297− for (ndst = i = strtab_size = 1; i < nsrc; ++i, ++src)
2298− if (is_core_symbol(src, info->sechdrs, info->hdr->e_shnum)) {
2299− strtab_size += strlen(&info->strtab[src->st_name]) + 1;
2300+ for (ndst = i = 0; i < nsrc; i++) {
2301+ if (i == 0 ||
2302+ is_core_symbol(src+i, info->sechdrs, info->hdr->e_shnum)) {
2303+ strtab_size += strlen(&info->strtab[src[i].st_name])+1;
23002304 ndst++;
23012305 }
2306+ }
23022307
23032308 /* Append room for core symbols at end of core part. */
23042309 info->symoffs = ALIGN(mod->core_size, symsect->sh_addralign ?: 1);
@@ -2332,15 +2337,15 @@ static void add_kallsyms(struct module *mod, const struct load_info *info) · 27 unmodified lines
23322337 mod->core_symtab = dst = mod->module_core + info->symoffs;
23332338 mod->core_strtab = s = mod->module_core + info->stroffs;
23342339 src = mod->symtab;
2335− *dst = *src;
23362340 *s++ = 0;
2337− for (ndst = i = 1; i < mod->num_symtab; ++i, ++src) {
2338− if (!is_core_symbol(src, info->sechdrs, info->hdr->e_shnum))
2339− continue;
2340−
2341− dst[ndst] = *src;
2342− dst[ndst++].st_name = s - mod->core_strtab;
2343− s += strlcpy(s, &mod->strtab[src->st_name], KSYM_NAME_LEN) + 1;
2341+ for (ndst = i = 0; i < mod->num_symtab; i++) {
2342+ if (i == 0 ||
2343+ is_core_symbol(src+i, info->sechdrs, info->hdr->e_shnum)) {
2344+ dst[ndst] = src[i];
2345+ dst[ndst++].st_name = s - mod->core_strtab;
2346+ s += strlcpy(s, &mod->strtab[src[i].st_name],
2347+ KSYM_NAME_LEN) + 1;
2348+ }
23442349 }
23452350 mod->core_num_syms = ndst;
23462351 }
mm/vmscan.c+2−0
@@ -3017,6 +3017,8 @@ static int kswapd(void *p) · 3016 unmodified lines
30173017 &balanced_classzone_idx);
30183018 }
30193019 }
3020+
3021+ current->reclaim_state = NULL;
30203022 return 0;
30213023 }
30223024
net/ceph/messenger.c+4−2
@@ -2300,10 +2300,11 @@ restart: · 2299 unmodified lines
23002300 mutex_unlock(&con->mutex);
23012301 return;
23022302 } else {
2303− con->ops->put(con);
23042303 dout("con_work %p FAILED to back off %lu\n", con,
23052304 con->delay);
2305+ set_bit(CON_FLAG_BACKOFF, &con->flags);
23062306 }
2307+ goto done;
23072308 }
23082309
23092310 if (con->state == CON_STATE_STANDBY) {
@@ -2749,7 +2750,8 @@ static int ceph_con_in_msg_alloc(struct ceph_connection *con, int *skip) · 439 unmodified lines
27492750 msg = con->ops->alloc_msg(con, hdr, skip);
27502751 mutex_lock(&con->mutex);
27512752 if (con->state != CON_STATE_OPEN) {
2752− ceph_msg_put(msg);
2753+ if (msg)
2754+ ceph_msg_put(msg);
27532755 return -EAGAIN;
27542756 }
27552757 con->in_msg = msg;
net/core/dev.c+1−1
@@ -1666,7 +1666,7 @@ static inline int deliver_skb(struct sk_buff *skb, · 1665 unmodified lines
16661666
16671667 static inline bool skb_loop_sk(struct packet_type *ptype, struct sk_buff *skb)
16681668 {
1669− if (ptype->af_packet_priv == NULL)
1669+ if (!ptype->af_packet_priv || !skb->sk)
16701670 return false;
16711671
16721672 if (ptype->id_match)
net/core/rtnetlink.c+2−1
@@ -2192,7 +2192,8 @@ static int nlmsg_populate_fdb(struct sk_buff *skb, · 2191 unmodified lines
21922192 goto skip;
21932193
21942194 err = nlmsg_populate_fdb_fill(skb, dev, ha->addr,
2195− portid, seq, 0, NTF_SELF);
2195+ portid, seq,
2196+ RTM_NEWNEIGH, NTF_SELF);
21962197 if (err < 0)
21972198 return err;
21982199 skip:
net/ipv4/inet_diag.c+4−1
@@ -892,13 +892,16 @@ static int __inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb, · 891 unmodified lines
892892 struct inet_diag_req_v2 *r, struct nlattr *bc)
893893 {
894894 const struct inet_diag_handler *handler;
895+ int err = 0;
895896
896897 handler = inet_diag_lock_handler(r->sdiag_protocol);
897898 if (!IS_ERR(handler))
898899 handler->dump(skb, cb, r, bc);
900+ else
901+ err = PTR_ERR(handler);
899902 inet_diag_unlock_handler(handler);
900903
901− return skb->len;
904+ return err ? : skb->len;
902905 }
903906
904907 static int inet_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
net/ipv4/netfilter/iptable_nat.c+3−1
@@ -184,7 +184,8 @@ nf_nat_ipv4_out(unsigned int hooknum, · 183 unmodified lines
184184
185185 if ((ct->tuplehash[dir].tuple.src.u3.ip !=
186186 ct->tuplehash[!dir].tuple.dst.u3.ip) ||
187− (ct->tuplehash[dir].tuple.src.u.all !=
187+ (ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMP &&
188+ ct->tuplehash[dir].tuple.src.u.all !=
188189 ct->tuplehash[!dir].tuple.dst.u.all))
189190 if (nf_xfrm_me_harder(skb, AF_INET) < 0)
190191 ret = NF_DROP;
@@ -221,6 +222,7 @@ nf_nat_ipv4_local_fn(unsigned int hooknum, · 30 unmodified lines
221222 }
222223 #ifdef CONFIG_XFRM
223224 else if (!(IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED) &&
225+ ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMP &&
224226 ct->tuplehash[dir].tuple.dst.u.all !=
225227 ct->tuplehash[!dir].tuple.src.u.all)
226228 if (nf_xfrm_me_harder(skb, AF_INET) < 0)
net/ipv4/tcp_illinois.c+5−3
@@ -313,11 +313,13 @@ static void tcp_illinois_info(struct sock *sk, u32 ext, · 312 unmodified lines
313313 .tcpv_rttcnt = ca->cnt_rtt,
314314 .tcpv_minrtt = ca->base_rtt,
315315 };
316− u64 t = ca->sum_rtt;
317316
318− do_div(t, ca->cnt_rtt);
319− info.tcpv_rtt = t;
317+ if (info.tcpv_rttcnt > 0) {
318+ u64 t = ca->sum_rtt;
320319
320+ do_div(t, info.tcpv_rttcnt);
321+ info.tcpv_rtt = t;
322+ }
321323 nla_put(skb, INET_DIAG_VEGASINFO, sizeof(info), &info);
322324 }
323325 }
net/ipv4/tcp_input.c+3−0
@@ -4529,6 +4529,9 @@ int tcp_send_rcvq(struct sock *sk, struct msghdr *msg, size_t size) · 4528 unmodified lines
45294529 struct tcphdr *th;
45304530 bool fragstolen;
45314531
4532+ if (size == 0)
4533+ return 0;
4534+
45324535 skb = alloc_skb(size + sizeof(*th), sk->sk_allocation);
45334536 if (!skb)
45344537 goto err;
net/ipv4/tcp_metrics.c+1−1
@@ -864,7 +864,7 @@ static int parse_nl_addr(struct genl_info *info, struct inetpeer_addr *addr, · 863 unmodified lines
864864 }
865865 a = info->attrs[TCP_METRICS_ATTR_ADDR_IPV6];
866866 if (a) {
867− if (nla_len(a) != sizeof(sizeof(struct in6_addr)))
867+ if (nla_len(a) != sizeof(struct in6_addr))
868868 return -EINVAL;
869869 addr->family = AF_INET6;
870870 memcpy(addr->addr.a6, nla_data(a), sizeof(addr->addr.a6));
net/ipv6/ip6_gre.c+4−4
@@ -1633,9 +1633,9 @@ static size_t ip6gre_get_size(const struct net_device *dev) · 1632 unmodified lines
16331633 /* IFLA_GRE_OKEY */
16341634 nla_total_size(4) +
16351635 /* IFLA_GRE_LOCAL */
1636− nla_total_size(4) +
1636+ nla_total_size(sizeof(struct in6_addr)) +
16371637 /* IFLA_GRE_REMOTE */
1638− nla_total_size(4) +
1638+ nla_total_size(sizeof(struct in6_addr)) +
16391639 /* IFLA_GRE_TTL */
16401640 nla_total_size(1) +
16411641 /* IFLA_GRE_TOS */
@@ -1659,8 +1659,8 @@ static int ip6gre_fill_info(struct sk_buff *skb, const struct net_device *dev) · 17 unmodified lines
16591659 nla_put_be16(skb, IFLA_GRE_OFLAGS, p->o_flags) ||
16601660 nla_put_be32(skb, IFLA_GRE_IKEY, p->i_key) ||
16611661 nla_put_be32(skb, IFLA_GRE_OKEY, p->o_key) ||
1662− nla_put(skb, IFLA_GRE_LOCAL, sizeof(struct in6_addr), &p->raddr) ||
1663− nla_put(skb, IFLA_GRE_REMOTE, sizeof(struct in6_addr), &p->laddr) ||
1662+ nla_put(skb, IFLA_GRE_LOCAL, sizeof(struct in6_addr), &p->laddr) ||
1663+ nla_put(skb, IFLA_GRE_REMOTE, sizeof(struct in6_addr), &p->raddr) ||
16641664 nla_put_u8(skb, IFLA_GRE_TTL, p->hop_limit) ||
16651665 /*nla_put_u8(skb, IFLA_GRE_TOS, t->priority) ||*/
16661666 nla_put_u8(skb, IFLA_GRE_ENCAP_LIMIT, p->encap_limit) ||
net/ipv6/ndisc.c+1−2
@@ -535,7 +535,7 @@ static void ndisc_send_unsol_na(struct net_device *dev) · 534 unmodified lines
535535 {
536536 struct inet6_dev *idev;
537537 struct inet6_ifaddr *ifa;
538− struct in6_addr mcaddr;
538+ struct in6_addr mcaddr = IN6ADDR_LINKLOCAL_ALLNODES_INIT;
539539
540540 idev = in6_dev_get(dev);
541541 if (!idev)
@@ -543,7 +543,6 @@ static void ndisc_send_unsol_na(struct net_device *dev) · 1 unmodified line
543543
544544 read_lock_bh(&idev->lock);
545545 list_for_each_entry(ifa, &idev->addr_list, if_list) {
546− addrconf_addr_solict_mult(&ifa->addr, &mcaddr);
547546 ndisc_send_na(dev, NULL, &mcaddr, &ifa->addr,
548547 /*router=*/ !!idev->cnf.forwarding,
549548 /*solicited=*/ false, /*override=*/ true,
net/ipv6/netfilter/ip6table_nat.c+3−1
@@ -186,7 +186,8 @@ nf_nat_ipv6_out(unsigned int hooknum, · 185 unmodified lines
186186
187187 if (!nf_inet_addr_cmp(&ct->tuplehash[dir].tuple.src.u3,
188188 &ct->tuplehash[!dir].tuple.dst.u3) ||
189− (ct->tuplehash[dir].tuple.src.u.all !=
189+ (ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMPV6 &&
190+ ct->tuplehash[dir].tuple.src.u.all !=
190191 ct->tuplehash[!dir].tuple.dst.u.all))
191192 if (nf_xfrm_me_harder(skb, AF_INET6) < 0)
192193 ret = NF_DROP;
@@ -222,6 +223,7 @@ nf_nat_ipv6_local_fn(unsigned int hooknum, · 29 unmodified lines
222223 }
223224 #ifdef CONFIG_XFRM
224225 else if (!(IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) &&
226+ ct->tuplehash[dir].tuple.dst.protonum != IPPROTO_ICMPV6 &&
225227 ct->tuplehash[dir].tuple.dst.u.all !=
226228 ct->tuplehash[!dir].tuple.src.u.all)
227229 if (nf_xfrm_me_harder(skb, AF_INET6))
net/ipv6/netfilter/nf_conntrack_reasm.c+2−2
@@ -85,7 +85,7 @@ static struct ctl_table nf_ct_frag6_sysctl_table[] = { · 84 unmodified lines
8585 { }
8686 };
8787
88−static int __net_init nf_ct_frag6_sysctl_register(struct net *net)
88+static int nf_ct_frag6_sysctl_register(struct net *net)
8989 {
9090 struct ctl_table *table;
9191 struct ctl_table_header *hdr;
@@ -127,7 +127,7 @@ static void __net_exit nf_ct_frags6_sysctl_unregister(struct net *net) · 35 unmodified lines
127127 }
128128
129129 #else
130−static int __net_init nf_ct_frag6_sysctl_register(struct net *net)
130+static int nf_ct_frag6_sysctl_register(struct net *net)
131131 {
132132 return 0;
133133 }
net/l2tp/l2tp_eth.c+1−0
@@ -291,6 +291,7 @@ static int l2tp_eth_create(struct net *net, u32 tunnel_id, u32 session_id, u32 p · 290 unmodified lines
291291
292292 out_del_dev:
293293 free_netdev(dev);
294+ spriv->dev = NULL;
294295 out_del_session:
295296 l2tp_session_delete(session);
296297 out:
net/mac80211/ibss.c+1−1
@@ -1108,7 +1108,7 @@ int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata, · 1107 unmodified lines
11081108 sdata->u.ibss.state = IEEE80211_IBSS_MLME_SEARCH;
11091109 sdata->u.ibss.ibss_join_req = jiffies;
11101110
1111− memcpy(sdata->u.ibss.ssid, params->ssid, IEEE80211_MAX_SSID_LEN);
1111+ memcpy(sdata->u.ibss.ssid, params->ssid, params->ssid_len);
11121112 sdata->u.ibss.ssid_len = params->ssid_len;
11131113
11141114 mutex_unlock(&sdata->u.ibss.mtx);
net/mac80211/rx.c+56−18
@@ -531,6 +531,11 @@ ieee80211_rx_mesh_check(struct ieee80211_rx_data *rx) · 530 unmodified lines
531531
532532 if (ieee80211_is_action(hdr->frame_control)) {
533533 u8 category;
534+
535+ /* make sure category field is present */
536+ if (rx->skb->len < IEEE80211_MIN_ACTION_SIZE)
537+ return RX_DROP_MONITOR;
538+
534539 mgmt = (struct ieee80211_mgmt *)hdr;
535540 category = mgmt->u.action.category;
536541 if (category != WLAN_CATEGORY_MESH_ACTION &&
@@ -883,14 +888,16 @@ ieee80211_rx_h_check(struct ieee80211_rx_data *rx) · 346 unmodified lines
883888 */
884889 if (rx->sta && rx->sdata->vif.type == NL80211_IFTYPE_STATION &&
885890 ieee80211_is_data_present(hdr->frame_control)) {
886− u16 ethertype;
887− u8 *payload;
888−
889− payload = rx->skb->data +
890− ieee80211_hdrlen(hdr->frame_control);
891− ethertype = (payload[6] << 8) | payload[7];
892− if (cpu_to_be16(ethertype) ==
893− rx->sdata->control_port_protocol)
891+ unsigned int hdrlen;
892+ __be16 ethertype;
893+
894+ hdrlen = ieee80211_hdrlen(hdr->frame_control);
895+
896+ if (rx->skb->len < hdrlen + 8)
897+ return RX_DROP_MONITOR;
898+
899+ skb_copy_bits(rx->skb, hdrlen + 6, &ethertype, 2);
900+ if (ethertype == rx->sdata->control_port_protocol)
894901 return RX_CONTINUE;
895902 }
896903
@@ -1462,11 +1469,14 @@ ieee80211_rx_h_defragment(struct ieee80211_rx_data *rx) · 565 unmodified lines
14621469
14631470 hdr = (struct ieee80211_hdr *)rx->skb->data;
14641471 fc = hdr->frame_control;
1472+
1473+ if (ieee80211_is_ctl(fc))
1474+ return RX_CONTINUE;
1475+
14651476 sc = le16_to_cpu(hdr->seq_ctrl);
14661477 frag = sc & IEEE80211_SCTL_FRAG;
14671478
14681479 if (likely((!ieee80211_has_morefrags(fc) && frag == 0) ||
1469− (rx->skb)->len < 24 ||
14701480 is_multicast_ether_addr(hdr->addr1))) {
14711481 /* not fragmented */
14721482 goto out;
@@ -1889,6 +1899,20 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) · 416 unmodified lines
18891899
18901900 hdr = (struct ieee80211_hdr *) skb->data;
18911901 hdrlen = ieee80211_hdrlen(hdr->frame_control);
1902+
1903+ /* make sure fixed part of mesh header is there, also checks skb len */
1904+ if (!pskb_may_pull(rx->skb, hdrlen + 6))
1905+ return RX_DROP_MONITOR;
1906+
1907+ mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen);
1908+
1909+ /* make sure full mesh header is there, also checks skb len */
1910+ if (!pskb_may_pull(rx->skb,
1911+ hdrlen + ieee80211_get_mesh_hdrlen(mesh_hdr)))
1912+ return RX_DROP_MONITOR;
1913+
1914+ /* reload pointers */
1915+ hdr = (struct ieee80211_hdr *) skb->data;
18921916 mesh_hdr = (struct ieee80211s_hdr *) (skb->data + hdrlen);
18931917
18941918 /* frame is in RMC, don't forward */
@@ -1897,7 +1921,8 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) · 2 unmodified lines
18971921 mesh_rmc_check(hdr->addr3, mesh_hdr, rx->sdata))
18981922 return RX_DROP_MONITOR;
18991923
1900− if (!ieee80211_is_data(hdr->frame_control))
1924+ if (!ieee80211_is_data(hdr->frame_control) ||
1925+ !(status->rx_flags & IEEE80211_RX_RA_MATCH))
19011926 return RX_CONTINUE;
19021927
19031928 if (!mesh_hdr->ttl)
@@ -1911,9 +1936,12 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) · 7 unmodified lines
19111936 if (is_multicast_ether_addr(hdr->addr1)) {
19121937 mpp_addr = hdr->addr3;
19131938 proxied_addr = mesh_hdr->eaddr1;
1914− } else {
1939+ } else if (mesh_hdr->flags & MESH_FLAGS_AE_A5_A6) {
1940+ /* has_a4 already checked in ieee80211_rx_mesh_check */
19151941 mpp_addr = hdr->addr4;
19161942 proxied_addr = mesh_hdr->eaddr2;
1943+ } else {
1944+ return RX_DROP_MONITOR;
19171945 }
19181946
19191947 rcu_read_lock();
@@ -1941,12 +1969,9 @@ ieee80211_rx_h_mesh_fwding(struct ieee80211_rx_data *rx) · 21 unmodified lines
19411969 }
19421970 skb_set_queue_mapping(skb, q);
19431971
1944− if (!(status->rx_flags & IEEE80211_RX_RA_MATCH))
1945− goto out;
1946−
19471972 if (!--mesh_hdr->ttl) {
19481973 IEEE80211_IFSTA_MESH_CTR_INC(ifmsh, dropped_frames_ttl);
1949− return RX_DROP_MONITOR;
1974+ goto out;
19501975 }
19511976
19521977 if (!ifmsh->mshcfg.dot11MeshForwarding)
@@ -2353,6 +2378,10 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx) · 400 unmodified lines
23532378 }
23542379 break;
23552380 case WLAN_CATEGORY_SELF_PROTECTED:
2381+ if (len < (IEEE80211_MIN_ACTION_SIZE +
2382+ sizeof(mgmt->u.action.u.self_prot.action_code)))
2383+ break;
2384+
23562385 switch (mgmt->u.action.u.self_prot.action_code) {
23572386 case WLAN_SP_MESH_PEERING_OPEN:
23582387 case WLAN_SP_MESH_PEERING_CLOSE:
@@ -2371,6 +2400,10 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx) · 12 unmodified lines
23712400 }
23722401 break;
23732402 case WLAN_CATEGORY_MESH_ACTION:
2403+ if (len < (IEEE80211_MIN_ACTION_SIZE +
2404+ sizeof(mgmt->u.action.u.mesh_action.action_code)))
2405+ break;
2406+
23742407 if (!ieee80211_vif_is_mesh(&sdata->vif))
23752408 break;
23762409 if (mesh_action_is_path_sel(mgmt) &&
@@ -2913,10 +2946,15 @@ static void __ieee80211_rx_handle_packet(struct ieee80211_hw *hw, · 536 unmodified lines
29132946 if (ieee80211_is_data(fc) || ieee80211_is_mgmt(fc))
29142947 local->dot11ReceivedFragmentCount++;
29152948
2916− if (ieee80211_is_mgmt(fc))
2917− err = skb_linearize(skb);
2918− else
2949+ if (ieee80211_is_mgmt(fc)) {
2950+ /* drop frame if too short for header */
2951+ if (skb->len < ieee80211_hdrlen(fc))
2952+ err = -ENOBUFS;
2953+ else
2954+ err = skb_linearize(skb);
2955+ } else {
29192956 err = !pskb_may_pull(skb, ieee80211_hdrlen(fc));
2957+ }
29202958
29212959 if (err) {
29222960 dev_kfree_skb(skb);
net/mac80211/util.c+35−7
@@ -643,13 +643,41 @@ u32 ieee802_11_parse_elems_crc(u8 *start, size_t len, · 642 unmodified lines
643643 break;
644644 }
645645
646− if (id != WLAN_EID_VENDOR_SPECIFIC &&
647− id != WLAN_EID_QUIET &&
648− test_bit(id, seen_elems)) {
649− elems->parse_error = true;
650− left -= elen;
651− pos += elen;
652− continue;
646+ switch (id) {
647+ case WLAN_EID_SSID:
648+ case WLAN_EID_SUPP_RATES:
649+ case WLAN_EID_FH_PARAMS:
650+ case WLAN_EID_DS_PARAMS:
651+ case WLAN_EID_CF_PARAMS:
652+ case WLAN_EID_TIM:
653+ case WLAN_EID_IBSS_PARAMS:
654+ case WLAN_EID_CHALLENGE:
655+ case WLAN_EID_RSN:
656+ case WLAN_EID_ERP_INFO:
657+ case WLAN_EID_EXT_SUPP_RATES:
658+ case WLAN_EID_HT_CAPABILITY:
659+ case WLAN_EID_HT_OPERATION:
660+ case WLAN_EID_VHT_CAPABILITY:
661+ case WLAN_EID_VHT_OPERATION:
662+ case WLAN_EID_MESH_ID:
663+ case WLAN_EID_MESH_CONFIG:
664+ case WLAN_EID_PEER_MGMT:
665+ case WLAN_EID_PREQ:
666+ case WLAN_EID_PREP:
667+ case WLAN_EID_PERR:
668+ case WLAN_EID_RANN:
669+ case WLAN_EID_CHANNEL_SWITCH:
670+ case WLAN_EID_EXT_CHANSWITCH_ANN:
671+ case WLAN_EID_COUNTRY:
672+ case WLAN_EID_PWR_CONSTRAINT:
673+ case WLAN_EID_TIMEOUT_INTERVAL:
674+ if (test_bit(id, seen_elems)) {
675+ elems->parse_error = true;
676+ left -= elen;
677+ pos += elen;
678+ continue;
679+ }
680+ break;
653681 }
654682
655683 if (calc_crc && id < 64 && (filter & (1ULL << id)))
net/netfilter/nf_conntrack_h323_main.c+2−1
@@ -753,7 +753,8 @@ static int callforward_do_filter(const union nf_inet_addr *src, · 752 unmodified lines
753753 flowi4_to_flowi(&fl1), false)) {
754754 if (!afinfo->route(&init_net, (struct dst_entry **)&rt2,
755755 flowi4_to_flowi(&fl2), false)) {
756− if (rt1->rt_gateway == rt2->rt_gateway &&
756+ if (rt_nexthop(rt1, fl1.daddr) ==
757+ rt_nexthop(rt2, fl2.daddr) &&
757758 rt1->dst.dev == rt2->dst.dev)
758759 ret = 1;
759760 dst_release(&rt2->dst);
net/sched/sch_qfq.c+79−30
@@ -84,18 +84,19 @@ · 83 unmodified lines
8484 * grp->index is the index of the group; and grp->slot_shift
8585 * is the shift for the corresponding (scaled) sigma_i.
8686 */
87−#define QFQ_MAX_INDEX 19
88−#define QFQ_MAX_WSHIFT 16
87+#define QFQ_MAX_INDEX 24
88+#define QFQ_MAX_WSHIFT 12
8989
9090 #define QFQ_MAX_WEIGHT (1<<QFQ_MAX_WSHIFT)
91−#define QFQ_MAX_WSUM (2*QFQ_MAX_WEIGHT)
91+#define QFQ_MAX_WSUM (16*QFQ_MAX_WEIGHT)
9292
9393 #define FRAC_BITS 30 /* fixed point arithmetic */
9494 #define ONE_FP (1UL << FRAC_BITS)
9595 #define IWSUM (ONE_FP/QFQ_MAX_WSUM)
9696
97−#define QFQ_MTU_SHIFT 11
97+#define QFQ_MTU_SHIFT 16 /* to support TSO/GSO */
9898 #define QFQ_MIN_SLOT_SHIFT (FRAC_BITS + QFQ_MTU_SHIFT - QFQ_MAX_INDEX)
99+#define QFQ_MIN_LMAX 256 /* min possible lmax for a class */
99100
100101 /*
101102 * Possible group states. These values are used as indexes for the bitmaps
@@ -231,6 +232,32 @@ static void qfq_update_class_params(struct qfq_sched *q, struct qfq_class *cl, · 129 unmodified lines
231232 q->wsum += delta_w;
232233 }
233234
235+static void qfq_update_reactivate_class(struct qfq_sched *q,
236+ struct qfq_class *cl,
237+ u32 inv_w, u32 lmax, int delta_w)
238+{
239+ bool need_reactivation = false;
240+ int i = qfq_calc_index(inv_w, lmax);
241+
242+ if (&q->groups[i] != cl->grp && cl->qdisc->q.qlen > 0) {
243+ /*
244+ * shift cl->F back, to not charge the
245+ * class for the not-yet-served head
246+ * packet
247+ */
248+ cl->F = cl->S;
249+ /* remove class from its slot in the old group */
250+ qfq_deactivate_class(q, cl);
251+ need_reactivation = true;
252+ }
253+
254+ qfq_update_class_params(q, cl, lmax, inv_w, delta_w);
255+
256+ if (need_reactivation) /* activate in new group */
257+ qfq_activate_class(q, cl, qdisc_peek_len(cl->qdisc));
258+}
259+
260+
234261 static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid,
235262 struct nlattr **tca, unsigned long *arg)
236263 {
@@ -238,7 +265,7 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, · 1 unmodified line
238265 struct qfq_class *cl = (struct qfq_class *)*arg;
239266 struct nlattr *tb[TCA_QFQ_MAX + 1];
240267 u32 weight, lmax, inv_w;
241− int i, err;
268+ int err;
242269 int delta_w;
243270
244271 if (tca[TCA_OPTIONS] == NULL) {
@@ -270,16 +297,14 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, · 25 unmodified lines
270297
271298 if (tb[TCA_QFQ_LMAX]) {
272299 lmax = nla_get_u32(tb[TCA_QFQ_LMAX]);
273− if (!lmax || lmax > (1UL << QFQ_MTU_SHIFT)) {
300+ if (lmax < QFQ_MIN_LMAX || lmax > (1UL << QFQ_MTU_SHIFT)) {
274301 pr_notice("qfq: invalid max length %u\n", lmax);
275302 return -EINVAL;
276303 }
277304 } else
278− lmax = 1UL << QFQ_MTU_SHIFT;
305+ lmax = psched_mtu(qdisc_dev(sch));
279306
280307 if (cl != NULL) {
281− bool need_reactivation = false;
282−
283308 if (tca[TCA_RATE]) {
284309 err = gen_replace_estimator(&cl->bstats, &cl->rate_est,
285310 qdisc_root_sleeping_lock(sch),
@@ -291,24 +316,8 @@ static int qfq_change_class(struct Qdisc *sch, u32 classid, u32 parentid, · 5 unmodified lines
291316 if (lmax == cl->lmax && inv_w == cl->inv_w)
292317 return 0; /* nothing to update */
293318
294− i = qfq_calc_index(inv_w, lmax);
295319 sch_tree_lock(sch);
296− if (&q->groups[i] != cl->grp && cl->qdisc->q.qlen > 0) {
297− /*
298− * shift cl->F back, to not charge the
299− * class for the not-yet-served head
300− * packet
301− */
302− cl->F = cl->S;
303− /* remove class from its slot in the old group */
304− qfq_deactivate_class(q, cl);
305− need_reactivation = true;
306− }
307−
308− qfq_update_class_params(q, cl, lmax, inv_w, delta_w);
309−
310− if (need_reactivation) /* activate in new group */
311− qfq_activate_class(q, cl, qdisc_peek_len(cl->qdisc));
320+ qfq_update_reactivate_class(q, cl, inv_w, lmax, delta_w);
312321 sch_tree_unlock(sch);
313322
314323 return 0;
@@ -663,15 +672,48 @@ static void qfq_make_eligible(struct qfq_sched *q, u64 old_V) · 348 unmodified lines
663672
664673
665674 /*
666− * XXX we should make sure that slot becomes less than 32.
667− * This is guaranteed by the input values.
668− * roundedS is always cl->S rounded on grp->slot_shift bits.
675+ * If the weight and lmax (max_pkt_size) of the classes do not change,
676+ * then QFQ guarantees that the slot index is never higher than
677+ * 2 + ((1<<QFQ_MTU_SHIFT)/QFQ_MIN_LMAX) * (QFQ_MAX_WEIGHT/QFQ_MAX_WSUM).
678+ *
679+ * With the current values of the above constants, the index is
680+ * then guaranteed to never be higher than 2 + 256 * (1 / 16) = 18.
681+ *
682+ * When the weight of a class is increased or the lmax of the class is
683+ * decreased, a new class with smaller slot size may happen to be
684+ * activated. The activation of this class should be properly delayed
685+ * to when the service of the class has finished in the ideal system
686+ * tracked by QFQ. If the activation of the class is not delayed to
687+ * this reference time instant, then this class may be unjustly served
688+ * before other classes waiting for service. This may cause
689+ * (unfrequently) the above bound to the slot index to be violated for
690+ * some of these unlucky classes.
691+ *
692+ * Instead of delaying the activation of the new class, which is quite
693+ * complex, the following inaccurate but simple solution is used: if
694+ * the slot index is higher than QFQ_MAX_SLOTS-2, then the timestamps
695+ * of the class are shifted backward so as to let the slot index
696+ * become equal to QFQ_MAX_SLOTS-2. This threshold is used because, if
697+ * the slot index is above it, then the data structure implementing
698+ * the bucket list either gets immediately corrupted or may get
699+ * corrupted on a possible next packet arrival that causes the start
700+ * time of the group to be shifted backward.
669701 */
670702 static void qfq_slot_insert(struct qfq_group *grp, struct qfq_class *cl,
671703 u64 roundedS)
672704 {
673705 u64 slot = (roundedS - grp->S) >> grp->slot_shift;
674− unsigned int i = (grp->front + slot) % QFQ_MAX_SLOTS;
706+ unsigned int i; /* slot index in the bucket list */
707+
708+ if (unlikely(slot > QFQ_MAX_SLOTS - 2)) {
709+ u64 deltaS = roundedS - grp->S -
710+ ((u64)(QFQ_MAX_SLOTS - 2)<<grp->slot_shift);
711+ cl->S -= deltaS;
712+ cl->F -= deltaS;
713+ slot = QFQ_MAX_SLOTS - 2;
714+ }
715+
716+ i = (grp->front + slot) % QFQ_MAX_SLOTS;
675717
676718 hlist_add_head(&cl->next, &grp->slots[i]);
677719 __set_bit(slot, &grp->full_slots);
@@ -892,6 +934,13 @@ static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch) · 214 unmodified lines
892934 }
893935 pr_debug("qfq_enqueue: cl = %x\n", cl->common.classid);
894936
937+ if (unlikely(cl->lmax < qdisc_pkt_len(skb))) {
938+ pr_debug("qfq: increasing maxpkt from %u to %u for class %u",
939+ cl->lmax, qdisc_pkt_len(skb), cl->common.classid);
940+ qfq_update_reactivate_class(q, cl, cl->inv_w,
941+ qdisc_pkt_len(skb), 0);
942+ }
943+
895944 err = qdisc_enqueue(skb, cl->qdisc);
896945 if (unlikely(err != NET_XMIT_SUCCESS)) {
897946 pr_debug("qfq_enqueue: enqueue failed %d\n", err);
net/sctp/socket.c+1−1
@@ -974,7 +974,7 @@ SCTP_STATIC int sctp_setsockopt_bindx(struct sock* sk, · 973 unmodified lines
974974 void *addr_buf;
975975 struct sctp_af *af;
976976
977− SCTP_DEBUG_PRINTK("sctp_setsocktopt_bindx: sk %p addrs %p"
977+ SCTP_DEBUG_PRINTK("sctp_setsockopt_bindx: sk %p addrs %p"
978978 " addrs_size %d opt %d\n", sk, addrs, addrs_size, op);
979979
980980 if (unlikely(addrs_size <= 0))
net/sunrpc/backchannel_rqst.c+1−1
@@ -172,7 +172,7 @@ out_free: · 171 unmodified lines
172172 xprt_free_allocation(req);
173173
174174 dprintk("RPC: setup backchannel transport failed\n");
175− return -1;
175+ return -ENOMEM;
176176 }
177177 EXPORT_SYMBOL_GPL(xprt_setup_backchannel);
178178
net/tipc/handler.c+0−1
@@ -116,7 +116,6 @@ void tipc_handler_stop(void) · 115 unmodified lines
116116 return;
117117
118118 handler_enabled = 0;
119− tasklet_disable(&tipc_tasklet);
120119 tasklet_kill(&tipc_tasklet);
121120
122121 spin_lock_bh(&qitem_lock);
net/wireless/core.c+1−2
@@ -526,8 +526,7 @@ int wiphy_register(struct wiphy *wiphy) · 525 unmodified lines
526526 for (i = 0; i < sband->n_channels; i++) {
527527 sband->channels[i].orig_flags =
528528 sband->channels[i].flags;
529− sband->channels[i].orig_mag =
530− sband->channels[i].max_antenna_gain;
529+ sband->channels[i].orig_mag = INT_MAX;
531530 sband->channels[i].orig_mpwr =
532531 sband->channels[i].max_power;
533532 sband->channels[i].band = band;
net/wireless/reg.c+3−2
@@ -908,7 +908,7 @@ static void handle_channel(struct wiphy *wiphy, · 907 unmodified lines
908908 map_regdom_flags(reg_rule->flags) | bw_flags;
909909 chan->max_antenna_gain = chan->orig_mag =
910910 (int) MBI_TO_DBI(power_rule->max_antenna_gain);
911− chan->max_power = chan->orig_mpwr =
911+ chan->max_reg_power = chan->max_power = chan->orig_mpwr =
912912 (int) MBM_TO_DBM(power_rule->max_eirp);
913913 return;
914914 }
@@ -1331,7 +1331,8 @@ static void handle_channel_custom(struct wiphy *wiphy, · 416 unmodified lines
13311331
13321332 chan->flags |= map_regdom_flags(reg_rule->flags) | bw_flags;
13331333 chan->max_antenna_gain = (int) MBI_TO_DBI(power_rule->max_antenna_gain);
1334− chan->max_power = (int) MBM_TO_DBM(power_rule->max_eirp);
1334+ chan->max_reg_power = chan->max_power =
1335+ (int) MBM_TO_DBM(power_rule->max_eirp);
13351336 }
13361337
13371338 static void handle_band_custom(struct wiphy *wiphy, enum ieee80211_band band,
net/wireless/util.c+8−6
@@ -309,23 +309,21 @@ unsigned int ieee80211_get_hdrlen_from_skb(const struct sk_buff *skb) · 308 unmodified lines
309309 }
310310 EXPORT_SYMBOL(ieee80211_get_hdrlen_from_skb);
311311
312−static int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
312+unsigned int ieee80211_get_mesh_hdrlen(struct ieee80211s_hdr *meshhdr)
313313 {
314314 int ae = meshhdr->flags & MESH_FLAGS_AE;
315− /* 7.1.3.5a.2 */
315+ /* 802.11-2012, 8.2.4.7.3 */
316316 switch (ae) {
317+ default:
317318 case 0:
318319 return 6;
319320 case MESH_FLAGS_AE_A4:
320321 return 12;
321322 case MESH_FLAGS_AE_A5_A6:
322323 return 18;
323− case (MESH_FLAGS_AE_A4 | MESH_FLAGS_AE_A5_A6):
324− return 24;
325− default:
326− return 6;
327324 }
328325 }
326+EXPORT_SYMBOL(ieee80211_get_mesh_hdrlen);
329327
330328 int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr,
331329 enum nl80211_iftype iftype)
@@ -373,6 +371,8 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, · 41 unmodified lines
373371 /* make sure meshdr->flags is on the linear part */
374372 if (!pskb_may_pull(skb, hdrlen + 1))
375373 return -1;
374+ if (meshdr->flags & MESH_FLAGS_AE_A4)
375+ return -1;
376376 if (meshdr->flags & MESH_FLAGS_AE_A5_A6) {
377377 skb_copy_bits(skb, hdrlen +
378378 offsetof(struct ieee80211s_hdr, eaddr1),
@@ -397,6 +397,8 @@ int ieee80211_data_to_8023(struct sk_buff *skb, const u8 *addr, · 18 unmodified lines
397397 /* make sure meshdr->flags is on the linear part */
398398 if (!pskb_may_pull(skb, hdrlen + 1))
399399 return -1;
400+ if (meshdr->flags & MESH_FLAGS_AE_A5_A6)
401+ return -1;
400402 if (meshdr->flags & MESH_FLAGS_AE_A4)
401403 skb_copy_bits(skb, hdrlen +
402404 offsetof(struct ieee80211s_hdr, eaddr1),
scripts/Makefile.modinst+2−1
@@ -16,8 +16,9 @@ PHONY += $(modules) · 15 unmodified lines
1616 __modinst: $(modules)
1717 @:
1818
19+# Don't stop modules_install if we can't sign external modules.
1920 quiet_cmd_modules_install = INSTALL $@
20− cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@) ; $(mod_sign_cmd) $(2)/$(notdir $@)
21+ cmd_modules_install = mkdir -p $(2); cp $@ $(2) ; $(mod_strip_cmd) $(2)/$(notdir $@) ; $(mod_sign_cmd) $(2)/$(notdir $@) $(patsubst %,|| true,$(KBUILD_EXTMOD))
2122
2223 # Modules built outside the kernel source tree go into extra by default
2324 INSTALL_MOD_DIR ?= extra
scripts/checkpatch.pl+4−2
@@ -1890,8 +1890,10 @@ sub process { · 1889 unmodified lines
18901890 }
18911891
18921892 if ($realfile =~ m@^(drivers/net/|net/)@ &&
1893− $rawline !~ m@^\+[ \t]*(\/\*|\*\/)@ &&
1894− $rawline =~ m@^\+[ \t]*.+\*\/[ \t]*$@) {
1893+ $rawline !~ m@^\+[ \t]*\*/[ \t]*$@ && #trailing */
1894+ $rawline !~ m@^\+.*/\*.*\*/[ \t]*$@ && #inline /*...*/
1895+ $rawline !~ m@^\+.*\*{2,}/[ \t]*$@ && #trailing **/
1896+ $rawline =~ m@^\+[ \t]*.+\*\/[ \t]*$@) { #non blank */
18951897 WARN("NETWORKING_BLOCK_COMMENT_STYLE",
18961898 "networking block comments put the trailing */ on a separate line\n" . $herecurr);
18971899 }
sound/core/compress_offload.c+7−2
@@ -100,12 +100,15 @@ static int snd_compr_open(struct inode *inode, struct file *f) · 99 unmodified lines
100100
101101 if (dirn != compr->direction) {
102102 pr_err("this device doesn't support this direction\n");
103+ snd_card_unref(compr->card);
103104 return -EINVAL;
104105 }
105106
106107 data = kzalloc(sizeof(*data), GFP_KERNEL);
107− if (!data)
108+ if (!data) {
109+ snd_card_unref(compr->card);
108110 return -ENOMEM;
111+ }
109112 data->stream.ops = compr->ops;
110113 data->stream.direction = dirn;
111114 data->stream.private_data = compr->private_data;
@@ -113,6 +116,7 @@ static int snd_compr_open(struct inode *inode, struct file *f) · 1 unmodified line
113116 runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
114117 if (!runtime) {
115118 kfree(data);
119+ snd_card_unref(compr->card);
116120 return -ENOMEM;
117121 }
118122 runtime->state = SNDRV_PCM_STATE_OPEN;
@@ -126,7 +130,8 @@ static int snd_compr_open(struct inode *inode, struct file *f) · 7 unmodified lines
126130 kfree(runtime);
127131 kfree(data);
128132 }
129− return ret;
133+ snd_card_unref(compr->card);
134+ return 0;
130135 }
131136
132137 static int snd_compr_free(struct inode *inode, struct file *f)
sound/core/control.c+5−0
@@ -86,6 +86,7 @@ static int snd_ctl_open(struct inode *inode, struct file *file) · 85 unmodified lines
8686 write_lock_irqsave(&card->ctl_files_rwlock, flags);
8787 list_add_tail(&ctl->list, &card->ctl_files);
8888 write_unlock_irqrestore(&card->ctl_files_rwlock, flags);
89+ snd_card_unref(card);
8990 return 0;
9091
9192 __error:
@@ -93,6 +94,8 @@ static int snd_ctl_open(struct inode *inode, struct file *file) · 1 unmodified line
9394 __error2:
9495 snd_card_file_remove(card, file);
9596 __error1:
97+ if (card)
98+ snd_card_unref(card);
9699 return err;
97100 }
98101
@@ -1434,6 +1437,8 @@ static ssize_t snd_ctl_read(struct file *file, char __user *buffer, · 1335 unmodified lines
14341437 spin_unlock_irq(&ctl->read_lock);
14351438 schedule();
14361439 remove_wait_queue(&ctl->change_sleep, &wait);
1440+ if (ctl->card->shutdown)
1441+ return -ENODEV;
14371442 if (signal_pending(current))
14381443 return -ERESTARTSYS;
14391444 spin_lock_irq(&ctl->read_lock);
sound/core/hwdep.c+11−1
@@ -100,8 +100,10 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) · 99 unmodified lines
100100 if (hw == NULL)
101101 return -ENODEV;
102102
103− if (!try_module_get(hw->card->module))
103+ if (!try_module_get(hw->card->module)) {
104+ snd_card_unref(hw->card);
104105 return -EFAULT;
106+ }
105107
106108 init_waitqueue_entry(&wait, current);
107109 add_wait_queue(&hw->open_wait, &wait);
@@ -129,6 +131,10 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) · 21 unmodified lines
129131 mutex_unlock(&hw->open_mutex);
130132 schedule();
131133 mutex_lock(&hw->open_mutex);
134+ if (hw->card->shutdown) {
135+ err = -ENODEV;
136+ break;
137+ }
132138 if (signal_pending(current)) {
133139 err = -ERESTARTSYS;
134140 break;
@@ -148,6 +154,7 @@ static int snd_hwdep_open(struct inode *inode, struct file * file) · 13 unmodified lines
148154 mutex_unlock(&hw->open_mutex);
149155 if (err < 0)
150156 module_put(hw->card->module);
157+ snd_card_unref(hw->card);
151158 return err;
152159 }
153160
@@ -459,12 +466,15 @@ static int snd_hwdep_dev_disconnect(struct snd_device *device) · 305 unmodified lines
459466 mutex_unlock(&register_mutex);
460467 return -EINVAL;
461468 }
469+ mutex_lock(&hwdep->open_mutex);
470+ wake_up(&hwdep->open_wait);
462471 #ifdef CONFIG_SND_OSSEMUL
463472 if (hwdep->ossreg)
464473 snd_unregister_oss_device(hwdep->oss_type, hwdep->card, hwdep->device);
465474 #endif
466475 snd_unregister_device(SNDRV_DEVICE_TYPE_HWDEP, hwdep->card, hwdep->device);
467476 list_del_init(&hwdep->list);
477+ mutex_unlock(&hwdep->open_mutex);
468478 mutex_unlock(&register_mutex);
469479 return 0;
470480 }
sound/core/init.c+30−20
@@ -213,6 +213,7 @@ int snd_card_create(int idx, const char *xid, · 212 unmodified lines
213213 spin_lock_init(&card->files_lock);
214214 INIT_LIST_HEAD(&card->files_list);
215215 init_waitqueue_head(&card->shutdown_sleep);
216+ atomic_set(&card->refcount, 0);
216217 #ifdef CONFIG_PM
217218 mutex_init(&card->power_lock);
218219 init_waitqueue_head(&card->power_sleep);
@@ -446,21 +447,36 @@ static int snd_card_do_free(struct snd_card *card) · 227 unmodified lines
446447 return 0;
447448 }
448449
450+/**
451+ * snd_card_unref - release the reference counter
452+ * @card: the card instance
453+ *
454+ * Decrements the reference counter. When it reaches to zero, wake up
455+ * the sleeper and call the destructor if needed.
456+ */
457+void snd_card_unref(struct snd_card *card)
458+{
459+ if (atomic_dec_and_test(&card->refcount)) {
460+ wake_up(&card->shutdown_sleep);
461+ if (card->free_on_last_close)
462+ snd_card_do_free(card);
463+ }
464+}
465+EXPORT_SYMBOL(snd_card_unref);
466+
449467 int snd_card_free_when_closed(struct snd_card *card)
450468 {
451− int free_now = 0;
452− int ret = snd_card_disconnect(card);
453− if (ret)
454− return ret;
469+ int ret;
455470
456− spin_lock(&card->files_lock);
457− if (list_empty(&card->files_list))
458− free_now = 1;
459− else
460− card->free_on_last_close = 1;
461− spin_unlock(&card->files_lock);
471+ atomic_inc(&card->refcount);
472+ ret = snd_card_disconnect(card);
473+ if (ret) {
474+ atomic_dec(&card->refcount);
475+ return ret;
476+ }
462477
463− if (free_now)
478+ card->free_on_last_close = 1;
479+ if (atomic_dec_and_test(&card->refcount))
464480 snd_card_do_free(card);
465481 return 0;
466482 }
@@ -474,7 +490,7 @@ int snd_card_free(struct snd_card *card) · 7 unmodified lines
474490 return ret;
475491
476492 /* wait, until all devices are ready for the free operation */
477− wait_event(card->shutdown_sleep, list_empty(&card->files_list));
493+ wait_event(card->shutdown_sleep, !atomic_read(&card->refcount));
478494 snd_card_do_free(card);
479495 return 0;
480496 }
@@ -886,6 +902,7 @@ int snd_card_file_add(struct snd_card *card, struct file *file) · 405 unmodified lines
886902 return -ENODEV;
887903 }
888904 list_add(&mfile->list, &card->files_list);
905+ atomic_inc(&card->refcount);
889906 spin_unlock(&card->files_lock);
890907 return 0;
891908 }
@@ -908,7 +925,6 @@ EXPORT_SYMBOL(snd_card_file_add); · 16 unmodified lines
908925 int snd_card_file_remove(struct snd_card *card, struct file *file)
909926 {
910927 struct snd_monitor_file *mfile, *found = NULL;
911− int last_close = 0;
912928
913929 spin_lock(&card->files_lock);
914930 list_for_each_entry(mfile, &card->files_list, list) {
@@ -923,19 +939,13 @@ int snd_card_file_remove(struct snd_card *card, struct file *file) · 8 unmodified lines
923939 break;
924940 }
925941 }
926− if (list_empty(&card->files_list))
927− last_close = 1;
928942 spin_unlock(&card->files_lock);
929− if (last_close) {
930− wake_up(&card->shutdown_sleep);
931− if (card->free_on_last_close)
932− snd_card_do_free(card);
933− }
934943 if (!found) {
935944 snd_printk(KERN_ERR "ALSA card file remove problem (%p)\n", file);
936945 return -ENOENT;
937946 }
938947 kfree(found);
948+ snd_card_unref(card);
939949 return 0;
940950 }
941951
sound/core/oss/mixer_oss.c+9−2
@@ -52,14 +52,19 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file) · 51 unmodified lines
5252 SNDRV_OSS_DEVICE_TYPE_MIXER);
5353 if (card == NULL)
5454 return -ENODEV;
55− if (card->mixer_oss == NULL)
55+ if (card->mixer_oss == NULL) {
56+ snd_card_unref(card);
5657 return -ENODEV;
58+ }
5759 err = snd_card_file_add(card, file);
58− if (err < 0)
60+ if (err < 0) {
61+ snd_card_unref(card);
5962 return err;
63+ }
6064 fmixer = kzalloc(sizeof(*fmixer), GFP_KERNEL);
6165 if (fmixer == NULL) {
6266 snd_card_file_remove(card, file);
67+ snd_card_unref(card);
6368 return -ENOMEM;
6469 }
6570 fmixer->card = card;
@@ -68,8 +73,10 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file) · 2 unmodified lines
6873 if (!try_module_get(card->module)) {
6974 kfree(fmixer);
7075 snd_card_file_remove(card, file);
76+ snd_card_unref(card);
7177 return -EFAULT;
7278 }
79+ snd_card_unref(card);
7380 return 0;
7481 }
7582
sound/core/oss/pcm_oss.c+7−0
@@ -2441,6 +2441,10 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file) · 2440 unmodified lines
24412441 mutex_unlock(&pcm->open_mutex);
24422442 schedule();
24432443 mutex_lock(&pcm->open_mutex);
2444+ if (pcm->card->shutdown) {
2445+ err = -ENODEV;
2446+ break;
2447+ }
24442448 if (signal_pending(current)) {
24452449 err = -ERESTARTSYS;
24462450 break;
@@ -2450,6 +2454,7 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file) · 3 unmodified lines
24502454 mutex_unlock(&pcm->open_mutex);
24512455 if (err < 0)
24522456 goto __error;
2457+ snd_card_unref(pcm->card);
24532458 return err;
24542459
24552460 __error:
@@ -2457,6 +2462,8 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file) · 1 unmodified line
24572462 __error2:
24582463 snd_card_file_remove(pcm->card, file);
24592464 __error1:
2465+ if (pcm)
2466+ snd_card_unref(pcm->card);
24602467 return err;
24612468 }
24622469
sound/core/pcm.c+11−2
@@ -1086,11 +1086,19 @@ static int snd_pcm_dev_disconnect(struct snd_device *device) · 1085 unmodified lines
10861086 if (list_empty(&pcm->list))
10871087 goto unlock;
10881088
1089+ mutex_lock(&pcm->open_mutex);
1090+ wake_up(&pcm->open_wait);
10891091 list_del_init(&pcm->list);
10901092 for (cidx = 0; cidx < 2; cidx++)
1091− for (substream = pcm->streams[cidx].substream; substream; substream = substream->next)
1092− if (substream->runtime)
1093+ for (substream = pcm->streams[cidx].substream; substream; substream = substream->next) {
1094+ snd_pcm_stream_lock_irq(substream);
1095+ if (substream->runtime) {
10931096 substream->runtime->status->state = SNDRV_PCM_STATE_DISCONNECTED;
1097+ wake_up(&substream->runtime->sleep);
1098+ wake_up(&substream->runtime->tsleep);
1099+ }
1100+ snd_pcm_stream_unlock_irq(substream);
1101+ }
10941102 list_for_each_entry(notify, &snd_pcm_notify_list, list) {
10951103 notify->n_disconnect(pcm);
10961104 }
@@ -1110,6 +1118,7 @@ static int snd_pcm_dev_disconnect(struct snd_device *device) · 13 unmodified lines
11101118 pcm->streams[cidx].chmap_kctl = NULL;
11111119 }
11121120 }
1121+ mutex_unlock(&pcm->open_mutex);
11131122 unlock:
11141123 mutex_unlock(&register_mutex);
11151124 return 0;
sound/core/pcm_native.c+29−6
@@ -369,6 +369,14 @@ static int period_to_usecs(struct snd_pcm_runtime *runtime) · 368 unmodified lines
369369 return usecs;
370370 }
371371
372+static void snd_pcm_set_state(struct snd_pcm_substream *substream, int state)
373+{
374+ snd_pcm_stream_lock_irq(substream);
375+ if (substream->runtime->status->state != SNDRV_PCM_STATE_DISCONNECTED)
376+ substream->runtime->status->state = state;
377+ snd_pcm_stream_unlock_irq(substream);
378+}
379+
372380 static int snd_pcm_hw_params(struct snd_pcm_substream *substream,
373381 struct snd_pcm_hw_params *params)
374382 {
@@ -452,7 +460,7 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream, · 77 unmodified lines
452460 runtime->boundary *= 2;
453461
454462 snd_pcm_timer_resolution_change(substream);
455− runtime->status->state = SNDRV_PCM_STATE_SETUP;
463+ snd_pcm_set_state(substream, SNDRV_PCM_STATE_SETUP);
456464
457465 if (pm_qos_request_active(&substream->latency_pm_qos_req))
458466 pm_qos_remove_request(&substream->latency_pm_qos_req);
@@ -464,7 +472,7 @@ static int snd_pcm_hw_params(struct snd_pcm_substream *substream, · 5 unmodified lines
464472 /* hardware might be unusable from this time,
465473 so we force application to retry to set
466474 the correct hardware parameter settings */
467− runtime->status->state = SNDRV_PCM_STATE_OPEN;
475+ snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN);
468476 if (substream->ops->hw_free != NULL)
469477 substream->ops->hw_free(substream);
470478 return err;
@@ -512,7 +520,7 @@ static int snd_pcm_hw_free(struct snd_pcm_substream *substream) · 41 unmodified lines
512520 return -EBADFD;
513521 if (substream->ops->hw_free)
514522 result = substream->ops->hw_free(substream);
515− runtime->status->state = SNDRV_PCM_STATE_OPEN;
523+ snd_pcm_set_state(substream, SNDRV_PCM_STATE_OPEN);
516524 pm_qos_remove_request(&substream->latency_pm_qos_req);
517525 return result;
518526 }
@@ -1320,7 +1328,7 @@ static void snd_pcm_post_prepare(struct snd_pcm_substream *substream, int state) · 801 unmodified lines
13201328 {
13211329 struct snd_pcm_runtime *runtime = substream->runtime;
13221330 runtime->control->appl_ptr = runtime->status->hw_ptr;
1323− runtime->status->state = SNDRV_PCM_STATE_PREPARED;
1331+ snd_pcm_set_state(substream, SNDRV_PCM_STATE_PREPARED);
13241332 }
13251333
13261334 static struct action_ops snd_pcm_action_prepare = {
@@ -1510,6 +1518,10 @@ static int snd_pcm_drain(struct snd_pcm_substream *substream, · 183 unmodified lines
15101518 down_read(&snd_pcm_link_rwsem);
15111519 snd_pcm_stream_lock_irq(substream);
15121520 remove_wait_queue(&to_check->sleep, &wait);
1521+ if (card->shutdown) {
1522+ result = -ENODEV;
1523+ break;
1524+ }
15131525 if (tout == 0) {
15141526 if (substream->runtime->status->state == SNDRV_PCM_STATE_SUSPENDED)
15151527 result = -ESTRPIPE;
@@ -1634,6 +1646,7 @@ static int snd_pcm_link(struct snd_pcm_substream *substream, int fd) · 118 unmodified lines
16341646 write_unlock_irq(&snd_pcm_link_rwlock);
16351647 up_write(&snd_pcm_link_rwsem);
16361648 _nolock:
1649+ snd_card_unref(substream1->pcm->card);
16371650 fput_light(file, fput_needed);
16381651 if (res < 0)
16391652 kfree(group);
@@ -2108,7 +2121,10 @@ static int snd_pcm_playback_open(struct inode *inode, struct file *file) · 468 unmodified lines
21082121 return err;
21092122 pcm = snd_lookup_minor_data(iminor(inode),
21102123 SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
2111− return snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_PLAYBACK);
2124+ err = snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_PLAYBACK);
2125+ if (pcm)
2126+ snd_card_unref(pcm->card);
2127+ return err;
21122128 }
21132129
21142130 static int snd_pcm_capture_open(struct inode *inode, struct file *file)
@@ -2119,7 +2135,10 @@ static int snd_pcm_capture_open(struct inode *inode, struct file *file) · 4 unmodified lines
21192135 return err;
21202136 pcm = snd_lookup_minor_data(iminor(inode),
21212137 SNDRV_DEVICE_TYPE_PCM_CAPTURE);
2122− return snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_CAPTURE);
2138+ err = snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_CAPTURE);
2139+ if (pcm)
2140+ snd_card_unref(pcm->card);
2141+ return err;
21232142 }
21242143
21252144 static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream)
@@ -2156,6 +2175,10 @@ static int snd_pcm_open(struct file *file, struct snd_pcm *pcm, int stream) · 30 unmodified lines
21562175 mutex_unlock(&pcm->open_mutex);
21572176 schedule();
21582177 mutex_lock(&pcm->open_mutex);
2178+ if (pcm->card->shutdown) {
2179+ err = -ENODEV;
2180+ break;
2181+ }
21592182 if (signal_pending(current)) {
21602183 err = -ERESTARTSYS;
21612184 break;
sound/core/rawmidi.c+25−1
@@ -379,8 +379,10 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) · 378 unmodified lines
379379 if (rmidi == NULL)
380380 return -ENODEV;
381381
382− if (!try_module_get(rmidi->card->module))
382+ if (!try_module_get(rmidi->card->module)) {
383+ snd_card_unref(rmidi->card);
383384 return -ENXIO;
385+ }
384386
385387 mutex_lock(&rmidi->open_mutex);
386388 card = rmidi->card;
@@ -422,6 +424,10 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) · 35 unmodified lines
422424 mutex_unlock(&rmidi->open_mutex);
423425 schedule();
424426 mutex_lock(&rmidi->open_mutex);
427+ if (rmidi->card->shutdown) {
428+ err = -ENODEV;
429+ break;
430+ }
425431 if (signal_pending(current)) {
426432 err = -ERESTARTSYS;
427433 break;
@@ -440,6 +446,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) · 12 unmodified lines
440446 #endif
441447 file->private_data = rawmidi_file;
442448 mutex_unlock(&rmidi->open_mutex);
449+ snd_card_unref(rmidi->card);
443450 return 0;
444451
445452 __error:
@@ -447,6 +454,7 @@ static int snd_rawmidi_open(struct inode *inode, struct file *file) · 1 unmodified line
447454 __error_card:
448455 mutex_unlock(&rmidi->open_mutex);
449456 module_put(rmidi->card->module);
457+ snd_card_unref(rmidi->card);
450458 return err;
451459 }
452460
@@ -991,6 +999,8 @@ static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t coun · 538 unmodified lines
991999 spin_unlock_irq(&runtime->lock);
9921000 schedule();
9931001 remove_wait_queue(&runtime->sleep, &wait);
1002+ if (rfile->rmidi->card->shutdown)
1003+ return -ENODEV;
9941004 if (signal_pending(current))
9951005 return result > 0 ? result : -ERESTARTSYS;
9961006 if (!runtime->avail)
@@ -1234,6 +1244,8 @@ static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, · 237 unmodified lines
12341244 spin_unlock_irq(&runtime->lock);
12351245 timeout = schedule_timeout(30 * HZ);
12361246 remove_wait_queue(&runtime->sleep, &wait);
1247+ if (rfile->rmidi->card->shutdown)
1248+ return -ENODEV;
12371249 if (signal_pending(current))
12381250 return result > 0 ? result : -ERESTARTSYS;
12391251 if (!runtime->avail && !timeout)
@@ -1609,9 +1621,20 @@ static int snd_rawmidi_dev_register(struct snd_device *device) · 369 unmodified lines
16091621 static int snd_rawmidi_dev_disconnect(struct snd_device *device)
16101622 {
16111623 struct snd_rawmidi *rmidi = device->device_data;
1624+ int dir;
16121625
16131626 mutex_lock(&register_mutex);
1627+ mutex_lock(&rmidi->open_mutex);
1628+ wake_up(&rmidi->open_wait);
16141629 list_del_init(&rmidi->list);
1630+ for (dir = 0; dir < 2; dir++) {
1631+ struct snd_rawmidi_substream *s;
1632+ list_for_each_entry(s, &rmidi->streams[dir].substreams, list) {
1633+ if (s->runtime)
1634+ wake_up(&s->runtime->sleep);
1635+ }
1636+ }
1637+
16151638 #ifdef CONFIG_SND_OSSEMUL
16161639 if (rmidi->ossreg) {
16171640 if ((int)rmidi->device == midi_map[rmidi->card->number]) {
@@ -1626,6 +1649,7 @@ static int snd_rawmidi_dev_disconnect(struct snd_device *device) · 8 unmodified lines
16261649 }
16271650 #endif /* CONFIG_SND_OSSEMUL */
16281651 snd_unregister_device(SNDRV_DEVICE_TYPE_RAWMIDI, rmidi->card, rmidi->device);
1652+ mutex_unlock(&rmidi->open_mutex);
16291653 mutex_unlock(&register_mutex);
16301654 return 0;
16311655 }
sound/core/sound.c+9−2
@@ -98,6 +98,10 @@ static void snd_request_other(int minor) · 97 unmodified lines
9898 *
9999 * Checks that a minor device with the specified type is registered, and returns
100100 * its user data pointer.
101+ *
102+ * This function increments the reference counter of the card instance
103+ * if an associated instance with the given minor number and type is found.
104+ * The caller must call snd_card_unref() appropriately later.
101105 */
102106 void *snd_lookup_minor_data(unsigned int minor, int type)
103107 {
@@ -108,9 +112,11 @@ void *snd_lookup_minor_data(unsigned int minor, int type) · 4 unmodified lines
108112 return NULL;
109113 mutex_lock(&sound_mutex);
110114 mreg = snd_minors[minor];
111− if (mreg && mreg->type == type)
115+ if (mreg && mreg->type == type) {
112116 private_data = mreg->private_data;
113− else
117+ if (private_data && mreg->card_ptr)
118+ atomic_inc(&mreg->card_ptr->refcount);
119+ } else
114120 private_data = NULL;
115121 mutex_unlock(&sound_mutex);
116122 return private_data;
@@ -275,6 +281,7 @@ int snd_register_device_for_dev(int type, struct snd_card *card, int dev, · 158 unmodified lines
275281 preg->device = dev;
276282 preg->f_ops = f_ops;
277283 preg->private_data = private_data;
284+ preg->card_ptr = card;
278285 mutex_lock(&sound_mutex);
279286 #ifdef CONFIG_SND_DYNAMIC_MINORS
280287 minor = snd_find_free_minor(type);
sound/core/sound_oss.c+8−2
@@ -40,6 +40,9 @@ · 39 unmodified lines
4040 static struct snd_minor *snd_oss_minors[SNDRV_OSS_MINORS];
4141 static DEFINE_MUTEX(sound_oss_mutex);
4242
43+/* NOTE: This function increments the refcount of the associated card like
44+ * snd_lookup_minor_data(); the caller must call snd_card_unref() appropriately
45+ */
4346 void *snd_lookup_oss_minor_data(unsigned int minor, int type)
4447 {
4548 struct snd_minor *mreg;
@@ -49,9 +52,11 @@ void *snd_lookup_oss_minor_data(unsigned int minor, int type) · 3 unmodified lines
4952 return NULL;
5053 mutex_lock(&sound_oss_mutex);
5154 mreg = snd_oss_minors[minor];
52− if (mreg && mreg->type == type)
55+ if (mreg && mreg->type == type) {
5356 private_data = mreg->private_data;
54− else
57+ if (private_data && mreg->card_ptr)
58+ atomic_inc(&mreg->card_ptr->refcount);
59+ } else
5560 private_data = NULL;
5661 mutex_unlock(&sound_oss_mutex);
5762 return private_data;
@@ -123,6 +128,7 @@ int snd_register_oss_device(int type, struct snd_card *card, int dev, · 65 unmodified lines
123128 preg->device = dev;
124129 preg->f_ops = f_ops;
125130 preg->private_data = private_data;
131+ preg->card_ptr = card;
126132 mutex_lock(&sound_oss_mutex);
127133 snd_oss_minors[minor] = preg;
128134 minor_unit = SNDRV_MINOR_OSS_DEVICE(minor);
sound/i2c/other/ak4113.c+1−1
@@ -426,7 +426,7 @@ static struct snd_kcontrol_new snd_ak4113_iec958_controls[] = { · 425 unmodified lines
426426 },
427427 {
428428 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
429− .name = "IEC958 Preample Capture Default",
429+ .name = "IEC958 Preamble Capture Default",
430430 .access = SNDRV_CTL_ELEM_ACCESS_READ |
431431 SNDRV_CTL_ELEM_ACCESS_VOLATILE,
432432 .info = snd_ak4113_spdif_pinfo,
sound/i2c/other/ak4114.c+1−1
@@ -401,7 +401,7 @@ static struct snd_kcontrol_new snd_ak4114_iec958_controls[] = { · 400 unmodified lines
401401 },
402402 {
403403 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
404− .name = "IEC958 Preample Capture Default",
404+ .name = "IEC958 Preamble Capture Default",
405405 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
406406 .info = snd_ak4114_spdif_pinfo,
407407 .get = snd_ak4114_spdif_pget,
sound/i2c/other/ak4117.c+1−1
@@ -380,7 +380,7 @@ static struct snd_kcontrol_new snd_ak4117_iec958_controls[] = { · 379 unmodified lines
380380 },
381381 {
382382 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
383− .name = "IEC958 Preample Capture Default",
383+ .name = "IEC958 Preamble Capture Default",
384384 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
385385 .info = snd_ak4117_spdif_pinfo,
386386 .get = snd_ak4117_spdif_pget,
sound/pci/es1968.c+2−0
@@ -2655,6 +2655,8 @@ static struct ess_device_list pm_whitelist[] __devinitdata = { · 2654 unmodified lines
26552655 { TYPE_MAESTRO2E, 0x1179 },
26562656 { TYPE_MAESTRO2E, 0x14c0 }, /* HP omnibook 4150 */
26572657 { TYPE_MAESTRO2E, 0x1558 },
2658+ { TYPE_MAESTRO2E, 0x125d }, /* a PCI card, e.g. Terratec DMX */
2659+ { TYPE_MAESTRO2, 0x125d }, /* a PCI card, e.g. SF64-PCE2 */
26582660 };
26592661
26602662 static struct ess_device_list mpu_blacklist[] __devinitdata = {
sound/pci/hda/hda_intel.c+2−0
@@ -3563,6 +3563,8 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = { · 3562 unmodified lines
35633563 /* Teradici */
35643564 { PCI_DEVICE(0x6549, 0x1200),
35653565 .driver_data = AZX_DRIVER_TERA | AZX_DCAPS_NO_64BIT },
3566+ { PCI_DEVICE(0x6549, 0x2200),
3567+ .driver_data = AZX_DRIVER_TERA | AZX_DCAPS_NO_64BIT },
35663568 /* Creative X-Fi (CA0110-IBG) */
35673569 /* CTHDA chips */
35683570 { PCI_DEVICE(0x1102, 0x0010),
sound/pci/hda/patch_analog.c+1−0
@@ -545,6 +545,7 @@ static int ad198x_build_pcms(struct hda_codec *codec) · 544 unmodified lines
545545 if (spec->multiout.dig_out_nid) {
546546 info++;
547547 codec->num_pcms++;
548+ codec->spdif_status_reset = 1;
548549 info->name = "AD198x Digital";
549550 info->pcm_type = HDA_PCM_TYPE_SPDIF;
550551 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = ad198x_pcm_digital_playback;
sound/pci/hda/patch_cirrus.c+12−9
@@ -101,8 +101,8 @@ enum { · 100 unmodified lines
101101 #define CS420X_VENDOR_NID 0x11
102102 #define CS_DIG_OUT1_PIN_NID 0x10
103103 #define CS_DIG_OUT2_PIN_NID 0x15
104−#define CS_DMIC1_PIN_NID 0x12
105−#define CS_DMIC2_PIN_NID 0x0e
104+#define CS_DMIC1_PIN_NID 0x0e
105+#define CS_DMIC2_PIN_NID 0x12
106106
107107 /* coef indices */
108108 #define IDX_SPDIF_STAT 0x0000
@@ -1079,14 +1079,18 @@ static void init_input(struct hda_codec *codec) · 970 unmodified lines
10791079 cs_automic(codec, NULL);
10801080
10811081 coef = 0x000a; /* ADC1/2 - Digital and Analog Soft Ramp */
1082+ cs_vendor_coef_set(codec, IDX_ADC_CFG, coef);
1083+
1084+ coef = cs_vendor_coef_get(codec, IDX_BEEP_CFG);
10821085 if (is_active_pin(codec, CS_DMIC2_PIN_NID))
1083− coef |= 0x0500; /* DMIC2 2 chan on, GPIO1 off */
1086+ coef |= 1 << 4; /* DMIC2 2 chan on, GPIO1 off */
10841087 if (is_active_pin(codec, CS_DMIC1_PIN_NID))
1085− coef |= 0x1800; /* DMIC1 2 chan on, GPIO0 off
1088+ coef |= 1 << 3; /* DMIC1 2 chan on, GPIO0 off
10861089 * No effect if SPDIF_OUT2 is
10871090 * selected in IDX_SPDIF_CTL.
10881091 */
1089− cs_vendor_coef_set(codec, IDX_ADC_CFG, coef);
1092+
1093+ cs_vendor_coef_set(codec, IDX_BEEP_CFG, coef);
10901094 } else {
10911095 if (spec->mic_detect)
10921096 cs_automic(codec, NULL);
@@ -1107,7 +1111,7 @@ static const struct hda_verb cs_coef_init_verbs[] = { · 14 unmodified lines
11071111 | 0x0400 /* Disable Coefficient Auto increment */
11081112 )},
11091113 /* Beep */
1110− {0x11, AC_VERB_SET_COEF_INDEX, IDX_DAC_CFG},
1114+ {0x11, AC_VERB_SET_COEF_INDEX, IDX_BEEP_CFG},
11111115 {0x11, AC_VERB_SET_PROC_COEF, 0x0007}, /* Enable Beep thru DAC1/2/3 */
11121116
11131117 {} /* terminator */
@@ -1728,8 +1732,7 @@ static int cs421x_mux_enum_put(struct snd_kcontrol *kcontrol, · 614 unmodified lines
17281732
17291733 }
17301734
1731−static struct snd_kcontrol_new cs421x_capture_source = {
1732−
1735+static const struct snd_kcontrol_new cs421x_capture_source = {
17331736 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
17341737 .name = "Capture Source",
17351738 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -1946,7 +1949,7 @@ static int cs421x_suspend(struct hda_codec *codec) · 210 unmodified lines
19461949 }
19471950 #endif
19481951
1949−static struct hda_codec_ops cs421x_patch_ops = {
1952+static const struct hda_codec_ops cs421x_patch_ops = {
19501953 .build_controls = cs421x_build_controls,
19511954 .build_pcms = cs_build_pcms,
19521955 .init = cs421x_init,
sound/pci/hda/patch_realtek.c+13−13
@@ -5840,7 +5840,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec) · 5839 unmodified lines
58405840 return alc_parse_auto_config(codec, alc269_ignore, ssids);
58415841 }
58425842
5843−static void alc269_toggle_power_output(struct hda_codec *codec, int power_up)
5843+static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
58445844 {
58455845 int val = alc_read_coef_idx(codec, 0x04);
58465846 if (power_up)
@@ -5857,10 +5857,10 @@ static void alc269_shutup(struct hda_codec *codec) · 10 unmodified lines
58575857 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
58585858 return;
58595859
5860− if ((alc_get_coef0(codec) & 0x00ff) == 0x017)
5861− alc269_toggle_power_output(codec, 0);
5862− if ((alc_get_coef0(codec) & 0x00ff) == 0x018) {
5863− alc269_toggle_power_output(codec, 0);
5860+ if (spec->codec_variant == ALC269_TYPE_ALC269VB)
5861+ alc269vb_toggle_power_output(codec, 0);
5862+ if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
5863+ (alc_get_coef0(codec) & 0x00ff) == 0x018) {
58645864 msleep(150);
58655865 }
58665866 }
@@ -5870,24 +5870,22 @@ static int alc269_resume(struct hda_codec *codec) · 3 unmodified lines
58705870 {
58715871 struct alc_spec *spec = codec->spec;
58725872
5873− if (spec->codec_variant == ALC269_TYPE_ALC269VB ||
5873+ if (spec->codec_variant == ALC269_TYPE_ALC269VB)
5874+ alc269vb_toggle_power_output(codec, 0);
5875+ if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
58745876 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
5875− alc269_toggle_power_output(codec, 0);
58765877 msleep(150);
58775878 }
58785879
58795880 codec->patch_ops.init(codec);
58805881
5881− if (spec->codec_variant == ALC269_TYPE_ALC269VB ||
5882+ if (spec->codec_variant == ALC269_TYPE_ALC269VB)
5883+ alc269vb_toggle_power_output(codec, 1);
5884+ if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
58825885 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
5883− alc269_toggle_power_output(codec, 1);
58845886 msleep(200);
58855887 }
58865888
5887− if (spec->codec_variant == ALC269_TYPE_ALC269VB ||
5888− (alc_get_coef0(codec) & 0x00ff) == 0x018)
5889− alc269_toggle_power_output(codec, 1);
5890−
58915889 snd_hda_codec_resume_amp(codec);
58925890 snd_hda_codec_resume_cache(codec);
58935891 hda_call_check_power_status(codec, 0x01);
@@ -7079,6 +7077,7 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = { · 1185 unmodified lines
70797077 .patch = patch_alc662 },
70807078 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
70817079 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
7080+ { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 },
70827081 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
70837082 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
70847083 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
@@ -7096,6 +7095,7 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = { · 11 unmodified lines
70967095 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
70977096 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
70987097 { .id = 0x10ec0899, .name = "ALC898", .patch = patch_alc882 },
7098+ { .id = 0x10ec0900, .name = "ALC1150", .patch = patch_alc882 },
70997099 {} /* terminator */
71007100 };
71017101
sound/pci/hda/patch_sigmatel.c+2−0
@@ -1763,6 +1763,8 @@ static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = { · 1762 unmodified lines
17631763 "HP", STAC_HP_ZEPHYR),
17641764 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3660,
17651765 "HP Mini", STAC_92HD83XXX_HP_LED),
1766+ SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x144E,
1767+ "HP Pavilion dv5", STAC_92HD83XXX_HP_INV_LED),
17661768 {} /* terminator */
17671769 };
17681770
sound/pci/hda/patch_via.c+29−7
@@ -1809,11 +1809,11 @@ static int via_auto_fill_dac_nids(struct hda_codec *codec) · 1808 unmodified lines
18091809 {
18101810 struct via_spec *spec = codec->spec;
18111811 const struct auto_pin_cfg *cfg = &spec->autocfg;
1812− int i, dac_num;
1812+ int i;
18131813 hda_nid_t nid;
18141814
1815+ spec->multiout.num_dacs = 0;
18151816 spec->multiout.dac_nids = spec->private_dac_nids;
1816− dac_num = 0;
18171817 for (i = 0; i < cfg->line_outs; i++) {
18181818 hda_nid_t dac = 0;
18191819 nid = cfg->line_out_pins[i];
@@ -1824,16 +1824,13 @@ static int via_auto_fill_dac_nids(struct hda_codec *codec) · 4 unmodified lines
18241824 if (!i && parse_output_path(codec, nid, dac, 1,
18251825 &spec->out_mix_path))
18261826 dac = spec->out_mix_path.path[0];
1827− if (dac) {
1828− spec->private_dac_nids[i] = dac;
1829− dac_num++;
1830− }
1827+ if (dac)
1828+ spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
18311829 }
18321830 if (!spec->out_path[0].depth && spec->out_mix_path.depth) {
18331831 spec->out_path[0] = spec->out_mix_path;
18341832 spec->out_mix_path.depth = 0;
18351833 }
1836− spec->multiout.num_dacs = dac_num;
18371834 return 0;
18381835 }
18391836
@@ -3628,6 +3625,7 @@ static void set_widgets_power_state_vt2002P(struct hda_codec *codec) · 1788 unmodified lines
36283625 */
36293626 enum {
36303627 VIA_FIXUP_INTMIC_BOOST,
3628+ VIA_FIXUP_ASUS_G75,
36313629 };
36323630
36333631 static void via_fixup_intmic_boost(struct hda_codec *codec,
@@ -3642,13 +3640,35 @@ static const struct hda_fixup via_fixups[] = { · 8 unmodified lines
36423640 .type = HDA_FIXUP_FUNC,
36433641 .v.func = via_fixup_intmic_boost,
36443642 },
3643+ [VIA_FIXUP_ASUS_G75] = {
3644+ .type = HDA_FIXUP_PINS,
3645+ .v.pins = (const struct hda_pintbl[]) {
3646+ /* set 0x24 and 0x33 as speakers */
3647+ { 0x24, 0x991301f0 },
3648+ { 0x33, 0x991301f1 }, /* subwoofer */
3649+ { }
3650+ }
3651+ },
36453652 };
36463653
36473654 static const struct snd_pci_quirk vt2002p_fixups[] = {
3655+ SND_PCI_QUIRK(0x1043, 0x1487, "Asus G75", VIA_FIXUP_ASUS_G75),
36483656 SND_PCI_QUIRK(0x1043, 0x8532, "Asus X202E", VIA_FIXUP_INTMIC_BOOST),
36493657 {}
36503658 };
36513659
3660+/* NIDs 0x24 and 0x33 on VT1802 have connections to non-existing NID 0x3e
3661+ * Replace this with mixer NID 0x1c
3662+ */
3663+static void fix_vt1802_connections(struct hda_codec *codec)
3664+{
3665+ static hda_nid_t conn_24[] = { 0x14, 0x1c };
3666+ static hda_nid_t conn_33[] = { 0x1c };
3667+
3668+ snd_hda_override_conn_list(codec, 0x24, ARRAY_SIZE(conn_24), conn_24);
3669+ snd_hda_override_conn_list(codec, 0x33, ARRAY_SIZE(conn_33), conn_33);
3670+}
3671+
36523672 /* patch for vt2002P */
36533673 static int patch_vt2002P(struct hda_codec *codec)
36543674 {
@@ -3663,6 +3683,8 @@ static int patch_vt2002P(struct hda_codec *codec) · 8 unmodified lines
36633683 spec->aa_mix_nid = 0x21;
36643684 override_mic_boost(codec, 0x2b, 0, 3, 40);
36653685 override_mic_boost(codec, 0x29, 0, 3, 40);
3686+ if (spec->codec_type == VT1802)
3687+ fix_vt1802_connections(codec);
36663688 add_secret_dac_path(codec);
36673689
36683690 snd_hda_pick_fixup(codec, NULL, vt2002p_fixups, via_fixups);
sound/pci/ice1712/ice1724.c+6−1
@@ -2859,7 +2859,12 @@ static int snd_vt1724_resume(struct device *dev) · 2858 unmodified lines
28592859 ice->set_spdif_clock(ice, 0);
28602860 } else {
28612861 /* internal on-card clock */
2862− snd_vt1724_set_pro_rate(ice, ice->pro_rate_default, 1);
2862+ int rate;
2863+ if (ice->cur_rate)
2864+ rate = ice->cur_rate;
2865+ else
2866+ rate = ice->pro_rate_default;
2867+ snd_vt1724_set_pro_rate(ice, rate, 1);
28632868 }
28642869
28652870 update_spdif_bits(ice, ice->pm_saved_spdif_ctrl);
sound/pci/rme9652/hdspm.c+3−2
@@ -3979,7 +3979,8 @@ static int snd_hdspm_get_sync_check(struct snd_kcontrol *kcontrol, · 3978 unmodified lines
39793979 case 8: /* SYNC IN */
39803980 val = hdspm_sync_in_sync_check(hdspm); break;
39813981 default:
3982− val = hdspm_s1_sync_check(hdspm, ucontrol->id.index-1);
3982+ val = hdspm_s1_sync_check(hdspm,
3983+ kcontrol->private_value-1);
39833984 }
39843985 break;
39853986
@@ -4899,7 +4900,7 @@ snd_hdspm_proc_read_madi(struct snd_info_entry * entry, · 913 unmodified lines
48994900 insel = "Coaxial";
49004901 break;
49014902 default:
4902− insel = "Unkown";
4903+ insel = "Unknown";
49034904 }
49044905
49054906 snd_iprintf(buffer,
sound/soc/codecs/cs42l52.c+1−1
@@ -763,7 +763,7 @@ static int cs42l52_set_sysclk(struct snd_soc_dai *codec_dai, · 762 unmodified lines
763763 if ((freq >= CS42L52_MIN_CLK) && (freq <= CS42L52_MAX_CLK)) {
764764 cs42l52->sysclk = freq;
765765 } else {
766− dev_err(codec->dev, "Invalid freq paramter\n");
766+ dev_err(codec->dev, "Invalid freq parameter\n");
767767 return -EINVAL;
768768 }
769769 return 0;
sound/soc/codecs/wm8994.c+1−1
@@ -3722,7 +3722,7 @@ static irqreturn_t wm8958_mic_irq(int irq, void *data) · 3721 unmodified lines
37223722 } while (count--);
37233723
37243724 if (count == 0)
3725− dev_warn(codec->dev, "No impedence range reported for jack\n");
3725+ dev_warn(codec->dev, "No impedance range reported for jack\n");
37263726
37273727 #ifndef CONFIG_SND_SOC_WM8994_MODULE
37283728 trace_snd_soc_jack_irq(dev_name(codec->dev));
sound/soc/omap/omap-dmic.c+2−2
@@ -464,9 +464,9 @@ static __devinit int asoc_dmic_probe(struct platform_device *pdev) · 463 unmodified lines
464464
465465 mutex_init(&dmic->mutex);
466466
467− dmic->fclk = clk_get(dmic->dev, "dmic_fck");
467+ dmic->fclk = clk_get(dmic->dev, "fck");
468468 if (IS_ERR(dmic->fclk)) {
469− dev_err(dmic->dev, "cant get dmic_fck\n");
469+ dev_err(dmic->dev, "cant get fck\n");
470470 return -ENODEV;
471471 }
472472
sound/soc/omap/zoom2.c+2−3
@@ -21,15 +21,14 @@ · 20 unmodified lines
2121
2222 #include <linux/clk.h>
2323 #include <linux/platform_device.h>
24+#include <linux/gpio.h>
2425 #include <sound/core.h>
2526 #include <sound/pcm.h>
2627 #include <sound/soc.h>
2728
2829 #include <asm/mach-types.h>
29−#include <mach/hardware.h>
30−#include <mach/gpio.h>
31−#include <mach/board-zoom.h>
3230 #include <linux/platform_data/asoc-ti-mcbsp.h>
31+#include <linux/platform_data/gpio-omap.h>
3332
3433 /* Register descriptions for twl4030 codec part */
3534 #include <linux/mfd/twl4030-audio.h>
sound/usb/card.c+8−4
@@ -339,7 +339,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx, · 338 unmodified lines
339339 }
340340
341341 mutex_init(&chip->mutex);
342− mutex_init(&chip->shutdown_mutex);
342+ init_rwsem(&chip->shutdown_rwsem);
343343 chip->index = idx;
344344 chip->dev = dev;
345345 chip->card = card;
@@ -560,7 +560,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, · 214 unmodified lines
560560
561561 card = chip->card;
562562 mutex_lock(&register_mutex);
563− mutex_lock(&chip->shutdown_mutex);
563+ down_write(&chip->shutdown_rwsem);
564564 chip->shutdown = 1;
565565 chip->num_interfaces--;
566566 if (chip->num_interfaces <= 0) {
@@ -582,11 +582,11 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, · 15 unmodified lines
582582 snd_usb_mixer_disconnect(p);
583583 }
584584 usb_chip[chip->index] = NULL;
585− mutex_unlock(&chip->shutdown_mutex);
585+ up_write(&chip->shutdown_rwsem);
586586 mutex_unlock(&register_mutex);
587587 snd_card_free_when_closed(card);
588588 } else {
589− mutex_unlock(&chip->shutdown_mutex);
589+ up_write(&chip->shutdown_rwsem);
590590 mutex_unlock(&register_mutex);
591591 }
592592 }
@@ -618,16 +618,20 @@ int snd_usb_autoresume(struct snd_usb_audio *chip) · 25 unmodified lines
618618 {
619619 int err = -ENODEV;
620620
621+ down_read(&chip->shutdown_rwsem);
621622 if (!chip->shutdown && !chip->probing)
622623 err = usb_autopm_get_interface(chip->pm_intf);
624+ up_read(&chip->shutdown_rwsem);
623625
624626 return err;
625627 }
626628
627629 void snd_usb_autosuspend(struct snd_usb_audio *chip)
628630 {
631+ down_read(&chip->shutdown_rwsem);
629632 if (!chip->shutdown && !chip->probing)
630633 usb_autopm_put_interface(chip->pm_intf);
634+ up_read(&chip->shutdown_rwsem);
631635 }
632636
633637 static int usb_audio_suspend(struct usb_interface *intf, pm_message_t message)
sound/usb/card.h+1−0
@@ -126,6 +126,7 @@ struct snd_usb_substream { · 125 unmodified lines
126126 struct snd_usb_endpoint *sync_endpoint;
127127 unsigned long flags;
128128 bool need_setup_ep; /* (re)configure EP at prepare? */
129+ unsigned int speed; /* USB_SPEED_XXX */
129130
130131 u64 formats; /* format bitmasks (all or'ed) */
131132 unsigned int num_formats; /* number of supported audio formats (list) */
sound/usb/endpoint.c+13−0
@@ -35,6 +35,7 @@ · 34 unmodified lines
3535
3636 #define EP_FLAG_ACTIVATED 0
3737 #define EP_FLAG_RUNNING 1
38+#define EP_FLAG_STOPPING 2
3839
3940 /*
4041 * snd_usb_endpoint is a model that abstracts everything related to an
@@ -502,10 +503,20 @@ static int wait_clear_urbs(struct snd_usb_endpoint *ep) · 461 unmodified lines
502503 if (alive)
503504 snd_printk(KERN_ERR "timeout: still %d active urbs on EP #%x\n",
504505 alive, ep->ep_num);
506+ clear_bit(EP_FLAG_STOPPING, &ep->flags);
505507
506508 return 0;
507509 }
508510
511+/* sync the pending stop operation;
512+ * this function itself doesn't trigger the stop operation
513+ */
514+void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep)
515+{
516+ if (ep && test_bit(EP_FLAG_STOPPING, &ep->flags))
517+ wait_clear_urbs(ep);
518+}
519+
509520 /*
510521 * unlink active urbs.
511522 */
@@ -918,6 +929,8 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep, · 406 unmodified lines
918929
919930 if (wait)
920931 wait_clear_urbs(ep);
932+ else
933+ set_bit(EP_FLAG_STOPPING, &ep->flags);
921934 }
922935 }
923936
sound/usb/endpoint.h+1−0
@@ -19,6 +19,7 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep, · 18 unmodified lines
1919 int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, int can_sleep);
2020 void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep,
2121 int force, int can_sleep, int wait);
22+void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep);
2223 int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep);
2324 int snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep);
2425 void snd_usb_endpoint_free(struct list_head *head);
sound/usb/mixer.c+43−22
@@ -287,25 +287,32 @@ static int get_ctl_value_v1(struct usb_mixer_elem_info *cval, int request, int v · 286 unmodified lines
287287 unsigned char buf[2];
288288 int val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1;
289289 int timeout = 10;
290− int err;
290+ int idx = 0, err;
291291
292292 err = snd_usb_autoresume(cval->mixer->chip);
293293 if (err < 0)
294294 return -EIO;
295+ down_read(&chip->shutdown_rwsem);
295296 while (timeout-- > 0) {
297+ if (chip->shutdown)
298+ break;
299+ idx = snd_usb_ctrl_intf(chip) | (cval->id << 8);
296300 if (snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), request,
297301 USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
298− validx, snd_usb_ctrl_intf(chip) | (cval->id << 8),
299− buf, val_len) >= val_len) {
302+ validx, idx, buf, val_len) >= val_len) {
300303 *value_ret = convert_signed_value(cval, snd_usb_combine_bytes(buf, val_len));
301− snd_usb_autosuspend(cval->mixer->chip);
302− return 0;
304+ err = 0;
305+ goto out;
303306 }
304307 }
305− snd_usb_autosuspend(cval->mixer->chip);
306308 snd_printdd(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",
307− request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type);
308− return -EINVAL;
309+ request, validx, idx, cval->val_type);
310+ err = -EINVAL;
311+
312+ out:
313+ up_read(&chip->shutdown_rwsem);
314+ snd_usb_autosuspend(cval->mixer->chip);
315+ return err;
309316 }
310317
311318 static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret)
@@ -313,7 +320,7 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int v · 1 unmodified line
313320 struct snd_usb_audio *chip = cval->mixer->chip;
314321 unsigned char buf[2 + 3*sizeof(__u16)]; /* enough space for one range */
315322 unsigned char *val;
316− int ret, size;
323+ int idx = 0, ret, size;
317324 __u8 bRequest;
318325
319326 if (request == UAC_GET_CUR) {
@@ -330,16 +337,22 @@ static int get_ctl_value_v2(struct usb_mixer_elem_info *cval, int request, int v · 10 unmodified lines
330337 if (ret)
331338 goto error;
332339
333− ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), bRequest,
340+ down_read(&chip->shutdown_rwsem);
341+ if (chip->shutdown)
342+ ret = -ENODEV;
343+ else {
344+ idx = snd_usb_ctrl_intf(chip) | (cval->id << 8);
345+ ret = snd_usb_ctl_msg(chip->dev, usb_rcvctrlpipe(chip->dev, 0), bRequest,
334346 USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
335− validx, snd_usb_ctrl_intf(chip) | (cval->id << 8),
336− buf, size);
347+ validx, idx, buf, size);
348+ }
349+ up_read(&chip->shutdown_rwsem);
337350 snd_usb_autosuspend(chip);
338351
339352 if (ret < 0) {
340353 error:
341354 snd_printk(KERN_ERR "cannot get ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d\n",
342− request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type);
355+ request, validx, idx, cval->val_type);
343356 return ret;
344357 }
345358
@@ -417,7 +430,7 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval, · 71 unmodified lines
417430 {
418431 struct snd_usb_audio *chip = cval->mixer->chip;
419432 unsigned char buf[2];
420− int val_len, err, timeout = 10;
433+ int idx = 0, val_len, err, timeout = 10;
421434
422435 if (cval->mixer->protocol == UAC_VERSION_1) {
423436 val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1;
@@ -440,19 +453,27 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval, · 16 unmodified lines
440453 err = snd_usb_autoresume(chip);
441454 if (err < 0)
442455 return -EIO;
443− while (timeout-- > 0)
456+ down_read(&chip->shutdown_rwsem);
457+ while (timeout-- > 0) {
458+ if (chip->shutdown)
459+ break;
460+ idx = snd_usb_ctrl_intf(chip) | (cval->id << 8);
444461 if (snd_usb_ctl_msg(chip->dev,
445462 usb_sndctrlpipe(chip->dev, 0), request,
446463 USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
447− validx, snd_usb_ctrl_intf(chip) | (cval->id << 8),
448− buf, val_len) >= 0) {
449− snd_usb_autosuspend(chip);
450− return 0;
464+ validx, idx, buf, val_len) >= 0) {
465+ err = 0;
466+ goto out;
451467 }
452− snd_usb_autosuspend(chip);
468+ }
453469 snd_printdd(KERN_ERR "cannot set ctl value: req = %#x, wValue = %#x, wIndex = %#x, type = %d, data = %#x/%#x\n",
454− request, validx, snd_usb_ctrl_intf(chip) | (cval->id << 8), cval->val_type, buf[0], buf[1]);
455− return -EINVAL;
470+ request, validx, idx, cval->val_type, buf[0], buf[1]);
471+ err = -EINVAL;
472+
473+ out:
474+ up_read(&chip->shutdown_rwsem);
475+ snd_usb_autosuspend(chip);
476+ return err;
456477 }
457478
458479 static int set_cur_ctl_value(struct usb_mixer_elem_info *cval, int validx, int value)
sound/usb/mixer_quirks.c+51−7
@@ -283,6 +283,11 @@ static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e · 282 unmodified lines
283283 if (value > 1)
284284 return -EINVAL;
285285 changed = value != mixer->audigy2nx_leds[index];
286+ down_read(&mixer->chip->shutdown_rwsem);
287+ if (mixer->chip->shutdown) {
288+ err = -ENODEV;
289+ goto out;
290+ }
286291 if (mixer->chip->usb_id == USB_ID(0x041e, 0x3042))
287292 err = snd_usb_ctl_msg(mixer->chip->dev,
288293 usb_sndctrlpipe(mixer->chip->dev, 0), 0x24,
@@ -299,6 +304,8 @@ static int snd_audigy2nx_led_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e · 10 unmodified lines
299304 usb_sndctrlpipe(mixer->chip->dev, 0), 0x24,
300305 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
301306 value, index + 2, NULL, 0);
307+ out:
308+ up_read(&mixer->chip->shutdown_rwsem);
302309 if (err < 0)
303310 return err;
304311 mixer->audigy2nx_leds[index] = value;
@@ -392,11 +399,16 @@ static void snd_audigy2nx_proc_read(struct snd_info_entry *entry, · 87 unmodified lines
392399
393400 for (i = 0; jacks[i].name; ++i) {
394401 snd_iprintf(buffer, "%s: ", jacks[i].name);
395− err = snd_usb_ctl_msg(mixer->chip->dev,
402+ down_read(&mixer->chip->shutdown_rwsem);
403+ if (mixer->chip->shutdown)
404+ err = 0;
405+ else
406+ err = snd_usb_ctl_msg(mixer->chip->dev,
396407 usb_rcvctrlpipe(mixer->chip->dev, 0),
397408 UAC_GET_MEM, USB_DIR_IN | USB_TYPE_CLASS |
398409 USB_RECIP_INTERFACE, 0,
399410 jacks[i].unitid << 8, buf, 3);
411+ up_read(&mixer->chip->shutdown_rwsem);
400412 if (err == 3 && (buf[0] == 3 || buf[0] == 6))
401413 snd_iprintf(buffer, "%02x %02x\n", buf[1], buf[2]);
402414 else
@@ -426,10 +438,15 @@ static int snd_xonar_u1_switch_put(struct snd_kcontrol *kcontrol, · 23 unmodified lines
426438 else
427439 new_status = old_status & ~0x02;
428440 changed = new_status != old_status;
429− err = snd_usb_ctl_msg(mixer->chip->dev,
441+ down_read(&mixer->chip->shutdown_rwsem);
442+ if (mixer->chip->shutdown)
443+ err = -ENODEV;
444+ else
445+ err = snd_usb_ctl_msg(mixer->chip->dev,
430446 usb_sndctrlpipe(mixer->chip->dev, 0), 0x08,
431447 USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_OTHER,
432448 50, 0, &new_status, 1);
449+ up_read(&mixer->chip->shutdown_rwsem);
433450 if (err < 0)
434451 return err;
435452 mixer->xonar_u1_status = new_status;
@@ -468,11 +485,17 @@ static int snd_nativeinstruments_control_get(struct snd_kcontrol *kcontrol, · 32 unmodified lines
468485 u8 bRequest = (kcontrol->private_value >> 16) & 0xff;
469486 u16 wIndex = kcontrol->private_value & 0xffff;
470487 u8 tmp;
488+ int ret;
471489
472− int ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), bRequest,
490+ down_read(&mixer->chip->shutdown_rwsem);
491+ if (mixer->chip->shutdown)
492+ ret = -ENODEV;
493+ else
494+ ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), bRequest,
473495 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN,
474496 0, cpu_to_le16(wIndex),
475497 &tmp, sizeof(tmp), 1000);
498+ up_read(&mixer->chip->shutdown_rwsem);
476499
477500 if (ret < 0) {
478501 snd_printk(KERN_ERR
@@ -493,11 +516,17 @@ static int snd_nativeinstruments_control_put(struct snd_kcontrol *kcontrol, · 14 unmodified lines
493516 u8 bRequest = (kcontrol->private_value >> 16) & 0xff;
494517 u16 wIndex = kcontrol->private_value & 0xffff;
495518 u16 wValue = ucontrol->value.integer.value[0];
519+ int ret;
496520
497− int ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), bRequest,
521+ down_read(&mixer->chip->shutdown_rwsem);
522+ if (mixer->chip->shutdown)
523+ ret = -ENODEV;
524+ else
525+ ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0), bRequest,
498526 USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_OUT,
499527 cpu_to_le16(wValue), cpu_to_le16(wIndex),
500528 NULL, 0, 1000);
529+ up_read(&mixer->chip->shutdown_rwsem);
501530
502531 if (ret < 0) {
503532 snd_printk(KERN_ERR
@@ -656,11 +685,16 @@ static int snd_ftu_eff_switch_get(struct snd_kcontrol *kctl, · 152 unmodified lines
656685 return -EINVAL;
657686
658687
659− err = snd_usb_ctl_msg(chip->dev,
688+ down_read(&mixer->chip->shutdown_rwsem);
689+ if (mixer->chip->shutdown)
690+ err = -ENODEV;
691+ else
692+ err = snd_usb_ctl_msg(chip->dev,
660693 usb_rcvctrlpipe(chip->dev, 0), UAC_GET_CUR,
661694 USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
662695 validx << 8, snd_usb_ctrl_intf(chip) | (id << 8),
663696 value, val_len);
697+ up_read(&mixer->chip->shutdown_rwsem);
664698 if (err < 0)
665699 return err;
666700
@@ -703,11 +737,16 @@ static int snd_ftu_eff_switch_put(struct snd_kcontrol *kctl, · 36 unmodified lines
703737
704738 if (!pval->is_cached) {
705739 /* Read current value */
706− err = snd_usb_ctl_msg(chip->dev,
740+ down_read(&mixer->chip->shutdown_rwsem);
741+ if (mixer->chip->shutdown)
742+ err = -ENODEV;
743+ else
744+ err = snd_usb_ctl_msg(chip->dev,
707745 usb_rcvctrlpipe(chip->dev, 0), UAC_GET_CUR,
708746 USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_IN,
709747 validx << 8, snd_usb_ctrl_intf(chip) | (id << 8),
710748 value, val_len);
749+ up_read(&mixer->chip->shutdown_rwsem);
711750 if (err < 0)
712751 return err;
713752
@@ -719,11 +758,16 @@ static int snd_ftu_eff_switch_put(struct snd_kcontrol *kctl, · 5 unmodified lines
719758 if (cur_val != new_val) {
720759 value[0] = new_val;
721760 value[1] = 0;
722− err = snd_usb_ctl_msg(chip->dev,
761+ down_read(&mixer->chip->shutdown_rwsem);
762+ if (mixer->chip->shutdown)
763+ err = -ENODEV;
764+ else
765+ err = snd_usb_ctl_msg(chip->dev,
723766 usb_sndctrlpipe(chip->dev, 0), UAC_SET_CUR,
724767 USB_RECIP_INTERFACE | USB_TYPE_CLASS | USB_DIR_OUT,
725768 validx << 8, snd_usb_ctrl_intf(chip) | (id << 8),
726769 value, val_len);
770+ up_read(&mixer->chip->shutdown_rwsem);
727771 if (err < 0)
728772 return err;
729773
sound/usb/pcm.c+37−19
@@ -71,6 +71,8 @@ static snd_pcm_uframes_t snd_usb_pcm_pointer(struct snd_pcm_substream *substream · 70 unmodified lines
7171 unsigned int hwptr_done;
7272
7373 subs = (struct snd_usb_substream *)substream->runtime->private_data;
74+ if (subs->stream->chip->shutdown)
75+ return SNDRV_PCM_POS_XRUN;
7476 spin_lock(&subs->lock);
7577 hwptr_done = subs->hwptr_done;
7678 substream->runtime->delay = snd_usb_pcm_delay(subs,
@@ -444,7 +446,6 @@ static int configure_endpoint(struct snd_usb_substream *subs) · 367 unmodified lines
444446 {
445447 int ret;
446448
447− mutex_lock(&subs->stream->chip->shutdown_mutex);
448449 /* format changed */
449450 stop_endpoints(subs, 0, 0, 0);
450451 ret = snd_usb_endpoint_set_params(subs->data_endpoint,
@@ -455,7 +456,7 @@ static int configure_endpoint(struct snd_usb_substream *subs) · 4 unmodified lines
455456 subs->cur_audiofmt,
456457 subs->sync_endpoint);
457458 if (ret < 0)
458− goto unlock;
459+ return ret;
459460
460461 if (subs->sync_endpoint)
461462 ret = snd_usb_endpoint_set_params(subs->data_endpoint,
@@ -465,9 +466,6 @@ static int configure_endpoint(struct snd_usb_substream *subs) · 3 unmodified lines
465466 subs->cur_rate,
466467 subs->cur_audiofmt,
467468 NULL);
468−
469−unlock:
470− mutex_unlock(&subs->stream->chip->shutdown_mutex);
471469 return ret;
472470 }
473471
@@ -505,7 +503,13 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream, · 31 unmodified lines
505503 return -EINVAL;
506504 }
507505
508− if ((ret = set_format(subs, fmt)) < 0)
506+ down_read(&subs->stream->chip->shutdown_rwsem);
507+ if (subs->stream->chip->shutdown)
508+ ret = -ENODEV;
509+ else
510+ ret = set_format(subs, fmt);
511+ up_read(&subs->stream->chip->shutdown_rwsem);
512+ if (ret < 0)
509513 return ret;
510514
511515 subs->interface = fmt->iface;
@@ -527,10 +531,12 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream) · 15 unmodified lines
527531 subs->cur_audiofmt = NULL;
528532 subs->cur_rate = 0;
529533 subs->period_bytes = 0;
530− mutex_lock(&subs->stream->chip->shutdown_mutex);
531− stop_endpoints(subs, 0, 1, 1);
532− deactivate_endpoints(subs);
533− mutex_unlock(&subs->stream->chip->shutdown_mutex);
534+ down_read(&subs->stream->chip->shutdown_rwsem);
535+ if (!subs->stream->chip->shutdown) {
536+ stop_endpoints(subs, 0, 1, 1);
537+ deactivate_endpoints(subs);
538+ }
539+ up_read(&subs->stream->chip->shutdown_rwsem);
534540 return snd_pcm_lib_free_vmalloc_buffer(substream);
535541 }
536542
@@ -552,12 +558,22 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) · 15 unmodified lines
552558 return -ENXIO;
553559 }
554560
555− if (snd_BUG_ON(!subs->data_endpoint))
556− return -EIO;
561+ down_read(&subs->stream->chip->shutdown_rwsem);
562+ if (subs->stream->chip->shutdown) {
563+ ret = -ENODEV;
564+ goto unlock;
565+ }
566+ if (snd_BUG_ON(!subs->data_endpoint)) {
567+ ret = -EIO;
568+ goto unlock;
569+ }
570+
571+ snd_usb_endpoint_sync_pending_stop(subs->sync_endpoint);
572+ snd_usb_endpoint_sync_pending_stop(subs->data_endpoint);
557573
558574 ret = set_format(subs, subs->cur_audiofmt);
559575 if (ret < 0)
560− return ret;
576+ goto unlock;
561577
562578 iface = usb_ifnum_to_if(subs->dev, subs->cur_audiofmt->iface);
563579 alts = &iface->altsetting[subs->cur_audiofmt->altset_idx];
@@ -567,12 +583,12 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) · 3 unmodified lines
567583 subs->cur_audiofmt,
568584 subs->cur_rate);
569585 if (ret < 0)
570− return ret;
586+ goto unlock;
571587
572588 if (subs->need_setup_ep) {
573589 ret = configure_endpoint(subs);
574590 if (ret < 0)
575− return ret;
591+ goto unlock;
576592 subs->need_setup_ep = false;
577593 }
578594
@@ -592,9 +608,11 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) · 13 unmodified lines
592608 /* for playback, submit the URBs now; otherwise, the first hwptr_done
593609 * updates for all URBs would happen at the same time when starting */
594610 if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK)
595− return start_endpoints(subs, 1);
611+ ret = start_endpoints(subs, 1);
596612
597− return 0;
613+ unlock:
614+ up_read(&subs->stream->chip->shutdown_rwsem);
615+ return ret;
598616 }
599617
600618 static struct snd_pcm_hardware snd_usb_hardware =
@@ -647,7 +665,7 @@ static int hw_check_valid_format(struct snd_usb_substream *subs, · 46 unmodified lines
647665 return 0;
648666 }
649667 /* check whether the period time is >= the data packet interval */
650− if (snd_usb_get_speed(subs->dev) != USB_SPEED_FULL) {
668+ if (subs->speed != USB_SPEED_FULL) {
651669 ptime = 125 * (1 << fp->datainterval);
652670 if (ptime > pt->max || (ptime == pt->max && pt->openmax)) {
653671 hwc_debug(" > check: ptime %u > max %u\n", ptime, pt->max);
@@ -925,7 +943,7 @@ static int setup_hw_info(struct snd_pcm_runtime *runtime, struct snd_usb_substre · 271 unmodified lines
925943 return err;
926944
927945 param_period_time_if_needed = SNDRV_PCM_HW_PARAM_PERIOD_TIME;
928− if (snd_usb_get_speed(subs->dev) == USB_SPEED_FULL)
946+ if (subs->speed == USB_SPEED_FULL)
929947 /* full speed devices have fixed data packet interval */
930948 ptmin = 1000;
931949 if (ptmin == 1000)
sound/usb/proc.c+2−2
@@ -108,7 +108,7 @@ static void proc_dump_substream_formats(struct snd_usb_substream *subs, struct s · 107 unmodified lines
108108 }
109109 snd_iprintf(buffer, "\n");
110110 }
111− if (snd_usb_get_speed(subs->dev) != USB_SPEED_FULL)
111+ if (subs->speed != USB_SPEED_FULL)
112112 snd_iprintf(buffer, " Data packet interval: %d us\n",
113113 125 * (1 << fp->datainterval));
114114 // snd_iprintf(buffer, " Max Packet Size = %d\n", fp->maxpacksize);
@@ -124,7 +124,7 @@ static void proc_dump_ep_status(struct snd_usb_substream *subs, · 9 unmodified lines
124124 return;
125125 snd_iprintf(buffer, " Packet Size = %d\n", ep->curpacksize);
126126 snd_iprintf(buffer, " Momentary freq = %u Hz (%#x.%04x)\n",
127− snd_usb_get_speed(subs->dev) == USB_SPEED_FULL
127+ subs->speed == USB_SPEED_FULL
128128 ? get_full_speed_hz(ep->freqm)
129129 : get_high_speed_hz(ep->freqm),
130130 ep->freqm >> 16, ep->freqm & 0xffff);
sound/usb/stream.c+1−0
@@ -90,6 +90,7 @@ static void snd_usb_init_substream(struct snd_usb_stream *as, · 89 unmodified lines
9090 subs->direction = stream;
9191 subs->dev = as->chip->dev;
9292 subs->txfr_quirk = as->chip->txfr_quirk;
93+ subs->speed = snd_usb_get_speed(subs->dev);
9394
9495 snd_usb_set_pcm_ops(as->pcm, stream);
9596
sound/usb/usbaudio.h+1−1
@@ -37,7 +37,7 @@ struct snd_usb_audio { · 36 unmodified lines
3737 struct usb_interface *pm_intf;
3838 u32 usb_id;
3939 struct mutex mutex;
40− struct mutex shutdown_mutex;
40+ struct rw_semaphore shutdown_rwsem;
4141 unsigned int shutdown:1;
4242 unsigned int probing:1;
4343 unsigned int autosuspended:1;
tools/testing/selftests/Makefile+1−1
@@ -1,4 +1,4 @@
1−TARGETS = breakpoints kcmp mqueue vm cpu-hotplug memory-hotplug epoll
1+TARGETS = breakpoints kcmp mqueue vm cpu-hotplug memory-hotplug
22
33 all:
44 for TARGET in $(TARGETS); do \
tools/testing/selftests/epoll/Makefile+0−11
@@ -1,11 +0,0 @@
1−# Makefile for epoll selftests
2−
3−all: test_epoll
4−%: %.c
5− gcc -pthread -g -o $@ $^
6−
7−run_tests: all
8− ./test_epoll
9−
10−clean:
11− $(RM) test_epoll
tools/testing/selftests/epoll/test_epoll.c+0−344
@@ -1,344 +0,0 @@
1−/*
2− * tools/testing/selftests/epoll/test_epoll.c
3− *
4− * Copyright 2012 Adobe Systems Incorporated
5− *
6− * This program is free software; you can redistribute it and/or modify
7− * it under the terms of the GNU General Public License as published by
8− * the Free Software Foundation; either version 2 of the License, or
9− * (at your option) any later version.
10− *
11− * Paton J. Lewis <palewis@adobe.com>
12− *
13− */
14−
15−#include <errno.h>
16−#include <fcntl.h>
17−#include <pthread.h>
18−#include <stdio.h>
19−#include <stdlib.h>
20−#include <unistd.h>
21−#include <sys/epoll.h>
22−#include <sys/socket.h>
23−
24−/*
25− * A pointer to an epoll_item_private structure will be stored in the epoll
26− * item's event structure so that we can get access to the epoll_item_private
27− * data after calling epoll_wait:
28− */
29−struct epoll_item_private {
30− int index; /* Position of this struct within the epoll_items array. */
31− int fd;
32− uint32_t events;
33− pthread_mutex_t mutex; /* Guards the following variables... */
34− int stop;
35− int status; /* Stores any error encountered while handling item. */
36− /* The following variable allows us to test whether we have encountered
37− a problem while attempting to cancel and delete the associated
38− event. When the test program exits, 'deleted' should be exactly
39− one. If it is greater than one, then the failed test reflects a real
40− world situation where we would have tried to access the epoll item's
41− private data after deleting it: */
42− int deleted;
43−};
44−
45−struct epoll_item_private *epoll_items;
46−
47−/*
48− * Delete the specified item from the epoll set. In a real-world secneario this
49− * is where we would free the associated data structure, but in this testing
50− * environment we retain the structure so that we can test for double-deletion:
51− */
52−void delete_item(int index)
53−{
54− __sync_fetch_and_add(&epoll_items[index].deleted, 1);
55−}
56−
57−/*
58− * A pointer to a read_thread_data structure will be passed as the argument to
59− * each read thread:
60− */
61−struct read_thread_data {
62− int stop;
63− int status; /* Indicates any error encountered by the read thread. */
64− int epoll_set;
65−};
66−
67−/*
68− * The function executed by the read threads:
69− */
70−void *read_thread_function(void *function_data)
71−{
72− struct read_thread_data *thread_data =
73− (struct read_thread_data *)function_data;
74− struct epoll_event event_data;
75− struct epoll_item_private *item_data;
76− char socket_data;
77−
78− /* Handle events until we encounter an error or this thread's 'stop'
79− condition is set: */
80− while (1) {
81− int result = epoll_wait(thread_data->epoll_set,
82− &event_data,
83− 1, /* Number of desired events */
84− 1000); /* Timeout in ms */
85− if (result < 0) {
86− /* Breakpoints signal all threads. Ignore that while
87− debugging: */
88− if (errno == EINTR)
89− continue;
90− thread_data->status = errno;
91− return 0;
92− } else if (thread_data->stop)
93− return 0;
94− else if (result == 0) /* Timeout */
95− continue;
96−
97− /* We need the mutex here because checking for the stop
98− condition and re-enabling the epoll item need to be done
99− together as one atomic operation when EPOLL_CTL_DISABLE is
100− available: */
101− item_data = (struct epoll_item_private *)event_data.data.ptr;
102− pthread_mutex_lock(&item_data->mutex);
103−
104− /* Remove the item from the epoll set if we want to stop
105− handling that event: */
106− if (item_data->stop)
107− delete_item(item_data->index);
108− else {
109− /* Clear the data that was written to the other end of
110− our non-blocking socket: */
111− do {
112− if (read(item_data->fd, &socket_data, 1) < 1) {
113− if ((errno == EAGAIN) ||
114− (errno == EWOULDBLOCK))
115− break;
116− else
117− goto error_unlock;
118− }
119− } while (item_data->events & EPOLLET);
120−
121− /* The item was one-shot, so re-enable it: */
122− event_data.events = item_data->events;
123− if (epoll_ctl(thread_data->epoll_set,
124− EPOLL_CTL_MOD,
125− item_data->fd,
126− &event_data) < 0)
127− goto error_unlock;
128− }
129−
130− pthread_mutex_unlock(&item_data->mutex);
131− }
132−
133−error_unlock:
134− thread_data->status = item_data->status = errno;
135− pthread_mutex_unlock(&item_data->mutex);
136− return 0;
137−}
138−
139−/*
140− * A pointer to a write_thread_data structure will be passed as the argument to
141− * the write thread:
142− */
143−struct write_thread_data {
144− int stop;
145− int status; /* Indicates any error encountered by the write thread. */
146− int n_fds;
147− int *fds;
148−};
149−
150−/*
151− * The function executed by the write thread. It writes a single byte to each
152− * socket in turn until the stop condition for this thread is set. If writing to
153− * a socket would block (i.e. errno was EAGAIN), we leave that socket alone for
154− * the moment and just move on to the next socket in the list. We don't care
155− * about the order in which we deliver events to the epoll set. In fact we don't
156− * care about the data we're writing to the pipes at all; we just want to
157− * trigger epoll events:
158− */
159−void *write_thread_function(void *function_data)
160−{
161− const char data = 'X';
162− int index;
163− struct write_thread_data *thread_data =
164− (struct write_thread_data *)function_data;
165− while (!thread_data->stop)
166− for (index = 0;
167− !thread_data->stop && (index < thread_data->n_fds);
168− ++index)
169− if ((write(thread_data->fds[index], &data, 1) < 1) &&
170− (errno != EAGAIN) &&
171− (errno != EWOULDBLOCK)) {
172− thread_data->status = errno;
173− return;
174− }
175−}
176−
177−/*
178− * Arguments are currently ignored:
179− */
180−int main(int argc, char **argv)
181−{
182− const int n_read_threads = 100;
183− const int n_epoll_items = 500;
184− int index;
185− int epoll_set = epoll_create1(0);
186− struct write_thread_data write_thread_data = {
187− 0, 0, n_epoll_items, malloc(n_epoll_items * sizeof(int))
188− };
189− struct read_thread_data *read_thread_data =
190− malloc(n_read_threads * sizeof(struct read_thread_data));
191− pthread_t *read_threads = malloc(n_read_threads * sizeof(pthread_t));
192− pthread_t write_thread;
193−
194− printf("-----------------\n");
195− printf("Runing test_epoll\n");
196− printf("-----------------\n");
197−
198− epoll_items = malloc(n_epoll_items * sizeof(struct epoll_item_private));
199−
200− if (epoll_set < 0 || epoll_items == 0 || write_thread_data.fds == 0 ||
201− read_thread_data == 0 || read_threads == 0)
202− goto error;
203−
204− if (sysconf(_SC_NPROCESSORS_ONLN) < 2) {
205− printf("Error: please run this test on a multi-core system.\n");
206− goto error;
207− }
208−
209− /* Create the socket pairs and epoll items: */
210− for (index = 0; index < n_epoll_items; ++index) {
211− int socket_pair[2];
212− struct epoll_event event_data;
213− if (socketpair(AF_UNIX,
214− SOCK_STREAM | SOCK_NONBLOCK,
215− 0,
216− socket_pair) < 0)
217− goto error;
218− write_thread_data.fds[index] = socket_pair[0];
219− epoll_items[index].index = index;
220− epoll_items[index].fd = socket_pair[1];
221− if (pthread_mutex_init(&epoll_items[index].mutex, NULL) != 0)
222− goto error;
223− /* We always use EPOLLONESHOT because this test is currently
224− structured to demonstrate the need for EPOLL_CTL_DISABLE,
225− which only produces useful information in the EPOLLONESHOT
226− case (without EPOLLONESHOT, calling epoll_ctl with
227− EPOLL_CTL_DISABLE will never return EBUSY). If support for
228− testing events without EPOLLONESHOT is desired, it should
229− probably be implemented in a separate unit test. */
230− epoll_items[index].events = EPOLLIN | EPOLLONESHOT;
231− if (index < n_epoll_items / 2)
232− epoll_items[index].events |= EPOLLET;
233− epoll_items[index].stop = 0;
234− epoll_items[index].status = 0;
235− epoll_items[index].deleted = 0;
236− event_data.events = epoll_items[index].events;
237− event_data.data.ptr = &epoll_items[index];
238− if (epoll_ctl(epoll_set,
239− EPOLL_CTL_ADD,
240− epoll_items[index].fd,
241− &event_data) < 0)
242− goto error;
243− }
244−
245− /* Create and start the read threads: */
246− for (index = 0; index < n_read_threads; ++index) {
247− read_thread_data[index].stop = 0;
248− read_thread_data[index].status = 0;
249− read_thread_data[index].epoll_set = epoll_set;
250− if (pthread_create(&read_threads[index],
251− NULL,
252− read_thread_function,
253− &read_thread_data[index]) != 0)
254− goto error;
255− }
256−
257− if (pthread_create(&write_thread,
258− NULL,
259− write_thread_function,
260− &write_thread_data) != 0)
261− goto error;
262−
263− /* Cancel all event pollers: */
264−#ifdef EPOLL_CTL_DISABLE
265− for (index = 0; index < n_epoll_items; ++index) {
266− pthread_mutex_lock(&epoll_items[index].mutex);
267− ++epoll_items[index].stop;
268− if (epoll_ctl(epoll_set,
269− EPOLL_CTL_DISABLE,
270− epoll_items[index].fd,
271− NULL) == 0)
272− delete_item(index);
273− else if (errno != EBUSY) {
274− pthread_mutex_unlock(&epoll_items[index].mutex);
275− goto error;
276− }
277− /* EBUSY means events were being handled; allow the other thread
278− to delete the item. */
279− pthread_mutex_unlock(&epoll_items[index].mutex);
280− }
281−#else
282− for (index = 0; index < n_epoll_items; ++index) {
283− pthread_mutex_lock(&epoll_items[index].mutex);
284− ++epoll_items[index].stop;
285− pthread_mutex_unlock(&epoll_items[index].mutex);
286− /* Wait in case a thread running read_thread_function is
287− currently executing code between epoll_wait and
288− pthread_mutex_lock with this item. Note that a longer delay
289− would make double-deletion less likely (at the expense of
290− performance), but there is no guarantee that any delay would
291− ever be sufficient. Note also that we delete all event
292− pollers at once for testing purposes, but in a real-world
293− environment we are likely to want to be able to cancel event
294− pollers at arbitrary times. Therefore we can't improve this
295− situation by just splitting this loop into two loops
296− (i.e. signal 'stop' for all items, sleep, and then delete all
297− items). We also can't fix the problem via EPOLL_CTL_DEL
298− because that command can't prevent the case where some other
299− thread is executing read_thread_function within the region
300− mentioned above: */
301− usleep(1);
302− pthread_mutex_lock(&epoll_items[index].mutex);
303− if (!epoll_items[index].deleted)
304− delete_item(index);
305− pthread_mutex_unlock(&epoll_items[index].mutex);
306− }
307−#endif
308−
309− /* Shut down the read threads: */
310− for (index = 0; index < n_read_threads; ++index)
311− __sync_fetch_and_add(&read_thread_data[index].stop, 1);
312− for (index = 0; index < n_read_threads; ++index) {
313− if (pthread_join(read_threads[index], NULL) != 0)
314− goto error;
315− if (read_thread_data[index].status)
316− goto error;
317− }
318−
319− /* Shut down the write thread: */
320− __sync_fetch_and_add(&write_thread_data.stop, 1);
321− if ((pthread_join(write_thread, NULL) != 0) || write_thread_data.status)
322− goto error;
323−
324− /* Check for final error conditions: */
325− for (index = 0; index < n_epoll_items; ++index) {
326− if (epoll_items[index].status != 0)
327− goto error;
328− if (pthread_mutex_destroy(&epoll_items[index].mutex) < 0)
329− goto error;
330− }
331− for (index = 0; index < n_epoll_items; ++index)
332− if (epoll_items[index].deleted != 1) {
333− printf("Error: item data deleted %1d times.\n",
334− epoll_items[index].deleted);
335− goto error;
336− }
337−
338− printf("[PASS]\n");
339− return 0;
340−
341− error:
342− printf("[FAIL]\n");
343− return errno;
344−}

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t