17 Jul, 2011

1 commit

  • Structs battery_file, acpi_dock_ops, file_operations,
    thermal_cooling_device_ops, thermal_zone_device_ops, kernel_param_ops
    are not changed in runtime. It is safe to make them const.
    register_hotplug_dock_device() was altered to take const "ops" argument
    to respect acpi_dock_ops' const notion.

    Signed-off-by: Vasiliy Kulikov
    Acked-by: Jeff Garzik
    Signed-off-by: Len Brown

    Vasiliy Kulikov
     

12 Jan, 2011

1 commit

  • Use the new function acpi_bus_update_power() for manipulating power
    resources used by ACPI fan devices, which allows them to be put into
    the right state during initialization and resume. Consequently,
    remove the flags.force_power_state field from struct acpi_device,
    which is not necessary any more.

    Signed-off-by: Rafael J. Wysocki
    Signed-off-by: Len Brown

    Rafael J. Wysocki
     

16 Oct, 2010

1 commit

  • Remove deprecated ACPI Fan driver procfs interface.

    The ACPI fan driver (CONFIG_ACPI_FAN) selects
    the generic thermal sysfs driver (CONFIG_THERMAL) since 2.6.26,
    so new sysfs I/F is available at /sys/class/thermal/cooling_devicecX/

    Signed-off-by: Zhang Rui
    Signed-off-by: Len Brown

    Zhang Rui
     

30 Sep, 2010

1 commit


10 Jun, 2010

1 commit

  • The code block braced with CONFIG_ACPI_PROCFS is unblanced. When
    CONFIG_ACPI_PROCFS=n, kernel trace will be produced like:

    Call Trace:
    [] ? remove_proc_entry+0x20d/0x290
    [] ? remove_proc_entry+0x20d/0x290
    [] warn_slowpath_common+0x6c/0xc0
    [] ? remove_proc_entry+0x20d/0x290
    [] warn_slowpath_fmt+0x26/0x30
    [] remove_proc_entry+0x20d/0x290
    [] ? proc_register+0x117/0x1f0
    [] ? proc_mkdir_mode+0x33/0x50
    [] ? acpi_fan_init+0x0/0x2c
    [] acpi_fan_init+0x23/0x2c
    [] do_one_initcall+0x23/0x180
    [] ? init_irq_proc+0x67/0x80
    [] kernel_init+0x13c/0x20e
    [] ? schedule_tail+0x20/0x90
    [] ? syscall_exit+0x5/0x16
    [] ? kernel_init+0x0/0x20e
    [] ? kernel_init+0x0/0x20e
    [] kernel_thread_helper+0x6/0x30
    ---[ end trace a7919e7f17c0a725 ]---

    Then also bracket later error checking code with ACPI_PROCFS
    option to avoid mismatch problem.

    Signed-off-by: Liang Li
    Signed-off-by: Len Brown

    Liang Li
     

16 Dec, 2009

1 commit

  • This message shows up for each cpu. Print as debug messages.

    [ 12.893967] processor ACPI0007:00: registered as cooling_device0
    [ 12.907838] processor ACPI0007:01: registered as cooling_device1

    Signed-off-by: Mike Travis
    Cc: Ingo Molnar
    Cc: linux-acpi@vger.kernel.org
    Cc: linux-kernel@vger.kernel.org
    Signed-off-by: Len Brown

    Mike Travis
     

29 Aug, 2009

1 commit

  • Linux/ACPI core files using internal.h all PREFIX "ACPI: ",
    however, not all ACPI drivers use/want it -- and they
    should not have to #undef PREFIX to define their own.

    Add GPL commment to internal.h while we are there.

    This does not change any actual console output,
    asside from a whitespace fix.

    Signed-off-by: Len Brown

    Len Brown
     

05 Apr, 2009

1 commit


31 Mar, 2009

