pandora-kernel.git
12 years agoMerge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
Linus Torvalds [Fri, 27 May 2011 17:14:22 +0000 (10:14 -0700)]
Merge branch 'v4l_for_linus' of git://git./linux/kernel/git/mchehab/linux-2.6

* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6:
  [media] v1.88 DM04/QQBOX Move remote to use rc_core dvb-usb-remote
  [media] Add missing include guard to header file
  [media] Inlined functions should be static
  [media] Remove invalid parameter description
  [media] cpia2: fix warning about invalid trigraph sequence
  [media] s5p-csis: Add missing dependency on PLAT_S5P
  [media] gspca/kinect: wrap gspca_debug with GSPCA_DEBUG
  [media] fintek-cir: new driver for Fintek LPC SuperIO CIR function
  [media] uvcvideo: Connect video devices to media entities
  [media] uvcvideo: Register subdevices for each entity
  [media] uvcvideo: Register a v4l2_device
  [media] add V4L2-PIX-FMT-SRGGB12 & friends to docbook
  [media] Documentation/DocBook: Rename media fops xml files
  [media] Media DocBook: fix validation errors
  [media] wl12xx: g_volatile_ctrl fix: wrong field set
  [media] fix kconfig dependency warning for VIDEO_TIMBERDALE
  [media] dm1105: GPIO handling added, I2C on GPIO added, LNB control through GPIO reworked
  [media] Add support for M-5MOLS 8 Mega Pixel camera ISP

