pandora-kernel.git
13 years agoMerge branch 'linus' into perf/urgent
Ingo Molnar [Thu, 12 Aug 2010 19:38:56 +0000 (21:38 +0200)]
Merge branch 'linus' into perf/urgent

Merge reason: Fix upstream breakage introduced by:

 de5d9bf: Move list types from <linux/list.h> to <linux/types.h>.

Signed-off-by: Ingo Molnar <mingo@elte.hu>
13 years agoMerge branch 'io_remap_pfn_range' of git://www.jni.nu/cris
Linus Torvalds [Thu, 12 Aug 2010 17:17:19 +0000 (10:17 -0700)]
Merge branch 'io_remap_pfn_range' of git://jni.nu/cris

* 'io_remap_pfn_range' of git://www.jni.nu/cris:
  CRIS: Define io_remap_pfn_range as remap_pfn_range

13 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm
Linus Torvalds [Thu, 12 Aug 2010 17:16:46 +0000 (10:16 -0700)]
Merge git://git./linux/kernel/git/agk/linux-2.6-dm

* git://git.kernel.org/pub/scm/linux/kernel/git/agk/linux-2.6-dm: (33 commits)
  dm mpath: support discard
  dm stripe: support discards
  dm: split discard requests on target boundaries
  dm stripe: optimize sector division
  dm stripe: move sector translation to a function
  dm: error return error for discards
  dm delay: support discard
  dm: zero silently drop discards
  dm: use dm_target_offset macro
  dm: factor out max_io_len_target_boundary
  dm: use common __issue_target_request for flush and discard support
  dm: linear support discard
  dm crypt: simplify crypt_ctr
  dm crypt: simplify crypt_config destruction logic
  dm: allow autoloading of dm mod
  dm: rename map_info flush_request to target_request_nr
  dm ioctl: refactor dm_table_complete
  dm snapshot: implement merge
  dm: do not initialise full request queue when bio based
  dm ioctl: make bio or request based device type immutable
  ...

13 years agoMerge branch 'hwpoison' of git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux...
Linus Torvalds [Thu, 12 Aug 2010 17:15:10 +0000 (10:15 -0700)]
Merge branch 'hwpoison' of git://git./linux/kernel/git/ak/linux-mce-2.6

* 'hwpoison' of git://git.kernel.org/pub/scm/linux/kernel/git/ak/linux-mce-2.6:
  hugetlb: add missing unlock in avoidcopy path in hugetlb_cow()
  hwpoison: rename CONFIG
  HWPOISON, hugetlb: support hwpoison injection for hugepage
  HWPOISON, hugetlb: detect hwpoison in hugetlb code
  HWPOISON, hugetlb: isolate corrupted hugepage
  HWPOISON, hugetlb: maintain mce_bad_pages in handling hugepage error
  HWPOISON, hugetlb: set/clear PG_hwpoison bits on hugepage
  HWPOISON, hugetlb: enable error handling path for hugepage
  hugetlb, rmap: add reverse mapping for hugepage
  hugetlb: move definition of is_vm_hugetlb_page() to hugepage_inline.h

Fix up trivial conflicts in mm/memory-failure.c

13 years agoMerge branch 'for-linus' of git://neil.brown.name/md
Linus Torvalds [Thu, 12 Aug 2010 17:08:10 +0000 (10:08 -0700)]
Merge branch 'for-linus' of git://neil.brown.name/md

* 'for-linus' of git://neil.brown.name/md:
  Further tidyup of raid6 naming in lib/raid6
  Make lib/raid6/test build correctly.
  Rename raid6 files now they're in a 'raid6' directory.

13 years agoMerge branch 'msm-core' of git://codeaurora.org/quic/kernel/dwalker/linux-msm
Linus Torvalds [Thu, 12 Aug 2010 17:07:32 +0000 (10:07 -0700)]
Merge branch 'msm-core' of git://codeaurora.org/quic/kernel/dwalker/linux-msm

* 'msm-core' of git://codeaurora.org/quic/kernel/dwalker/linux-msm:
  msm: mmc: Add msm prefix to platform data structure
  msm: trout: Remove extern declaration from source file
  arm: msm: Fix section mismatch in smd.c.
  arm: msm: trout add mmc support
  arm: msm: trout: add trout specific gpio interrupts
  arm: msm: remove unused #include <linux/version.h>

13 years agoMerge branch 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq
Linus Torvalds [Thu, 12 Aug 2010 17:07:11 +0000 (10:07 -0700)]
Merge branch 'fixes' of git://git./linux/kernel/git/davej/cpufreq

* 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/davej/cpufreq:
  [CPUFREQ] add missing __percpu markup in pcc-cpufreq.c

13 years agoMerge branch 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvar...
Linus Torvalds [Thu, 12 Aug 2010 17:06:29 +0000 (10:06 -0700)]
Merge branch 'i2c-for-linus' of git://git./linux/kernel/git/jdelvare/staging

* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  i2c: I2C bus multiplexer driver pca954x
  i2c: Multiplexed I2C bus core support
  i2c: Use a separate mutex for userspace client lists
  i2c: Make i2c_default_probe self-sufficient
  i2c: Drop dummy variable
  i2c: Move adapter locking helpers to i2c-core
  V4L/DVB: Use custom I2C probing function mechanism
  i2c: Add support for custom probe function
  i2c-dev: Use memdup_user
  i2c-dev: Remove unnecessary kmalloc casts

13 years agoMerge branch 'params' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux...
Linus Torvalds [Thu, 12 Aug 2010 17:01:59 +0000 (10:01 -0700)]
Merge branch 'params' of git://git./linux/kernel/git/rusty/linux-2.6-for-linus

* 'params' of git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus: (22 commits)
  param: don't deref arg in __same_type() checks
  param: update drivers/acpi/debug.c to new scheme
  param: use module_param in drivers/message/fusion/mptbase.c
  ide: use module_param_named rather than module_param_call
  param: update drivers/char/ipmi/ipmi_watchdog.c to new scheme
  param: lock if_sdio's lbs_helper_name and lbs_fw_name against sysfs changes.
  param: lock myri10ge_fw_name against sysfs changes.
  param: simple locking for sysfs-writable charp parameters
  param: remove unnecessary writable charp
  param: add kerneldoc to moduleparam.h
  param: locking for kernel parameters
  param: make param sections const.
  param: use free hook for charp (fix leak of charp parameters)
  param: add a free hook to kernel_param_ops.
  param: silence .init.text references from param ops
  Add param ops struct for hvc_iucv driver.
  nfs: update for module_param_named API change
  AppArmor: update for module_param_named API change
  param: use ops in struct kernel_param, rather than get and set fns directly
  param: move the EXPORT_SYMBOL to after the definitions.
  ...

