aboutsummaryrefslogtreecommitdiff
path: root/drivers/acpi/dock.c
AgeCommit message (Collapse)Author
2009-04-05Merge branch 'linus' into releaseLen Brown
Conflicts: arch/x86/kernel/cpu/cpufreq/longhaul.c Signed-off-by: Len Brown <len.brown@intel.com>
2009-04-03dock: fix dereference after kfree()Dan Carpenter
dock_remove() calls kfree() on dock_station so we should use list_for_each_entry_safe() to avoid dereferencing freed memory. Found by smatch (http://repo.or.cz/w/smatch.git/). Compile tested. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Len Brown <len.brown@intel.com>
2009-03-24Driver core: implement uevent suppress in kobjectMing Lei
This patch implements uevent suppress in kobject and removes it from struct device, based on the following ideas: 1,Uevent sending should be one attribute of kobject, so suppressing it in kobject layer is more natural than in device layer. By this way, we can do it for other objects embedded with kobject. 2,It may save several bytes for each instance of struct device.(On my omap3(32bit ARM) based box, can save 8bytes per device object) This patch also introduces dev_set|get_uevent_suppress() helpers to set and query uevent_suppress attribute in case to help kobject as private part of struct device in future. [This version is against the latest driver-core patch set of Greg,please ignore the last version.] Signed-off-by: Ming Lei <tom.leiming@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-02-07Merge branches 'release', 'asus', 'bugzilla-12450', 'cpuidle', 'debug', ↵Len Brown
'ec', 'misc', 'printk' and 'processor' into release
2009-02-07ACPI: add missing KERN_* constants to printksFrank Seidel
According to kerneljanitors todo list all printk calls (beginning a new line) should have an according KERN_* constant. Those are the missing peaces here for the acpi subsystem. Signed-off-by: Frank Seidel <frank@f-seidel.de> Signed-off-by: Len Brown <len.brown@intel.com>
2009-02-06ACPI: dock: Don't eval _STA on every show_docked sysfs readHolger Macht
Some devices trigger a DEVICE_CHECK on every evalutation of _STA. This can also be seen in commit 8b59560a3baf2e7c24e0fb92ea5d09eca92805db (ACPI: dock: avoid check _STA method). If an undock is processed, the dock driver sends a uevent and userspace might read the show_docked property in sysfs. This causes an evaluation of _STA of the particular device which causes the dock driver to immediately dock again. In any case, evaluation of _STA (show_docked) does not necessarily mean that we are docked, so check with the internal device structure. http://bugzilla.kernel.org/show_bug.cgi?id=12360 Signed-off-by: Holger Macht <hmacht@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
2008-10-22Merge branch 'ull' into testLen Brown
Conflicts: drivers/acpi/bay.c drivers/acpi/dock.c drivers/ata/libata-acpi.c Signed-off-by: Len Brown <len.brown@intel.com>
2008-10-11ACPI: Change acpi_evaluate_integer to support 64-bit on 32-bit kernelsMatthew Wilcox
As of version 2.0, ACPI can return 64-bit integers. The current acpi_evaluate_integer only supports 64-bit integers on 64-bit platforms. Change the argument to take a pointer to an acpi_integer so we support 64-bit integers on all platforms. lenb: replaced use of "acpi_integer" with "unsigned long long" lenb: fixed bug in acpi_thermal_trips_update() Signed-off-by: Matthew Wilcox <willy@linux.intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2008-10-11Subject: ACPI dock: Use ACPI_EXCEPTION instead of printk(KERN_ERRThomas Renninger
lenb: stripped patch down to what still applied to new dock.c Signed-off-by: Thomas Renninger <trenn@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
2008-09-23dock: add 'type' sysfs fileShaohua Li
add a sysfs file to present dock type. Suggested by Holger. Signed-off-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2008-09-23dock: fix for ATA bay in a dock stationShaohua Li
an ATA bay can be in a dock and itself can be ejected separately. This patch handles such eject bay. Found by Holger. Signed-off-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2008-09-23dock: introduce .uevent for devices in dock, eg libataShaohua Li
dock's uevent reported itself, not ata. It might be difficult to find an ata device just according to a dock. This patch introduces docking ops for each device in a dock. when docking, dock driver can send device specific uevent. This should help dock station too (not just bay) Signed-off-by: Shaohua Li <shaohua.li@intel.com> Acked-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Len Brown <len.brown@intel.com>
2008-09-23libata: remove functions now handed by ACPI dock driverShaohua Li
dock driver can handle ata(bay) hotplug now. dock driver already handles _EJ0 and _STA, so remove them. Also libata doesn't need register notification handler anymore. Signed-off-by: Shaohua Li <shaohua.li@intel.com> Acked-by: Tejun Heo <htejun@gmail.com> Signed-off-by: Len Brown <len.brown@intel.com>
2008-09-23ACPI: fix hotplug raceZhang Rui
The hotplug notification handler and drivers' notification handler all run in one workqueue. Before hotplug removes an acpi device, the device driver's notification handler is already be recorded to run just after global notification handler. After hotplug notification handler runs, acpica will notice a NULL notification handler and crash. So now we run run hotplug in another workqueue and wait for all acpi notication handlers finish. This was found in battery hotplug, but actually all hotplug can be affected. Signed-off-by: Zhang Rui <rui.zhang@intel.com> Signed-off-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2008-09-23ACPI: introduce notifier change to avoid duplicatesShaohua Li
The battery driver already registers notification handler. To avoid registering notification handler again, introduce a notifier chain in global system notifier handler and use it in dock driver. Signed-off-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2008-09-23dock: add bay and battery hotplug supportShaohua Li
Make the dock driver support bay and battery hotplug. They are all regarded as dock, so handling can be unified. Signed-off-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2008-09-23dock: add _LCK supportShaohua Li
support _LCK method, which is a optional method for hotplug lenb: we have not seen _LCK used in the field yet Signed-off-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2008-09-23dock: fix eject request process (2.6.27-rc1 regression)Shaohua Li
commit 2a7feab28d3fc060d320eaba192e49dad1079b7e introduces a bug. My thinkpad actually will send an eject_request and we should follow the eject process to finish the eject, otherwise system still thinks the bay is present. Signed-off-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2008-09-23ACPI: dock: avoid check _STA methodShaohua Li
In some BIOSes, every _STA method call will send a notification again, this cause freeze. And in some BIOSes, it appears _STA should be called after _DCK. This tries to avoid calls _STA, and still keep the device present check. http://bugzilla.kernel.org/show_bug.cgi?id=10431 Signed-off-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2008-08-15ACPI: Properly clear flags on false-positives and send uevent on sudden unplugHolger Macht
Some devices emit a ACPI_NOTIFY_DEVICE_CHECK while physically unplugging even if the software undock has already been done and dock_present() check fails. However, the internal flags need to be cleared (complete_undock()). Also, even notify userspace if the dock station suddently went away without proper software undocking. This happens on a Acer TravelMate 3000 Signed-off-by: Holger Macht <hmacht@suse.de> Signed-off-by: Andi Kleen <ak@linux.intel.com>
2008-07-20APCI: revert duplicated patchThomas Gleixner
commit 816c2eda3ce8fa7eb62f22e01e2ec7a3f7d677c0 ("dock: bay: Don't call acpi_walk_namespace() when ACPI is disabled.") was merged between 2.6.26-rc8 and -rc9) Due to rebasing the ACPI tree via quilt the same patch got applied again via commit cc7e51666d82aedfd6b9a033ca1a10d71c21f1ca ("dock: bay: Don't call acpi_walk_namespace() when ACPI is disabled.") Revert it, as it is obviously bogus. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-16dock: bay: Don't call acpi_walk_namespace() when ACPI is disabled.Len Brown
Signed-off-by: Len Brown <len.brown@intel.com> Signed-off-by: Andi Kleen <ak@linux.intel.com>
2008-06-26dock: bay: Don't call acpi_walk_namespace() when ACPI is disabled.Len Brown
Signed-off-by: Len Brown <len.brown@intel.com>
2008-06-11dock.c remove trailing printk whitespaceTim Pepper
Signed-off-by: Tim Pepper <lnxninja@linux.vnet.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Len Brown <len.brown@intel.com>
2008-03-18ACPI: Set flag DOCK_UNDOCKING when triggered via sysfsHolger Macht
begin_undock() is only called when triggered via a acpi notify handler (pressing the undock button on the dock station), but complete_undock() is always called after the eject. So if a undock is triggered through a sysfs write, the flag DOCK_UNDOCKING has to be set for the dock station, too. Otherwise this will freeze the system hard. Signed-off-by: Holger Macht <hmacht@suse.de> Acked-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Len Brown <len.brown@intel.com>
2008-02-07Merge branches 'release' and 'fluff' into releaseLen Brown
Conflicts: drivers/acpi/scan.c include/linux/acpi.h Signed-off-by: Len Brown <len.brown@intel.com>
2008-02-07ACPI: misc cleanupsAdrian Bunk
This patch contains the following possible cleanups: - make the following needlessly global code static: - drivers/acpi/bay.c:dev_attr_eject - drivers/acpi/bay.c:dev_attr_present - drivers/acpi/dock.c:dev_attr_docked - drivers/acpi/dock.c:dev_attr_flags - drivers/acpi/dock.c:dev_attr_uid - drivers/acpi/dock.c:dev_attr_undock - drivers/acpi/pci_bind.c:acpi_pci_unbind() - drivers/acpi/pci_link.c:acpi_link_lock - drivers/acpi/sbs.c:acpi_sbs_callback() - drivers/acpi/sbshc.c:acpi_smbus_transaction() - drivers/acpi/sleep/main.c:acpi_sleep_prepare() - #if 0 the following unused global functions: - drivers/acpi/numa.c:acpi_unmap_pxm_to_node() - remove the following unused EXPORT_SYMBOL's: - acpi_register_gsi - acpi_unregister_gsi - acpi_strict - acpi_bus_receive_event - register_acpi_bus_type - unregister_acpi_bus_type - acpi_os_printf - acpi_os_sleep - acpi_os_stall - acpi_os_read_pci_configuration - acpi_os_create_semaphore - acpi_os_delete_semaphore - acpi_os_wait_semaphore - acpi_os_signal_semaphore - acpi_os_signal - acpi_pci_irq_enable - acpi_get_pxm Signed-off-by: Adrian Bunk <bunk@kernel.org> Acked-by: Alexey Starikovskiy <astarikovskiy@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
2007-12-08ACPI: Add autoload info to dock driverFrank Seidel
References: https://bugzilla.novell.com/show_bug.cgi?id=302482 Signed-off-by: Thomas Renninger <trenn@novell.com> Signed-off-by: Kay Sievers <kasievers@novell.com> Signed-off-by: Frank Seidel <fseidel@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
2007-08-11ACPI: dock: Send key=value pair instead of plain valueHolger Macht
Send key=value pair along with the uevent instead of a plain value so that userspace (udev) can handle it like common environment variables. Signed-off-by: Holger Macht <hmacht@suse.de> Acked-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Cc: Stephan Berberig <s.berberig@arcor.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
2007-07-18ACPI: dock: fix oops when _DCK evaluation failsDmitry Torokhov
Data returned by acpi_get_name in acpi_buffer is not acpi_object and therefore should not be cast to it, otherwise we'll get an nice oops trying to print error message. Also print name of the ACPI object corresponding to the docking station and elevate severity of the message printed when _DCK fails to KERN_ERR. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Cc: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2007-05-10ACPI: dock: send envp with ueventKristen Carlson Accardi
Send an env along with our KOBJ_CHANGE uevent so that user space has the option of checking for that to see if a dock or undock has occurred. Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2007-05-10ACPI: dock: unsuppress ueventsKristen Carlson Accardi
Platform devices may not send uevents by default - override the setting so that we can send uevents on dock/undock. Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2007-05-10ACPI: dock: add immediate_undock optionKristen Carlson Accardi
Allow the driver to be loaded with an option that will allow userspace to control whether the laptop is ejected immediately when the user presses the button, or only when the syfs undock file is written. if immediate_undock == 1, then when the user presses the undock button, the laptop will send an event to userspace to notify userspace of the undock, but then immediately undock without waiting for userspace. This is the current behavior, and I set this to be the default. if immediate_undock == 0, then when the user presses the undock button, the laptop will send an event to userspace and do nothing. User space can query the "flags" sysfs entry to determine if an undock request has been made by the user (if bit 1 is set). User space will then need to write the undock sysfs entry to complete the undocking process. Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2007-05-10ACPI: dock: use dynamically allocated platform deviceKristen Carlson Accardi
Get rid of no release function warnings by switching to dynamically allocating the platform_device and using the platform device release routine in the base driver. Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2007-05-10ACPI: dock: fix opps after dock driver fails to initializeChuck Ebbert
The driver tests the dock_station pointer for nonnull to check whether it has initialized properly. But in some cases dock_station will be non-null after being freed when driver init fails. Fix by zeroing the pointer after freeing. Signed-off-by: Chuck Ebbert <cebbert@redhat.com> Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2007-05-10ACPI: dock: cleanup the uid patchKristen Carlson Accardi
Make uid sysfs file error path free memory, and cleanup sysfs file when removing driver. Also fix CodingStyle violations. Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Cc: Illya A. Volynets-Evenbakh <ilya@total-knowledge.com> Signed-off-by: Len Brown <len.brown@intel.com>
2007-03-28ACPI: dock: use NULL for pointerRandy Dunlap
Use NULL instead of 0 for pointers: drivers/acpi/dock.c:677:75: warning: Using plain integer as NULL pointer Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Len Brown <len.brown@intel.com>
2007-03-09ACPI: dock: add access to ACPI docking station UIDIlya A. Volynets-Evenbakh
It is useful to know whether your laptop is docked or not, but it is even more useful to know which docking station it's docked to. Attached patch adds "uid" file to sysfs. Tested on Dell Latitude D600 with D/Dock. Patch is against official 2.6.20 release. Signed-off-by: Len Brown <len.brown@intel.com>
2007-02-12ACPI: delete extra #defines in /drivers/acpi/ driversLen Brown
Cosmetic only. Except in a single case, #define ACPI_*_DRIVER_NAME were invoked 0 or 1 times. Signed-off-by: Len Brown <len.brown@intel.com>
2007-02-12ACPI: clean up ACPI_MODULE_NAME() useLen 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@intel.com>
2007-02-03ACPI: dock: check if parent is on dockKristen Carlson Accardi
When determining if a device is on a dock station, we should check the parent of the device as well. Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2006-12-16Pull style into test branchLen Brown
Conflicts: drivers/acpi/button.c drivers/acpi/ec.c drivers/acpi/osl.c drivers/acpi/sbs.c
2006-12-16Pull bugfix into test branchLen Brown
Conflicts: kernel/power/disk.c
2006-12-14ACPI: dock: add uevent to indicate change in device statusKristen Carlson Accardi
Send a uevent to indicate a device change whenever we dock or undock, so that userspace may now check the dock status via sysfs. Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Holger Macht <hmacht@suse.de> Signed-off-by: Len Brown <len.brown@intel.com>
2006-12-07ACPI: dock: Fix symbol conflict between acpiphp and dockPrarit Bhargava
Fix bug which will cause acpiphp to not be able to load when dock.ko cannot load. Signed-off-by: Prarit Bhargava <prarit@redhat.com> Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2006-12-07ACPI: dock: Add a docked sysfs file to the dock driver.brandon@ifup.org
Add 2 sysfs files for user interface. 1) docked - 1/0 (read only) - indicates whether the software believes the laptop is docked in a docking station. 2) undock - (write only) - writing to this file causes the software to initiate an undock request to the firmware. Signed-off-by: Brandon Philips <brandon@ifup.org> Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2006-12-07ACPI: dock: fix build warningLen Brown
drivers/acpi/dock.c:689: warning: too many arguments for format Signed-off-by: Len Brown <len.brown@intel.com>
2006-12-07ACPI: dock: Make the dock station driver a platform device driver.Kristen Carlson Accardi
Make the dock station driver a platform device driver so that we can create sysfs entries under /sys/device/platform. Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2006-12-04[PATCH] severing fs.h, radix-tree.h -> sched.hAl Viro
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
2006-10-30ACPI: dock: use mutex instead of spinlockKristen Carlson Accardi
http://bugzilla.kernel.org/show_bug.cgi?id=7303 Use a mutex instead of a spinlock for locking the hotplug list because we need to call into the ACPI subsystem which might sleep. Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>