Commit Graph

530 Commits (18259cac98884522a46c24a73ef8d4879d824607)

Author SHA1 Message Date
Kim, Milo 18259cac98 lp8727_charger: Fix checkpatch warning
Fix the warning on MODULE_AUTHOR.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 18:07:14 -07:00
Kim, Milo 1ae9df7d49 lp8727_charger: Add description in the private data
Add description and relocate data.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 18:07:06 -07:00
Kim, Milo 56d99ed93a lp8727_charger: Fix a typo - chg_parm to chg_param
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 18:06:54 -07:00
Kim, Milo 5e00b9761b lp8727_charger: Make some cosmetic changes in lp8727_delayed_func()
Declare a variable at one line and align lines.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 18:06:30 -07:00
Kim, Milo 20414e2e0e lp8727_charger: Clean up lp8727_charger_changed()
Declare a variable at one line. Just return when no charger exists to make
code simpler.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 18:06:13 -07:00
Kim, Milo e06374b0d6 lp8727_charger: Return if the battery is discharging
If the charger is pulled out, just return as DISCHARGING. Then no need for
additional 'else' statement.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 18:05:55 -07:00
Kim, Milo b59c93c009 lp8727_charger: Make lp8727_charger_get_propery() simpler
Charger has only one valid property - ONLINE. If the property is not
ONLINE, then just return quickly.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 18:05:39 -07:00
Kim, Milo 91a696330c lp8727_charger: Make lp8727_ctrl_switch() inline
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 18:05:28 -07:00
Kim, Milo 70be130529 lp8727_charger: Make lp8727_init_device() shorter
Just return with lp8727_write_byte(), no need to check its value.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 18:04:29 -07:00
Kim, Milo 65272bac3a lp8727_charger: Clean up lp8727_is_charger_attached()
Change return type to boolean. Remove unnecessary check routine for NULL
string. (Power supply name is always valid when the function is executed.)

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 18:04:00 -07:00
Kim, Milo 18763a36d0 lp8727_charger: Use specific definition
Add new LP8727_ICHG_SHIFT definition and replace a magic number. Reuse
definition for the size of interrupt register buffer.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 18:03:45 -07:00
Kim, Milo 6029719f08 lp8727_charger: Clean up lp8727 definitions
All definitions should be unique, since they're in the gloabl namespace.
So the prefix LP8727_ are added. Additionally, use BIT() macro for bit
masks. Remove unnecessary definitions such as SW_DM1_U1 and SW_DP2_U2.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 18:01:33 -07:00
Kim, Milo faaae9bbb1 lp8727_charger: Use the definition rather than enum
Enum lp8727_chg_state can be removed because only one charger status is
used - EOC(End Of Charge).

To check whether the EOC is reached or not, use simple comparison rather
than shift-operation.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 18:01:15 -07:00
Kim, Milo b1ad079680 lp8727_charger: Fix code for getting battery temp
For better understanding, use specific function and definitions rather
than magic numbers. New enum type for die temperature is matched with hex
codes. Specific temperature names are better than 0x1, 0x2 and 0x3.

And lp8727_is_high_temperature() function has better readability than
comparing raw register values.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 18:00:55 -07:00
Kim, Milo 638555d276 lp8727_charger: Clear interrrupts at inital time
To initialize the device, previous interrupts need to be cleared while
loading the driver.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 18:00:38 -07:00
Kim, Milo d71fda0161 lp8727_charger: Clean up the interrupt handler
For better understanding, function name is changed. (lp8727_intr_config()
is replaced with lp8727_setup_irq().)

The private IRQ number is set when the IRQ is allocated successfully. This
data is used for releasing the IRQ on unloading the driver. Even the IRQ
number is not defined, the driver should be operated. In this case, just
return as 0.

In additional function lp8727_release_irq(), the workqueue is canceled and
the allocated IRQ is released.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 18:00:08 -07:00
Kim, Milo 2a0925827b lp8727_charger: Remove unnecessary workqueue thread
LP8727 has two IRQ threads. One is the I2C HW IRQ pin, the other is for
delayed interrupt processing. But this delayed processing can be handled
without additional single thread by using schedule_delayed_work() with
jiffies time value.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 17:57:49 -07:00
Kim, Milo 60fd57e06e lp8727_charger: Add configurable debouce timer
Debounce time is configurable in the platform side. If it is not defined,
the default value is 270ms.