13 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6
Linus Torvalds [Thu, 12 Aug 2010 17:01:30 +0000 (10:01 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/lrg/voltage-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6: (22 commits)
  regulator: Remove default DEBUG define from TPS6586x
  regulator: tps6507x - add missing platform_set_drvdata in tps6507x_pmic_probe
  regulator: tps6586x - add regulator_unregister() in tps6586x_regulator_remove()
  mfd: max8998 - fix incorrect kfree(i2c) in i2c_driver probe callback handler
  regulator: lp3971 - remove unnecessary ret value checking in lp3971_i2c_write()
  regulator: max8660 - fix a memory leak in max8660_remove()
  regulator: max1586 - fix a memory leak in max1586_pmic_remove()
  regulator: Default GPIO controlled WM8994 regulators to disabled
  regulator: lp3971 - remove unnecessary ret value checking in lp3971_i2c_write()
  max8998: fix off-by-one value range checking
  regulator: tps6586x: fix millivolt return values and SM2 table
  regulator: tps6586x: add dependancy on MFD_TPS6585x
  regulator: add TPS6586X regulator driver
  regulator: MAX8998: set_voltage bugfix. ramp_up delay and min/max voltage
  regulator: add support for regulators on the ab8500 MFD
  ab8500-mfd: add regulator support to ab8500 mfd device
  tps65023: Allow registering similar TPS65021
  drivers: regulators: depend on MFD_MAX8998
  drivers: regulator: add Maxim 8998 driver
  ISL6271A voltage regulator support.
  ...

13 years agoMerge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6
Linus Torvalds [Thu, 12 Aug 2010 17:01:06 +0000 (10:01 -0700)]
Merge branch 'for-next' of git://git./linux/kernel/git/sameo/mfd-2.6

* 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/sameo/mfd-2.6: (40 commits)
  mfd: Fix incorrect kfree(i2c) in wm8994-core i2c_driver probe
  mfd: Fix incorrect kfree(i2c) in wm831x-core i2c_driver probe
  mfd: Fix incorrect kfree(i2c) in tps6507x i2c_driver probe
  mfd: Add TPS6586x driver
  mfd: Use macros instead of some constant magic numbers for menelaus
  mfd: Fix menelaus mmc slot 2 misconfiguration
  mfd: Missing slab.h includes
  mfd: Fix wrong wm8350-core kfree in error path
  mfd: Fix wm8994_device_init() return value
  mfd: Avoid calling platform_device_put() twice in ucb1400 probe error path
  mfd: Annotate tc6387xb probe/remove routines with __devinit/__devexit
  mfd: Fix tc6387xb resource reclaim
  mfd: Fix wrong goto labels for tc6393xb error handling
  mfd: Get rid of now unused mc13783 private header
  hwmon: Don't access struct mc13783 directly from mc13783-adc
  mfd: New mc13783 function exposing flags
  mfd: Check jz4740-adc kmalloc() result
  mfd: Fix jz4740-adc resource reclaim in probe error path
  mfd: Add WM8321 support
  mfd: Add stmpe auto sleep feature
  ...

13 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
Linus Torvalds [Thu, 12 Aug 2010 17:00:06 +0000 (10:00 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/tiwai/sound-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6:
  ASoC: add AD1980 obsolete information
  ASoC: register cache should be 1 byte aligned for 1 byte long register
  ALSA: hda - Adding support for new IDT 92HD87XX codecs
  ASoC: Fix inverted mute controls for WM8580
  ALSA: HDA: Use model=auto for LG R510
  ALSA: hda - Update model entries in HD-Audio-Models.txt
  ALSA: hda: document VIA models
  ALSA: hda - patch_nvhdmi.c: Add missing codec IDs, unify names
  ALSA: hda - add support for Conexant CX20584
  ALSA: hda - New snd-hda-intel model/pin config for hp dv7-4000
  ALSA: hda - Fix missing stream for second ADC on Realtek ALC260 HDA codec
  ALSA: hda - Make converter setups sticky
  ALSA: hda - Add support for Acer ZGA ALC271 (1025:047c)
  sound/oss: Adjust confusing if indentation
  sound: oss: au1550_ac97.c removed duplicated #include
  ASoC: Fix for changed Eureka Kconfig symbol names

13 years agoMerge git://git.infradead.org/battery-2.6
Linus Torvalds [Thu, 12 Aug 2010 16:58:33 +0000 (09:58 -0700)]
Merge git://git.infradead.org/battery-2.6

* git://git.infradead.org/battery-2.6:
  intel_mid_battery: Fix battery scaling
  intel_mid_battery: Fix the argument order to intel_scu_ipc_command
  olpc_battery: Fix build failure caused by sysfs changes
  Add s3c-adc-battery driver
  Intel MID platform battery driver

Fix up trivial conflicts (battery drivers added from different branches)
in drivers/power/{Kconfig,Makefile}

13 years agox86/hpet: Use the FSEC_PER_SEC constant for femto-second periods
Chris Wilson [Mon, 9 Aug 2010 21:20:10 +0000 (14:20 -0700)]
x86/hpet: Use the FSEC_PER_SEC constant for femto-second periods

The current computation, introduced with f12a15be63, of FSEC_PER_SEC using
the multiplication of (FSEC_PER_NSEC * NSEC_PER_SEC) is performed only
with 32bit integers on small machines, resulting in an overflow and a
*very* short intervals being programmed.  An interrupt storm follows.

Note that we also have to specify FSEC_PER_SEC as being long long to
overcome the same limitations.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: John Stultz <johnstul@us.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Ingo Molnar <mingo@elte.hu>
Acked-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agotimekeeping: Fix overflow in rawtime tv_nsec on 32 bit archs
Jason Wessel [Mon, 9 Aug 2010 21:20:09 +0000 (14:20 -0700)]
timekeeping: Fix overflow in rawtime tv_nsec on 32 bit archs

The tv_nsec is a long and when added to the shifted interval it can wrap
and become negative which later causes looping problems in the
getrawmonotonic().  The edge case occurs when the system has slept for
a short period of time of ~2 seconds.

A trace printk of the values in this patch illustrate the problem:

ftrace time stamp: log
43.716079: logarithmic_accumulation: raw: 3d0913 tv_nsec d687faa
43.718513: logarithmic_accumulation: raw: 3d0913 tv_nsec da588bd
43.722161: logarithmic_accumulation: raw: 3d0913 tv_nsec de291d0
46.349925: logarithmic_accumulation: raw: 7a122600 tv_nsec e1f9ae3
46.349930: logarithmic_accumulation: raw: 1e848980 tv_nsec 8831c0e3

The kernel starts looping at 46.349925 in the getrawmonotonic() due to
the negative value from adding the raw value to tv_nsec.

A simple solution is to accumulate into a u64, and then normalize it
to a timespec_t.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
 [ Reworked variable names and simplified some of the code. - John ]
Signed-off-by: John Stultz <johnstul@us.ibm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMN10300: Use no_printk() for disabled gdbstub debugging functions
David Howells [Thu, 12 Aug 2010 15:55:02 +0000 (16:55 +0100)]
MN10300: Use no_printk() for disabled gdbstub debugging functions

Use no_printk() for disabled gdbstub debugging functions to maintain side
effect checking.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAdd a dummy printk function for the maintenance of unused printks
David Howells [Thu, 12 Aug 2010 15:54:57 +0000 (16:54 +0100)]
Add a dummy printk function for the maintenance of unused printks

Add a dummy printk function for the maintenance of unused printks through gcc
format checking, and also so that side-effect checking is maintained too.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMN10300: Don't try and #include <linux/slab.h> in lib/inflate.c from bootloader
David Howells [Thu, 12 Aug 2010 15:54:52 +0000 (16:54 +0100)]
MN10300: Don't try and #include <linux/slab.h> in lib/inflate.c from bootloader

Don't try and #include <linux/slab.h> in lib/inflate.c from the bootloader code
as linux/slab.h hauls in function defs that aren't available in the bootloader
code and may also haul in conflicting functions.

To fix this, make the inclusion of linux/slab.h contingent on NO_INFLATE_MALLOC
as are the usages of kmalloc() and kfree().

In MN10300, this causes the following errors:

In file included from include/linux/string.h:21,
                 from include/linux/bitmap.h:8,
                 from include/linux/nodemask.h:93,
                 from include/linux/mmzone.h:16,
                 from include/linux/gfp.h:4,
                 from include/linux/slab.h:12,
                 from arch/mn10300/boot/compressed/../../../../lib/inflate.c:106,
                 from arch/mn10300/boot/compressed/misc.c:170:
/warthog/am33/linux-2.6-mn10300/arch/mn10300/include/asm/string.h:19: error: conflicting types for 'memset'
arch/mn10300/boot/compressed/misc.c:59: error: previous definition of 'memset' was here

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMN10300: Permit .GCC-command-line sections
David Howells [Thu, 12 Aug 2010 15:54:47 +0000 (16:54 +0100)]
MN10300: Permit .GCC-command-line sections

Permit .GCC-command-line sections in modules.  Otherwise modpost says things
like:

WARNING: drivers/mtd/chips/map_ram.o (.GCC-command-line): unexpected non-allocatable section.
Did you forget to use "ax"/"aw" in a .S file?
Note that for example <linux/init.h> contains
section definitions for use in .S files.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMN10300: Fix size_t and ssize_t
David Howells [Thu, 12 Aug 2010 15:54:41 +0000 (16:54 +0100)]
MN10300: Fix size_t and ssize_t

With the newer compilers, size_t and ssize_t are expected to be (un)signed int
rather than (un)signed long.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMN10300: Fix RTC routines
David Howells [Thu, 12 Aug 2010 15:54:36 +0000 (16:54 +0100)]
MN10300: Fix RTC routines

A change to the RTC routines in the MN10300 arch used set_rtc_mms() when it
meant set_rtc_mmss().  This results in an error due to a reference of an
undefined symbol.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years ago[CPUFREQ] add missing __percpu markup in pcc-cpufreq.c
Namhyung Kim [Sat, 7 Aug 2010 17:37:23 +0000 (02:37 +0900)]
[CPUFREQ] add missing __percpu markup in pcc-cpufreq.c

pcc_cpu_info is a percpu pointer but was missing __percpu markup.
Add it.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Dave Jones <davej@redhat.com>
13 years agoMerge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6
Linus Torvalds [Thu, 12 Aug 2010 16:29:06 +0000 (09:29 -0700)]
Merge branch 'release' of git://git./linux/kernel/git/aegl/linux-2.6

* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/aegl/linux-2.6:
  [IA64] Fix rwsem: RWSEM_WAITING_BIAS must not be unsigned.

13 years agoMerge branch 'drm-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
Linus Torvalds [Thu, 12 Aug 2010 16:21:39 +0000 (09:21 -0700)]
Merge branch 'drm-core-next' of git://git./linux/kernel/git/airlied/drm-2.6

* 'drm-core-next' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: (55 commits)
  io-mapping: move asm include inside the config option
  vgaarb: drop vga.h include
  drm/radeon: Add probing of clocks from device-tree
  drm/radeon: drop old and broken mesa warning
  drm/radeon: Fix pci_map_page() error checking
  drm: Remove count_lock for calling lastclose() after 58474713 (v2)
  drm/radeon/kms: allow FG_ALPHA_VALUE on r5xx
  drm/radeon/kms: another r6xx/r7xx CS checker fix
  DRM: Replace kmalloc/memset combos with kzalloc
  drm: expand gamma_set
  drm/edid: Split mode lists out to their own header for readability
  drm/edid: Rewrite mode parse to use the generic detailed block walk
  drm/edid: Add detailed block walk for VTB extensions
  drm/edid: Add detailed block walk for CEA extensions
  drm: Remove unused fields from drm_display_info
  drm: Use ENOENT consistently for the error return for an unmatched handle.
  drm/radeon/kms: mark 3D power states as performance
  drm: Only set DPMS once on the CRTC not after every encoder.
  drm/radeon/kms: add additional quirk for Acer rv620 laptop
  drm: Propagate error code from fb_create()
  ...

Fix up trivial conflicts in drivers/gpu/drm/drm_edid.c

13 years ago[IA64] Fix rwsem: RWSEM_WAITING_BIAS must not be unsigned.
Tony Luck [Thu, 12 Aug 2010 16:14:56 +0000 (09:14 -0700)]
[IA64] Fix rwsem: RWSEM_WAITING_BIAS must not be unsigned.

Some nice improvements were made to rwsem in commit:

 424acaaeb3a3932d64a9b4bd59df6cf72c22d8f3
 rwsem: wake queued readers when writer blocks on active read lock

but this change overlooked that ia64 had defined RWSEM_WAITING_BIAS
as an unsigned value, while the new code required a signed value (as
it is in every other architecture).

This fix suggested by the original patch author: Michel Lespinasse.

Signed-off-by: Tony Luck <tony.luck@intel.com>
13 years agoMerge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6
Linus Torvalds [Thu, 12 Aug 2010 16:11:31 +0000 (09:11 -0700)]
Merge branch 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6

* 'next-devicetree' of git://git.secretlab.ca/git/linux-2.6:
  mmc_spi: Fix unterminated of_match_table
  of/sparc: fix build regression from of_device changes
  of/device: Replace struct of_device with struct platform_device

13 years agoMerge branch 'stable/xen-swiotlb-0.8.6' of git://git.kernel.org/pub/scm/linux/kernel...
Linus Torvalds [Thu, 12 Aug 2010 16:09:41 +0000 (09:09 -0700)]
Merge branch 'stable/xen-swiotlb-0.8.6' of git://git./linux/kernel/git/konrad/xen

* 'stable/xen-swiotlb-0.8.6' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/xen:
  x86: Detect whether we should use Xen SWIOTLB.
  pci-swiotlb-xen: Add glue code to setup dma_ops utilizing xen_swiotlb_* functions.
  swiotlb-xen: SWIOTLB library for Xen PV guest with PCI passthrough.
  xen/mmu: inhibit vmap aliases rather than trying to clear them out
  vmap: add flag to allow lazy unmap to be disabled at runtime
  xen: Add xen_create_contiguous_region
  xen: Rename the balloon lock
  xen: Allow unprivileged Xen domains to create iomap pages
  xen: use _PAGE_IOMAP in ioremap to do machine mappings

Fix up trivial conflicts (adding both xen swiotlb and xen pci platform
driver setup close to each other) in drivers/xen/{Kconfig,Makefile} and
include/xen/xen-ops.h

13 years agomemstick: fix hangs on unexpected device removal in mspro_blk
Maxim Levitsky [Wed, 11 Aug 2010 21:17:52 +0000 (14:17 -0700)]
memstick: fix hangs on unexpected device removal in mspro_blk

mspro_block_remove() is called from detect thread that first calls the
mspro_block_stop(), which stops the request queue.  If we call
del_gendisk() with the queue stopped we get a deadlock.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Cc: Alex Dubov <oakad@yahoo.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agomemstick: init sysfs attributes
Maxim Levitsky [Wed, 11 Aug 2010 21:17:52 +0000 (14:17 -0700)]
memstick: init sysfs attributes

Otherwise lockdep complains.

Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
Cc: Alex Dubov <oakad@yahoo.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agommc_test: fix large memory allocation
Adrian Hunter [Wed, 11 Aug 2010 21:17:51 +0000 (14:17 -0700)]
mmc_test: fix large memory allocation

- Fix mmc_test_alloc_mem.

- Use nr_free_buffer_pages() instead of sysinfo.totalram to determine
  total lowmem pages.

- Change variables containing memory sizes to unsigned long.

- Limit maximum test area size to 128MiB because that is the maximum MMC
  high capacity erase size (the maxmium SD allocation unit size is just
  4MiB)

Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agommc_test: add performance tests
Adrian Hunter [Wed, 11 Aug 2010 21:17:51 +0000 (14:17 -0700)]
mmc_test: add performance tests

mmc_test provides tests aimed at testing SD/MMC hosts.  This patch adds
performance tests.

It is advantageous to have performance tests in a kernel
module like mmc_test for the following reasons:
- transfer times can be measured very accurately
- arbitrarily large transfers are possible
- the effect of contiguous vs scattered pages
can be determined

The new tests are:

23. Best-case read performance
24. Best-case write performance
25. Best-case read performance into scattered pages
26. Best-case write performance from scattered pages
27. Single read performance by transfer size
28. Single write performance by transfer size
29. Single trim performance by transfer size
30. Consecutive read performance by transfer size
31. Consecutive write performance by transfer size
32. Consecutive trim performance by transfer size

Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agommc_block: add support for secure discard
Adrian Hunter [Wed, 11 Aug 2010 21:17:50 +0000 (14:17 -0700)]
mmc_block: add support for secure discard

Secure discard is implemented by Secure Trim if the discard is unaligned
or Secure Erase otherwise.

Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Acked-by: Jens Axboe <axboe@kernel.dk>
Cc: Kyungmin Park <kmpark@infradead.org>
Cc: Madhusudhan Chikkature <madhu.cr@ti.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ben Gardiner <bengardiner@nanometrics.ca>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoblock: add secure discard
Adrian Hunter [Wed, 11 Aug 2010 21:17:49 +0000 (14:17 -0700)]
block: add secure discard

Secure discard is the same as discard except that all copies of the
discarded sectors (perhaps created by garbage collection) must also be
erased.

Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Acked-by: Jens Axboe <axboe@kernel.dk>
Cc: Kyungmin Park <kmpark@infradead.org>
Cc: Madhusudhan Chikkature <madhu.cr@ti.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ben Gardiner <bengardiner@nanometrics.ca>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoomap_hsmmc: add erase capability
Adrian Hunter [Wed, 11 Aug 2010 21:17:48 +0000 (14:17 -0700)]
omap_hsmmc: add erase capability

Disable the data (busy) timeout for erases and set the MMC_CAP_ERASE
capability.

Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Acked-by: Jens Axboe <axboe@kernel.dk>
Cc: Kyungmin Park <kmpark@infradead.org>
Cc: Madhusudhan Chikkature <madhu.cr@ti.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ben Gardiner <bengardiner@nanometrics.ca>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agommc_block: add discard support
Adrian Hunter [Wed, 11 Aug 2010 21:17:47 +0000 (14:17 -0700)]
mmc_block: add discard support

Enable MMC to service discard requests.  In the case of SD and MMC cards
that do not support trim, discards become erases.  In the case of cards
(MMC) that only allow erases in multiples of erase group size, round to
the nearest completely discarded erase group.

Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Acked-by: Jens Axboe <axboe@kernel.dk>
Cc: Kyungmin Park <kmpark@infradead.org>
Cc: Madhusudhan Chikkature <madhu.cr@ti.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ben Gardiner <bengardiner@nanometrics.ca>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agommc: add erase, secure erase, trim and secure trim operations
Adrian Hunter [Wed, 11 Aug 2010 21:17:46 +0000 (14:17 -0700)]
mmc: add erase, secure erase, trim and secure trim operations

SD/MMC cards tend to support an erase operation.  In addition, eMMC v4.4
cards can support secure erase, trim and secure trim operations that are
all variants of the basic erase command.

SD/MMC device attributes "erase_size" and "preferred_erase_size" have been
added.

"erase_size" is the minimum size, in bytes, of an erase operation.  For
MMC, "erase_size" is the erase group size reported by the card.  Note that
"erase_size" does not apply to trim or secure trim operations where the
minimum size is always one 512 byte sector.  For SD, "erase_size" is 512
if the card is block-addressed, 0 otherwise.

SD/MMC cards can erase an arbitrarily large area up to and
including the whole card.  When erasing a large area it may
be desirable to do it in smaller chunks for three reasons:

    1. A single erase command will make all other I/O on the card
       wait.  This is not a problem if the whole card is being erased, but
       erasing one partition will make I/O for another partition on the
       same card wait for the duration of the erase - which could be a
       several minutes.

    2. To be able to inform the user of erase progress.

    3. The erase timeout becomes too large to be very useful.
       Because the erase timeout contains a margin which is multiplied by
       the size of the erase area, the value can end up being several
       minutes for large areas.

"erase_size" is not the most efficient unit to erase (especially for SD
where it is just one sector), hence "preferred_erase_size" provides a good
chunk size for erasing large areas.

For MMC, "preferred_erase_size" is the high-capacity erase size if a card
specifies one, otherwise it is based on the capacity of the card.

For SD, "preferred_erase_size" is the allocation unit size specified by
the card.

"preferred_erase_size" is in bytes.

Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com>
Acked-by: Jens Axboe <axboe@kernel.dk>
Cc: Kyungmin Park <kmpark@infradead.org>
Cc: Madhusudhan Chikkature <madhu.cr@ti.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Ben Gardiner <bengardiner@nanometrics.ca>
Cc: <linux-mmc@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agomm: fix writeback_in_progress()
Jan Kara [Wed, 11 Aug 2010 21:17:44 +0000 (14:17 -0700)]
mm: fix writeback_in_progress()

Commit 83ba7b071f3 ("writeback: simplify the write back thread queue")
broke writeback_in_progress() as in that commit we started to remove work
items from the list at the moment we start working on them and not at the
moment they are finished.  Thus if the flusher thread was doing some work
but there was no other work queued, writeback_in_progress() returned
false.  This could in particular cause unnecessary queueing of background
writeback from balance_dirty_pages() or writeout work from
writeback_sb_if_idle().

This patch fixes the problem by introducing a bit in the bdi state which
indicates that the flusher thread is processing some work and uses this
bit for writeback_in_progress() test.

NOTE: Both callsites of writeback_in_progress() (namely,
writeback_inodes_sb_if_idle() and balance_dirty_pages()) would actually
need a different information than what writeback_in_progress() provides.
They would need to know whether *the kind of writeback they are going to
submit* is already queued.  But this information isn't that simple to
provide so let's fix writeback_in_progress() for the time being.

Signed-off-by: Jan Kara <jack@suse.cz>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Wu Fengguang <fengguang.wu@intel.com>
Acked-by: Jens Axboe <jaxboe@fusionio.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agowriteback: merge for_kupdate and !for_kupdate cases
Wu Fengguang [Wed, 11 Aug 2010 21:17:43 +0000 (14:17 -0700)]
writeback: merge for_kupdate and !for_kupdate cases

Unify the logic for kupdate and non-kupdate cases.  There won't be
starvation because the inodes requeued into b_more_io will later be
spliced _after_ the remaining inodes in b_io, hence won't stand in the way
of other inodes in the next run.

It avoids unnecessary redirty_tail() calls, hence the update of
i_dirtied_when.  The timestamp update is undesirable because it could
later delay the inode's periodic writeback, or may exclude the inode from
the data integrity sync operation (which checks timestamp to avoid extra
work and livelock).

===
How the redirty_tail() comes about:

It was a long story..  This redirty_tail() was introduced with
wbc.more_io.  The initial patch for more_io actually does not have the
redirty_tail(), and when it's merged, several 100% iowait bug reports
arised:

reiserfs:
        http://lkml.org/lkml/2007/10/23/93

jfs:
        commit 29a424f28390752a4ca2349633aaacc6be494db5
        JFS: clear PAGECACHE_TAG_DIRTY for no-write pages

ext2:
        http://www.spinics.net/linux/lists/linux-ext4/msg04762.html

They are all old bugs hidden in various filesystems that become "visible"
with the more_io patch.  At the time, the ext2 bug is thought to be
"trivial", so not fixed.  Instead the following updated more_io patch with
redirty_tail() is merged:

http://www.spinics.net/linux/lists/linux-ext4/msg04507.html

This will in general prevent 100% on ext2 and possibly other unknown FS bugs.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Martin Bligh <mbligh@google.com>
Cc: Michael Rubin <mrubin@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agowriteback: fix queue_io() ordering
Wu Fengguang [Wed, 11 Aug 2010 21:17:42 +0000 (14:17 -0700)]
writeback: fix queue_io() ordering

This was not a bug, since b_io is empty for kupdate writeback.  The next
patch will do requeue_io() for non-kupdate writeback, so let's fix it.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Martin Bligh <mbligh@google.com>
Cc: Michael Rubin <mrubin@google.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agowriteback: don't redirty tail an inode with dirty pages
Wu Fengguang [Wed, 11 Aug 2010 21:17:41 +0000 (14:17 -0700)]
writeback: don't redirty tail an inode with dirty pages

Avoid delaying writeback for an expire inode with lots of dirty pages, but
no active dirtier at the moment.  Previously we only do that for the
kupdate case.

Any filesystem that does delayed allocation or unwritten extent conversion
after IO completion will cause this - for example, XFS.

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Acked-by: Jan Kara <jack@suse.cz>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agowriteback: add comment to the dirty limit functions
Wu Fengguang [Wed, 11 Aug 2010 21:17:40 +0000 (14:17 -0700)]
writeback: add comment to the dirty limit functions

Document global_dirty_limits() and bdi_dirty_limit().

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agowriteback: avoid unnecessary calculation of bdi dirty thresholds
Wu Fengguang [Wed, 11 Aug 2010 21:17:39 +0000 (14:17 -0700)]
writeback: avoid unnecessary calculation of bdi dirty thresholds

Split get_dirty_limits() into global_dirty_limits()+bdi_dirty_limit(), so
that the latter can be avoided when under global dirty background
threshold (which is the normal state for most systems).

Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agowriteback: balance_dirty_pages(): reduce calls to global_page_state
Wu Fengguang [Wed, 11 Aug 2010 21:17:37 +0000 (14:17 -0700)]
writeback: balance_dirty_pages(): reduce calls to global_page_state

Reducing the number of times balance_dirty_pages calls global_page_state
reduces the cache references and so improves write performance on a
variety of workloads.

'perf stats' of simple fio write tests shows the reduction in cache
access.  Where the test is fio 'write,mmap,600Mb,pre_read' on AMD AthlonX2
with 3Gb memory (dirty_threshold approx 600 Mb) running each test 10
times, dropping the fasted & slowest values then taking the average &
standard deviation

average (s.d.) in millions (10^6)
2.6.31-rc8 648.6 (14.6)
+patch 620.1 (16.5)

Achieving this reduction is by dropping clip_bdi_dirty_limit as it rereads
the counters to apply the dirty_threshold and moving this check up into
balance_dirty_pages where it has already read the counters.

Also by rearrange the for loop to only contain one copy of the limit tests
allows the pdflush test after the loop to use the local copies of the
counters rather than rereading them.

In the common case with no throttling it now calls global_page_state 5
fewer times and bdi_stat 2 fewer.

Fengguang:

This patch slightly changes behavior by replacing clip_bdi_dirty_limit()
with the explicit check (nr_reclaimable + nr_writeback >= dirty_thresh) to
avoid exceeding the dirty limit.  Since the bdi dirty limit is mostly
accurate we don't need to do routinely clip.  A simple dirty limit check
would be enough.

The check is necessary because, in principle we should throttle everything
calling balance_dirty_pages() when we're over the total limit, as said by
Peter.

We now set and clear dirty_exceeded not only based on bdi dirty limits,
but also on the global dirty limit.  The global limit check is added in
place of clip_bdi_dirty_limit() for safety and not intended as a behavior
change.  The bdi limits should be tight enough to keep all dirty pages
under the global limit at most time; occasional small exceeding should be
OK though.  The change makes the logic more obvious: the global limit is
the ultimate goal and shall be always imposed.

We may now start background writeback work based on outdated conditions.
That's safe because the bdi flush thread will (and have to) double check
the states.  It reduces overall overheads because the test based on old
states still have good chance to be right.

[akpm@linux-foundation.org] fix uninitialized dirty_exceeded
Signed-off-by: Richard Kennedy <richard@rsk.demon.co.uk>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
Cc: Jan Kara <jack@suse.cz>
Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Dave Chinner <david@fromorbit.com>
Cc: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoparisc: fix wrong page aligned size calculation in ioremapping code
Florian Zumbiehl [Wed, 11 Aug 2010 21:17:33 +0000 (14:17 -0700)]
parisc: fix wrong page aligned size calculation in ioremapping code

parisc __ioremap(): fix off-by-one error in page alignment of allocation
size for sizes where size%PAGE_SIZE==1.

Signed-off-by: Florian Zumbiehl <florz@florz.de>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Acked-by: Helge Deller <deller@gmx.de>
Tested-by: Helge Deller <deller@gmx.de>
Cc: "James E.J. Bottomley" <jejb@parisc-linux.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoscore: fix dereference of NULL pointer in local_flush_tlb_page()
Roel Kluin [Wed, 11 Aug 2010 21:17:31 +0000 (14:17 -0700)]
score: fix dereference of NULL pointer in local_flush_tlb_page()

Don't dereference vma if it's NULL.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Cc: Chen Liqin <liqin.chen@sunplusct.com>
Cc: Lennox Wu <lennox.wu@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agopc8736x_gpio: depends on X86_32
Randy Dunlap [Wed, 11 Aug 2010 21:17:30 +0000 (14:17 -0700)]
pc8736x_gpio: depends on X86_32

Fix kconfig dependency warning for PC8736x_GPIO by restricting it to
X86_32.

  warning: (SCx200_GPIO && SCx200 || PC8736x_GPIO && X86) selects NSC_GPIO which has unmet direct dependencies (X86_32)

NSC_GPIO is X86_32 only.  The other driver (SCx200_GPIO) that selects
NSC_GPIO is X86_32 only (indirectly, since SCx200 depends on X86_32), so
limit this driver also.

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Cc: Jordan Crouse <jordan.crouse@amd.com>
Cc: Jim Cromie <jim.cromie@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agomm: fix fatal kernel-doc error
Randy Dunlap [Wed, 11 Aug 2010 21:17:30 +0000 (14:17 -0700)]
mm: fix fatal kernel-doc error

Fix a fatal kernel-doc error due to a #define coming between a function's
kernel-doc notation and the function signature.  (kernel-doc cannot handle
this)

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoacpi: fix bogus preemption logic
Thomas Gleixner [Wed, 11 Aug 2010 21:17:29 +0000 (14:17 -0700)]
acpi: fix bogus preemption logic

The ACPI_PREEMPTION_POINT() logic was introduced in commit 8bd108d
(ACPICA: add preemption point after each opcode parse).  The follow up
commits abe1dfab6138d15692c084ca70 tried to fix the preemption logic
back and forth, but nobody noticed that the usage of
in_atomic_preempt_off() in that context is wrong.

The check which guards the call of cond_resched() is:

    if (!in_atomic_preempt_off() && !irqs_disabled())

in_atomic_preempt_off() is not intended for general use as the comment
above the macro definition clearly says:

 * Check whether we were atomic before we did preempt_disable():
 * (used by the scheduler, *after* releasing the kernel lock)

On a CONFIG_PREEMPT=n kernel the usage of in_atomic_preempt_off() works by
accident, but with CONFIG_PREEMPT=y it's just broken.

The whole purpose of the ACPI_PREEMPTION_POINT() is to reduce the latency
on a CONFIG_PREEMPT=n kernel, so make ACPI_PREEMPTION_POINT() depend on
CONFIG_PREEMPT=n and remove the in_atomic_preempt_off() check.

Addresses https://bugzilla.kernel.org/show_bug.cgi?id=16210

[akpm@linux-foundation.org: fix build]
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Len Brown <lenb@kernel.org>
Cc: Francois Valenduc <francois.valenduc@tvcablenet.be>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agokernel/kfifo.c: add handling of chained scatterlists
Stefani Seibold [Wed, 11 Aug 2010 21:17:27 +0000 (14:17 -0700)]
kernel/kfifo.c: add handling of chained scatterlists

The current kfifo scatterlist implementation will not work with chained
scatterlists.  It assumes that struct scatterlist arrays are allocated
contiguously, which is not the case when chained scatterlists (struct
sg_table) are in use.

Signed-off-by: Stefani Seibold <stefani@seibold.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoCRIS: Define io_remap_pfn_range as remap_pfn_range
Jesper Nilsson [Thu, 12 Aug 2010 12:32:58 +0000 (14:32 +0200)]
CRIS: Define io_remap_pfn_range as remap_pfn_range

CRIS don't need any special mapping for io, but didn't define this,
meaning that all uses of io_remap_pfn_range lead to compile errors.

This fixes a compile error introduced in CRIS when drivers/mtd/mtdchar.c
mmap handling was changed in commit dd02b67d5e9e7896891fa27eb5db65f55a290998

Signed-off-by: Jesper Nilsson <jesper.nilsson@axis.com>
13 years agomfd: Fix incorrect kfree(i2c) in wm8994-core i2c_driver probe
Axel Lin [Mon, 9 Aug 2010 06:52:16 +0000 (14:52 +0800)]
mfd: Fix incorrect kfree(i2c) in wm8994-core i2c_driver probe

The i2c_client received in probe() should not be kfree()'d.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Fix incorrect kfree(i2c) in wm831x-core i2c_driver probe
Axel Lin [Mon, 9 Aug 2010 06:51:15 +0000 (14:51 +0800)]
mfd: Fix incorrect kfree(i2c) in wm831x-core i2c_driver probe

The i2c_client received in probe() should not be kfree()'d.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Fix incorrect kfree(i2c) in tps6507x i2c_driver probe
Axel Lin [Mon, 9 Aug 2010 06:49:46 +0000 (14:49 +0800)]
mfd: Fix incorrect kfree(i2c) in tps6507x i2c_driver probe

The i2c_client received in probe() should not be kfree()'d.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Add TPS6586x driver
Mike Rapoport [Tue, 10 Aug 2010 23:11:04 +0000 (01:11 +0200)]
mfd: Add TPS6586x driver

Add mfd core driver for TPS6586x PMICs family.
The driver provides I/O access for the sub-device drivers and performs
regstration of the sub-devices based on the platform requirements.
In addition it implements GPIOlib interface for the chip GPIOs.

TODO:
        - add interrupt support
        - add platform data for PWM, backlight leds and charger

Signed-off-by: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Mike Rapoport <mike.rapoport@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Use macros instead of some constant magic numbers for menelaus
Jarkko Nikula [Sun, 8 Aug 2010 17:05:24 +0000 (20:05 +0300)]
mfd: Use macros instead of some constant magic numbers for menelaus

This patch is originally done by Carlos Eduardo Aguiar. Original fix is
commit 3305829b2816072b9c8ed01374b205ae4de74027 in
git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git

Author modified the fix for mainline version of menelaus.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Cc: Carlos Eduardo Aguiar <carlos.aguiar@indt.org.br>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Fix menelaus mmc slot 2 misconfiguration
Jarkko Nikula [Sun, 8 Aug 2010 17:05:23 +0000 (20:05 +0300)]
mfd: Fix menelaus mmc slot 2 misconfiguration

We are modifying register value instead of return value.

This fix is originally done by Carlos Eduardo Aguiar. Original fix is
commit bb4e91722e29efe31587d2cc664b6def645aecd9 in
git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6.git

Author modified the fix for mainline version of menelaus.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
Cc: Carlos Eduardo Aguiar <carlos.aguiar@indt.org.br>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Missing slab.h includes
David Miller [Thu, 5 Aug 2010 05:57:14 +0000 (22:57 -0700)]
mfd: Missing slab.h includes

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Fix wrong wm8350-core kfree in error path
Axel Lin [Wed, 4 Aug 2010 01:54:21 +0000 (09:54 +0800)]
mfd: Fix wrong wm8350-core kfree in error path

This patch includes below fixes:
1. fix wm8350_create_cache error path
   make sure wm8350->reg_cache is freed in error path.
2. fix wm8350_device_init error path
   no need to kfree(wm8350->reg_cache) in the case of goto out.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Fix wm8994_device_init() return value
Axel Lin [Wed, 4 Aug 2010 01:44:47 +0000 (09:44 +0800)]
mfd: Fix wm8994_device_init() return value

wm8994_device_init() will return 0 in the case of kzalloc fail
in current implementation.
This patch fixes the return value.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Avoid calling platform_device_put() twice in ucb1400 probe error path
Axel Lin [Tue, 3 Aug 2010 08:34:13 +0000 (16:34 +0800)]
mfd: Avoid calling platform_device_put() twice in ucb1400 probe error path

In the case of goto err2, what we want is to call
platform_device_del() instead of platform_device_unregister().
Otherwise, we call platform_device_put() twice.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Annotate tc6387xb probe/remove routines with __devinit/__devexit
Axel Lin [Tue, 3 Aug 2010 05:45:45 +0000 (13:45 +0800)]
mfd: Annotate tc6387xb probe/remove routines with __devinit/__devexit

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Fix tc6387xb resource reclaim
Axel Lin [Tue, 3 Aug 2010 05:44:00 +0000 (13:44 +0800)]
mfd: Fix tc6387xb resource reclaim

This patch includes below fixes:
1. add a missing iounmap in tc6387xb_probe() error path
2. fix resource reclaim in tc6387xb_remove()

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Fix wrong goto labels for tc6393xb error handling
Axel Lin [Tue, 3 Aug 2010 03:10:41 +0000 (11:10 +0800)]
mfd: Fix wrong goto labels for tc6393xb error handling

This patch corrects the error handling path.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Get rid of now unused mc13783 private header
Uwe Kleine-König [Mon, 2 Aug 2010 13:48:04 +0000 (15:48 +0200)]
mfd: Get rid of now unused mc13783 private header

This adds all remaining definitions that are used by the core driver
to the .c file.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agohwmon: Don't access struct mc13783 directly from mc13783-adc
Uwe Kleine-König [Mon, 2 Aug 2010 09:14:18 +0000 (11:14 +0200)]
hwmon: Don't access struct mc13783 directly from mc13783-adc

There is a shiny new mc13783 API function that can be used instead.

While at it refactor the code a bit to reduce code duplication a bit.

This removes the last user of <linux/mfd/mc13783-private.h> and so this
include file can go away.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: New mc13783 function exposing flags
Uwe Kleine-König [Mon, 2 Aug 2010 09:14:17 +0000 (11:14 +0200)]
mfd: New mc13783 function exposing flags

This is needed for the mc13783-adc driver to decide if a touch screen is
connected.  If so some channels are not available as generic hwmon inputs.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Check jz4740-adc kmalloc() result
Axel Lin [Mon, 2 Aug 2010 01:02:02 +0000 (09:02 +0800)]
mfd: Check jz4740-adc kmalloc() result

If kmalloc() fails exit with -ENOMEM.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Fix jz4740-adc resource reclaim in probe error path
Axel Lin [Thu, 29 Jul 2010 08:28:25 +0000 (16:28 +0800)]
mfd: Fix jz4740-adc resource reclaim in probe error path

If mfd_add_devices() fail, we need to relese allocated resources.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Add WM8321 support
Mark Brown [Wed, 21 Jul 2010 13:23:37 +0000 (14:23 +0100)]
mfd: Add WM8321 support

The WM8321 is a PMIC for low power, high performance applications. From a
software point of view the device is identical to the WM8320, all the
differences between the two devices are visible only in hardware.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Add stmpe auto sleep feature
Sundar R Iyer [Wed, 21 Jul 2010 06:11:07 +0000 (11:41 +0530)]
mfd: Add stmpe auto sleep feature

Some STMPE devices support entering sleep mode automatically on a
specified timeout of inactivity on the I2C bus with the host system.

Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Acked-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Sundar R Iyer <sundar.iyer@stericsson.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agotouchscreen: Fix sign bug
Kulikov Vasiliy [Thu, 15 Jul 2010 18:43:54 +0000 (22:43 +0400)]
touchscreen: Fix sign bug

platform_get_irq_byname() can return negative results, it is not seen to
unsigned ts_irq. Make it signed.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Acked-By: Luotao Fu <l.fu@pengutronix.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Add support for TWL6030 PWM
Hemanth V [Wed, 14 Jul 2010 10:04:56 +0000 (12:04 +0200)]
mfd: Add support for TWL6030 PWM

TWL6030 supports PWM (Pulse Width Modulator) which is used
to control charging LED. PWM allows for controlling brightness.
This patch implements the APIs required by leds-pwm driver.

Signed-off-by: Hemanth V <hemanthv@ti.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Add additional WM8994 GPIO functions
Mark Brown [Thu, 8 Jul 2010 12:09:51 +0000 (21:09 +0900)]
mfd: Add additional WM8994 GPIO functions

Later revisions of the WM8994 add some more GPIO functions, define them
in the header file.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Add JZ4740 ADC driver
Lars-Peter Clausen [Mon, 12 Jul 2010 01:48:08 +0000 (03:48 +0200)]
mfd: Add JZ4740 ADC driver

This patch adds a MFD driver for the JZ4740 ADC unit. The driver is used to
demultiplex IRQs and synchronize access to shared registers between the
battery, hwmon and (future) touchscreen driver.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agogpiolib: Implement set_debounce for WM831x GPIOs
Mark Brown [Sat, 3 Jul 2010 13:40:56 +0000 (15:40 +0200)]
gpiolib: Implement set_debounce for WM831x GPIOs

The debounce times are approximate, they can be selected using the two
input functions.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agoinput: STMPE touch controller support
Luotao Fu [Fri, 2 Jul 2010 12:10:29 +0000 (14:10 +0200)]
input: STMPE touch controller support

This one adds a driver for STMPE touchscreen controllers.
This driver depends on the stmpexxx mfd core driver.

Signed-off-by: Luotao Fu <l.fu@pengutronix.de>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agoinput: Add STMPE keypad driver
Rabin Vincent [Fri, 2 Jul 2010 11:22:10 +0000 (16:52 +0530)]
input: Add STMPE keypad driver

Add an input driver for the keypad on STMPE I/O expanders.  This driver
uses the common support provided by the STMPE MFD driver.

Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agogpio: Add STMPE GPIO driver
Rabin Vincent [Fri, 2 Jul 2010 11:22:09 +0000 (16:52 +0530)]
gpio: Add STMPE GPIO driver

Add support for the GPIOs on STMPE I/O Expanders.

[l.fu@pengutronix.de: fix set direction input]
[l.fu@pengutronix.de: set GPIO alternate function while requesting]
Acked-by: Luotao Fu <l.fu@pengutronix.de>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Add STMPE I/O Expander support
Rabin Vincent [Fri, 2 Jul 2010 11:22:08 +0000 (16:52 +0530)]
mfd: Add STMPE I/O Expander support

Add support for the STMPE family of I/O Expanders from
STMicroelectronics.  These devices include upto 24 gpios and a varying
selection of blocks, including PWM, keypad, and touchscreen controllers.
This patch adds the MFD core.

[l.fu@pengutronix.de: fix stmpe811 enable hook]
[l.fu@pengutronix.de: add touchscreen platform data]
Acked-by: Luotao Fu <l.fu@pengutronix.de>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Properly free t7l66xb clk32k clock source
Axel Lin [Thu, 1 Jul 2010 09:43:50 +0000 (17:43 +0800)]
mfd: Properly free t7l66xb clk32k clock source

This patch includes below fixes to properly free clk32k clock source:
1. remove a redundant clk_put in t7l66xb_probe error path
2. add missing clk_disable(t7l66xb->clk32k) and clk_put(t7l66xb->clk32k)
   to properly free the clock source.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: More verbose MFD Kconfig entry
Samuel Ortiz [Sat, 19 Jun 2010 00:29:24 +0000 (02:29 +0200)]
mfd: More verbose MFD Kconfig entry

For people to be able to intellingibly decide if they want to enable MFD
drivers or not, we have to give them a much better description of what they
are.

13 years agomfd: Staticise ab3550 register access functions
Mark Brown [Wed, 9 Jun 2010 13:54:54 +0000 (14:54 +0100)]
mfd: Staticise ab3550 register access functions

These are now exported via an ops table rather than referenced
directly and so should be staticised.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Fix davinci memory leak
Julia Lawall [Tue, 1 Jun 2010 14:34:38 +0000 (16:34 +0200)]
mfd: Fix davinci memory leak

Error handling code following a kmalloc should free the allocated data.

The semantic match that finds the problem is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r exists@
local idexpression x;
statement S;
expression E;
identifier f,f1,l;
position p1,p2;
expression *ptr != NULL;
@@

x@p1 = \(kmalloc\|kzalloc\|kcalloc\)(...);
...
if (x == NULL) S
<... when != x
     when != if (...) { <+...x...+> }
(
x->f1 = E
|
 (x->f1 == NULL || ...)
|
 f(...,x->f1,...)
)
...>
(
 return \(0\|<+...x...+>\|ptr\);
|
 return@p2 ...;
)

@script:python@
p1 << r.p1;
p2 << r.p2;
@@

print "* file: %s kmalloc %s return %s" % (p1[0].file,p1[0].line,p2[0].line)
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: properly handle platform_device_add_resources fail in mfd_add_device
Axel Lin [Mon, 31 May 2010 09:30:55 +0000 (17:30 +0800)]
mfd: properly handle platform_device_add_resources fail in mfd_add_device

platform_device_add_resources may fail, thus add error checking for it.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: kzalloc doesn't return ERR_PTR
Julia Lawall [Fri, 28 May 2010 20:58:46 +0000 (22:58 +0200)]
mfd: kzalloc doesn't return ERR_PTR

Use !x rather than IS_ERR(x) to test the result of kzalloc.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@
expression x,E;
@@

x = \(kmalloc\|kzalloc\|kcalloc\)(...)
... when != x = E
- IS_ERR(x)
+ !x
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: AB8500 mask off irrelevant bits from the SPI message
Linus Walleij [Fri, 28 May 2010 00:59:44 +0000 (02:59 +0200)]
mfd: AB8500 mask off irrelevant bits from the SPI message

The registers on the AB8500 are only 8 bits wide, so the content
of the remaining bits is undefined. Let's mask off the undefined
stuff when returning a register in an SPI read.

Acked-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Fix 88pm860x uninitialized variable and clean up
Dan Carpenter [Wed, 26 May 2010 22:54:09 +0000 (00:54 +0200)]
mfd: Fix 88pm860x uninitialized variable and clean up

The original code had a compile warning:
drivers/mfd/88pm860x-core.c:431: warning: ‘ret’ may be used
uninitialized in this function
It seems like the warning is valid if either pdata or pdata->touch is
NULL.

This patch checks pdata and pdata->touch at the beginning of the
function.  That means everything can be pulled in one indent level.
Now all the statements fit within the 80 character limit.

Also at that point the "use_gpadc" variable isn't needed and removing
it simplifies the logic.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Acked-by: Haojian Zhuang <hzhuang1@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Fix memory leak in ab3100_otp_probe
Axel Lin [Tue, 25 May 2010 06:49:51 +0000 (14:49 +0800)]
mfd: Fix memory leak in ab3100_otp_probe

In current implementation, there is a memory leak if ab3100_otp_read fail.
And in the case of ab3100_otp_init_debugfs fail, it does not properly remove
sysfs entries.
This patch properly handle above failure cases.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Fix led resource in 88pm860x
Haojian Zhuang [Wed, 19 May 2010 05:06:59 +0000 (13:06 +0800)]
mfd: Fix led resource in 88pm860x

Fix typo error in LED resource of 88pm860x.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agomfd: Enable onkey on max8925
Haojian Zhuang [Fri, 18 Jun 2010 17:59:53 +0000 (19:59 +0200)]
mfd: Enable onkey on max8925

Enable onkey feature in max8925 driver.

Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
13 years agodm mpath: support discard
Mike Snitzer [Thu, 12 Aug 2010 03:14:32 +0000 (04:14 +0100)]
dm mpath: support discard

Enable discard support in the DM multipath target.

This discard support depends on a few discard-specific fixes to the
block layer's request stacking driver methods.

Discard requests are optional so don't allow a failed discard to trigger
path failures.  If there is a real problem with a given path the
barriers associated with the discard (either before or after the
discard) will cause path failure.  That said, unconditionally passing
discard failures up the stack is not ideal.  This must be fixed once DM
has more information about the nature of the underlying storage failure.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Cc: Kiyoshi Ueda <k-ueda@ct.jp.nec.com>
13 years agodm stripe: support discards
Mikulas Patocka [Thu, 12 Aug 2010 03:14:26 +0000 (04:14 +0100)]
dm stripe: support discards

The DM core will submit a discard bio to the stripe target for each
stripe in a striped DM device.  The stripe target will determine
stripe-specific portions of the supplied bio to be remapped into
individual (at most 'num_discard_requests' extents).  If a given
stripe-specific discard bio doesn't touch a particular stripe the bio
will be dropped.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
13 years agodm: split discard requests on target boundaries
Mike Snitzer [Thu, 12 Aug 2010 03:14:24 +0000 (04:14 +0100)]
dm: split discard requests on target boundaries

Update __clone_and_map_discard to loop across all targets in a DM
device's table when it processes a discard bio.  If a discard crosses a
target boundary it must be split accordingly.

Update __issue_target_requests and __issue_target_request to allow a
cloned discard bio to have a custom start sector and size.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
13 years agodm stripe: optimize sector division
Mikulas Patocka [Thu, 12 Aug 2010 03:14:21 +0000 (04:14 +0100)]
dm stripe: optimize sector division

Optimize sector division: If the number of stripes is a power of two,
we can do shift and mask instead of division.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
13 years agodm stripe: move sector translation to a function
Mikulas Patocka [Thu, 12 Aug 2010 03:14:14 +0000 (04:14 +0100)]
dm stripe: move sector translation to a function

Move sector to stripe translation into a function.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
13 years agodm: error return error for discards
Mike Snitzer [Thu, 12 Aug 2010 03:14:14 +0000 (04:14 +0100)]
dm: error return error for discards

Have the error target respond to a discard request with a hard -EIO
rather than fail the request with -EOPNOTSUPP.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
13 years agodm delay: support discard
Mike Snitzer [Thu, 12 Aug 2010 03:14:13 +0000 (04:14 +0100)]
dm delay: support discard

Enable discard support for the delay target.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
13 years agodm: zero silently drop discards
Mike Snitzer [Thu, 12 Aug 2010 03:14:12 +0000 (04:14 +0100)]
dm: zero silently drop discards

Have the zero target silently drop a discard rather than fail the
request with -EOPNOTSUPP.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
13 years agodm: use dm_target_offset macro
Alasdair G Kergon [Thu, 12 Aug 2010 03:14:11 +0000 (04:14 +0100)]
dm: use dm_target_offset macro

Use new dm_target_offset() macro to avoid most references to ti->begin
in dm targets.

Signed-off-by: Alasdair G Kergon <agk@redhat.com>
13 years agodm: factor out max_io_len_target_boundary
Mike Snitzer [Thu, 12 Aug 2010 03:14:10 +0000 (04:14 +0100)]
dm: factor out max_io_len_target_boundary

Split max_io_len_target_boundary out of max_io_len so that the discard
support can make use of it without duplicating max_io_len code.

Avoiding max_io_len's split_io logic enables DM's discard support to
submit the entire discard request to a target.  But discards must still
be split on target boundaries.

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>