Axel Lin [Tue, 27 Mar 2012 07:20:08 +0000 (15:20 +0800)]
regulator: wm8350: Fix the logic to choose best current limit setting
Current implementation in get_isink_val actually choose the biggest current
limit setting falls within the specified range.
What we want is to choose the smallest current limit setting falls within the
specified range. Fix it.
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
regulator: anatop: patching to device-tree property "reg".
Change "reg" to "anatop-reg-offset" due to there is a warning of handling no
size field in reg.
This patch also adds the missing device-tree binding documentation.
Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel Lin [Thu, 22 Mar 2012 22:27:10 +0000 (06:27 +0800)]
regulator: Do proper shift to set correct bit for DC[2|5]_HIB_MODE setting
DC[2|5]_HIB_MODE is BIT 12 of DCDC[2|5] Control register.
WM8350_DC2_HIB_MODE_ACTIVE/WM8350_DC2_HIB_MODE_DISABLE are defined as 1/0.
Thus we need to left shift WM8350_DC2_HIB_MODE_SHIFT bits.
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel Lin [Thu, 22 Mar 2012 22:25:05 +0000 (06:25 +0800)]
regulator: Fix restoring pmic.dcdcx_hib_mode settings in wm8350_dcdc_set_suspend_enable
What we want is to restore wm8350->pmic.dcdcx_hib_mode settings to
WM8350_DCDCx_LOW_POWER registers. Current code also clears all other
bits of WM8350_DCDCx_LOW_POWER registers which is wrong.
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Mark Brown [Mon, 19 Mar 2012 17:17:32 +0000 (17:17 +0000)]
Merge tag 'topic/twl' into regulator-next
TWL specific changes, cross-merged with OMAP due to arch/arm wanting to
use the new ability to override the voltage set and get operations to
support the in-CPU voltage management. The other changes are minor
fixes, the addition of a few new regulators and device tree support.
Rajendra Nayak [Fri, 16 Mar 2012 10:20:21 +0000 (15:50 +0530)]
regulator: Fix up a confusing dev_warn when DT lookup fails
of_parse_phandle() returns NULL either if the property name
itself does not exist or if it (exists and) does not
reference a valid phandle.
Giving out a warn like the one below (that the property references
an invalid phandle) can be confusing when the property itself
does not exist in the node.
Fix it with a more sensible message and make it a dev_dbg instead
of a dev_warn.
Reported-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Signed-off-by: Rajendra Nayak <rnayak@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel Lin [Mon, 12 Mar 2012 07:57:50 +0000 (15:57 +0800)]
regulator: Refactor tps6507x to use one tps6507x_pmic_ops for all LDOs and DCDCs
All the callback functions implementation for DCDCx and LDOx are very similar,
I think it is ok to use one tps6507x_pmic_ops for all LDOs and DCDCs.
This refactor removes a couple of duplicated code.
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel Lin [Sat, 10 Mar 2012 02:59:43 +0000 (10:59 +0800)]
regulator: Make s5m8767_get_voltage_register always return correct register
Check s5m8767->buck[2|3|4]_gpiodvs status in s5m8767_get_voltage_register
and return correct register accordingly.
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Sangbeom Kim <sbkim73@samsung.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
If we need to ensure only one of the buck[2|3|4]_gpiodvs can be specificed,
check them earlier.
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Sangbeom Kim <sbkim73@samsung.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Laxman Dewangan [Wed, 14 Mar 2012 07:30:58 +0000 (13:00 +0530)]
regulator: tps65910: Provide settling time for DCDC voltage change
Settling time is require when there is dcdc rail's voltage change.
Returning proper delay time for dcdc voltage change to settle down
the output voltage to new value.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Anatop is an integrated regulator inside i.MX6 SoC.
There are 3 digital regulators which controls PU, CORE (ARM), and SOC.
And 3 analog regulators which controls 1P1, 2P5, 3P0 (USB).
This patch adds the Anatop regulator driver.
Signed-off-by: Nancy Chen <Nancy.Chen@freescale.com> Signed-off-by: Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org> Acked-by: Shawn Guo <shawn.guo@linaro.org> Reviewed-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel Lin [Wed, 14 Mar 2012 02:18:45 +0000 (10:18 +0800)]
regulator: Use tps65912_set_voltage_sel for both DCDCx and LDOx
commit 42b5ef "regulator: tps65912: Use simple equations to get register address"
uses tps65912_get_sel_register to replace tps65912_get_dcdc_sel_register
and tps65912_get_ldo_sel_register.
Now tps65912_set_voltage_dcdc_sel and tps65912_set_voltage_ldo_sel has exactly
the same implementation. Merge them to tps65912_set_voltage_sel function.
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Laxman Dewangan [Tue, 13 Mar 2012 06:05:20 +0000 (11:35 +0530)]
regulator: tps65910: Provide settling time for enabling rails
There is settling time for each rails when it is switched to
ON. Implementing enable time for returning proper settling time
of regulator rails when it is enabled.
Filling the on-time for each rail as per tps65910/tps65911
datasheets.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel Lin [Mon, 12 Mar 2012 22:40:48 +0000 (06:40 +0800)]
regulator: tps65912: Use simple equations to get register address
The address of ctrl and sel registers can be calculated by simple equations.
This patch simplifies the implementation in tps65912_get_ctrl_register and
implements tps65912_get_sel_register to replace tps65912_get_dcdc_sel_register
and tps65912_get_ldo_sel_register.
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel Lin [Mon, 12 Mar 2012 23:15:27 +0000 (07:15 +0800)]
regulator: Fix the logic of tps65910_get_mode
We actually clear LDO_ST_ON_BIT for standby mode in tps65910_set_mode.
Fix the logic in tps65910_get_mode.
Supply state (EEPROM bits):
ST[1:0] = 00 : Off
ST[1:0] = 01 : On high power (ACTIVE)
ST[1:0] = 10 : Off
ST[1:0] = 11 : On low power (SLEEP)
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel Lin [Mon, 12 Mar 2012 04:11:46 +0000 (12:11 +0800)]
regulator: Merge tps65217_pmic_ldo234_ops and tps65217_pmic_dcdc_ops to tps65217_pmic_ops
Most callback functions implementation for tps65217_pmic_ldo234_ops and
tps65217_pmic_dcdc_ops are the same except the rid range checking.
This patch uses tps65217_pmic_ops for all DCDCx, LDO2, LDO3, and LDO4.
And rework tps65217_pmic_set_voltage to make it can be called for
DCDCx, LDO2, LDO3, and LDO4.
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel Lin [Fri, 9 Mar 2012 03:31:08 +0000 (11:31 +0800)]
regulator: Rename s5m8767_convert_voltage to s5m8767_convert_voltage_to_sel
This function finds the smallest voltage that falls within the specified range,
and then returns the selector. This rename makes the intention more clear.
Also remove unneeded local variables min_vol and max_vol in s5m8767_set_voltage
and s5m8767_set_voltage_buck.
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Sangbeom Kim <sbkim73@samsung.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel Lin [Fri, 9 Mar 2012 02:22:20 +0000 (10:22 +0800)]
regulator: Rename set_voltage_sel callback function name to *_sel
This change improves readability.
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Laxman Dewangan [Wed, 7 Mar 2012 12:51:49 +0000 (18:21 +0530)]
regulator: tps65910: Sleep off rails when ext sleep configured
Keep the rails OFF in sleep mode only when the rails are
controlled by external sleep control.
The devices tps65910 and tps65911, both has the sleep input.
The tps65911's sleep input is not same as tps65910's EN3 and hence
taking care of SLEEP input as separate external sleep control input.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel Lin [Wed, 7 Mar 2012 02:02:12 +0000 (10:02 +0800)]
regulator: Remove unused i2c variable in s5m8767_pmic_probe
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Sangbeom Kim <sbkim73@samsung.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel Lin [Fri, 2 Mar 2012 08:20:54 +0000 (16:20 +0800)]
regulator: ad5398: Use DIV_ROUND_UP macro to calculate selector
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Sonic Zhang <sonic.zhang@analog.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel Lin [Fri, 2 Mar 2012 01:28:44 +0000 (09:28 +0800)]
regulator: Add a pointer to aat2870_data in struct aat2870_regulator
The reason we add *pdev in struct aat2870_regulator is to use it
to get a pointer to struct aat2870_data.
Save a pointer to struct aat2870_data instead of pdev in struct
aat2870_regulator, this change makes the intention more clear.
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Jin Park <jinyoungp@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel Lin [Fri, 2 Mar 2012 01:19:02 +0000 (09:19 +0800)]
regulator: Simplify the code to get selector in isl6271a_set_voltage
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Marek Vasut <marek.vasut@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel Lin [Wed, 29 Feb 2012 04:45:35 +0000 (12:45 +0800)]
regulator: Fix n_voltage settings for pcf50633 regulator
Current code has off-by-one n_voltage settings for AUTO/DOWN*/LDO* regulators.
Take ldo1 as example:
n_voltage should be (3.6 - 0.9) / 0.1 + 1 = 28
Table 76. LDO1OUT - LDO1 output voltage select register (address 2Dh) bit description[1]
Bit Symbol Access Description
4:0 ldo1_out R/W VO(prog) = 0.9 + ldo1_out × 0.1 V (max 3.6V); e.g.
00000 : 0.9 V
00001 : 1.0 V
11000 : 3.3 V
11011 : 3.6 V
11111 : 3.6 V
The n_voltage settings for HCLDO and MEMLDO are also wrong.
n_voltage for HCLDO and MEMLDO should be (3.6 - 0.9) / 0.1 + 1 = 28
Table 88. HCLDOOUT - HCLDO output voltage select register (addr. 39h) bit description[1]
Bit Symbol Access Description
4:0 hcldo_out R/W VO(prog) = 0.9 + hcldo_out × 0.1 V (max 3.6 V); e.g.
00000 : 0.9 V
00001 : 1.0 V
11011 : 3.6 V
11111 : 3.6 V
Table 62. MEMLDOOUT - MEMLDO o/p voltage select reg. (address 26h) bit description[1]
Bit Symbol Access Description
4:0 memldo_out R/W VO(prog) = 0.9 + memldo_out × 0.1 V; e.g.
00000: 0.9 V
00001: 1.0 V
11000 : 3.3 V
11011 : 3.6 V
11111 : 3.6 V
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel Lin [Fri, 24 Feb 2012 06:52:45 +0000 (14:52 +0800)]
regulator: Fix the logic of s5m8767_set_voltage_time_sel
This patch includes below fixes:
1. The mask variable is not used at all here, remove it.
2. We already have the new_sel and old_sel, simply returns the delay by:
DIV_ROUND_UP(desc->step * (new_sel - old_sel), s5m8767->ramp_delay);
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel Lin [Fri, 24 Feb 2012 09:15:45 +0000 (17:15 +0800)]
regulator: Convert ab8499 to use get_voltage_sel()
This change is required to make ab8500_regulator_get_voltage_sel work.
The regulator core will call set_voltage_time_sel only when get_voltage_sel is
implemented.
Signed-off-by: Axel Lin <axel.lin@gmail.com> Tested-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel Lin [Wed, 22 Feb 2012 01:29:16 +0000 (09:29 +0800)]
regulator: Sort Kconfig and Makefile entries
Sort Kconfig entries by company name/driver in alphabetical order.
Sort Makefile entries by alphabetical order.
In order to group all the Kconfig entries by company name,
this patch also adds company name to some Kconfig entries.
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel Lin [Tue, 21 Feb 2012 02:14:55 +0000 (10:14 +0800)]
regulator: Fix module desciption for tps65910 regulator
Fix the module desciption and also update Kconfig to include supporting
tps65911 chip.
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Laxman Dewangan [Fri, 17 Feb 2012 13:26:11 +0000 (18:56 +0530)]
regulator: tps65910: Correct VIO voltage configuration
The VIO regulator register specify the voltage configuration
on bit3:2 of its register. And hence only these bits should
be modified when setting voltage and used when reading voltage
from register setting.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Axel Lin [Tue, 7 Feb 2012 03:06:20 +0000 (11:06 +0800)]
regulator: tps62360: Remove pointless test for unsigned less than zero
The variable 'selector' is a 'unsigned int', so it can never be less than zero.
Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Peter Ujfalusi [Tue, 28 Feb 2012 09:39:13 +0000 (15:09 +0530)]
mfd: twl-core: regulator configuration for twl6030 V1V8, V2V1 SMPS
To be able to attach consumers to these supplies from board
files we need to have regulator_init_data for them.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Rajendra Nayak <rnayak@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Peter Ujfalusi [Tue, 28 Feb 2012 09:39:12 +0000 (15:09 +0530)]
regulator: twl-regulator: Add fixed LDO for V1V8, V2V1 supply
V1V8 supply most common use is to provide VIO for the system.
V2V1 supply is used on SDP4430/PandaBoards to provide 2.1V to
twl6040, and also as an input to VCXIO_IN, VDAC_IN of twl6030.
Also update the bindings documentation with the new compatible
property for these additional LDOs.
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com> Signed-off-by: Rajendra Nayak <rnayak@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Rajendra Nayak [Tue, 28 Feb 2012 09:39:11 +0000 (15:09 +0530)]
regulator: twl: adapt twl-regulator driver to dt
Modify the twl regulator driver to extract the regulator_init_data from
device tree when passed, instead of getting it through platform_data
structures (on non-DT builds)
Also add documentation for TWL regulator specific bindings.
Signed-off-by: Rajendra Nayak <rnayak@ti.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Tero Kristo [Tue, 28 Feb 2012 09:39:10 +0000 (15:09 +0530)]
regulator: twl6030: add support for vdd1, vdd2 and vdd3 regulators
vdd1 and vdd2 are now common regulators for twl4030 and twl6030. Also
added vdd3 as a new regulator for twl6030. twl6030 vdd1...vdd3 smps
regulator voltages can only be controlled through the smartreflex
voltage channel, thus the support for the voltage_get and set is
minimal and requires external controller.
Signed-off-by: Tero Kristo <t-kristo@ti.com> Signed-off-by: Rajendra Nayak <rnayak@ti.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Tero Kristo [Thu, 16 Feb 2012 10:27:52 +0000 (12:27 +0200)]
regulator: twl4030: add support for external voltage get/set
This is needed for SMPS regulators, which use the OMAP voltage
processor for voltage get/set functions instead of the normal I2C
channel. For this purpose, regulator_init_data->driver_data contents
are expanded, it is now a struct which contains function pointers
for the set/get voltage operations, a data pointer for these, and
the previously used features bitmask.
Signed-off-by: Tero Kristo <t-kristo@ti.com> Acked-by: Samuel Ortiz <sameo@linux.intel.com> [for the MFD part] Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Laxman Dewangan [Fri, 3 Feb 2012 07:24:38 +0000 (12:54 +0530)]
regulator: twl6030: Fix voltage selection logic
The voltage selection logic for the twl6030 smps fails if
min:max is such that min < 1300mV and max > 1300mV although
this is in valid range for a regulator e.g. [x, 1350] where
x < 1300.
Fixing the voltage selection logic such that first it will
check for min_uV for a range and then calculated value will
be checked against max_uV.
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Sascha Hauer [Sat, 3 Mar 2012 11:40:02 +0000 (12:40 +0100)]
regulator: provide a helper for registering a fixed regulator
Some devices require a regulator to work, but boards may not have
a software controllable regulator for this device. Provide a helper
function to make it simpler for these boards to register a fixed
regulator as a dummy regulator.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Linus Torvalds [Sat, 25 Feb 2012 20:12:08 +0000 (12:12 -0800)]
Merge tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Couple of minor driver fixes.
* tag 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
hwmon: (max34440) Fix resetting temperature history
hwmon: (f75375s) Fix register write order when setting fans to full speed
hwmon: (ads1015) Fix file leak in probe function
hwmon: (max6639) Fix PPR register initialization to set both channels
hwmon: (max6639) Fix FAN_FROM_REG calculation
Linus Torvalds [Sat, 25 Feb 2012 20:11:25 +0000 (12:11 -0800)]
Merge branch 'rc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
three kbuild fixes for 3.3:
- make deb-pkg symlink race fix.
- make coccicheck fix.
- Dropping the check for modutils. This is not a regression, but
allows the module-init-tools replacement kmod work with the 3.3
kernel.
* 'rc-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
coccicheck: change handling of C={1,2} when M= is set
builddeb: Don't create files in /tmp with predictable names
kbuild: do not check for ancient modutils tools
Ian Kent [Wed, 22 Feb 2012 12:45:44 +0000 (20:45 +0800)]
autofs: work around unhappy compat problem on x86-64
When the autofs protocol version 5 packet type was added in commit 5c0a32fc2cd0 ("autofs4: add new packet type for v5 communications"), it
obvously tried quite hard to be word-size agnostic, and uses explicitly
sized fields that are all correctly aligned.
However, with the final "char name[NAME_MAX+1]" array at the end, the
actual size of the structure ends up being not very well defined:
because the struct isn't marked 'packed', doing a "sizeof()" on it will
align the size of the struct up to the biggest alignment of the members
it has.
And despite all the members being the same, the alignment of them is
different: a "__u64" has 4-byte alignment on x86-32, but native 8-byte
alignment on x86-64. And while 'NAME_MAX+1' ends up being a nice round
number (256), the name[] array starts out a 4-byte aligned.
End result: the "packed" size of the structure is 300 bytes: 4-byte, but
not 8-byte aligned.
As a result, despite all the fields being in the same place on all
architectures, sizeof() will round up that size to 304 bytes on
architectures that have 8-byte alignment for u64.
Note that this is *not* a problem for 32-bit compat mode on POWER, since
there __u64 is 8-byte aligned even in 32-bit mode. But on x86, 32-bit
and 64-bit alignment is different for 64-bit entities, and as a result
the structure that has exactly the same layout has different sizes.
So on x86-64, but no other architecture, we will just subtract 4 from
the size of the structure when running in a compat task. That way we
will write the properly sized packet that user mode expects.
Not pretty. Sadly, this very subtle, and unnecessary, size difference
has been encoded in user space that wants to read packets of *exactly*
the right size, and will refuse to touch anything else.
Reported-and-tested-by: Thomas Meyer <thomas@m3y3r.de> Signed-off-by: Ian Kent <raven@themaw.net> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Linus Torvalds [Sat, 25 Feb 2012 00:08:51 +0000 (16:08 -0800)]
Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6
SCSI fixes on 20120224:
"This is a set of assorted bug fixes for power management, mpt2sas,
ipr, the rdac device handler and quite a big chunk for qla2xxx (plus a
use after free of scsi_host in scsi_scan.c). "
* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6:
[SCSI] scsi_dh_rdac: Fix for unbalanced reference count
[SCSI] scsi_pm: Fix bug in the SCSI power management handler
[SCSI] scsi_scan: Fix 'Poison overwritten' warning caused by using freed 'shost'
[SCSI] qla2xxx: Update version number to 8.03.07.13-k.
[SCSI] qla2xxx: Proper detection of firmware abort error code for ISP82xx.
[SCSI] qla2xxx: Remove resetting memory during device initialization for ISP82xx.
[SCSI] qla2xxx: Complete mailbox command timedout to avoid initialization failures during next reset cycle.
[SCSI] qla2xxx: Remove check for null fcport from host reset handler.
[SCSI] qla2xxx: Correct out of bounds read of ISP2200 mailbox registers.
[SCSI] qla2xxx: Remove errant clearing of MBX_INTERRUPT flag during CT-IOCB processing.
[SCSI] qla2xxx: Clear options-flags while issuing stop-firmware mbx command.
[SCSI] qla2xxx: Add an "is reset active" helper.
[SCSI] qla2xxx: Add check for null fcport references in qla2xxx_queuecommand.
[SCSI] qla2xxx: Propagate up abort failures.
[SCSI] isci: Fix NULL ptr dereference when no firmware is being loaded
[SCSI] ipr: fix eeh recovery for 64-bit adapters
[SCSI] mpt2sas: Fix mismatch in mpt2sas_base_hard_reset_handler() mutex lock-unlock
Linus Torvalds [Fri, 24 Feb 2012 20:32:51 +0000 (12:32 -0800)]
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media:
[media] hdpvr: update picture controls to support firmware versions > 0.15
[media] wl128x: fix build errors when GPIOLIB is not enabled
[media] hdpvr: fix race conditon during start of streaming
[media] omap3isp: Fix crash caused by subdevs now having a pointer to devnodes
[media] imon: don't wedge hardware after early callbacks
Oleg Nesterov [Fri, 24 Feb 2012 19:07:29 +0000 (20:07 +0100)]
epoll: ep_unregister_pollwait() can use the freed pwq->whead
signalfd_cleanup() ensures that ->signalfd_wqh is not used, but
this is not enough. eppoll_entry->whead still points to the memory
we are going to free, ep_unregister_pollwait()->remove_wait_queue()
is obviously unsafe.
Change ep_poll_callback(POLLFREE) to set eppoll_entry->whead = NULL,
change ep_unregister_pollwait() to check pwq->whead != NULL under
rcu_read_lock() before remove_wait_queue(). We add the new helper,
ep_remove_wait_queue(), for this.
This works because sighand_cachep is SLAB_DESTROY_BY_RCU and because
->signalfd_wqh is initialized in sighand_ctor(), not in copy_sighand.
ep_unregister_pollwait()->remove_wait_queue() can play with already
freed and potentially reused ->sighand, but this is fine. This memory
must have the valid ->signalfd_wqh until rcu_read_unlock().
Oleg Nesterov [Fri, 24 Feb 2012 19:07:11 +0000 (20:07 +0100)]
epoll: introduce POLLFREE to flush ->signalfd_wqh before kfree()
This patch is intentionally incomplete to simplify the review.
It ignores ep_unregister_pollwait() which plays with the same wqh.
See the next change.
epoll assumes that the EPOLL_CTL_ADD'ed file controls everything
f_op->poll() needs. In particular it assumes that the wait queue
can't go away until eventpoll_release(). This is not true in case
of signalfd, the task which does EPOLL_CTL_ADD uses its ->sighand
which is not connected to the file.
This patch adds the special event, POLLFREE, currently only for
epoll. It expects that init_poll_funcptr()'ed hook should do the
necessary cleanup. Perhaps it should be defined as EPOLLFREE in
eventpoll.
__cleanup_sighand() is changed to do wake_up_poll(POLLFREE) if
->signalfd_wqh is not empty, we add the new signalfd_cleanup()
helper.
ep_poll_callback(POLLFREE) simply does list_del_init(task_list).
This make this poll entry inconsistent, but we don't care. If you
share epoll fd which contains our sigfd with another process you
should blame yourself. signalfd is "really special". I simply do
not know how we can define the "right" semantics if it used with
epoll.
The main problem is, epoll calls signalfd_poll() once to establish
the connection with the wait queue, after that signalfd_poll(NULL)
returns the different/inconsistent results depending on who does
EPOLL_CTL_MOD/signalfd_read/etc. IOW: apart from sigmask, signalfd
has nothing to do with the file, it works with the current thread.
In short: this patch is the hack which tries to fix the symptoms.
It also assumes that nobody can take tasklist_lock under epoll
locks, this seems to be true.
Note:
- we do not have wake_up_all_poll() but wake_up_poll()
is fine, poll/epoll doesn't use WQ_FLAG_EXCLUSIVE.
- signalfd_cleanup() uses POLLHUP along with POLLFREE,
we need a couple of simple changes in eventpoll.c to
make sure it can't be "lost".
Linus Torvalds [Fri, 24 Feb 2012 17:02:53 +0000 (09:02 -0800)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs
Quoth Chris:
"This is later than I wanted because I got backed up running through
btrfs bugs from the Oracle QA teams. But they are all bug fixes that
we've queued and tested since rc1.
Nothing in particular stands out, this just reflects bug fixing and QA
done in parallel by all the btrfs developers. The most user visible
of these is:
Btrfs: clear the extent uptodate bits during parent transid failures
Because that helps deal with out of date drives (say an iscsi disk
that has gone away and come back). The old code wasn't always
properly retrying the other mirror for this type of failure."
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs: (24 commits)
Btrfs: fix compiler warnings on 32 bit systems
Btrfs: increase the global block reserve estimates
Btrfs: clear the extent uptodate bits during parent transid failures
Btrfs: add extra sanity checks on the path names in btrfs_mksubvol
Btrfs: make sure we update latest_bdev
Btrfs: improve error handling for btrfs_insert_dir_item callers
Btrfs: be less strict on finding next node in clear_extent_bit
Btrfs: fix a bug on overcommit stuff
Btrfs: kick out redundant stuff in convert_extent_bit
Btrfs: skip states when they does not contain bits to clear
Btrfs: check return value of lookup_extent_mapping() correctly
Btrfs: fix deadlock on page lock when doing auto-defragment
Btrfs: fix return value check of extent_io_ops
btrfs: honor umask when creating subvol root
btrfs: silence warning in raid array setup
btrfs: fix structs where bitfields and spinlock/atomic share 8B word
btrfs: delalloc for page dirtied out-of-band in fixup worker
Btrfs: fix memory leak in load_free_space_cache()
btrfs: don't check DUP chunks twice
Btrfs: fix trim 0 bytes after a device delete
...
Linus Torvalds [Fri, 24 Feb 2012 17:01:46 +0000 (09:01 -0800)]
Merge tag 'for-linus' of git://linux-c6x.org/git/projects/linux-c6x-upstreaming
This is the arch/c6x part of commit 7c43185138cf ("Kbuild: Use dtc's -d
(dependency) option") which was dropped because c6x had not yet been
merged at the time.
* tag 'for-linus' of git://linux-c6x.org/git/projects/linux-c6x-upstreaming:
Kbuild: Use dtc's -d (dependency) option
Kyle McMartin [Fri, 24 Feb 2012 15:36:16 +0000 (10:36 -0500)]
MAINTAINERS: drop me from PA-RISC maintenance
I don't even live in the same country as any of my PA-RISC hardware
these days, so the odds of me touching the code are pretty low.
(Also re-order things to ensure jejb gets CC'd since he's been the
primary maintainer for the last few years.)
David Howells [Thu, 23 Feb 2012 13:50:35 +0000 (13:50 +0000)]
NOMMU: Lock i_mmap_mutex for access to the VMA prio list
Lock i_mmap_mutex for access to the VMA prio list to prevent concurrent
access. Currently, certain parts of the mmap handling are protected by
the region mutex, but not all.
Reported-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Al Viro <viro@zeniv.linux.org.uk>
cc: stable@vger.kernel.org Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Linus Torvalds [Fri, 24 Feb 2012 16:56:51 +0000 (08:56 -0800)]
Merge tag 'sh-for-linus' of git://github.com/pmundt/linux-sh
SuperH fixes for 3.3-rc5
* tag 'sh-for-linus' of git://github.com/pmundt/linux-sh:
sh: Fix sh2a build error for CONFIG_CACHE_WRITETHROUGH
sh: modify a resource of sh_eth_giga1_resources in board-sh7757lcr
arch/sh: remove references to cpu_*_map.
sh: Fix typo in pci-sh7780.c
sh: add platform_device for SPI1 in setup-sh7757
sh: modify resource for SPI0 in setup-sh7757
sh: se7724: fix compile breakage
sh: clkfwk: bugfix: use clk_reparent() for div6 clocks
sh: clock-sh7724: fixup sh_fsi clock settings
sh: sh7757lcr: update to the new MMCIF DMA configuration
sh: fix the sh_mmcif_plat_data in board-sh7757lcr
video: pvr2fb: Fix up spurious section mismatch warnings.
sh: Defer to asm-generic/device.h.
Anton Vorontsov [Fri, 24 Feb 2012 01:14:46 +0000 (05:14 +0400)]
mm: memcg: Correct unregistring of events attached to the same eventfd
There is an issue when memcg unregisters events that were attached to
the same eventfd:
- On the first call mem_cgroup_usage_unregister_event() removes all
events attached to a given eventfd, and if there were no events left,
thresholds->primary would become NULL;
- Since there were several events registered, cgroups core will call
mem_cgroup_usage_unregister_event() again, but now kernel will oops,
as the function doesn't expect that threshold->primary may be NULL.
That's a good question whether mem_cgroup_usage_unregister_event()
should actually remove all events in one go, but nowadays it can't
do any better as cftype->unregister_event callback doesn't pass
any private event-associated cookie. So, let's fix the issue by
simply checking for threshold->primary.
FWIW, w/o the patch the following oops may be observed:
Rusty Russell [Wed, 15 Feb 2012 04:58:04 +0000 (15:28 +1030)]
arch/sh: remove references to cpu_*_map.
This has been obsolescent for a while; time for the final push.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Cc: Paul Mundt <lethal@linux-sh.org> Cc: linux-sh@vger.kernel.org Signed-off-by: Paul Mundt <lethal@linux-sh.org>
With kernel 3.1, Christoph removed i_alloc_sem and replaced it with
calls (namely inode_dio_wait() and inode_dio_done()) which are
EXPORT_SYMBOL_GPL() thus they cannot be used by non-GPL file systems and
further inode_dio_wait() was pushed from notify_change() into the file
system ->setattr() method but no non-GPL file system can make this call.
That means non-GPL file systems cannot exist any more unless they do not
use any VFS functionality related to reading/writing as far as I can
tell or at least as long as they want to implement direct i/o.
Both Linus and Al (and others) have said on LKML that this breakage of
the VFS API should not have happened and that the change was simply
missed as it was not documented in the change logs of the patches that
did those changes.
This patch changes the two function exports in question to be
EXPORT_SYMBOL() thus restoring the VFS API as it used to be - accessible
for all modules.
Christoph, who introduced the two functions and exported them GPL-only
is CC-ed on this patch to give him the opportunity to object to the
symbols being changed in this manner if he did indeed intend them to be
GPL-only and does not want them to become available to all modules.
Signed-off-by: Anton Altaparmakov <anton@tuxera.com> CC: Christoph Hellwig <hch@infradead.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>