Platform data is msec unit, and this time is converted to jiffies
internally. The workqueue uses this jiffies time in the interrupt
handling. So debounce_jiffies is added in the private data.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 17:57:12 -07:00
Kim, Milo 318cb389d0 lp8727_charger: Fix buggy code of NULL pdata
LP8727 platform data is optional, so the driver should work even the
platform data is NULL.

To check the platform data, charging parameter data should be changed to
the pointer type.

Fix NULL point access problem when getting the battery properties. When
the data is NULL, just return as invalid value.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 17:56:49 -07:00
Kim, Milo fb9adc5190 lp8727_charger: Cleanup _probe() and _remove()
If the lp8727_register_psy() gets failed, registered interrupt handler
should be freed, but this is not complete solution. It has still problem.
Assume that the IRQ occurs while unregistering power supply devices. Then
the ISR will access to freed IRQ.

From Anton's opinion, it can be resolved if re-ordering the call sequence.

Register power supplies first, then create interrupt handler. Then no need
to free the IRQ in _probe(). Additionally goto statements can be removed
because those can be replaced with return statements.

The _remove() should be changed the sequence - in reverse order of
_probe()

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 17:55:34 -07:00
Kim, Milo 74727c5715 lp8727_charger: Use devm_kzalloc()
Use devm_kzalloc() rather than kzalloc()/kfree() to make
allocating/freeing the private data simpler.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 17:51:57 -07:00
Fengguang Wu a2778b0fe1 twl4030_charger: Use IRQF_ONESHOT
Generated by: scripts/coccinelle/misc/irqf_oneshot.cocci

Make sure threaded IRQs without a primary handler are always request with IRQF_ONESHOT

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Acked-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 15:41:49 -07:00
Fengguang Wu 7c577c0d1e lp8727_charger: Use IRQF_ONESHOT
Generated by: scripts/coccinelle/misc/irqf_oneshot.cocci

ERROR: Threaded IRQ with no primary handler requested without IRQF_ONESHOT

Make sure threaded IRQs without a primary handler are always request
with IRQF_ONESHOT

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
Acked-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 15:39:14 -07:00
Anton Vorontsov f1ade35253 88pm860x_battery and charger: Fix a few post-merge issues
Sparse complains:

  CHECK   drivers/power/88pm860x_battery.c
drivers/power/88pm860x_battery.c:128:5: warning: symbol 'array_soc' was not declared. Should it be static?
  CHECK   drivers/power/88pm860x_charger.c
drivers/power/88pm860x_charger.c:640:3: warning: symbol 'pm860x_irq_descs' was not declared. Should it be static?
  CHECK   drivers/mfd/88pm860x-core.c
drivers/mfd/88pm860x-core.c:803:53: warning: incorrect type in assignment (different base types)
drivers/mfd/88pm860x-core.c:803:53:    expected struct charger_regulator *charger_regulators
drivers/mfd/88pm860x-core.c:803:53:    got struct regulator_bulk_data static [toplevel] *

The issues are minor, except for the last one. We seemed to use
'regulator_bulk_data' struct (just as charger manager documentation
wrongly tells us), but in real it should have been
'struct charger_regulator'. The only reason that it worked is
because both 'supply' and 'regulator_name' struct members are the
first in these structs. :-)

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 15:33:12 -07:00
Jett.Zhou a830d28b48 power_supply: Enable battery-charger for 88pm860x
There are charger and battery measurement feature for 88pm860x PMIC.

For charger, it can support pre-charge with small current when battery is
nearly exausted and then changed into fast-charge with CC&CV mode.

For battery monitor, it can support battery measurement such as
vbat,vsys,vchg and ibat etc,it can aslo accumulating the Coulomb value
charged or discharged from battery based on Conlomb Counter, we use it
to estimate battery capacity.

