1. 01 7月, 2012 1 次提交
  2. 08 5月, 2012 1 次提交
  3. 04 1月, 2012 1 次提交
  4. 06 8月, 2011 1 次提交
    • S
      Battery: sysfs_remove_battery(): possible circular locking · 69d94ec6
      Sergey Senozhatsky 提交于
      Commit 9c921c22
      Author: Lan Tianyu <tianyu.lan@intel.com>
      
          ACPI / Battery: Resolve the race condition in the sysfs_remove_battery()
      
      fixed BUG https://bugzilla.kernel.org/show_bug.cgi?id=35642 , but as a side
      effect made lockdep unhappy with sysfs_remove_battery():
      
      [14818.477168]
      [14818.477170] =======================================================
      [14818.477200] [ INFO: possible circular locking dependency detected ]
      [14818.477221] 3.1.0-dbg-07865-g1280ea8-dirty #668
      [14818.477236] -------------------------------------------------------
      [14818.477257] s2ram/1599 is trying to acquire lock:
      [14818.477276]  (s_active#8){++++.+}, at: [<ffffffff81169147>] sysfs_addrm_finish+0x31/0x5a
      [14818.477323]
      [14818.477325] but task is already holding lock:
      [14818.477350]  (&battery->lock){+.+.+.}, at: [<ffffffffa0047278>] sysfs_remove_battery+0x10/0x4b [battery]
      [14818.477395]
      [14818.477397] which lock already depends on the new lock.
      [14818.477399]
      [..]
      [14818.479121] stack backtrace:
      [14818.479148] Pid: 1599, comm: s2ram Not tainted 3.1.0-dbg-07865-g1280ea8-dirty #668
      [14818.479175] Call Trace:
      [14818.479198]  [<ffffffff814828c3>] print_circular_bug+0x293/0x2a4
      [14818.479228]  [<ffffffff81070cb5>] __lock_acquire+0xfe4/0x164b
      [14818.479260]  [<ffffffff81169147>] ? sysfs_addrm_finish+0x31/0x5a
      [14818.479288]  [<ffffffff810718d2>] lock_acquire+0x138/0x1ac
      [14818.479316]  [<ffffffff81169147>] ? sysfs_addrm_finish+0x31/0x5a
      [14818.479345]  [<ffffffff81168a79>] sysfs_deactivate+0x9b/0xec
      [14818.479373]  [<ffffffff81169147>] ? sysfs_addrm_finish+0x31/0x5a
      [14818.479405]  [<ffffffff81169147>] sysfs_addrm_finish+0x31/0x5a
      [14818.479433]  [<ffffffff81167bc5>] sysfs_hash_and_remove+0x54/0x77
      [14818.479461]  [<ffffffff811681b9>] sysfs_remove_file+0x12/0x14
      [14818.479488]  [<ffffffff81385bf8>] device_remove_file+0x12/0x14
      [14818.479516]  [<ffffffff81386504>] device_del+0x119/0x17c
      [14818.479542]  [<ffffffff81386575>] device_unregister+0xe/0x1a
      [14818.479570]  [<ffffffff813c6ef9>] power_supply_unregister+0x23/0x27
      [14818.479601]  [<ffffffffa004729c>] sysfs_remove_battery+0x34/0x4b [battery]
      [14818.479632]  [<ffffffffa004778f>] battery_notify+0x2c/0x3a [battery]
      [14818.479662]  [<ffffffff8148fe82>] notifier_call_chain+0x74/0xa1
      [14818.479692]  [<ffffffff810624b4>] __blocking_notifier_call_chain+0x6c/0x89
      [14818.479722]  [<ffffffff810624e0>] blocking_notifier_call_chain+0xf/0x11
      [14818.479751]  [<ffffffff8107e40e>] pm_notifier_call_chain+0x15/0x27
      [14818.479770]  [<ffffffff8107ee1a>] enter_state+0xa7/0xd5
      [14818.479782]  [<ffffffff8107e341>] state_store+0xaa/0xc0
      [14818.479795]  [<ffffffff8107e297>] ? pm_async_store+0x45/0x45
      [14818.479807]  [<ffffffff81248837>] kobj_attr_store+0x17/0x19
      [14818.479820]  [<ffffffff81167e27>] sysfs_write_file+0x103/0x13f
      [14818.479834]  [<ffffffff81109037>] vfs_write+0xad/0x13d
      [14818.479847]  [<ffffffff811092b2>] sys_write+0x45/0x6c
      [14818.479860]  [<ffffffff81492f92>] system_call_fastpath+0x16/0x1b
      
      This patch introduces separate lock to struct acpi_battery to
      grab in sysfs_remove_battery() instead of battery->lock.
      So fix by Lan Tianyu is still there, we just grab independent lock.
      Signed-off-by: NSergey Senozhatsky <sergey.senozhatsky@gmail.com>
      Tested-by: NLan Tianyu <tianyu.lan@intel.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      69d94ec6
  5. 21 7月, 2011 1 次提交
    • P
      treewide: fix potentially dangerous trailing ';' in #defined values/expressions · 497888cf
      Phil Carmody 提交于
      All these are instances of
        #define NAME value;
      or
        #define NAME(params_opt) value;
      
      These of course fail to build when used in contexts like
        if(foo $OP NAME)
        while(bar $OP NAME)
      and may silently generate the wrong code in contexts such as
        foo = NAME + 1;    /* foo = value; + 1; */
        bar = NAME - 1;    /* bar = value; - 1; */
        baz = NAME & quux; /* baz = value; & quux; */
      
      Reported on comp.lang.c,
      Message-ID: <ab0d55fe-25e5-482b-811e-c475aa6065c3@c29g2000yqd.googlegroups.com>
      Initial analysis of the dangers provided by Keith Thompson in that thread.
      
      There are many more instances of more complicated macros having unnecessary
      trailing semicolons, but this pile seems to be all of the cases of simple
      values suffering from the problem. (Thus things that are likely to be found
      in one of the contexts above, more complicated ones aren't.)
      Signed-off-by: NPhil Carmody <ext-phil.2.carmody@nokia.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      497888cf
  6. 17 7月, 2011 3 次提交
  7. 14 7月, 2011 6 次提交
  8. 23 3月, 2011 1 次提交
  9. 21 1月, 2011 1 次提交
  10. 12 1月, 2011 2 次提交
  11. 25 12月, 2010 1 次提交
  12. 10 12月, 2010 1 次提交
  13. 24 10月, 2010 1 次提交
    • R
      ACPI / Battery: Return -ENODEV for unknown values in get_property() · a1b4bd69
      Rafael J. Wysocki 提交于
      The function acpi_battery_get_property() is called by the
      power supply framework's function power_supply_show_property()
      implementing the sysfs interface for power supply devices as the
      ACPI battery driver's ->get_property() callback.  Thus it is supposed
      to return error code if the value of the given property is unknown.
      Unfortunately, however, it returns 0 in those cases and puts a
      wrong (negative) value into the intval field of the
      union power_supply_propval object provided by
      power_supply_show_property().  In consequence, wrong negative
      values are read by user space from the battery's sysfs files.
      
      Fix this by making acpi_battery_get_property() return -ENODEV
      for properties with unknown values (-ENODEV is returned, because
      power_supply_uevent() returns with error for any other error code
      returned by power_supply_show_property()).
      Reported-and-tested-by: NSitsofe Wheeler <sitsofe@yahoo.com>
      Signed-off-by: NRafael J. Wysocki <rjw@sisk.pl>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      a1b4bd69
  14. 22 10月, 2010 1 次提交
  15. 16 10月, 2010 1 次提交
  16. 31 8月, 2010 1 次提交
  17. 07 7月, 2010 1 次提交
  18. 05 4月, 2010 2 次提交
  19. 30 3月, 2010 1 次提交
    • T
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking... · 5a0e3ad6
      Tejun Heo 提交于
      include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h
      
      percpu.h is included by sched.h and module.h and thus ends up being
      included when building most .c files.  percpu.h includes slab.h which
      in turn includes gfp.h making everything defined by the two files
      universally available and complicating inclusion dependencies.
      
      percpu.h -> slab.h dependency is about to be removed.  Prepare for
      this change by updating users of gfp and slab facilities include those
      headers directly instead of assuming availability.  As this conversion
      needs to touch large number of source files, the following script is
      used as the basis of conversion.
      
        http://userweb.kernel.org/~tj/misc/slabh-sweep.py
      
      The script does the followings.
      
      * Scan files for gfp and slab usages and update includes such that
        only the necessary includes are there.  ie. if only gfp is used,
        gfp.h, if slab is used, slab.h.
      
      * When the script inserts a new include, it looks at the include
        blocks and try to put the new include such that its order conforms
        to its surrounding.  It's put in the include block which contains
        core kernel includes, in the same order that the rest are ordered -
        alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
        doesn't seem to be any matching order.
      
      * If the script can't find a place to put a new include (mostly
        because the file doesn't have fitting include block), it prints out
        an error message indicating which .h file needs to be added to the
        file.
      
      The conversion was done in the following steps.
      
      1. The initial automatic conversion of all .c files updated slightly
         over 4000 files, deleting around 700 includes and adding ~480 gfp.h
         and ~3000 slab.h inclusions.  The script emitted errors for ~400
         files.
      
      2. Each error was manually checked.  Some didn't need the inclusion,
         some needed manual addition while adding it to implementation .h or
         embedding .c file was more appropriate for others.  This step added
         inclusions to around 150 files.
      
      3. The script was run again and the output was compared to the edits
         from #2 to make sure no file was left behind.
      
      4. Several build tests were done and a couple of problems were fixed.
         e.g. lib/decompress_*.c used malloc/free() wrappers around slab
         APIs requiring slab.h to be added manually.
      
      5. The script was run on all .h files but without automatically
         editing them as sprinkling gfp.h and slab.h inclusions around .h
         files could easily lead to inclusion dependency hell.  Most gfp.h
         inclusion directives were ignored as stuff from gfp.h was usually
         wildly available and often used in preprocessor macros.  Each
         slab.h inclusion directive was examined and added manually as
         necessary.
      
      6. percpu.h was updated not to include slab.h.
      
      7. Build test were done on the following configurations and failures
         were fixed.  CONFIG_GCOV_KERNEL was turned off for all tests (as my
         distributed build env didn't work with gcov compiles) and a few
         more options had to be turned off depending on archs to make things
         build (like ipr on powerpc/64 which failed due to missing writeq).
      
         * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
         * powerpc and powerpc64 SMP allmodconfig
         * sparc and sparc64 SMP allmodconfig
         * ia64 SMP allmodconfig
         * s390 SMP allmodconfig
         * alpha SMP allmodconfig
         * um on x86_64 SMP allmodconfig
      
      8. percpu.h modifications were reverted so that it could be applied as
         a separate patch and serve as bisection point.
      
      Given the fact that I had only a couple of failures from tests on step
      6, I'm fairly confident about the coverage of this conversion patch.
      If there is a breakage, it's likely to be something in one of the arch
      headers which should be easily discoverable easily on most builds of
      the specific arch.
      Signed-off-by: NTejun Heo <tj@kernel.org>
      Guess-its-ok-by: NChristoph Lameter <cl@linux-foundation.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
      5a0e3ad6
  20. 28 1月, 2010 1 次提交
  21. 16 1月, 2010 2 次提交
  22. 16 12月, 2009 1 次提交
  23. 30 8月, 2009 1 次提交
    • H
      ACPI battery: work around negative s16 battery current on Acer · bc76f90b
      Hector Martin 提交于
      Acer Aspire 8930G laptops (and possibly others) report the battery current
      as a 16-bit signed negative when it is charging.  It also reports it as
      0x10000 when the current is 0.  This patch adds a quirk for this which
      takes the absolute value of the reported current cast to an s16.  This is
      a DSDT bug present in the latest BIOS revision (the EC register is 16 bits
      signed and the DSDT attempts to take the 16-bit two's complement of this,
      which works for discharge but not charge.  It also breaks zero values
      because a 32-bit register is used and the high bits aren't thrown away).
      
      I've enabled this for all Acer systems which report in mA units.  This
      should be safe since it won't break compliant systems unless they report a
      current above 32A, which is insane.  The patch also detects the valid
      32-bit value -1, which indicates unknown status, and does not attempt the
      fix in that case (note that this does not conflict with 16-bit -1, which
      is 65535 as read normally and gets translated to 1mA).
      Signed-off-by: NHector Martin <hector@marcansoft.com>
      Acked-by: NAlexey Starikovskiy <astarikovskiy@suse.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      bc76f90b
  24. 29 8月, 2009 1 次提交
  25. 18 6月, 2009 2 次提交
  26. 12 4月, 2009 1 次提交
  27. 08 4月, 2009 1 次提交
  28. 05 4月, 2009 1 次提交
    • A
      ACPI: battery: asynchronous init · 0f66af53
      Arjan van de Ven 提交于
      The battery driver tends to take quite some time to initialize
      (100ms-300ms is quite typical).
      This patch initializes the batter driver asynchronously, so that other
      things in the kernel can initialize in parallel to this 300 msec.
      
      As part of this, the battery driver had to move to the back
      of the ACPI init order (hence the Makefile change).
      Without this move, the next ACPI driver would just block
      on the ACPI/devicee layer semaphores until the battery driver was
      done anyway, not gaining any boot time.
      Signed-off-by: NArjan van de Ven <arjan@linux.intel.com>
      Signed-off-by: NLen Brown <len.brown@intel.com>
      0f66af53
  29. 04 4月, 2009 1 次提交