1 commit

  • Setting ->owner as done currently (pde->owner = THIS_MODULE) is racy
    as correctly noted at bug #12454. Someone can lookup entry with NULL
    ->owner, thus not pinning enything, and release it later resulting
    in module refcount underflow.

    We can keep ->owner and supply it at registration time like ->proc_fops
    and ->data.

    But this leaves ->owner as easy-manipulative field (just one C assignment)
    and somebody will forget to unpin previous/pin current module when
    switching ->owner. ->proc_fops is declared as "const" which should give
    some thoughts.

    ->read_proc/->write_proc were just fixed to not require ->owner for
    protection.

    rmmod'ed directories will be empty and return "." and ".." -- no harm.
    And directories with tricky enough readdir and lookup shouldn't be modular.
    We definitely don't want such modular code.

    Removing ->owner will also make PDE smaller.

    So, let's nuke it.

    Kudos to Jeff Layton for reminding about this, let's say, oversight.

    http://bugzilla.kernel.org/show_bug.cgi?id=12454

    Signed-off-by: Alexey Dobriyan

    Alexey Dobriyan
     

20 Feb, 2009

1 commit


08 Nov, 2008

1 commit


23 Oct, 2008

2 commits

  • Len Brown
     
  • ACPI_DB_ERROR and ACPI_DB_WARN were removed from ACPICA core.
    So replace ACPI_DEBUG_PRINT((ACPI_DB_ERROR, ...) with printk(KERN_ERR PREFIX ...)
    and ACPI_DEBUG_PRINT((ACPI_DB_WARN, ...) with printk(KERN_WARNING PREFIX ...)

    We do not use ACPI_ERROR/ACPI_WARNING since they're not exported, see
    -------------------------------------------------------------
    commit 6468463abd7051fcc29f3ee7c931f9bbbb26f5a4
    Author: Len Brown
    Date: Mon Jun 26 23:41:38 2006 -0400

    ACPI: un-export ACPI_ERROR() -- use printk(KERN_ERR...)

    Signed-off-by: Len Brown
    -------------------------------------------------------------

    Signed-off-by: Lin Ming
    Signed-off-by: Len Brown

    Lin Ming
     

11 Oct, 2008

1 commit


22 Jul, 2008

1 commit


17 Jul, 2008

1 commit

  • Under /proc/acpi, there is a fan control interface, a user can
    set 0 or 3 to /proc/acpi/fan/*/state, 0 denotes D0 state, 3
    denotes D3 state, but in current implementation, a user can
    set a fan to D1 state by any char excluding '1', '2' and '3'.

    For example:

    [root@localhost acpi]# cat /proc/acpi/fan/C31B/state
    status: off
    [root@localhost acpi]# echo "" > /proc/acpi/fan/C31B/state
    [root@localhost acpi]# cat /proc/acpi/fan/C31B/state
    status: on
    [root@localhost acpi]# echo "3" > /proc/acpi/fan/C31B/state
    [root@localhost acpi]# cat /proc/acpi/fan/C31B/state
    status: off
    [root@localhost acpi]# echo "xxxxx" > /proc/acpi/fan/C31B/state
    [root@localhost acpi]# cat /proc/acpi/fan/C31B/state
    status: on

    Obviously, such inputs as "" and "xxxxx" are invalid for fan state.

    This patch fixes this issue, it strictly limits fan state only to
    accept 0, 1, 2 and 3, any other inputs are invalid.

    Before applying this patch, the test result is:

    [root@localhost acpi]# cat /proc/acpi/fan/C31B/state
    status: off
    [root@localhost acpi]# echo "" > /proc/acpi/fan/C31B/state
    [root@localhost acpi]# cat /proc/acpi/fan/C31B/state
    status: on
    [root@localhost acpi]# echo "3" > /proc/acpi/fan/C31B/state
    [root@localhost acpi]# cat /proc/acpi/fan/C31B/state
    status: off
    [root@localhost acpi]# echo "xxxxx" > /proc/acpi/fan/C31B/state
    [root@localhost acpi]# cat /proc/acpi/fan/C31B/state
    status: on
    [root@localhost acpi]# echo "3" > /proc/acpi/fan/C31B/state
    [root@localhost acpi]# cat /proc/acpi/fan/C31B/state
    status: off
    [root@localhost acpi]# echo "3x" > /proc/acpi/fan/C31B/state
    [root@localhost acpi]# cat /proc/acpi/fan/C31B/state
    status: off
    [root@localhost acpi]# echo "-1x" > /proc/acpi/fan/C31B/state
    [root@localhost acpi]# cat /proc/acpi/fan/C31B/state
    status: on
    [root@localhost acpi]#

    After applying this patch, the test result is:

    [root@localhost ~]# cat /proc/acpi/fan/C31B/state
    status: off
    [root@localhost ~]# echo "" > /proc/acpi/fan/C31B/state
    -bash: echo: write error: Invalid argument
    [root@localhost ~]# cat /proc/acpi/fan/C31B/state
    status: off
    [root@localhost ~]# echo "3" > /proc/acpi/fan/C31B/state
    [root@localhost ~]# cat /proc/acpi/fan/C31B/state
    status: off
    [root@localhost ~]# echo "xxxxx" > /proc/acpi/fan/C31B/state
    -bash: echo: write error: Invalid argument
    [root@localhost ~]# cat /proc/acpi/fan/C31B/state
    status: off
    [root@localhost ~]# echo "-1x" > /proc/acpi/fan/C31B/state
    -bash: echo: write error: Invalid argument
    [root@localhost ~]# cat /proc/acpi/fan/C31B/state
    status: off
    [root@localhost ~]# echo "0" > //proc/acpi/fan/C31B/state
    [root@localhost ~]# cat /proc/acpi/fan/C31B/state
    status: on
    [root@localhost ~]# echo "4" > //proc/acpi/fan/C31B/state
    -bash: echo: write error: Invalid argument
    [root@localhost ~]# cat /proc/acpi/fan/C31B/state
    status: on
    [root@localhost ~]# echo "3" > //proc/acpi/fan/C31B/state
    [root@localhost ~]# cat /proc/acpi/fan/C31B/state
    status: off
    [root@localhost ~]# echo "0" > //proc/acpi/fan/C31B/state
    [root@localhost ~]# cat /proc/acpi/fan/C31B/state
    status: on
    [root@localhost ~]# echo "3x" > //proc/acpi/fan/C31B/state
    -bash: echo: write error: Invalid argument
    [root@localhost ~]#

    Signed-off-by: Yi Yang
    Signed-off-by: Andi Kleen
    Acked-by: Zhang Rui
    Signed-off-by: Len Brown

    Yi Yang
     

01 May, 2008

1 commit

  • * 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: (179 commits)
    ACPI: Fix acpi_processor_idle and idle= boot parameters interaction
    acpi: fix section mismatch warning in pnpacpi
    intel_menlo: fix build warning
    ACPI: Cleanup: Remove unneeded, multiple local dummy variables
    ACPI: video - fix permissions on some proc entries
    ACPI: video - properly handle errors when registering proc elements
    ACPI: video - do not store invalid entries in attached_array list
    ACPI: re-name acpi_pm_ops to acpi_suspend_ops
    ACER_WMI/ASUS_LAPTOP: fix build bug
    thinkpad_acpi: fix possible NULL pointer dereference if kstrdup failed
    ACPI: check a return value correctly in acpi_power_get_context()
    #if 0 acpi/bay.c:eject_removable_drive()
    eeepc-laptop: add hwmon fan control
    eeepc-laptop: add backlight
    eeepc-laptop: add base driver
    ACPI: thinkpad-acpi: bump up version to 0.20
    ACPI: thinkpad-acpi: fix selects in Kconfig
    ACPI: thinkpad-acpi: use a private workqueue
    ACPI: thinkpad-acpi: fluff really minor fix
    ACPI: thinkpad-acpi: use uppercase for "LED" on user documentation
    ...

    Fixed conflicts in drivers/acpi/video.c and drivers/misc/intel_menlow.c
    manually.

    Linus Torvalds
     

29 Apr, 2008

2 commits

  • Use proc_create()/proc_create_data() to make sure that ->proc_fops and ->data
    be setup before gluing PDE to main tree.

    Add correct ->owner to proc_fops to fix reading/module unloading race.

    Signed-off-by: Denis V. Lunev
    Cc: Len Brown
    Cc: Alexey Dobriyan
    Cc: "Eric W. Biederman"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Denis V. Lunev
     
  • thermal_cooling_device_register used to return NULL if THERMAL is "n".
    As the ACPI fan, processor and video drivers SELECT the generic
    thermal in PATCH 01, this is not a problem any more.

    Signed-off-by: Julia Lawall
    Signed-off-by: Zhang Rui
    Signed-off-by: Len Brown

    Julia Lawall
     

29 Mar, 2008

1 commit

  • Revert commit 1192aeb957402b45f311895f124e4ca41206843c ("ACPI:
    drivers/acpi: elide a non-zero test on a result that is never 0")
    because it turns out that thermal_cooling_device_register() does
    actually return NULL if CONFIG_THERMAL is turned off (then the routine
    turns into a dummy inline routine in the header files that returns NULL
    unconditionally).

    This was found with randconfig testing, causing a crash during bootup:

    initcall 0x78878534 ran for 13 msecs: acpi_button_init+0x0/0x51()
    Calling initcall 0x78878585: acpi_fan_init+0x0/0x2c()
    BUG: unable to handle kernel NULL pointer dereference at 00000000
    IP: [] acpi_fan_add+0x7d/0xfd
    *pde = 00000000
    Oops: 0000 [#1]
    Modules linked in:

    Pid: 1, comm: swapper Not tainted (2.6.25-rc7-sched-devel.git-x86-latest.git #14)
    EIP: 0060:[] EFLAGS: 00010246 CPU: 0
    EIP is at acpi_fan_add+0x7d/0xfd
    EAX: b787c718 EBX: b787c400 ECX: b782ceb4 EDX: 00000007
    ESI: 00000000 EDI: b787c6f4 EBP: b782cee0 ESP: b782cecc
    DS: 007b ES: 007b FS: 0000 GS: 0000 SS: 0068
    Process swapper (pid: 1, ti=b782c000 task=b7846000 task.ti=b782c000)
    Stack: b787c459 00000000 b787c400 78790888 b787c60c b782cef8 782b6fb8 ffffffda
    b787c60c 00000000 78790958 b782cf0c 783005d7 b787c60c 78790958 78790584
    b782cf1c 783007f6 b782cf28 00000000 b782cf40 782ffc4a 78790958 b794d558
    Call Trace:
    [] ? acpi_device_probe+0x3e/0xdb
    [] ? driver_probe_device+0x82/0xfc
    [] ? __driver_attach+0x3a/0x70
    [] ? bus_for_each_dev+0x3e/0x60
    [] ? driver_attach+0x14/0x16
    [] ? __driver_attach+0x0/0x70
    [] ? bus_add_driver+0x9d/0x1b0
    [] ? driver_register+0x47/0xa3
    [] ? timespec_to_ktime+0x9/0xc
    [] ? acpi_bus_register_driver+0x3a/0x3c
    [] ? acpi_fan_init+0xd/0x2c
    [] ? kernel_init+0xac/0x1f9
    [] ? kernel_init+0x0/0x1f9
    [] ? kernel_thread_helper+0x7/0x10
    =======================
    Code: 6e 78 e8 57 44 e7 ff 58 e9 93 00 00 00 8b 55 f0 8d bb f4 02 00 00 80 4b 2d 10 8b 03 e8 87 cb ff ff 8d 83 18 03 00 00 80 63 2d ef 35 00 00 00 00 50 68 e8 9c 6e 78 e8 22 44 e7 ff b9 b6 9c 6e
    EIP: [] acpi_fan_add+0x7d/0xfd SS:ESP 0068:b782cecc
    ---[ end trace 778e504de7e3b1e3 ]---
    Kernel panic - not syncing: Attempted to kill init!

    Signed-off-by: Ingo Molnar
    Acked-by: Julia Lawall
    Signed-off-by: Linus Torvalds

    Ingo Molnar
     

27 Mar, 2008

1 commit

  • The function thermal_cooling_device_register always returns either a valid
    pointer or a value made with ERR_PTR, so a test for non-zero on the result
    will always succeed.

    The problem was found using the following semantic match.
    (http://www.emn.fr/x-info/coccinelle/)

    //
    @a@
    expression E, E1;
    statement S,S1;
    position p;
    @@

    E = thermal_cooling_device_register(...)
    ... when != E = E1
    if@p (E) S else S1

    @n@
    position a.p;
    expression E,E1;
    statement S,S1;
    @@

    E = NULL
    ... when != E = E1
    if@p (E) S else S1

    @depends on !n@
    expression E;
    statement S,S1;
    position a.p;
    @@

    * if@p (E)
    S else S1
    //

    Signed-off-by: Julia Lawall
    Signed-off-by: Andrew Morton
    Signed-off-by: Len Brown

    Julia Lawall
     

16 Feb, 2008

1 commit


02 Feb, 2008

2 commits


24 Jan, 2008

1 commit


26 Oct, 2007

2 commits


24 Jul, 2007

1 commit


13 Feb, 2007

3 commits

  • Cosmetic only.

    Except in a single case, #define ACPI_*_DRIVER_NAME
    were invoked 0 or 1 times.

    Signed-off-by: Len Brown

    Len Brown
     
  • It was erroneously used as a description rather than a name.

    ie. turn this:

    lenb@se7525gp2:/sys> ls bus/acpi/drivers
    ACPI AC Adapter Driver ACPI Embedded Controller Driver ACPI Power Resource Driver
    ACPI Battery Driver ACPI Fan Driver ACPI Processor Driver
    ACPI Button Driver ACPI PCI Interrupt Link Driver ACPI Thermal Zone Driver
    ACPI container driver ACPI PCI Root Bridge Driver hpet

    into this:

    lenb@se7525gp2:~> ls /sys/bus/acpi/drivers
    ac battery button container ec fan hpet pci_link pci_root power processor thermal

    Signed-off-by: Len Brown

    Len Brown
     
  • cosmetic only

    Make "module name" actually match the file name.
    Invoke with ';' as leaving it off confuses Lindent and gcc doesn't care.
    Fix indentation where Lindent did get confused.

    Signed-off-by: Len Brown

    Len Brown
     

03 Feb, 2007

1 commit


21 Dec, 2006

1 commit


16 Dec, 2006

1 commit

  • Add ACPI bus_type for Linux driver model.

    1. .shutdown method is added into acpi_driver.ops
    needed by bus_type operations.
    2. remove useless parameter 'int state' in .resume method.
    3. change parameter 'int state'
    to 'pm_message_t state' in .suspend method.

    Note: The new .uevent method mark ACPI drivers by PNPID instead of by name.
    Udev script needs to look for "HWID=" or "COMPTID=" to load
    ACPI drivers as a result.

    Signed-off-by: Li Shaohua
    Signed-off-by: Zhang Rui
    Signed-off-by: Len Brown

    Patrick Mochel
     

14 Oct, 2006

1 commit


10 Jul, 2006

1 commit


30 Jun, 2006

3 commits


27 Jun, 2006

1 commit