Signed-off-by: Jett.Zhou <jtzhou@marvell.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 15:32:55 -07:00
Kim, Milo 98a2766493 power_supply: Add new lp8788 charger driver
TI LP8788 PMU supports regulators, battery charger, RTC, ADC, backlight
driver and current sinks.

This patch supports the charger operations including the charger
interrupt handling.

The LP8788 charger driver provides configurable platform data.  The
charger platform data includes ADC input ID, maximum battery voltage,
charging parameters and etc.

The ADC input is used for getting the battery voltage and temperature.
Charging parameters are used for updating the charger operations such
like setting charging current and setting End-of-charge conditions.

When the charging interrupt occurs, power supply uevents are generated
in order to update the user-space information.  For platform specific
charger action, the charger_event() function can be used in the
platform side.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 15:11:54 -07:00
Dan Carpenter f4f95adf7c da9052-battery: Don't free IRQ that wasn't requested
We should decrement "i" before doing the free_irq().  If we call this
because request_threaded_irq() failed then we don't want to free the
thing which failed.  Or in the case where we get here because
power_supply_register() failed then the original codes does a read past
the end of the array.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 15:00:12 -07:00
Olof Johansson a22b41a31e sbs-battery: Probe should try talking to the device
Turns out this driver doesn't actually try talking to the device at
probe time, so if it's incorrectly configured in the device tree or
platform data (or if the battery has been removed from the system),
then probe will succeed and every access will sit there and time out.
The end result is a possibly laggy system that thinks it has a battery
but can never read status, which isn't very useful.

Instead, just read any register (I chose status) at probe, and if that
fails, don't register the device.

Signed-off-by: Olof Johansson <olof@lixom.net>
Acked-by: Rhyland Klein <rklein@nvidia.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 14:57:52 -07:00
Ramakrishna Pallala 1502cfe19b smb347-charger: Fix battery status reporting logic for charger faults
This patch checks for charger status register for determining the
battery charging status and reports Discharing/Charging/Not Charging/Full
accordingly.

This patch also adds the interrupt support for Safety Timer Expiration.
This interrupt is helpful in debugging the cause for charger fault.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 14:44:45 -07:00
Paul Parsons ec60ea5cd6 pda_power: Fix ac_draw usage before it being set
When I reboot my iPAQ hx4700 in its cradle, the battery will not begin
to charge even though the AC supply is connected. Charging will start
only after the PDA power driver is tickled by some other power event,
such as reseating the iPAQ in its cradle or connecting the USB cable.

The problem lies in pda_power_probe(), where ac_draw is used by the call
to update_charger() before being set by the call to regulator_get().

Moving the regulator_get() call to before the update_charger() call
fixes the problem.

Signed-off-by: Paul Parsons <lost.distance@yahoo.com>
Cc: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-09-20 14:27:34 -07:00
Ramakrishna Pallala 2815b786c3 power_supply: Add new power supply properties CHARGE_CURRENT/VOLTAGE_MAX
There are different types of chargers avalibale like AC, Solar, USB,
etc..  Even in USB we have different types SDP/DCP/CDP/ACA and all these
chargers have different o/p ratings. For example SDP supports only 500mA
of charge current whereas AC charger can support upto 8A or more.

Similarly batteries also come with charge current and voltage ratings
and these ratings vary depending on its capacity and the technology
used.

This patch adds two new power supply properties
CONSTANT_CHARGE_CURRENT_MAX and CONSTANT_CHARGE_CURRENT_MAX.

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-08-22 21:59:15 -07:00
Chanwoo Choi fd65ee5f1c charger-manager: Use replacement variable to check state of battery
This patch remove unnecessary variable(cm->fullbatt_vchk_uV) by using
'desc->fullbatt_uV' field directly in fullbatt_handler() function
to check the state of battery.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-08-22 20:09:08 -07:00
Chanwoo Choi dbb61fc745 charger-manager: Disable regulator when charger cable is detached
This patch disable regulator for charging when charger cable is detached
before stopping charging forcibly on abnormal battery state and check
return value of regulator_enable/disable() function to confirm correct
operation of enabling or disabling regulator for charging.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-08-22 20:08:28 -07:00
Anton Vorontsov c084e092e4 da9030_battery: Don't use 0 as NULL
Noticed the new warning:

  CHECK   drivers/power/da9030_battery.c
