From patchwork Tue Jan 20 11:18:24 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Holger Macht X-Patchwork-Id: 3270 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n0KBEpVX012185 for ; Tue, 20 Jan 2009 03:14:51 -0800 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757656AbZATLTW (ORCPT ); Tue, 20 Jan 2009 06:19:22 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1758030AbZATLTW (ORCPT ); Tue, 20 Jan 2009 06:19:22 -0500 Received: from ns.suse.de ([195.135.220.2]:57708 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757656AbZATLTW (ORCPT ); Tue, 20 Jan 2009 06:19:22 -0500 Received: from Relay1.suse.de (relay-ext.suse.de [195.135.221.8]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.suse.de (Postfix) with ESMTP id D5A37429B4; Tue, 20 Jan 2009 12:19:20 +0100 (CET) Subject: [PATCH] ACPI: dock: Don't eval _STA on every show_docked sysfs read From: Holger Macht Reply-To: hmacht@suse.de To: linux-acpi@vger.kernel.org Cc: stable@kernel.org, Len Brown , Li@suse.de, Shaohua , Daniel Smolik , akpm@linux-foundation.org Organization: SUSE Linux Products GmbH Date: Tue, 20 Jan 2009 12:18:24 +0100 Message-Id: <1232450304.5286.4.camel@homac.suse.de> Mime-Version: 1.0 X-Mailer: Evolution 2.24.1.1 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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 --- -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c index 5b30b8d..afd5db3 100644 --- a/drivers/acpi/dock.c +++ b/drivers/acpi/dock.c @@ -855,10 +855,14 @@ fdd_out: static ssize_t show_docked(struct device *dev, struct device_attribute *attr, char *buf) { + struct acpi_device *tmp; + struct dock_station *dock_station = *((struct dock_station **) dev->platform_data); - return snprintf(buf, PAGE_SIZE, "%d\n", dock_present(dock_station)); + if (ACPI_SUCCESS(acpi_bus_get_device(dock_station->handle, &tmp))) + return snprintf(buf, PAGE_SIZE, "1\n"); + return snprintf(buf, PAGE_SIZE, "0\n"); } static DEVICE_ATTR(docked, S_IRUGO, show_docked, NULL);