12 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lrg/voltage-2.6
Linus Torvalds [Fri, 27 May 2011 17:13:01 +0000 (10:13 -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: (42 commits)
  regulator: Fix _regulator_get_voltage if get_voltage callback is NULL
  USB: TWL6025 allow different regulator name
  REGULATOR: TWL6025: add support to twl-regulator
  regulator: twl6030: do not write to _GRP for regulator disable
  regulator: twl6030: do not write to _GRP for regulator enable
  TPS65911: Comparator: Add comparator driver
  TPS65911: Add support for added GPIO lines
  GPIO: TPS65910: Move driver to drivers/gpio/
  TPS65911: Add new irq definitions
  regulator: tps65911: Add new chip version
  MFD: TPS65910: Add support for TPS65911 device
  regulator: Fix off-by-one value range checking for mc13xxx_regulator_get_voltage
  regulator: mc13892: Fix voltage unit in test case.
  regulator: Remove MAX8997_REG_BUCK1DVS/MAX8997_REG_BUCK2DVS/MAX8997_REG_BUCK5DVS macros
  mfd: Fix off-by-one value range checking for tps65910_i2c_write
  regulator: Only apply voltage constraints from consumers that set them
  regulator: If we can't configure optimum mode we're always in the best one
  regulator: max8997: remove useless code
  regulator: Fix memory leak in max8998_pmic_probe failure path
  regulator: Fix desc_id for tps65023/6507x/65910
  ...

12 years agoMerge git://git.infradead.org/battery-2.6
Linus Torvalds [Fri, 27 May 2011 17:12:35 +0000 (10:12 -0700)]
Merge git://git.infradead.org/battery-2.6

* git://git.infradead.org/battery-2.6:
  PXA: Use dev_pm_ops in z2_battery
  ds2760_battery: Fix rated capacity of the hx4700 1800mAh battery
  ds2760_battery: Fix indexing of the 4 active full EEPROM registers
  power: Make test_power driver more dynamic.
  bq27x00_battery: Name of cycle count property
  max8903_charger: Add GENERIC_HARDIRQS as a dependency (fixes S390 build)
  ARM: RX-51: Enable isp1704 power on/off
  isp1704_charger: Allow board specific powering routine
  gpio-charger: Add gpio_charger_resume
  power_supply: Add driver for MAX8903 charger

12 years agoMerge branch 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groec...
Linus Torvalds [Fri, 27 May 2011 17:11:42 +0000 (10:11 -0700)]
Merge branch 'hwmon-for-linus' of git://git./linux/kernel/git/groeck/staging

* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/staging:
  hwmon: (coretemp) Fix section mismatch
  hwmon: (pmbus) Initialize sysfs attributes
  hwmon: (coretemp) Update comments describing the handling of HT CPUs
  hwmon: (coretemp) Initialize sysfs attributes

12 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
Linus Torvalds [Fri, 27 May 2011 17:10:51 +0000 (10:10 -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: (26 commits)
  ASoC: Fix power down for widgetless per-card DAPM context case
  ASoC: wm1250-ev1: Define "WM1250 Output" with SND_SOC_DAPM_OUTPUT
  ASoC: Remove duplicate linux/delay.h inclusion.
  ASoC: sam9g20_wm8731: use the proper SYSCKL value
  ASoC: wm8731: fix wm8731_check_osc() connected condition
  ALSA: hda - Reorganize controller quriks with bit flags
  ALSA: hda - Use snd_printd() in snd_hda_parse_pin_def_config()
  ALSA: core: remove unused variables.
  ALSA: HDA: Increase MAX_HDMI_PINS
  ALSA: PCM - Don't check DMA time-out too shortly
  MAINTAINERS: add FireWire audio maintainer
  ALSA: usb-audio: more control quirks for M-Audio FastTrack devices
  ALSA: usb-audio: add new quirk type QUIRK_AUDIO_STANDARD_MIXER
  ALSA: usb-audio: export snd_usb_feature_unit_ctl
  ALSA: usb-audio: rework add_control_to_empty()
  ALSA: usb-audio: move assignment of chip->ctrl_intf
  ALSA: hda - Use model=auto for Lenovo G555
  ALSA: HDA: Unify HDMI hotplug handling.
  ALSA: hda - Force AD1988_6STACK_DIG for Asus M3N-HT Deluxe
  ASoC: core - remove superfluous new line.
  ...

12 years agoregulator: Fix _regulator_get_voltage if get_voltage callback is NULL
Axel Lin [Mon, 23 May 2011 12:08:10 +0000 (20:08 +0800)]
regulator: Fix _regulator_get_voltage if get_voltage callback is NULL

In the case of get_voltage callback is NULL, current implementation in
_regulator_get_voltage will return -EINVAL.

Also returns proper error if ret is negative value.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoUSB: TWL6025 allow different regulator name
Graeme Gregory [Sun, 22 May 2011 20:21:24 +0000 (21:21 +0100)]
USB: TWL6025 allow different regulator name

The twl6025 uses a different regulator for USB than the 6030 so select
the correct regulator name depending on the subclass of device.

Since V1

Use features passed via platform data instead of global variable.

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoREGULATOR: TWL6025: add support to twl-regulator
Graeme Gregory [Sun, 22 May 2011 20:21:23 +0000 (21:21 +0100)]
REGULATOR: TWL6025: add support to twl-regulator

Adding support for the twl6025. Major difference in the twl6025 is the
group functionality has been removed from the chip so this affects how
regulators are enabled and disabled.

The names of the regulators also changed.

The DCDCs of the 6025 are software controllable as well.

Since V1

Use the features variable passed via platform data instead of calling
global function.

Change the very switch like if statements to be a more readable
switch statement.

Since V2

twl6025 doesn't use remap so remove it from the macros.

Since V3

enable/disable functions for 4030/6030 were seperated upstream so rebase
on top of this. Change DCDC reference to SMPS as this is used in TRM.
Change list_voltage slightly to have less code.

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoregulator: twl6030: do not write to _GRP for regulator disable
Balaji T K [Fri, 20 May 2011 13:33:52 +0000 (19:03 +0530)]
regulator: twl6030: do not write to _GRP for regulator disable

TWL6030: regulator is disabled via VREG_STATE
TWL4030: regulator is disabled via VREG_GRP
Since there is nothing common, split twlreg_enable similar to other regulator_ops

Signed-off-by: Balaji T K <balajitk@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoregulator: twl6030: do not write to _GRP for regulator enable
Balaji T K [Fri, 20 May 2011 13:33:51 +0000 (19:03 +0530)]
regulator: twl6030: do not write to _GRP for regulator enable

TWL6030: regulator is enabled via VREG_STATE
TWL4030: regulator is enabled via VREG_GRP
Since there is nothing common, split twlreg_enable similar to other regulator_ops

Signed-off-by: Balaji T K <balajitk@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoTPS65911: Comparator: Add comparator driver
Jorge Eduardo Candelaria [Mon, 16 May 2011 23:35:48 +0000 (18:35 -0500)]
TPS65911: Comparator: Add comparator driver

This driver adds functionality to the tps65911 chip driver.

Two of the comparators are configurable by software and measures
VCCS voltage to detect high or low voltage scenarios.

Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoTPS65911: Add support for added GPIO lines
Jorge Eduardo Candelaria [Mon, 16 May 2011 23:35:42 +0000 (18:35 -0500)]
TPS65911: Add support for added GPIO lines

GPIO 1 to 8 are added for TPS65911 chip version. The gpio driver
now handles more than one gpio lines. Subsequent versions of the
chip family can add new GPIO lines with minimal driver changes.

Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoGPIO: TPS65910: Move driver to drivers/gpio/
Jorge Eduardo Candelaria [Mon, 16 May 2011 23:35:37 +0000 (18:35 -0500)]
GPIO: TPS65910: Move driver to drivers/gpio/

The GPIO driver should reside in drivers/gpio/ for better
organization.

Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoTPS65911: Add new irq definitions
Jorge Eduardo Candelaria [Mon, 16 May 2011 23:35:07 +0000 (18:35 -0500)]
TPS65911: Add new irq definitions

TPS65911 adds new interrupt sources, as well as two new registers
to handle them, one for interrupt status and one for interrupt
masking. The added irqs are:

-VMBCH2 - Low and High threshold
-GPIO1-8 - Rising and falling edge detection
-WTCHDG - Watchdog interrupt
-PWRDN - PWRDN reset interrupt

The code should handle these new registers only when the chip
version is TPS65911.

Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoregulator: tps65911: Add new chip version
Jorge Eduardo Candelaria [Mon, 16 May 2011 23:35:03 +0000 (18:35 -0500)]
regulator: tps65911: Add new chip version

The tps65911 chip introduces new features, including changes in
the regulator module.

- VDD1 and VDD2 remain unchanged.
- VDD3 is now named VDDCTRL and has a wider voltage range.
- LDOs are now named LDO1...8 and voltage ranges are sequential,
  making LDOs easier to handle.

Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoMFD: TPS65910: Add support for TPS65911 device
Jorge Eduardo Candelaria [Mon, 16 May 2011 23:34:59 +0000 (18:34 -0500)]
MFD: TPS65910: Add support for TPS65911 device

The TPS65911 is the next generation of the TPS65910 family of
PMIC chips. It adds a few features:

- Watchdog Timer
- PWM & LED generators
- Comparators for system control status

It also adds a set of Interrupts and GPIOs, among other things.

The driver exports a function to identify between different
versions of the tps65910 family, allowing other modules to
identify the capabilities of the current chip.

Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoregulator: Fix off-by-one value range checking for mc13xxx_regulator_get_voltage
Axel Lin [Wed, 18 May 2011 12:56:45 +0000 (20:56 +0800)]
regulator: Fix off-by-one value range checking for mc13xxx_regulator_get_voltage

We use val as array index,
thus the valid value rangae for val should be 0 .. n_voltages-1.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoregulator: mc13892: Fix voltage unit in test case.
Fabio Estevam [Mon, 16 May 2011 13:54:27 +0000 (10:54 -0300)]
regulator: mc13892: Fix voltage unit in test case.

Voltage values should be expressed in microvolts, not in milivolts.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Signed-off-by: Ranjani Vaidyanathan <ra5478@freescale.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoregulator: Remove MAX8997_REG_BUCK1DVS/MAX8997_REG_BUCK2DVS/MAX8997_REG_BUCK5DVS...
Axel Lin [Mon, 16 May 2011 10:20:34 +0000 (18:20 +0800)]
regulator: Remove MAX8997_REG_BUCK1DVS/MAX8997_REG_BUCK2DVS/MAX8997_REG_BUCK5DVS macros

In current implementation, the original macro implementation assumes the caller
pass the parameter starting from 1 (to match the register names in datasheet).
Thus we have unneeded plus one then minus one operations
when using MAX8997_REG_BUCK1DVS/MAX8997_REG_BUCK2DVS/MAX8997_REG_BUCK5DVS macros.

This patch removes these macros to avoid unneeded plus one then minus one operations
without reducing readability.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agomfd: Fix off-by-one value range checking for tps65910_i2c_write
Axel Lin [Mon, 16 May 2011 14:19:01 +0000 (22:19 +0800)]
mfd: Fix off-by-one value range checking for tps65910_i2c_write

If bytes == (TPS65910_MAX_REGISTER + 1), we have a buffer overflow when
doing memcpy(&msg[1], src, bytes).

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoregulator: Only apply voltage constraints from consumers that set them
Mark Brown [Sat, 14 May 2011 20:42:34 +0000 (13:42 -0700)]
regulator: Only apply voltage constraints from consumers that set them

When applying the set_voltage() requests from consumers skip over those
consumers that haven't set anything, otherwise we'll come out with a
maximum voltage of zero.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoregulator: If we can't configure optimum mode we're always in the best one
Mark Brown [Sat, 14 May 2011 18:19:45 +0000 (11:19 -0700)]
regulator: If we can't configure optimum mode we're always in the best one

If either a regulator driver can't tell us what the optimum mode is (or
doesn't have modes in the first place) or the system doesn't allow DRMS
changes then it's more helpful for users to just say that we're in the
optimal mode, even if it's from a selection of one.

Still report errors if the process of picking and setting a mode changes as
this may indicate that we're stuck in a low power mode and unable to deliver
a higher current that the consumer just asked for.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoregulator: max8997: remove useless code
Jonghwan Choi [Thu, 12 May 2011 02:37:48 +0000 (11:37 +0900)]
regulator: max8997: remove useless code

fix unreachable code.

Signed-off-by: Jonghwan Choi <jhbird.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoregulator: Fix memory leak in max8998_pmic_probe failure path
Axel Lin [Fri, 13 May 2011 06:54:06 +0000 (14:54 +0800)]
regulator: Fix memory leak in max8998_pmic_probe failure path

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Kyungmin Park <kyungmin.park@samsung.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoregulator: Fix desc_id for tps65023/6507x/65910
Axel Lin [Thu, 12 May 2011 05:47:50 +0000 (13:47 +0800)]
regulator: Fix desc_id for tps65023/6507x/65910

The desc_id variable should not be a static variable.

The rest of the code assumes the desc_id must less than TPSxxxxx_NUM_REGULATOR.
If we set desc_id to be a static variable, checking the return value of
rdev_get_id() may return error.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Cc: Anuj Aggarwal <anuj.aggarwal@ti.com>
Cc: Graeme Gregory <gg@slimlogic.co.uk>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agolinux-next: build failure after merge of the voltage tree
Jorge Eduardo Candelaria [Wed, 11 May 2011 06:43:02 +0000 (01:43 -0500)]
linux-next: build failure after merge of the voltage tree

On May 10, 2011, at 9:27 PM, Stephen Rothwell wrote:

> Hi Jorge,
>
> On Tue, 10 May 2011 12:30:36 -0500 Jorge Eduardo Candelaria <jedu@slimlogic.co.uk> wrote:
>>
>> On May 10, 2011, at 3:38 AM, Liam Girdwood wrote:
>>
>>> On Tue, 2011-05-10 at 12:44 +1000, Stephen Rothwell wrote:
>>>> Hi Liam,
>>>>
>>>> After merging the voltage tree, today's linux-next build (x86_64
>>>> allmodconfig) failed like this:
>>>>
>>>> ERROR: "tps65910_gpio_init" [drivers/mfd/tps65910.ko] undefined!
>>>> ERROR: "tps65910_irq_init" [drivers/mfd/tps65910.ko] undefined!
>>>> ERROR: "irq_modify_status" [drivers/mfd/tps65910-irq.ko] undefined!
>>>> ERROR: "irq_set_chip_and_handler_name" [drivers/mfd/tps65910-irq.ko] undefined!
>>>> ERROR: "handle_edge_irq" [drivers/mfd/tps65910-irq.ko] undefined!
>>>>
>>>> I have used the voltage tree from next-20110509 for today.
>>>
>>> Jorge, could you send a fix for this today.
>>
>> The following patch should solve this:
>>
>> From: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
>> MFD: Fix TPS65910 build
>>
>> Support for tps65910 as a module is not available. The driver can
>> only be compiled as built-in. OTOH, the regulator driver can still
>> be built as module without breaking the compilation.
>>
>> Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
>
> Today (even with the above patch included) I got these errors from the
> x86_64 allmodconfig build:
>
> tps65910.c:(.text+0xf4140): undefined reference to `i2c_master_send'
> drivers/built-in.o: In function `tps65910_i2c_read':
> tps65910.c:(.text+0xf41d2): undefined reference to `i2c_transfer'
> drivers/built-in.o: In function `tps65910_i2c_init':
> tps65910.c:(.init.text+0xcb83): undefined reference to `i2c_register_driver'
> drivers/built-in.o: In function `tps65910_i2c_exit':
> tps65910.c:(.exit.text+0x6e0): undefined reference to `i2c_del_driver'
>
> I have used the voltage tree from next-20110509 again today.

Following patch should fix the dependency problems. Please review:

From: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
[PATCH] MFD: TPS65910: Fix I2C dependency

TPS65910 driver can only be compiled built-in, so the I2C driver
should be as well.

Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoRevert "regulator: Move VCOINCELL to be the last element of mc13892_regulators array"
Axel Lin [Tue, 10 May 2011 11:10:36 +0000 (19:10 +0800)]
Revert "regulator: Move VCOINCELL to be the last element of mc13892_regulators array"

I check this patch again and found this actually is not a bug
because MC13xxx_DEFINE explictly defines the order of each entry in the array.

Thus revert the patch.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoregulator: Remove some unused variables from wm831x DCDCs
Mark Brown [Tue, 10 May 2011 13:52:57 +0000 (15:52 +0200)]
regulator: Remove some unused variables from wm831x DCDCs

These became unused with the IRQ removal patch, I'm fairly sure that a
patch was sent earlier by someone else but it doesn't seem to have been
applied and I don't have a copy sitting around any more.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agolinux-next: build failure after merge of the voltage tree
Jorge Eduardo Candelaria [Tue, 10 May 2011 17:30:36 +0000 (12:30 -0500)]
linux-next: build failure after merge of the voltage tree

On May 10, 2011, at 3:38 AM, Liam Girdwood wrote:

> On Tue, 2011-05-10 at 12:44 +1000, Stephen Rothwell wrote:
>> Hi Liam,
>>
>> After merging the voltage tree, today's linux-next build (x86_64
>> allmodconfig) failed like this:
>>
>> ERROR: "tps65910_gpio_init" [drivers/mfd/tps65910.ko] undefined!
>> ERROR: "tps65910_irq_init" [drivers/mfd/tps65910.ko] undefined!
>> ERROR: "irq_modify_status" [drivers/mfd/tps65910-irq.ko] undefined!
>> ERROR: "irq_set_chip_and_handler_name" [drivers/mfd/tps65910-irq.ko] undefined!
>> ERROR: "handle_edge_irq" [drivers/mfd/tps65910-irq.ko] undefined!
>>
>> I have used the voltage tree from next-20110509 for today.
>
> Jorge, could you send a fix for this today.
>
> Thanks
>
> Liam
>

The following patch should solve this:

From: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
MFD: Fix TPS65910 build

Support for tps65910 as a module is not available. The driver can
only be compiled as built-in. OTOH, the regulator driver can still
be built as module without breaking the compilation.

Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoTPS65910: Add tps65910 regulator driver
Graeme Gregory [Mon, 2 May 2011 21:20:08 +0000 (16:20 -0500)]
TPS65910: Add tps65910 regulator driver

The regulator module consists of 3 DCDCs and 8 LDOs. The output
voltages are configurable and are meant to supply power to the
main processor and other components

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoTPS65910: IRQ: Add interrupt controller
Graeme Gregory [Mon, 2 May 2011 21:20:04 +0000 (16:20 -0500)]
TPS65910: IRQ: Add interrupt controller

This module controls the interrupt handling for the tps chip. The
interrupt sources are the following:

- GPIO falling/rising edge detection
- Battery voltage below/above threshold
- PWRON signal
- PWRHOLD signal
- Temperature detection
- RTC alarm and periodic event

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoTPS65910: GPIO: Add GPIO driver
Graeme Gregory [Mon, 2 May 2011 21:19:52 +0000 (16:19 -0500)]
TPS65910: GPIO: Add GPIO driver

TPS65910 has one configurable GPIO that can be used for several
purposes. Subsequent versions of the TPS chip support more than
one GPIO.

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Acked-by: Grant Likely <grant.likely@secretlab.ca>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoMFD: TPS65910: Add new mfd device for TPS65910
Graeme Gregory [Mon, 2 May 2011 21:19:46 +0000 (16:19 -0500)]
MFD: TPS65910: Add new mfd device for TPS65910

The TPS65910 chip is a power management IC for multimedia and handheld
devices. It contains the following components:

- Regulators
- GPIO controller
- RTC

The tps65910 core driver is registered as a platform driver and provides
communication through I2C with the host device for the different
components.

Signed-off-by: Graeme Gregory <gg@slimlogic.co.uk>
Signed-off-by: Jorge Eduardo Candelaria <jedu@slimlogic.co.uk>
Acked-by: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoregulator: Use mc13xxx_reg_write instead of mc13xxx_reg_rmw in mc13892_sw_regulator_s...
Axel Lin [Mon, 9 May 2011 09:49:40 +0000 (17:49 +0800)]
regulator: Use mc13xxx_reg_write instead of mc13xxx_reg_rmw in mc13892_sw_regulator_set_voltage

Currently, we call mc13xxx_reg_read and mc13xxx_reg_rmw for the same register.
This can be converted to simply a mc13xxx_reg_read and a mc13xxx_reg_write,
thus save a redundant register read.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoregulator: Support voltage offsets to compensate for drops in system
Mark Brown [Sun, 8 May 2011 21:13:37 +0000 (22:13 +0100)]
regulator: Support voltage offsets to compensate for drops in system

Some systems, particularly physically large systems used for early
prototyping, may experience substantial voltage drops between the regulator
and the consumers as a result of long traces in the system. With these
systems voltages may need to be set higher than requested in order to
ensure reliable system operation.

Allow systems to work around such hardware issues by allowing constraints
to supply an offset to be applied to any requested and reported voltages.
This is not ideal, especially since the voltage drop may be load dependant,
but is sufficient for most affected systems, it is not expected to be used
in production hardware. The offset is applied after all constraint
processing so constraints should be specified in terms of consumer values
not physically configured values.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoregulator: Remove supply_regulator_dev from machine configuration
Mark Brown [Sun, 8 May 2011 21:30:18 +0000 (22:30 +0100)]
regulator: Remove supply_regulator_dev from machine configuration

supply_regulator_dev (using a struct pointer) has been deprecated in favour
of supply_regulator (using a regulator name) for quite a few releases
now with a warning generated if it is used and there are no current in tree
users so just remove the code.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoregulator: Move VCOINCELL to be the last element of mc13892_regulators array
Axel Lin [Thu, 5 May 2011 15:32:58 +0000 (23:32 +0800)]
regulator: Move VCOINCELL to be the last element of mc13892_regulators array

In include/linux/mfd/mc13892.h, we define MC13892_VCOINCELL as 23.
Thus VCOINCELL should be defined as 23th element in mc13892_regulators array, not the first one.
This actually fixes an off-by-one bug while accessing mc13892_regulators array.

For example,
In mc13892_regulator_probe, we use MC13892_VCAM as array index of mc13892_regulators array.
        mc13892_regulators[MC13892_VCAM].desc.ops->set_mode
                = mc13892_vcam_set_mode;
Currently, it access mc13892_regulators[12] ,which is VAUDIO not VCAM.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoregulator: Factor out references to rdev in regulator_force_disable()
Mark Brown [Mon, 9 May 2011 09:41:02 +0000 (11:41 +0200)]
regulator: Factor out references to rdev in regulator_force_disable()

Don't go looking up the rdev pointer every time, just use a local variable
like everything else.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoregulator: Convert WM8400 to get_voltage_sel()
Mark Brown [Sun, 8 May 2011 21:19:09 +0000 (22:19 +0100)]
regulator: Convert WM8400 to get_voltage_sel()

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoregulator: Fix the argument of calling regulator_mode_constrain
Axel Lin [Fri, 1 Apr 2011 10:25:25 +0000 (18:25 +0800)]
regulator: Fix the argument of calling regulator_mode_constrain

The second parameter of regulator_mode_constrain takes a pointer.

This patch fixes below warning:
drivers/regulator/core.c: In function 'regulator_set_mode':
drivers/regulator/core.c:2014: warning: passing argument 2 of 'regulator_mode_constrain' makes pointer from integer without a cast
drivers/regulator/core.c:200: note: expected 'int *' but argument is of type 'unsigned int'

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@vega.(none)>
12 years agoregulator: twl: add twl6030 set_mode
Saquib Herman [Fri, 1 Apr 2011 04:52:46 +0000 (10:22 +0530)]
regulator: twl: add twl6030 set_mode

Current set_mode logic does not support 6030. The logic for 4030 is
not reusable for 6030 as the mode setting for 6030 now uses the new
CFG_STATE register. We hence rename the old get_status as being
specific to 4030.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Saquib Herman <saquib@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@vega.(none)>
12 years agoregulator: twl: add twl6030 get_status
Saquib Herman [Fri, 1 Apr 2011 04:52:45 +0000 (10:22 +0530)]
regulator: twl: add twl6030 get_status

Current get_status logic does not support 6030 get_status.
The logic for 4030 is not reusable for 6030 as the status
check for 6030 now depends on the new CFG_STATE register.
We hence rename the old get_status as being specific to
4030 and remove the redundant check for the same.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Saquib Herman <saquib@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@vega.(none)>
12 years agoregulator: twl: fix twl6030 regulator is_enabled
Saquib Herman [Fri, 1 Apr 2011 04:52:44 +0000 (10:22 +0530)]
regulator: twl: fix twl6030 regulator is_enabled

With TWL6030, it is not enough to ensure that the regulator is the
group of P1 group (CPU/Linux), but we need to check the state as far
as APP is concerned as well.

Split the current is_enabled to 6030 and 4030 specific ones. This
split impacts few macros and variables as well, but sets up the
stage for further fixes to set_mode and get_status in subsequent
patches.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Saquib Herman <saquib@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@vega.(none)>
12 years agoregulator: twl: remap has no meaning for 6030
Saquib Herman [Fri, 1 Apr 2011 04:52:43 +0000 (10:22 +0530)]
regulator: twl: remap has no meaning for 6030

TWL6030 does not have remap register. The current implementation
causes value of remap to be written to state register, accidentally
causing the regulators which are probed to be switched on as well.
This is wrong as regulators should be controllable based on calls
to enable/disable for TWL regulator framework. Further, the values
initialized make no sense as well. We hence remove this from the
initalizers and also write to remap register only if the TWL
is 4030.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Saquib Herman <saquib@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@vega.(none)>
12 years agoregulator: twl: fix twl6030 enable/disable
Saquib Herman [Fri, 1 Apr 2011 04:52:42 +0000 (10:22 +0530)]
regulator: twl: fix twl6030 enable/disable

TWL6030 requires an additional register write to CFG_STATE register
to explicitly state that the regulator is in a certain state. Merely
associating the regulator with the group is not enough. Add the
required register field definitions and fix the handling for
TWL6030 enable/disable.

Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Saquib Herman <saquib@ti.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@vega.(none)>
12 years agoregulator: Add missing platform_set_drvdata in tps6105x_regulator_probe
Axel Lin [Tue, 29 Mar 2011 09:54:58 +0000 (17:54 +0800)]
regulator: Add missing platform_set_drvdata in tps6105x_regulator_probe

Otherwise, calling platform_get_drvdata in tps6105x_regulator_remove
returns NULL.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agoregulator: When constraining modes fall back to higher power modes
Mark Brown [Tue, 29 Mar 2011 21:29:12 +0000 (06:29 +0900)]
regulator: When constraining modes fall back to higher power modes

If a mode requested by a consumer is not allowed by constraints
automatically fall back to a higher power mode if possible. This
ensures that consumers get at least the output they requested while
allowing machine drivers to transparently limit lower power modes
if required.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
12 years agohwmon: (coretemp) Fix section mismatch
Jean Delvare [Thu, 26 May 2011 10:01:54 +0000 (06:01 -0400)]
hwmon: (coretemp) Fix section mismatch

chk_ucode_version() is only called from coretemp_probe() which is
__devinit, so it can be marked __devinit too.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Durgadoss R <durgadoss.r@intel.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Guenter Roeck <guenter.roeck@ericsson.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
12 years agohwmon: (pmbus) Initialize sysfs attributes
Guenter Roeck [Tue, 24 May 2011 19:16:40 +0000 (12:16 -0700)]
hwmon: (pmbus) Initialize sysfs attributes

Initialize sysfs attrs before device_create_file() call to suppress
lockdep_init_map() warning:

WARNING: at kernel/lockdep.c:2701 lockdep_init_map+0x12d/0x140()

Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: stable@kernel.org # .39.x
12 years agohwmon: (coretemp) Update comments describing the handling of HT CPUs
Guenter Roeck [Mon, 23 May 2011 20:52:35 +0000 (13:52 -0700)]
hwmon: (coretemp) Update comments describing the handling of HT CPUs

Update comments describing the handling of HT CPUs based on review feedback.

Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: Durgadoss R <durgadoss.r@intel.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
12 years agohwmon: (coretemp) Initialize sysfs attributes
Sergey Senozhatsky [Tue, 24 May 2011 11:28:31 +0000 (07:28 -0400)]
hwmon: (coretemp) Initialize sysfs attributes

Initialize sysfs attrs before device_create_file() call to suppress lockdep_init_map()
warning:

[    3.653628] WARNING: at kernel/lockdep.c:2885 lockdep_init_map+0xea/0x43c()
[    3.653698] Modules linked in:
[    3.654835] Pid: 1, comm: swapper Not tainted 2.6.39-dbg-git8-05624-g46187f8 #576
[    3.656014] Call Trace:
[    3.657139]  [<ffffffff8103e4b4>] warn_slowpath_common+0x7e/0x96
[    3.658298]  [<ffffffff8103e4e1>] warn_slowpath_null+0x15/0x17
[    3.659460]  [<ffffffff8106d7b9>] lockdep_init_map+0xea/0x43c
[    3.660616]  [<ffffffff81163c1a>] sysfs_add_file_mode+0x5d/0xa8
[    3.661785]  [<ffffffff81163c71>] sysfs_add_file+0xc/0xe
[    3.662929]  [<ffffffff81163d26>] sysfs_create_file+0x23/0x25
[    3.664045]  [<ffffffff813724d1>] device_create_file+0x14/0x16
[    3.665172]  [<ffffffff81460ed4>] coretemp_probe+0xf9/0x185
[    3.666306]  [<ffffffff8137638e>] platform_drv_probe+0x12/0x14
[    3.667420]  [<ffffffff81375321>] driver_probe_device+0xb0/0x14b
[    3.668542]  [<ffffffff8137546d>] __device_attach+0x35/0x3a
[    3.669710]  [<ffffffff81375438>] ? __driver_attach+0x7c/0x7c
[    3.670816]  [<ffffffff8137426b>] bus_for_each_drv+0x54/0x88
[    3.671921]  [<ffffffff81375231>] device_attach+0x77/0x9b
[    3.673027]  [<ffffffff81374aef>] bus_probe_device+0x22/0x39
[    3.674137]  [<ffffffff81373235>] device_add+0x3c1/0x550
[    3.675249]  [<ffffffff81371ed9>] ? dev_set_name+0x3c/0x3e
[    3.676371]  [<ffffffff813769f3>] platform_device_add+0x10c/0x156
[    3.677491]  [<ffffffff8146af9c>] get_core_online+0xab/0x16e
[    3.678608]  [<ffffffff81ad8070>] coretemp_init+0x4b/0x80
[    3.679724]  [<ffffffff81ad8025>] ? hwmon_init+0xee/0xee
[    3.680853]  [<ffffffff8100020a>] do_one_initcall+0x7a/0x13c
[    3.681975]  [<ffffffff81aaac74>] kernel_init+0xe1/0x15b
[    3.683081]  [<ffffffff8147e4e4>] kernel_thread_helper+0x4/0x10
[    3.684174]  [<ffffffff8102d48c>] ? finish_task_switch+0x76/0xf0
[    3.685266]  [<ffffffff81477918>] ? retint_restore_args+0x13/0x13
[    3.686356]  [<ffffffff81aaab93>] ? start_kernel+0x3ee/0x3ee
[    3.687425]  [<ffffffff8147e4e0>] ? gs_change+0x13/0x13
[    3.688489] ---[ end trace 7392ad3e6a92ae39 ]---

Signed-off-by: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
12 years agoMerge branch 'fix/asoc' into for-linus
Takashi Iwai [Fri, 27 May 2011 06:03:03 +0000 (08:03 +0200)]
Merge branch 'fix/asoc' into for-linus

12 years agoMerge branch 'fix/misc' into for-linus
Takashi Iwai [Fri, 27 May 2011 06:02:59 +0000 (08:02 +0200)]
Merge branch 'fix/misc' into for-linus

12 years agoMerge branch 'upstream/tidy-xen-mmu-2.6.39' of git://git.kernel.org/pub/scm/linux...
Linus Torvalds [Fri, 27 May 2011 02:01:15 +0000 (19:01 -0700)]
Merge branch 'upstream/tidy-xen-mmu-2.6.39' of git://git./linux/kernel/git/jeremy/xen

* 'upstream/tidy-xen-mmu-2.6.39' of git://git.kernel.org/pub/scm/linux/kernel/git/jeremy/xen:
  xen: fix compile without CONFIG_XEN_DEBUG_FS
  Use arbitrary_virt_to_machine() to deal with ioremapped pud updates.
  Use arbitrary_virt_to_machine() to deal with ioremapped pmd updates.
  xen/mmu: remove all ad-hoc stats stuff
  xen: use normal virt_to_machine for ptes
  xen: make a pile of mmu pvop functions static
  vmalloc: remove vmalloc_sync_all() from alloc_vm_area()
  xen: condense everything onto xen_set_pte
  xen: use mmu_update for xen_set_pte_at()
  xen: drop all the special iomap pte paths.

12 years agoselinux: don't pass in NULL avd to avc_has_perm_noaudit
Linus Torvalds [Tue, 24 May 2011 20:48:51 +0000 (13:48 -0700)]
selinux: don't pass in NULL avd to avc_has_perm_noaudit

Right now security_get_user_sids() will pass in a NULL avd pointer to
avc_has_perm_noaudit(), which then forces that function to have a dummy
entry for that case and just generally test it.

Don't do it.  The normal callers all pass a real avd pointer, and this
helper function is incredibly hot.  So don't make avc_has_perm_noaudit()
do conditional stuff that isn't needed for the common case.

This also avoids some duplicated stack space.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-linus
Linus Torvalds [Fri, 27 May 2011 00:27:35 +0000 (17:27 -0700)]
Merge git://git./linux/kernel/git/pkl/squashfs-linus

* git://git.kernel.org/pub/scm/linux/kernel/git/pkl/squashfs-linus:
  Squashfs: update email address
  Squashfs: add extra sanity checks at mount time
  Squashfs: add sanity checks to fragment reading at mount time
  Squashfs: add sanity checks to lookup table reading at mount time
  Squashfs: add sanity checks to id reading at mount time
  Squashfs: add sanity checks to xattr reading at mount time
  Squashfs: reverse order of filesystem table reading
  Squashfs: move table allocation into squashfs_read_table()

12 years agom68knommu: use generic find_next_bit_le()
Akinobu Mita [Thu, 26 May 2011 23:26:13 +0000 (16:26 -0700)]
m68knommu: use generic find_next_bit_le()

The implementation of find_next_bit_le() on m68knommu is identical with
the generic implementation of find_next_bit_le().

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agos390: use asm-generic/bitops/le.h
Akinobu Mita [Thu, 26 May 2011 23:26:12 +0000 (16:26 -0700)]
s390: use asm-generic/bitops/le.h

The previous style change enables to use asm-generic/bitops/le.h on s390.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoarm: use asm-generic/bitops/le.h
Akinobu Mita [Thu, 26 May 2011 23:26:11 +0000 (16:26 -0700)]
arm: use asm-generic/bitops/le.h

The previous style change enables to use asm-generic/bitops/le.h on arm.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoarch: remove CONFIG_GENERIC_FIND_{NEXT_BIT,BIT_LE,LAST_BIT}
Akinobu Mita [Thu, 26 May 2011 23:26:10 +0000 (16:26 -0700)]
arch: remove CONFIG_GENERIC_FIND_{NEXT_BIT,BIT_LE,LAST_BIT}

By the previous style change, CONFIG_GENERIC_FIND_NEXT_BIT,
CONFIG_GENERIC_FIND_BIT_LE, and CONFIG_GENERIC_FIND_LAST_BIT are not used
to test for existence of find bitops anymore.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Greg Ungerer <gerg@uclinux.org>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Russell King <linux@arm.linux.org.uk>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agobitops: add #ifndef for each of find bitops
Akinobu Mita [Thu, 26 May 2011 23:26:09 +0000 (16:26 -0700)]
bitops: add #ifndef for each of find bitops

The style that we normally use in asm-generic is to test the macro itself
for existence, so in asm-generic, do:

#ifndef find_next_zero_bit_le
extern unsigned long find_next_zero_bit_le(const void *addr,
unsigned long size, unsigned long offset);
#endif

and in the architectures, write

static inline unsigned long find_next_zero_bit_le(const void *addr,
unsigned long size, unsigned long offset)
#define find_next_zero_bit_le find_next_zero_bit_le

This adds the #ifndef for each of the find bitops in the generic header
and source files.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoarch: add #define for each of optimized find bitops
Akinobu Mita [Thu, 26 May 2011 23:26:06 +0000 (16:26 -0700)]
arch: add #define for each of optimized find bitops

The style that we normally use in asm-generic is to test the macro itself
for existence, so in asm-generic, do:

#ifndef find_next_zero_bit_le
extern unsigned long find_next_zero_bit_le(const void *addr,
unsigned long size, unsigned long offset);
#endif

and in the architectures, write

static inline unsigned long find_next_zero_bit_le(const void *addr,
unsigned long size, unsigned long offset)
#define find_next_zero_bit_le find_next_zero_bit_le

This adds the #define for each of the optimized find bitops in the
architectures.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>
Acked-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Greg Ungerer <gerg@uclinux.org>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>
Acked-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agom68knommu: fix build error due to the lack of find_next_bit_le()
Akinobu Mita [Thu, 26 May 2011 23:26:05 +0000 (16:26 -0700)]
m68knommu: fix build error due to the lack of find_next_bit_le()

m68knommu can't build ext4, udf, and ocfs2 due to the lack of
find_next_bit_le().

This implements find_next_bit_le() on m68knommu by duplicating the generic
find_next_bit_le() in lib/find_next_bit.c.

Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Acked-by: Greg Ungerer <gerg@uclinux.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agow1: add Maxim/Dallas DS2780 Stand-Alone Fuel Gauge IC support
Clifton Barnes [Thu, 26 May 2011 23:26:04 +0000 (16:26 -0700)]
w1: add Maxim/Dallas DS2780 Stand-Alone Fuel Gauge IC support

Add support for the Maxim/Dallas DS2780 Stand-Alone Fuel Gauge IC.

It was suggested to combine this functionality with the current ds2782
driver.  Unfortunately, I'm unable to commit the time to refactoring this
driver to that extent and I don't have a platform with the ds2782 part to
validate that there are no regression issues by adding this functionality.

[akpm@linux-foundation.org: use min_t()]
Signed-off-by: Clifton Barnes <cabarnes@indesign-llc.com>
Tested-by: Haojian Zhuang <haojian.zhuang@gmail.com>
Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Cc: Ryan Mallon <ryan@bluewatersys.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agow1: have netlink search update kernel list
David Fries [Thu, 26 May 2011 23:26:03 +0000 (16:26 -0700)]
w1: have netlink search update kernel list

Reorganize so the netlink connector one wire search command will update
the kernel list of detected slave devices.  Otherwise, a newly detected
device is unusable because unless it's in the kernel list of known devices
any commands will result in ENODEV status.

Signed-off-by: David Fries <David@Fries.net>
Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agow1: complete the 1-wire (w1) ds1wm driver search algorithm
Jean-François Dagenais [Thu, 26 May 2011 23:26:02 +0000 (16:26 -0700)]
w1: complete the 1-wire (w1) ds1wm driver search algorithm

This adds multi-slave support of the w1 bus for the ds1wm Synthesizable
1-Wire Bus Master.  Also many fixes and tweaks based on the rev3 of the
datasheet http://datasheets.maxim-ic.com/en/ds/DS1WM.pdf

Signed-off-by: Jean-François Dagenais <dagenaisj@sonatest.com>
Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Cc: Szabolcs Gyurko <szabolcs.gyurko@tlt.hu>
Cc: Matt Reimer <mreimer@vpop.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agow1: add 1-wire (w1) DS2408 8-Channel Addressable Switch support
Jean-François Dagenais [Thu, 26 May 2011 23:26:02 +0000 (16:26 -0700)]
w1: add 1-wire (w1) DS2408 8-Channel Addressable Switch support

This DS2408 w1 slave driver is not complete for all the features of the
chip, but its sufficient if you use it as a simple IO expander.

[randy.dunlap@oracle.com: fix w1_ds2408.c printk formats]
Signed-off-by: Jean-François Dagenais <dagenaisj@sonatest.com>
Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Cc: Szabolcs Gyurko <szabolcs.gyurko@tlt.hu>
Cc: Matt Reimer <mreimer@vpop.net>
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>
12 years agow1: add 1-wire (w1) reset and resume command API support
Jean-François Dagenais [Thu, 26 May 2011 23:26:01 +0000 (16:26 -0700)]
w1: add 1-wire (w1) reset and resume command API support

The first patch adds generic functionnality to w1_io for Resume Command
[A5h] lots of slaves support.  I found it useful for multi-commands/reset
workflows with the same slave on a multi-slave bus.

This DS2408 w1 slave driver is not complete for all the features of the
chip, but its sufficient if you use it as a simple IO expander.  Enjoy!

The ds1wm had Kconfig dependencies towards ARM && HAVE_CLK.  I took them
out since I was using the ds1wm on an x86_64 platform (ds1wm in a FPGA
through pcie) and found them irrelevant.

The clock freq/divisors at the top of ds1wm.c did not have the MSB set to
1.  This bit is CLK_EN which turns the whole prescaler and dividers on.
The driver never mentionned this bit either, so I just included this bit
right in the table entries.  I also took the liberty to add a couple of
entries to the table.  The spec doesn't explicitely mentions these
possibilities but the description and examination of the core shows the
prescalers & dividers can be used for more than the table explicitely
shows.  The table I enlarged still doesn't cover all possibilities, but
it's a good start.

I also made a few tweaks to a couple of the read and write algorithms
which made sense while I had my head very deep in the ds1wm documentation.
 We stressed it a lot with 10+ slaves on the bus, many ds2408, ds2431 and
ds2433 at the same time doing extensive interaction.  It proved quite
stable in our production environment.

This patch:

Add generic functionnality to w1_io for Resume Command [A5h] lots of
slaves support.

Signed-off-by: Jean-François Dagenais <dagenaisj@sonatest.com>
Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru>
Cc: Szabolcs Gyurko <szabolcs.gyurko@tlt.hu>
Cc: Matt Reimer <mreimer@vpop.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agokernel/profile.c: remove some duplicate code from profile_hits()
Rakib Mullick [Thu, 26 May 2011 23:26:00 +0000 (16:26 -0700)]
kernel/profile.c: remove some duplicate code from profile_hits()

profile_hits() has a common check for prof_on and prof_buffer regardless
of SMP or !SMP.  So, remove some duplicate code by splitting profile_hits
into two.

[akpm@linux-foundation.org: make do_profile_hits static]
Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agodrivers/char/ppdev.c: put gotten port value
Julia Lawall [Thu, 26 May 2011 23:25:59 +0000 (16:25 -0700)]
drivers/char/ppdev.c: put gotten port value

parport_find_number() calls parport_get_port() on its result, so there
should be a corresponding call to parport_put_port() before dropping the
reference.  Similar code is found in the function register_device() in the
same file.

The semantic match that finds this problem is as follows:
(http://coccinelle.lip6.fr/)

  // <smpl>
  @exists@
  local idexpression struct parport * x;
  expression ra,rr;
  statement S1,S2;
  @@

  x = parport_find_number(...)
  ... when != x = rr
      when any
      when != parport_put_port(x,...)
      when != if (...) { ... parport_put_port(x,...) ...}
  (
  if(<+...x...+>) S1 else S2
  |
  if(...) { ... when != x = ra
       when forall
       when != parport_put_port(x,...)
  *return...;
  }
  )
  // </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoedac,rcu: use synchronize_rcu() instead of call_rcu()+rcu_barrier()
Lai Jiangshan [Thu, 26 May 2011 23:25:58 +0000 (16:25 -0700)]
edac,rcu: use synchronize_rcu() instead of call_rcu()+rcu_barrier()

synchronize_rcu() does the stuff as needed.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Doug Thompson <dougthompson@xmission.com>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agopid: fix typo in function description
Sisir Koppaka [Thu, 26 May 2011 23:25:57 +0000 (16:25 -0700)]
pid: fix typo in function description

finds is misspelt as finr. No functional change.

Signed-off-by: Sisir Koppaka <sisir.koppaka@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agofs/partitions/efi.c: corrupted GUID partition tables can cause kernel oops
Timo Warns [Thu, 26 May 2011 23:25:57 +0000 (16:25 -0700)]
fs/partitions/efi.c: corrupted GUID partition tables can cause kernel oops

The kernel automatically evaluates partition tables of storage devices.
The code for evaluating GUID partitions (in fs/partitions/efi.c) contains
a bug that causes a kernel oops on certain corrupted GUID partition
tables.

This bug has security impacts, because it allows, for example, to
prepare a storage device that crashes a kernel subsystem upon connecting
the device (e.g., a "USB Stick of (Partial) Death").

crc = efi_crc32((const unsigned char *) (*gpt), le32_to_cpu((*gpt)->header_size));

computes a CRC32 checksum over gpt covering (*gpt)->header_size bytes.
There is no validation of (*gpt)->header_size before the efi_crc32 call.

A corrupted partition table may have large values for (*gpt)->header_size.
 In this case, the CRC32 computation access memory beyond the memory
allocated for gpt, which may cause a kernel heap overflow.

Validate value of GUID partition table header size.

[akpm@linux-foundation.org: fix layout and indenting]
Signed-off-by: Timo Warns <warns@pre-sense.de>
Cc: Matt Domsch <Matt_Domsch@dell.com>
Cc: Eugene Teo <eugeneteo@kernel.sg>
Cc: Dave Jones <davej@codemonkey.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agodrivers/char/mspec.c: use {k,v}zalloc to allocate memory
Rakib Mullick [Thu, 26 May 2011 23:25:56 +0000 (16:25 -0700)]
drivers/char/mspec.c: use {k,v}zalloc to allocate memory

Let memory allocator initialize the allocated memory as null, thus remove
the use of memset.

Signed-off-by: Rakib Mullick <rakib.mullick@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoipmi: convert to seq_file interface
Alexey Dobriyan [Thu, 26 May 2011 23:25:55 +0000 (16:25 -0700)]
ipmi: convert to seq_file interface

The ->read_proc interface is going away, convert to seq_file.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc:Corey Minyard <minyard@acm.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agofs/proc/vmcore.c: add hook to read_from_oldmem() to check for non-ram pages
Olaf Hering [Thu, 26 May 2011 23:25:54 +0000 (16:25 -0700)]
fs/proc/vmcore.c: add hook to read_from_oldmem() to check for non-ram pages

The balloon driver in a Xen guest frees guest pages and marks them as
mmio.  When the kernel crashes and the crash kernel attempts to read the
oldmem via /proc/vmcore a read from ballooned pages will generate 100%
load in dom0 because Xen asks qemu-dm for the page content.  Since the
reads come in as 8byte requests each ballooned page is tried 512 times.

With this change a hook can be registered which checks wether the given
pfn is really ram.  The hook has to return a value > 0 for ram pages, a
value < 0 on error (because the hypercall is not known) and 0 for non-ram
pages.

This will reduce the time to read /proc/vmcore.  Without this change a
512M guest with 128M crashkernel region needs 200 seconds to read it, with
this change it takes just 2 seconds.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoproc: fix pagemap_read() error case
KOSAKI Motohiro [Thu, 26 May 2011 23:25:53 +0000 (16:25 -0700)]
proc: fix pagemap_read() error case

Currently, pagemap_read() has three error and/or corner case handling
mistake.

 (1) If ppos parameter is wrong, mm refcount will be leak.
 (2) If count parameter is 0, mm refcount will be leak too.
 (3) If the current task is sleeping in kmalloc() and the system
     is out of memory and oom-killer kill the proc associated task,
     mm_refcount prevent the task free its memory. then system may
     hang up.

<Quote Hugh's explain why we shold call kmalloc() before get_mm()>

  check_mem_permission gets a reference to the mm.  If we
  __get_free_page after check_mem_permission, imagine what happens if the
  system is out of memory, and the mm we're looking at is selected for
  killing by the OOM killer: while we wait in __get_free_page for more
  memory, no memory is freed from the selected mm because it cannot reach
  exit_mmap while we hold that reference.

This patch fixes the above three.

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Jovi Zhang <bookjovi@gmail.com>
Acked-by: Hugh Dickins <hughd@google.com>
Cc: Stephen Wilson <wilsons@start.ca>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoproc: put check_mem_permission after __get_free_page in mem_write
KOSAKI Motohiro [Thu, 26 May 2011 23:25:52 +0000 (16:25 -0700)]
proc: put check_mem_permission after __get_free_page in mem_write

It whould be better if put check_mem_permission after __get_free_page in
mem_write, to be same as function mem_read.

Hugh Dickins explained the reason.

    check_mem_permission gets a reference to the mm.  If we __get_free_page
    after check_mem_permission, imagine what happens if the system is out
    of memory, and the mm we're looking at is selected for killing by the
    OOM killer: while we wait in __get_free_page for more memory, no memory
    is freed from the selected mm because it cannot reach exit_mmap while
    we hold that reference.

Reported-by: Jovi Zhang <bookjovi@gmail.com>
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Acked-by: Hugh Dickins <hughd@google.com>
Reviewed-by: Stephen Wilson <wilsons@start.ca>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoproc/stat: use defined macro KMALLOC_MAX_SIZE
Yuanhan Liu [Thu, 26 May 2011 23:25:51 +0000 (16:25 -0700)]
proc/stat: use defined macro KMALLOC_MAX_SIZE

There is a macro for the max size kmalloc can allocate, so use it instead
of a hardcoded number.

Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoproc: constify status array
Mike Frysinger [Thu, 26 May 2011 23:25:51 +0000 (16:25 -0700)]
proc: constify status array

No need for this local array to be writable, so mark it const.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agofs/proc: convert to kstrtoX()
Alexey Dobriyan [Thu, 26 May 2011 23:25:50 +0000 (16:25 -0700)]
fs/proc: convert to kstrtoX()

Convert fs/proc/ from strict_strto*() to kstrto*() functions.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agocoredump: add support for exe_file in core name
Jiri Slaby [Thu, 26 May 2011 23:25:46 +0000 (16:25 -0700)]
coredump: add support for exe_file in core name

Now, exe_file is not proc FS dependent, so we can use it to name core
file.  So we add %E pattern for core file name cration which extract path
from mm_struct->exe_file.  Then it converts slashes to exclamation marks
and pastes the result to the core file name itself.

This is useful for environments where binary names are longer than 16
character (the current->comm limitation).  Also where there are binaries
with same name but in a different path.  Further in case the binery itself
changes its current->comm after exec.

So by doing (s/$/#/ -- # is treated as git comment):

  $ sysctl kernel.core_pattern='core.%p.%e.%E'
  $ ln /bin/cat cat45678901234567890
  $ ./cat45678901234567890
  ^Z
  $ rm cat45678901234567890
  $ fg
  ^\Quit (core dumped)
  $ ls core*

we now get:

  core.2434.cat456789012345.!root!cat45678901234567890 (deleted)

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Reviewed-by: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agomm: extract exe_file handling from procfs
Jiri Slaby [Thu, 26 May 2011 23:25:46 +0000 (16:25 -0700)]
mm: extract exe_file handling from procfs

Setup and cleanup of mm_struct->exe_file is currently done in fs/proc/.
This was because exe_file was needed only for /proc/<pid>/exe.  Since we
will need the exe_file functionality also for core dumps (so core name can
contain full binary path), built this functionality always into the
kernel.

To achieve that move that out of proc FS to the kernel/ where in fact it
should belong.  By doing that we can make dup_mm_exe_file static.  Also we
can drop linux/proc_fs.h inclusion in fs/exec.c and kernel/fork.c.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Alexander Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agokgdbts: unify/generalize gdb breakpoint adjustment
Mike Frysinger [Thu, 26 May 2011 23:25:45 +0000 (16:25 -0700)]
kgdbts: unify/generalize gdb breakpoint adjustment

The Blackfin arch, like the x86 arch, needs to adjust the PC manually
after a breakpoint is hit as normally this is handled by the remote gdb.
However, rather than starting another arch ifdef mess, create a common
GDB_ADJUSTS_BREAK_OFFSET define for any arch to opt-in via their kgdb.h.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Acked-by: Dongdong Deng <dongdong.deng@windriver.com>
Cc: Sergei Shtylyov <sshtylyov@mvista.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agosh: convert to asm-generic ptrace.h
Mike Frysinger [Thu, 26 May 2011 23:25:44 +0000 (16:25 -0700)]
sh: convert to asm-generic ptrace.h

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Sergei Shtylyov <sshtylyov@mvista.com>
Cc: Dongdong Deng <dongdong.deng@windriver.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agox86: convert to asm-generic ptrace.h
Mike Frysinger [Thu, 26 May 2011 23:25:43 +0000 (16:25 -0700)]
x86: convert to asm-generic ptrace.h

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Sergei Shtylyov <sshtylyov@mvista.com>
Cc: Dongdong Deng <dongdong.deng@windriver.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoBlackfin: convert to asm-generic ptrace.h
Mike Frysinger [Thu, 26 May 2011 23:25:42 +0000 (16:25 -0700)]
Blackfin: convert to asm-generic ptrace.h

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Sergei Shtylyov <sshtylyov@mvista.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoasm-generic/ptrace.h: start a common low level ptrace helper
Mike Frysinger [Thu, 26 May 2011 23:25:39 +0000 (16:25 -0700)]
asm-generic/ptrace.h: start a common low level ptrace helper

This is a series of low level ptrace unification steps to make it easier
for common code (like KGDB) to poke at register state.  This also avoids
having to duplicate higher level operations for most ports which don't
have special needs for accessing things.

This patch:

This implements a bunch of helper funcs for poking the registers of a
ptrace structure.  Now common code should be able to portably update
specific registers (like kgdb updating the PC).

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Sergei Shtylyov <sshtylyov@mvista.com>
Cc: Dongdong Deng <dongdong.deng@windriver.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agomemcg: add the pagefault count into memcg stats
Ying Han [Thu, 26 May 2011 23:25:38 +0000 (16:25 -0700)]
memcg: add the pagefault count into memcg stats

Two new stats in per-memcg memory.stat which tracks the number of page
faults and number of major page faults.

  "pgfault"
  "pgmajfault"

They are different from "pgpgin"/"pgpgout" stat which count number of
pages charged/discharged to the cgroup and have no meaning of reading/
writing page to disk.

It is valuable to track the two stats for both measuring application's
performance as well as the efficiency of the kernel page reclaim path.
Counting pagefaults per process is useful, but we also need the aggregated
value since processes are monitored and controlled in cgroup basis in
memcg.

Functional test: check the total number of pgfault/pgmajfault of all
memcgs and compare with global vmstat value:

  $ cat /proc/vmstat | grep fault
  pgfault 1070751
  pgmajfault 553

  $ cat /dev/cgroup/memory.stat | grep fault
  pgfault 1071138
  pgmajfault 553
  total_pgfault 1071142
  total_pgmajfault 553

  $ cat /dev/cgroup/A/memory.stat | grep fault
  pgfault 199
  pgmajfault 0
  total_pgfault 199
  total_pgmajfault 0

Performance test: run page fault test(pft) wit 16 thread on faulting in
15G anon pages in 16G container.  There is no regression noticed on the
"flt/cpu/s"

Sample output from pft:

  TAG pft:anon-sys-default:
    Gb  Thr CLine   User     System     Wall    flt/cpu/s fault/wsec
    15   16   1     0.67s   233.41s    14.76s   16798.546 266356.260

  +-------------------------------------------------------------------------+
      N           Min           Max        Median           Avg        Stddev
  x  10     16682.962     17344.027     16913.524     16928.812      166.5362
  +  10     16695.568     16923.896     16820.604     16824.652     84.816568
  No difference proven at 95.0% confidence

[akpm@linux-foundation.org: fix build]
[hughd@google.com: shmem fix]
Signed-off-by: Ying Han <yinghan@google.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agomemcg: add memory.numastat api for numa statistics
Ying Han [Thu, 26 May 2011 23:25:37 +0000 (16:25 -0700)]
memcg: add memory.numastat api for numa statistics

The new API exports numa_maps per-memcg basis.  This is a piece of useful
information where it exports per-memcg page distribution across real numa
nodes.

One of the usecases is evaluating application performance by combining
this information w/ the cpu allocation to the application.

The output of the memory.numastat tries to follow w/ simiar format of
numa_maps like:

  total=<total pages> N0=<node 0 pages> N1=<node 1 pages> ...
  file=<total file pages> N0=<node 0 pages> N1=<node 1 pages> ...
  anon=<total anon pages> N0=<node 0 pages> N1=<node 1 pages> ...
  unevictable=<total anon pages> N0=<node 0 pages> N1=<node 1 pages> ...

And we have per-node:

  total = file + anon + unevictable

  $ cat /dev/cgroup/memory/memory.numa_stat
  total=250020 N0=87620 N1=52367 N2=45298 N3=64735
  file=225232 N0=83402 N1=46160 N2=40522 N3=55148
  anon=21053 N0=3424 N1=6207 N2=4776 N3=6646
  unevictable=3735 N0=794 N1=0 N2=0 N3=2941

Signed-off-by: Ying Han <yinghan@google.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Minchan Kim <minchan.kim@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agomemcg: rename mem_cgroup_zone_nr_pages() to mem_cgroup_zone_nr_lru_pages()
Ying Han [Thu, 26 May 2011 23:25:36 +0000 (16:25 -0700)]
memcg: rename mem_cgroup_zone_nr_pages() to mem_cgroup_zone_nr_lru_pages()

The caller of the function has been renamed to zone_nr_lru_pages(), and
this is just fixing up in the memcg code.  The current name is easily to
be mis-read as zone's total number of pages.

Signed-off-by: Ying Han <yinghan@google.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agomemcg: remove unused retry signal from reclaim
Johannes Weiner [Thu, 26 May 2011 23:25:35 +0000 (16:25 -0700)]
memcg: remove unused retry signal from reclaim

If the memcg reclaim code detects the target memcg below its limit it
exits and returns a guaranteed non-zero value so that the charge is
retried.

Nowadays, the charge side checks the memcg limit itself and does not rely
on this non-zero return value trick.

This patch removes it.  The reclaim code will now always return the true
number of pages it reclaimed on its own.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Acked-by: Rik van Riel<riel@redhat.com>
Acked-by: Ying Han<yinghan@google.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Mel Gorman <mgorman@suse.de>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agomemcg: fix get_scan_count() for small targets
KAMEZAWA Hiroyuki [Thu, 26 May 2011 23:25:34 +0000 (16:25 -0700)]
memcg: fix get_scan_count() for small targets

During memory reclaim we determine the number of pages to be scanned per
zone as

(anon + file) >> priority.
Assume
scan = (anon + file) >> priority.

If scan < SWAP_CLUSTER_MAX, the scan will be skipped for this time and
priority gets higher.  This has some problems.

  1. This increases priority as 1 without any scan.
     To do scan in this priority, amount of pages should be larger than 512M.
     If pages>>priority < SWAP_CLUSTER_MAX, it's recorded and scan will be
     batched, later. (But we lose 1 priority.)
     If memory size is below 16M, pages >> priority is 0 and no scan in
     DEF_PRIORITY forever.

  2. If zone->all_unreclaimabe==true, it's scanned only when priority==0.
     So, x86's ZONE_DMA will never be recoverred until the user of pages
     frees memory by itself.

  3. With memcg, the limit of memory can be small. When using small memcg,
     it gets priority < DEF_PRIORITY-2 very easily and need to call
     wait_iff_congested().
     For doing scan before priorty=9, 64MB of memory should be used.

Then, this patch tries to scan SWAP_CLUSTER_MAX of pages in force...when

  1. the target is enough small.
  2. it's kswapd or memcg reclaim.

Then we can avoid rapid priority drop and may be able to recover
all_unreclaimable in a small zones.  And this patch removes nr_saved_scan.
 This will allow scanning in this priority even when pages >> priority is
very small.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Ying Han <yinghan@google.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agomemcg: reclaim memory from nodes in round-robin order
Ying Han [Thu, 26 May 2011 23:25:33 +0000 (16:25 -0700)]
memcg: reclaim memory from nodes in round-robin order

Presently, memory cgroup's direct reclaim frees memory from the current
node.  But this has some troubles.  Usually when a set of threads works in
a cooperative way, they tend to operate on the same node.  So if they hit
limits under memcg they will reclaim memory from themselves, damaging the
active working set.

For example, assume 2 node system which has Node 0 and Node 1 and a memcg
which has 1G limit.  After some work, file cache remains and the usages
are

   Node 0:  1M
   Node 1:  998M.

and run an application on Node 0, it will eat its foot before freeing
unnecessary file caches.

This patch adds round-robin for NUMA and adds equal pressure to each node.
When using cpuset's spread memory feature, this will work very well.

But yes, a better algorithm is needed.

[akpm@linux-foundation.org: comment editing]
[kamezawa.hiroyu@jp.fujitsu.com: fix time comparisons]
Signed-off-by: Ying Han <yinghan@google.com>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Mel Gorman <mel@csn.ul.ie>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agoMAINTAINERS: add mm/page_cgroup.c into memcg subsystem
Namhyung Kim [Thu, 26 May 2011 23:25:32 +0000 (16:25 -0700)]
MAINTAINERS: add mm/page_cgroup.c into memcg subsystem

AFAICS mm/page_cgroup.c is for memcg subsystem, but it was directed only
to generic cgroup maintainers.  Fix it.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agomemcg: move page-freeing code out of lock
Namhyung Kim [Thu, 26 May 2011 23:25:31 +0000 (16:25 -0700)]
memcg: move page-freeing code out of lock

Move page-freeing code out of swap_cgroup_mutex in the hope that it could
reduce few of theoretical contentions between swapons and/or swapoffs.

This is just a cleanup, no functional changes.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agomemcg: fix off-by-one when calculating swap cgroup map length
Namhyung Kim [Thu, 26 May 2011 23:25:30 +0000 (16:25 -0700)]
memcg: fix off-by-one when calculating swap cgroup map length

It allocated one more page than necessary if @max_pages was a multiple of
SC_PER_PAGE.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agomemcg: mark init_section_page_cgroup() properly
Namhyung Kim [Thu, 26 May 2011 23:25:29 +0000 (16:25 -0700)]
memcg: mark init_section_page_cgroup() properly

Commit ca371c0d7e23 ("memcg: fix page_cgroup fatal error in FLATMEM")
removes call to alloc_bootmem() in the function so that it can be marked
as __meminit to reduce memory usage when MEMORY_HOTPLUG=n.

Also as the new helper function alloc_page_cgroup() is called only in the
function, it should be marked too.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agomemcg: remove pointless next_mz nullification in mem_cgroup_soft_limit_reclaim()
Michal Hocko [Thu, 26 May 2011 23:25:28 +0000 (16:25 -0700)]
memcg: remove pointless next_mz nullification in mem_cgroup_soft_limit_reclaim()

next_mz is assigned to NULL if __mem_cgroup_largest_soft_limit_node
selects the same mz.  This doesn't make much sense as we assign to the
variable right in the next loop.

Compiler will probably optimize this out but it is little bit confusing
for the code reading.

Signed-off-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
12 years agomemcg: add the soft_limit reclaim in global direct reclaim.
Ying Han [Thu, 26 May 2011 23:25:27 +0000 (16:25 -0700)]
memcg: add the soft_limit reclaim in global direct reclaim.

We recently added the change in global background reclaim which counts the
return value of soft_limit reclaim.  Now this patch adds the similar logic
on global direct reclaim.

We should skip scanning global LRU on shrink_zone if soft_limit reclaim
does enough work.  This is the first step where we start with counting the
nr_scanned and nr_reclaimed from soft_limit reclaim into global
scan_control.

Signed-off-by: Ying Han <yinghan@google.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Minchan Kim <minchan.kim@gmail.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Mel Gorman <mel@csn.ul.ie>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Rik van Riel <riel@redhat.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>