drivers/power/da9030_battery.c:190:68: warning: Using plain integer as NULL pointer

This commit fixes the issue.

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-08-22 20:00:45 -07:00
Ramakrishna Pallala b1b56872be power_supply: Add new power supply AUTHENTIC property
It is possible that users can use non-standard chargers or use invalid
batteries especially with mobile devices.

This patch adds a new power supply property called 'AUTHENTIC' to
indicate this to the user(user space).

Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-08-22 19:56:37 -07:00
Devendra Naga deacc4fe57 ds2781_battery: Replace call to kzalloc with devm_kzalloc
With devm_kzalloc there is no need of freeing at the errorpath and also
at unregister it.

Signed-off-by: Devendra Naga <develkernel412222@gmail.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-08-22 19:47:14 -07:00
Devendra Naga bc6e51d889 ds2781_battery: Convert to module_platform_driver
module_platform_driver can be used to replace the platform_driver
register and unregister functions, with the calls to module_init
and module_exit,

i.e. all the code that is doing like the below

static int __init mymod_init(void)
{
	return platform_driver_register(&drv_operations);
}

static void __exit mymod_exit(void)
{
	platform_driver_unregister(&drv_operations);
}

module_init(mymod_init);
module_exit(mymod_exit);

can be replaced with
module_platform_driver(drv_operations)...

Signed-off-by: Devendra Naga <develkernel412222@gmail.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-08-22 19:47:09 -07:00
Il Han 94b05cabc0 twl4030_charger: It would be better not to use the 0b-prefix
It would be better not to use the 0b-prefix for earlier versions of
gcc-4.3.

Signed-off-by: Il Han <corone.il.han@gmail.com>
Acked-by: NeilBrown <neilb@suse.de>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-08-22 19:38:28 -07:00
Axel Lin 4ac64d5126 power_supply: Remove broken mark for da9052-battery
The fix for MFD part is already merged so we can remove the broken mark
for da9052-battery.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-08-22 19:31:43 -07:00
Anton Vorontsov bc909f27f5 da9052-battery: Fix da9052_determine_vc_tbl_index's return value
The patch fixes the following warnings:

  CHECK   drivers/power/da9052-battery.c
drivers/power/da9052-battery.c:330:15: warning: symbol 'da9052_determine_vc_tbl_index' was not declared. Should it be static?
  CC      drivers/power/da9052-battery.o
drivers/power/da9052-battery.c: In function 'da9052_determine_vc_tbl_index':
drivers/power/da9052-battery.c:348:1: warning: control reaches end of non-void function [-Wreturn-type]

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-08-22 19:31:42 -07:00
Devendra Naga 6297b5e54b lp8727_charger: Unregister power supply at error path of lp8727_register_psy
if usb power supply registration fails,
	we wont unregister the ac power supply
if battery power supply registration fails,
	we wont unregister the usb, and ac supply,

take care of those things and also no need of goto -err_mem: at the fail case of
kzalloc simply can have return -ENOMEM

Signed-off-by: Devendra Naga <develkernel412222@gmail.com>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-08-22 19:14:09 -07:00
Julia Lawall f77609959a bq27x00_battery: Fix error return code
Initialize return variable before exiting on an error path.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}

// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-08-22 18:48:13 -07:00
Julia Lawall d2941651d7 ab8500_fg: Fix error return code
Initialize return variable before exiting on an error path.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}

// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-08-22 18:48:01 -07:00
Julia Lawall 05cdbdb95f ab8500_btemp: Fix error return code
Initialize return variable before exiting on an error path.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}

// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-08-22 18:47:51 -07:00
Julia Lawall 588d4f0b05 wm97xx_battery: Fix error return code
Initialize return variable before exiting on an error path.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}

// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-08-22 18:47:40 -07:00
Julia Lawall fc2bc0c29a ab8500_charger: Fix error return code
Initialize return variable before exiting on an error path.

