public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: Holger Macht <hmacht@suse.de>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-acpi@vger.kernel.org, stable@kernel.org, lenb@kernel.org,
	Li@suse.de, shaohua.li@intel.com, marvin@mydatex.cz
Subject: Re: [PATCH] ACPI: dock: Don't eval _STA on every show_docked sysfs read
Date: Fri, 06 Feb 2009 17:47:56 +0100	[thread overview]
Message-ID: <1233938876.12590.4.camel@homac.suse.de> (raw)
In-Reply-To: <20090127130455.2c1b0cd4.akpm@linux-foundation.org>

[-- Attachment #1: Type: text/plain, Size: 442 bytes --]

Hi,

sorry for the delay...

On Tue, 2009-01-27 at 13:04 -0800, Andrew Morton wrote:
> On Tue, 20 Jan 2009 12:18:24 +0100
> Holger Macht <hmacht@suse.de> wrote:
> 
> > Cc: stable@kernel.org
> 
> The patch applied OK to 2.6.28 but not to any earlier kernel.  If we
> decide that it should be backported to 2.6.27 or earlier, a new patch
> might be needed for that.

Patch that applies to stable kernel from today is attached.

Thanks,
	Holger

[-- Attachment #2: acpi-dock-dont-eval-STA-on-every-show-docked-sysfs-read.patch --]
[-- Type: text/x-patch, Size: 1325 bytes --]

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>
---

diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 25d2161..7290e54 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -691,8 +691,14 @@ fdd_out:
 static ssize_t show_docked(struct device *dev,
 			   struct device_attribute *attr, char *buf)
 {
-	return snprintf(buf, PAGE_SIZE, "%d\n", dock_present(dock_station));
+	struct acpi_device *tmp;
+
+	struct dock_station *dock_station = *((struct dock_station **)
+		dev->platform_data);
 
+	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);
 

  reply	other threads:[~2009-02-06 16:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-20 11:18 [PATCH] ACPI: dock: Don't eval _STA on every show_docked sysfs read Holger Macht
2009-01-27 21:04 ` Andrew Morton
2009-02-06 16:47   ` Holger Macht [this message]
2009-02-06 21:33     ` Andrew Morton
2009-02-07  3:11   ` Len Brown
2009-02-07  3:18     ` Andrew Morton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1233938876.12590.4.camel@homac.suse.de \
    --to=hmacht@suse.de \
    --cc=Li@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=marvin@mydatex.cz \
    --cc=shaohua.li@intel.com \
    --cc=stable@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox