CRIS: use kbuild.h instead of defining macros in asm-offset.c

This is modelled on commits such as the one below:

Commit fc1c3a003edb8a6778e64e10ef671a38c76c969e ("sh: use kbuild.h
instead of defining macros in asm-offsets.c") introduced in v2.6.26.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
Merge tag 'disintegrate-cris-20121009' of git://git.infradead.org/users/dhowells/linux-headers into for-linus2

UAPI Disintegration 2012-10-09

* tag 'disintegrate-cris-20121009' of git://git.infradead.org/users/dhowells/linux-headers:
  UAPI: (Scripted) Disintegrate arch/cris/include/asm
  UAPI: (Scripted) Disintegrate arch/cris/include/arch-v32/arch
  UAPI: (Scripted) Disintegrate arch/cris/include/arch-v10/arch
CRIS: locking: fix the return value of arch_read_trylock()

arch_write_trylock() should return 'ret' instead of always
return 1.

dpatch engine is used to auto generate this patch.
(https://github.com/weiyj/dpatch)

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
UAPI: Fix up empty files in arch/cris/

Fix up three empty files in arch/cris/ by sticking placeholder comments in
there to prevent the patch program from deleting them.

I decided not to delete the arch-v*/Kbuild files as it's possibly someone might
want to use them for genhdr-y lines in the future, but they could be deleted
and the pointer lines removed from asm/Kbuild.  The uapi/arch-v*/Kbuild files
ought to be uneffected by such a change.

asm/swab.h didn't have anything outside of __KERNEL__ so nothing appeared in
uapi/asm/swab.h.  The latter, however, is exported by Kbuild.asm.

This needs to be applied after the CRIS UAPI disintegration patch.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
drm/i915: optionally disable shrinker lock stealing

commit 5774506f157a91400c587b85d1ce4de56f0d32f6
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Wed Nov 21 13:04:04 2012 +0000

    drm/i915: Borrow our struct_mutex for the direct reclaim

added a nice trick to steal the struct_mutex lock in the shrinker if
it's the current task holding it. But this also caused the requirement
that every place which allocates memory needs to be careful about the
gem state of objects, since the shrinker could have pulled the rug out
from under it. We've usually solved this by carefully preallocating
things or ensure that buffers are pinned already.

But the shrinker also reaps mmap offset, so allocating those needs to
be careful, too. Now that code has been factored out into some common
helpers, so either we have fragile code depending upon the common
helper not doing something we don't want it to do. Or we need to
reimplement the mmap offset creation and so also leak implementation
details into our code.

Since this all results in leaky abstraction, cop out by disabling the
lock borrowing trick while calling down into the helpers. That way our
craziness is nicely confined to files in drm/i915.

v2: Split out the change to create_mmap_offset as request by Chris Wilson.

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drm/i915: disable shrinker lock stealing for create_mmap_offset

The mmap offset structure is not part of the drm/i915 code, but
provided by gem helpers. To avoid leaky abstractions (by either
depending upon implementation details of said helper wrt to
preallocations, or reimplementing it in our code and so fuzzing
around in internal details of that helpr) simply disable
the shrinker lock stealing accross calls into the helper functions.

This should fix igt/gem_tiled_swapping.

v2: Fix cleanup path confusion bemoaned by Chris Wilson.

Reported-by: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Mika Kuoppala <mika.kuoppala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
mm: do not sleep in balance_pgdat if there's no i/o congestion

On a 4GB RAM machine, where Normal zone is much smaller than DMA32 zone,
the Normal zone gets fragmented in time.  This requires relatively more
pressure in balance_pgdat to get the zone above the required watermark.
Unfortunately, the congestion_wait() call in there slows it down for a
completely wrong reason, expecting that there's a lot of
writeback/swapout, even when there's none (much more common).  After a
few days, when fragmentation progresses, this flawed logic translates to
a very high CPU iowait times, even though there's no I/O congestion at
all.  If THP is enabled, the problem occurs sooner, but I was able to
see it even on !THP kernels, just by giving it a bit more time to occur.

The proper way to deal with this is to not wait, unless there's
congestion.  Thanks to Mel Gorman, we already have the function that
perfectly fits the job.  The patch was tested on a machine which nicely
revealed the problem after only 1 day of uptime, and it's been working
great.

Signed-off-by: Zlatko Calusic <zlatko.calusic@iskon.hr>
Acked-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
sched: numa: ksm: fix oops in task_numa_placment()

task_numa_placement() oopsed on NULL p->mm when task_numa_fault() got
called in the handling of break_ksm() for ksmd.  That might be a
peculiar case, which perhaps KSM could takes steps to avoid? but it's
more robust if task_numa_placement() allows for such a possibility.

Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
ksm: make rmap walks more scalable

The rmap walks in ksm.c are like those in rmap.c: they can safely be
done with anon_vma_lock_read().

Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Mel Gorman <mgorman@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Merge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging

Pull hwmon subsystem update from Jean Delvare:
 "There are many improvements to the it87 driver, as well as suspend
  support for the Winbond Super-I/O chips, and a few other fixes."

* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  hwmon-vid: Add support for AMD family 11h to 15h processors
  hwmon: (it87) Support PECI for additional chips
  hwmon: (it87) Report thermal sensor type as Intel PECI if appropriate
  hwmon: (it87) Manage device specific features with table
  hwmon: (it87) Replace pwm group macro with direct attribute definitions
  hwmon: (it87) Avoid quoted string splits across lines
  hwmon: (it87) Save fan registers in 2-dimensional array
  hwmon: (it87) Introduce support for tempX_offset sysfs attribute
  hwmon: (it87) Replace macro defining tempX_type sensors with direct definitions
  hwmon: (it87) Save voltage register values in 2-dimensional array
  hwmon: (it87) Save temperature registers in 2-dimensional array
  hwmon: (w83627ehf) Get rid of smatch warnings
  hwmon: (w83627hf) Don't touch nonexistent I2C address registers
  hwmon: (w83627ehf) Add support for suspend
  hwmon: (w83627hf) Add support for suspend
  hwmon: Fix PCI device reference leak in quirk
Merge tag 'tag-for-linus-3.8' of git://git.linaro.org/people/sumitsemwal/linux-dma-buf

Pull dma-buf updates from Sumit Semwal:
 "A fairly small dma-buf pull request for 3.8 - only 2 patches"

* tag 'tag-for-linus-3.8' of git://git.linaro.org/people/sumitsemwal/linux-dma-buf:
  dma-buf: remove fallback for !CONFIG_DMA_SHARED_BUFFER
  dma-buf: might_sleep() in dma_buf_unmap_attachment()
Merge tag 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc

Pull ARM SoC fixes from Olof Johansson:
 "This is a batch of fixes for arm-soc platforms, most of it is for OMAP
  but there are others too (i.MX, Tegra, ep93xx).  Fixes warnings, some
  broken platforms and drivers, etc.  A bit all over the map really."

There was some concern about commit 68136b10 ("RM: sunxi: Change device
tree naming scheme for sunxi"), but Tony says:
 "Looks like that's trivial to fix as needed, no need to rebuild the
  branch to fix that AFAIK.

  The fix can be done once Olof is available online again.

  Linus, I suggest that you go ahead and pull this if there are no other
  issues with this branch."

* tag 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (32 commits)
  ARM: sunxi: Change device tree naming scheme for sunxi
  ARM: ux500: fix missing include
  ARM: u300: delete custom pin hog code
  ARM: davinci: fix build break due to missing include
  ARM: exynos: Fix warning due to missing 'inline' in stub
  ARM: imx: Move platform-mx2-emma to arch/arm/mach-imx/devices
  ARM i.MX51 clock: Fix regression since enabling MIPI/HSP clocks
  ARM: dts: mx27: Fix the AIPI bus for FEC
  ARM: OMAP2+: common: remove use of vram
  ARM: OMAP3/4: cpuidle: fix sparse and checkpatch warnings
  ARM: OMAP4: clock data: DPLLs are missing bypass clocks in their parent lists
  ARM: OMAP4: clock data: div_iva_hs_clk is a power-of-two divider
  ARM: OMAP4: Fix EMU clock domain always on
  ARM: OMAP4460: Workaround ABE DPLL failing to turn-on
  ARM: OMAP4: Enhance support for DPLLs with 4X multiplier
  ARM: OMAP4: Add function table for non-M4X dplls
  ARM: OMAP4: Update timer clock aliases
  ARM: OMAP: Move plat/omap-serial.h to include/linux/platform_data/serial-omap.h
  ARM: dts: Add build target for omap4-panda-a4
  ARM: dts: OMAP2420: Correct H4 board memory size
  ...
Merge tag 'cris-for-linus-3.8' of git://jni.nu/cris

Pull CRIS changes from Jesper Nilsson.

... mainly the UAPI disintegration.

* tag 'cris-for-linus-3.8' of git://jni.nu/cris:
  UAPI: Fix up empty files in arch/cris/
  CRIS: locking: fix the return value of arch_read_trylock()
  CRIS: use kbuild.h instead of defining macros in asm-offset.c
  UAPI: (Scripted) Disintegrate arch/cris/include/asm
  UAPI: (Scripted) Disintegrate arch/cris/include/arch-v32/arch
  UAPI: (Scripted) Disintegrate arch/cris/include/arch-v10/arch
Merge tags 'disintegrate-h8300-20121219', 'disintegrate-m32r-20121219' and 'disintegrate-score-20121220' of git://git.infradead.org/users/dhowells/linux-headers

Pull UAPI disintegration for H8/300, M32R and Score from David Howells.

Scripted UAPI patches for architectures that apparently never reacted to
it on their own.

* tag 'disintegrate-h8300-20121219' of git://git.infradead.org/users/dhowells/linux-headers:
  UAPI: (Scripted) Disintegrate arch/h8300/include/asm

* tag 'disintegrate-m32r-20121219' of git://git.infradead.org/users/dhowells/linux-headers:
  UAPI: (Scripted) Disintegrate arch/m32r/include/asm

* tag 'disintegrate-score-20121220' of git://git.infradead.org/users/dhowells/linux-headers:
  UAPI: (Scripted) Disintegrate arch/score/include/asm
Merge tag 'upstream-3.8-rc1' of git://git.infradead.org/linux-ubi

Pull UBI update from Artem Bityutskiy:
 "Nothing exciting, just clean-ups and nicification.  Oh, and one small
  optimization which makes UBI to use less RAM."

* tag 'upstream-3.8-rc1' of git://git.infradead.org/linux-ubi:
  UBI: embed ubi_debug_info field in ubi_device struct
  UBI: introduce helpers dbg_chk_{io, gen}
  UBI: replace memcpy with struct assignment
  UBI: remove spurious comment
  UBI: gluebi: rename misleading variables
  UBI: do not allocate the memory unnecessarily
  UBI: use list_move_tail instead of list_del/list_add_tail
Merge tag 'sound-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "This update contains overall only driver-specific fixes.  Slightly
  large LOC are seen in usb-audio driver for a couple of new device
  quirks and cs42l71 ASoC driver for enhanced features.  The others are
  a few small (regression) fixes HD-audio, and yet other small / trival
  ASoC fixes."

* tag 'sound-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: usb-audio: Support for Digidesign Mbox 2 USB sound card:
  ALSA: HDA: Fix sound resume hang
  ALSA: hda - bug fix for invalid connection list of Haswell HDMI codec pins
  ALSA: hda - Fix the wrong pincaps set in ALC861VD dallas/hp fixup
  ALSA: hda - Set codec->single_adc_amp flag for Realtek codecs
  ASoC: atmel-ssc: change disable to disable in dts node
  ASoC: Prevent pop_wait overwrite
  ALSA: usb-audio: ignore-quirk for HP Wireless Audio
  ALSA: hda - Always turn on pins for HDMI/DP
  ALSA: hda - Fix pin configuration of HP Pavilion dv7
  ASoC: core: Fix splitting of log messages
  ASoC: cs42l73: Change VSPIN/VSPOUT to VSPINOUT
  ASoC: cs42l73: Add DAPM events for power down.
  ASoC: cs42l73: Add DMIC's as DAPM inputs.
  ASoC: sigmadsp: Fix endianness conversion issue
  ASoC: tpa6130a2: Use devm_* APIs
ASoC: pcm: allow backend hardware to be freed in pause state

When front-end PCM session is in paused state, back-end
PCM session will be put in paused state as well if given
front-end PCM session is the only client of given back-end.
Then, application closes front-end PCM session, DPCM
framework will not allow back-end enters HW_FREE state
so back-end will never get shutdown completely.

Signed-off-by: Patrick Lai <plai@codeaurora.org>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
ASoC: sta529: Fix update register bits in sta529_set_dai_fmt

Both the mask and mode settings are wrong in current code.

According to the datasheet:

S2PCFG0 (0x0A)
BIT[3:1] DATA_FORMAT
        serial interface protocol format:
        000: left Justified
        001: I2S (default)
        010: right justified
        100: PCM no delay
        101: PCM delay
        111: DSP

Thus fixes the defines for LEFT_J_DATA_FORMAT, I2S_DATA_FORMAT, and
RIGHT_J_DATA_FORMAT.
Also adds define for DATA_FORMAT_MSK.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
Acked-by: Rajeev Kumar <rajeev-dlh.kumar@st.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: stable@vger.kernel.org
Merge tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux

Pull virtio update from Rusty Russell:
 "Some nice cleanups, and even a patch my wife did as a "live" demo for
  Latinoware 2012.

  There's a slightly non-trivial merge in virtio-net, as we cleaned up
  the virtio add_buf interface while DaveM accepted the mq virtio-net
  patches."

* tag 'virtio-next-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux: (27 commits)
  virtio_console: Add support for remoteproc serial
  virtio_console: Merge struct buffer_token into struct port_buffer
  virtio: add drv_to_virtio to make code clearly
  virtio: use dev_to_virtio wrapper in virtio
  virtio-mmio: Fix irq parsing in command line parameter
  virtio_console: Free buffers from out-queue upon close
  virtio: Convert dev_printk(KERN_<LEVEL> to dev_<level>(
  virtio_console: Use kmalloc instead of kzalloc
  virtio_console: Free buffer if splice fails
  virtio: tools: make it clear that virtqueue_add_buf() no longer returns > 0
  virtio: scsi: make it clear that virtqueue_add_buf() no longer returns > 0
  virtio: rpmsg: make it clear that virtqueue_add_buf() no longer returns > 0
  virtio: net: make it clear that virtqueue_add_buf() no longer returns > 0
  virtio: console: make it clear that virtqueue_add_buf() no longer returns > 0
  virtio: make virtqueue_add_buf() returning 0 on success, not capacity.
  virtio: console: don't rely on virtqueue_add_buf() returning capacity.
  virtio_net: don't rely on virtqueue_add_buf() returning capacity.
  virtio-net: remove unused skb_vnet_hdr->num_sg field
  virtio-net: correct capacity math on ring full
  virtio: move queue_index and num_free fields into core struct virtqueue.
  ...
ARM: OMAP: Fix build breakage due to missing include in i2c.c

Merge commit 752451f01c45 ("Merge branch 'i2c-embedded/for-next' of
git://git.pengutronix.de/git/wsa/linux") resulted in a build breakage
for OMAP

  arch/arm/mach-omap2/i2c.c: In function 'omap_pm_set_max_mpu_wakeup_lat_compat':
  arch/arm/mach-omap2/i2c.c:130:2: error: implicit declaration of function 'omap_pm_set_max_mpu_wakeup_lat'
  make[1]: *** [arch/arm/mach-omap2/i2c.o] Error 1

Fix this by including the appropriate header file with the function
prototype.

Reported-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Vaibhav Bedia <vaibhav.bedia@ti.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>