A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)

// <smpl>
(
if@p1 (\(ret < 0\|ret != 0\))
 { ... return ret; }
|
ret@p1 = 0
)
... when != ret = e1
    when != &ret
*if(...)
{
  ... when != ret = e2
      when forall
 return ret;
}

// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
2012-08-22 18:47:25 -07:00
Linus Torvalds fc6bdb59a5 Merge branch 'for-linus-3.6' of git://dev.laptop.org/users/dilinger/linux-olpc
Pull OLPC platform updates from Andres Salomon:
 "These move the OLPC Embedded Controller driver out of
  arch/x86/platform and into drivers/platform/olpc.

  OLPC machines are now ARM-based (which means lots of x86 and ARM
  changes), but are typically pretty self-contained..  so it makes more
  sense to go through a separate OLPC tree after getting the appropriate
  review/ACKs."

* 'for-linus-3.6' of git://dev.laptop.org/users/dilinger/linux-olpc:
  x86: OLPC: move s/r-related EC cmds to EC driver
  Platform: OLPC: move global variables into priv struct
  Platform: OLPC: move debugfs support from x86 EC driver
  x86: OLPC: switch over to using new EC driver on x86
  Platform: OLPC: add a suspended flag to the EC driver
  Platform: OLPC: turn EC driver into a platform_driver
  Platform: OLPC: allow EC cmd to be overridden, and create a workqueue to call it
  drivers: OLPC: update various drivers to include olpc-ec.h
  Platform: OLPC: add a stub to drivers/platform/ for the OLPC EC driver
2012-08-02 11:52:39 -07:00
Andres Salomon 3bf9428f22 drivers: OLPC: update various drivers to include olpc-ec.h
Switch over to using olpc-ec.h in multiple steps, so as not to break builds.
This covers every driver that calls olpc_ec_cmd().

Signed-off-by: Andres Salomon <dilinger@queued.net>
Acked-by: Paul Fox <pgf@laptop.org>
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
2012-07-31 23:27:29 -04:00
Linus Torvalds 3e9a97082f This patch series contains a major revamp of how we collect entropy
from interrupts for /dev/random and /dev/urandom.  The goal is to
 addresses weaknesses discussed in the paper "Mining your Ps and Qs:
 Detection of Widespread Weak Keys in Network Devices", by Nadia
 Heninger, Zakir Durumeric, Eric Wustrow, J. Alex Halderman, which will
 be published in the Proceedings of the 21st Usenix Security Symposium,
 August 2012.  (See https://factorable.net for more information and an
 extended version of the paper.)
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABCAAGBQJQF/0DAAoJENNvdpvBGATwIowQAOep9QKtLrBvb2lwIRVmeiy8
 lRf7V/tYZnz4FePbR0W92JQfKYkCV8yyOO0bmeRzWL3v4m+lRwDTSyA1DDyQMoH+
 LOMzvDKSLJMSXTXdSOIr1WYACphViCR/9CrbMBCKSkYfZLJ1MdaEDxT3rcpTGD0T
 6iknUweiSkHHhkerU5yQL7FKzD5kYUe0hsF47w7QVlHRHJsW2fsZqkFoh+RpnhNw
 03u+djxNGBo9qV81vZ9D1b0vA9uRlEjoWOOEG2XE4M2iq6TUySueA72dQnCwunfi
 3kG/u1Swv2dgq6aRrP3H7zdwhYSourGxziu3jNhEKwKEohrxYY7xjNX3RVeTqP67
 AzlKsOTWpRLIDrzjSLlb8VxRQiZewu8Unex3e1G+eo20sbcIObHGrxNp7K00zZvd
 QZiMHhOwItwFTe4lBO+XbqH2JKbL9/uJmwh5EipMpQTraKO9E6N3CJiUHjzBLo2K
 iGDZxRMKf4gVJRwDxbbP6D70JPVu8ZJ09XVIpsXQ3Z1xNqaMF0QdCmP3ty56q1o0
 NvkSXxPKrijZs8Sk0rVDqnJ3ll8PuDnXMv5eDtL42VT818I5WxESn9djjwEanGv0
 TYxbFub/NRxmPEE5B2Js5FBpqsLf5f282OSMeS/5WLBbnHJR1OoPoAhGVpHvxntC
 bi5FC1OolqhvzVIdsqgt
 =u7KM
 -----END PGP SIGNATURE-----

Merge tag 'random_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random

Pull random subsystem patches from Ted Ts'o:
 "This patch series contains a major revamp of how we collect entropy
  from interrupts for /dev/random and /dev/urandom.

  The goal is to addresses weaknesses discussed in the paper "Mining
  your Ps and Qs: Detection of Widespread Weak Keys in Network Devices",
  by Nadia Heninger, Zakir Durumeric, Eric Wustrow, J.  Alex Halderman,
  which will be published in the Proceedings of the 21st Usenix Security
  Symposium, August 2012.  (See https://factorable.net for more
  information and an extended version of the paper.)"

Fix up trivial conflicts due to nearby changes in
drivers/{mfd/ab3100-core.c, usb/gadget/omap_udc.c}

* tag 'random_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/random: (33 commits)
  random: mix in architectural randomness in extract_buf()
  dmi: Feed DMI table to /dev/random driver
  random: Add comment to random_initialize()
  random: final removal of IRQF_SAMPLE_RANDOM
  um: remove IRQF_SAMPLE_RANDOM which is now a no-op
  sparc/ldc: remove IRQF_SAMPLE_RANDOM which is now a no-op
  [ARM] pxa: remove IRQF_SAMPLE_RANDOM which is now a no-op
  board-palmz71: remove IRQF_SAMPLE_RANDOM which is now a no-op
  isp1301_omap: remove IRQF_SAMPLE_RANDOM which is now a no-op
  pxa25x_udc: remove IRQF_SAMPLE_RANDOM which is now a no-op
  omap_udc: remove IRQF_SAMPLE_RANDOM which is now a no-op
  goku_udc: remove IRQF_SAMPLE_RANDOM which was commented out
  uartlite: remove IRQF_SAMPLE_RANDOM which is now a no-op
  drivers: hv: remove IRQF_SAMPLE_RANDOM which is now a no-op
  xen-blkfront: remove IRQF_SAMPLE_RANDOM which is now a no-op
  n2_crypto: remove IRQF_SAMPLE_RANDOM which is now a no-op
  pda_power: remove IRQF_SAMPLE_RANDOM which is now a no-op
  i2c-pmcmsp: remove IRQF_SAMPLE_RANDOM which is now a no-op
  input/serio/hp_sdc.c: remove IRQF_SAMPLE_RANDOM which is now a no-op
  mfd: remove IRQF_SAMPLE_RANDOM which is now a no-op
  ...
