aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/dock.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2009-12-16Merge branch 'dock' into releaseLen Brown1-170/+91
Conflicts: drivers/acpi/dock.c Signed-off-by: Len Brown <len.brown@intel.com>
2009-12-16ACPI: dock: minor whitespace and style cleanupsAlex Chiang1-58/+45
Removed some stray whitespaces Added whitespace when needed for legibility Removed unneeded curly braces Removed useless void casts Removed unnecessary local variable initialization Renamed variables to help out with 80-column fixes Signed-off-by: Alex Chiang <achiang@hp.com> Acked-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2009-12-16ACPI: dock: add struct dock_station * directly to platform device dataAlex Chiang1-27/+13
Instead of adding a (struct dock_station **) to our dock device's platform data, we can add the (struct dock_station *) directly. This change saves us some ugly casting and improves readability. The cost of making this change is an extra 290 bytes of stack usage, but this is an infrequently called code-path and unlikely to cause the kernel to blow up. Signed-off-by: Alex Chiang <achiang@hp.com> Acked-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2009-12-16ACPI: dock: dock_add - hoist up platform_device_register_simple()Alex Chiang1-9/+7
Move the call to platform_device_register_simple so that we do it before allocating and initializing our struct dock_station. Signed-off-by: Alex Chiang <achiang@hp.com> Acked-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2009-12-16ACPI: dock: remove global 'dock_device_name'Alex Chiang1-2/+1
We only use it in one spot, so it probably gets optimized out, but there's still no need to use a global variable for this. Signed-off-by: Alex Chiang <achiang@hp.com> Acked-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2009-12-16ACPI: dock: combine add|alloc_dock_dependent_device (v2)Alex Chiang1-36/+19
There's no real need to have a separate allocation step when adding a dock dependent device. Combining the two functions is both logical and helps with legibility. Signed-off-by: Alex Chiang <achiang@hp.com> Acked-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2009-11-24ACPICA: Add post-order callback to acpi_walk_namespaceLin Ming1-4/+4
The existing interface only has a pre-order callback. This change adds an additional parameter for a post-order callback which will be more useful for bus scans. ACPICA BZ 779. Also update the external calls to acpi_walk_namespace. http://www.acpica.org/bugzilla/show_bug.cgi?id=779 Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2009-11-03ACPI: dock: convert sysfs attributes to an attribute_groupAlex Chiang1-57/+24
As suggested by Dmitry Torokhov, convert the individual sysfs attributes into an attribute group. This change eliminates quite a bit of copy/paste code in the error handling paths. Signed-off-by: Alex Chiang <achiang@hp.com> Reviewed-by: Dmitry Torokhov <dtor@mail.ru> Acked-by: Shaohua Li <shaohua.li@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2009-10-03ACPI: dock: fix "sibiling" typoAlex Chiang1-8/+8
Crossword clues as haikus: Snakes from the same brood fighting Jackson on a plane? sibilant siblings I guess Will Shortz's job is still secure. Signed-off-by: Alex Chiang <achiang@hp.com> Signed-off-by: Len Brown <len.brown@intel.com>
2009-09-19Merge branch 'acpica' into releaseLen Brown1-5/+3
2009-08-28ACPI: Move definition of PREFIX from acpi_bus.h to internal..hLen Brown1-0/+2
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@intel.com>
2009-08-27ACPICA: Major update for acpi_get_object_info external interfaceBob Moore1-5/+3
Completed a major update for the acpi_get_object_info external interface. Changes include: - Support for variable, unlimited length HID, UID, and CID strings - Support Processor objects the same as Devices (HID,UID,CID,ADR,STA, etc.) - Call the _SxW power methods on behalf of a device object - Determine if a device is a PCI root bridge - Change the ACPI_BUFFER parameter to ACPI_DEVICE_INFO. These changes will require an update to all callers of this interface. See the ACPICA Programmer Reference for details. Also, update all invocations of acpi_get_object_info interface Signed-off-by: Bob Moore <robert.moore@intel.com> Signed-off-by: Lin Ming <ming.m.lin@intel.com> Signed-off-by: Len Brown <len.brown@intel.com>
2009-04-05Merge branch 'linus' into releaseLen Brown1-1/+1
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 Carpenter1-1/+2
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 Lei1-1/+1
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', 'ec', 'misc', 'printk' and 'processor' into releaseLen Brown1-5/+9
2009-02-07ACPI: add missing KERN_* constants to printksFrank Seidel1-4/+4
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 Macht1-1/+5
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 Brown1-3/+3
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 Wilcox1-3/+3
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 Renninger1-2/+3
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 Li1-0/+25
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 Li1-4/+10
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 Li1-7/+15
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 Li1-1/+2
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 Rui1-1/+24
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 Li1-22/+24
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 Li1-48/+175
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 Li1-0/+21
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 Li1-5/+0
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 Li1-1/+4
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 Macht1-3/+8
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 Gleixner1-3/+0
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 Brown1-0/+3
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 Brown1-0/+3
Signed-off-by: Len Brown <len.brown@intel.com>
2008-06-11dock.c remove trailing printk whitespaceTim Pepper1-1/+1
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 Macht1-0/+1
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 Brown1-4/+4
Conflicts: drivers/acpi/scan.c include/linux/acpi.h Signed-off-by: Len Brown <len.brown@intel.com>
2008-02-07ACPI: misc cleanupsAdrian Bunk1-4/+4
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 Seidel1-0/+6
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 Macht1-3/+3
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 Torokhov1-4/+4
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 Accardi1-1/+9
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 Accardi1-0/+3
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 Accardi1-2/+49
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 Accardi1-24/+23
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 Ebbert1-0/+7
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 Accardi1-5/+8
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 Dunlap1-1/+2
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-Evenbakh1-0/+24
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>