History

Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Minor line offset auto-merges.

David S. Miller committed 13 years ago

Commit 67f4efd2 parents c53aa50 f4a75d2384 files · +4467 −2347Browse files

Unified · Split

384 files
  1. Documentation/arm64/memory.txt +6 −6
  2. Documentation/cgroups/memory.txt +4 −0
  3. Documentation/filesystems/proc.txt +12 −4
  4. Documentation/networking/netdev-features.txt +1 −1
  5. MAINTAINERS +60 −9
  6. Makefile +1 −1
  7. arch/arm/boot/Makefile +5 −5
  8. arch/arm/boot/dts/tegra30.dtsi +2 −2
  9. arch/arm/include/asm/io.h +2 −2
  10. arch/arm/include/asm/sched_clock.h +0 −2
  11. arch/arm/include/asm/vfpmacros.h +6 −6
  12. arch/arm/include/uapi/asm/hwcap.h +2 −1
  13. arch/arm/kernel/sched_clock.c +4 −14
  14. arch/arm/mach-at91/at91rm9200_devices.c +1 −1
  15. arch/arm/mach-at91/at91sam9260_devices.c +1 −1
  16. arch/arm/mach-at91/at91sam9261_devices.c +1 −1
  17. arch/arm/mach-at91/at91sam9263_devices.c +1 −1
  18. arch/arm/mach-at91/at91sam9g45_devices.c +6 −6
  19. arch/arm/mach-highbank/system.c +2 −1
  20. arch/arm/mach-imx/clk-gate2.c +1 −1
  21. arch/arm/mach-imx/ehci-imx25.c +1 −1
  22. arch/arm/mach-imx/ehci-imx35.c +1 −1
  23. arch/arm/mach-omap2/clockdomains44xx_data.c +1 −1
  24. arch/arm/mach-omap2/devices.c +79 −0
  25. arch/arm/mach-omap2/omap_hwmod.c +49 −14
  26. arch/arm/mach-omap2/omap_hwmod_44xx_data.c +36 −0
  27. arch/arm/mach-omap2/twl-common.c +1 −1
  28. arch/arm/mach-omap2/vc.c +1 −1
  29. arch/arm/mach-pxa/hx4700.c +7 −1
  30. arch/arm/mach-pxa/spitz_pm.c +2 −6
  31. arch/arm/mm/alignment.c +1 −1
  32. arch/arm/plat-omap/include/plat/omap_hwmod.h +6 −0
  33. arch/arm/tools/Makefile +1 −1
  34. arch/arm/vfp/vfpmodule.c +6 −3
  35. arch/arm/xen/enlighten.c +11 −0
  36. arch/arm64/Kconfig +1 −0
  37. arch/arm64/include/asm/elf.h +1 −4
  38. arch/arm64/include/asm/fpsimd.h +2 −3
  39. arch/arm64/include/asm/io.h +5 −5
  40. arch/arm64/include/asm/pgtable-hwdef.h +4 −2
  41. arch/arm64/include/asm/pgtable.h +20 −20
  42. arch/arm64/include/asm/processor.h +2 −0
  43. arch/arm64/include/asm/unistd.h +0 −1
  44. arch/arm64/kernel/perf_event.c +2 −8
  45. arch/arm64/kernel/process.c +0 −18
  46. arch/arm64/kernel/smp.c +1 −2
  47. arch/arm64/mm/init.c +1 −1
  48. arch/h8300/include/asm/cache.h +2 −1
  49. arch/ia64/mm/init.c +0 −1
  50. arch/mips/cavium-octeon/executive/cvmx-l2c.c +1 −0
  51. arch/mips/fw/arc/misc.c +1 −0
  52. arch/mips/include/asm/bitops.h +39 −89
  53. arch/mips/include/asm/compat.h +1 −1
  54. arch/mips/include/asm/io.h +1 −0
  55. arch/mips/include/asm/irqflags.h +75 −132
  56. arch/mips/include/asm/thread_info.h +0 −6
  57. arch/mips/lib/Makefile +3 −2
  58. arch/mips/lib/bitops.c +179 −0
  59. arch/mips/lib/mips-atomic.c +176 −0
  60. arch/mips/mti-malta/malta-platform.c +2 −1
  61. arch/s390/Kconfig +1 −0
  62. arch/s390/include/asm/cio.h +2 −0
  63. arch/s390/include/asm/compat.h +1 −1
  64. arch/s390/include/asm/pgtable.h +22 −13
  65. arch/s390/include/asm/topology.h +3 −0
  66. arch/s390/include/uapi/asm/ptrace.h +2 −2
  67. arch/s390/kernel/compat_signal.c +12 −2
  68. arch/s390/kernel/sclp.S +7 −1
  69. arch/s390/kernel/signal.c +12 −2
  70. arch/s390/kernel/topology.c +4 −2
  71. arch/s390/lib/uaccess_pt.c +1 −1
  72. arch/s390/mm/gup.c +3 −4
  73. arch/sparc/Kconfig +1 −0
  74. arch/sparc/crypto/Makefile +8 −8
  75. arch/sparc/crypto/aes_glue.c +2 −0
  76. arch/sparc/crypto/camellia_glue.c +2 −0
  77. arch/sparc/crypto/crc32c_glue.c +2 −0
  78. arch/sparc/crypto/des_glue.c +2 −0
  79. arch/sparc/crypto/md5_glue.c +2 −0
  80. arch/sparc/crypto/sha1_glue.c +2 −0
  81. arch/sparc/crypto/sha256_glue.c +2 −0
  82. arch/sparc/crypto/sha512_glue.c +2 −0
  83. arch/sparc/include/asm/atomic_64.h +3 −1
  84. arch/sparc/include/asm/backoff.h +59 −10
  85. arch/sparc/include/asm/compat.h +3 −2
  86. arch/sparc/include/asm/processor_64.h +16 −1
  87. arch/sparc/include/asm/prom.h +5 −0
  88. arch/sparc/include/asm/thread_info_64.h +5 −0
  89. arch/sparc/include/asm/ttable.h +16 −8
  90. arch/sparc/include/uapi/asm/unistd.h +6 −1
  91. arch/sparc/kernel/entry.h +7 −0
  92. arch/sparc/kernel/leon_kernel.c +4 −2
  93. arch/sparc/kernel/perf_event.c +16 −6
  94. arch/sparc/kernel/process_64.c +23 −19
  95. arch/sparc/kernel/ptrace_64.c +2 −2
  96. arch/sparc/kernel/setup_64.c +21 −0
  97. arch/sparc/kernel/sys_sparc_64.c +5 −0
  98. arch/sparc/kernel/systbls_32.S +1 −0
  99. arch/sparc/kernel/systbls_64.S +2 −0
  100. arch/sparc/kernel/unaligned_64.c +23 −13
  101. arch/sparc/kernel/visemul.c +14 −9
  102. arch/sparc/kernel/vmlinux.lds.S +5 −0
  103. arch/sparc/kernel/winfixup.S +2 −0
  104. arch/sparc/lib/atomic_64.S +15 −1
  105. arch/sparc/lib/ksyms.c +1 −0
  106. arch/sparc/math-emu/math_64.c +1 −1
  107. arch/unicore32/Kconfig +6 −1
  108. arch/unicore32/include/asm/Kbuild +0 −1
  109. arch/unicore32/include/asm/bug.h +0 −5
  110. arch/unicore32/include/asm/cmpxchg.h +1 −1
  111. arch/unicore32/include/asm/kvm_para.h +0 −1
  112. arch/unicore32/include/asm/processor.h +0 −5
  113. arch/unicore32/include/asm/ptrace.h +1 −75
  114. arch/unicore32/include/uapi/asm/Kbuild +7 −0
  115. arch/unicore32/include/uapi/asm/byteorder.h +0 −0
  116. arch/unicore32/include/uapi/asm/ptrace.h +90 −0
  117. arch/unicore32/include/uapi/asm/sigcontext.h +0 −0
  118. arch/unicore32/include/uapi/asm/unistd.h +1 −0
  119. arch/unicore32/kernel/entry.S +7 −13
  120. arch/unicore32/kernel/process.c +14 −44
  121. arch/unicore32/kernel/setup.h +6 −0
  122. arch/unicore32/kernel/sys.c +0 −63
  123. arch/unicore32/mm/fault.c +27 −10
  124. arch/x86/include/asm/xen/hypercall.h +7 −14
  125. arch/x86/kvm/cpuid.h +3 −0
  126. arch/x86/kvm/vmx.c +7 −4
  127. arch/x86/kvm/x86.c +3 −0
  128. crypto/cryptd.c +8 −3
  129. drivers/acpi/video.c +7 −4
  130. drivers/base/platform.c +7 −0
  131. drivers/bluetooth/ath3k.c +1 −0
  132. drivers/bluetooth/btusb.c +1 −0
  133. drivers/bus/omap-ocp2scp.c +65 −3
  134. drivers/clk/ux500/u8500_clk.c +46 −4
  135. drivers/gpio/Kconfig +1 −1
  136. drivers/gpu/drm/drm_fops.c +30 −14
  137. drivers/gpu/drm/exynos/Kconfig +1 −1
  138. drivers/gpu/drm/exynos/exynos_drm_connector.c +1 −0
  139. drivers/gpu/drm/exynos/exynos_drm_encoder.c +17 −16
  140. drivers/gpu/drm/exynos/exynos_mixer.c +1 −1
  141. drivers/gpu/drm/i915/i915_dma.c +2 −1
  142. drivers/gpu/drm/i915/intel_crt.c +2 −2
  143. drivers/gpu/drm/i915/intel_display.c +11 −0
  144. drivers/gpu/drm/i915/intel_overlay.c +11 −3
  145. drivers/gpu/drm/i915/intel_panel.c +1 −1
  146. drivers/gpu/drm/i915/intel_sdvo.c +61 −23
  147. drivers/gpu/drm/i915/intel_sdvo_regs.h +2 −0
  148. drivers/gpu/drm/nouveau/core/engine/disp/nv50.c +12 −8
  149. drivers/gpu/drm/nouveau/core/engine/graph/nv40.c +2 −2
  150. drivers/gpu/drm/nouveau/core/engine/mpeg/nv40.c +1 −1
  151. drivers/gpu/drm/nouveau/core/subdev/vm/nv41.c +1 −1
  152. drivers/gpu/drm/nouveau/nouveau_connector.c +1 −1
  153. drivers/gpu/drm/radeon/atombios_crtc.c +31 −23
  154. drivers/gpu/drm/radeon/atombios_encoders.c +1 −1
  155. drivers/gpu/drm/radeon/evergreen.c +1 −1
  156. drivers/gpu/drm/radeon/evergreen_cs.c +4 −1
  157. drivers/gpu/drm/radeon/evergreend.h +4 −0
  158. drivers/gpu/drm/radeon/radeon_atpx_handler.c +2 −2
  159. drivers/gpu/drm/radeon/radeon_connectors.c +21 −7
  160. drivers/gpu/drm/radeon/radeon_legacy_crtc.c +13 −2
  161. drivers/gpu/drm/radeon/radeon_legacy_encoders.c +147 −28
  162. drivers/gpu/drm/radeon/si.c +1 −0
  163. drivers/gpu/drm/radeon/sid.h +1 −0
  164. drivers/gpu/drm/ttm/ttm_page_alloc.c +4 −1
  165. drivers/gpu/drm/ttm/ttm_tt.c +0 −4
  166. drivers/gpu/drm/udl/udl_drv.h +1 −1
  167. drivers/gpu/drm/udl/udl_fb.c +7 −5
  168. drivers/gpu/drm/udl/udl_transfer.c +3 −2
  169. drivers/gpu/drm/vmwgfx/vmwgfx_dmabuf.c +1 −1
  170. drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +5 −0
  171. drivers/gpu/drm/vmwgfx/vmwgfx_ioctl.c +2 −0
  172. drivers/hid/hid-microsoft.c +3 −3
  173. drivers/hid/hidraw.c +43 −26
  174. drivers/hwmon/asb100.c +1 −1
  175. drivers/hwmon/w83627ehf.c +1 −0
  176. drivers/hwmon/w83627hf.c +1 −1
  177. drivers/hwmon/w83781d.c +1 −1
  178. drivers/hwmon/w83791d.c +1 −1
  179. drivers/hwmon/w83792d.c +1 −1
  180. drivers/hwmon/w83l786ng.c +1 −1
  181. drivers/i2c/busses/i2c-mxs.c +14 −172
  182. drivers/i2c/busses/i2c-nomadik.c +7 −2
  183. drivers/i2c/busses/i2c-tegra.c +1 −1
  184. drivers/i2c/muxes/i2c-mux-pinctrl.c +1 −1
  185. drivers/irqchip/irq-bcm2835.c +2 −1
  186. drivers/leds/ledtrig-cpu.c +0 −21
  187. drivers/mmc/host/dw_mmc-exynos.c +4 −4
  188. drivers/mmc/host/dw_mmc-pltfm.c +3 −3
  189. drivers/mmc/host/dw_mmc-pltfm.h +1 −1
  190. drivers/mmc/host/dw_mmc.c +34 −28
  191. drivers/mmc/host/mxcmmc.c +1 −1
  192. drivers/mmc/host/omap_hsmmc.c +12 −7
  193. drivers/mmc/host/sdhci-dove.c +20 −18
  194. drivers/mmc/host/sdhci-of-esdhc.c +11 −0
  195. drivers/mmc/host/sdhci-pci.c +1 −1
  196. drivers/mmc/host/sdhci-pltfm.c +7 −0
  197. drivers/mmc/host/sdhci-s3c.c +16 −14
  198. drivers/mmc/host/sdhci.c +28 −16
  199. drivers/mmc/host/sdhci.h +1 −0
  200. drivers/mmc/host/sh_mmcif.c +1 −1
  201. drivers/net/ethernet/jme.c +8 −20
  202. drivers/net/ethernet/micrel/ksz884x.c +4 −12
  203. drivers/net/ethernet/smsc/smsc911x.c +15 −2
  204. drivers/net/ethernet/tile/tilegx.c +1 −1
  205. drivers/net/ethernet/xilinx/xilinx_axienet_main.c +6 −6
  206. drivers/net/phy/mdio-bitbang.c +0 −1
  207. drivers/net/usb/cdc_ncm.c +18 −4
  208. drivers/net/usb/smsc95xx.c +2 −2
  209. drivers/net/vxlan.c +7 −3
  210. drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +1 −1
  211. drivers/net/wireless/iwlwifi/dvm/mac80211.c +1 −1
  212. drivers/net/wireless/iwlwifi/dvm/main.c +1 −1
  213. drivers/net/wireless/iwlwifi/pcie/rx.c +21 −2
  214. drivers/pci/bus.c +0 −3
  215. drivers/pci/pci-driver.c +2 −10
  216. drivers/pci/pci-sysfs.c +0 −34
  217. drivers/pci/pci.c +32 −0
  218. drivers/pci/pci.h +2 −0
  219. drivers/pci/pcie/aer/aerdrv_core.c +16 −4
  220. drivers/pci/pcie/portdrv_core.c +2 −1
  221. drivers/pci/proc.c +8 −0
  222. drivers/pinctrl/Kconfig +2 −0
  223. drivers/pinctrl/spear/pinctrl-spear.c +1 −1
  224. drivers/pinctrl/spear/pinctrl-spear1310.c +320 −45
  225. drivers/pinctrl/spear/pinctrl-spear1340.c +39 −2
  226. drivers/pinctrl/spear/pinctrl-spear320.c +6 −2
  227. drivers/pinctrl/spear/pinctrl-spear3xx.h +1 −0
  228. drivers/rapidio/rio.c +1 −1
  229. drivers/regulator/core.c +20 −13
  230. drivers/s390/char/con3215.c +5 −7
  231. drivers/s390/cio/css.h +0 −3
  232. drivers/s390/cio/device.c +1 −7
  233. drivers/s390/cio/idset.c +1 −2
  234. drivers/s390/net/qeth_core_main.c +22 −2
  235. drivers/s390/net/qeth_l2_main.c +8 −5
  236. drivers/scsi/qlogicpti.c +1 −12
  237. drivers/staging/android/android_alarm.h +1 −3
  238. drivers/thermal/exynos_thermal.c +1 −1
  239. drivers/thermal/rcar_thermal.c +1 −1
  240. drivers/tty/hvc/hvc_console.c +0 −7
  241. drivers/tty/serial/max310x.c +1 −0
  242. drivers/usb/core/hcd.c +16 −0
  243. drivers/usb/early/ehci-dbgp.c +9 −6
  244. drivers/usb/host/ehci-ls1x.c +1 −1
  245. drivers/usb/host/ohci-xls.c +1 −1
  246. drivers/usb/musb/musb_gadget.c +26 −4
  247. drivers/usb/musb/ux500.c +1 −1
  248. drivers/usb/otg/Kconfig +2 −2
  249. drivers/usb/serial/keyspan.c +1 −2
  250. drivers/usb/serial/option.c +9 −0
  251. drivers/usb/serial/usb_wwan.c +5 −5
  252. drivers/virtio/virtio.c +3 −1
  253. drivers/xen/Makefile +1 −0
  254. drivers/xen/events.c +1 −1
  255. drivers/xen/fallback.c +80 −0
  256. fs/cifs/cifsacl.c +20 −29
  257. fs/cifs/dir.c +10 −1
  258. fs/eventpoll.c +3 −35
  259. fs/gfs2/file.c +5 −9
  260. fs/gfs2/lops.c +2 −14
  261. fs/gfs2/quota.c +5 −2
  262. fs/gfs2/rgrp.c +21 −12
  263. fs/gfs2/super.c +2 −1
  264. fs/gfs2/trans.c +8 −0
  265. fs/nfs/dns_resolve.c +3 −2
  266. fs/nfs/inode.c +4 −1
  267. fs/nfs/internal.h +4 −2
  268. fs/nfs/mount_clnt.c +1 −1
  269. fs/nfs/namespace.c +14 −5
  270. fs/nfs/nfs4namespace.c +2 −1
  271. fs/nfs/nfs4proc.c +28 −18
  272. fs/nfs/pnfs.c +2 −2
  273. fs/nfs/super.c +50 −1
  274. fs/nfs/unlink.c +1 −1
  275. fs/notify/fanotify/fanotify.c +1 −0
  276. fs/proc/base.c +109 −0
  277. fs/pstore/platform.c +2 −1
  278. fs/ubifs/find.c +10 −2
  279. fs/ubifs/lprops.c +6 −0
  280. fs/ubifs/ubifs.h +3 −0
  281. fs/xfs/xfs_alloc.c +2 −41
  282. fs/xfs/xfs_alloc.h +0 −3
  283. fs/xfs/xfs_alloc_btree.c +2 −0
  284. fs/xfs/xfs_bmap.c +54 −9
  285. fs/xfs/xfs_bmap.h +8 −1
  286. fs/xfs/xfs_buf_item.c +18 −0
  287. fs/xfs/xfs_fsops.c +19 −2
  288. fs/xfs/xfs_ialloc.c +1 −0
  289. fs/xfs/xfs_inode.c +2 −1
  290. fs/xfs/xfs_ioctl.c +1 −1
  291. fs/xfs/xfs_iomap.c +3 −1
  292. fs/xfs/xfs_log.c +16 −3
  293. fs/xfs/xfs_log_recover.c +1 −1
  294. include/linux/clk-provider.h +2 −2
  295. include/linux/mm.h +0 −4
  296. include/linux/mmc/dw_mmc.h +3 −3
  297. include/linux/mmc/sdhci.h +1 −0
  298. include/linux/mmzone.h +1 −1
  299. include/linux/of_address.h +2 −0
  300. include/linux/platform_data/omap_ocp2scp.h +31 −0
  301. include/linux/rio.h +2 −0
  302. include/uapi/linux/eventpoll.h +0 −1
  303. include/uapi/linux/oom.h +9 −0
  304. include/xen/hvm.h +32 −2
  305. kernel/futex.c +22 −19
  306. kernel/module.c +16 −11
  307. mm/bootmem.c +1 −9
  308. mm/highmem.c +1 −1
  309. mm/memcontrol.c +50 −17
  310. mm/memory.c +4 −6
  311. mm/memory_hotplug.c +0 −7
  312. mm/mmap.c +2 −0
  313. mm/mmzone.c +1 −5
  314. mm/nobootmem.c +0 −3
  315. mm/page_alloc.c +1 −35
  316. mm/shmem.c +15 −3
  317. mm/swapfile.c +2 −2
  318. mm/vmscan.c +2 −25
  319. net/batman-adv/soft-interface.c +6 −6
  320. net/batman-adv/translation-table.c +14 −1
  321. net/bluetooth/hci_core.c +2 −2
  322. net/bluetooth/mgmt.c +7 −5
  323. net/bluetooth/smp.c +1 −1
  324. net/core/dev.c +3 −1
  325. net/core/dev_addr_lists.c +2 −1
  326. net/ipv4/ip_sockglue.c +22 −13
  327. net/ipv4/ip_vti.c +5 −0
  328. net/ipv4/tcp.c +2 −2
  329. net/ipv4/tcp_input.c +10 −5
  330. net/ipv4/tcp_metrics.c +9 −3
  331. net/ipv4/tcp_output.c +4 −0
  332. net/ipv6/ipv6_sockglue.c +1 −0
  333. net/mac80211/cfg.c +3 −0
  334. net/mac80211/ieee80211_i.h +2 −0
  335. net/mac80211/main.c +4 −2
  336. net/mac80211/scan.c +1 −1
  337. net/mac80211/sta_info.c +8 −3
  338. net/mac80211/status.c +9 −0
  339. net/mac80211/tx.c +6 −3
  340. net/mac80211/util.c +2 −0
  341. net/sctp/proc.c +4 −4
  342. net/sunrpc/backchannel_rqst.c +1 −1
  343. net/wireless/reg.c +2 −3
  344. scripts/Makefile.modinst +2 −1
  345. scripts/checkpatch.pl +4 −2
  346. scripts/kconfig/expr.h +2 −3
  347. scripts/kconfig/list.h +91 −0
  348. scripts/kconfig/lkc_proto.h +2 −2
  349. scripts/kconfig/mconf.c +3 −3
  350. scripts/kconfig/menu.c +8 −6
  351. security/device_cgroup.c +13 −5
  352. sound/core/oss/mixer_oss.c +1 −0
  353. sound/core/oss/pcm_oss.c +1 −0
  354. sound/core/pcm_native.c +4 −2
  355. sound/core/sound.c +1 −1
  356. sound/core/sound_oss.c +1 −1
  357. sound/i2c/other/ak4113.c +1 −1
  358. sound/i2c/other/ak4114.c +1 −1
  359. sound/i2c/other/ak4117.c +1 −1
  360. sound/pci/es1968.c +9 −2
  361. sound/pci/fm801.c +8 −3
  362. sound/pci/hda/hda_intel.c +2 −0
  363. sound/pci/hda/patch_analog.c +1 −0
  364. sound/pci/hda/patch_cirrus.c +12 −9
  365. sound/pci/hda/patch_realtek.c +14 −13
  366. sound/pci/hda/patch_via.c +29 −7
  367. sound/pci/rme9652/hdspm.c +3 −2
  368. sound/soc/codecs/cs42l52.c +2 −3
  369. sound/soc/codecs/wm5102.c +551 −1
  370. sound/soc/codecs/wm8978.c +1 −1
  371. sound/soc/codecs/wm8994.c +1 −1
  372. sound/soc/mxs/mxs-saif.c +13 −4
  373. sound/soc/samsung/Kconfig +2 −0
  374. sound/soc/samsung/bells.c +1 −1
  375. sound/soc/soc-core.c +3 −2
  376. sound/soc/soc-dapm.c +1 −1
  377. sound/usb/card.c +3 −3
  378. sound/usb/endpoint.c +13 −0
  379. sound/usb/endpoint.h +1 −0
  380. sound/usb/pcm.c +3 −0
  381. tools/power/x86/turbostat/turbostat.c +19 −9
  382. tools/testing/selftests/Makefile +1 −1
  383. tools/testing/selftests/epoll/Makefile +0 −11
  384. 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/cgroups/memory.txt+4−0
@@ -466,6 +466,10 @@ Note: · 465 unmodified lines
466466 5.3 swappiness
467467
468468 Similar to /proc/sys/vm/swappiness, but affecting a hierarchy of groups only.
469+Please note that unlike the global swappiness, memcg knob set to 0
470+really prevents from any swapping even if there is a swap storage
471+available. This might lead to memcg OOM killer if there are no file
472+pages to reclaim.
469473
470474 Following cgroups' swappiness can't be changed.
471475 - root cgroup (uses /proc/sys/vm/swappiness).
Documentation/filesystems/proc.txt+12−4
@@ -33,7 +33,7 @@ Table of Contents · 32 unmodified lines
3333 2 Modifying System Parameters
3434
3535 3 Per-Process Parameters
36− 3.1 /proc/<pid>/oom_score_adj - Adjust the oom-killer
36+ 3.1 /proc/<pid>/oom_adj & /proc/<pid>/oom_score_adj - Adjust the oom-killer
3737 score
3838 3.2 /proc/<pid>/oom_score - Display current oom-killer score
3939 3.3 /proc/<pid>/io - Display the IO accounting fields
@@ -1320,10 +1320,10 @@ of the kernel. · 1280 unmodified lines
13201320 CHAPTER 3: PER-PROCESS PARAMETERS
13211321 ------------------------------------------------------------------------------
13221322
1323−3.1 /proc/<pid>/oom_score_adj- Adjust the oom-killer score
1323+3.1 /proc/<pid>/oom_adj & /proc/<pid>/oom_score_adj- Adjust the oom-killer score
13241324 --------------------------------------------------------------------------------
13251325
1326−This file can be used to adjust the badness heuristic used to select which
1326+These file can be used to adjust the badness heuristic used to select which
13271327 process gets killed in out of memory conditions.
13281328
13291329 The badness heuristic assigns a value to each candidate task ranging from 0
@@ -1361,6 +1361,12 @@ same system, cpuset, mempolicy, or memory controller resources to use at least · 31 unmodified lines
13611361 equivalent to discounting 50% of the task's allowed memory from being considered
13621362 as scoring against the task.
13631363
1364+For backwards compatibility with previous kernels, /proc/<pid>/oom_adj may also
1365+be used to tune the badness score. Its acceptable values range from -16
1366+(OOM_ADJUST_MIN) to +15 (OOM_ADJUST_MAX) and a special value of -17
1367+(OOM_DISABLE) to disable oom killing entirely for that task. Its value is
1368+scaled linearly with /proc/<pid>/oom_score_adj.
1369+
13641370 The value of /proc/<pid>/oom_score_adj may be reduced no lower than the last
13651371 value set by a CAP_SYS_RESOURCE process. To reduce the value any lower
13661372 requires CAP_SYS_RESOURCE.
@@ -1375,7 +1381,9 @@ minimal amount of work. · 8 unmodified lines
13751381 -------------------------------------------------------------
13761382
13771383 This file can be used to check the current score used by the oom-killer is for
1378−any given <pid>.
1384+any given <pid>. Use it together with /proc/<pid>/oom_score_adj to tune which
1385+process should be killed in an out-of-memory situation.
1386+
13791387
13801388 3.3 /proc/<pid>/io - Display the IO accounting fields
13811389 -------------------------------------------------------
Documentation/networking/netdev-features.txt+1−1
@@ -164,4 +164,4 @@ read the CRC recorded by the NIC on receipt of the packet. · 163 unmodified lines
164164 This requests that the NIC receive all possible frames, including errored
165165 frames (such as bad FCS, etc). This can be helpful when sniffing a link with
166166 bad packets on it. Some NICs may receive more packets if also put into normal
167−PROMISC mdoe.
167+PROMISC mode.
MAINTAINERS+60−9
@@ -2507,6 +2507,7 @@ M: Joonyoung Shim <jy0922.shim@samsung.com> · 2506 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*
@@ -3597,6 +3598,49 @@ F: drivers/hid/hid-hyperv.c · 1084 unmodified lines
35973598 F: drivers/net/hyperv/
35983599 F: drivers/staging/hv/
35993600
3601+I2C OVER PARALLEL PORT
3602+M: Jean Delvare <khali@linux-fr.org>
3603+L: linux-i2c@vger.kernel.org
3604+S: Maintained
3605+F: Documentation/i2c/busses/i2c-parport
3606+F: Documentation/i2c/busses/i2c-parport-light
3607+F: drivers/i2c/busses/i2c-parport.c
3608+F: drivers/i2c/busses/i2c-parport-light.c
3609+
3610+I2C/SMBUS CONTROLLER DRIVERS FOR PC
3611+M: Jean Delvare <khali@linux-fr.org>
3612+L: linux-i2c@vger.kernel.org
3613+S: Maintained
3614+F: Documentation/i2c/busses/i2c-ali1535
3615+F: Documentation/i2c/busses/i2c-ali1563
3616+F: Documentation/i2c/busses/i2c-ali15x3
3617+F: Documentation/i2c/busses/i2c-amd756
3618+F: Documentation/i2c/busses/i2c-amd8111
3619+F: Documentation/i2c/busses/i2c-i801
3620+F: Documentation/i2c/busses/i2c-nforce2
3621+F: Documentation/i2c/busses/i2c-piix4
3622+F: Documentation/i2c/busses/i2c-sis5595
3623+F: Documentation/i2c/busses/i2c-sis630
3624+F: Documentation/i2c/busses/i2c-sis96x
3625+F: Documentation/i2c/busses/i2c-via
3626+F: Documentation/i2c/busses/i2c-viapro
3627+F: drivers/i2c/busses/i2c-ali1535.c
3628+F: drivers/i2c/busses/i2c-ali1563.c
3629+F: drivers/i2c/busses/i2c-ali15x3.c
3630+F: drivers/i2c/busses/i2c-amd756.c
3631+F: drivers/i2c/busses/i2c-amd756-s4882.c
3632+F: drivers/i2c/busses/i2c-amd8111.c
3633+F: drivers/i2c/busses/i2c-i801.c
3634+F: drivers/i2c/busses/i2c-isch.c
3635+F: drivers/i2c/busses/i2c-nforce2.c
3636+F: drivers/i2c/busses/i2c-nforce2-s4985.c
3637+F: drivers/i2c/busses/i2c-piix4.c
3638+F: drivers/i2c/busses/i2c-sis5595.c
3639+F: drivers/i2c/busses/i2c-sis630.c
3640+F: drivers/i2c/busses/i2c-sis96x.c
3641+F: drivers/i2c/busses/i2c-via.c
3642+F: drivers/i2c/busses/i2c-viapro.c
3643+
36003644 I2C/SMBUS STUB DRIVER
36013645 M: "Mark M. Hoffman" <mhoffman@lightlink.com>
36023646 L: linux-i2c@vger.kernel.org
@@ -3604,9 +3648,8 @@ S: Maintained · 1 unmodified line
36043648 F: drivers/i2c/busses/i2c-stub.c
36053649
36063650 I2C SUBSYSTEM
3607−M: "Jean Delvare (PC drivers, core)" <khali@linux-fr.org>
3651+M: Wolfram Sang <w.sang@pengutronix.de>
36083652 M: "Ben Dooks (embedded platforms)" <ben-linux@fluff.org>
3609−M: "Wolfram Sang (embedded platforms)" <w.sang@pengutronix.de>
36103653 L: linux-i2c@vger.kernel.org
36113654 W: http://i2c.wiki.kernel.org/
36123655 T: quilt kernel.org/pub/linux/kernel/people/jdelvare/linux-2.6/jdelvare-i2c/
@@ -3617,6 +3660,13 @@ F: drivers/i2c/ · 4 unmodified lines
36173660 F: include/linux/i2c.h
36183661 F: include/linux/i2c-*.h
36193662
3663+I2C-TAOS-EVM DRIVER
3664+M: Jean Delvare <khali@linux-fr.org>
3665+L: linux-i2c@vger.kernel.org
3666+S: Maintained
3667+F: Documentation/i2c/busses/i2c-taos-evm
3668+F: drivers/i2c/busses/i2c-taos-evm.c
3669+
36203670 I2C-TINY-USB DRIVER
36213671 M: Till Harbaum <till@harbaum.org>
36223672 L: linux-i2c@vger.kernel.org
@@ -7212,6 +7262,14 @@ L: linux-xtensa@linux-xtensa.org · 3589 unmodified lines
72127262 S: Maintained
72137263 F: arch/xtensa/
72147264
7265+THERMAL
7266+M: Zhang Rui <rui.zhang@intel.com>
7267+L: linux-pm@vger.kernel.org
7268+T: git git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux.git
7269+S: Supported
7270+F: drivers/thermal/
7271+F: include/linux/thermal.h
7272+
72157273 THINKPAD ACPI EXTRAS DRIVER
72167274 M: Henrique de Moraes Holschuh <ibm-acpi@hmh.eng.br>
72177275 L: ibm-acpi-devel@lists.sourceforge.net
@@ -7895,13 +7953,6 @@ M: Roger Luethi <rl@hellgate.ch> · 677 unmodified lines
78957953 S: Maintained
78967954 F: drivers/net/ethernet/via/via-rhine.c
78977955
7898−VIAPRO SMBUS DRIVER
7899−M: Jean Delvare <khali@linux-fr.org>
7900−L: linux-i2c@vger.kernel.org
7901−S: Maintained
7902−F: Documentation/i2c/busses/i2c-viapro
7903−F: drivers/i2c/busses/i2c-viapro.c
7904−
79057956 VIA SD/MMC CARD CONTROLLER DRIVER
79067957 M: Bruce Chang <brucechang@via.com.tw>
79077958 M: Harald Welte <HaraldWelte@viatech.com>
Makefile+1−1
@@ -1,7 +1,7 @@
11 VERSION = 3
22 PATCHLEVEL = 7
33 SUBLEVEL = 0
4−EXTRAVERSION = -rc3
4+EXTRAVERSION = -rc6
55 NAME = Terrified Chipmunk
66
77 # *DOCUMENTATION*
arch/arm/boot/Makefile+5−5
@@ -33,7 +33,7 @@ ifeq ($(CONFIG_XIP_KERNEL),y) · 32 unmodified lines
3333
3434 $(obj)/xipImage: vmlinux FORCE
3535 $(call if_changed,objcopy)
36− $(kecho) ' Kernel: $@ is ready (physical address: $(CONFIG_XIP_PHYS_ADDR))'
36+ @$(kecho) ' Kernel: $@ is ready (physical address: $(CONFIG_XIP_PHYS_ADDR))'
3737
3838 $(obj)/Image $(obj)/zImage: FORCE
3939 @echo 'Kernel configured for XIP (CONFIG_XIP_KERNEL=y)'
@@ -48,14 +48,14 @@ $(obj)/xipImage: FORCE · 8 unmodified lines
4848
4949 $(obj)/Image: vmlinux FORCE
5050 $(call if_changed,objcopy)
51− $(kecho) ' Kernel: $@ is ready'
51+ @$(kecho) ' Kernel: $@ is ready'
5252
5353 $(obj)/compressed/vmlinux: $(obj)/Image FORCE
5454 $(Q)$(MAKE) $(build)=$(obj)/compressed $@
5555
5656 $(obj)/zImage: $(obj)/compressed/vmlinux FORCE
5757 $(call if_changed,objcopy)
58− $(kecho) ' Kernel: $@ is ready'
58+ @$(kecho) ' Kernel: $@ is ready'
5959
6060 endif
6161
@@ -90,7 +90,7 @@ fi · 28 unmodified lines
9090 $(obj)/uImage: $(obj)/zImage FORCE
9191 @$(check_for_multiple_loadaddr)
9292 $(call if_changed,uimage)
93− $(kecho) ' Image $@ is ready'
93+ @$(kecho) ' Image $@ is ready'
9494
9595 $(obj)/bootp/bootp: $(obj)/zImage initrd FORCE
9696 $(Q)$(MAKE) $(build)=$(obj)/bootp $@
@@ -98,7 +98,7 @@ $(obj)/bootp/bootp: $(obj)/zImage initrd FORCE · 1 unmodified line
9898
9999 $(obj)/bootpImage: $(obj)/bootp/bootp FORCE
100100 $(call if_changed,objcopy)
101− $(kecho) ' Kernel: $@ is ready'
101+ @$(kecho) ' Kernel: $@ is ready'
102102
103103 PHONY += initrd FORCE
104104 initrd:
arch/arm/boot/dts/tegra30.dtsi+2−2
@@ -73,8 +73,8 @@ · 72 unmodified lines
7373
7474 pinmux: pinmux {
7575 compatible = "nvidia,tegra30-pinmux";
76− reg = <0x70000868 0xd0 /* Pad control registers */
77− 0x70003000 0x3e0>; /* Mux registers */
76+ reg = <0x70000868 0xd4 /* Pad control registers */
77+ 0x70003000 0x3e4>; /* Mux registers */
7878 };
7979
8080 serial@70006000 {
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/mach-at91/at91rm9200_devices.c+1−1
@@ -68,7 +68,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) · 67 unmodified lines
6868
6969 /* Enable overcurrent notification */
7070 for (i = 0; i < data->ports; i++) {
71− if (data->overcurrent_pin[i])
71+ if (gpio_is_valid(data->overcurrent_pin[i]))
7272 at91_set_gpio_input(data->overcurrent_pin[i], 1);
7373 }
7474
arch/arm/mach-at91/at91sam9260_devices.c+1−1
@@ -72,7 +72,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) · 71 unmodified lines
7272
7373 /* Enable overcurrent notification */
7474 for (i = 0; i < data->ports; i++) {
75− if (data->overcurrent_pin[i])
75+ if (gpio_is_valid(data->overcurrent_pin[i]))
7676 at91_set_gpio_input(data->overcurrent_pin[i], 1);
7777 }
7878
arch/arm/mach-at91/at91sam9261_devices.c+1−1
@@ -72,7 +72,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) · 71 unmodified lines
7272
7373 /* Enable overcurrent notification */
7474 for (i = 0; i < data->ports; i++) {
75− if (data->overcurrent_pin[i])
75+ if (gpio_is_valid(data->overcurrent_pin[i]))
7676 at91_set_gpio_input(data->overcurrent_pin[i], 1);
7777 }
7878
arch/arm/mach-at91/at91sam9263_devices.c+1−1
@@ -78,7 +78,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) · 77 unmodified lines
7878
7979 /* Enable overcurrent notification */
8080 for (i = 0; i < data->ports; i++) {
81− if (data->overcurrent_pin[i])
81+ if (gpio_is_valid(data->overcurrent_pin[i]))
8282 at91_set_gpio_input(data->overcurrent_pin[i], 1);
8383 }
8484
arch/arm/mach-at91/at91sam9g45_devices.c+6−6
@@ -1841,8 +1841,8 @@ static struct resource sha_resources[] = { · 1840 unmodified lines
18411841 .flags = IORESOURCE_MEM,
18421842 },
18431843 [1] = {
1844− .start = AT91SAM9G45_ID_AESTDESSHA,
1845− .end = AT91SAM9G45_ID_AESTDESSHA,
1844+ .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
1845+ .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
18461846 .flags = IORESOURCE_IRQ,
18471847 },
18481848 };
@@ -1874,8 +1874,8 @@ static struct resource tdes_resources[] = { · 25 unmodified lines
18741874 .flags = IORESOURCE_MEM,
18751875 },
18761876 [1] = {
1877− .start = AT91SAM9G45_ID_AESTDESSHA,
1878− .end = AT91SAM9G45_ID_AESTDESSHA,
1877+ .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
1878+ .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
18791879 .flags = IORESOURCE_IRQ,
18801880 },
18811881 };
@@ -1910,8 +1910,8 @@ static struct resource aes_resources[] = { · 28 unmodified lines
19101910 .flags = IORESOURCE_MEM,
19111911 },
19121912 [1] = {
1913− .start = AT91SAM9G45_ID_AESTDESSHA,
1914− .end = AT91SAM9G45_ID_AESTDESSHA,
1913+ .start = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
1914+ .end = NR_IRQS_LEGACY + AT91SAM9G45_ID_AESTDESSHA,
19151915 .flags = IORESOURCE_IRQ,
19161916 },
19171917 };
arch/arm/mach-highbank/system.c+2−1
@@ -28,6 +28,7 @@ void highbank_restart(char mode, const char *cmd) · 27 unmodified lines
2828 hignbank_set_pwr_soft_reset();
2929
3030 scu_power_mode(scu_base_addr, SCU_PM_POWEROFF);
31− cpu_do_idle();
31+ while (1)
32+ cpu_do_idle();
3233 }
3334
arch/arm/mach-imx/clk-gate2.c+1−1
@@ -112,7 +112,7 @@ struct clk *clk_register_gate2(struct device *dev, const char *name, · 111 unmodified lines
112112
113113 clk = clk_register(dev, &gate->hw);
114114 if (IS_ERR(clk))
115− kfree(clk);
115+ kfree(gate);
116116
117117 return clk;
118118 }
arch/arm/mach-imx/ehci-imx25.c+1−1
@@ -30,7 +30,7 @@ · 29 unmodified lines
3030 #define MX25_H1_SIC_SHIFT 21
3131 #define MX25_H1_SIC_MASK (0x3 << MX25_H1_SIC_SHIFT)
3232 #define MX25_H1_PP_BIT (1 << 18)
33−#define MX25_H1_PM_BIT (1 << 8)
33+#define MX25_H1_PM_BIT (1 << 16)
3434 #define MX25_H1_IPPUE_UP_BIT (1 << 7)
3535 #define MX25_H1_IPPUE_DOWN_BIT (1 << 6)
3636 #define MX25_H1_TLL_BIT (1 << 5)
arch/arm/mach-imx/ehci-imx35.c+1−1
@@ -30,7 +30,7 @@ · 29 unmodified lines
3030 #define MX35_H1_SIC_SHIFT 21
3131 #define MX35_H1_SIC_MASK (0x3 << MX35_H1_SIC_SHIFT)
3232 #define MX35_H1_PP_BIT (1 << 18)
33−#define MX35_H1_PM_BIT (1 << 8)
33+#define MX35_H1_PM_BIT (1 << 16)
3434 #define MX35_H1_IPPUE_UP_BIT (1 << 7)
3535 #define MX35_H1_IPPUE_DOWN_BIT (1 << 6)
3636 #define MX35_H1_TLL_BIT (1 << 5)
arch/arm/mach-omap2/clockdomains44xx_data.c+1−1
@@ -359,7 +359,7 @@ static struct clockdomain iss_44xx_clkdm = { · 358 unmodified lines
359359 .clkdm_offs = OMAP4430_CM2_CAM_CAM_CDOFFS,
360360 .wkdep_srcs = iss_wkup_sleep_deps,
361361 .sleepdep_srcs = iss_wkup_sleep_deps,
362− .flags = CLKDM_CAN_HWSUP_SWSUP,
362+ .flags = CLKDM_CAN_SWSUP,
363363 };
364364
365365 static struct clockdomain l3_dss_44xx_clkdm = {
arch/arm/mach-omap2/devices.c+79−0
@@ -19,6 +19,7 @@ · 18 unmodified lines
1919 #include <linux/of.h>
2020 #include <linux/pinctrl/machine.h>
2121 #include <linux/platform_data/omap4-keypad.h>
22+#include <linux/platform_data/omap_ocp2scp.h>
2223
2324 #include <asm/mach-types.h>
2425 #include <asm/mach/map.h>
@@ -613,6 +614,83 @@ static void omap_init_vout(void) · 588 unmodified lines
613614 static inline void omap_init_vout(void) {}
614615 #endif
615616
617+#if defined(CONFIG_OMAP_OCP2SCP) || defined(CONFIG_OMAP_OCP2SCP_MODULE)
618+static int count_ocp2scp_devices(struct omap_ocp2scp_dev *ocp2scp_dev)
619+{
620+ int cnt = 0;
621+
622+ while (ocp2scp_dev->drv_name != NULL) {
623+ cnt++;
624+ ocp2scp_dev++;
625+ }
626+
627+ return cnt;
628+}
629+
630+static void omap_init_ocp2scp(void)
631+{
632+ struct omap_hwmod *oh;
633+ struct platform_device *pdev;
634+ int bus_id = -1, dev_cnt = 0, i;
635+ struct omap_ocp2scp_dev *ocp2scp_dev;
636+ const char *oh_name, *name;
637+ struct omap_ocp2scp_platform_data *pdata;
638+
639+ if (!cpu_is_omap44xx())
640+ return;
641+
642+ oh_name = "ocp2scp_usb_phy";
643+ name = "omap-ocp2scp";
644+
645+ oh = omap_hwmod_lookup(oh_name);
646+ if (!oh) {
647+ pr_err("%s: could not find omap_hwmod for %s\n", __func__,
648+ oh_name);
649+ return;
650+ }
651+
652+ pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
653+ if (!pdata) {
654+ pr_err("%s: No memory for ocp2scp pdata\n", __func__);
655+ return;
656+ }
657+
658+ ocp2scp_dev = oh->dev_attr;
659+ dev_cnt = count_ocp2scp_devices(ocp2scp_dev);
660+
661+ if (!dev_cnt) {
662+ pr_err("%s: No devices connected to ocp2scp\n", __func__);
663+ kfree(pdata);
664+ return;
665+ }
666+
667+ pdata->devices = kzalloc(sizeof(struct omap_ocp2scp_dev *)
668+ * dev_cnt, GFP_KERNEL);
669+ if (!pdata->devices) {
670+ pr_err("%s: No memory for ocp2scp pdata devices\n", __func__);
671+ kfree(pdata);
672+ return;
673+ }
674+
675+ for (i = 0; i < dev_cnt; i++, ocp2scp_dev++)
676+ pdata->devices[i] = ocp2scp_dev;
677+
678+ pdata->dev_cnt = dev_cnt;
679+
680+ pdev = omap_device_build(name, bus_id, oh, pdata, sizeof(*pdata), NULL,
681+ 0, false);
682+ if (IS_ERR(pdev)) {
683+ pr_err("Could not build omap_device for %s %s\n",
684+ name, oh_name);
685+ kfree(pdata->devices);
686+ kfree(pdata);
687+ return;
688+ }
689+}
690+#else
691+static inline void omap_init_ocp2scp(void) { }
692+#endif
693+
616694 /*-------------------------------------------------------------------------*/
617695
618696 static int __init omap2_init_devices(void)
@@ -640,6 +718,7 @@ static int __init omap2_init_devices(void) · 21 unmodified lines
640718 omap_init_sham();
641719 omap_init_aes();
642720 omap_init_vout();
721+ omap_init_ocp2scp();
643722
644723 return 0;
645724 }
arch/arm/mach-omap2/omap_hwmod.c+49−14
@@ -421,6 +421,38 @@ static int _set_softreset(struct omap_hwmod *oh, u32 *v) · 420 unmodified lines
421421 return 0;
422422 }
423423
424+/**
425+ * _wait_softreset_complete - wait for an OCP softreset to complete
426+ * @oh: struct omap_hwmod * to wait on
427+ *
428+ * Wait until the IP block represented by @oh reports that its OCP
429+ * softreset is complete. This can be triggered by software (see
430+ * _ocp_softreset()) or by hardware upon returning from off-mode (one
431+ * example is HSMMC). Waits for up to MAX_MODULE_SOFTRESET_WAIT
432+ * microseconds. Returns the number of microseconds waited.
433+ */
434+static int _wait_softreset_complete(struct omap_hwmod *oh)
435+{
436+ struct omap_hwmod_class_sysconfig *sysc;
437+ u32 softrst_mask;
438+ int c = 0;
439+
440+ sysc = oh->class->sysc;
441+
442+ if (sysc->sysc_flags & SYSS_HAS_RESET_STATUS)
443+ omap_test_timeout((omap_hwmod_read(oh, sysc->syss_offs)
444+ & SYSS_RESETDONE_MASK),
445+ MAX_MODULE_SOFTRESET_WAIT, c);
446+ else if (sysc->sysc_flags & SYSC_HAS_RESET_STATUS) {
447+ softrst_mask = (0x1 << sysc->sysc_fields->srst_shift);
448+ omap_test_timeout(!(omap_hwmod_read(oh, sysc->sysc_offs)
449+ & softrst_mask),
450+ MAX_MODULE_SOFTRESET_WAIT, c);
451+ }
452+
453+ return c;
454+}
455+
424456 /**
425457 * _set_dmadisable: set OCP_SYSCONFIG.DMADISABLE bit in @v
426458 * @oh: struct omap_hwmod *
@@ -1282,6 +1314,18 @@ static void _enable_sysc(struct omap_hwmod *oh) · 855 unmodified lines
12821314 if (!oh->class->sysc)
12831315 return;
12841316
1317+ /*
1318+ * Wait until reset has completed, this is needed as the IP
1319+ * block is reset automatically by hardware in some cases
1320+ * (off-mode for example), and the drivers require the
1321+ * IP to be ready when they access it
1322+ */
1323+ if (oh->flags & HWMOD_CONTROL_OPT_CLKS_IN_RESET)
1324+ _enable_optional_clocks(oh);
1325+ _wait_softreset_complete(oh);
1326+ if (oh->flags & HWMOD_CONTROL_OPT_CLKS_IN_RESET)
1327+ _disable_optional_clocks(oh);
1328+
12851329 v = oh->_sysc_cache;
12861330 sf = oh->class->sysc->sysc_flags;
12871331
@@ -1804,7 +1848,7 @@ static int _am33xx_disable_module(struct omap_hwmod *oh) · 516 unmodified lines
18041848 */
18051849 static int _ocp_softreset(struct omap_hwmod *oh)
18061850 {
1807− u32 v, softrst_mask;
1851+ u32 v;
18081852 int c = 0;
18091853 int ret = 0;
18101854
@@ -1834,19 +1878,7 @@ static int _ocp_softreset(struct omap_hwmod *oh) · 23 unmodified lines
18341878 if (oh->class->sysc->srst_udelay)
18351879 udelay(oh->class->sysc->srst_udelay);
18361880
1837− if (oh->class->sysc->sysc_flags & SYSS_HAS_RESET_STATUS)
1838− omap_test_timeout((omap_hwmod_read(oh,
1839− oh->class->sysc->syss_offs)
1840− & SYSS_RESETDONE_MASK),
1841− MAX_MODULE_SOFTRESET_WAIT, c);
1842− else if (oh->class->sysc->sysc_flags & SYSC_HAS_RESET_STATUS) {
1843− softrst_mask = (0x1 << oh->class->sysc->sysc_fields->srst_shift);
1844− omap_test_timeout(!(omap_hwmod_read(oh,
1845− oh->class->sysc->sysc_offs)
1846− & softrst_mask),
1847− MAX_MODULE_SOFTRESET_WAIT, c);
1848− }
1849−
1881+ c = _wait_softreset_complete(oh);
18501882 if (c == MAX_MODULE_SOFTRESET_WAIT)
18511883 pr_warning("omap_hwmod: %s: softreset failed (waited %d usec)\n",
18521884 oh->name, MAX_MODULE_SOFTRESET_WAIT);
@@ -2352,6 +2384,9 @@ static int __init _setup_reset(struct omap_hwmod *oh) · 499 unmodified lines
23522384 if (oh->_state != _HWMOD_STATE_INITIALIZED)
23532385 return -EINVAL;
23542386
2387+ if (oh->flags & HWMOD_EXT_OPT_MAIN_CLK)
2388+ return -EPERM;
2389+
23552390 if (oh->rst_lines_cnt == 0) {
23562391 r = _enable(oh);
23572392 if (r) {
arch/arm/mach-omap2/omap_hwmod_44xx_data.c+36−0
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 #include <linux/io.h>
2222 #include <linux/platform_data/gpio-omap.h>
2323 #include <linux/power/smartreflex.h>
24+#include <linux/platform_data/omap_ocp2scp.h>
2425
2526 #include <plat/omap_hwmod.h>
2627 #include <plat/i2c.h>
@@ -2125,6 +2126,14 @@ static struct omap_hwmod omap44xx_mcpdm_hwmod = { · 2098 unmodified lines
21252126 .name = "mcpdm",
21262127 .class = &omap44xx_mcpdm_hwmod_class,
21272128 .clkdm_name = "abe_clkdm",
2129+ /*
2130+ * It's suspected that the McPDM requires an off-chip main
2131+ * functional clock, controlled via I2C. This IP block is
2132+ * currently reset very early during boot, before I2C is
2133+ * available, so it doesn't seem that we have any choice in
2134+ * the kernel other than to avoid resetting it.
2135+ */
2136+ .flags = HWMOD_EXT_OPT_MAIN_CLK,
21282137 .mpu_irqs = omap44xx_mcpdm_irqs,
21292138 .sdma_reqs = omap44xx_mcpdm_sdma_reqs,
21302139 .main_clk = "mcpdm_fck",
@@ -2681,6 +2690,32 @@ static struct omap_hwmod_class omap44xx_ocp2scp_hwmod_class = { · 550 unmodified lines
26812690 .sysc = &omap44xx_ocp2scp_sysc,
26822691 };
26832692
2693+/* ocp2scp dev_attr */
2694+static struct resource omap44xx_usb_phy_and_pll_addrs[] = {
2695+ {
2696+ .name = "usb_phy",
2697+ .start = 0x4a0ad080,
2698+ .end = 0x4a0ae000,
2699+ .flags = IORESOURCE_MEM,
2700+ },
2701+ {
2702+ /* XXX: Remove this once control module driver is in place */
2703+ .name = "ctrl_dev",
2704+ .start = 0x4a002300,
2705+ .end = 0x4a002303,
2706+ .flags = IORESOURCE_MEM,
2707+ },
2708+ { }
2709+};
2710+
2711+static struct omap_ocp2scp_dev ocp2scp_dev_attr[] = {
2712+ {
2713+ .drv_name = "omap-usb2",
2714+ .res = omap44xx_usb_phy_and_pll_addrs,
2715+ },
2716+ { }
2717+};
2718+
26842719 /* ocp2scp_usb_phy */
26852720 static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = {
26862721 .name = "ocp2scp_usb_phy",
@@ -2694,6 +2729,7 @@ static struct omap_hwmod omap44xx_ocp2scp_usb_phy_hwmod = { · 7 unmodified lines
26942729 .modulemode = MODULEMODE_HWCTRL,
26952730 },
26962731 },
2732+ .dev_attr = ocp2scp_dev_attr,
26972733 };
26982734
26992735 /*
arch/arm/mach-omap2/twl-common.c+1−1
@@ -366,7 +366,7 @@ static struct regulator_init_data omap4_clk32kg_idata = { · 365 unmodified lines
366366 };
367367
368368 static struct regulator_consumer_supply omap4_vdd1_supply[] = {
369− REGULATOR_SUPPLY("vcc", "mpu.0"),
369+ REGULATOR_SUPPLY("vcc", "cpu0"),
370370 };
371371
372372 static struct regulator_consumer_supply omap4_vdd2_supply[] = {
arch/arm/mach-omap2/vc.c+1−1
@@ -264,7 +264,7 @@ static void __init omap_vc_i2c_init(struct voltagedomain *voltdm) · 263 unmodified lines
264264
265265 if (initialized) {
266266 if (voltdm->pmic->i2c_high_speed != i2c_high_speed)
267− pr_warn("%s: I2C config for vdd_%s does not match other channels (%u).",
267+ pr_warn("%s: I2C config for vdd_%s does not match other channels (%u).\n",
268268 __func__, voltdm->name, i2c_high_speed);
269269 return;
270270 }
arch/arm/mach-pxa/hx4700.c+7−1
@@ -28,6 +28,7 @@ · 27 unmodified lines
2828 #include <linux/mfd/asic3.h>
2929 #include <linux/mtd/physmap.h>
3030 #include <linux/pda_power.h>
31+#include <linux/pwm.h>
3132 #include <linux/pwm_backlight.h>
3233 #include <linux/regulator/driver.h>
3334 #include <linux/regulator/gpio-regulator.h>
@@ -556,7 +557,7 @@ static struct platform_device hx4700_lcd = { · 522 unmodified lines
556557 */
557558
558559 static struct platform_pwm_backlight_data backlight_data = {
559− .pwm_id = 1,
560+ .pwm_id = -1, /* Superseded by pwm_lookup */
560561 .max_brightness = 200,
561562 .dft_brightness = 100,
562563 .pwm_period_ns = 30923,
@@ -571,6 +572,10 @@ static struct platform_device backlight = { · 8 unmodified lines
571572 },
572573 };
573574
575+static struct pwm_lookup hx4700_pwm_lookup[] = {
576+ PWM_LOOKUP("pxa27x-pwm.1", 0, "pwm-backlight", NULL),
577+};
578+
574579 /*
575580 * USB "Transceiver"
576581 */
@@ -872,6 +877,7 @@ static void __init hx4700_init(void) · 295 unmodified lines
872877 pxa_set_stuart_info(NULL);
873878
874879 platform_add_devices(devices, ARRAY_SIZE(devices));
880+ pwm_add_table(hx4700_pwm_lookup, ARRAY_SIZE(hx4700_pwm_lookup));
875881
876882 pxa_set_ficp_info(&ficp_info);
877883 pxa27x_set_i2c_power_info(NULL);
arch/arm/mach-pxa/spitz_pm.c+2−6
@@ -86,10 +86,7 @@ static void spitz_discharge1(int on) · 85 unmodified lines
8686 gpio_set_value(SPITZ_GPIO_LED_GREEN, on);
8787 }
8888
89−static unsigned long gpio18_config[] = {
90− GPIO18_RDY,
91− GPIO18_GPIO,
92−};
89+static unsigned long gpio18_config = GPIO18_GPIO;
9390
9491 static void spitz_presuspend(void)
9592 {
@@ -112,7 +109,7 @@ static void spitz_presuspend(void) · 16 unmodified lines
112109 PGSR3 &= ~SPITZ_GPIO_G3_STROBE_BIT;
113110 PGSR2 |= GPIO_bit(SPITZ_GPIO_KEY_STROBE0);
114111
115− pxa2xx_mfp_config(&gpio18_config[0], 1);
112+ pxa2xx_mfp_config(&gpio18_config, 1);
116113 gpio_request_one(18, GPIOF_OUT_INIT_HIGH, "Unknown");
117114 gpio_free(18);
118115
@@ -131,7 +128,6 @@ static void spitz_presuspend(void) · 12 unmodified lines
131128
132129 static void spitz_postsuspend(void)
133130 {
134− pxa2xx_mfp_config(&gpio18_config[1], 1);
135131 }
136132
137133 static int spitz_should_wakeup(unsigned int resume_on_alarm)
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/plat-omap/include/plat/omap_hwmod.h+6−0
@@ -443,6 +443,11 @@ struct omap_hwmod_omap4_prcm { · 442 unmodified lines
443443 * in order to complete the reset. Optional clocks will be disabled
444444 * again after the reset.
445445 * HWMOD_16BIT_REG: Module has 16bit registers
446+ * HWMOD_EXT_OPT_MAIN_CLK: The only main functional clock source for
447+ * this IP block comes from an off-chip source and is not always
448+ * enabled. This prevents the hwmod code from being able to
449+ * enable and reset the IP block early. XXX Eventually it should
450+ * be possible to query the clock framework for this information.
446451 */
447452 #define HWMOD_SWSUP_SIDLE (1 << 0)
448453 #define HWMOD_SWSUP_MSTANDBY (1 << 1)
@@ -453,6 +458,7 @@ struct omap_hwmod_omap4_prcm { · 4 unmodified lines
453458 #define HWMOD_NO_IDLEST (1 << 6)
454459 #define HWMOD_CONTROL_OPT_CLKS_IN_RESET (1 << 7)
455460 #define HWMOD_16BIT_REG (1 << 8)
461+#define HWMOD_EXT_OPT_MAIN_CLK (1 << 9)
456462
457463 /*
458464 * omap_hwmod._int_flags definitions
arch/arm/tools/Makefile+1−1
@@ -5,6 +5,6 @@ · 4 unmodified lines
55 #
66
77 include/generated/mach-types.h: $(src)/gen-mach-types $(src)/mach-types
8− $(kecho) ' Generating $@'
8+ @$(kecho) ' Generating $@'
99 @mkdir -p $(dir $@)
1010 $(Q)$(AWK) -f $^ > $@ || { rm -f $@; /bin/false; }
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/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+5−5
@@ -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 {
@@ -222,12 +222,12 @@ extern void __iomem *__ioremap(phys_addr_t phys_addr, size_t size, pgprot_t prot · 101 unmodified lines
222222 extern void __iounmap(volatile void __iomem *addr);
223223
224224 #define PROT_DEFAULT (PTE_TYPE_PAGE | PTE_AF | PTE_DIRTY)
225−#define PROT_DEVICE_nGnRE (PROT_DEFAULT | PTE_XN | PTE_ATTRINDX(MT_DEVICE_nGnRE))
225+#define PROT_DEVICE_nGnRE (PROT_DEFAULT | PTE_PXN | PTE_UXN | 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/pgtable-hwdef.h+4−2
@@ -38,7 +38,8 @@ · 37 unmodified lines
3838 #define PMD_SECT_S (_AT(pmdval_t, 3) << 8)
3939 #define PMD_SECT_AF (_AT(pmdval_t, 1) << 10)
4040 #define PMD_SECT_NG (_AT(pmdval_t, 1) << 11)
41−#define PMD_SECT_XN (_AT(pmdval_t, 1) << 54)
41+#define PMD_SECT_PXN (_AT(pmdval_t, 1) << 53)
42+#define PMD_SECT_UXN (_AT(pmdval_t, 1) << 54)
4243
4344 /*
4445 * AttrIndx[2:0] encoding (mapping attributes defined in the MAIR* registers).
@@ -57,7 +58,8 @@ · 12 unmodified lines
5758 #define PTE_SHARED (_AT(pteval_t, 3) << 8) /* SH[1:0], inner shareable */
5859 #define PTE_AF (_AT(pteval_t, 1) << 10) /* Access Flag */
5960 #define PTE_NG (_AT(pteval_t, 1) << 11) /* nG */
60−#define PTE_XN (_AT(pteval_t, 1) << 54) /* XN */
61+#define PTE_PXN (_AT(pteval_t, 1) << 53) /* Privileged XN */
62+#define PTE_UXN (_AT(pteval_t, 1) << 54) /* User XN */
6163
6264 /*
6365 * AttrIndx[2:0] encoding (mapping attributes defined in the MAIR* registers).
arch/arm64/include/asm/pgtable.h+20−20
@@ -62,23 +62,23 @@ extern pgprot_t pgprot_default; · 61 unmodified lines
6262
6363 #define _MOD_PROT(p, b) __pgprot(pgprot_val(p) | (b))
6464
65−#define PAGE_NONE _MOD_PROT(pgprot_default, PTE_NG | PTE_XN | PTE_RDONLY)
66−#define PAGE_SHARED _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_XN)
67−#define PAGE_SHARED_EXEC _MOD_PROT(pgprot_default, PTE_USER | PTE_NG)
68−#define PAGE_COPY _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_XN | PTE_RDONLY)
69−#define PAGE_COPY_EXEC _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_RDONLY)
70−#define PAGE_READONLY _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_XN | PTE_RDONLY)
71−#define PAGE_READONLY_EXEC _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_RDONLY)
72−#define PAGE_KERNEL _MOD_PROT(pgprot_default, PTE_XN | PTE_DIRTY)
73−#define PAGE_KERNEL_EXEC _MOD_PROT(pgprot_default, PTE_DIRTY)
74−
75−#define __PAGE_NONE __pgprot(_PAGE_DEFAULT | PTE_NG | PTE_XN | PTE_RDONLY)
76−#define __PAGE_SHARED __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_XN)
77−#define __PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG)
78−#define __PAGE_COPY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_XN | PTE_RDONLY)
79−#define __PAGE_COPY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_RDONLY)
80−#define __PAGE_READONLY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_XN | PTE_RDONLY)
81−#define __PAGE_READONLY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_RDONLY)
65+#define PAGE_NONE _MOD_PROT(pgprot_default, PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY)
66+#define PAGE_SHARED _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_UXN)
67+#define PAGE_SHARED_EXEC _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN)
68+#define PAGE_COPY _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY)
69+#define PAGE_COPY_EXEC _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_RDONLY)
70+#define PAGE_READONLY _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY)
71+#define PAGE_READONLY_EXEC _MOD_PROT(pgprot_default, PTE_USER | PTE_NG | PTE_PXN | PTE_RDONLY)
72+#define PAGE_KERNEL _MOD_PROT(pgprot_default, PTE_PXN | PTE_UXN | PTE_DIRTY)
73+#define PAGE_KERNEL_EXEC _MOD_PROT(pgprot_default, PTE_UXN | PTE_DIRTY)
74+
75+#define __PAGE_NONE __pgprot(_PAGE_DEFAULT | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY)
76+#define __PAGE_SHARED __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN)
77+#define __PAGE_SHARED_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN)
78+#define __PAGE_COPY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY)
79+#define __PAGE_COPY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_RDONLY)
80+#define __PAGE_READONLY __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_UXN | PTE_RDONLY)
81+#define __PAGE_READONLY_EXEC __pgprot(_PAGE_DEFAULT | PTE_USER | PTE_NG | PTE_PXN | PTE_RDONLY)
8282
8383 #endif /* __ASSEMBLY__ */
8484
@@ -130,10 +130,10 @@ extern struct page *empty_zero_page; · 45 unmodified lines
130130 #define pte_young(pte) (pte_val(pte) & PTE_AF)
131131 #define pte_special(pte) (pte_val(pte) & PTE_SPECIAL)
132132 #define pte_write(pte) (!(pte_val(pte) & PTE_RDONLY))
133−#define pte_exec(pte) (!(pte_val(pte) & PTE_XN))
133+#define pte_exec(pte) (!(pte_val(pte) & PTE_UXN))
134134
135135 #define pte_present_exec_user(pte) \
136− ((pte_val(pte) & (PTE_VALID | PTE_USER | PTE_XN)) == \
136+ ((pte_val(pte) & (PTE_VALID | PTE_USER | PTE_UXN)) == \
137137 (PTE_VALID | PTE_USER))
138138
139139 #define PTE_BIT_FUNC(fn,op) \
@@ -262,7 +262,7 @@ static inline pmd_t *pmd_offset(pud_t *pud, unsigned long addr) · 122 unmodified lines
262262
263263 static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
264264 {
265− const pteval_t mask = PTE_USER | PTE_XN | PTE_RDONLY;
265+ const pteval_t mask = PTE_USER | PTE_PXN | PTE_UXN | PTE_RDONLY;
266266 pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask);
267267 return pte;
268268 }
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/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/ia64/mm/init.c+0−1
@@ -637,7 +637,6 @@ mem_init (void) · 636 unmodified lines
637637
638638 high_memory = __va(max_low_pfn * PAGE_SIZE);
639639
640− reset_zone_present_pages();
641640 for_each_online_pgdat(pgdat)
642641 if (pgdat->bdata->node_bootmem_map)
643642 totalram_pages += free_all_bootmem_node(pgdat);
arch/mips/cavium-octeon/executive/cvmx-l2c.c+1−0
@@ -30,6 +30,7 @@ · 29 unmodified lines
3030 * measurement, and debugging facilities.
3131 */
3232
33+#include <linux/irqflags.h>
3334 #include <asm/octeon/cvmx.h>
3435 #include <asm/octeon/cvmx-l2c.h>
3536 #include <asm/octeon/cvmx-spinlock.h>
arch/mips/fw/arc/misc.c+1−0
@@ -11,6 +11,7 @@ · 10 unmodified lines
1111 */
1212 #include <linux/init.h>
1313 #include <linux/kernel.h>
14+#include <linux/irqflags.h>
1415
1516 #include <asm/bcache.h>
1617
arch/mips/include/asm/bitops.h+39−89
@@ -14,7 +14,6 @@ · 13 unmodified lines
1414 #endif
1515
1616 #include <linux/compiler.h>
17−#include <linux/irqflags.h>
1817 #include <linux/types.h>
1918 #include <asm/barrier.h>
2019 #include <asm/byteorder.h> /* sigh ... */
@@ -44,6 +43,24 @@ · 23 unmodified lines
4443 #define smp_mb__before_clear_bit() smp_mb__before_llsc()
4544 #define smp_mb__after_clear_bit() smp_llsc_mb()
4645
46+
47+/*
48+ * These are the "slower" versions of the functions and are in bitops.c.
49+ * These functions call raw_local_irq_{save,restore}().
50+ */
51+void __mips_set_bit(unsigned long nr, volatile unsigned long *addr);
52+void __mips_clear_bit(unsigned long nr, volatile unsigned long *addr);
53+void __mips_change_bit(unsigned long nr, volatile unsigned long *addr);
54+int __mips_test_and_set_bit(unsigned long nr,
55+ volatile unsigned long *addr);
56+int __mips_test_and_set_bit_lock(unsigned long nr,
57+ volatile unsigned long *addr);
58+int __mips_test_and_clear_bit(unsigned long nr,
59+ volatile unsigned long *addr);
60+int __mips_test_and_change_bit(unsigned long nr,
61+ volatile unsigned long *addr);
62+
63+
4764 /*
4865 * set_bit - Atomically set a bit in memory
4966 * @nr: the bit to set
@@ -57,7 +74,7 @@ · 7 unmodified lines
5774 static inline void set_bit(unsigned long nr, volatile unsigned long *addr)
5875 {
5976 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
60− unsigned short bit = nr & SZLONG_MASK;
77+ int bit = nr & SZLONG_MASK;
6178 unsigned long temp;
6279
6380 if (kernel_uses_llsc && R10000_LLSC_WAR) {
@@ -92,17 +109,8 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr) · 28 unmodified lines
92109 : "=&r" (temp), "+m" (*m)
93110 : "ir" (1UL << bit));
94111 } while (unlikely(!temp));
95− } else {
96− volatile unsigned long *a = addr;
97− unsigned long mask;
98− unsigned long flags;
99−
100− a += nr >> SZLONG_LOG;
101− mask = 1UL << bit;
102− raw_local_irq_save(flags);
103− *a |= mask;
104− raw_local_irq_restore(flags);
105− }
112+ } else
113+ __mips_set_bit(nr, addr);
106114 }
107115
108116 /*
@@ -118,7 +126,7 @@ static inline void set_bit(unsigned long nr, volatile unsigned long *addr) · 9 unmodified lines
118126 static inline void clear_bit(unsigned long nr, volatile unsigned long *addr)
119127 {
120128 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
121− unsigned short bit = nr & SZLONG_MASK;
129+ int bit = nr & SZLONG_MASK;
122130 unsigned long temp;
123131
124132 if (kernel_uses_llsc && R10000_LLSC_WAR) {
@@ -153,17 +161,8 @@ static inline void clear_bit(unsigned long nr, volatile unsigned long *addr) · 28 unmodified lines
153161 : "=&r" (temp), "+m" (*m)
154162 : "ir" (~(1UL << bit)));
155163 } while (unlikely(!temp));
156− } else {
157− volatile unsigned long *a = addr;
158− unsigned long mask;
159− unsigned long flags;
160−
161− a += nr >> SZLONG_LOG;
162− mask = 1UL << bit;
163− raw_local_irq_save(flags);
164− *a &= ~mask;
165− raw_local_irq_restore(flags);
166− }
164+ } else
165+ __mips_clear_bit(nr, addr);
167166 }
168167
169168 /*
@@ -191,7 +190,7 @@ static inline void clear_bit_unlock(unsigned long nr, volatile unsigned long *ad · 21 unmodified lines
191190 */
192191 static inline void change_bit(unsigned long nr, volatile unsigned long *addr)
193192 {
194− unsigned short bit = nr & SZLONG_MASK;
193+ int bit = nr & SZLONG_MASK;
195194
196195 if (kernel_uses_llsc && R10000_LLSC_WAR) {
197196 unsigned long *m = ((unsigned long *) addr) + (nr >> SZLONG_LOG);
@@ -220,17 +219,8 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr) · 22 unmodified lines
220219 : "=&r" (temp), "+m" (*m)
221220 : "ir" (1UL << bit));
222221 } while (unlikely(!temp));
223− } else {
224− volatile unsigned long *a = addr;
225− unsigned long mask;
226− unsigned long flags;
227−
228− a += nr >> SZLONG_LOG;
229− mask = 1UL << bit;
230− raw_local_irq_save(flags);
231− *a ^= mask;
232− raw_local_irq_restore(flags);
233− }
222+ } else
223+ __mips_change_bit(nr, addr);
234224 }
235225
236226 /*
@@ -244,7 +234,7 @@ static inline void change_bit(unsigned long nr, volatile unsigned long *addr) · 7 unmodified lines
244234 static inline int test_and_set_bit(unsigned long nr,
245235 volatile unsigned long *addr)
246236 {
247− unsigned short bit = nr & SZLONG_MASK;
237+ int bit = nr & SZLONG_MASK;
248238 unsigned long res;
249239
250240 smp_mb__before_llsc();
@@ -281,18 +271,8 @@ static inline int test_and_set_bit(unsigned long nr, · 30 unmodified lines
281271 } while (unlikely(!res));
282272
283273 res = temp & (1UL << bit);
284− } else {
285− volatile unsigned long *a = addr;
286− unsigned long mask;
287− unsigned long flags;
288−
289− a += nr >> SZLONG_LOG;
290− mask = 1UL << bit;
291− raw_local_irq_save(flags);
292− res = (mask & *a);
293− *a |= mask;
294− raw_local_irq_restore(flags);
295− }
274+ } else
275+ res = __mips_test_and_set_bit(nr, addr);
296276
297277 smp_llsc_mb();
298278
@@ -310,7 +290,7 @@ static inline int test_and_set_bit(unsigned long nr, · 11 unmodified lines
310290 static inline int test_and_set_bit_lock(unsigned long nr,
311291 volatile unsigned long *addr)
312292 {
313− unsigned short bit = nr & SZLONG_MASK;
293+ int bit = nr & SZLONG_MASK;
314294 unsigned long res;
315295
316296 if (kernel_uses_llsc && R10000_LLSC_WAR) {
@@ -345,18 +325,8 @@ static inline int test_and_set_bit_lock(unsigned long nr, · 28 unmodified lines
345325 } while (unlikely(!res));
346326
347327 res = temp & (1UL << bit);
348− } else {
349− volatile unsigned long *a = addr;
350− unsigned long mask;
351− unsigned long flags;
352−
353− a += nr >> SZLONG_LOG;
354− mask = 1UL << bit;
355− raw_local_irq_save(flags);
356− res = (mask & *a);
357− *a |= mask;
358− raw_local_irq_restore(flags);
359− }
328+ } else
329+ res = __mips_test_and_set_bit_lock(nr, addr);
360330
361331 smp_llsc_mb();
362332
@@ -373,7 +343,7 @@ static inline int test_and_set_bit_lock(unsigned long nr, · 10 unmodified lines
373343 static inline int test_and_clear_bit(unsigned long nr,
374344 volatile unsigned long *addr)
375345 {
376− unsigned short bit = nr & SZLONG_MASK;
346+ int bit = nr & SZLONG_MASK;
377347 unsigned long res;
378348
379349 smp_mb__before_llsc();
@@ -428,18 +398,8 @@ static inline int test_and_clear_bit(unsigned long nr, · 48 unmodified lines
428398 } while (unlikely(!res));
429399
430400 res = temp & (1UL << bit);
431− } else {
432− volatile unsigned long *a = addr;
433− unsigned long mask;
434− unsigned long flags;
435−
436− a += nr >> SZLONG_LOG;
437− mask = 1UL << bit;
438− raw_local_irq_save(flags);
439− res = (mask & *a);
440− *a &= ~mask;
441− raw_local_irq_restore(flags);
442− }
401+ } else
402+ res = __mips_test_and_clear_bit(nr, addr);
443403
444404 smp_llsc_mb();
445405
@@ -457,7 +417,7 @@ static inline int test_and_clear_bit(unsigned long nr, · 11 unmodified lines
457417 static inline int test_and_change_bit(unsigned long nr,
458418 volatile unsigned long *addr)
459419 {
460− unsigned short bit = nr & SZLONG_MASK;
420+ int bit = nr & SZLONG_MASK;
461421 unsigned long res;
462422
463423 smp_mb__before_llsc();
@@ -494,18 +454,8 @@ static inline int test_and_change_bit(unsigned long nr, · 30 unmodified lines
494454 } while (unlikely(!res));
495455
496456 res = temp & (1UL << bit);
497− } else {
498− volatile unsigned long *a = addr;
499− unsigned long mask;
500− unsigned long flags;
501−
502− a += nr >> SZLONG_LOG;
503− mask = 1UL << bit;
504− raw_local_irq_save(flags);
505− res = (mask & *a);
506− *a ^= mask;
507− raw_local_irq_restore(flags);
508− }
457+ } else
458+ res = __mips_test_and_change_bit(nr, addr);
509459
510460 smp_llsc_mb();
511461
arch/mips/include/asm/compat.h+1−1
@@ -290,7 +290,7 @@ struct compat_shmid64_ds { · 289 unmodified lines
290290
291291 static inline int is_compat_task(void)
292292 {
293− return test_thread_flag(TIF_32BIT);
293+ return test_thread_flag(TIF_32BIT_ADDR);
294294 }
295295
296296 #endif /* _ASM_COMPAT_H */
arch/mips/include/asm/io.h+1−0
@@ -15,6 +15,7 @@ · 14 unmodified lines
1515 #include <linux/compiler.h>
1616 #include <linux/kernel.h>
1717 #include <linux/types.h>
18+#include <linux/irqflags.h>
1819
1920 #include <asm/addrspace.h>
2021 #include <asm/bug.h>
arch/mips/include/asm/irqflags.h+75−132
@@ -16,83 +16,13 @@ · 15 unmodified lines
1616 #include <linux/compiler.h>
1717 #include <asm/hazards.h>
1818
19−__asm__(
20− " .macro arch_local_irq_enable \n"
21− " .set push \n"
22− " .set reorder \n"
23− " .set noat \n"
24−#ifdef CONFIG_MIPS_MT_SMTC
25− " mfc0 $1, $2, 1 # SMTC - clear TCStatus.IXMT \n"
26− " ori $1, 0x400 \n"
27− " xori $1, 0x400 \n"
28− " mtc0 $1, $2, 1 \n"
29−#elif defined(CONFIG_CPU_MIPSR2)
30− " ei \n"
31−#else
32− " mfc0 $1,$12 \n"
33− " ori $1,0x1f \n"
34− " xori $1,0x1e \n"
35− " mtc0 $1,$12 \n"
36−#endif
37− " irq_enable_hazard \n"
38− " .set pop \n"
39− " .endm");
19+#if defined(CONFIG_CPU_MIPSR2) && !defined(CONFIG_MIPS_MT_SMTC)
4020
41−extern void smtc_ipi_replay(void);
42−
43−static inline void arch_local_irq_enable(void)
44−{
45−#ifdef CONFIG_MIPS_MT_SMTC
46− /*
47− * SMTC kernel needs to do a software replay of queued
48− * IPIs, at the cost of call overhead on each local_irq_enable()
49− */
50− smtc_ipi_replay();
51−#endif
52− __asm__ __volatile__(
53− "arch_local_irq_enable"
54− : /* no outputs */
55− : /* no inputs */
56− : "memory");
57−}
58−
59−
60−/*
61− * For cli() we have to insert nops to make sure that the new value
62− * has actually arrived in the status register before the end of this
63− * macro.
64− * R4000/R4400 need three nops, the R4600 two nops and the R10000 needs
65− * no nops at all.
66− */
67−/*
68− * For TX49, operating only IE bit is not enough.
69− *
70− * If mfc0 $12 follows store and the mfc0 is last instruction of a
71− * page and fetching the next instruction causes TLB miss, the result
72− * of the mfc0 might wrongly contain EXL bit.
73− *
74− * ERT-TX49H2-027, ERT-TX49H3-012, ERT-TX49HL3-006, ERT-TX49H4-008
75− *
76− * Workaround: mask EXL bit of the result or place a nop before mfc0.
77− */
7821 __asm__(
7922 " .macro arch_local_irq_disable\n"
8023 " .set push \n"
8124 " .set noat \n"
82−#ifdef CONFIG_MIPS_MT_SMTC
83− " mfc0 $1, $2, 1 \n"
84− " ori $1, 0x400 \n"
85− " .set noreorder \n"
86− " mtc0 $1, $2, 1 \n"
87−#elif defined(CONFIG_CPU_MIPSR2)
8825 " di \n"
89−#else
90− " mfc0 $1,$12 \n"
91− " ori $1,0x1f \n"
92− " xori $1,0x1f \n"
93− " .set noreorder \n"
94− " mtc0 $1,$12 \n"
95−#endif
9626 " irq_disable_hazard \n"
9727 " .set pop \n"
9828 " .endm \n");
@@ -106,46 +36,14 @@ static inline void arch_local_irq_disable(void) · 7 unmodified lines
10636 : "memory");
10737 }
10838
109−__asm__(
110− " .macro arch_local_save_flags flags \n"
111− " .set push \n"
112− " .set reorder \n"
113−#ifdef CONFIG_MIPS_MT_SMTC
114− " mfc0 \\flags, $2, 1 \n"
115−#else
116− " mfc0 \\flags, $12 \n"
117−#endif
118− " .set pop \n"
119− " .endm \n");
120−
121−static inline unsigned long arch_local_save_flags(void)
122−{
123− unsigned long flags;
124− asm volatile("arch_local_save_flags %0" : "=r" (flags));
125− return flags;
126−}
12739
12840 __asm__(
12941 " .macro arch_local_irq_save result \n"
13042 " .set push \n"
13143 " .set reorder \n"
13244 " .set noat \n"
133−#ifdef CONFIG_MIPS_MT_SMTC
134− " mfc0 \\result, $2, 1 \n"
135− " ori $1, \\result, 0x400 \n"
136− " .set noreorder \n"
137− " mtc0 $1, $2, 1 \n"
138− " andi \\result, \\result, 0x400 \n"
139−#elif defined(CONFIG_CPU_MIPSR2)
14045 " di \\result \n"
14146 " andi \\result, 1 \n"
142−#else
143− " mfc0 \\result, $12 \n"
144− " ori $1, \\result, 0x1f \n"
145− " xori $1, 0x1f \n"
146− " .set noreorder \n"
147− " mtc0 $1, $12 \n"
148−#endif
14947 " irq_disable_hazard \n"
15048 " .set pop \n"
15149 " .endm \n");
@@ -160,61 +58,37 @@ static inline unsigned long arch_local_irq_save(void) · 8 unmodified lines
16058 return flags;
16159 }
16260
61+
16362 __asm__(
16463 " .macro arch_local_irq_restore flags \n"
16564 " .set push \n"
16665 " .set noreorder \n"
16766 " .set noat \n"
168−#ifdef CONFIG_MIPS_MT_SMTC
169− "mfc0 $1, $2, 1 \n"
170− "andi \\flags, 0x400 \n"
171− "ori $1, 0x400 \n"
172− "xori $1, 0x400 \n"
173− "or \\flags, $1 \n"
174− "mtc0 \\flags, $2, 1 \n"
175−#elif defined(CONFIG_CPU_MIPSR2) && defined(CONFIG_IRQ_CPU)
67+#if defined(CONFIG_IRQ_CPU)
17668 /*
17769 * Slow, but doesn't suffer from a relatively unlikely race
17870 * condition we're having since days 1.
17971 */
18072 " beqz \\flags, 1f \n"
181− " di \n"
73+ " di \n"
18274 " ei \n"
18375 "1: \n"
184−#elif defined(CONFIG_CPU_MIPSR2)
76+#else
18577 /*
18678 * Fast, dangerous. Life is fun, life is good.
18779 */
18880 " mfc0 $1, $12 \n"
18981 " ins $1, \\flags, 0, 1 \n"
19082 " mtc0 $1, $12 \n"
191−#else
192− " mfc0 $1, $12 \n"
193− " andi \\flags, 1 \n"
194− " ori $1, 0x1f \n"
195− " xori $1, 0x1f \n"
196− " or \\flags, $1 \n"
197− " mtc0 \\flags, $12 \n"
19883 #endif
19984 " irq_disable_hazard \n"
20085 " .set pop \n"
20186 " .endm \n");
20287
203−
20488 static inline void arch_local_irq_restore(unsigned long flags)
20589 {
20690 unsigned long __tmp1;
20791
208−#ifdef CONFIG_MIPS_MT_SMTC
209− /*
210− * SMTC kernel needs to do a software replay of queued
211− * IPIs, at the cost of branch and call overhead on each
212− * local_irq_restore()
213− */
214− if (unlikely(!(flags & 0x0400)))
215− smtc_ipi_replay();
216−#endif
217−
21892 __asm__ __volatile__(
21993 "arch_local_irq_restore\t%0"
22094 : "=r" (__tmp1)
@@ -232,6 +106,75 @@ static inline void __arch_local_irq_restore(unsigned long flags) · 11 unmodified lines
232106 : "0" (flags)
233107 : "memory");
234108 }
109+#else
110+/* Functions that require preempt_{dis,en}able() are in mips-atomic.c */
111+void arch_local_irq_disable(void);
112+unsigned long arch_local_irq_save(void);
113+void arch_local_irq_restore(unsigned long flags);
114+void __arch_local_irq_restore(unsigned long flags);
115+#endif /* if defined(CONFIG_CPU_MIPSR2) && !defined(CONFIG_MIPS_MT_SMTC) */
116+
117+
118+__asm__(
119+ " .macro arch_local_irq_enable \n"
120+ " .set push \n"
121+ " .set reorder \n"
122+ " .set noat \n"
123+#ifdef CONFIG_MIPS_MT_SMTC
124+ " mfc0 $1, $2, 1 # SMTC - clear TCStatus.IXMT \n"
125+ " ori $1, 0x400 \n"
126+ " xori $1, 0x400 \n"
127+ " mtc0 $1, $2, 1 \n"
128+#elif defined(CONFIG_CPU_MIPSR2)
129+ " ei \n"
130+#else
131+ " mfc0 $1,$12 \n"
132+ " ori $1,0x1f \n"
133+ " xori $1,0x1e \n"
134+ " mtc0 $1,$12 \n"
135+#endif
136+ " irq_enable_hazard \n"
137+ " .set pop \n"
138+ " .endm");
139+
140+extern void smtc_ipi_replay(void);
141+
142+static inline void arch_local_irq_enable(void)
143+{
144+#ifdef CONFIG_MIPS_MT_SMTC
145+ /*
146+ * SMTC kernel needs to do a software replay of queued
147+ * IPIs, at the cost of call overhead on each local_irq_enable()
148+ */
149+ smtc_ipi_replay();
150+#endif
151+ __asm__ __volatile__(
152+ "arch_local_irq_enable"
153+ : /* no outputs */
154+ : /* no inputs */
155+ : "memory");
156+}
157+
158+
159+__asm__(
160+ " .macro arch_local_save_flags flags \n"
161+ " .set push \n"
162+ " .set reorder \n"
163+#ifdef CONFIG_MIPS_MT_SMTC
164+ " mfc0 \\flags, $2, 1 \n"
165+#else
166+ " mfc0 \\flags, $12 \n"
167+#endif
168+ " .set pop \n"
169+ " .endm \n");
170+
171+static inline unsigned long arch_local_save_flags(void)
172+{
173+ unsigned long flags;
174+ asm volatile("arch_local_save_flags %0" : "=r" (flags));
175+ return flags;
176+}
177+
235178
236179 static inline int arch_irqs_disabled_flags(unsigned long flags)
237180 {
@@ -245,7 +188,7 @@ static inline int arch_irqs_disabled_flags(unsigned long flags) · 7 unmodified lines
245188 #endif
246189 }
247190
248−#endif
191+#endif /* #ifndef __ASSEMBLY__ */
249192
250193 /*
251194 * Do the CPU's IRQ-state tracing from assembly code.
arch/mips/include/asm/thread_info.h+0−6
@@ -112,12 +112,6 @@ register struct thread_info *__current_thread_info __asm__("$28"); · 111 unmodified lines
112112 #define TIF_LOAD_WATCH 25 /* If set, load watch registers */
113113 #define TIF_SYSCALL_TRACE 31 /* syscall trace active */
114114
115−#ifdef CONFIG_MIPS32_O32
116−#define TIF_32BIT TIF_32BIT_REGS
117−#elif defined(CONFIG_MIPS32_N32)
118−#define TIF_32BIT _TIF_32BIT_ADDR
119−#endif /* CONFIG_MIPS32_O32 */
120−
121115 #define _TIF_SYSCALL_TRACE (1<<TIF_SYSCALL_TRACE)
122116 #define _TIF_SIGPENDING (1<<TIF_SIGPENDING)
123117 #define _TIF_NEED_RESCHED (1<<TIF_NEED_RESCHED)
arch/mips/lib/Makefile+3−2
@@ -2,8 +2,9 @@ · 1 unmodified line
22 # Makefile for MIPS-specific library files..
33 #
44
5−lib-y += csum_partial.o delay.o memcpy.o memset.o \
6− strlen_user.o strncpy_user.o strnlen_user.o uncached.o
5+lib-y += bitops.o csum_partial.o delay.o memcpy.o memset.o \
6+ mips-atomic.o strlen_user.o strncpy_user.o \
7+ strnlen_user.o uncached.o
78
89 obj-y += iomap.o
910 obj-$(CONFIG_PCI) += iomap-pci.o
arch/mips/lib/bitops.c+179−0
@@ -0,0 +1,179 @@
1+/*
2+ * This file is subject to the terms and conditions of the GNU General Public
3+ * License. See the file "COPYING" in the main directory of this archive
4+ * for more details.
5+ *
6+ * Copyright (c) 1994-1997, 99, 2000, 06, 07 Ralf Baechle (ralf@linux-mips.org)
7+ * Copyright (c) 1999, 2000 Silicon Graphics, Inc.
8+ */
9+#include <linux/bitops.h>
10+#include <linux/irqflags.h>
11+#include <linux/export.h>
12+
13+
14+/**
15+ * __mips_set_bit - Atomically set a bit in memory. This is called by
16+ * set_bit() if it cannot find a faster solution.
17+ * @nr: the bit to set
18+ * @addr: the address to start counting from
19+ */
20+void __mips_set_bit(unsigned long nr, volatile unsigned long *addr)
21+{
22+ volatile unsigned long *a = addr;
23+ unsigned bit = nr & SZLONG_MASK;
24+ unsigned long mask;
25+ unsigned long flags;
26+
27+ a += nr >> SZLONG_LOG;
28+ mask = 1UL << bit;
29+ raw_local_irq_save(flags);
30+ *a |= mask;
31+ raw_local_irq_restore(flags);
32+}
33+EXPORT_SYMBOL(__mips_set_bit);
34+
35+
36+/**
37+ * __mips_clear_bit - Clears a bit in memory. This is called by clear_bit() if
38+ * it cannot find a faster solution.
39+ * @nr: Bit to clear
40+ * @addr: Address to start counting from
41+ */
42+void __mips_clear_bit(unsigned long nr, volatile unsigned long *addr)
43+{
44+ volatile unsigned long *a = addr;
45+ unsigned bit = nr & SZLONG_MASK;
46+ unsigned long mask;
47+ unsigned long flags;
48+
49+ a += nr >> SZLONG_LOG;
50+ mask = 1UL << bit;
51+ raw_local_irq_save(flags);
52+ *a &= ~mask;
53+ raw_local_irq_restore(flags);
54+}
55+EXPORT_SYMBOL(__mips_clear_bit);
56+
57+
58+/**
59+ * __mips_change_bit - Toggle a bit in memory. This is called by change_bit()
60+ * if it cannot find a faster solution.
61+ * @nr: Bit to change
62+ * @addr: Address to start counting from
63+ */
64+void __mips_change_bit(unsigned long nr, volatile unsigned long *addr)
65+{
66+ volatile unsigned long *a = addr;
67+ unsigned bit = nr & SZLONG_MASK;
68+ unsigned long mask;
69+ unsigned long flags;
70+
71+ a += nr >> SZLONG_LOG;
72+ mask = 1UL << bit;
73+ raw_local_irq_save(flags);
74+ *a ^= mask;
75+ raw_local_irq_restore(flags);
76+}
77+EXPORT_SYMBOL(__mips_change_bit);
78+
79+
80+/**
81+ * __mips_test_and_set_bit - Set a bit and return its old value. This is
82+ * called by test_and_set_bit() if it cannot find a faster solution.
83+ * @nr: Bit to set
84+ * @addr: Address to count from
85+ */
86+int __mips_test_and_set_bit(unsigned long nr,
87+ volatile unsigned long *addr)
88+{
89+ volatile unsigned long *a = addr;
90+ unsigned bit = nr & SZLONG_MASK;
91+ unsigned long mask;
92+ unsigned long flags;
93+ unsigned long res;
94+
95+ a += nr >> SZLONG_LOG;
96+ mask = 1UL << bit;
97+ raw_local_irq_save(flags);
98+ res = (mask & *a);
99+ *a |= mask;
100+ raw_local_irq_restore(flags);
101+ return res;
102+}
103+EXPORT_SYMBOL(__mips_test_and_set_bit);
104+
105+
106+/**
107+ * __mips_test_and_set_bit_lock - Set a bit and return its old value. This is
108+ * called by test_and_set_bit_lock() if it cannot find a faster solution.
109+ * @nr: Bit to set
110+ * @addr: Address to count from
111+ */
112+int __mips_test_and_set_bit_lock(unsigned long nr,
113+ volatile unsigned long *addr)
114+{
115+ volatile unsigned long *a = addr;
116+ unsigned bit = nr & SZLONG_MASK;
117+ unsigned long mask;
118+ unsigned long flags;
119+ unsigned long res;
120+
121+ a += nr >> SZLONG_LOG;
122+ mask = 1UL << bit;
123+ raw_local_irq_save(flags);
124+ res = (mask & *a);
125+ *a |= mask;
126+ raw_local_irq_restore(flags);
127+ return res;
128+}
129+EXPORT_SYMBOL(__mips_test_and_set_bit_lock);
130+
131+
132+/**
133+ * __mips_test_and_clear_bit - Clear a bit and return its old value. This is
134+ * called by test_and_clear_bit() if it cannot find a faster solution.
135+ * @nr: Bit to clear
136+ * @addr: Address to count from
137+ */
138+int __mips_test_and_clear_bit(unsigned long nr, volatile unsigned long *addr)
139+{
140+ volatile unsigned long *a = addr;
141+ unsigned bit = nr & SZLONG_MASK;
142+ unsigned long mask;
143+ unsigned long flags;
144+ unsigned long res;
145+
146+ a += nr >> SZLONG_LOG;
147+ mask = 1UL << bit;
148+ raw_local_irq_save(flags);
149+ res = (mask & *a);
150+ *a &= ~mask;
151+ raw_local_irq_restore(flags);
152+ return res;
153+}
154+EXPORT_SYMBOL(__mips_test_and_clear_bit);
155+
156+
157+/**
158+ * __mips_test_and_change_bit - Change a bit and return its old value. This is
159+ * called by test_and_change_bit() if it cannot find a faster solution.
160+ * @nr: Bit to change
161+ * @addr: Address to count from
162+ */
163+int __mips_test_and_change_bit(unsigned long nr, volatile unsigned long *addr)
164+{
165+ volatile unsigned long *a = addr;
166+ unsigned bit = nr & SZLONG_MASK;
167+ unsigned long mask;
168+ unsigned long flags;
169+ unsigned long res;
170+
171+ a += nr >> SZLONG_LOG;
172+ mask = 1UL << bit;
173+ raw_local_irq_save(flags);
174+ res = (mask & *a);
175+ *a ^= mask;
176+ raw_local_irq_restore(flags);
177+ return res;
178+}
179+EXPORT_SYMBOL(__mips_test_and_change_bit);
arch/mips/lib/mips-atomic.c+176−0
@@ -0,0 +1,176 @@
1+/*
2+ * This file is subject to the terms and conditions of the GNU General Public
3+ * License. See the file "COPYING" in the main directory of this archive
4+ * for more details.
5+ *
6+ * Copyright (C) 1994, 95, 96, 97, 98, 99, 2003 by Ralf Baechle
7+ * Copyright (C) 1996 by Paul M. Antoine
8+ * Copyright (C) 1999 Silicon Graphics
9+ * Copyright (C) 2000 MIPS Technologies, Inc.
10+ */
11+#include <asm/irqflags.h>
12+#include <asm/hazards.h>
13+#include <linux/compiler.h>
14+#include <linux/preempt.h>
15+#include <linux/export.h>
16+
17+#if !defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_MIPS_MT_SMTC)
18+
19+/*
20+ * For cli() we have to insert nops to make sure that the new value
21+ * has actually arrived in the status register before the end of this
22+ * macro.
23+ * R4000/R4400 need three nops, the R4600 two nops and the R10000 needs
24+ * no nops at all.
25+ */
26+/*
27+ * For TX49, operating only IE bit is not enough.
28+ *
29+ * If mfc0 $12 follows store and the mfc0 is last instruction of a
30+ * page and fetching the next instruction causes TLB miss, the result
31+ * of the mfc0 might wrongly contain EXL bit.
32+ *
33+ * ERT-TX49H2-027, ERT-TX49H3-012, ERT-TX49HL3-006, ERT-TX49H4-008
34+ *
35+ * Workaround: mask EXL bit of the result or place a nop before mfc0.
36+ */
37+__asm__(
38+ " .macro arch_local_irq_disable\n"
39+ " .set push \n"
40+ " .set noat \n"
41+#ifdef CONFIG_MIPS_MT_SMTC
42+ " mfc0 $1, $2, 1 \n"
43+ " ori $1, 0x400 \n"
44+ " .set noreorder \n"
45+ " mtc0 $1, $2, 1 \n"
46+#elif defined(CONFIG_CPU_MIPSR2)
47+ /* see irqflags.h for inline function */
48+#else
49+ " mfc0 $1,$12 \n"
50+ " ori $1,0x1f \n"
51+ " xori $1,0x1f \n"
52+ " .set noreorder \n"
53+ " mtc0 $1,$12 \n"
54+#endif
55+ " irq_disable_hazard \n"
56+ " .set pop \n"
57+ " .endm \n");
58+
59+void arch_local_irq_disable(void)
60+{
61+ preempt_disable();
62+ __asm__ __volatile__(
63+ "arch_local_irq_disable"
64+ : /* no outputs */
65+ : /* no inputs */
66+ : "memory");
67+ preempt_enable();
68+}
69+EXPORT_SYMBOL(arch_local_irq_disable);
70+
71+
72+__asm__(
73+ " .macro arch_local_irq_save result \n"
74+ " .set push \n"
75+ " .set reorder \n"
76+ " .set noat \n"
77+#ifdef CONFIG_MIPS_MT_SMTC
78+ " mfc0 \\result, $2, 1 \n"
79+ " ori $1, \\result, 0x400 \n"
80+ " .set noreorder \n"
81+ " mtc0 $1, $2, 1 \n"
82+ " andi \\result, \\result, 0x400 \n"
83+#elif defined(CONFIG_CPU_MIPSR2)
84+ /* see irqflags.h for inline function */
85+#else
86+ " mfc0 \\result, $12 \n"
87+ " ori $1, \\result, 0x1f \n"
88+ " xori $1, 0x1f \n"
89+ " .set noreorder \n"
90+ " mtc0 $1, $12 \n"
91+#endif
92+ " irq_disable_hazard \n"
93+ " .set pop \n"
94+ " .endm \n");
95+
96+unsigned long arch_local_irq_save(void)
97+{
98+ unsigned long flags;
99+ preempt_disable();
100+ asm volatile("arch_local_irq_save\t%0"
101+ : "=r" (flags)
102+ : /* no inputs */
103+ : "memory");
104+ preempt_enable();
105+ return flags;
106+}
107+EXPORT_SYMBOL(arch_local_irq_save);
108+
109+
110+__asm__(
111+ " .macro arch_local_irq_restore flags \n"
112+ " .set push \n"
113+ " .set noreorder \n"
114+ " .set noat \n"
115+#ifdef CONFIG_MIPS_MT_SMTC
116+ "mfc0 $1, $2, 1 \n"
117+ "andi \\flags, 0x400 \n"
118+ "ori $1, 0x400 \n"
119+ "xori $1, 0x400 \n"
120+ "or \\flags, $1 \n"
121+ "mtc0 \\flags, $2, 1 \n"
122+#elif defined(CONFIG_CPU_MIPSR2) && defined(CONFIG_IRQ_CPU)
123+ /* see irqflags.h for inline function */
124+#elif defined(CONFIG_CPU_MIPSR2)
125+ /* see irqflags.h for inline function */
126+#else
127+ " mfc0 $1, $12 \n"
128+ " andi \\flags, 1 \n"
129+ " ori $1, 0x1f \n"
130+ " xori $1, 0x1f \n"
131+ " or \\flags, $1 \n"
132+ " mtc0 \\flags, $12 \n"
133+#endif
134+ " irq_disable_hazard \n"
135+ " .set pop \n"
136+ " .endm \n");
137+
138+void arch_local_irq_restore(unsigned long flags)
139+{
140+ unsigned long __tmp1;
141+
142+#ifdef CONFIG_MIPS_MT_SMTC
143+ /*
144+ * SMTC kernel needs to do a software replay of queued
145+ * IPIs, at the cost of branch and call overhead on each
146+ * local_irq_restore()
147+ */
148+ if (unlikely(!(flags & 0x0400)))
149+ smtc_ipi_replay();
150+#endif
151+ preempt_disable();
152+ __asm__ __volatile__(
153+ "arch_local_irq_restore\t%0"
154+ : "=r" (__tmp1)
155+ : "0" (flags)
156+ : "memory");
157+ preempt_enable();
158+}
159+EXPORT_SYMBOL(arch_local_irq_restore);
160+
161+
162+void __arch_local_irq_restore(unsigned long flags)
163+{
164+ unsigned long __tmp1;
165+
166+ preempt_disable();
167+ __asm__ __volatile__(
168+ "arch_local_irq_restore\t%0"
169+ : "=r" (__tmp1)
170+ : "0" (flags)
171+ : "memory");
172+ preempt_enable();
173+}
174+EXPORT_SYMBOL(__arch_local_irq_restore);
175+
176+#endif /* !defined(CONFIG_CPU_MIPSR2) || defined(CONFIG_MIPS_MT_SMTC) */
arch/mips/mti-malta/malta-platform.c+2−1
@@ -29,6 +29,7 @@ · 28 unmodified lines
2929 #include <linux/mtd/partitions.h>
3030 #include <linux/mtd/physmap.h>
3131 #include <linux/platform_device.h>
32+#include <asm/mips-boards/maltaint.h>
3233 #include <mtd/mtd-abi.h>
3334
3435 #define SMC_PORT(base, int) \
@@ -48,7 +49,7 @@ static struct plat_serial8250_port uart8250_data[] = { · 13 unmodified lines
4849 SMC_PORT(0x2F8, 3),
4950 {
5051 .mapbase = 0x1f000900, /* The CBUS UART */
51− .irq = MIPS_CPU_IRQ_BASE + 2,
52+ .irq = MIPS_CPU_IRQ_BASE + MIPSCPU_INT_MB2,
5253 .uartclk = 3686400, /* Twice the usual clk! */
5354 .iotype = UPIO_MEM32,
5455 .flags = CBUS_UART_FLAGS,
arch/s390/Kconfig+1−0
@@ -96,6 +96,7 @@ config S390 · 95 unmodified lines
9696 select HAVE_MEMBLOCK_NODE_MAP
9797 select HAVE_CMPXCHG_LOCAL
9898 select HAVE_CMPXCHG_DOUBLE
99+ select HAVE_ALIGNED_STRUCT_PAGE if SLUB
99100 select HAVE_VIRT_CPU_ACCOUNTING
100101 select VIRT_CPU_ACCOUNTING
101102 select ARCH_DISCARD_MEMBLOCK
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/compat.h+1−1
@@ -20,7 +20,7 @@ · 19 unmodified lines
2020 #define PSW32_MASK_CC 0x00003000UL
2121 #define PSW32_MASK_PM 0x00000f00UL
2222
23−#define PSW32_MASK_USER 0x00003F00UL
23+#define PSW32_MASK_USER 0x0000FF00UL
2424
2525 #define PSW32_ADDR_AMODE 0x80000000UL
2626 #define PSW32_ADDR_INSN 0x7FFFFFFFUL
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/include/asm/topology.h+3−0
@@ -8,6 +8,9 @@ struct cpu; · 7 unmodified lines
88
99 #ifdef CONFIG_SCHED_BOOK
1010
11+extern unsigned char cpu_socket_id[NR_CPUS];
12+#define topology_physical_package_id(cpu) (cpu_socket_id[cpu])
13+
1114 extern unsigned char cpu_core_id[NR_CPUS];
1215 extern cpumask_t cpu_core_map[NR_CPUS];
1316
arch/s390/include/uapi/asm/ptrace.h+2−2
@@ -239,7 +239,7 @@ typedef struct · 238 unmodified lines
239239 #define PSW_MASK_EA 0x00000000UL
240240 #define PSW_MASK_BA 0x00000000UL
241241
242−#define PSW_MASK_USER 0x00003F00UL
242+#define PSW_MASK_USER 0x0000FF00UL
243243
244244 #define PSW_ADDR_AMODE 0x80000000UL
245245 #define PSW_ADDR_INSN 0x7FFFFFFFUL
@@ -269,7 +269,7 @@ typedef struct · 23 unmodified lines
269269 #define PSW_MASK_EA 0x0000000100000000UL
270270 #define PSW_MASK_BA 0x0000000080000000UL
271271
272−#define PSW_MASK_USER 0x00003F8180000000UL
272+#define PSW_MASK_USER 0x0000FF8180000000UL
273273
274274 #define PSW_ADDR_AMODE 0x0000000000000000UL
275275 #define PSW_ADDR_INSN 0xFFFFFFFFFFFFFFFFUL
arch/s390/kernel/compat_signal.c+12−2
@@ -309,6 +309,10 @@ static int restore_sigregs32(struct pt_regs *regs,_sigregs32 __user *sregs) · 308 unmodified lines
309309 regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) |
310310 (__u64)(regs32.psw.mask & PSW32_MASK_USER) << 32 |
311311 (__u64)(regs32.psw.addr & PSW32_ADDR_AMODE);
312+ /* Check for invalid user address space control. */
313+ if ((regs->psw.mask & PSW_MASK_ASC) >= (psw_kernel_bits & PSW_MASK_ASC))
314+ regs->psw.mask = (psw_user_bits & PSW_MASK_ASC) |
315+ (regs->psw.mask & ~PSW_MASK_ASC);
312316 regs->psw.addr = (__u64)(regs32.psw.addr & PSW32_ADDR_INSN);
313317 for (i = 0; i < NUM_GPRS; i++)
314318 regs->gprs[i] = (__u64) regs32.gprs[i];
@@ -481,7 +485,10 @@ static int setup_frame32(int sig, struct k_sigaction *ka, · 166 unmodified lines
481485
482486 /* Set up registers for signal handler */
483487 regs->gprs[15] = (__force __u64) frame;
484− regs->psw.mask |= PSW_MASK_BA; /* force amode 31 */
488+ /* Force 31 bit amode and default user address space control. */
489+ regs->psw.mask = PSW_MASK_BA |
490+ (psw_user_bits & PSW_MASK_ASC) |
491+ (regs->psw.mask & ~PSW_MASK_ASC);
485492 regs->psw.addr = (__force __u64) ka->sa.sa_handler;
486493
487494 regs->gprs[2] = map_signal(sig);
@@ -549,7 +556,10 @@ static int setup_rt_frame32(int sig, struct k_sigaction *ka, siginfo_t *info, · 61 unmodified lines
549556
550557 /* Set up registers for signal handler */
551558 regs->gprs[15] = (__force __u64) frame;
552− regs->psw.mask |= PSW_MASK_BA; /* force amode 31 */
559+ /* Force 31 bit amode and default user address space control. */
560+ regs->psw.mask = PSW_MASK_BA |
561+ (psw_user_bits & PSW_MASK_ASC) |
562+ (regs->psw.mask & ~PSW_MASK_ASC);
553563 regs->psw.addr = (__u64) ka->sa.sa_handler;
554564
555565 regs->gprs[2] = map_signal(sig);
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/kernel/signal.c+12−2
@@ -136,6 +136,10 @@ static int restore_sigregs(struct pt_regs *regs, _sigregs __user *sregs) · 135 unmodified lines
136136 /* Use regs->psw.mask instead of psw_user_bits to preserve PER bit. */
137137 regs->psw.mask = (regs->psw.mask & ~PSW_MASK_USER) |
138138 (user_sregs.regs.psw.mask & PSW_MASK_USER);
139+ /* Check for invalid user address space control. */
140+ if ((regs->psw.mask & PSW_MASK_ASC) >= (psw_kernel_bits & PSW_MASK_ASC))
141+ regs->psw.mask = (psw_user_bits & PSW_MASK_ASC) |
142+ (regs->psw.mask & ~PSW_MASK_ASC);
139143 /* Check for invalid amode */
140144 if (regs->psw.mask & PSW_MASK_EA)
141145 regs->psw.mask |= PSW_MASK_BA;
@@ -273,7 +277,10 @@ static int setup_frame(int sig, struct k_sigaction *ka, · 131 unmodified lines
273277
274278 /* Set up registers for signal handler */
275279 regs->gprs[15] = (unsigned long) frame;
276− regs->psw.mask |= PSW_MASK_EA | PSW_MASK_BA; /* 64 bit amode */
280+ /* Force default amode and default user address space control. */
281+ regs->psw.mask = PSW_MASK_EA | PSW_MASK_BA |
282+ (psw_user_bits & PSW_MASK_ASC) |
283+ (regs->psw.mask & ~PSW_MASK_ASC);
277284 regs->psw.addr = (unsigned long) ka->sa.sa_handler | PSW_ADDR_AMODE;
278285
279286 regs->gprs[2] = map_signal(sig);
@@ -346,7 +353,10 @@ static int setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, · 66 unmodified lines
346353
347354 /* Set up registers for signal handler */
348355 regs->gprs[15] = (unsigned long) frame;
349− regs->psw.mask |= PSW_MASK_EA | PSW_MASK_BA; /* 64 bit amode */
356+ /* Force default amode and default user address space control. */
357+ regs->psw.mask = PSW_MASK_EA | PSW_MASK_BA |
358+ (psw_user_bits & PSW_MASK_ASC) |
359+ (regs->psw.mask & ~PSW_MASK_ASC);
350360 regs->psw.addr = (unsigned long) ka->sa.sa_handler | PSW_ADDR_AMODE;
351361
352362 regs->gprs[2] = map_signal(sig);
arch/s390/kernel/topology.c+4−2
@@ -40,6 +40,7 @@ static DEFINE_SPINLOCK(topology_lock); · 39 unmodified lines
4040 static struct mask_info core_info;
4141 cpumask_t cpu_core_map[NR_CPUS];
4242 unsigned char cpu_core_id[NR_CPUS];
43+unsigned char cpu_socket_id[NR_CPUS];
4344
4445 static struct mask_info book_info;
4546 cpumask_t cpu_book_map[NR_CPUS];
@@ -83,11 +84,12 @@ static struct mask_info *add_cpus_to_mask(struct topology_cpu *tl_cpu, · 37 unmodified lines
8384 cpumask_set_cpu(lcpu, &book->mask);
8485 cpu_book_id[lcpu] = book->id;
8586 cpumask_set_cpu(lcpu, &core->mask);
87+ cpu_core_id[lcpu] = rcpu;
8688 if (one_core_per_cpu) {
87− cpu_core_id[lcpu] = rcpu;
89+ cpu_socket_id[lcpu] = rcpu;
8890 core = core->next;
8991 } else {
90− cpu_core_id[lcpu] = core->id;
92+ cpu_socket_id[lcpu] = core->id;
9193 }
9294 smp_cpu_set_polarization(lcpu, tl_cpu->pp);
9395 }
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+3−4
@@ -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;
@@ -180,8 +180,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write, · 47 unmodified lines
180180 addr = start;
181181 len = (unsigned long) nr_pages << PAGE_SHIFT;
182182 end = start + len;
183− if (unlikely(!access_ok(write ? VERIFY_WRITE : VERIFY_READ,
184− (void __user *)start, len)))
183+ if ((end < start) || (end > TASK_SIZE))
185184 return 0;
186185
187186 local_irq_save(flags);
@@ -229,7 +228,7 @@ int get_user_pages_fast(unsigned long start, int nr_pages, int write, · 41 unmodified lines
229228 addr = start;
230229 len = (unsigned long) nr_pages << PAGE_SHIFT;
231230 end = start + len;
232− if (end < start)
231+ if ((end < start) || (end > TASK_SIZE))
233232 goto slow_irqon;
234233
235234 /*
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/unicore32/Kconfig+6−1
@@ -16,6 +16,8 @@ config UNICORE32 · 15 unmodified lines
1616 select ARCH_WANT_FRAME_POINTERS
1717 select GENERIC_IOMAP
1818 select MODULES_USE_ELF_REL
19+ select GENERIC_KERNEL_THREAD
20+ select GENERIC_KERNEL_EXECVE
1921 help
2022 UniCore-32 is 32-bit Instruction Set Architecture,
2123 including a series of low-power-consumption RISC chip
@@ -64,6 +66,9 @@ config GENERIC_CALIBRATE_DELAY · 42 unmodified lines
6466 config ARCH_MAY_HAVE_PC_FDC
6567 bool
6668
69+config ZONE_DMA
70+ def_bool y
71+
6772 config NEED_DMA_MAP_STATE
6873 def_bool y
6974
@@ -216,7 +221,7 @@ config PUV3_GPIO · 146 unmodified lines
216221 bool
217222 depends on !ARCH_FPGA
218223 select GENERIC_GPIO
219− select GPIO_SYSFS if EXPERIMENTAL
224+ select GPIO_SYSFS
220225 default y
221226
222227 if PUV3_NB0916
arch/unicore32/include/asm/Kbuild+0−1
@@ -1,4 +1,3 @@
1−include include/asm-generic/Kbuild.asm
21
32 generic-y += atomic.h
43 generic-y += auxvec.h
arch/unicore32/include/asm/bug.h+0−5
@@ -19,9 +19,4 @@ extern void die(const char *msg, struct pt_regs *regs, int err); · 18 unmodified lines
1919 extern void uc32_notify_die(const char *str, struct pt_regs *regs,
2020 struct siginfo *info, unsigned long err, unsigned long trap);
2121
22−extern asmlinkage void __backtrace(void);
23−extern asmlinkage void c_backtrace(unsigned long fp, int pmode);
24−
25−extern void __show_regs(struct pt_regs *);
26−
2722 #endif /* __UNICORE_BUG_H__ */
arch/unicore32/include/asm/cmpxchg.h+1−1
@@ -35,7 +35,7 @@ static inline unsigned long __xchg(unsigned long x, volatile void *ptr, · 34 unmodified lines
3535 : "memory", "cc");
3636 break;
3737 default:
38− ret = __xchg_bad_pointer();
38+ __xchg_bad_pointer();
3939 }
4040
4141 return ret;
arch/unicore32/include/asm/kvm_para.h+0−1
@@ -1 +0,0 @@
1−#include <asm-generic/kvm_para.h>
arch/unicore32/include/asm/processor.h+0−5
@@ -72,11 +72,6 @@ unsigned long get_wchan(struct task_struct *p); · 71 unmodified lines
7272
7373 #define cpu_relax() barrier()
7474
75−/*
76− * Create a new kernel thread
77− */
78−extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
79−
8075 #define task_pt_regs(p) \
8176 ((struct pt_regs *)(THREAD_START_SP + task_stack_page(p)) - 1)
8277
arch/unicore32/include/asm/ptrace.h+1−75
@@ -12,80 +12,10 @@ · 11 unmodified lines
1212 #ifndef __UNICORE_PTRACE_H__
1313 #define __UNICORE_PTRACE_H__
1414
15−#define PTRACE_GET_THREAD_AREA 22
16−
17−/*
18− * PSR bits
19− */
20−#define USER_MODE 0x00000010
21−#define REAL_MODE 0x00000011
22−#define INTR_MODE 0x00000012
23−#define PRIV_MODE 0x00000013
24−#define ABRT_MODE 0x00000017
25−#define EXTN_MODE 0x0000001b
26−#define SUSR_MODE 0x0000001f
27−#define MODE_MASK 0x0000001f
28−#define PSR_R_BIT 0x00000040
29−#define PSR_I_BIT 0x00000080
30−#define PSR_V_BIT 0x10000000
31−#define PSR_C_BIT 0x20000000
32−#define PSR_Z_BIT 0x40000000
33−#define PSR_S_BIT 0x80000000
34−
35−/*
36− * Groups of PSR bits
37− */
38−#define PSR_f 0xff000000 /* Flags */
39−#define PSR_c 0x000000ff /* Control */
15+#include <uapi/asm/ptrace.h>
4016
4117 #ifndef __ASSEMBLY__
4218
43−/*
44− * This struct defines the way the registers are stored on the
45− * stack during a system call. Note that sizeof(struct pt_regs)
46− * has to be a multiple of 8.
47− */
48−struct pt_regs {
49− unsigned long uregs[34];
50−};
51−
52−#define UCreg_asr uregs[32]
53−#define UCreg_pc uregs[31]
54−#define UCreg_lr uregs[30]
55−#define UCreg_sp uregs[29]
56−#define UCreg_ip uregs[28]
57−#define UCreg_fp uregs[27]
58−#define UCreg_26 uregs[26]
59−#define UCreg_25 uregs[25]
60−#define UCreg_24 uregs[24]
61−#define UCreg_23 uregs[23]
62−#define UCreg_22 uregs[22]
63−#define UCreg_21 uregs[21]
64−#define UCreg_20 uregs[20]
65−#define UCreg_19 uregs[19]
66−#define UCreg_18 uregs[18]
67−#define UCreg_17 uregs[17]
68−#define UCreg_16 uregs[16]
69−#define UCreg_15 uregs[15]
70−#define UCreg_14 uregs[14]
71−#define UCreg_13 uregs[13]
72−#define UCreg_12 uregs[12]
73−#define UCreg_11 uregs[11]
74−#define UCreg_10 uregs[10]
75−#define UCreg_09 uregs[9]
76−#define UCreg_08 uregs[8]
77−#define UCreg_07 uregs[7]
78−#define UCreg_06 uregs[6]
79−#define UCreg_05 uregs[5]
80−#define UCreg_04 uregs[4]
81−#define UCreg_03 uregs[3]
82−#define UCreg_02 uregs[2]
83−#define UCreg_01 uregs[1]
84−#define UCreg_00 uregs[0]
85−#define UCreg_ORIG_00 uregs[33]
86−
87−#ifdef __KERNEL__
88−
8919 #define user_mode(regs) \
9020 (processor_mode(regs) == USER_MODE)
9121
@@ -125,9 +55,5 @@ static inline int valid_user_regs(struct pt_regs *regs) · 33 unmodified lines
12555
12656 #define instruction_pointer(regs) ((regs)->UCreg_pc)
12757
128−#endif /* __KERNEL__ */
129−
13058 #endif /* __ASSEMBLY__ */
131−
13259 #endif
133−
arch/unicore32/include/uapi/asm/Kbuild+7−0
@@ -1,3 +1,10 @@
11 # UAPI Header export list
22 include include/uapi/asm-generic/Kbuild.asm
33
4+header-y += byteorder.h
5+header-y += kvm_para.h
6+header-y += ptrace.h
7+header-y += sigcontext.h
8+header-y += unistd.h
9+
10+generic-y += kvm_para.h
arch/unicore32/include/uapi/asm/byteorder.hrenamed from arch/unicore32/include/asm/byteorder.h+0−0

File renamed without changes.

arch/unicore32/include/uapi/asm/ptrace.h+90−0
@@ -0,0 +1,90 @@
1+/*
2+ * linux/arch/unicore32/include/asm/ptrace.h
3+ *
4+ * Code specific to PKUnity SoC and UniCore ISA
5+ *
6+ * Copyright (C) 2001-2010 GUAN Xue-tao
7+ *
8+ * This program is free software; you can redistribute it and/or modify
9+ * it under the terms of the GNU General Public License version 2 as
10+ * published by the Free Software Foundation.
11+ */
12+#ifndef _UAPI__UNICORE_PTRACE_H__
13+#define _UAPI__UNICORE_PTRACE_H__
14+
15+#define PTRACE_GET_THREAD_AREA 22
16+
17+/*
18+ * PSR bits
19+ */
20+#define USER_MODE 0x00000010
21+#define REAL_MODE 0x00000011
22+#define INTR_MODE 0x00000012
23+#define PRIV_MODE 0x00000013
24+#define ABRT_MODE 0x00000017
25+#define EXTN_MODE 0x0000001b
26+#define SUSR_MODE 0x0000001f
27+#define MODE_MASK 0x0000001f
28+#define PSR_R_BIT 0x00000040
29+#define PSR_I_BIT 0x00000080
30+#define PSR_V_BIT 0x10000000
31+#define PSR_C_BIT 0x20000000
32+#define PSR_Z_BIT 0x40000000
33+#define PSR_S_BIT 0x80000000
34+
35+/*
36+ * Groups of PSR bits
37+ */
38+#define PSR_f 0xff000000 /* Flags */
39+#define PSR_c 0x000000ff /* Control */
40+
41+#ifndef __ASSEMBLY__
42+
43+/*
44+ * This struct defines the way the registers are stored on the
45+ * stack during a system call. Note that sizeof(struct pt_regs)
46+ * has to be a multiple of 8.
47+ */
48+struct pt_regs {
49+ unsigned long uregs[34];
50+};
51+
52+#define UCreg_asr uregs[32]
53+#define UCreg_pc uregs[31]
54+#define UCreg_lr uregs[30]
55+#define UCreg_sp uregs[29]
56+#define UCreg_ip uregs[28]
57+#define UCreg_fp uregs[27]
58+#define UCreg_26 uregs[26]
59+#define UCreg_25 uregs[25]
60+#define UCreg_24 uregs[24]
61+#define UCreg_23 uregs[23]
62+#define UCreg_22 uregs[22]
63+#define UCreg_21 uregs[21]
64+#define UCreg_20 uregs[20]
65+#define UCreg_19 uregs[19]
66+#define UCreg_18 uregs[18]
67+#define UCreg_17 uregs[17]
68+#define UCreg_16 uregs[16]
69+#define UCreg_15 uregs[15]
70+#define UCreg_14 uregs[14]
71+#define UCreg_13 uregs[13]
72+#define UCreg_12 uregs[12]
73+#define UCreg_11 uregs[11]
74+#define UCreg_10 uregs[10]
75+#define UCreg_09 uregs[9]
76+#define UCreg_08 uregs[8]
77+#define UCreg_07 uregs[7]
78+#define UCreg_06 uregs[6]
79+#define UCreg_05 uregs[5]
80+#define UCreg_04 uregs[4]
81+#define UCreg_03 uregs[3]
82+#define UCreg_02 uregs[2]
83+#define UCreg_01 uregs[1]
84+#define UCreg_00 uregs[0]
85+#define UCreg_ORIG_00 uregs[33]
86+
87+
88+#endif /* __ASSEMBLY__ */
89+
90+#endif /* _UAPI__UNICORE_PTRACE_H__ */
arch/unicore32/include/uapi/asm/sigcontext.hrenamed from arch/unicore32/include/asm/sigcontext.h+0−0

File renamed without changes.

arch/unicore32/include/uapi/asm/unistd.hrenamed from arch/unicore32/include/asm/unistd.h+1−0
@@ -12,3 +12,4 @@ · 11 unmodified lines
1212
1313 /* Use the standard ABI for syscalls. */
1414 #include <asm-generic/unistd.h>
15+#define __ARCH_WANT_SYS_EXECVE
arch/unicore32/kernel/entry.S+7−13
@@ -573,17 +573,16 @@ ENDPROC(ret_to_user) · 572 unmodified lines
573573 */
574574 ENTRY(ret_from_fork)
575575 b.l schedule_tail
576− get_thread_info tsk
577− ldw r1, [tsk+], #TI_FLAGS @ check for syscall tracing
578− mov why, #1
579− cand.a r1, #_TIF_SYSCALL_TRACE @ are we tracing syscalls?
580− beq ret_slow_syscall
581− mov r1, sp
582− mov r0, #1 @ trace exit [IP = 1]
583− b.l syscall_trace
584576 b ret_slow_syscall
585577 ENDPROC(ret_from_fork)
586578
579+ENTRY(ret_from_kernel_thread)
580+ b.l schedule_tail
581+ mov r0, r5
582+ adr lr, ret_slow_syscall
583+ mov pc, r4
584+ENDPROC(ret_from_kernel_thread)
585+
587586 /*=============================================================================
588587 * SWI handler
589588 *-----------------------------------------------------------------------------
@@ -669,11 +668,6 @@ __cr_alignment: · 79 unmodified lines
669668 #endif
670669 .ltorg
671670
672−ENTRY(sys_execve)
673− add r3, sp, #S_OFF
674− b __sys_execve
675−ENDPROC(sys_execve)
676−
677671 ENTRY(sys_clone)
678672 add ip, sp, #S_OFF
679673 stw ip, [sp+], #4
arch/unicore32/kernel/process.c+14−44
@@ -258,6 +258,7 @@ void release_thread(struct task_struct *dead_task) · 257 unmodified lines
258258 }
259259
260260 asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
261+asmlinkage void ret_from_kernel_thread(void) __asm__("ret_from_kernel_thread");
261262
262263 int
263264 copy_thread(unsigned long clone_flags, unsigned long stack_start,
@@ -266,17 +267,22 @@ copy_thread(unsigned long clone_flags, unsigned long stack_start, · 2 unmodified lines
266267 struct thread_info *thread = task_thread_info(p);
267268 struct pt_regs *childregs = task_pt_regs(p);
268269
269− *childregs = *regs;
270− childregs->UCreg_00 = 0;
271− childregs->UCreg_sp = stack_start;
272−
273270 memset(&thread->cpu_context, 0, sizeof(struct cpu_context_save));
274271 thread->cpu_context.sp = (unsigned long)childregs;
275− thread->cpu_context.pc = (unsigned long)ret_from_fork;
276−
277− if (clone_flags & CLONE_SETTLS)
278− childregs->UCreg_16 = regs->UCreg_03;
272+ if (unlikely(!regs)) {
273+ thread->cpu_context.pc = (unsigned long)ret_from_kernel_thread;
274+ thread->cpu_context.r4 = stack_start;
275+ thread->cpu_context.r5 = stk_sz;
276+ memset(childregs, 0, sizeof(struct pt_regs));
277+ } else {
278+ thread->cpu_context.pc = (unsigned long)ret_from_fork;
279+ *childregs = *regs;
280+ childregs->UCreg_00 = 0;
281+ childregs->UCreg_sp = stack_start;
279282
283+ if (clone_flags & CLONE_SETTLS)
284+ childregs->UCreg_16 = regs->UCreg_03;
285+ }
280286 return 0;
281287 }
282288
@@ -305,42 +311,6 @@ int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fp) · 22 unmodified lines
305311 }
306312 EXPORT_SYMBOL(dump_fpu);
307313
308−/*
309− * Shuffle the argument into the correct register before calling the
310− * thread function. r1 is the thread argument, r2 is the pointer to
311− * the thread function, and r3 points to the exit function.
312− */
313−asm(".pushsection .text\n"
314−" .align\n"
315−" .type kernel_thread_helper, #function\n"
316−"kernel_thread_helper:\n"
317−" mov.a asr, r7\n"
318−" mov r0, r4\n"
319−" mov lr, r6\n"
320−" mov pc, r5\n"
321−" .size kernel_thread_helper, . - kernel_thread_helper\n"
322−" .popsection");
323−
324−/*
325− * Create a kernel thread.
326− */
327−pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
328−{
329− struct pt_regs regs;
330−
331− memset(&regs, 0, sizeof(regs));
332−
333− regs.UCreg_04 = (unsigned long)arg;
334− regs.UCreg_05 = (unsigned long)fn;
335− regs.UCreg_06 = (unsigned long)do_exit;
336− regs.UCreg_07 = PRIV_MODE;
337− regs.UCreg_pc = (unsigned long)kernel_thread_helper;
338− regs.UCreg_asr = regs.UCreg_07 | PSR_I_BIT;
339−
340− return do_fork(flags|CLONE_VM|CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
341−}
342−EXPORT_SYMBOL(kernel_thread);
343−
344314 unsigned long get_wchan(struct task_struct *p)
345315 {
346316 struct stackframe frame;
arch/unicore32/kernel/setup.h+6−0
@@ -30,4 +30,10 @@ extern char __vectors_start[], __vectors_end[]; · 29 unmodified lines
3030 extern void kernel_thread_helper(void);
3131
3232 extern void __init early_signal_init(void);
33+
34+extern asmlinkage void __backtrace(void);
35+extern asmlinkage void c_backtrace(unsigned long fp, int pmode);
36+
37+extern void __show_regs(struct pt_regs *);
38+
3339 #endif
arch/unicore32/kernel/sys.c+0−63
@@ -42,69 +42,6 @@ asmlinkage long __sys_clone(unsigned long clone_flags, unsigned long newsp, · 41 unmodified lines
4242 parent_tid, child_tid);
4343 }
4444
45−/* sys_execve() executes a new program.
46− * This is called indirectly via a small wrapper
47− */
48−asmlinkage long __sys_execve(const char __user *filename,
49− const char __user *const __user *argv,
50− const char __user *const __user *envp,
51− struct pt_regs *regs)
52−{
53− int error;
54− struct filename *fn;
55−
56− fn = getname(filename);
57− error = PTR_ERR(fn);
58− if (IS_ERR(fn))
59− goto out;
60− error = do_execve(fn->name, argv, envp, regs);
61− putname(fn);
62−out:
63− return error;
64−}
65−
66−int kernel_execve(const char *filename,
67− const char *const argv[],
68− const char *const envp[])
69−{
70− struct pt_regs regs;
71− int ret;
72−
73− memset(&regs, 0, sizeof(struct pt_regs));
74− ret = do_execve(filename,
75− (const char __user *const __user *)argv,
76− (const char __user *const __user *)envp, &regs);
77− if (ret < 0)
78− goto out;
79−
80− /*
81− * Save argc to the register structure for userspace.
82− */
83− regs.UCreg_00 = ret;
84−
85− /*
86− * We were successful. We won't be returning to our caller, but
87− * instead to user space by manipulating the kernel stack.
88− */
89− asm("add r0, %0, %1\n\t"
90− "mov r1, %2\n\t"
91− "mov r2, %3\n\t"
92− "mov r22, #0\n\t" /* not a syscall */
93− "mov r23, %0\n\t" /* thread structure */
94− "b.l memmove\n\t" /* copy regs to top of stack */
95− "mov sp, r0\n\t" /* reposition stack pointer */
96− "b ret_to_user"
97− :
98− : "r" (current_thread_info()),
99− "Ir" (THREAD_START_SP - sizeof(regs)),
100− "r" (&regs),
101− "Ir" (sizeof(regs))
102− : "r0", "r1", "r2", "r3", "ip", "lr", "memory");
103−
104− out:
105− return ret;
106−}
107−
10845 /* Note: used by the compat code even in 64-bit Linux. */
10946 SYSCALL_DEFINE6(mmap2, unsigned long, addr, unsigned long, len,
11047 unsigned long, prot, unsigned long, flags,
arch/unicore32/mm/fault.c+27−10
@@ -168,7 +168,7 @@ static inline bool access_error(unsigned int fsr, struct vm_area_struct *vma) · 167 unmodified lines
168168 }
169169
170170 static int __do_pf(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
171− struct task_struct *tsk)
171+ unsigned int flags, struct task_struct *tsk)
172172 {
173173 struct vm_area_struct *vma;
174174 int fault;
@@ -194,14 +194,7 @@ good_area: · 19 unmodified lines
194194 * If for any reason at all we couldn't handle the fault, make
195195 * sure we exit gracefully rather than endlessly redo the fault.
196196 */
197− fault = handle_mm_fault(mm, vma, addr & PAGE_MASK,
198− (!(fsr ^ 0x12)) ? FAULT_FLAG_WRITE : 0);
199− if (unlikely(fault & VM_FAULT_ERROR))
200− return fault;
201− if (fault & VM_FAULT_MAJOR)
202− tsk->maj_flt++;
203− else
204− tsk->min_flt++;
197+ fault = handle_mm_fault(mm, vma, addr & PAGE_MASK, flags);
205198 return fault;
206199
207200 check_stack:
@@ -216,6 +209,8 @@ static int do_pf(unsigned long addr, unsigned int fsr, struct pt_regs *regs) · 8 unmodified lines
216209 struct task_struct *tsk;
217210 struct mm_struct *mm;
218211 int fault, sig, code;
212+ unsigned int flags = FAULT_FLAG_ALLOW_RETRY | FAULT_FLAG_KILLABLE |
213+ ((!(fsr ^ 0x12)) ? FAULT_FLAG_WRITE : 0);
219214
220215 tsk = current;
221216 mm = tsk->mm;
@@ -236,6 +231,7 @@ static int do_pf(unsigned long addr, unsigned int fsr, struct pt_regs *regs) · 14 unmodified lines
236231 if (!user_mode(regs)
237232 && !search_exception_tables(regs->UCreg_pc))
238233 goto no_context;
234+retry:
239235 down_read(&mm->mmap_sem);
240236 } else {
241237 /*
@@ -251,7 +247,28 @@ static int do_pf(unsigned long addr, unsigned int fsr, struct pt_regs *regs) · 9 unmodified lines
251247 #endif
252248 }
253249
254− fault = __do_pf(mm, addr, fsr, tsk);
250+ fault = __do_pf(mm, addr, fsr, flags, tsk);
251+
252+ /* If we need to retry but a fatal signal is pending, handle the
253+ * signal first. We do not need to release the mmap_sem because
254+ * it would already be released in __lock_page_or_retry in
255+ * mm/filemap.c. */
256+ if ((fault & VM_FAULT_RETRY) && fatal_signal_pending(current))
257+ return 0;
258+
259+ if (!(fault & VM_FAULT_ERROR) && (flags & FAULT_FLAG_ALLOW_RETRY)) {
260+ if (fault & VM_FAULT_MAJOR)
261+ tsk->maj_flt++;
262+ else
263+ tsk->min_flt++;
264+ if (fault & VM_FAULT_RETRY) {
265+ /* Clear FAULT_FLAG_ALLOW_RETRY to avoid any risk
266+ * of starvation. */
267+ flags &= ~FAULT_FLAG_ALLOW_RETRY;
268+ goto retry;
269+ }
270+ }
271+
255272 up_read(&mm->mmap_sem);
256273
257274 /*
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/kvm/cpuid.h+3−0
@@ -24,6 +24,9 @@ static inline bool guest_cpuid_has_xsave(struct kvm_vcpu *vcpu) · 23 unmodified lines
2424 {
2525 struct kvm_cpuid_entry2 *best;
2626
27+ if (!static_cpu_has(X86_FEATURE_XSAVE))
28+ return 0;
29+
2730 best = kvm_find_cpuid_entry(vcpu, 1, 0);
2831 return best && (best->ecx & bit(X86_FEATURE_XSAVE));
2932 }
arch/x86/kvm/vmx.c+7−4
@@ -6549,19 +6549,22 @@ static void vmx_cpuid_update(struct kvm_vcpu *vcpu) · 6548 unmodified lines
65496549 }
65506550 }
65516551
6552− exec_control = vmcs_read32(SECONDARY_VM_EXEC_CONTROL);
65536552 /* Exposing INVPCID only when PCID is exposed */
65546553 best = kvm_find_cpuid_entry(vcpu, 0x7, 0);
65556554 if (vmx_invpcid_supported() &&
65566555 best && (best->ebx & bit(X86_FEATURE_INVPCID)) &&
65576556 guest_cpuid_has_pcid(vcpu)) {
6557+ exec_control = vmcs_read32(SECONDARY_VM_EXEC_CONTROL);
65586558 exec_control |= SECONDARY_EXEC_ENABLE_INVPCID;
65596559 vmcs_write32(SECONDARY_VM_EXEC_CONTROL,
65606560 exec_control);
65616561 } else {
6562− exec_control &= ~SECONDARY_EXEC_ENABLE_INVPCID;
6563− vmcs_write32(SECONDARY_VM_EXEC_CONTROL,
6564− exec_control);
6562+ if (cpu_has_secondary_exec_ctrls()) {
6563+ exec_control = vmcs_read32(SECONDARY_VM_EXEC_CONTROL);
6564+ exec_control &= ~SECONDARY_EXEC_ENABLE_INVPCID;
6565+ vmcs_write32(SECONDARY_VM_EXEC_CONTROL,
6566+ exec_control);
6567+ }
65656568 if (best)
65666569 best->ebx &= ~bit(X86_FEATURE_INVPCID);
65676570 }
arch/x86/kvm/x86.c+3−0
@@ -5781,6 +5781,9 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, · 5780 unmodified lines
57815781 int pending_vec, max_bits, idx;
57825782 struct desc_ptr dt;
57835783
5784+ if (!guest_cpuid_has_xsave(vcpu) && (sregs->cr4 & X86_CR4_OSXSAVE))
5785+ return -EINVAL;
5786+
57845787 dt.size = sregs->idt.limit;
57855788 dt.address = sregs->idt.base;
57865789 kvm_x86_ops->set_idt(vcpu, &dt);
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/bluetooth/ath3k.c+1−0
@@ -67,6 +67,7 @@ static struct usb_device_id ath3k_table[] = { · 66 unmodified lines
6767 { USB_DEVICE(0x13d3, 0x3304) },
6868 { USB_DEVICE(0x0930, 0x0215) },
6969 { USB_DEVICE(0x0489, 0xE03D) },
70+ { USB_DEVICE(0x0489, 0xE027) },
7071
7172 /* Atheros AR9285 Malbec with sflash firmware */
7273 { USB_DEVICE(0x03F0, 0x311D) },
drivers/bluetooth/btusb.c+1−0
@@ -124,6 +124,7 @@ static struct usb_device_id blacklist_table[] = { · 123 unmodified lines
124124 { USB_DEVICE(0x13d3, 0x3304), .driver_info = BTUSB_IGNORE },
125125 { USB_DEVICE(0x0930, 0x0215), .driver_info = BTUSB_IGNORE },
126126 { USB_DEVICE(0x0489, 0xe03d), .driver_info = BTUSB_IGNORE },
127+ { USB_DEVICE(0x0489, 0xe027), .driver_info = BTUSB_IGNORE },
127128
128129 /* Atheros AR9285 Malbec with sflash firmware */
129130 { USB_DEVICE(0x03f0, 0x311d), .driver_info = BTUSB_IGNORE },
drivers/bus/omap-ocp2scp.c+65−3
@@ -22,6 +22,26 @@ · 21 unmodified lines
2222 #include <linux/pm_runtime.h>
2323 #include <linux/of.h>
2424 #include <linux/of_platform.h>
25+#include <linux/platform_data/omap_ocp2scp.h>
26+
27+/**
28+ * _count_resources - count for the number of resources
29+ * @res: struct resource *
30+ *
31+ * Count and return the number of resources populated for the device that is
32+ * connected to ocp2scp.
33+ */
34+static unsigned _count_resources(struct resource *res)
35+{
36+ int cnt = 0;
37+
38+ while (res->start != res->end) {
39+ cnt++;
40+ res++;
41+ }
42+
43+ return cnt;
44+}
2545
2646 static int ocp2scp_remove_devices(struct device *dev, void *c)
2747 {
@@ -34,20 +54,62 @@ static int ocp2scp_remove_devices(struct device *dev, void *c) · 6 unmodified lines
3454
3555 static int __devinit omap_ocp2scp_probe(struct platform_device *pdev)
3656 {
37− int ret;
38− struct device_node *np = pdev->dev.of_node;
57+ int ret;
58+ unsigned res_cnt, i;
59+ struct device_node *np = pdev->dev.of_node;
60+ struct platform_device *pdev_child;
61+ struct omap_ocp2scp_platform_data *pdata = pdev->dev.platform_data;
62+ struct omap_ocp2scp_dev *dev;
3963
4064 if (np) {
4165 ret = of_platform_populate(np, NULL, NULL, &pdev->dev);
4266 if (ret) {
43− dev_err(&pdev->dev, "failed to add resources for ocp2scp child\n");
67+ dev_err(&pdev->dev,
68+ "failed to add resources for ocp2scp child\n");
4469 goto err0;
4570 }
71+ } else if (pdata) {
72+ for (i = 0, dev = *pdata->devices; i < pdata->dev_cnt; i++,
73+ dev++) {
74+ res_cnt = _count_resources(dev->res);
75+
76+ pdev_child = platform_device_alloc(dev->drv_name,
77+ PLATFORM_DEVID_AUTO);
78+ if (!pdev_child) {
79+ dev_err(&pdev->dev,
80+ "failed to allocate mem for ocp2scp child\n");
81+ goto err0;
82+ }
83+
84+ ret = platform_device_add_resources(pdev_child,
85+ dev->res, res_cnt);
86+ if (ret) {
87+ dev_err(&pdev->dev,
88+ "failed to add resources for ocp2scp child\n");
89+ goto err1;
90+ }
91+
92+ pdev_child->dev.parent = &pdev->dev;
93+
94+ ret = platform_device_add(pdev_child);
95+ if (ret) {
96+ dev_err(&pdev->dev,
97+ "failed to register ocp2scp child device\n");
98+ goto err1;
99+ }
100+ }
101+ } else {
102+ dev_err(&pdev->dev, "OCP2SCP initialized without plat data\n");
103+ return -EINVAL;
46104 }
105+
47106 pm_runtime_enable(&pdev->dev);
48107
49108 return 0;
50109
110+err1:
111+ platform_device_put(pdev_child);
112+
51113 err0:
52114 device_for_each_child(&pdev->dev, NULL, ocp2scp_remove_devices);
53115
drivers/clk/ux500/u8500_clk.c+46−4
@@ -40,7 +40,7 @@ void u8500_clk_init(void) · 39 unmodified lines
4040 CLK_IS_ROOT|CLK_IGNORE_UNUSED,
4141 32768);
4242 clk_register_clkdev(clk, "clk32k", NULL);
43− clk_register_clkdev(clk, NULL, "rtc-pl031");
43+ clk_register_clkdev(clk, "apb_pclk", "rtc-pl031");
4444
4545 /* PRCMU clocks */
4646 fw_version = prcmu_get_fw_version();
@@ -228,10 +228,17 @@ void u8500_clk_init(void) · 181 unmodified lines
228228
229229 clk = clk_reg_prcc_pclk("p1_pclk2", "per1clk", U8500_CLKRST1_BASE,
230230 BIT(2), 0);
231+ clk_register_clkdev(clk, "apb_pclk", "nmk-i2c.1");
232+
231233 clk = clk_reg_prcc_pclk("p1_pclk3", "per1clk", U8500_CLKRST1_BASE,
232234 BIT(3), 0);
235+ clk_register_clkdev(clk, "apb_pclk", "msp0");
236+ clk_register_clkdev(clk, "apb_pclk", "ux500-msp-i2s.0");
237+
233238 clk = clk_reg_prcc_pclk("p1_pclk4", "per1clk", U8500_CLKRST1_BASE,
234239 BIT(4), 0);
240+ clk_register_clkdev(clk, "apb_pclk", "msp1");
241+ clk_register_clkdev(clk, "apb_pclk", "ux500-msp-i2s.1");
235242
236243 clk = clk_reg_prcc_pclk("p1_pclk5", "per1clk", U8500_CLKRST1_BASE,
237244 BIT(5), 0);
@@ -239,6 +246,7 @@ void u8500_clk_init(void) · 1 unmodified line
239246
240247 clk = clk_reg_prcc_pclk("p1_pclk6", "per1clk", U8500_CLKRST1_BASE,
241248 BIT(6), 0);
249+ clk_register_clkdev(clk, "apb_pclk", "nmk-i2c.2");
242250
243251 clk = clk_reg_prcc_pclk("p1_pclk7", "per1clk", U8500_CLKRST1_BASE,
244252 BIT(7), 0);
@@ -246,6 +254,7 @@ void u8500_clk_init(void) · 1 unmodified line
246254
247255 clk = clk_reg_prcc_pclk("p1_pclk8", "per1clk", U8500_CLKRST1_BASE,
248256 BIT(8), 0);
257+ clk_register_clkdev(clk, "apb_pclk", "slimbus0");
249258
250259 clk = clk_reg_prcc_pclk("p1_pclk9", "per1clk", U8500_CLKRST1_BASE,
251260 BIT(9), 0);
@@ -255,11 +264,16 @@ void u8500_clk_init(void) · 3 unmodified lines
255264
256265 clk = clk_reg_prcc_pclk("p1_pclk10", "per1clk", U8500_CLKRST1_BASE,
257266 BIT(10), 0);
267+ clk_register_clkdev(clk, "apb_pclk", "nmk-i2c.4");
268+
258269 clk = clk_reg_prcc_pclk("p1_pclk11", "per1clk", U8500_CLKRST1_BASE,
259270 BIT(11), 0);
271+ clk_register_clkdev(clk, "apb_pclk", "msp3");
272+ clk_register_clkdev(clk, "apb_pclk", "ux500-msp-i2s.3");
260273
261274 clk = clk_reg_prcc_pclk("p2_pclk0", "per2clk", U8500_CLKRST2_BASE,
262275 BIT(0), 0);
276+ clk_register_clkdev(clk, "apb_pclk", "nmk-i2c.3");
263277
264278 clk = clk_reg_prcc_pclk("p2_pclk1", "per2clk", U8500_CLKRST2_BASE,
265279 BIT(1), 0);
@@ -279,12 +293,13 @@ void u8500_clk_init(void) · 13 unmodified lines
279293
280294 clk = clk_reg_prcc_pclk("p2_pclk5", "per2clk", U8500_CLKRST2_BASE,
281295 BIT(5), 0);
296+ clk_register_clkdev(clk, "apb_pclk", "msp2");
297+ clk_register_clkdev(clk, "apb_pclk", "ux500-msp-i2s.2");
282298
283299 clk = clk_reg_prcc_pclk("p2_pclk6", "per2clk", U8500_CLKRST2_BASE,
284300 BIT(6), 0);
285301 clk_register_clkdev(clk, "apb_pclk", "sdi1");
286302
287−
288303 clk = clk_reg_prcc_pclk("p2_pclk7", "per2clk", U8500_CLKRST2_BASE,
289304 BIT(7), 0);
290305 clk_register_clkdev(clk, "apb_pclk", "sdi3");
@@ -316,10 +331,15 @@ void u8500_clk_init(void) · 25 unmodified lines
316331
317332 clk = clk_reg_prcc_pclk("p3_pclk1", "per3clk", U8500_CLKRST3_BASE,
318333 BIT(1), 0);
334+ clk_register_clkdev(clk, "apb_pclk", "ssp0");
335+
319336 clk = clk_reg_prcc_pclk("p3_pclk2", "per3clk", U8500_CLKRST3_BASE,
320337 BIT(2), 0);
338+ clk_register_clkdev(clk, "apb_pclk", "ssp1");
339+
321340 clk = clk_reg_prcc_pclk("p3_pclk3", "per3clk", U8500_CLKRST3_BASE,
322341 BIT(3), 0);
342+ clk_register_clkdev(clk, "apb_pclk", "nmk-i2c.0");
323343
324344 clk = clk_reg_prcc_pclk("p3_pclk4", "per3clk", U8500_CLKRST3_BASE,
325345 BIT(4), 0);
@@ -401,10 +421,17 @@ void u8500_clk_init(void) · 75 unmodified lines
401421
402422 clk = clk_reg_prcc_kclk("p1_i2c1_kclk", "i2cclk",
403423 U8500_CLKRST1_BASE, BIT(2), CLK_SET_RATE_GATE);
424+ clk_register_clkdev(clk, NULL, "nmk-i2c.1");
425+
404426 clk = clk_reg_prcc_kclk("p1_msp0_kclk", "msp02clk",
405427 U8500_CLKRST1_BASE, BIT(3), CLK_SET_RATE_GATE);
428+ clk_register_clkdev(clk, NULL, "msp0");
429+ clk_register_clkdev(clk, NULL, "ux500-msp-i2s.0");
430+
406431 clk = clk_reg_prcc_kclk("p1_msp1_kclk", "msp1clk",
407432 U8500_CLKRST1_BASE, BIT(4), CLK_SET_RATE_GATE);
433+ clk_register_clkdev(clk, NULL, "msp1");
434+ clk_register_clkdev(clk, NULL, "ux500-msp-i2s.1");
408435
409436 clk = clk_reg_prcc_kclk("p1_sdi0_kclk", "sdmmcclk",
410437 U8500_CLKRST1_BASE, BIT(5), CLK_SET_RATE_GATE);
@@ -412,17 +439,25 @@ void u8500_clk_init(void) · 1 unmodified line
412439
413440 clk = clk_reg_prcc_kclk("p1_i2c2_kclk", "i2cclk",
414441 U8500_CLKRST1_BASE, BIT(6), CLK_SET_RATE_GATE);
442+ clk_register_clkdev(clk, NULL, "nmk-i2c.2");
443+
415444 clk = clk_reg_prcc_kclk("p1_slimbus0_kclk", "slimclk",
416− U8500_CLKRST1_BASE, BIT(3), CLK_SET_RATE_GATE);
417− /* FIXME: Redefinition of BIT(3). */
445+ U8500_CLKRST1_BASE, BIT(8), CLK_SET_RATE_GATE);
446+ clk_register_clkdev(clk, NULL, "slimbus0");
447+
418448 clk = clk_reg_prcc_kclk("p1_i2c4_kclk", "i2cclk",
419449 U8500_CLKRST1_BASE, BIT(9), CLK_SET_RATE_GATE);
450+ clk_register_clkdev(clk, NULL, "nmk-i2c.4");
451+
420452 clk = clk_reg_prcc_kclk("p1_msp3_kclk", "msp1clk",
421453 U8500_CLKRST1_BASE, BIT(10), CLK_SET_RATE_GATE);
454+ clk_register_clkdev(clk, NULL, "msp3");
455+ clk_register_clkdev(clk, NULL, "ux500-msp-i2s.3");
422456
423457 /* Periph2 */
424458 clk = clk_reg_prcc_kclk("p2_i2c3_kclk", "i2cclk",
425459 U8500_CLKRST2_BASE, BIT(0), CLK_SET_RATE_GATE);
460+ clk_register_clkdev(clk, NULL, "nmk-i2c.3");
426461
427462 clk = clk_reg_prcc_kclk("p2_sdi4_kclk", "sdmmcclk",
428463 U8500_CLKRST2_BASE, BIT(2), CLK_SET_RATE_GATE);
@@ -430,6 +465,8 @@ void u8500_clk_init(void) · 1 unmodified line
430465
431466 clk = clk_reg_prcc_kclk("p2_msp2_kclk", "msp02clk",
432467 U8500_CLKRST2_BASE, BIT(3), CLK_SET_RATE_GATE);
468+ clk_register_clkdev(clk, NULL, "msp2");
469+ clk_register_clkdev(clk, NULL, "ux500-msp-i2s.2");
433470
434471 clk = clk_reg_prcc_kclk("p2_sdi1_kclk", "sdmmcclk",
435472 U8500_CLKRST2_BASE, BIT(4), CLK_SET_RATE_GATE);
@@ -450,10 +487,15 @@ void u8500_clk_init(void) · 14 unmodified lines
450487 /* Periph3 */
451488 clk = clk_reg_prcc_kclk("p3_ssp0_kclk", "sspclk",
452489 U8500_CLKRST3_BASE, BIT(1), CLK_SET_RATE_GATE);
490+ clk_register_clkdev(clk, NULL, "ssp0");
491+
453492 clk = clk_reg_prcc_kclk("p3_ssp1_kclk", "sspclk",
454493 U8500_CLKRST3_BASE, BIT(2), CLK_SET_RATE_GATE);
494+ clk_register_clkdev(clk, NULL, "ssp1");
495+
455496 clk = clk_reg_prcc_kclk("p3_i2c0_kclk", "i2cclk",
456497 U8500_CLKRST3_BASE, BIT(3), CLK_SET_RATE_GATE);
498+ clk_register_clkdev(clk, NULL, "nmk-i2c.0");
457499
458500 clk = clk_reg_prcc_kclk("p3_sdi2_kclk", "sdmmcclk",
459501 U8500_CLKRST3_BASE, BIT(4), CLK_SET_RATE_GATE);
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/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+2−2
@@ -143,7 +143,7 @@ static void intel_crt_dpms(struct drm_connector *connector, int mode) · 142 unmodified lines
143143 int old_dpms;
144144
145145 /* PCH platforms and VLV only support on/off. */
146− if (INTEL_INFO(dev)->gen < 5 && mode != DRM_MODE_DPMS_ON)
146+ if (INTEL_INFO(dev)->gen >= 5 && mode != DRM_MODE_DPMS_ON)
147147 mode = DRM_MODE_DPMS_OFF;
148148
149149 if (mode == connector->dpms)
@@ -729,7 +729,7 @@ void intel_crt_init(struct drm_device *dev) · 579 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_display.c+11−0
@@ -3841,6 +3841,17 @@ static bool intel_choose_pipe_bpp_dither(struct drm_crtc *crtc, · 3840 unmodified lines
38413841 }
38423842 }
38433843
3844+ if (intel_encoder->type == INTEL_OUTPUT_EDP) {
3845+ /* Use VBT settings if we have an eDP panel */
3846+ unsigned int edp_bpc = dev_priv->edp.bpp / 3;
3847+
3848+ if (edp_bpc < display_bpc) {
3849+ DRM_DEBUG_KMS("clamping display bpc (was %d) to eDP (%d)\n", display_bpc, edp_bpc);
3850+ display_bpc = edp_bpc;
3851+ }
3852+ continue;
3853+ }
3854+
38443855 /*
38453856 * HDMI is either 12 or 8, so if the display lets 10bpc sneak
38463857 * through, clamp it down. (Note: >12bpc will be caught below.)
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+61−23
@@ -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)
@@ -2360,6 +2382,18 @@ intel_sdvo_output_setup(struct intel_sdvo *intel_sdvo, uint16_t flags) · 1423 unmodified lines
23602382 return true;
23612383 }
23622384
2385+static void intel_sdvo_output_cleanup(struct intel_sdvo *intel_sdvo)
2386+{
2387+ struct drm_device *dev = intel_sdvo->base.base.dev;
2388+ struct drm_connector *connector, *tmp;
2389+
2390+ list_for_each_entry_safe(connector, tmp,
2391+ &dev->mode_config.connector_list, head) {
2392+ if (intel_attached_encoder(connector) == &intel_sdvo->base)
2393+ intel_sdvo_destroy(connector);
2394+ }
2395+}
2396+
23632397 static bool intel_sdvo_tv_create_property(struct intel_sdvo *intel_sdvo,
23642398 struct intel_sdvo_connector *intel_sdvo_connector,
23652399 int type)
@@ -2683,7 +2717,8 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob) · 317 unmodified lines
26832717 intel_sdvo->caps.output_flags) != true) {
26842718 DRM_DEBUG_KMS("SDVO output failed to setup on %s\n",
26852719 SDVO_NAME(intel_sdvo));
2686− goto err;
2720+ /* Output_setup can leave behind connectors! */
2721+ goto err_output;
26872722 }
26882723
26892724 /* Only enable the hotplug irq if we need it, to work around noisy
@@ -2696,12 +2731,12 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob) · 6 unmodified lines
26962731
26972732 /* Set the input timing to the screen. Assume always input 0. */
26982733 if (!intel_sdvo_set_target_input(intel_sdvo))
2699− goto err;
2734+ goto err_output;
27002735
27012736 if (!intel_sdvo_get_input_pixel_clock_range(intel_sdvo,
27022737 &intel_sdvo->pixel_clock_min,
27032738 &intel_sdvo->pixel_clock_max))
2704− goto err;
2739+ goto err_output;
27052740
27062741 DRM_DEBUG_KMS("%s device VID/DID: %02X:%02X.%02X, "
27072742 "clock range %dMHz - %dMHz, "
@@ -2721,6 +2756,9 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob) · 13 unmodified lines
27212756 (SDVO_OUTPUT_TMDS1 | SDVO_OUTPUT_RGB1) ? 'Y' : 'N');
27222757 return true;
27232758
2759+err_output:
2760+ intel_sdvo_output_cleanup(intel_sdvo);
2761+
27242762 err:
27252763 drm_encoder_cleanup(&intel_encoder->base);
27262764 i2c_del_adapter(&intel_sdvo->ddc);
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/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/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/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/atombios_encoders.c+1−1
@@ -1625,7 +1625,7 @@ radeon_atom_encoder_dpms_dig(struct drm_encoder *encoder, int mode) · 1624 unmodified lines
16251625 atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_SETUP, 0, 0);
16261626 atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE, 0, 0);
16271627 /* some early dce3.2 boards have a bug in their transmitter control table */
1628− if ((rdev->family != CHIP_RV710) || (rdev->family != CHIP_RV730))
1628+ if ((rdev->family != CHIP_RV710) && (rdev->family != CHIP_RV730))
16291629 atombios_dig_transmitter_setup(encoder, ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT, 0, 0);
16301630 }
16311631 if (ENCODER_MODE_IS_DP(atombios_get_encoder_mode(encoder)) && connector) {
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/ttm/ttm_page_alloc.c+4−1
@@ -749,7 +749,10 @@ static int ttm_get_pages(struct page **pages, unsigned npages, int flags, · 748 unmodified lines
749749 /* clear the pages coming from the pool if requested */
750750 if (flags & TTM_PAGE_FLAG_ZERO_ALLOC) {
751751 list_for_each_entry(p, &plist, lru) {
752− clear_page(page_address(p));
752+ if (PageHighMem(p))
753+ clear_highpage(p);
754+ else
755+ clear_page(page_address(p));
753756 }
754757 }
755758
drivers/gpu/drm/ttm/ttm_tt.c+0−4
@@ -308,9 +308,7 @@ int ttm_tt_swapin(struct ttm_tt *ttm) · 307 unmodified lines
308308 if (unlikely(to_page == NULL))
309309 goto out_err;
310310
311− preempt_disable();
312311 copy_highpage(to_page, from_page);
313− preempt_enable();
314312 page_cache_release(from_page);
315313 }
316314
@@ -358,9 +356,7 @@ int ttm_tt_swapout(struct ttm_tt *ttm, struct file *persistent_swap_storage) · 41 unmodified lines
358356 ret = PTR_ERR(to_page);
359357 goto out_err;
360358 }
361− preempt_disable();
362359 copy_highpage(to_page, from_page);
363− preempt_enable();
364360 set_page_dirty(to_page);
365361 mark_page_accessed(to_page);
366362 page_cache_release(to_page);
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/gpu/drm/vmwgfx/vmwgfx_ioctl.c+2−0
@@ -110,6 +110,8 @@ int vmw_get_cap_3d_ioctl(struct drm_device *dev, void *data, · 109 unmodified lines
110110 memcpy_fromio(bounce, &fifo_mem[SVGA_FIFO_3D_CAPS], size);
111111
112112 ret = copy_to_user(buffer, bounce, size);
113+ if (ret)
114+ ret = -EFAULT;
113115 vfree(bounce);
114116
115117 if (unlikely(ret != 0))
drivers/hid/hid-microsoft.c+3−3
@@ -46,9 +46,9 @@ static __u8 *ms_report_fixup(struct hid_device *hdev, __u8 *rdesc, · 45 unmodified lines
4646 rdesc[559] = 0x45;
4747 }
4848 /* 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)) {
49+ if ((quirks & MS_RDESC_3K) && *rsize == 106 && rdesc[94] == 0x19 &&
50+ rdesc[95] == 0x00 && rdesc[96] == 0x29 &&
51+ rdesc[97] == 0xff) {
5252 rdesc[94] = 0x35;
5353 rdesc[96] = 0x45;
5454 }
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/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/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/muxes/i2c-mux-pinctrl.c+1−1
@@ -169,7 +169,7 @@ static int __devinit i2c_mux_pinctrl_probe(struct platform_device *pdev) · 168 unmodified lines
169169 mux->busses = devm_kzalloc(&pdev->dev,
170170 sizeof(mux->busses) * mux->pdata->bus_count,
171171 GFP_KERNEL);
172− if (!mux->states) {
172+ if (!mux->busses) {
173173 dev_err(&pdev->dev, "Cannot allocate busses\n");
174174 ret = -ENOMEM;
175175 goto err;
drivers/irqchip/irq-bcm2835.c+2−1
@@ -168,7 +168,8 @@ static int __init armctrl_of_init(struct device_node *node, · 167 unmodified lines
168168 }
169169
170170 static struct of_device_id irq_of_match[] __initconst = {
171− { .compatible = "brcm,bcm2835-armctrl-ic", .data = armctrl_of_init }
171+ { .compatible = "brcm,bcm2835-armctrl-ic", .data = armctrl_of_init },
172+ { }
172173 };
173174
174175 void __init bcm2835_init_irq(void)
drivers/leds/ledtrig-cpu.c+0−21
@@ -33,8 +33,6 @@ · 32 unmodified lines
3333 struct led_trigger_cpu {
3434 char name[MAX_NAME_LEN];
3535 struct led_trigger *_trig;
36− struct mutex lock;
37− int lock_is_inited;
3836 };
3937
4038 static DEFINE_PER_CPU(struct led_trigger_cpu, cpu_trig);
@@ -50,12 +48,6 @@ void ledtrig_cpu(enum cpu_led_event ledevt) · 9 unmodified lines
5048 {
5149 struct led_trigger_cpu *trig = &__get_cpu_var(cpu_trig);
5250
53− /* mutex lock should be initialized before calling mutex_call() */
54− if (!trig->lock_is_inited)
55− return;
56−
57− mutex_lock(&trig->lock);
58−
5951 /* Locate the correct CPU LED */
6052 switch (ledevt) {
6153 case CPU_LED_IDLE_END:
@@ -75,8 +67,6 @@ void ledtrig_cpu(enum cpu_led_event ledevt) · 13 unmodified lines
7567 /* Will leave the LED as it is */
7668 break;
7769 }
78−
79− mutex_unlock(&trig->lock);
8070 }
8171 EXPORT_SYMBOL(ledtrig_cpu);
8272
@@ -117,14 +107,9 @@ static int __init ledtrig_cpu_init(void) · 34 unmodified lines
117107 for_each_possible_cpu(cpu) {
118108 struct led_trigger_cpu *trig = &per_cpu(cpu_trig, cpu);
119109
120− mutex_init(&trig->lock);
121−
122110 snprintf(trig->name, MAX_NAME_LEN, "cpu%d", cpu);
123111
124− mutex_lock(&trig->lock);
125112 led_trigger_register_simple(trig->name, &trig->_trig);
126− trig->lock_is_inited = 1;
127− mutex_unlock(&trig->lock);
128113 }
129114
130115 register_syscore_ops(&ledtrig_cpu_syscore_ops);
@@ -142,15 +127,9 @@ static void __exit ledtrig_cpu_exit(void) · 11 unmodified lines
142127 for_each_possible_cpu(cpu) {
143128 struct led_trigger_cpu *trig = &per_cpu(cpu_trig, cpu);
144129
145− mutex_lock(&trig->lock);
146−
147130 led_trigger_unregister_simple(trig->_trig);
148131 trig->_trig = NULL;
149132 memset(trig->name, 0, MAX_NAME_LEN);
150− trig->lock_is_inited = 0;
151−
152− mutex_unlock(&trig->lock);
153− mutex_destroy(&trig->lock);
154133 }
155134
156135 unregister_syscore_ops(&ledtrig_cpu_syscore_ops);
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/ethernet/jme.c+8−20
@@ -1860,10 +1860,14 @@ jme_open(struct net_device *netdev) · 1859 unmodified lines
18601860 jme_clear_pm(jme);
18611861 JME_NAPI_ENABLE(jme);
18621862
1863− tasklet_enable(&jme->linkch_task);
1864− tasklet_enable(&jme->txclean_task);
1865− tasklet_hi_enable(&jme->rxclean_task);
1866− tasklet_hi_enable(&jme->rxempty_task);
1863+ tasklet_init(&jme->linkch_task, jme_link_change_tasklet,
1864+ (unsigned long) jme);
1865+ tasklet_init(&jme->txclean_task, jme_tx_clean_tasklet,
1866+ (unsigned long) jme);
1867+ tasklet_init(&jme->rxclean_task, jme_rx_clean_tasklet,
1868+ (unsigned long) jme);
1869+ tasklet_init(&jme->rxempty_task, jme_rx_empty_tasklet,
1870+ (unsigned long) jme);
18671871
18681872 rc = jme_request_irq(jme);
18691873 if (rc)
@@ -3079,22 +3083,6 @@ jme_init_one(struct pci_dev *pdev, · 1209 unmodified lines
30793083 tasklet_init(&jme->pcc_task,
30803084 jme_pcc_tasklet,
30813085 (unsigned long) jme);
3082− tasklet_init(&jme->linkch_task,
3083− jme_link_change_tasklet,
3084− (unsigned long) jme);
3085− tasklet_init(&jme->txclean_task,
3086− jme_tx_clean_tasklet,
3087− (unsigned long) jme);
3088− tasklet_init(&jme->rxclean_task,
3089− jme_rx_clean_tasklet,
3090− (unsigned long) jme);
3091− tasklet_init(&jme->rxempty_task,
3092− jme_rx_empty_tasklet,
3093− (unsigned long) jme);
3094− tasklet_disable_nosync(&jme->linkch_task);
3095− tasklet_disable_nosync(&jme->txclean_task);
3096− tasklet_disable_nosync(&jme->rxclean_task);
3097− tasklet_disable_nosync(&jme->rxempty_task);
30983086 jme->dpi.cur = PCC_P1;
30993087
31003088 jme->reg_ghc = 0;
drivers/net/ethernet/micrel/ksz884x.c+4−12
@@ -5459,8 +5459,10 @@ static int prepare_hardware(struct net_device *dev) · 5458 unmodified lines
54595459 rc = request_irq(dev->irq, netdev_intr, IRQF_SHARED, dev->name, dev);
54605460 if (rc)
54615461 return rc;
5462− tasklet_enable(&hw_priv->rx_tasklet);
5463− tasklet_enable(&hw_priv->tx_tasklet);
5462+ tasklet_init(&hw_priv->rx_tasklet, rx_proc_task,
5463+ (unsigned long) hw_priv);
5464+ tasklet_init(&hw_priv->tx_tasklet, tx_proc_task,
5465+ (unsigned long) hw_priv);
54645466
54655467 hw->promiscuous = 0;
54665468 hw->all_multi = 0;
@@ -7033,16 +7035,6 @@ static int __devinit pcidev_init(struct pci_dev *pdev, · 1566 unmodified lines
70337035 spin_lock_init(&hw_priv->hwlock);
70347036 mutex_init(&hw_priv->lock);
70357037
7036− /* tasklet is enabled. */
7037− tasklet_init(&hw_priv->rx_tasklet, rx_proc_task,
7038− (unsigned long) hw_priv);
7039− tasklet_init(&hw_priv->tx_tasklet, tx_proc_task,
7040− (unsigned long) hw_priv);
7041−
7042− /* tasklet_enable will decrement the atomic counter. */
7043− tasklet_disable(&hw_priv->rx_tasklet);
7044− tasklet_disable(&hw_priv->tx_tasklet);
7045−
70467038 for (i = 0; i < TOTAL_PORT_NUM; i++)
70477039 init_waitqueue_head(&hw_priv->counter[i].counter);
70487040
drivers/net/ethernet/smsc/smsc911x.c+15−2
@@ -2110,7 +2110,7 @@ static void __devinit smsc911x_read_mac_address(struct net_device *dev) · 2109 unmodified lines
21102110 static int __devinit smsc911x_init(struct net_device *dev)
21112111 {
21122112 struct smsc911x_data *pdata = netdev_priv(dev);
2113− unsigned int byte_test;
2113+ unsigned int byte_test, mask;
21142114 unsigned int to = 100;
21152115
21162116 SMSC_TRACE(pdata, probe, "Driver Parameters:");
@@ -2130,9 +2130,22 @@ static int __devinit smsc911x_init(struct net_device *dev) · 13 unmodified lines
21302130 /*
21312131 * poll the READY bit in PMT_CTRL. Any other access to the device is
21322132 * forbidden while this bit isn't set. Try for 100ms
2133+ *
2134+ * Note that this test is done before the WORD_SWAP register is
2135+ * programmed. So in some configurations the READY bit is at 16 before
2136+ * WORD_SWAP is written to. This issue is worked around by waiting
2137+ * until either bit 0 or bit 16 gets set in PMT_CTRL.
2138+ *
2139+ * SMSC has confirmed that checking bit 16 (marked as reserved in
2140+ * the datasheet) is fine since these bits "will either never be set
2141+ * or can only go high after READY does (so also indicate the device
2142+ * is ready)".
21332143 */
2134− while (!(smsc911x_reg_read(pdata, PMT_CTRL) & PMT_CTRL_READY_) && --to)
2144+
2145+ mask = PMT_CTRL_READY_ | swahw32(PMT_CTRL_READY_);
2146+ while (!(smsc911x_reg_read(pdata, PMT_CTRL) & mask) && --to)
21352147 udelay(1000);
2148+
21362149 if (to == 0) {
21372150 pr_err("Device not READY in 100ms aborting\n");
21382151 return -ENODEV;
drivers/net/ethernet/tile/tilegx.c+1−1
@@ -917,7 +917,7 @@ static int tile_net_setup_interrupts(struct net_device *dev) · 916 unmodified lines
917917 ingress_irq = rc;
918918 tile_irq_activate(ingress_irq, TILE_IRQ_PERCPU);
919919 rc = request_irq(ingress_irq, tile_net_handle_ingress_irq,
920− 0, NULL, NULL);
920+ 0, "tile_net", NULL);
921921 if (rc != 0) {
922922 netdev_err(dev, "request_irq failed: %d\n", rc);
923923 destroy_irq(ingress_irq);
drivers/net/ethernet/xilinx/xilinx_axienet_main.c+6−6
@@ -942,6 +942,10 @@ static int axienet_open(struct net_device *ndev) · 941 unmodified lines
942942 phy_start(lp->phy_dev);
943943 }
944944
945+ /* Enable tasklets for Axi DMA error handling */
946+ tasklet_init(&lp->dma_err_tasklet, axienet_dma_err_handler,
947+ (unsigned long) lp);
948+
945949 /* Enable interrupts for Axi DMA Tx */
946950 ret = request_irq(lp->tx_irq, axienet_tx_irq, 0, ndev->name, ndev);
947951 if (ret)
@@ -950,8 +954,7 @@ static int axienet_open(struct net_device *ndev) · 2 unmodified lines
950954 ret = request_irq(lp->rx_irq, axienet_rx_irq, 0, ndev->name, ndev);
951955 if (ret)
952956 goto err_rx_irq;
953− /* Enable tasklets for Axi DMA error handling */
954− tasklet_enable(&lp->dma_err_tasklet);
957+
955958 return 0;
956959
957960 err_rx_irq:
@@ -960,6 +963,7 @@ err_tx_irq: · 2 unmodified lines
960963 if (lp->phy_dev)
961964 phy_disconnect(lp->phy_dev);
962965 lp->phy_dev = NULL;
966+ tasklet_kill(&lp->dma_err_tasklet);
963967 dev_err(lp->dev, "request_irq() failed\n");
964968 return ret;
965969 }
@@ -1613,10 +1617,6 @@ static int __devinit axienet_of_probe(struct platform_device *op) · 647 unmodified lines
16131617 goto err_iounmap_2;
16141618 }
16151619
1616− tasklet_init(&lp->dma_err_tasklet, axienet_dma_err_handler,
1617− (unsigned long) lp);
1618− tasklet_disable(&lp->dma_err_tasklet);
1619−
16201620 return 0;
16211621
16221622 err_iounmap_2:
drivers/net/phy/mdio-bitbang.c+0−1
@@ -234,7 +234,6 @@ 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);
238237 mdiobus_free(bus);
239238 }
240239 EXPORT_SYMBOL(free_mdio_bitbang);
drivers/net/usb/cdc_ncm.c+18−4
@@ -440,10 +440,12 @@ advance: · 439 unmodified lines
440440 ((!ctx->mbim_desc) && ((ctx->ether_desc == NULL) || (ctx->control != intf))))
441441 goto error;
442442
443− /* claim interfaces, if any */
444− temp = usb_driver_claim_interface(driver, ctx->data, dev);
445− if (temp)
446− goto error;
443+ /* claim data interface, if different from control */
444+ if (ctx->data != ctx->control) {
445+ temp = usb_driver_claim_interface(driver, ctx->data, dev);
446+ if (temp)
447+ goto error;
448+ }
447449
448450 iface_no = ctx->data->cur_altsetting->desc.bInterfaceNumber;
449451
@@ -519,6 +521,10 @@ void cdc_ncm_unbind(struct usbnet *dev, struct usb_interface *intf) · 69 unmodified lines
519521
520522 tasklet_kill(&ctx->bh);
521523
524+ /* handle devices with combined control and data interface */
525+ if (ctx->control == ctx->data)
526+ ctx->data = NULL;
527+
522528 /* disconnect master --> disconnect slave */
523529 if (intf == ctx->control && ctx->data) {
524530 usb_set_intfdata(ctx->data, NULL);
@@ -1186,6 +1192,14 @@ static const struct usb_device_id cdc_devs[] = { · 661 unmodified lines
11861192 .driver_info = (unsigned long) &wwan_info,
11871193 },
11881194
1195+ /* Huawei NCM devices disguised as vendor specific */
1196+ { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x02, 0x16),
1197+ .driver_info = (unsigned long)&wwan_info,
1198+ },
1199+ { USB_VENDOR_AND_INTERFACE_INFO(0x12d1, 0xff, 0x02, 0x46),
1200+ .driver_info = (unsigned long)&wwan_info,
1201+ },
1202+
11891203 /* Generic CDC-NCM devices */
11901204 { USB_INTERFACE_INFO(USB_CLASS_COMM,
11911205 USB_CDC_SUBCLASS_NCM, USB_CDC_PROTO_NONE),
drivers/net/usb/smsc95xx.c+2−2
@@ -203,7 +203,7 @@ static int smsc95xx_mdio_read(struct net_device *netdev, int phy_id, int idx) · 202 unmodified lines
203203 /* set the address, index & direction (read from PHY) */
204204 phy_id &= dev->mii.phy_id_mask;
205205 idx &= dev->mii.reg_num_mask;
206− addr = (phy_id << 11) | (idx << 6) | MII_READ_;
206+ addr = (phy_id << 11) | (idx << 6) | MII_READ_ | MII_BUSY_;
207207 ret = smsc95xx_write_reg(dev, MII_ADDR, addr);
208208 check_warn_goto_done(ret, "Error writing MII_ADDR");
209209
@@ -240,7 +240,7 @@ static void smsc95xx_mdio_write(struct net_device *netdev, int phy_id, int idx, · 30 unmodified lines
240240 /* set the address, index & direction (write to PHY) */
241241 phy_id &= dev->mii.phy_id_mask;
242242 idx &= dev->mii.reg_num_mask;
243− addr = (phy_id << 11) | (idx << 6) | MII_WRITE_;
243+ addr = (phy_id << 11) | (idx << 6) | MII_WRITE_ | MII_BUSY_;
244244 ret = smsc95xx_write_reg(dev, MII_ADDR, addr);
245245 check_warn_goto_done(ret, "Error writing MII_ADDR");
246246
drivers/net/vxlan.c+7−3
@@ -1,5 +1,5 @@
11 /*
2− * VXLAN: Virtual eXtensiable Local Area Network
2+ * VXLAN: Virtual eXtensible Local Area Network
33 *
44 * Copyright (c) 2012 Vyatta Inc.
55 *
@@ -50,8 +50,8 @@ · 44 unmodified lines
5050
5151 #define VXLAN_N_VID (1u << 24)
5252 #define VXLAN_VID_MASK (VXLAN_N_VID - 1)
53−/* VLAN + IP header + UDP + VXLAN */
54−#define VXLAN_HEADROOM (4 + 20 + 8 + 8)
53+/* IP header + UDP + VXLAN + Ethernet header */
54+#define VXLAN_HEADROOM (20 + 8 + 8 + 14)
5555
5656 #define VXLAN_FLAGS 0x08000000 /* struct vxlanhdr.vx_flags required value. */
5757
@@ -1102,6 +1102,10 @@ static int vxlan_newlink(struct net *net, struct net_device *dev, · 1044 unmodified lines
11021102
11031103 if (!tb[IFLA_MTU])
11041104 dev->mtu = lowerdev->mtu - VXLAN_HEADROOM;
1105+
1106+ /* update header length based on lower device */
1107+ dev->hard_header_len = lowerdev->hard_header_len +
1108+ VXLAN_HEADROOM;
11051109 }
11061110
11071111 if (data[IFLA_VXLAN_TOS])
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c+1−1
@@ -4197,7 +4197,7 @@ static s32 brcmf_mode_to_nl80211_iftype(s32 mode) · 4196 unmodified lines
41974197
41984198 static void brcmf_wiphy_pno_params(struct wiphy *wiphy)
41994199 {
4200−#ifndef CONFIG_BRCMFISCAN
4200+#ifndef CONFIG_BRCMISCAN
42014201 /* scheduled scan settings */
42024202 wiphy->max_sched_scan_ssids = BRCMF_PNO_MAX_PFN_COUNT;
42034203 wiphy->max_match_sets = BRCMF_PNO_MAX_PFN_COUNT;
drivers/net/wireless/iwlwifi/dvm/mac80211.c+1−1
@@ -521,7 +521,7 @@ static void iwlagn_mac_tx(struct ieee80211_hw *hw, · 520 unmodified lines
521521 ieee80211_get_tx_rate(hw, IEEE80211_SKB_CB(skb))->bitrate);
522522
523523 if (iwlagn_tx_skb(priv, control->sta, skb))
524− dev_kfree_skb_any(skb);
524+ ieee80211_free_txskb(hw, skb);
525525 }
526526
527527 static void iwlagn_mac_update_tkip_key(struct ieee80211_hw *hw,
drivers/net/wireless/iwlwifi/dvm/main.c+1−1
@@ -2113,7 +2113,7 @@ static void iwl_free_skb(struct iwl_op_mode *op_mode, struct sk_buff *skb) · 2112 unmodified lines
21132113
21142114 info = IEEE80211_SKB_CB(skb);
21152115 iwl_trans_free_tx_cmd(priv->trans, info->driver_data[1]);
2116− dev_kfree_skb_any(skb);
2116+ ieee80211_free_txskb(priv->hw, skb);
21172117 }
21182118
21192119 static void iwl_set_hw_rfkill_state(struct iwl_op_mode *op_mode, bool state)
drivers/net/wireless/iwlwifi/pcie/rx.c+21−2
@@ -321,6 +321,14 @@ static void iwl_rx_allocate(struct iwl_trans *trans, gfp_t priority) · 320 unmodified lines
321321 dma_map_page(trans->dev, page, 0,
322322 PAGE_SIZE << trans_pcie->rx_page_order,
323323 DMA_FROM_DEVICE);
324+ if (dma_mapping_error(trans->dev, rxb->page_dma)) {
325+ rxb->page = NULL;
326+ spin_lock_irqsave(&rxq->lock, flags);
327+ list_add(&rxb->list, &rxq->rx_used);
328+ spin_unlock_irqrestore(&rxq->lock, flags);
329+ __free_pages(page, trans_pcie->rx_page_order);
330+ return;
331+ }
324332 /* dma address must be no more than 36 bits */
325333 BUG_ON(rxb->page_dma & ~DMA_BIT_MASK(36));
326334 /* and also 256 byte aligned! */
@@ -489,8 +497,19 @@ static void iwl_rx_handle_rxbuf(struct iwl_trans *trans, · 162 unmodified lines
489497 dma_map_page(trans->dev, rxb->page, 0,
490498 PAGE_SIZE << trans_pcie->rx_page_order,
491499 DMA_FROM_DEVICE);
492− list_add_tail(&rxb->list, &rxq->rx_free);
493− rxq->free_count++;
500+ if (dma_mapping_error(trans->dev, rxb->page_dma)) {
501+ /*
502+ * free the page(s) as well to not break
503+ * the invariant that the items on the used
504+ * list have no page(s)
505+ */
506+ __free_pages(rxb->page, trans_pcie->rx_page_order);
507+ rxb->page = NULL;
508+ list_add_tail(&rxb->list, &rxq->rx_used);
509+ } else {
510+ list_add_tail(&rxb->list, &rxq->rx_free);
511+ rxq->free_count++;
512+ }
494513 } else
495514 list_add_tail(&rxb->list, &rxq->rx_used);
496515 spin_unlock_irqrestore(&rxq->lock, flags);
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/rapidio/rio.c+1−1
@@ -401,7 +401,7 @@ EXPORT_SYMBOL_GPL(rio_release_inb_pwrite); · 400 unmodified lines
401401 /**
402402 * rio_map_inb_region -- Map inbound memory region.
403403 * @mport: Master port.
404− * @lstart: physical address of memory region to be mapped
404+ * @local: physical address of memory region to be mapped
405405 * @rbase: RIO base address assigned to this window
406406 * @size: Size of the memory region
407407 * @rflags: Flags for mapping.
drivers/regulator/core.c+20−13
@@ -1381,22 +1381,14 @@ struct regulator *regulator_get_exclusive(struct device *dev, const char *id) · 1380 unmodified lines
13811381 }
13821382 EXPORT_SYMBOL_GPL(regulator_get_exclusive);
13831383
1384−/**
1385− * regulator_put - "free" the regulator source
1386− * @regulator: regulator source
1387− *
1388− * Note: drivers must ensure that all regulator_enable calls made on this
1389− * regulator source are balanced by regulator_disable calls prior to calling
1390− * this function.
1391− */
1392−void regulator_put(struct regulator *regulator)
1384+/* Locks held by regulator_put() */
1385+static void _regulator_put(struct regulator *regulator)
13931386 {
13941387 struct regulator_dev *rdev;
13951388
13961389 if (regulator == NULL || IS_ERR(regulator))
13971390 return;
13981391
1399− mutex_lock(&regulator_list_mutex);
14001392 rdev = regulator->rdev;
14011393
14021394 debugfs_remove_recursive(regulator->debugfs);
@@ -1412,6 +1404,20 @@ void regulator_put(struct regulator *regulator) · 9 unmodified lines
14121404 rdev->exclusive = 0;
14131405
14141406 module_put(rdev->owner);
1407+}
1408+
1409+/**
1410+ * regulator_put - "free" the regulator source
1411+ * @regulator: regulator source
1412+ *
1413+ * Note: drivers must ensure that all regulator_enable calls made on this
1414+ * regulator source are balanced by regulator_disable calls prior to calling
1415+ * this function.
1416+ */
1417+void regulator_put(struct regulator *regulator)
1418+{
1419+ mutex_lock(&regulator_list_mutex);
1420+ _regulator_put(regulator);
14151421 mutex_unlock(&regulator_list_mutex);
14161422 }
14171423 EXPORT_SYMBOL_GPL(regulator_put);
@@ -1974,7 +1980,7 @@ int regulator_is_supported_voltage(struct regulator *regulator, · 556 unmodified lines
19741980 if (!(rdev->constraints->valid_ops_mask & REGULATOR_CHANGE_VOLTAGE)) {
19751981 ret = regulator_get_voltage(regulator);
19761982 if (ret >= 0)
1977− return (min_uV >= ret && ret <= max_uV);
1983+ return (min_uV <= ret && ret <= max_uV);
19781984 else
19791985 return ret;
19801986 }
@@ -3365,7 +3371,7 @@ regulator_register(const struct regulator_desc *regulator_desc, · 1384 unmodified lines
33653371 if (ret != 0) {
33663372 rdev_err(rdev, "Failed to request enable GPIO%d: %d\n",
33673373 config->ena_gpio, ret);
3368− goto clean;
3374+ goto wash;
33693375 }
33703376
33713377 rdev->ena_gpio = config->ena_gpio;
@@ -3445,10 +3451,11 @@ unset_supplies: · 73 unmodified lines
34453451
34463452 scrub:
34473453 if (rdev->supply)
3448− regulator_put(rdev->supply);
3454+ _regulator_put(rdev->supply);
34493455 if (rdev->ena_gpio)
34503456 gpio_free(rdev->ena_gpio);
34513457 kfree(rdev->constraints);
3458+wash:
34523459 device_unregister(&rdev->dev);
34533460 /* device core frees rdev */
34543461 rdev = ERR_PTR(ret);
drivers/s390/char/con3215.c+5−7
@@ -44,7 +44,6 @@ · 43 unmodified lines
4444 #define RAW3215_NR_CCWS 3
4545 #define RAW3215_TIMEOUT HZ/10 /* time for delayed output */
4646
47−#define RAW3215_FIXED 1 /* 3215 console device is not be freed */
4847 #define RAW3215_WORKING 4 /* set if a request is being worked on */
4948 #define RAW3215_THROTTLED 8 /* set if reading is disabled */
5049 #define RAW3215_STOPPED 16 /* set if writing is disabled */
@@ -339,8 +338,10 @@ static void raw3215_wakeup(unsigned long data) · 288 unmodified lines
339338 struct tty_struct *tty;
340339
341340 tty = tty_port_tty_get(&raw->port);
342− tty_wakeup(tty);
343− tty_kref_put(tty);
341+ if (tty) {
342+ tty_wakeup(tty);
343+ tty_kref_put(tty);
344+ }
344345 }
345346
346347 /*
@@ -629,8 +630,7 @@ static void raw3215_shutdown(struct raw3215_info *raw) · 282 unmodified lines
629630 DECLARE_WAITQUEUE(wait, current);
630631 unsigned long flags;
631632
632− if (!(raw->port.flags & ASYNC_INITIALIZED) ||
633− (raw->flags & RAW3215_FIXED))
633+ if (!(raw->port.flags & ASYNC_INITIALIZED))
634634 return;
635635 /* Wait for outstanding requests, then free irq */
636636 spin_lock_irqsave(get_ccwdev_lock(raw->cdev), flags);
@@ -926,8 +926,6 @@ static int __init con3215_init(void) · 289 unmodified lines
926926 dev_set_drvdata(&cdev->dev, raw);
927927 cdev->handler = raw3215_irq;
928928
929− raw->flags |= RAW3215_FIXED;
930−
931929 /* Request the console irq */
932930 if (raw3215_startup(raw) != 0) {
933931 raw3215_free_info(raw);
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/s390/net/qeth_core_main.c+22−2
@@ -2942,13 +2942,33 @@ static int qeth_query_ipassists_cb(struct qeth_card *card, · 2941 unmodified lines
29422942 QETH_DBF_TEXT(SETUP, 2, "qipasscb");
29432943
29442944 cmd = (struct qeth_ipa_cmd *) data;
2945+
2946+ switch (cmd->hdr.return_code) {
2947+ case IPA_RC_NOTSUPP:
2948+ case IPA_RC_L2_UNSUPPORTED_CMD:
2949+ QETH_DBF_TEXT(SETUP, 2, "ipaunsup");
2950+ card->options.ipa4.supported_funcs |= IPA_SETADAPTERPARMS;
2951+ card->options.ipa6.supported_funcs |= IPA_SETADAPTERPARMS;
2952+ return -0;
2953+ default:
2954+ if (cmd->hdr.return_code) {
2955+ QETH_DBF_MESSAGE(1, "%s IPA_CMD_QIPASSIST: Unhandled "
2956+ "rc=%d\n",
2957+ dev_name(&card->gdev->dev),
2958+ cmd->hdr.return_code);
2959+ return 0;
2960+ }
2961+ }
2962+
29452963 if (cmd->hdr.prot_version == QETH_PROT_IPV4) {
29462964 card->options.ipa4.supported_funcs = cmd->hdr.ipa_supported;
29472965 card->options.ipa4.enabled_funcs = cmd->hdr.ipa_enabled;
2948− } else {
2966+ } else if (cmd->hdr.prot_version == QETH_PROT_IPV6) {
29492967 card->options.ipa6.supported_funcs = cmd->hdr.ipa_supported;
29502968 card->options.ipa6.enabled_funcs = cmd->hdr.ipa_enabled;
2951− }
2969+ } else
2970+ QETH_DBF_MESSAGE(1, "%s IPA_CMD_QIPASSIST: Flawed LIC detected"
2971+ "\n", dev_name(&card->gdev->dev));
29522972 QETH_DBF_TEXT(SETUP, 2, "suppenbl");
29532973 QETH_DBF_TEXT_(SETUP, 2, "%08x", (__u32)cmd->hdr.ipa_supported);
29542974 QETH_DBF_TEXT_(SETUP, 2, "%08x", (__u32)cmd->hdr.ipa_enabled);
drivers/s390/net/qeth_l2_main.c+8−5
@@ -626,10 +626,13 @@ static int qeth_l2_request_initial_mac(struct qeth_card *card) · 625 unmodified lines
626626 QETH_DBF_TEXT(SETUP, 2, "doL2init");
627627 QETH_DBF_TEXT_(SETUP, 2, "doL2%s", CARD_BUS_ID(card));
628628
629− rc = qeth_query_setadapterparms(card);
630− if (rc) {
631− QETH_DBF_MESSAGE(2, "could not query adapter parameters on "
632− "device %s: x%x\n", CARD_BUS_ID(card), rc);
629+ if (qeth_is_supported(card, IPA_SETADAPTERPARMS)) {
630+ rc = qeth_query_setadapterparms(card);
631+ if (rc) {
632+ QETH_DBF_MESSAGE(2, "could not query adapter "
633+ "parameters on device %s: x%x\n",
634+ CARD_BUS_ID(card), rc);
635+ }
633636 }
634637
635638 if (card->info.type == QETH_CARD_TYPE_IQD ||
@@ -676,7 +679,7 @@ static int qeth_l2_set_mac_address(struct net_device *dev, void *p) · 40 unmodified lines
676679 return -ERESTARTSYS;
677680 }
678681 rc = qeth_l2_send_delmac(card, &card->dev->dev_addr[0]);
679− if (!rc)
682+ if (!rc || (rc == IPA_RC_L2_MAC_NOT_FOUND))
680683 rc = qeth_l2_send_setmac(card, addr->sa_data);
681684 return rc ? -EINVAL : 0;
682685 }
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/staging/android/android_alarm.h+1−3
@@ -51,12 +51,10 @@ enum android_alarm_return_flags { · 50 unmodified lines
5151 #define ANDROID_ALARM_WAIT _IO('a', 1)
5252
5353 #define ALARM_IOW(c, type, size) _IOW('a', (c) | ((type) << 4), size)
54−#define ALARM_IOR(c, type, size) _IOR('a', (c) | ((type) << 4), size)
55−
5654 /* Set alarm */
5755 #define ANDROID_ALARM_SET(type) ALARM_IOW(2, type, struct timespec)
5856 #define ANDROID_ALARM_SET_AND_WAIT(type) ALARM_IOW(3, type, struct timespec)
59−#define ANDROID_ALARM_GET_TIME(type) ALARM_IOR(4, type, struct timespec)
57+#define ANDROID_ALARM_GET_TIME(type) ALARM_IOW(4, type, struct timespec)
6058 #define ANDROID_ALARM_SET_RTC _IOW('a', 5, struct timespec)
6159 #define ANDROID_ALARM_BASE_CMD(cmd) (cmd & ~(_IOC(0, 0, 0xf0, 0)))
6260 #define ANDROID_ALARM_IOCTL_TO_TYPE(cmd) (_IOC_NR(cmd) >> 4)
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/tty/hvc/hvc_console.c+0−7
@@ -424,7 +424,6 @@ static void hvc_hangup(struct tty_struct *tty) · 423 unmodified lines
424424 {
425425 struct hvc_struct *hp = tty->driver_data;
426426 unsigned long flags;
427− int temp_open_count;
428427
429428 if (!hp)
430429 return;
@@ -444,7 +443,6 @@ static void hvc_hangup(struct tty_struct *tty) · 13 unmodified lines
444443 return;
445444 }
446445
447− temp_open_count = hp->port.count;
448446 hp->port.count = 0;
449447 spin_unlock_irqrestore(&hp->port.lock, flags);
450448 tty_port_tty_set(&hp->port, NULL);
@@ -453,11 +451,6 @@ static void hvc_hangup(struct tty_struct *tty) · 2 unmodified lines
453451
454452 if (hp->ops->notifier_hangup)
455453 hp->ops->notifier_hangup(hp, hp->data);
456−
457− while(temp_open_count) {
458− --temp_open_count;
459− tty_port_put(&hp->port);
460− }
461454 }
462455
463456 /*
drivers/tty/serial/max310x.c+1−0
@@ -1239,6 +1239,7 @@ static int __devexit max310x_remove(struct spi_device *spi) · 1238 unmodified lines
12391239 static const struct spi_device_id max310x_id_table[] = {
12401240 { "max3107", MAX310X_TYPE_MAX3107 },
12411241 { "max3108", MAX310X_TYPE_MAX3108 },
1242+ { }
12421243 };
12431244 MODULE_DEVICE_TABLE(spi, max310x_id_table);
12441245
drivers/usb/core/hcd.c+16−0
@@ -2151,8 +2151,15 @@ EXPORT_SYMBOL_GPL(usb_bus_start_enum); · 2150 unmodified lines
21512151 irqreturn_t usb_hcd_irq (int irq, void *__hcd)
21522152 {
21532153 struct usb_hcd *hcd = __hcd;
2154+ unsigned long flags;
21542155 irqreturn_t rc;
21552156
2157+ /* IRQF_DISABLED doesn't work correctly with shared IRQs
2158+ * when the first handler doesn't use it. So let's just
2159+ * assume it's never used.
2160+ */
2161+ local_irq_save(flags);
2162+
21562163 if (unlikely(HCD_DEAD(hcd) || !HCD_HW_ACCESSIBLE(hcd)))
21572164 rc = IRQ_NONE;
21582165 else if (hcd->driver->irq(hcd) == IRQ_NONE)
@@ -2160,6 +2167,7 @@ irqreturn_t usb_hcd_irq (int irq, void *__hcd) · 1 unmodified line
21602167 else
21612168 rc = IRQ_HANDLED;
21622169
2170+ local_irq_restore(flags);
21632171 return rc;
21642172 }
21652173 EXPORT_SYMBOL_GPL(usb_hcd_irq);
@@ -2347,6 +2355,14 @@ static int usb_hcd_request_irqs(struct usb_hcd *hcd, · 181 unmodified lines
23472355 int retval;
23482356
23492357 if (hcd->driver->irq) {
2358+
2359+ /* IRQF_DISABLED doesn't work as advertised when used together
2360+ * with IRQF_SHARED. As usb_hcd_irq() will always disable
2361+ * interrupts we can remove it here.
2362+ */
2363+ if (irqflags & IRQF_SHARED)
2364+ irqflags &= ~IRQF_DISABLED;
2365+
23502366 snprintf(hcd->irq_descr, sizeof(hcd->irq_descr), "%s:usb%d",
23512367 hcd->driver->description, hcd->self.busnum);
23522368 retval = request_irq(irqnum, &usb_hcd_irq, irqflags,
drivers/usb/early/ehci-dbgp.c+9−6
@@ -20,6 +20,7 @@ · 19 unmodified lines
2020 #include <linux/usb/ehci_def.h>
2121 #include <linux/delay.h>
2222 #include <linux/serial_core.h>
23+#include <linux/kconfig.h>
2324 #include <linux/kgdb.h>
2425 #include <linux/kthread.h>
2526 #include <asm/io.h>
@@ -614,12 +615,6 @@ err: · 588 unmodified lines
614615 return -ENODEV;
615616 }
616617
617−int dbgp_external_startup(struct usb_hcd *hcd)
618−{
619− return xen_dbgp_external_startup(hcd) ?: _dbgp_external_startup();
620−}
621−EXPORT_SYMBOL_GPL(dbgp_external_startup);
622−
623618 static int ehci_reset_port(int port)
624619 {
625620 u32 portsc;
@@ -979,6 +974,7 @@ struct console early_dbgp_console = { · 353 unmodified lines
979974 .index = -1,
980975 };
981976
977+#if IS_ENABLED(CONFIG_USB_EHCI_HCD)
982978 int dbgp_reset_prep(struct usb_hcd *hcd)
983979 {
984980 int ret = xen_dbgp_reset_prep(hcd);
@@ -1007,6 +1003,13 @@ int dbgp_reset_prep(struct usb_hcd *hcd) · 22 unmodified lines
10071003 }
10081004 EXPORT_SYMBOL_GPL(dbgp_reset_prep);
10091005
1006+int dbgp_external_startup(struct usb_hcd *hcd)
1007+{
1008+ return xen_dbgp_external_startup(hcd) ?: _dbgp_external_startup();
1009+}
1010+EXPORT_SYMBOL_GPL(dbgp_external_startup);
1011+#endif /* USB_EHCI_HCD */
1012+
10101013 #ifdef CONFIG_KGDB
10111014
10121015 static char kgdbdbgp_buf[DBGP_MAX_PACKET];
drivers/usb/host/ehci-ls1x.c+1−1
@@ -113,7 +113,7 @@ static int ehci_hcd_ls1x_probe(struct platform_device *pdev) · 112 unmodified lines
113113 goto err_put_hcd;
114114 }
115115
116− ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
116+ ret = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED);
117117 if (ret)
118118 goto err_put_hcd;
119119
drivers/usb/host/ohci-xls.c+1−1
@@ -56,7 +56,7 @@ static int ohci_xls_probe_internal(const struct hc_driver *driver, · 55 unmodified lines
5656 goto err3;
5757 }
5858
59− retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
59+ retval = usb_add_hcd(hcd, irq, IRQF_DISABLED | IRQF_SHARED);
6060 if (retval != 0)
6161 goto err4;
6262 return retval;
drivers/usb/musb/musb_gadget.c+26−4
@@ -707,11 +707,12 @@ static void rxstate(struct musb *musb, struct musb_request *req) · 706 unmodified lines
707707 fifo_count = musb_readw(epio, MUSB_RXCOUNT);
708708
709709 /*
710− * use mode 1 only if we expect data of at least ep packet_sz
711− * and have not yet received a short packet
710+ * Enable Mode 1 on RX transfers only when short_not_ok flag
711+ * is set. Currently short_not_ok flag is set only from
712+ * file_storage and f_mass_storage drivers
712713 */
713− if ((request->length - request->actual >= musb_ep->packet_sz) &&
714− (fifo_count >= musb_ep->packet_sz))
714+
715+ if (request->short_not_ok && fifo_count == musb_ep->packet_sz)
715716 use_mode_1 = 1;
716717 else
717718 use_mode_1 = 0;
@@ -727,6 +728,27 @@ static void rxstate(struct musb *musb, struct musb_request *req) · 9 unmodified lines
727728 c = musb->dma_controller;
728729 channel = musb_ep->dma;
729730
731+ /* We use DMA Req mode 0 in rx_csr, and DMA controller operates in
732+ * mode 0 only. So we do not get endpoint interrupts due to DMA
733+ * completion. We only get interrupts from DMA controller.
734+ *
735+ * We could operate in DMA mode 1 if we knew the size of the tranfer
736+ * in advance. For mass storage class, request->length = what the host
737+ * sends, so that'd work. But for pretty much everything else,
738+ * request->length is routinely more than what the host sends. For
739+ * most these gadgets, end of is signified either by a short packet,
740+ * or filling the last byte of the buffer. (Sending extra data in
741+ * that last pckate should trigger an overflow fault.) But in mode 1,
742+ * we don't get DMA completion interrupt for short packets.
743+ *
744+ * Theoretically, we could enable DMAReq irq (MUSB_RXCSR_DMAMODE = 1),
745+ * to get endpoint interrupt on every DMA req, but that didn't seem
746+ * to work reliably.
747+ *
748+ * REVISIT an updated g_file_storage can set req->short_not_ok, which
749+ * then becomes usable as a runtime "use mode 1" hint...
750+ */
751+
730752 /* Experimental: Mode1 works with mass storage use cases */
731753 if (use_mode_1) {
732754 csr |= MUSB_RXCSR_AUTOCLEAR;
drivers/usb/musb/ux500.c+1−1
@@ -65,7 +65,7 @@ static int __devinit ux500_probe(struct platform_device *pdev) · 64 unmodified lines
6565 struct platform_device *musb;
6666 struct ux500_glue *glue;
6767 struct clk *clk;
68−
68+ int musbid;
6969 int ret = -ENOMEM;
7070
7171 glue = kzalloc(sizeof(*glue), GFP_KERNEL);
drivers/usb/otg/Kconfig+2−2
@@ -58,7 +58,7 @@ config USB_ULPI_VIEWPORT · 57 unmodified lines
5858
5959 config TWL4030_USB
6060 tristate "TWL4030 USB Transceiver Driver"
61− depends on TWL4030_CORE && REGULATOR_TWL4030
61+ depends on TWL4030_CORE && REGULATOR_TWL4030 && USB_MUSB_OMAP2PLUS
6262 select USB_OTG_UTILS
6363 help
6464 Enable this to support the USB OTG transceiver on TWL4030
@@ -68,7 +68,7 @@ config TWL4030_USB · 3 unmodified lines
6868
6969 config TWL6030_USB
7070 tristate "TWL6030 USB Transceiver Driver"
71− depends on TWL4030_CORE && OMAP_USB2
71+ depends on TWL4030_CORE && OMAP_USB2 && USB_MUSB_OMAP2PLUS
7272 select USB_OTG_UTILS
7373 help
7474 Enable this to support the USB OTG transceiver on TWL6030
drivers/usb/serial/keyspan.c+1−2
@@ -2430,7 +2430,7 @@ static void keyspan_release(struct usb_serial *serial) · 2429 unmodified lines
24302430 static int keyspan_port_probe(struct usb_serial_port *port)
24312431 {
24322432 struct usb_serial *serial = port->serial;
2433− struct keyspan_port_private *s_priv;
2433+ struct keyspan_serial_private *s_priv;
24342434 struct keyspan_port_private *p_priv;
24352435 const struct keyspan_device_details *d_details;
24362436 struct callbacks *cback;
@@ -2445,7 +2445,6 @@ static int keyspan_port_probe(struct usb_serial_port *port) · 8 unmodified lines
24452445 if (!p_priv)
24462446 return -ENOMEM;
24472447
2448− s_priv = usb_get_serial_data(port->serial);
24492448 p_priv->device_details = d_details;
24502449
24512450 /* Setup values for the various callback routines */
drivers/usb/serial/option.c+9−0
@@ -158,6 +158,7 @@ static void option_instat_callback(struct urb *urb); · 157 unmodified lines
158158 #define NOVATELWIRELESS_PRODUCT_EVDO_EMBEDDED_HIGHSPEED 0x8001
159159 #define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_FULLSPEED 0x9000
160160 #define NOVATELWIRELESS_PRODUCT_HSPA_EMBEDDED_HIGHSPEED 0x9001
161+#define NOVATELWIRELESS_PRODUCT_E362 0x9010
161162 #define NOVATELWIRELESS_PRODUCT_G1 0xA001
162163 #define NOVATELWIRELESS_PRODUCT_G1_M 0xA002
163164 #define NOVATELWIRELESS_PRODUCT_G2 0xA010
@@ -193,6 +194,9 @@ static void option_instat_callback(struct urb *urb); · 29 unmodified lines
193194 #define DELL_PRODUCT_5730_MINICARD_TELUS 0x8181
194195 #define DELL_PRODUCT_5730_MINICARD_VZW 0x8182
195196
197+#define DELL_PRODUCT_5800_MINICARD_VZW 0x8195 /* Novatel E362 */
198+#define DELL_PRODUCT_5800_V2_MINICARD_VZW 0x8196 /* Novatel E362 */
199+
196200 #define KYOCERA_VENDOR_ID 0x0c88
197201 #define KYOCERA_PRODUCT_KPC650 0x17da
198202 #define KYOCERA_PRODUCT_KPC680 0x180a
@@ -283,6 +287,7 @@ static void option_instat_callback(struct urb *urb); · 84 unmodified lines
283287 /* ALCATEL PRODUCTS */
284288 #define ALCATEL_VENDOR_ID 0x1bbb
285289 #define ALCATEL_PRODUCT_X060S_X200 0x0000
290+#define ALCATEL_PRODUCT_X220_X500D 0x0017
286291
287292 #define PIRELLI_VENDOR_ID 0x1266
288293 #define PIRELLI_PRODUCT_C100_1 0x1002
@@ -706,6 +711,7 @@ static const struct usb_device_id option_ids[] = { · 417 unmodified lines
706711 { USB_DEVICE(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_G2) },
707712 /* Novatel Ovation MC551 a.k.a. Verizon USB551L */
708713 { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_MC551, 0xff, 0xff, 0xff) },
714+ { USB_DEVICE_AND_INTERFACE_INFO(NOVATELWIRELESS_VENDOR_ID, NOVATELWIRELESS_PRODUCT_E362, 0xff, 0xff, 0xff) },
709715
710716 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01) },
711717 { USB_DEVICE(AMOI_VENDOR_ID, AMOI_PRODUCT_H01A) },
@@ -728,6 +734,8 @@ static const struct usb_device_id option_ids[] = { · 16 unmodified lines
728734 { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_SPRINT) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */
729735 { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_TELUS) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */
730736 { USB_DEVICE(DELL_VENDOR_ID, DELL_PRODUCT_5730_MINICARD_VZW) }, /* Dell Wireless 5730 Mobile Broadband EVDO/HSPA Mini-Card */
737+ { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_MINICARD_VZW, 0xff, 0xff, 0xff) },
738+ { USB_DEVICE_AND_INTERFACE_INFO(DELL_VENDOR_ID, DELL_PRODUCT_5800_V2_MINICARD_VZW, 0xff, 0xff, 0xff) },
731739 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_E100A) }, /* ADU-E100, ADU-310 */
732740 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_500A) },
733741 { USB_DEVICE(ANYDATA_VENDOR_ID, ANYDATA_PRODUCT_ADU_620UW) },
@@ -1157,6 +1165,7 @@ static const struct usb_device_id option_ids[] = { · 423 unmodified lines
11571165 { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200),
11581166 .driver_info = (kernel_ulong_t)&alcatel_x200_blacklist
11591167 },
1168+ { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X220_X500D) },
11601169 { USB_DEVICE(AIRPLUS_VENDOR_ID, AIRPLUS_PRODUCT_MCD650) },
11611170 { USB_DEVICE(TLAYTECH_VENDOR_ID, TLAYTECH_PRODUCT_TEU800) },
11621171 { USB_DEVICE(LONGCHEER_VENDOR_ID, FOUR_G_SYSTEMS_PRODUCT_W14),
drivers/usb/serial/usb_wwan.c+5−5
@@ -455,9 +455,6 @@ static struct urb *usb_wwan_setup_urb(struct usb_serial_port *port, · 454 unmodified lines
455455 struct usb_serial *serial = port->serial;
456456 struct urb *urb;
457457
458− if (endpoint == -1)
459− return NULL; /* endpoint not needed */
460−
461458 urb = usb_alloc_urb(0, GFP_KERNEL); /* No ISO */
462459 if (urb == NULL) {
463460 dev_dbg(&serial->interface->dev,
@@ -489,6 +486,9 @@ int usb_wwan_port_probe(struct usb_serial_port *port) · 25 unmodified lines
489486 init_usb_anchor(&portdata->delayed);
490487
491488 for (i = 0; i < N_IN_URB; i++) {
489+ if (!port->bulk_in_size)
490+ break;
491+
492492 buffer = (u8 *)__get_free_page(GFP_KERNEL);
493493 if (!buffer)
494494 goto bail_out_error;
@@ -502,8 +502,8 @@ int usb_wwan_port_probe(struct usb_serial_port *port) · 7 unmodified lines
502502 }
503503
504504 for (i = 0; i < N_OUT_URB; i++) {
505− if (port->bulk_out_endpointAddress == -1)
506− continue;
505+ if (!port->bulk_out_size)
506+ break;
507507
508508 buffer = kmalloc(OUT_BUFLEN, GFP_KERNEL);
509509 if (!buffer)
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+}
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/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/proc/base.c+109−0
@@ -873,6 +873,113 @@ static const struct file_operations proc_environ_operations = { · 872 unmodified lines
873873 .release = mem_release,
874874 };
875875
876+static ssize_t oom_adj_read(struct file *file, char __user *buf, size_t count,
877+ loff_t *ppos)
878+{
879+ struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode);
880+ char buffer[PROC_NUMBUF];
881+ int oom_adj = OOM_ADJUST_MIN;
882+ size_t len;
883+ unsigned long flags;
884+
885+ if (!task)
886+ return -ESRCH;
887+ if (lock_task_sighand(task, &flags)) {
888+ if (task->signal->oom_score_adj == OOM_SCORE_ADJ_MAX)
889+ oom_adj = OOM_ADJUST_MAX;
890+ else
891+ oom_adj = (task->signal->oom_score_adj * -OOM_DISABLE) /
892+ OOM_SCORE_ADJ_MAX;
893+ unlock_task_sighand(task, &flags);
894+ }
895+ put_task_struct(task);
896+ len = snprintf(buffer, sizeof(buffer), "%d\n", oom_adj);
897+ return simple_read_from_buffer(buf, count, ppos, buffer, len);
898+}
899+
900+static ssize_t oom_adj_write(struct file *file, const char __user *buf,
901+ size_t count, loff_t *ppos)
902+{
903+ struct task_struct *task;
904+ char buffer[PROC_NUMBUF];
905+ int oom_adj;
906+ unsigned long flags;
907+ int err;
908+
909+ memset(buffer, 0, sizeof(buffer));
910+ if (count > sizeof(buffer) - 1)
911+ count = sizeof(buffer) - 1;
912+ if (copy_from_user(buffer, buf, count)) {
913+ err = -EFAULT;
914+ goto out;
915+ }
916+
917+ err = kstrtoint(strstrip(buffer), 0, &oom_adj);
918+ if (err)
919+ goto out;
920+ if ((oom_adj < OOM_ADJUST_MIN || oom_adj > OOM_ADJUST_MAX) &&
921+ oom_adj != OOM_DISABLE) {
922+ err = -EINVAL;
923+ goto out;
924+ }
925+
926+ task = get_proc_task(file->f_path.dentry->d_inode);
927+ if (!task) {
928+ err = -ESRCH;
929+ goto out;
930+ }
931+
932+ task_lock(task);
933+ if (!task->mm) {
934+ err = -EINVAL;
935+ goto err_task_lock;
936+ }
937+
938+ if (!lock_task_sighand(task, &flags)) {
939+ err = -ESRCH;
940+ goto err_task_lock;
941+ }
942+
943+ /*
944+ * Scale /proc/pid/oom_score_adj appropriately ensuring that a maximum
945+ * value is always attainable.
946+ */
947+ if (oom_adj == OOM_ADJUST_MAX)
948+ oom_adj = OOM_SCORE_ADJ_MAX;
949+ else
950+ oom_adj = (oom_adj * OOM_SCORE_ADJ_MAX) / -OOM_DISABLE;
951+
952+ if (oom_adj < task->signal->oom_score_adj &&
953+ !capable(CAP_SYS_RESOURCE)) {
954+ err = -EACCES;
955+ goto err_sighand;
956+ }
957+
958+ /*
959+ * /proc/pid/oom_adj is provided for legacy purposes, ask users to use
960+ * /proc/pid/oom_score_adj instead.
961+ */
962+ printk_once(KERN_WARNING "%s (%d): /proc/%d/oom_adj is deprecated, please use /proc/%d/oom_score_adj instead.\n",
963+ current->comm, task_pid_nr(current), task_pid_nr(task),
964+ task_pid_nr(task));
965+
966+ task->signal->oom_score_adj = oom_adj;
967+ trace_oom_score_adj_update(task);
968+err_sighand:
969+ unlock_task_sighand(task, &flags);
970+err_task_lock:
971+ task_unlock(task);
972+ put_task_struct(task);
973+out:
974+ return err < 0 ? err : count;
975+}
976+
977+static const struct file_operations proc_oom_adj_operations = {
978+ .read = oom_adj_read,
979+ .write = oom_adj_write,
980+ .llseek = generic_file_llseek,
981+};
982+
876983 static ssize_t oom_score_adj_read(struct file *file, char __user *buf,
877984 size_t count, loff_t *ppos)
878985 {
@@ -2598,6 +2705,7 @@ static const struct pid_entry tgid_base_stuff[] = { · 1719 unmodified lines
25982705 REG("cgroup", S_IRUGO, proc_cgroup_operations),
25992706 #endif
26002707 INF("oom_score", S_IRUGO, proc_oom_score),
2708+ REG("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adj_operations),
26012709 REG("oom_score_adj", S_IRUGO|S_IWUSR, proc_oom_score_adj_operations),
26022710 #ifdef CONFIG_AUDITSYSCALL
26032711 REG("loginuid", S_IWUSR|S_IRUGO, proc_loginuid_operations),
@@ -2964,6 +3072,7 @@ static const struct pid_entry tid_base_stuff[] = { · 360 unmodified lines
29643072 REG("cgroup", S_IRUGO, proc_cgroup_operations),
29653073 #endif
29663074 INF("oom_score", S_IRUGO, proc_oom_score),
3075+ REG("oom_adj", S_IRUGO|S_IWUSR, proc_oom_adj_operations),
29673076 REG("oom_score_adj", S_IRUGO|S_IWUSR, proc_oom_score_adj_operations),
29683077 #ifdef CONFIG_AUDITSYSCALL
29693078 REG("loginuid", S_IWUSR|S_IRUGO, proc_loginuid_operations),
fs/pstore/platform.c+2−1
@@ -161,6 +161,7 @@ static void pstore_console_write(struct console *con, const char *s, unsigned c) · 160 unmodified lines
161161
162162 while (s < e) {
163163 unsigned long flags;
164+ u64 id;
164165
165166 if (c > psinfo->bufsize)
166167 c = psinfo->bufsize;
@@ -172,7 +173,7 @@ static void pstore_console_write(struct console *con, const char *s, unsigned c) · 5 unmodified lines
172173 spin_lock_irqsave(&psinfo->buf_lock, flags);
173174 }
174175 memcpy(psinfo->buf, s, c);
175− psinfo->write(PSTORE_TYPE_CONSOLE, 0, NULL, 0, c, psinfo);
176+ psinfo->write(PSTORE_TYPE_CONSOLE, 0, &id, 0, c, psinfo);
176177 spin_unlock_irqrestore(&psinfo->buf_lock, flags);
177178 s += c;
178179 c = e - s;
fs/ubifs/find.c+10−2
@@ -681,8 +681,16 @@ int ubifs_find_free_leb_for_idx(struct ubifs_info *c) · 680 unmodified lines
681681 if (!lprops) {
682682 lprops = ubifs_fast_find_freeable(c);
683683 if (!lprops) {
684− ubifs_assert(c->freeable_cnt == 0);
685− if (c->lst.empty_lebs - c->lst.taken_empty_lebs > 0) {
684+ /*
685+ * The first condition means the following: go scan the
686+ * LPT if there are uncategorized lprops, which means
687+ * there may be freeable LEBs there (UBIFS does not
688+ * store the information about freeable LEBs in the
689+ * master node).
690+ */
691+ if (c->in_a_category_cnt != c->main_lebs ||
692+ c->lst.empty_lebs - c->lst.taken_empty_lebs > 0) {
693+ ubifs_assert(c->freeable_cnt == 0);
686694 lprops = scan_for_leb_for_idx(c);
687695 if (IS_ERR(lprops)) {
688696 err = PTR_ERR(lprops);
fs/ubifs/lprops.c+6−0
@@ -300,8 +300,11 @@ void ubifs_add_to_cat(struct ubifs_info *c, struct ubifs_lprops *lprops, · 299 unmodified lines
300300 default:
301301 ubifs_assert(0);
302302 }
303+
303304 lprops->flags &= ~LPROPS_CAT_MASK;
304305 lprops->flags |= cat;
306+ c->in_a_category_cnt += 1;
307+ ubifs_assert(c->in_a_category_cnt <= c->main_lebs);
305308 }
306309
307310 /**
@@ -334,6 +337,9 @@ static void ubifs_remove_from_cat(struct ubifs_info *c, · 26 unmodified lines
334337 default:
335338 ubifs_assert(0);
336339 }
340+
341+ c->in_a_category_cnt -= 1;
342+ ubifs_assert(c->in_a_category_cnt >= 0);
337343 }
338344
339345 /**
fs/ubifs/ubifs.h+3−0
@@ -1183,6 +1183,8 @@ struct ubifs_debug_info; · 1182 unmodified lines
11831183 * @freeable_list: list of freeable non-index LEBs (free + dirty == @leb_size)
11841184 * @frdi_idx_list: list of freeable index LEBs (free + dirty == @leb_size)
11851185 * @freeable_cnt: number of freeable LEBs in @freeable_list
1186+ * @in_a_category_cnt: count of lprops which are in a certain category, which
1187+ * basically meants that they were loaded from the flash
11861188 *
11871189 * @ltab_lnum: LEB number of LPT's own lprops table
11881190 * @ltab_offs: offset of LPT's own lprops table
@@ -1412,6 +1414,7 @@ struct ubifs_info { · 223 unmodified lines
14121414 struct list_head freeable_list;
14131415 struct list_head frdi_idx_list;
14141416 int freeable_cnt;
1417+ int in_a_category_cnt;
14151418
14161419 int ltab_lnum;
14171420 int ltab_offs;
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/clk-provider.h+2−2
@@ -335,8 +335,8 @@ const char *__clk_get_name(struct clk *clk); · 334 unmodified lines
335335 struct clk_hw *__clk_get_hw(struct clk *clk);
336336 u8 __clk_get_num_parents(struct clk *clk);
337337 struct clk *__clk_get_parent(struct clk *clk);
338−inline int __clk_get_enable_count(struct clk *clk);
339−inline int __clk_get_prepare_count(struct clk *clk);
338+int __clk_get_enable_count(struct clk *clk);
339+int __clk_get_prepare_count(struct clk *clk);
340340 unsigned long __clk_get_rate(struct clk *clk);
341341 unsigned long __clk_get_flags(struct clk *clk);
342342 int __clk_is_enabled(struct clk *clk);
include/linux/mm.h+0−4
@@ -1684,9 +1684,5 @@ static inline unsigned int debug_guardpage_minorder(void) { return 0; } · 1683 unmodified lines
16841684 static inline bool page_is_guard(struct page *page) { return false; }
16851685 #endif /* CONFIG_DEBUG_PAGEALLOC */
16861686
1687−extern void reset_zone_present_pages(void);
1688−extern void fixup_zone_present_pages(int nid, unsigned long start_pfn,
1689− unsigned long end_pfn);
1690−
16911687 #endif /* __KERNEL__ */
16921688 #endif /* _LINUX_MM_H */
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/mmzone.h+1−1
@@ -752,7 +752,7 @@ extern int init_currently_empty_zone(struct zone *zone, unsigned long start_pfn, · 751 unmodified lines
752752 unsigned long size,
753753 enum memmap_context context);
754754
755−extern void lruvec_init(struct lruvec *lruvec, struct zone *zone);
755+extern void lruvec_init(struct lruvec *lruvec);
756756
757757 static inline struct zone *lruvec_zone(struct lruvec *lruvec)
758758 {
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/platform_data/omap_ocp2scp.h+31−0
@@ -0,0 +1,31 @@
1+/*
2+ * omap_ocp2scp.h -- ocp2scp header file
3+ *
4+ * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com
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 of the License, or
8+ * (at your option) any later version.
9+ *
10+ * Author: Kishon Vijay Abraham I <kishon@ti.com>
11+ *
12+ * This program is distributed in the hope that it will be useful,
13+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+ * GNU General Public License for more details.
16+ *
17+ */
18+
19+#ifndef __DRIVERS_OMAP_OCP2SCP_H
20+#define __DRIVERS_OMAP_OCP2SCP_H
21+
22+struct omap_ocp2scp_dev {
23+ const char *drv_name;
24+ struct resource *res;
25+};
26+
27+struct omap_ocp2scp_platform_data {
28+ int dev_cnt;
29+ struct omap_ocp2scp_dev **devices;
30+};
31+#endif /* __DRIVERS_OMAP_OCP2SCP_H */
include/linux/rio.h+2−0
@@ -275,9 +275,11 @@ struct rio_id_table { · 274 unmodified lines
275275 * struct rio_net - RIO network info
276276 * @node: Node in global list of RIO networks
277277 * @devices: List of devices in this network
278+ * @switches: List of switches in this netowrk
278279 * @mports: List of master ports accessing this network
279280 * @hport: Default port for accessing this network
280281 * @id: RIO network ID
282+ * @destid_table: destID allocation table
281283 */
282284 struct rio_net {
283285 struct list_head node; /* node in list of networks */
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/oom.h+9−0
@@ -8,4 +8,13 @@ · 7 unmodified lines
88 #define OOM_SCORE_ADJ_MIN (-1000)
99 #define OOM_SCORE_ADJ_MAX 1000
1010
11+/*
12+ * /proc/<pid>/oom_adj set to -17 protects from the oom killer for legacy
13+ * purposes.
14+ */
15+#define OOM_DISABLE (-17)
16+/* inclusive */
17+#define OOM_ADJUST_MIN (-16)
18+#define OOM_ADJUST_MAX 15
19+
1120 #endif /* _UAPI__INCLUDE_LINUX_OOM_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;
kernel/futex.c+22−19
@@ -716,7 +716,7 @@ static int futex_lock_pi_atomic(u32 __user *uaddr, struct futex_hash_bucket *hb, · 715 unmodified lines
716716 struct futex_pi_state **ps,
717717 struct task_struct *task, int set_waiters)
718718 {
719− int lock_taken, ret, ownerdied = 0;
719+ int lock_taken, ret, force_take = 0;
720720 u32 uval, newval, curval, vpid = task_pid_vnr(task);
721721
722722 retry:
@@ -755,17 +755,15 @@ retry: · 32 unmodified lines
755755 newval = curval | FUTEX_WAITERS;
756756
757757 /*
758− * There are two cases, where a futex might have no owner (the
759− * owner TID is 0): OWNER_DIED. We take over the futex in this
760− * case. We also do an unconditional take over, when the owner
761− * of the futex died.
762− *
763− * This is safe as we are protected by the hash bucket lock !
758+ * Should we force take the futex? See below.
764759 */
765− if (unlikely(ownerdied || !(curval & FUTEX_TID_MASK))) {
766− /* Keep the OWNER_DIED bit */
760+ if (unlikely(force_take)) {
761+ /*
762+ * Keep the OWNER_DIED and the WAITERS bit and set the
763+ * new TID value.
764+ */
767765 newval = (curval & ~FUTEX_TID_MASK) | vpid;
768− ownerdied = 0;
766+ force_take = 0;
769767 lock_taken = 1;
770768 }
771769
@@ -775,7 +773,7 @@ retry: · 3 unmodified lines
775773 goto retry;
776774
777775 /*
778− * We took the lock due to owner died take over.
776+ * We took the lock due to forced take over.
779777 */
780778 if (unlikely(lock_taken))
781779 return 1;
@@ -790,20 +788,25 @@ retry: · 8 unmodified lines
790788 switch (ret) {
791789 case -ESRCH:
792790 /*
793− * No owner found for this futex. Check if the
794− * OWNER_DIED bit is set to figure out whether
795− * this is a robust futex or not.
791+ * We failed to find an owner for this
792+ * futex. So we have no pi_state to block
793+ * on. This can happen in two cases:
794+ *
795+ * 1) The owner died
796+ * 2) A stale FUTEX_WAITERS bit
797+ *
798+ * Re-read the futex value.
796799 */
797800 if (get_futex_value_locked(&curval, uaddr))
798801 return -EFAULT;
799802
800803 /*
801− * We simply start over in case of a robust
802− * futex. The code above will take the futex
803− * and return happy.
804+ * If the owner died or we have a stale
805+ * WAITERS bit the owner TID in the user space
806+ * futex is 0.
804807 */
805− if (curval & FUTEX_OWNER_DIED) {
806− ownerdied = 1;
808+ if (!(curval & FUTEX_TID_MASK)) {
809+ force_take = 1;
807810 goto retry;
808811 }
809812 default:
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/bootmem.c+1−9
@@ -198,8 +198,6 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata) · 197 unmodified lines
198198 int order = ilog2(BITS_PER_LONG);
199199
200200 __free_pages_bootmem(pfn_to_page(start), order);
201− fixup_zone_present_pages(page_to_nid(pfn_to_page(start)),
202− start, start + BITS_PER_LONG);
203201 count += BITS_PER_LONG;
204202 start += BITS_PER_LONG;
205203 } else {
@@ -210,9 +208,6 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata) · 4 unmodified lines
210208 if (vec & 1) {
211209 page = pfn_to_page(start + off);
212210 __free_pages_bootmem(page, 0);
213− fixup_zone_present_pages(
214− page_to_nid(page),
215− start + off, start + off + 1);
216211 count++;
217212 }
218213 vec >>= 1;
@@ -226,11 +221,8 @@ static unsigned long __init free_all_bootmem_core(bootmem_data_t *bdata) · 7 unmodified lines
226221 pages = bdata->node_low_pfn - bdata->node_min_pfn;
227222 pages = bootmem_bootmap_pages(pages);
228223 count += pages;
229− while (pages--) {
230− fixup_zone_present_pages(page_to_nid(page),
231− page_to_pfn(page), page_to_pfn(page) + 1);
224+ while (pages--)
232225 __free_pages_bootmem(page++, 0);
233− }
234226
235227 bdebug("nid=%td released=%lx\n", bdata - bootmem_node_data, count);
236228
mm/highmem.c+1−1
@@ -98,7 +98,7 @@ struct page *kmap_to_page(void *vaddr) · 97 unmodified lines
9898 {
9999 unsigned long addr = (unsigned long)vaddr;
100100
101− if (addr >= PKMAP_ADDR(0) && addr <= PKMAP_ADDR(LAST_PKMAP)) {
101+ if (addr >= PKMAP_ADDR(0) && addr < PKMAP_ADDR(LAST_PKMAP)) {
102102 int i = (addr - PKMAP_ADDR(0)) >> PAGE_SHIFT;
103103 return pte_page(pkmap_page_table[i]);
104104 }
mm/memcontrol.c+50−17
@@ -1055,12 +1055,24 @@ struct lruvec *mem_cgroup_zone_lruvec(struct zone *zone, · 1054 unmodified lines
10551055 struct mem_cgroup *memcg)
10561056 {
10571057 struct mem_cgroup_per_zone *mz;
1058+ struct lruvec *lruvec;
10581059
1059− if (mem_cgroup_disabled())
1060− return &zone->lruvec;
1060+ if (mem_cgroup_disabled()) {
1061+ lruvec = &zone->lruvec;
1062+ goto out;
1063+ }
10611064
10621065 mz = mem_cgroup_zoneinfo(memcg, zone_to_nid(zone), zone_idx(zone));
1063− return &mz->lruvec;
1066+ lruvec = &mz->lruvec;
1067+out:
1068+ /*
1069+ * Since a node can be onlined after the mem_cgroup was created,
1070+ * we have to be prepared to initialize lruvec->zone here;
1071+ * and if offlined then reonlined, we need to reinitialize it.
1072+ */
1073+ if (unlikely(lruvec->zone != zone))
1074+ lruvec->zone = zone;
1075+ return lruvec;
10641076 }
10651077
10661078 /*
@@ -1087,9 +1099,12 @@ struct lruvec *mem_cgroup_page_lruvec(struct page *page, struct zone *zone) · 20 unmodified lines
10871099 struct mem_cgroup_per_zone *mz;
10881100 struct mem_cgroup *memcg;
10891101 struct page_cgroup *pc;
1102+ struct lruvec *lruvec;
10901103
1091− if (mem_cgroup_disabled())
1092− return &zone->lruvec;
1104+ if (mem_cgroup_disabled()) {
1105+ lruvec = &zone->lruvec;
1106+ goto out;
1107+ }
10931108
10941109 pc = lookup_page_cgroup(page);
10951110 memcg = pc->mem_cgroup;
@@ -1107,7 +1122,16 @@ struct lruvec *mem_cgroup_page_lruvec(struct page *page, struct zone *zone) · 11 unmodified lines
11071122 pc->mem_cgroup = memcg = root_mem_cgroup;
11081123
11091124 mz = page_cgroup_zoneinfo(memcg, page);
1110− return &mz->lruvec;
1125+ lruvec = &mz->lruvec;
1126+out:
1127+ /*
1128+ * Since a node can be onlined after the mem_cgroup was created,
1129+ * we have to be prepared to initialize lruvec->zone here;
1130+ * and if offlined then reonlined, we need to reinitialize it.
1131+ */
1132+ if (unlikely(lruvec->zone != zone))
1133+ lruvec->zone = zone;
1134+ return lruvec;
11111135 }
11121136
11131137 /**
@@ -1452,17 +1476,26 @@ static int mem_cgroup_count_children(struct mem_cgroup *memcg) · 338 unmodified lines
14521476 static u64 mem_cgroup_get_limit(struct mem_cgroup *memcg)
14531477 {
14541478 u64 limit;
1455− u64 memsw;
14561479
14571480 limit = res_counter_read_u64(&memcg->res, RES_LIMIT);
1458− limit += total_swap_pages << PAGE_SHIFT;
14591481
1460− memsw = res_counter_read_u64(&memcg->memsw, RES_LIMIT);
14611482 /*
1462− * If memsw is finite and limits the amount of swap space available
1463− * to this memcg, return that limit.
1483+ * Do not consider swap space if we cannot swap due to swappiness
14641484 */
1465− return min(limit, memsw);
1485+ if (mem_cgroup_swappiness(memcg)) {
1486+ u64 memsw;
1487+
1488+ limit += total_swap_pages << PAGE_SHIFT;
1489+ memsw = res_counter_read_u64(&memcg->memsw, RES_LIMIT);
1490+
1491+ /*
1492+ * If memsw is finite and limits the amount of swap space
1493+ * available to this memcg, return that limit.
1494+ */
1495+ limit = min(limit, memsw);
1496+ }
1497+
1498+ return limit;
14661499 }
14671500
14681501 void mem_cgroup_out_of_memory(struct mem_cgroup *memcg, gfp_t gfp_mask,
@@ -3688,17 +3721,17 @@ unsigned long mem_cgroup_soft_limit_reclaim(struct zone *zone, int order, · 2219 unmodified lines
36883721 static bool mem_cgroup_force_empty_list(struct mem_cgroup *memcg,
36893722 int node, int zid, enum lru_list lru)
36903723 {
3691− struct mem_cgroup_per_zone *mz;
3724+ struct lruvec *lruvec;
36923725 unsigned long flags, loop;
36933726 struct list_head *list;
36943727 struct page *busy;
36953728 struct zone *zone;
36963729
36973730 zone = &NODE_DATA(node)->node_zones[zid];
3698− mz = mem_cgroup_zoneinfo(memcg, node, zid);
3699− list = &mz->lruvec.lists[lru];
3731+ lruvec = mem_cgroup_zone_lruvec(zone, memcg);
3732+ list = &lruvec->lists[lru];
37003733
3701− loop = mz->lru_size[lru];
3734+ loop = mem_cgroup_get_lru_size(lruvec, lru);
37023735 /* give some margin against EBUSY etc...*/
37033736 loop += 256;
37043737 busy = NULL;
@@ -4736,7 +4769,7 @@ static int alloc_mem_cgroup_per_zone_info(struct mem_cgroup *memcg, int node) · 1031 unmodified lines
47364769
47374770 for (zone = 0; zone < MAX_NR_ZONES; zone++) {
47384771 mz = &pn->zoneinfo[zone];
4739− lruvec_init(&mz->lruvec, &NODE_DATA(node)->node_zones[zone]);
4772+ lruvec_init(&mz->lruvec);
47404773 mz->usage_in_excess = 0;
47414774 mz->on_tree = false;
47424775 mz->memcg = memcg;
mm/memory.c+4−6
@@ -2527,9 +2527,8 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, · 2526 unmodified lines
25272527 int ret = 0;
25282528 int page_mkwrite = 0;
25292529 struct page *dirty_page = NULL;
2530− unsigned long mmun_start; /* For mmu_notifiers */
2531− unsigned long mmun_end; /* For mmu_notifiers */
2532− bool mmun_called = false; /* For mmu_notifiers */
2530+ unsigned long mmun_start = 0; /* For mmu_notifiers */
2531+ unsigned long mmun_end = 0; /* For mmu_notifiers */
25332532
25342533 old_page = vm_normal_page(vma, address, orig_pte);
25352534 if (!old_page) {
@@ -2708,8 +2707,7 @@ gotten: · 172 unmodified lines
27082707 goto oom_free_new;
27092708
27102709 mmun_start = address & PAGE_MASK;
2711− mmun_end = (address & PAGE_MASK) + PAGE_SIZE;
2712− mmun_called = true;
2710+ mmun_end = mmun_start + PAGE_SIZE;
27132711 mmu_notifier_invalidate_range_start(mm, mmun_start, mmun_end);
27142712
27152713 /*
@@ -2778,7 +2776,7 @@ gotten: · 62 unmodified lines
27782776 page_cache_release(new_page);
27792777 unlock:
27802778 pte_unmap_unlock(page_table, ptl);
2781− if (mmun_called)
2779+ if (mmun_end > mmun_start)
27822780 mmu_notifier_invalidate_range_end(mm, mmun_start, mmun_end);
27832781 if (old_page) {
27842782 /*
mm/memory_hotplug.c+0−7
@@ -106,7 +106,6 @@ static void get_page_bootmem(unsigned long info, struct page *page, · 105 unmodified lines
106106 void __ref put_page_bootmem(struct page *page)
107107 {
108108 unsigned long type;
109− struct zone *zone;
110109
111110 type = (unsigned long) page->lru.next;
112111 BUG_ON(type < MEMORY_HOTPLUG_MIN_BOOTMEM_TYPE ||
@@ -117,12 +116,6 @@ void __ref put_page_bootmem(struct page *page) · 4 unmodified lines
117116 set_page_private(page, 0);
118117 INIT_LIST_HEAD(&page->lru);
119118 __free_pages_bootmem(page, 0);
120−
121− zone = page_zone(page);
122− zone_span_writelock(zone);
123− zone->present_pages++;
124− zone_span_writeunlock(zone);
125− totalram_pages++;
126119 }
127120
128121 }
mm/mmap.c+2−0
@@ -334,8 +334,10 @@ void validate_mm(struct mm_struct *mm) · 333 unmodified lines
334334 struct vm_area_struct *vma = mm->mmap;
335335 while (vma) {
336336 struct anon_vma_chain *avc;
337+ vma_lock_anon_vma(vma);
337338 list_for_each_entry(avc, &vma->anon_vma_chain, same_vma)
338339 anon_vma_interval_tree_verify(avc);
340+ vma_unlock_anon_vma(vma);
339341 vma = vma->vm_next;
340342 i++;
341343 }
mm/mmzone.c+1−5
@@ -87,7 +87,7 @@ int memmap_valid_within(unsigned long pfn, · 86 unmodified lines
8787 }
8888 #endif /* CONFIG_ARCH_HAS_HOLES_MEMORYMODEL */
8989
90−void lruvec_init(struct lruvec *lruvec, struct zone *zone)
90+void lruvec_init(struct lruvec *lruvec)
9191 {
9292 enum lru_list lru;
9393
@@ -95,8 +95,4 @@ void lruvec_init(struct lruvec *lruvec, struct zone *zone) · 1 unmodified line
9595
9696 for_each_lru(lru)
9797 INIT_LIST_HEAD(&lruvec->lists[lru]);
98−
99−#ifdef CONFIG_MEMCG
100− lruvec->zone = zone;
101−#endif
10298 }
mm/nobootmem.c+0−3
@@ -116,8 +116,6 @@ static unsigned long __init __free_memory_core(phys_addr_t start, · 115 unmodified lines
116116 return 0;
117117
118118 __free_pages_memory(start_pfn, end_pfn);
119− fixup_zone_present_pages(pfn_to_nid(start >> PAGE_SHIFT),
120− start_pfn, end_pfn);
121119
122120 return end_pfn - start_pfn;
123121 }
@@ -128,7 +126,6 @@ unsigned long __init free_low_memory_core_early(int nodeid) · 4 unmodified lines
128126 phys_addr_t start, end, size;
129127 u64 i;
130128
131− reset_zone_present_pages();
132129 for_each_free_mem_range(i, MAX_NUMNODES, &start, &end, NULL)
133130 count += __free_memory_core(start, end);
134131
mm/page_alloc.c+1−35
@@ -4505,7 +4505,7 @@ static void __paginginit free_area_init_core(struct pglist_data *pgdat, · 4504 unmodified lines
45054505 zone->zone_pgdat = pgdat;
45064506
45074507 zone_pcp_init(zone);
4508− lruvec_init(&zone->lruvec, zone);
4508+ lruvec_init(&zone->lruvec);
45094509 if (!size)
45104510 continue;
45114511
@@ -6098,37 +6098,3 @@ void dump_page(struct page *page) · 1586 unmodified lines
60986098 dump_page_flags(page->flags);
60996099 mem_cgroup_print_bad_page(page);
61006100 }
6101−
6102−/* reset zone->present_pages */
6103−void reset_zone_present_pages(void)
6104−{
6105− struct zone *z;
6106− int i, nid;
6107−
6108− for_each_node_state(nid, N_HIGH_MEMORY) {
6109− for (i = 0; i < MAX_NR_ZONES; i++) {
6110− z = NODE_DATA(nid)->node_zones + i;
6111− z->present_pages = 0;
6112− }
6113− }
6114−}
6115−
6116−/* calculate zone's present pages in buddy system */
6117−void fixup_zone_present_pages(int nid, unsigned long start_pfn,
6118− unsigned long end_pfn)
6119−{
6120− struct zone *z;
6121− unsigned long zone_start_pfn, zone_end_pfn;
6122− int i;
6123−
6124− for (i = 0; i < MAX_NR_ZONES; i++) {
6125− z = NODE_DATA(nid)->node_zones + i;
6126− zone_start_pfn = z->zone_start_pfn;
6127− zone_end_pfn = zone_start_pfn + z->spanned_pages;
6128−
6129− /* if the two regions intersect */
6130− if (!(zone_start_pfn >= end_pfn || zone_end_pfn <= start_pfn))
6131− z->present_pages += min(end_pfn, zone_end_pfn) -
6132− max(start_pfn, zone_start_pfn);
6133− }
6134−}
mm/shmem.c+15−3
@@ -643,7 +643,7 @@ static void shmem_evict_inode(struct inode *inode) · 642 unmodified lines
643643 kfree(info->symlink);
644644
645645 simple_xattrs_free(&info->xattrs);
646− BUG_ON(inode->i_blocks);
646+ WARN_ON(inode->i_blocks);
647647 shmem_free_inode(inode->i_sb);
648648 clear_inode(inode);
649649 }
@@ -1145,8 +1145,20 @@ repeat: · 495 unmodified lines
11451145 if (!error) {
11461146 error = shmem_add_to_page_cache(page, mapping, index,
11471147 gfp, swp_to_radix_entry(swap));
1148− /* We already confirmed swap, and make no allocation */
1149− VM_BUG_ON(error);
1148+ /*
1149+ * We already confirmed swap under page lock, and make
1150+ * no memory allocation here, so usually no possibility
1151+ * of error; but free_swap_and_cache() only trylocks a
1152+ * page, so it is just possible that the entry has been
1153+ * truncated or holepunched since swap was confirmed.
1154+ * shmem_undo_range() will have done some of the
1155+ * unaccounting, now delete_from_swap_cache() will do
1156+ * the rest (including mem_cgroup_uncharge_swapcache).
1157+ * Reset swap.val? No, leave it so "failed" goes back to
1158+ * "repeat": reading a hole and writing should succeed.
1159+ */
1160+ if (error)
1161+ delete_from_swap_cache(page);
11501162 }
11511163 if (error)
11521164 goto failed;
mm/swapfile.c+2−2
@@ -1494,9 +1494,8 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile) · 1493 unmodified lines
14941494 BUG_ON(!current->mm);
14951495
14961496 pathname = getname(specialfile);
1497− err = PTR_ERR(pathname);
14981497 if (IS_ERR(pathname))
1499− goto out;
1498+ return PTR_ERR(pathname);
15001499
15011500 victim = file_open_name(pathname, O_RDWR|O_LARGEFILE, 0);
15021501 err = PTR_ERR(victim);
@@ -1608,6 +1607,7 @@ SYSCALL_DEFINE1(swapoff, const char __user *, specialfile) · 105 unmodified lines
16081607 out_dput:
16091608 filp_close(victim, NULL);
16101609 out:
1610+ putname(pathname);
16111611 return err;
16121612 }
16131613
mm/vmscan.c+2−25
@@ -1760,28 +1760,6 @@ static bool in_reclaim_compaction(struct scan_control *sc) · 1759 unmodified lines
17601760 return false;
17611761 }
17621762
1763−#ifdef CONFIG_COMPACTION
1764−/*
1765− * If compaction is deferred for sc->order then scale the number of pages
1766− * reclaimed based on the number of consecutive allocation failures
1767− */
1768−static unsigned long scale_for_compaction(unsigned long pages_for_compaction,
1769− struct lruvec *lruvec, struct scan_control *sc)
1770−{
1771− struct zone *zone = lruvec_zone(lruvec);
1772−
1773− if (zone->compact_order_failed <= sc->order)
1774− pages_for_compaction <<= zone->compact_defer_shift;
1775− return pages_for_compaction;
1776−}
1777−#else
1778−static unsigned long scale_for_compaction(unsigned long pages_for_compaction,
1779− struct lruvec *lruvec, struct scan_control *sc)
1780−{
1781− return pages_for_compaction;
1782−}
1783−#endif
1784−
17851763 /*
17861764 * Reclaim/compaction is used for high-order allocation requests. It reclaims
17871765 * order-0 pages before compacting the zone. should_continue_reclaim() returns
@@ -1829,9 +1807,6 @@ static inline bool should_continue_reclaim(struct lruvec *lruvec, · 41 unmodified lines
18291807 * inactive lists are large enough, continue reclaiming
18301808 */
18311809 pages_for_compaction = (2UL << sc->order);
1832−
1833− pages_for_compaction = scale_for_compaction(pages_for_compaction,
1834− lruvec, sc);
18351810 inactive_lru_pages = get_lru_size(lruvec, LRU_INACTIVE_FILE);
18361811 if (nr_swap_pages > 0)
18371812 inactive_lru_pages += get_lru_size(lruvec, LRU_INACTIVE_ANON);
@@ -3017,6 +2992,8 @@ static int kswapd(void *p) · 1179 unmodified lines
30172992 &balanced_classzone_idx);
30182993 }
30192994 }
2995+
2996+ current->reclaim_state = NULL;
30202997 return 0;
30212998 }
30222999
net/batman-adv/soft-interface.c+6−6
@@ -347,6 +347,12 @@ void batadv_interface_rx(struct net_device *soft_iface, · 346 unmodified lines
347347
348348 soft_iface->last_rx = jiffies;
349349
350+ /* Let the bridge loop avoidance check the packet. If will
351+ * not handle it, we can safely push it up.
352+ */
353+ if (batadv_bla_rx(bat_priv, skb, vid, is_bcast))
354+ goto out;
355+
350356 if (orig_node)
351357 batadv_tt_add_temporary_global_entry(bat_priv, orig_node,
352358 ethhdr->h_source);
@@ -354,12 +360,6 @@ void batadv_interface_rx(struct net_device *soft_iface, · 1 unmodified line
354360 if (batadv_is_ap_isolated(bat_priv, ethhdr->h_source, ethhdr->h_dest))
355361 goto dropped;
356362
357− /* Let the bridge loop avoidance check the packet. If will
358− * not handle it, we can safely push it up.
359− */
360− if (batadv_bla_rx(bat_priv, skb, vid, is_bcast))
361− goto out;
362−
363363 netif_rx(skb);
364364 goto out;
365365
net/batman-adv/translation-table.c+14−1
@@ -861,6 +861,12 @@ int batadv_tt_global_add(struct batadv_priv *bat_priv, · 860 unmodified lines
861861 */
862862 common->flags &= ~BATADV_TT_CLIENT_TEMP;
863863
864+ /* the change can carry possible "attribute" flags like the
865+ * TT_CLIENT_WIFI, therefore they have to be copied in the
866+ * client entry
867+ */
868+ tt_global_entry->common.flags |= flags;
869+
864870 /* If there is the BATADV_TT_CLIENT_ROAM flag set, there is only
865871 * one originator left in the list and we previously received a
866872 * delete + roaming change for this originator.
@@ -1574,7 +1580,7 @@ batadv_tt_response_fill_table(uint16_t tt_len, uint8_t ttvn, · 707 unmodified lines
15741580
15751581 memcpy(tt_change->addr, tt_common_entry->addr,
15761582 ETH_ALEN);
1577− tt_change->flags = BATADV_NO_FLAGS;
1583+ tt_change->flags = tt_common_entry->flags;
15781584
15791585 tt_count++;
15801586 tt_change++;
@@ -2545,6 +2551,13 @@ bool batadv_tt_add_temporary_global_entry(struct batadv_priv *bat_priv, · 964 unmodified lines
25452551 {
25462552 bool ret = false;
25472553
2554+ /* if the originator is a backbone node (meaning it belongs to the same
2555+ * LAN of this node) the temporary client must not be added because to
2556+ * reach such destination the node must use the LAN instead of the mesh
2557+ */
2558+ if (batadv_bla_is_backbone_gw_orig(bat_priv, orig_node->orig))
2559+ goto out;
2560+
25482561 if (!batadv_tt_global_add(bat_priv, orig_node, addr,
25492562 BATADV_TT_CLIENT_TEMP,
25502563 atomic_read(&orig_node->last_ttvn)))
net/bluetooth/hci_core.c+2−2
@@ -1754,11 +1754,11 @@ int hci_register_dev(struct hci_dev *hdev) · 1753 unmodified lines
17541754 if (hdev->dev_type != HCI_AMP)
17551755 set_bit(HCI_AUTO_OFF, &hdev->dev_flags);
17561756
1757− schedule_work(&hdev->power_on);
1758−
17591757 hci_notify(hdev, HCI_DEV_REG);
17601758 hci_dev_hold(hdev);
17611759
1760+ schedule_work(&hdev->power_on);
1761+
17621762 return id;
17631763
17641764 err_wqueue:
net/bluetooth/mgmt.c+7−5
@@ -326,7 +326,7 @@ static int read_index_list(struct sock *sk, struct hci_dev *hdev, void *data, · 325 unmodified lines
326326 struct hci_dev *d;
327327 size_t rp_len;
328328 u16 count;
329− int i, err;
329+ int err;
330330
331331 BT_DBG("sock %p", sk);
332332
@@ -347,9 +347,7 @@ static int read_index_list(struct sock *sk, struct hci_dev *hdev, void *data, · 14 unmodified lines
347347 return -ENOMEM;
348348 }
349349
350− rp->num_controllers = cpu_to_le16(count);
351−
352− i = 0;
350+ count = 0;
353351 list_for_each_entry(d, &hci_dev_list, list) {
354352 if (test_bit(HCI_SETUP, &d->dev_flags))
355353 continue;
@@ -357,10 +355,13 @@ static int read_index_list(struct sock *sk, struct hci_dev *hdev, void *data, · 1 unmodified line
357355 if (!mgmt_valid_hdev(d))
358356 continue;
359357
360− rp->index[i++] = cpu_to_le16(d->id);
358+ rp->index[count++] = cpu_to_le16(d->id);
361359 BT_DBG("Added hci%u", d->id);
362360 }
363361
362+ rp->num_controllers = cpu_to_le16(count);
363+ rp_len = sizeof(*rp) + (2 * count);
364+
364365 read_unlock(&hci_dev_list_lock);
365366
366367 err = cmd_complete(sk, MGMT_INDEX_NONE, MGMT_OP_READ_INDEX_LIST, 0, rp,
@@ -1366,6 +1367,7 @@ static int remove_uuid(struct sock *sk, struct hci_dev *hdev, void *data, · 999 unmodified lines
13661367 continue;
13671368
13681369 list_del(&match->list);
1370+ kfree(match);
13691371 found++;
13701372 }
13711373
net/bluetooth/smp.c+1−1
@@ -267,7 +267,7 @@ static void smp_failure(struct l2cap_conn *conn, u8 reason, u8 send) · 266 unmodified lines
267267
268268 clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->hcon->flags);
269269 mgmt_auth_failed(conn->hcon->hdev, conn->dst, hcon->type,
270− hcon->dst_type, reason);
270+ hcon->dst_type, HCI_ERROR_AUTH_FAILURE);
271271
272272 cancel_delayed_work_sync(&conn->security_timer);
273273
net/core/dev.c+3−1
@@ -2895,8 +2895,10 @@ static int get_rps_cpu(struct net_device *dev, struct sk_buff *skb, · 2894 unmodified lines
28952895 if (unlikely(tcpu != next_cpu) &&
28962896 (tcpu == RPS_NO_CPU || !cpu_online(tcpu) ||
28972897 ((int)(per_cpu(softnet_data, tcpu).input_queue_head -
2898− rflow->last_qtail)) >= 0))
2898+ rflow->last_qtail)) >= 0)) {
2899+ tcpu = next_cpu;
28992900 rflow = set_rps_cpu(dev, skb, rflow, next_cpu);
2901+ }
29002902
29012903 if (tcpu != RPS_NO_CPU && cpu_online(tcpu)) {
29022904 *rflowp = rflow;
net/core/dev_addr_lists.c+2−1
@@ -319,7 +319,8 @@ int dev_addr_del(struct net_device *dev, const unsigned char *addr, · 318 unmodified lines
319319 */
320320 ha = list_first_entry(&dev->dev_addrs.list,
321321 struct netdev_hw_addr, list);
322− if (ha->addr == dev->dev_addr && ha->refcount == 1)
322+ if (!memcmp(ha->addr, addr, dev->addr_len) &&
323+ ha->type == addr_type && ha->refcount == 1)
323324 return -ENOENT;
324325
325326 err = __hw_addr_del(&dev->dev_addrs, addr, dev->addr_len,
net/ipv4/ip_sockglue.c+22−13
@@ -457,19 +457,28 @@ static int do_ip_setsockopt(struct sock *sk, int level, · 456 unmodified lines
457457 struct inet_sock *inet = inet_sk(sk);
458458 int val = 0, err;
459459
460− if (((1<<optname) & ((1<<IP_PKTINFO) | (1<<IP_RECVTTL) |
461− (1<<IP_RECVOPTS) | (1<<IP_RECVTOS) |
462− (1<<IP_RETOPTS) | (1<<IP_TOS) |
463− (1<<IP_TTL) | (1<<IP_HDRINCL) |
464− (1<<IP_MTU_DISCOVER) | (1<<IP_RECVERR) |
465− (1<<IP_ROUTER_ALERT) | (1<<IP_FREEBIND) |
466− (1<<IP_PASSSEC) | (1<<IP_TRANSPARENT) |
467− (1<<IP_MINTTL) | (1<<IP_NODEFRAG))) ||
468− optname == IP_UNICAST_IF ||
469− optname == IP_MULTICAST_TTL ||
470− optname == IP_MULTICAST_ALL ||
471− optname == IP_MULTICAST_LOOP ||
472− optname == IP_RECVORIGDSTADDR) {
460+ switch (optname) {
461+ case IP_PKTINFO:
462+ case IP_RECVTTL:
463+ case IP_RECVOPTS:
464+ case IP_RECVTOS:
465+ case IP_RETOPTS:
466+ case IP_TOS:
467+ case IP_TTL:
468+ case IP_HDRINCL:
469+ case IP_MTU_DISCOVER:
470+ case IP_RECVERR:
471+ case IP_ROUTER_ALERT:
472+ case IP_FREEBIND:
473+ case IP_PASSSEC:
474+ case IP_TRANSPARENT:
475+ case IP_MINTTL:
476+ case IP_NODEFRAG:
477+ case IP_UNICAST_IF:
478+ case IP_MULTICAST_TTL:
479+ case IP_MULTICAST_ALL:
480+ case IP_MULTICAST_LOOP:
481+ case IP_RECVORIGDSTADDR:
473482 if (optlen >= sizeof(int)) {
474483 if (get_user(val, (int __user *) optval))
475484 return -EFAULT;
net/ipv4/ip_vti.c+5−0
@@ -324,12 +324,17 @@ static int vti_rcv(struct sk_buff *skb) · 323 unmodified lines
324324 if (tunnel != NULL) {
325325 struct pcpu_tstats *tstats;
326326
327+ if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb))
328+ return -1;
329+
327330 tstats = this_cpu_ptr(tunnel->dev->tstats);
328331 u64_stats_update_begin(&tstats->syncp);
329332 tstats->rx_packets++;
330333 tstats->rx_bytes += skb->len;
331334 u64_stats_update_end(&tstats->syncp);
332335
336+ skb->mark = 0;
337+ secpath_reset(skb);
333338 skb->dev = tunnel->dev;
334339 return 1;
335340 }
net/ipv4/tcp.c+2−2
@@ -1213,7 +1213,7 @@ new_segment: · 1212 unmodified lines
12131213 wait_for_sndbuf:
12141214 set_bit(SOCK_NOSPACE, &sk->sk_socket->flags);
12151215 wait_for_memory:
1216− if (copied && likely(!tp->repair))
1216+ if (copied)
12171217 tcp_push(sk, flags & ~MSG_MORE, mss_now, TCP_NAGLE_PUSH);
12181218
12191219 if ((err = sk_stream_wait_memory(sk, &timeo)) != 0)
@@ -1224,7 +1224,7 @@ wait_for_memory: · 4 unmodified lines
12241224 }
12251225
12261226 out:
1227− if (copied && likely(!tp->repair))
1227+ if (copied)
12281228 tcp_push(sk, flags, mss_now, tp->nonagle);
12291229 release_sock(sk);
12301230 return copied + copied_syn;
net/ipv4/tcp_input.c+10−5
@@ -5320,11 +5320,6 @@ static bool tcp_validate_incoming(struct sock *sk, struct sk_buff *skb, · 5319 unmodified lines
53205320 goto discard;
53215321 }
53225322
5323− /* ts_recent update must be made after we are sure that the packet
5324− * is in window.
5325− */
5326− tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq);
5327−
53285323 /* step 3: check security and precedence [ignored] */
53295324
53305325 /* step 4: Check for a SYN
@@ -5559,6 +5554,11 @@ step5: · 228 unmodified lines
55595554 if (th->ack && tcp_ack(sk, skb, FLAG_SLOWPATH) < 0)
55605555 goto discard;
55615556
5557+ /* ts_recent update must be made after we are sure that the packet
5558+ * is in window.
5559+ */
5560+ tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq);
5561+
55625562 tcp_rcv_rtt_measure_ts(sk, skb);
55635563
55645564 /* Process urgent data. */
@@ -6137,6 +6137,11 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, · 572 unmodified lines
61376137 } else
61386138 goto discard;
61396139
6140+ /* ts_recent update must be made after we are sure that the packet
6141+ * is in window.
6142+ */
6143+ tcp_replace_ts_recent(tp, TCP_SKB_CB(skb)->seq);
6144+
61406145 /* step 6: check the URG bit */
61416146 tcp_urg(sk, skb, th);
61426147
net/ipv4/tcp_metrics.c+9−3
@@ -1,7 +1,6 @@
11 #include <linux/rcupdate.h>
22 #include <linux/spinlock.h>
33 #include <linux/jiffies.h>
4−#include <linux/bootmem.h>
54 #include <linux/module.h>
65 #include <linux/cache.h>
76 #include <linux/slab.h>
@@ -9,6 +8,7 @@ · 1 unmodified line
98 #include <linux/tcp.h>
109 #include <linux/hash.h>
1110 #include <linux/tcp_metrics.h>
11+#include <linux/vmalloc.h>
1212
1313 #include <net/inet_connection_sock.h>
1414 #include <net/net_namespace.h>
@@ -1034,7 +1034,10 @@ static int __net_init tcp_net_metrics_init(struct net *net) · 1019 unmodified lines
10341034 net->ipv4.tcp_metrics_hash_log = order_base_2(slots);
10351035 size = sizeof(struct tcpm_hash_bucket) << net->ipv4.tcp_metrics_hash_log;
10361036
1037− net->ipv4.tcp_metrics_hash = kzalloc(size, GFP_KERNEL);
1037+ net->ipv4.tcp_metrics_hash = kzalloc(size, GFP_KERNEL | __GFP_NOWARN);
1038+ if (!net->ipv4.tcp_metrics_hash)
1039+ net->ipv4.tcp_metrics_hash = vzalloc(size);
1040+
10381041 if (!net->ipv4.tcp_metrics_hash)
10391042 return -ENOMEM;
10401043
@@ -1055,7 +1058,10 @@ static void __net_exit tcp_net_metrics_exit(struct net *net) · 14 unmodified lines
10551058 tm = next;
10561059 }
10571060 }
1058− kfree(net->ipv4.tcp_metrics_hash);
1061+ if (is_vmalloc_addr(net->ipv4.tcp_metrics_hash))
1062+ vfree(net->ipv4.tcp_metrics_hash);
1063+ else
1064+ kfree(net->ipv4.tcp_metrics_hash);
10591065 }
10601066
10611067 static __net_initdata struct pernet_operations tcp_net_metrics_ops = {
net/ipv4/tcp_output.c+4−0
@@ -1986,6 +1986,9 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, · 1985 unmodified lines
19861986 tso_segs = tcp_init_tso_segs(sk, skb, mss_now);
19871987 BUG_ON(!tso_segs);
19881988
1989+ if (unlikely(tp->repair) && tp->repair_queue == TCP_SEND_QUEUE)
1990+ goto repair; /* Skip network transmission */
1991+
19891992 cwnd_quota = tcp_cwnd_test(tp, skb);
19901993 if (!cwnd_quota)
19911994 break;
@@ -2026,6 +2029,7 @@ static bool tcp_write_xmit(struct sock *sk, unsigned int mss_now, int nonagle, · 34 unmodified lines
20262029 if (unlikely(tcp_transmit_skb(sk, skb, 1, gfp)))
20272030 break;
20282031
2032+repair:
20292033 /* Advance the send_head. This one is sent out.
20302034 * This call will increment packets_out.
20312035 */
net/ipv6/ipv6_sockglue.c+1−0
@@ -827,6 +827,7 @@ pref_skip_coa: · 826 unmodified lines
827827 if (val < 0 || val > 255)
828828 goto e_inval;
829829 np->min_hopcount = val;
830+ retv = 0;
830831 break;
831832 case IPV6_DONTFRAG:
832833 np->dontfrag = valbool;
net/mac80211/cfg.c+3−0
@@ -2613,6 +2613,9 @@ static void ieee80211_mgmt_frame_register(struct wiphy *wiphy, · 2612 unmodified lines
26132613 else
26142614 local->probe_req_reg--;
26152615
2616+ if (!local->open_count)
2617+ break;
2618+
26162619 ieee80211_queue_work(&local->hw, &local->reconfig_filter);
26172620 break;
26182621 default:
net/mac80211/ieee80211_i.h+2−0
@@ -1377,6 +1377,8 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, · 1376 unmodified lines
13771377 struct net_device *dev);
13781378 netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
13791379 struct net_device *dev);
1380+void ieee80211_purge_tx_queue(struct ieee80211_hw *hw,
1381+ struct sk_buff_head *skbs);
13801382
13811383 /* HT */
13821384 void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata,
net/mac80211/main.c+4−2
@@ -920,8 +920,10 @@ int ieee80211_register_hw(struct ieee80211_hw *hw) · 919 unmodified lines
920920 local->hw.wiphy->cipher_suites,
921921 sizeof(u32) * local->hw.wiphy->n_cipher_suites,
922922 GFP_KERNEL);
923− if (!suites)
924− return -ENOMEM;
923+ if (!suites) {
924+ result = -ENOMEM;
925+ goto fail_wiphy_register;
926+ }
925927 for (r = 0; r < local->hw.wiphy->n_cipher_suites; r++) {
926928 u32 suite = local->hw.wiphy->cipher_suites[r];
927929 if (suite == WLAN_CIPHER_SUITE_WEP40 ||
net/mac80211/scan.c+1−1
@@ -934,7 +934,7 @@ int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata, · 933 unmodified lines
934934 struct cfg80211_sched_scan_request *req)
935935 {
936936 struct ieee80211_local *local = sdata->local;
937− struct ieee80211_sched_scan_ies sched_scan_ies;
937+ struct ieee80211_sched_scan_ies sched_scan_ies = {};
938938 int ret, i;
939939
940940 mutex_lock(&local->mtx);
net/mac80211/sta_info.c+8−3
@@ -122,8 +122,8 @@ static void free_sta_work(struct work_struct *wk) · 121 unmodified lines
122122
123123 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
124124 local->total_ps_buffered -= skb_queue_len(&sta->ps_tx_buf[ac]);
125− __skb_queue_purge(&sta->ps_tx_buf[ac]);
126− __skb_queue_purge(&sta->tx_filtered[ac]);
125+ ieee80211_purge_tx_queue(&local->hw, &sta->ps_tx_buf[ac]);
126+ ieee80211_purge_tx_queue(&local->hw, &sta->tx_filtered[ac]);
127127 }
128128
129129 #ifdef CONFIG_MAC80211_MESH
@@ -146,7 +146,7 @@ static void free_sta_work(struct work_struct *wk) · 16 unmodified lines
146146 tid_tx = rcu_dereference_raw(sta->ampdu_mlme.tid_tx[i]);
147147 if (!tid_tx)
148148 continue;
149− __skb_queue_purge(&tid_tx->pending);
149+ ieee80211_purge_tx_queue(&local->hw, &tid_tx->pending);
150150 kfree(tid_tx);
151151 }
152152
@@ -982,6 +982,7 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta) · 829 unmodified lines
982982 struct ieee80211_local *local = sdata->local;
983983 struct sk_buff_head pending;
984984 int filtered = 0, buffered = 0, ac;
985+ unsigned long flags;
985986
986987 clear_sta_flag(sta, WLAN_STA_SP);
987988
@@ -997,12 +998,16 @@ void ieee80211_sta_ps_deliver_wakeup(struct sta_info *sta) · 9 unmodified lines
997998 for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) {
998999 int count = skb_queue_len(&pending), tmp;
9991000
1001+ spin_lock_irqsave(&sta->tx_filtered[ac].lock, flags);
10001002 skb_queue_splice_tail_init(&sta->tx_filtered[ac], &pending);
1003+ spin_unlock_irqrestore(&sta->tx_filtered[ac].lock, flags);
10011004 tmp = skb_queue_len(&pending);
10021005 filtered += tmp - count;
10031006 count = tmp;
10041007
1008+ spin_lock_irqsave(&sta->ps_tx_buf[ac].lock, flags);
10051009 skb_queue_splice_tail_init(&sta->ps_tx_buf[ac], &pending);
1010+ spin_unlock_irqrestore(&sta->ps_tx_buf[ac].lock, flags);
10061011 tmp = skb_queue_len(&pending);
10071012 buffered += tmp - count;
10081013 }
net/mac80211/status.c+9−0
@@ -669,3 +669,12 @@ void ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb) · 668 unmodified lines
669669 dev_kfree_skb_any(skb);
670670 }
671671 EXPORT_SYMBOL(ieee80211_free_txskb);
672+
673+void ieee80211_purge_tx_queue(struct ieee80211_hw *hw,
674+ struct sk_buff_head *skbs)
675+{
676+ struct sk_buff *skb;
677+
678+ while ((skb = __skb_dequeue(skbs)))
679+ ieee80211_free_txskb(hw, skb);
680+}
net/mac80211/tx.c+6−3
@@ -1361,7 +1361,7 @@ static int invoke_tx_handlers(struct ieee80211_tx_data *tx) · 1360 unmodified lines
13611361 if (tx->skb)
13621362 ieee80211_free_txskb(&tx->local->hw, tx->skb);
13631363 else
1364− __skb_queue_purge(&tx->skbs);
1364+ ieee80211_purge_tx_queue(&tx->local->hw, &tx->skbs);
13651365 return -1;
13661366 } else if (unlikely(res == TX_QUEUED)) {
13671367 I802_DEBUG_INC(tx->local->tx_handlers_queued);
@@ -2160,10 +2160,13 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, · 792 unmodified lines
21602160 */
21612161 void ieee80211_clear_tx_pending(struct ieee80211_local *local)
21622162 {
2163+ struct sk_buff *skb;
21632164 int i;
21642165
2165− for (i = 0; i < local->hw.queues; i++)
2166− skb_queue_purge(&local->pending[i]);
2166+ for (i = 0; i < local->hw.queues; i++) {
2167+ while ((skb = skb_dequeue(&local->pending[i])) != NULL)
2168+ ieee80211_free_txskb(&local->hw, skb);
2169+ }
21672170 }
21682171
21692172 /*
net/mac80211/util.c+2−0
@@ -1534,6 +1534,8 @@ int ieee80211_reconfig(struct ieee80211_local *local) · 1533 unmodified lines
15341534 list_for_each_entry(sdata, &local->interfaces, list) {
15351535 if (sdata->vif.type != NL80211_IFTYPE_STATION)
15361536 continue;
1537+ if (!sdata->u.mgd.associated)
1538+ continue;
15371539
15381540 ieee80211_send_nullfunc(local, sdata, 0);
15391541 }
net/sctp/proc.c+4−4
@@ -102,7 +102,7 @@ static const struct file_operations sctp_snmp_seq_fops = { · 101 unmodified lines
102102 .open = sctp_snmp_seq_open,
103103 .read = seq_read,
104104 .llseek = seq_lseek,
105− .release = single_release,
105+ .release = single_release_net,
106106 };
107107
108108 /* Set up the proc fs entry for 'snmp' object. */
@@ -251,7 +251,7 @@ static const struct file_operations sctp_eps_seq_fops = { · 142 unmodified lines
251251 .open = sctp_eps_seq_open,
252252 .read = seq_read,
253253 .llseek = seq_lseek,
254− .release = seq_release,
254+ .release = seq_release_net,
255255 };
256256
257257 /* Set up the proc fs entry for 'eps' object. */
@@ -372,7 +372,7 @@ static const struct file_operations sctp_assocs_seq_fops = { · 114 unmodified lines
372372 .open = sctp_assocs_seq_open,
373373 .read = seq_read,
374374 .llseek = seq_lseek,
375− .release = seq_release,
375+ .release = seq_release_net,
376376 };
377377
378378 /* Set up the proc fs entry for 'assocs' object. */
@@ -517,7 +517,7 @@ static const struct file_operations sctp_remaddr_seq_fops = { · 138 unmodified lines
517517 .open = sctp_remaddr_seq_open,
518518 .read = seq_read,
519519 .llseek = seq_lseek,
520− .release = seq_release,
520+ .release = seq_release_net,
521521 };
522522
523523 int __net_init sctp_remaddr_proc_init(struct net *net)
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/wireless/reg.c+2−3
@@ -141,9 +141,8 @@ static const struct ieee80211_regdomain world_regdom = { · 140 unmodified lines
141141 .reg_rules = {
142142 /* IEEE 802.11b/g, channels 1..11 */
143143 REG_RULE(2412-10, 2462+10, 40, 6, 20, 0),
144− /* IEEE 802.11b/g, channels 12..13. No HT40
145− * channel fits here. */
146− REG_RULE(2467-10, 2472+10, 20, 6, 20,
144+ /* IEEE 802.11b/g, channels 12..13. */
145+ REG_RULE(2467-10, 2472+10, 40, 6, 20,
147146 NL80211_RRF_PASSIVE_SCAN |
148147 NL80211_RRF_NO_IBSS),
149148 /* IEEE 802.11 channel 14 - Only JP enables
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 }
scripts/kconfig/expr.h+2−3
@@ -12,7 +12,7 @@ extern "C" { · 11 unmodified lines
1212
1313 #include <assert.h>
1414 #include <stdio.h>
15−#include <sys/queue.h>
15+#include "list.h"
1616 #ifndef __cplusplus
1717 #include <stdbool.h>
1818 #endif
@@ -175,12 +175,11 @@ struct menu { · 156 unmodified lines
175175 #define MENU_ROOT 0x0002
176176
177177 struct jump_key {
178− CIRCLEQ_ENTRY(jump_key) entries;
178+ struct list_head entries;
179179 size_t offset;
180180 struct menu *target;
181181 int index;
182182 };
183−CIRCLEQ_HEAD(jk_head, jump_key);
184183
185184 #define JUMP_NB 9
186185
scripts/kconfig/list.h+91−0
@@ -0,0 +1,91 @@
1+#ifndef LIST_H
2+#define LIST_H
3+
4+/*
5+ * Copied from include/linux/...
6+ */
7+
8+#undef offsetof
9+#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
10+
11+/**
12+ * container_of - cast a member of a structure out to the containing structure
13+ * @ptr: the pointer to the member.
14+ * @type: the type of the container struct this is embedded in.
15+ * @member: the name of the member within the struct.
16+ *
17+ */
18+#define container_of(ptr, type, member) ({ \
19+ const typeof( ((type *)0)->member ) *__mptr = (ptr); \
20+ (type *)( (char *)__mptr - offsetof(type,member) );})
21+
22+
23+struct list_head {
24+ struct list_head *next, *prev;
25+};
26+
27+
28+#define LIST_HEAD_INIT(name) { &(name), &(name) }
29+
30+#define LIST_HEAD(name) \
31+ struct list_head name = LIST_HEAD_INIT(name)
32+
33+/**
34+ * list_entry - get the struct for this entry
35+ * @ptr: the &struct list_head pointer.
36+ * @type: the type of the struct this is embedded in.
37+ * @member: the name of the list_struct within the struct.
38+ */
39+#define list_entry(ptr, type, member) \
40+ container_of(ptr, type, member)
41+
42+/**
43+ * list_for_each_entry - iterate over list of given type
44+ * @pos: the type * to use as a loop cursor.
45+ * @head: the head for your list.
46+ * @member: the name of the list_struct within the struct.
47+ */
48+#define list_for_each_entry(pos, head, member) \
49+ for (pos = list_entry((head)->next, typeof(*pos), member); \
50+ &pos->member != (head); \
51+ pos = list_entry(pos->member.next, typeof(*pos), member))
52+
53+/**
54+ * list_empty - tests whether a list is empty
55+ * @head: the list to test.
56+ */
57+static inline int list_empty(const struct list_head *head)
58+{
59+ return head->next == head;
60+}
61+
62+/*
63+ * Insert a new entry between two known consecutive entries.
64+ *
65+ * This is only for internal list manipulation where we know
66+ * the prev/next entries already!
67+ */
68+static inline void __list_add(struct list_head *_new,
69+ struct list_head *prev,
70+ struct list_head *next)
71+{
72+ next->prev = _new;
73+ _new->next = next;
74+ _new->prev = prev;
75+ prev->next = _new;
76+}
77+
78+/**
79+ * list_add_tail - add a new entry
80+ * @new: new entry to be added
81+ * @head: list head to add it before
82+ *
83+ * Insert a new entry before the specified head.
84+ * This is useful for implementing queues.
85+ */
86+static inline void list_add_tail(struct list_head *_new, struct list_head *head)
87+{
88+ __list_add(_new, head->prev, head);
89+}
90+
91+#endif
scripts/kconfig/lkc_proto.h+2−2
@@ -21,9 +21,9 @@ P(menu_get_root_menu,struct menu *,(struct menu *menu)); · 20 unmodified lines
2121 P(menu_get_parent_menu,struct menu *,(struct menu *menu));
2222 P(menu_has_help,bool,(struct menu *menu));
2323 P(menu_get_help,const char *,(struct menu *menu));
24−P(get_symbol_str, void, (struct gstr *r, struct symbol *sym, struct jk_head
24+P(get_symbol_str, void, (struct gstr *r, struct symbol *sym, struct list_head
2525 *head));
26−P(get_relations_str, struct gstr, (struct symbol **sym_arr, struct jk_head
26+P(get_relations_str, struct gstr, (struct symbol **sym_arr, struct list_head
2727 *head));
2828 P(menu_get_ext_help,void,(struct menu *menu, struct gstr *help));
2929
scripts/kconfig/mconf.c+3−3
@@ -312,7 +312,7 @@ static void set_config_filename(const char *config_filename) · 311 unmodified lines
312312
313313
314314 struct search_data {
315− struct jk_head *head;
315+ struct list_head *head;
316316 struct menu **targets;
317317 int *keys;
318318 };
@@ -323,7 +323,7 @@ static void update_text(char *buf, size_t start, size_t end, void *_data) · 4 unmodified lines
323323 struct jump_key *pos;
324324 int k = 0;
325325
326− CIRCLEQ_FOREACH(pos, data->head, entries) {
326+ list_for_each_entry(pos, data->head, entries) {
327327 if (pos->offset >= start && pos->offset < end) {
328328 char header[4];
329329
@@ -375,7 +375,7 @@ again: · 45 unmodified lines
375375
376376 sym_arr = sym_re_search(dialog_input);
377377 do {
378− struct jk_head head = CIRCLEQ_HEAD_INITIALIZER(head);
378+ LIST_HEAD(head);
379379 struct menu *targets[JUMP_NB];
380380 int keys[JUMP_NB + 1], i;
381381 struct search_data data = {
scripts/kconfig/menu.c+8−6
@@ -508,7 +508,7 @@ const char *menu_get_help(struct menu *menu) · 507 unmodified lines
508508 }
509509
510510 static void get_prompt_str(struct gstr *r, struct property *prop,
511− struct jk_head *head)
511+ struct list_head *head)
512512 {
513513 int i, j;
514514 struct menu *submenu[8], *menu, *location = NULL;
@@ -544,12 +544,13 @@ static void get_prompt_str(struct gstr *r, struct property *prop, · 29 unmodified lines
544544 } else
545545 jump->target = location;
546546
547− if (CIRCLEQ_EMPTY(head))
547+ if (list_empty(head))
548548 jump->index = 0;
549549 else
550− jump->index = CIRCLEQ_LAST(head)->index + 1;
550+ jump->index = list_entry(head->prev, struct jump_key,
551+ entries)->index + 1;
551552
552− CIRCLEQ_INSERT_TAIL(head, jump, entries);
553+ list_add_tail(&jump->entries, head);
553554 }
554555
555556 if (i > 0) {
@@ -573,7 +574,8 @@ static void get_prompt_str(struct gstr *r, struct property *prop, · 17 unmodified lines
573574 /*
574575 * head is optional and may be NULL
575576 */
576−void get_symbol_str(struct gstr *r, struct symbol *sym, struct jk_head *head)
577+void get_symbol_str(struct gstr *r, struct symbol *sym,
578+ struct list_head *head)
577579 {
578580 bool hit;
579581 struct property *prop;
@@ -612,7 +614,7 @@ void get_symbol_str(struct gstr *r, struct symbol *sym, struct jk_head *head) · 32 unmodified lines
612614 str_append(r, "\n\n");
613615 }
614616
615−struct gstr get_relations_str(struct symbol **sym_arr, struct jk_head *head)
617+struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head)
616618 {
617619 struct symbol *sym;
618620 struct gstr res = str_new();
security/device_cgroup.c+13−5
@@ -164,8 +164,8 @@ static void dev_exception_clean(struct dev_cgroup *dev_cgroup) · 163 unmodified lines
164164 struct dev_exception_item *ex, *tmp;
165165
166166 list_for_each_entry_safe(ex, tmp, &dev_cgroup->exceptions, list) {
167− list_del(&ex->list);
168− kfree(ex);
167+ list_del_rcu(&ex->list);
168+ kfree_rcu(ex, rcu);
169169 }
170170 }
171171
@@ -298,7 +298,7 @@ static int may_access(struct dev_cgroup *dev_cgroup, · 126 unmodified lines
298298 struct dev_exception_item *ex;
299299 bool match = false;
300300
301− list_for_each_entry(ex, &dev_cgroup->exceptions, list) {
301+ list_for_each_entry_rcu(ex, &dev_cgroup->exceptions, list) {
302302 if ((refex->type & DEV_BLOCK) && !(ex->type & DEV_BLOCK))
303303 continue;
304304 if ((refex->type & DEV_CHAR) && !(ex->type & DEV_CHAR))
@@ -352,6 +352,8 @@ static int parent_has_perm(struct dev_cgroup *childcg, · 47 unmodified lines
352352 */
353353 static inline int may_allow_all(struct dev_cgroup *parent)
354354 {
355+ if (!parent)
356+ return 1;
355357 return parent->behavior == DEVCG_DEFAULT_ALLOW;
356358 }
357359
@@ -376,11 +378,14 @@ static int devcgroup_update_access(struct dev_cgroup *devcgroup, · 18 unmodified lines
376378 int count, rc;
377379 struct dev_exception_item ex;
378380 struct cgroup *p = devcgroup->css.cgroup;
379− struct dev_cgroup *parent = cgroup_to_devcgroup(p->parent);
381+ struct dev_cgroup *parent = NULL;
380382
381383 if (!capable(CAP_SYS_ADMIN))
382384 return -EPERM;
383385
386+ if (p->parent)
387+ parent = cgroup_to_devcgroup(p->parent);
388+
384389 memset(&ex, 0, sizeof(ex));
385390 b = buffer;
386391
@@ -391,11 +396,14 @@ static int devcgroup_update_access(struct dev_cgroup *devcgroup, · 4 unmodified lines
391396 if (!may_allow_all(parent))
392397 return -EPERM;
393398 dev_exception_clean(devcgroup);
399+ devcgroup->behavior = DEVCG_DEFAULT_ALLOW;
400+ if (!parent)
401+ break;
402+
394403 rc = dev_exceptions_copy(&devcgroup->exceptions,
395404 &parent->exceptions);
396405 if (rc)
397406 return rc;
398− devcgroup->behavior = DEVCG_DEFAULT_ALLOW;
399407 break;
400408 case DEVCG_DENY:
401409 dev_exception_clean(devcgroup);
sound/core/oss/mixer_oss.c+1−0
@@ -76,6 +76,7 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file) · 75 unmodified lines
7676 snd_card_unref(card);
7777 return -EFAULT;
7878 }
79+ snd_card_unref(card);
7980 return 0;
8081 }
8182
sound/core/oss/pcm_oss.c+1−0
@@ -2454,6 +2454,7 @@ static int snd_pcm_oss_open(struct inode *inode, struct file *file) · 2453 unmodified lines
24542454 mutex_unlock(&pcm->open_mutex);
24552455 if (err < 0)
24562456 goto __error;
2457+ snd_card_unref(pcm->card);
24572458 return err;
24582459
24592460 __error:
sound/core/pcm_native.c+4−2
@@ -2122,7 +2122,8 @@ static int snd_pcm_playback_open(struct inode *inode, struct file *file) · 2121 unmodified lines
21222122 pcm = snd_lookup_minor_data(iminor(inode),
21232123 SNDRV_DEVICE_TYPE_PCM_PLAYBACK);
21242124 err = snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_PLAYBACK);
2125− snd_card_unref(pcm->card);
2125+ if (pcm)
2126+ snd_card_unref(pcm->card);
21262127 return err;
21272128 }
21282129
@@ -2135,7 +2136,8 @@ static int snd_pcm_capture_open(struct inode *inode, struct file *file) · 6 unmodified lines
21352136 pcm = snd_lookup_minor_data(iminor(inode),
21362137 SNDRV_DEVICE_TYPE_PCM_CAPTURE);
21372138 err = snd_pcm_open(file, pcm, SNDRV_PCM_STREAM_CAPTURE);
2138− snd_card_unref(pcm->card);
2139+ if (pcm)
2140+ snd_card_unref(pcm->card);
21392141 return err;
21402142 }
21412143
sound/core/sound.c+1−1
@@ -114,7 +114,7 @@ void *snd_lookup_minor_data(unsigned int minor, int type) · 113 unmodified lines
114114 mreg = snd_minors[minor];
115115 if (mreg && mreg->type == type) {
116116 private_data = mreg->private_data;
117− if (mreg->card_ptr)
117+ if (private_data && mreg->card_ptr)
118118 atomic_inc(&mreg->card_ptr->refcount);
119119 } else
120120 private_data = NULL;
sound/core/sound_oss.c+1−1
@@ -54,7 +54,7 @@ void *snd_lookup_oss_minor_data(unsigned int minor, int type) · 53 unmodified lines
5454 mreg = snd_oss_minors[minor];
5555 if (mreg && mreg->type == type) {
5656 private_data = mreg->private_data;
57− if (mreg->card_ptr)
57+ if (private_data && mreg->card_ptr)
5858 atomic_inc(&mreg->card_ptr->refcount);
5959 } else
6060 private_data = NULL;
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+9−2
@@ -2581,9 +2581,14 @@ static u8 snd_es1968_tea575x_get_pins(struct snd_tea575x *tea) · 2580 unmodified lines
25812581 struct es1968 *chip = tea->private_data;
25822582 unsigned long io = chip->io_port + GPIO_DATA;
25832583 u16 val = inw(io);
2584+ u8 ret;
25842585
2585− return (val & STR_DATA) ? TEA575X_DATA : 0 |
2586− (val & STR_MOST) ? TEA575X_MOST : 0;
2586+ ret = 0;
2587+ if (val & STR_DATA)
2588+ ret |= TEA575X_DATA;
2589+ if (val & STR_MOST)
2590+ ret |= TEA575X_MOST;
2591+ return ret;
25872592 }
25882593
25892594 static void snd_es1968_tea575x_set_direction(struct snd_tea575x *tea, bool output)
@@ -2655,6 +2660,8 @@ static struct ess_device_list pm_whitelist[] __devinitdata = { · 65 unmodified lines
26552660 { TYPE_MAESTRO2E, 0x1179 },
26562661 { TYPE_MAESTRO2E, 0x14c0 }, /* HP omnibook 4150 */
26572662 { TYPE_MAESTRO2E, 0x1558 },
2663+ { TYPE_MAESTRO2E, 0x125d }, /* a PCI card, e.g. Terratec DMX */
2664+ { TYPE_MAESTRO2, 0x125d }, /* a PCI card, e.g. SF64-PCE2 */
26582665 };
26592666
26602667 static struct ess_device_list mpu_blacklist[] __devinitdata = {
sound/pci/fm801.c+8−3
@@ -767,9 +767,14 @@ static u8 snd_fm801_tea575x_get_pins(struct snd_tea575x *tea) · 766 unmodified lines
767767 struct fm801 *chip = tea->private_data;
768768 unsigned short reg = inw(FM801_REG(chip, GPIO_CTRL));
769769 struct snd_fm801_tea575x_gpio gpio = *get_tea575x_gpio(chip);
770−
771− return (reg & FM801_GPIO_GP(gpio.data)) ? TEA575X_DATA : 0 |
772− (reg & FM801_GPIO_GP(gpio.most)) ? TEA575X_MOST : 0;
770+ u8 ret;
771+
772+ ret = 0;
773+ if (reg & FM801_GPIO_GP(gpio.data))
774+ ret |= TEA575X_DATA;
775+ if (reg & FM801_GPIO_GP(gpio.most))
776+ ret |= TEA575X_MOST;
777+ return ret;
773778 }
774779
775780 static void snd_fm801_tea575x_set_direction(struct snd_tea575x *tea, bool output)
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+14−13
@@ -5407,6 +5407,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = { · 5406 unmodified lines
54075407 SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC889_FIXUP_IMAC91_VREF),
54085408 SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC889_FIXUP_IMAC91_VREF),
54095409 SND_PCI_QUIRK(0x106b, 0x4200, "Mac Pro 5,1", ALC885_FIXUP_MACPRO_GPIO),
5410+ SND_PCI_QUIRK(0x106b, 0x4300, "iMac 9,1", ALC889_FIXUP_IMAC91_VREF),
54105411 SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC889_FIXUP_IMAC91_VREF),
54115412 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC889_FIXUP_IMAC91_VREF),
54125413 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC889_FIXUP_IMAC91_VREF),
@@ -5840,7 +5841,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec) · 427 unmodified lines
58405841 return alc_parse_auto_config(codec, alc269_ignore, ssids);
58415842 }
58425843
5843−static void alc269_toggle_power_output(struct hda_codec *codec, int power_up)
5844+static void alc269vb_toggle_power_output(struct hda_codec *codec, int power_up)
58445845 {
58455846 int val = alc_read_coef_idx(codec, 0x04);
58465847 if (power_up)
@@ -5857,10 +5858,10 @@ static void alc269_shutup(struct hda_codec *codec) · 10 unmodified lines
58575858 if (spec->codec_variant != ALC269_TYPE_ALC269VB)
58585859 return;
58595860
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);
5861+ if (spec->codec_variant == ALC269_TYPE_ALC269VB)
5862+ alc269vb_toggle_power_output(codec, 0);
5863+ if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
5864+ (alc_get_coef0(codec) & 0x00ff) == 0x018) {
58645865 msleep(150);
58655866 }
58665867 }
@@ -5870,24 +5871,22 @@ static int alc269_resume(struct hda_codec *codec) · 3 unmodified lines
58705871 {
58715872 struct alc_spec *spec = codec->spec;
58725873
5873− if (spec->codec_variant == ALC269_TYPE_ALC269VB ||
5874+ if (spec->codec_variant == ALC269_TYPE_ALC269VB)
5875+ alc269vb_toggle_power_output(codec, 0);
5876+ if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
58745877 (alc_get_coef0(codec) & 0x00ff) == 0x018) {
5875− alc269_toggle_power_output(codec, 0);
58765878 msleep(150);
58775879 }
58785880
58795881 codec->patch_ops.init(codec);
58805882
5881− if (spec->codec_variant == ALC269_TYPE_ALC269VB ||
5883+ if (spec->codec_variant == ALC269_TYPE_ALC269VB)
5884+ alc269vb_toggle_power_output(codec, 1);
5885+ if (spec->codec_variant == ALC269_TYPE_ALC269VB &&
58825886 (alc_get_coef0(codec) & 0x00ff) == 0x017) {
5883− alc269_toggle_power_output(codec, 1);
58845887 msleep(200);
58855888 }
58865889
5887− if (spec->codec_variant == ALC269_TYPE_ALC269VB ||
5888− (alc_get_coef0(codec) & 0x00ff) == 0x018)
5889− alc269_toggle_power_output(codec, 1);
5890−
58915890 snd_hda_codec_resume_amp(codec);
58925891 snd_hda_codec_resume_cache(codec);
58935892 hda_call_check_power_status(codec, 0x01);
@@ -7079,6 +7078,7 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = { · 1185 unmodified lines
70797078 .patch = patch_alc662 },
70807079 { .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 },
70817080 { .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 },
7081+ { .id = 0x10ec0668, .name = "ALC668", .patch = patch_alc662 },
70827082 { .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },
70837083 { .id = 0x10ec0680, .name = "ALC680", .patch = patch_alc680 },
70847084 { .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },
@@ -7096,6 +7096,7 @@ static const struct hda_codec_preset snd_hda_preset_realtek[] = { · 11 unmodified lines
70967096 { .id = 0x10ec0889, .name = "ALC889", .patch = patch_alc882 },
70977097 { .id = 0x10ec0892, .name = "ALC892", .patch = patch_alc662 },
70987098 { .id = 0x10ec0899, .name = "ALC898", .patch = patch_alc882 },
7099+ { .id = 0x10ec0900, .name = "ALC1150", .patch = patch_alc882 },
70997100 {} /* terminator */
71007101 };
71017102
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/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+2−3
@@ -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;
@@ -773,7 +773,6 @@ static int cs42l52_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) · 3 unmodified lines
773773 {
774774 struct snd_soc_codec *codec = codec_dai->codec;
775775 struct cs42l52_private *cs42l52 = snd_soc_codec_get_drvdata(codec);
776− int ret = 0;
777776 u8 iface = 0;
778777
779778 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
@@ -822,7 +821,7 @@ static int cs42l52_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) · 42 unmodified lines
822821 case SND_SOC_DAIFMT_NB_IF:
823822 break;
824823 default:
825− ret = -EINVAL;
824+ return -EINVAL;
826825 }
827826 cs42l52->config.format = iface;
828827 snd_soc_write(codec, CS42L52_IFACE_CTL1, cs42l52->config.format);
sound/soc/codecs/wm5102.c+551−1
@@ -42,6 +42,556 @@ static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0); · 41 unmodified lines
4242 static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
4343 static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0);
4444
45+static const struct reg_default wm5102_sysclk_reva_patch[] = {
46+ { 0x3000, 0x2225 },
47+ { 0x3001, 0x3a03 },
48+ { 0x3002, 0x0225 },
49+ { 0x3003, 0x0801 },
50+ { 0x3004, 0x6249 },
51+ { 0x3005, 0x0c04 },
52+ { 0x3006, 0x0225 },
53+ { 0x3007, 0x5901 },
54+ { 0x3008, 0xe249 },
55+ { 0x3009, 0x030d },
56+ { 0x300a, 0x0249 },
57+ { 0x300b, 0x2c01 },
58+ { 0x300c, 0xe249 },
59+ { 0x300d, 0x4342 },
60+ { 0x300e, 0xe249 },
61+ { 0x300f, 0x73c0 },
62+ { 0x3010, 0x4249 },
63+ { 0x3011, 0x0c00 },
64+ { 0x3012, 0x0225 },
65+ { 0x3013, 0x1f01 },
66+ { 0x3014, 0x0225 },
67+ { 0x3015, 0x1e01 },
68+ { 0x3016, 0x0225 },
69+ { 0x3017, 0xfa00 },
70+ { 0x3018, 0x0000 },
71+ { 0x3019, 0xf000 },
72+ { 0x301a, 0x0000 },
73+ { 0x301b, 0xf000 },
74+ { 0x301c, 0x0000 },
75+ { 0x301d, 0xf000 },
76+ { 0x301e, 0x0000 },
77+ { 0x301f, 0xf000 },
78+ { 0x3020, 0x0000 },
79+ { 0x3021, 0xf000 },
80+ { 0x3022, 0x0000 },
81+ { 0x3023, 0xf000 },
82+ { 0x3024, 0x0000 },
83+ { 0x3025, 0xf000 },
84+ { 0x3026, 0x0000 },
85+ { 0x3027, 0xf000 },
86+ { 0x3028, 0x0000 },
87+ { 0x3029, 0xf000 },
88+ { 0x302a, 0x0000 },
89+ { 0x302b, 0xf000 },
90+ { 0x302c, 0x0000 },
91+ { 0x302d, 0xf000 },
92+ { 0x302e, 0x0000 },
93+ { 0x302f, 0xf000 },
94+ { 0x3030, 0x0225 },
95+ { 0x3031, 0x1a01 },
96+ { 0x3032, 0x0225 },
97+ { 0x3033, 0x1e00 },
98+ { 0x3034, 0x0225 },
99+ { 0x3035, 0x1f00 },
100+ { 0x3036, 0x6225 },
101+ { 0x3037, 0xf800 },
102+ { 0x3038, 0x0000 },
103+ { 0x3039, 0xf000 },
104+ { 0x303a, 0x0000 },
105+ { 0x303b, 0xf000 },
106+ { 0x303c, 0x0000 },
107+ { 0x303d, 0xf000 },
108+ { 0x303e, 0x0000 },
109+ { 0x303f, 0xf000 },
110+ { 0x3040, 0x2226 },
111+ { 0x3041, 0x3a03 },
112+ { 0x3042, 0x0226 },
113+ { 0x3043, 0x0801 },
114+ { 0x3044, 0x6249 },
115+ { 0x3045, 0x0c06 },
116+ { 0x3046, 0x0226 },
117+ { 0x3047, 0x5901 },
118+ { 0x3048, 0xe249 },
119+ { 0x3049, 0x030d },
120+ { 0x304a, 0x0249 },
121+ { 0x304b, 0x2c01 },
122+ { 0x304c, 0xe249 },
123+ { 0x304d, 0x4342 },
124+ { 0x304e, 0xe249 },
125+ { 0x304f, 0x73c0 },
126+ { 0x3050, 0x4249 },
127+ { 0x3051, 0x0c00 },
128+ { 0x3052, 0x0226 },
129+ { 0x3053, 0x1f01 },
130+ { 0x3054, 0x0226 },
131+ { 0x3055, 0x1e01 },
132+ { 0x3056, 0x0226 },
133+ { 0x3057, 0xfa00 },
134+ { 0x3058, 0x0000 },
135+ { 0x3059, 0xf000 },
136+ { 0x305a, 0x0000 },
137+ { 0x305b, 0xf000 },
138+ { 0x305c, 0x0000 },
139+ { 0x305d, 0xf000 },
140+ { 0x305e, 0x0000 },
141+ { 0x305f, 0xf000 },
142+ { 0x3060, 0x0000 },
143+ { 0x3061, 0xf000 },
144+ { 0x3062, 0x0000 },
145+ { 0x3063, 0xf000 },
146+ { 0x3064, 0x0000 },
147+ { 0x3065, 0xf000 },
148+ { 0x3066, 0x0000 },
149+ { 0x3067, 0xf000 },
150+ { 0x3068, 0x0000 },
151+ { 0x3069, 0xf000 },
152+ { 0x306a, 0x0000 },
153+ { 0x306b, 0xf000 },
154+ { 0x306c, 0x0000 },
155+ { 0x306d, 0xf000 },
156+ { 0x306e, 0x0000 },
157+ { 0x306f, 0xf000 },
158+ { 0x3070, 0x0226 },
159+ { 0x3071, 0x1a01 },
160+ { 0x3072, 0x0226 },
161+ { 0x3073, 0x1e00 },
162+ { 0x3074, 0x0226 },
163+ { 0x3075, 0x1f00 },
164+ { 0x3076, 0x6226 },
165+ { 0x3077, 0xf800 },
166+ { 0x3078, 0x0000 },
167+ { 0x3079, 0xf000 },
168+ { 0x307a, 0x0000 },
169+ { 0x307b, 0xf000 },
170+ { 0x307c, 0x0000 },
171+ { 0x307d, 0xf000 },
172+ { 0x307e, 0x0000 },
173+ { 0x307f, 0xf000 },
174+ { 0x3080, 0x2227 },
175+ { 0x3081, 0x3a03 },
176+ { 0x3082, 0x0227 },
177+ { 0x3083, 0x0801 },
178+ { 0x3084, 0x6255 },
179+ { 0x3085, 0x0c04 },
180+ { 0x3086, 0x0227 },
181+ { 0x3087, 0x5901 },
182+ { 0x3088, 0xe255 },
183+ { 0x3089, 0x030d },
184+ { 0x308a, 0x0255 },
185+ { 0x308b, 0x2c01 },
186+ { 0x308c, 0xe255 },
187+ { 0x308d, 0x4342 },
188+ { 0x308e, 0xe255 },
189+ { 0x308f, 0x73c0 },
190+ { 0x3090, 0x4255 },
191+ { 0x3091, 0x0c00 },
192+ { 0x3092, 0x0227 },
193+ { 0x3093, 0x1f01 },
194+ { 0x3094, 0x0227 },
195+ { 0x3095, 0x1e01 },
196+ { 0x3096, 0x0227 },
197+ { 0x3097, 0xfa00 },
198+ { 0x3098, 0x0000 },
199+ { 0x3099, 0xf000 },
200+ { 0x309a, 0x0000 },
201+ { 0x309b, 0xf000 },
202+ { 0x309c, 0x0000 },
203+ { 0x309d, 0xf000 },
204+ { 0x309e, 0x0000 },
205+ { 0x309f, 0xf000 },
206+ { 0x30a0, 0x0000 },
207+ { 0x30a1, 0xf000 },
208+ { 0x30a2, 0x0000 },
209+ { 0x30a3, 0xf000 },
210+ { 0x30a4, 0x0000 },
211+ { 0x30a5, 0xf000 },
212+ { 0x30a6, 0x0000 },
213+ { 0x30a7, 0xf000 },
214+ { 0x30a8, 0x0000 },
215+ { 0x30a9, 0xf000 },
216+ { 0x30aa, 0x0000 },
217+ { 0x30ab, 0xf000 },
218+ { 0x30ac, 0x0000 },
219+ { 0x30ad, 0xf000 },
220+ { 0x30ae, 0x0000 },
221+ { 0x30af, 0xf000 },
222+ { 0x30b0, 0x0227 },
223+ { 0x30b1, 0x1a01 },
224+ { 0x30b2, 0x0227 },
225+ { 0x30b3, 0x1e00 },
226+ { 0x30b4, 0x0227 },
227+ { 0x30b5, 0x1f00 },
228+ { 0x30b6, 0x6227 },
229+ { 0x30b7, 0xf800 },
230+ { 0x30b8, 0x0000 },
231+ { 0x30b9, 0xf000 },
232+ { 0x30ba, 0x0000 },
233+ { 0x30bb, 0xf000 },
234+ { 0x30bc, 0x0000 },
235+ { 0x30bd, 0xf000 },
236+ { 0x30be, 0x0000 },
237+ { 0x30bf, 0xf000 },
238+ { 0x30c0, 0x2228 },
239+ { 0x30c1, 0x3a03 },
240+ { 0x30c2, 0x0228 },
241+ { 0x30c3, 0x0801 },
242+ { 0x30c4, 0x6255 },
243+ { 0x30c5, 0x0c06 },
244+ { 0x30c6, 0x0228 },
245+ { 0x30c7, 0x5901 },
246+ { 0x30c8, 0xe255 },
247+ { 0x30c9, 0x030d },
248+ { 0x30ca, 0x0255 },
249+ { 0x30cb, 0x2c01 },
250+ { 0x30cc, 0xe255 },
251+ { 0x30cd, 0x4342 },
252+ { 0x30ce, 0xe255 },
253+ { 0x30cf, 0x73c0 },
254+ { 0x30d0, 0x4255 },
255+ { 0x30d1, 0x0c00 },
256+ { 0x30d2, 0x0228 },
257+ { 0x30d3, 0x1f01 },
258+ { 0x30d4, 0x0228 },
259+ { 0x30d5, 0x1e01 },
260+ { 0x30d6, 0x0228 },
261+ { 0x30d7, 0xfa00 },
262+ { 0x30d8, 0x0000 },
263+ { 0x30d9, 0xf000 },
264+ { 0x30da, 0x0000 },
265+ { 0x30db, 0xf000 },
266+ { 0x30dc, 0x0000 },
267+ { 0x30dd, 0xf000 },
268+ { 0x30de, 0x0000 },
269+ { 0x30df, 0xf000 },
270+ { 0x30e0, 0x0000 },
271+ { 0x30e1, 0xf000 },
272+ { 0x30e2, 0x0000 },
273+ { 0x30e3, 0xf000 },
274+ { 0x30e4, 0x0000 },
275+ { 0x30e5, 0xf000 },
276+ { 0x30e6, 0x0000 },
277+ { 0x30e7, 0xf000 },
278+ { 0x30e8, 0x0000 },
279+ { 0x30e9, 0xf000 },
280+ { 0x30ea, 0x0000 },
281+ { 0x30eb, 0xf000 },
282+ { 0x30ec, 0x0000 },
283+ { 0x30ed, 0xf000 },
284+ { 0x30ee, 0x0000 },
285+ { 0x30ef, 0xf000 },
286+ { 0x30f0, 0x0228 },
287+ { 0x30f1, 0x1a01 },
288+ { 0x30f2, 0x0228 },
289+ { 0x30f3, 0x1e00 },
290+ { 0x30f4, 0x0228 },
291+ { 0x30f5, 0x1f00 },
292+ { 0x30f6, 0x6228 },
293+ { 0x30f7, 0xf800 },
294+ { 0x30f8, 0x0000 },
295+ { 0x30f9, 0xf000 },
296+ { 0x30fa, 0x0000 },
297+ { 0x30fb, 0xf000 },
298+ { 0x30fc, 0x0000 },
299+ { 0x30fd, 0xf000 },
300+ { 0x30fe, 0x0000 },
301+ { 0x30ff, 0xf000 },
302+ { 0x3100, 0x222b },
303+ { 0x3101, 0x3a03 },
304+ { 0x3102, 0x222b },
305+ { 0x3103, 0x5803 },
306+ { 0x3104, 0xe26f },
307+ { 0x3105, 0x030d },
308+ { 0x3106, 0x626f },
309+ { 0x3107, 0x2c01 },
310+ { 0x3108, 0xe26f },
311+ { 0x3109, 0x4342 },
312+ { 0x310a, 0xe26f },
313+ { 0x310b, 0x73c0 },
314+ { 0x310c, 0x026f },
315+ { 0x310d, 0x0c00 },
316+ { 0x310e, 0x022b },
317+ { 0x310f, 0x1f01 },
318+ { 0x3110, 0x022b },
319+ { 0x3111, 0x1e01 },
320+ { 0x3112, 0x022b },
321+ { 0x3113, 0xfa00 },
322+ { 0x3114, 0x0000 },
323+ { 0x3115, 0xf000 },
324+ { 0x3116, 0x0000 },
325+ { 0x3117, 0xf000 },
326+ { 0x3118, 0x0000 },
327+ { 0x3119, 0xf000 },
328+ { 0x311a, 0x0000 },
329+ { 0x311b, 0xf000 },
330+ { 0x311c, 0x0000 },
331+ { 0x311d, 0xf000 },
332+ { 0x311e, 0x0000 },
333+ { 0x311f, 0xf000 },
334+ { 0x3120, 0x022b },
335+ { 0x3121, 0x0a01 },
336+ { 0x3122, 0x022b },
337+ { 0x3123, 0x1e00 },
338+ { 0x3124, 0x022b },
339+ { 0x3125, 0x1f00 },
340+ { 0x3126, 0x622b },
341+ { 0x3127, 0xf800 },
342+ { 0x3128, 0x0000 },
343+ { 0x3129, 0xf000 },
344+ { 0x312a, 0x0000 },
345+ { 0x312b, 0xf000 },
346+ { 0x312c, 0x0000 },
347+ { 0x312d, 0xf000 },
348+ { 0x312e, 0x0000 },
349+ { 0x312f, 0xf000 },
350+ { 0x3130, 0x0000 },
351+ { 0x3131, 0xf000 },
352+ { 0x3132, 0x0000 },
353+ { 0x3133, 0xf000 },
354+ { 0x3134, 0x0000 },
355+ { 0x3135, 0xf000 },
356+ { 0x3136, 0x0000 },
357+ { 0x3137, 0xf000 },
358+ { 0x3138, 0x0000 },
359+ { 0x3139, 0xf000 },
360+ { 0x313a, 0x0000 },
361+ { 0x313b, 0xf000 },
362+ { 0x313c, 0x0000 },
363+ { 0x313d, 0xf000 },
364+ { 0x313e, 0x0000 },
365+ { 0x313f, 0xf000 },
366+ { 0x3140, 0x0000 },
367+ { 0x3141, 0xf000 },
368+ { 0x3142, 0x0000 },
369+ { 0x3143, 0xf000 },
370+ { 0x3144, 0x0000 },
371+ { 0x3145, 0xf000 },
372+ { 0x3146, 0x0000 },
373+ { 0x3147, 0xf000 },
374+ { 0x3148, 0x0000 },
375+ { 0x3149, 0xf000 },
376+ { 0x314a, 0x0000 },
377+ { 0x314b, 0xf000 },
378+ { 0x314c, 0x0000 },
379+ { 0x314d, 0xf000 },
380+ { 0x314e, 0x0000 },
381+ { 0x314f, 0xf000 },
382+ { 0x3150, 0x0000 },
383+ { 0x3151, 0xf000 },
384+ { 0x3152, 0x0000 },
385+ { 0x3153, 0xf000 },
386+ { 0x3154, 0x0000 },
387+ { 0x3155, 0xf000 },
388+ { 0x3156, 0x0000 },
389+ { 0x3157, 0xf000 },
390+ { 0x3158, 0x0000 },
391+ { 0x3159, 0xf000 },
392+ { 0x315a, 0x0000 },
393+ { 0x315b, 0xf000 },
394+ { 0x315c, 0x0000 },
395+ { 0x315d, 0xf000 },
396+ { 0x315e, 0x0000 },
397+ { 0x315f, 0xf000 },
398+ { 0x3160, 0x0000 },
399+ { 0x3161, 0xf000 },
400+ { 0x3162, 0x0000 },
401+ { 0x3163, 0xf000 },
402+ { 0x3164, 0x0000 },
403+ { 0x3165, 0xf000 },
404+ { 0x3166, 0x0000 },
405+ { 0x3167, 0xf000 },
406+ { 0x3168, 0x0000 },
407+ { 0x3169, 0xf000 },
408+ { 0x316a, 0x0000 },
409+ { 0x316b, 0xf000 },
410+ { 0x316c, 0x0000 },
411+ { 0x316d, 0xf000 },
412+ { 0x316e, 0x0000 },
413+ { 0x316f, 0xf000 },
414+ { 0x3170, 0x0000 },
415+ { 0x3171, 0xf000 },
416+ { 0x3172, 0x0000 },
417+ { 0x3173, 0xf000 },
418+ { 0x3174, 0x0000 },
419+ { 0x3175, 0xf000 },
420+ { 0x3176, 0x0000 },
421+ { 0x3177, 0xf000 },
422+ { 0x3178, 0x0000 },
423+ { 0x3179, 0xf000 },
424+ { 0x317a, 0x0000 },
425+ { 0x317b, 0xf000 },
426+ { 0x317c, 0x0000 },
427+ { 0x317d, 0xf000 },
428+ { 0x317e, 0x0000 },
429+ { 0x317f, 0xf000 },
430+ { 0x3180, 0x2001 },
431+ { 0x3181, 0xf101 },
432+ { 0x3182, 0x0000 },
433+ { 0x3183, 0xf000 },
434+ { 0x3184, 0x0000 },
435+ { 0x3185, 0xf000 },
436+ { 0x3186, 0x0000 },
437+ { 0x3187, 0xf000 },
438+ { 0x3188, 0x0000 },
439+ { 0x3189, 0xf000 },
440+ { 0x318a, 0x0000 },
441+ { 0x318b, 0xf000 },
442+ { 0x318c, 0x0000 },
443+ { 0x318d, 0xf000 },
444+ { 0x318e, 0x0000 },
445+ { 0x318f, 0xf000 },
446+ { 0x3190, 0x0000 },
447+ { 0x3191, 0xf000 },
448+ { 0x3192, 0x0000 },
449+ { 0x3193, 0xf000 },
450+ { 0x3194, 0x0000 },
451+ { 0x3195, 0xf000 },
452+ { 0x3196, 0x0000 },
453+ { 0x3197, 0xf000 },
454+ { 0x3198, 0x0000 },
455+ { 0x3199, 0xf000 },
456+ { 0x319a, 0x0000 },
457+ { 0x319b, 0xf000 },
458+ { 0x319c, 0x0000 },
459+ { 0x319d, 0xf000 },
460+ { 0x319e, 0x0000 },
461+ { 0x319f, 0xf000 },
462+ { 0x31a0, 0x0000 },
463+ { 0x31a1, 0xf000 },
464+ { 0x31a2, 0x0000 },
465+ { 0x31a3, 0xf000 },
466+ { 0x31a4, 0x0000 },
467+ { 0x31a5, 0xf000 },
468+ { 0x31a6, 0x0000 },
469+ { 0x31a7, 0xf000 },
470+ { 0x31a8, 0x0000 },
471+ { 0x31a9, 0xf000 },
472+ { 0x31aa, 0x0000 },
473+ { 0x31ab, 0xf000 },
474+ { 0x31ac, 0x0000 },
475+ { 0x31ad, 0xf000 },
476+ { 0x31ae, 0x0000 },
477+ { 0x31af, 0xf000 },
478+ { 0x31b0, 0x0000 },
479+ { 0x31b1, 0xf000 },
480+ { 0x31b2, 0x0000 },
481+ { 0x31b3, 0xf000 },
482+ { 0x31b4, 0x0000 },
483+ { 0x31b5, 0xf000 },
484+ { 0x31b6, 0x0000 },
485+ { 0x31b7, 0xf000 },
486+ { 0x31b8, 0x0000 },
487+ { 0x31b9, 0xf000 },
488+ { 0x31ba, 0x0000 },
489+ { 0x31bb, 0xf000 },
490+ { 0x31bc, 0x0000 },
491+ { 0x31bd, 0xf000 },
492+ { 0x31be, 0x0000 },
493+ { 0x31bf, 0xf000 },
494+ { 0x31c0, 0x0000 },
495+ { 0x31c1, 0xf000 },
496+ { 0x31c2, 0x0000 },
497+ { 0x31c3, 0xf000 },
498+ { 0x31c4, 0x0000 },
499+ { 0x31c5, 0xf000 },
500+ { 0x31c6, 0x0000 },
501+ { 0x31c7, 0xf000 },
502+ { 0x31c8, 0x0000 },
503+ { 0x31c9, 0xf000 },
504+ { 0x31ca, 0x0000 },
505+ { 0x31cb, 0xf000 },
506+ { 0x31cc, 0x0000 },
507+ { 0x31cd, 0xf000 },
508+ { 0x31ce, 0x0000 },
509+ { 0x31cf, 0xf000 },
510+ { 0x31d0, 0x0000 },
511+ { 0x31d1, 0xf000 },
512+ { 0x31d2, 0x0000 },
513+ { 0x31d3, 0xf000 },
514+ { 0x31d4, 0x0000 },
515+ { 0x31d5, 0xf000 },
516+ { 0x31d6, 0x0000 },
517+ { 0x31d7, 0xf000 },
518+ { 0x31d8, 0x0000 },
519+ { 0x31d9, 0xf000 },
520+ { 0x31da, 0x0000 },
521+ { 0x31db, 0xf000 },
522+ { 0x31dc, 0x0000 },
523+ { 0x31dd, 0xf000 },
524+ { 0x31de, 0x0000 },
525+ { 0x31df, 0xf000 },
526+ { 0x31e0, 0x0000 },
527+ { 0x31e1, 0xf000 },
528+ { 0x31e2, 0x0000 },
529+ { 0x31e3, 0xf000 },
530+ { 0x31e4, 0x0000 },
531+ { 0x31e5, 0xf000 },
532+ { 0x31e6, 0x0000 },
533+ { 0x31e7, 0xf000 },
534+ { 0x31e8, 0x0000 },
535+ { 0x31e9, 0xf000 },
536+ { 0x31ea, 0x0000 },
537+ { 0x31eb, 0xf000 },
538+ { 0x31ec, 0x0000 },
539+ { 0x31ed, 0xf000 },
540+ { 0x31ee, 0x0000 },
541+ { 0x31ef, 0xf000 },
542+ { 0x31f0, 0x0000 },
543+ { 0x31f1, 0xf000 },
544+ { 0x31f2, 0x0000 },
545+ { 0x31f3, 0xf000 },
546+ { 0x31f4, 0x0000 },
547+ { 0x31f5, 0xf000 },
548+ { 0x31f6, 0x0000 },
549+ { 0x31f7, 0xf000 },
550+ { 0x31f8, 0x0000 },
551+ { 0x31f9, 0xf000 },
552+ { 0x31fa, 0x0000 },
553+ { 0x31fb, 0xf000 },
554+ { 0x31fc, 0x0000 },
555+ { 0x31fd, 0xf000 },
556+ { 0x31fe, 0x0000 },
557+ { 0x31ff, 0xf000 },
558+ { 0x024d, 0xff50 },
559+ { 0x0252, 0xff50 },
560+ { 0x0259, 0x0112 },
561+ { 0x025e, 0x0112 },
562+};
563+
564+static int wm5102_sysclk_ev(struct snd_soc_dapm_widget *w,
565+ struct snd_kcontrol *kcontrol, int event)
566+{
567+ struct snd_soc_codec *codec = w->codec;
568+ struct arizona *arizona = dev_get_drvdata(codec->dev);
569+ struct regmap *regmap = codec->control_data;
570+ const struct reg_default *patch = NULL;
571+ int i, patch_size;
572+
573+ switch (arizona->rev) {
574+ case 0:
575+ patch = wm5102_sysclk_reva_patch;
576+ patch_size = ARRAY_SIZE(wm5102_sysclk_reva_patch);
577+ break;
578+ }
579+
580+ switch (event) {
581+ case SND_SOC_DAPM_POST_PMU:
582+ if (patch)
583+ for (i = 0; i < patch_size; i++)
584+ regmap_write(regmap, patch[i].reg,
585+ patch[i].def);
586+ break;
587+
588+ default:
589+ break;
590+ }
591+
592+ return 0;
593+}
594+
45595 static const struct snd_kcontrol_new wm5102_snd_controls[] = {
46596 SOC_SINGLE("IN1 High Performance Switch", ARIZONA_IN1L_CONTROL,
47597 ARIZONA_IN1_OSR_SHIFT, 1, 0),
@@ -297,7 +847,7 @@ static const struct snd_kcontrol_new wm5102_aec_loopback_mux = · 249 unmodified lines
297847
298848 static const struct snd_soc_dapm_widget wm5102_dapm_widgets[] = {
299849 SND_SOC_DAPM_SUPPLY("SYSCLK", ARIZONA_SYSTEM_CLOCK_1, ARIZONA_SYSCLK_ENA_SHIFT,
300− 0, NULL, 0),
850+ 0, wm5102_sysclk_ev, SND_SOC_DAPM_POST_PMU),
301851 SND_SOC_DAPM_SUPPLY("ASYNCCLK", ARIZONA_ASYNC_CLOCK_1,
302852 ARIZONA_ASYNC_CLK_ENA_SHIFT, 0, NULL, 0),
303853 SND_SOC_DAPM_SUPPLY("OPCLK", ARIZONA_OUTPUT_SYSTEM_CLOCK,
sound/soc/codecs/wm8978.c+1−1
@@ -782,7 +782,7 @@ static int wm8978_hw_params(struct snd_pcm_substream *substream, · 781 unmodified lines
782782 wm8978->mclk_idx = -1;
783783 f_sel = wm8978->f_mclk;
784784 } else {
785− if (!wm8978->f_pllout) {
785+ if (!wm8978->f_opclk) {
786786 /* We only enter here, if OPCLK is not used */
787787 int ret = wm8978_configure_pll(codec);
788788 if (ret < 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/mxs/mxs-saif.c+13−4
@@ -523,16 +523,24 @@ static int mxs_saif_trigger(struct snd_pcm_substream *substream, int cmd, · 522 unmodified lines
523523
524524 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
525525 /*
526− * write a data to saif data register to trigger
527− * the transfer
526+ * write data to saif data register to trigger
527+ * the transfer.
528+ * For 24-bit format the 32-bit FIFO register stores
529+ * only one channel, so we need to write twice.
530+ * This is also safe for the other non 24-bit formats.
528531 */
529532 __raw_writel(0, saif->base + SAIF_DATA);
533+ __raw_writel(0, saif->base + SAIF_DATA);
530534 } else {
531535 /*
532− * read a data from saif data register to trigger
533− * the receive
536+ * read data from saif data register to trigger
537+ * the receive.
538+ * For 24-bit format the 32-bit FIFO register stores
539+ * only one channel, so we need to read twice.
540+ * This is also safe for the other non 24-bit formats.
534541 */
535542 __raw_readl(saif->base + SAIF_DATA);
543+ __raw_readl(saif->base + SAIF_DATA);
536544 }
537545
538546 master_saif->ongoing = 1;
@@ -812,3 +820,4 @@ module_platform_driver(mxs_saif_driver); · 273 unmodified lines
812820 MODULE_AUTHOR("Freescale Semiconductor, Inc.");
813821 MODULE_DESCRIPTION("MXS ASoC SAIF driver");
814822 MODULE_LICENSE("GPL");
823+MODULE_ALIAS("platform:mxs-saif");
sound/soc/samsung/Kconfig+2−0
@@ -207,6 +207,8 @@ config SND_SOC_BELLS · 206 unmodified lines
207207 select SND_SOC_WM5102
208208 select SND_SOC_WM5110
209209 select SND_SOC_WM9081
210+ select SND_SOC_WM0010
211+ select SND_SOC_WM1250_EV1
210212
211213 config SND_SOC_LOWLAND
212214 tristate "Audio support for Wolfson Lowland"
sound/soc/samsung/bells.c+1−1
@@ -247,7 +247,7 @@ static struct snd_soc_dai_link bells_dai_wm5110[] = { · 246 unmodified lines
247247 {
248248 .name = "Sub",
249249 .stream_name = "Sub",
250− .cpu_dai_name = "wm5110-aif3",
250+ .cpu_dai_name = "wm5102-aif3",
251251 .codec_dai_name = "wm9081-hifi",
252252 .codec_name = "wm9081.1-006c",
253253 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
sound/soc/soc-core.c+3−2
@@ -2786,8 +2786,9 @@ int snd_soc_put_volsw_sx(struct snd_kcontrol *kcontrol, · 2785 unmodified lines
27862786 val = (ucontrol->value.integer.value[0] + min) & mask;
27872787 val = val << shift;
27882788
2789− if (snd_soc_update_bits_locked(codec, reg, val_mask, val))
2790− return err;
2789+ err = snd_soc_update_bits_locked(codec, reg, val_mask, val);
2790+ if (err < 0)
2791+ return err;
27912792
27922793 if (snd_soc_volsw_is_stereo(mc)) {
27932794 val_mask = mask << rshift;
sound/soc/soc-dapm.c+1−1
@@ -3745,7 +3745,7 @@ void snd_soc_dapm_shutdown(struct snd_soc_card *card) · 3744 unmodified lines
37453745 {
37463746 struct snd_soc_codec *codec;
37473747
3748− list_for_each_entry(codec, &card->codec_dev_list, list) {
3748+ list_for_each_entry(codec, &card->codec_dev_list, card_list) {
37493749 soc_dapm_shutdown_codec(&codec->dapm);
37503750 if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY)
37513751 snd_soc_dapm_set_bias_level(&codec->dapm,
sound/usb/card.c+3−3
@@ -559,9 +559,11 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, · 558 unmodified lines
559559 return;
560560
561561 card = chip->card;
562− mutex_lock(&register_mutex);
563562 down_write(&chip->shutdown_rwsem);
564563 chip->shutdown = 1;
564+ up_write(&chip->shutdown_rwsem);
565+
566+ mutex_lock(&register_mutex);
565567 chip->num_interfaces--;
566568 if (chip->num_interfaces <= 0) {
567569 snd_card_disconnect(card);
@@ -582,11 +584,9 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, · 14 unmodified lines
582584 snd_usb_mixer_disconnect(p);
583585 }
584586 usb_chip[chip->index] = NULL;
585− up_write(&chip->shutdown_rwsem);
586587 mutex_unlock(&register_mutex);
587588 snd_card_free_when_closed(card);
588589 } else {
589− up_write(&chip->shutdown_rwsem);
590590 mutex_unlock(&register_mutex);
591591 }
592592 }
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/pcm.c+3−0
@@ -568,6 +568,9 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream) · 567 unmodified lines
568568 goto unlock;
569569 }
570570
571+ snd_usb_endpoint_sync_pending_stop(subs->sync_endpoint);
572+ snd_usb_endpoint_sync_pending_stop(subs->data_endpoint);
573+
571574 ret = set_format(subs, subs->cur_audiofmt);
572575 if (ret < 0)
573576 goto unlock;
tools/power/x86/turbostat/turbostat.c+19−9
@@ -206,8 +206,10 @@ int get_msr(int cpu, off_t offset, unsigned long long *msr) · 205 unmodified lines
206206 retval = pread(fd, msr, sizeof *msr, offset);
207207 close(fd);
208208
209− if (retval != sizeof *msr)
209+ if (retval != sizeof *msr) {
210+ fprintf(stderr, "%s offset 0x%zx read failed\n", pathname, offset);
210211 return -1;
212+ }
211213
212214 return 0;
213215 }
@@ -1101,7 +1103,9 @@ void turbostat_loop() · 887 unmodified lines
11011103
11021104 restart:
11031105 retval = for_all_cpus(get_counters, EVEN_COUNTERS);
1104− if (retval) {
1106+ if (retval < -1) {
1107+ exit(retval);
1108+ } else if (retval == -1) {
11051109 re_initialize();
11061110 goto restart;
11071111 }
@@ -1114,7 +1118,9 @@ restart: · 6 unmodified lines
11141118 }
11151119 sleep(interval_sec);
11161120 retval = for_all_cpus(get_counters, ODD_COUNTERS);
1117− if (retval) {
1121+ if (retval < -1) {
1122+ exit(retval);
1123+ } else if (retval == -1) {
11181124 re_initialize();
11191125 goto restart;
11201126 }
@@ -1126,7 +1132,9 @@ restart: · 5 unmodified lines
11261132 flush_stdout();
11271133 sleep(interval_sec);
11281134 retval = for_all_cpus(get_counters, EVEN_COUNTERS);
1129− if (retval) {
1135+ if (retval < -1) {
1136+ exit(retval);
1137+ } else if (retval == -1) {
11301138 re_initialize();
11311139 goto restart;
11321140 }
@@ -1545,8 +1553,11 @@ void turbostat_init() · 412 unmodified lines
15451553 int fork_it(char **argv)
15461554 {
15471555 pid_t child_pid;
1556+ int status;
15481557
1549− for_all_cpus(get_counters, EVEN_COUNTERS);
1558+ status = for_all_cpus(get_counters, EVEN_COUNTERS);
1559+ if (status)
1560+ exit(status);
15501561 /* clear affinity side-effect of get_counters() */
15511562 sched_setaffinity(0, cpu_present_setsize, cpu_present_set);
15521563 gettimeofday(&tv_even, (struct timezone *)NULL);
@@ -1556,7 +1567,6 @@ int fork_it(char **argv) · 3 unmodified lines
15561567 /* child */
15571568 execvp(argv[0], argv);
15581569 } else {
1559− int status;
15601570
15611571 /* parent */
15621572 if (child_pid == -1) {
@@ -1568,7 +1578,7 @@ int fork_it(char **argv) · 5 unmodified lines
15681578 signal(SIGQUIT, SIG_IGN);
15691579 if (waitpid(child_pid, &status, 0) == -1) {
15701580 perror("wait");
1571− exit(1);
1581+ exit(status);
15721582 }
15731583 }
15741584 /*
@@ -1585,7 +1595,7 @@ int fork_it(char **argv) · 10 unmodified lines
15851595
15861596 fprintf(stderr, "%.6f sec\n", tv_delta.tv_sec + tv_delta.tv_usec/1000000.0);
15871597
1588− return 0;
1598+ return status;
15891599 }
15901600
15911601 void cmdline(int argc, char **argv)
@@ -1594,7 +1604,7 @@ void cmdline(int argc, char **argv) · 2 unmodified lines
15941604
15951605 progname = argv[0];
15961606
1597− while ((opt = getopt(argc, argv, "+pPSvisc:sC:m:M:")) != -1) {
1607+ while ((opt = getopt(argc, argv, "+pPSvi:sc:sC:m:M:")) != -1) {
15981608 switch (opt) {
15991609 case 'p':
16001610 show_core_only++;
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−}