2012-07-31 19:07:42 -07:00
Linus Torvalds 4b24ff7110 The tag contains just a few battery-related changes for v3.6. It's is
all pretty straightforward, except one thing.
 
 One of our patches added thermal support for power supply class, but
 thermal/ subsystem changed under our feet. We (well, Stephen, that is)
 caught the issue and it was decided[1] that I'd just delay the battery
 pull request, and then will fix it up by merging upstream back into
 battery tree at the specific commit.
 
 That's not all though: another[2] small fixup for thermal subsystem was
 needed to get rid of a warning in power supply subsystem (the warning
 was not drivers/power's "fault", the thermal registration function just
 needed a proper const annotation, which is also done by a small commit
 on top of the merge.
 
 So, to sum this up:
 - The 'master' branch of the battery tree was in the -next tree for
   weeks, was never rebased, altered etc. It should be all OK;
 - Although, for-v3.6 tag contains the 'master' branch + merge + the
   warning fix.
 
 [1] http://lkml.org/lkml/2012/6/19/23
 [2] http://lkml.org/lkml/2012/6/18/28
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.18 (GNU/Linux)
 
 iQIcBAABAgAGBQJQF9V8AAoJEGgI9fZJve1bLvkP/j/Nt1fBud2w5Q/NJr310hYJ
 NWIMSJwFbMhPoNd7sESznogXH8eHQ6YJP+CmkA5Gxr0t8pjEEJHEEyEcf1eNv6/c
 YDZfDB3TIaeYzulvRUkXMQ1f7hiA5Bq2t13yXeMM19+r9DzNZ51jZ3TXETLkpWZG
 BfZPg5wmP0xssXB3fjJMWuW5hVEc503WLpLFXkWfWKMU3PGdy/8DckV/YLvf2l7K
 1fkBLZry0gtruKqFbwcXhanP1JQ8FFFO8n1tSVLJhXXoym5twn/5GAgcpcKSFfJg
 mkGXAQLLuXKfERBIda7qbQl74HmTzYadCcueeXy1hTpom+VwfOpG+by2t/FrXT/M
 aJW6hfSLMgicG8FIuSYqbkutvijU9srU/YI00zrSGDBgi4sGKChRMf4sKQXnHO7X
 Lb7csQ7hEWsfG5gkgjRkmgZdhqWYoIxxe5Gv2Z9MKF27mHoSM03KHiZGlDJMrmNs
 w4KcU5H9tA62dT/UFszuu7NZenmsVS/ktiHWe5k+EXElZMZRrxKDJk2cvLPkRz/E
 VkXGvAmTDYPasZm29yzTnPKcuo6pfeOVJnUWybHOYxhkqAhJu1QzHCatqapgfy8E
 F2ODI5FoWtQES96B9t3tY4lTzq/0yUHcbiJt4BsyRcCGP+ggEQjCq0HGqOca12XX
 gxE20O3l+YQTCQIYKH+S
 =1NaS
 -----END PGP SIGNATURE-----

Merge tag 'for-v3.6' of git://git.infradead.org/battery-2.6

Pull battery updates from Anton Vorontsov:
 "The tag contains just a few battery-related changes for v3.6.  It's is
  all pretty straightforward, except one thing.

  One of our patches added thermal support for power supply class, but
  thermal/ subsystem changed under our feet.  We (well, Stephen, that
  is) caught the issue and it was decided[1] that I'd just delay the
  battery pull request, and then will fix it up by merging upstream back
  into battery tree at the specific commit.

  That's not all though: another[2] small fixup for thermal subsystem
  was needed to get rid of a warning in power supply subsystem (the
  warning was not drivers/power's "fault", the thermal registration
  function just needed a proper const annotation, which is also done by
  a small commit on top of the merge.

  So, to sum this up:
   - The 'master' branch of the battery tree was in the -next tree for
     weeks, was never rebased, altered etc.  It should be all OK;
   - Although, for-v3.6 tag contains the 'master' branch + merge + the
     warning fix.

  [1] http://lkml.org/lkml/2012/6/19/23
  [2] http://lkml.org/lkml/2012/6/18/28"

* tag 'for-v3.6' of git://git.infradead.org/battery-2.6: (23 commits)
  thermal: Constify 'type' argument for the registration routine
  olpc-battery: update CHARGE_FULL_DESIGN property for BYD LiFe batteries
  olpc-battery: Add VOLTAGE_MAX_DESIGN property
  charger-manager: Fix build break related to EXTCON
  lp8727_charger: Move header file into platform_data directory
  power_supply: Add min/max alert properties for CAPACITY, TEMP, TEMP_AMBIENT
  bq27x00_battery: Add support for BQ27425 chip
  charger-manager: Set current limit of regulator for over current protection
  charger-manager: Use EXTCON Subsystem to detect charger cables for charging
  test_power: Add VOLTAGE_NOW and BATTERY_TEMP properties
  test_power: Add support for USB AC source
  gpio-charger: Use cansleep version of gpio_set_value
  bq27x00_battery: Add support for power average and health properties
  sbs-battery: Don't trigger false supply_changed event
  twl4030_charger: Allow charger to control the regulator that feeds it
  twl4030_charger: Add backup-battery charging
  twl4030_charger: Fix some typos
  max17042_battery: Support CHARGE_COUNTER power supply attribute
  smb347-charger: Add constant charge and current properties
  power_supply: Add constant charge_current and charge_voltage properties
  ...
2012-07-31 18:08:25 -07:00