From: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
To: lenb@kernel.org
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] ACPI: eliminate useless bay events
Date: Tue, 6 Mar 2007 15:40:46 -0800 [thread overview]
Message-ID: <20070306154046.942b0706.kristen.c.accardi@intel.com> (raw)
Eliminate bay events on resume if nothing has changed.
Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@intel.com>
Index: 2.6-git/drivers/acpi/bay.c
===================================================================
--- 2.6-git.orig/drivers/acpi/bay.c
+++ 2.6-git/drivers/acpi/bay.c
@@ -51,6 +51,7 @@ struct bay {
char *name;
struct list_head list;
struct platform_device *pdev;
+ int present;
};
static LIST_HEAD(drive_bays);
@@ -125,7 +126,7 @@ static ssize_t show_present(struct devic
struct device_attribute *attr, char *buf)
{
struct bay *bay = dev_get_drvdata(dev);
- return snprintf(buf, PAGE_SIZE, "%d\n", bay_present(bay));
+ return snprintf(buf, PAGE_SIZE, "%d\n", bay->present);
}
DEVICE_ATTR(present, S_IRUGO, show_present, NULL);
@@ -142,6 +143,7 @@ static ssize_t write_eject(struct device
return -EINVAL;
eject_device(bay->handle);
+ bay->present = bay_present(bay);
return count;
}
DEVICE_ATTR(eject, S_IWUSR, NULL, write_eject);
@@ -195,6 +197,8 @@ static int is_ejectable_bay(acpi_handle
return 0;
}
+/* not needed right now */
+#if 0
/**
* eject_removable_drive - try to eject this drive
* @dev : the device structure of the drive
@@ -219,6 +223,7 @@ int eject_removable_drive(struct device
return 0;
}
EXPORT_SYMBOL_GPL(eject_removable_drive);
+#endif
static int acpi_bay_add_fs(struct bay *bay)
{
@@ -308,6 +313,9 @@ static int bay_add(acpi_handle handle, i
register_hotplug_dock_device(handle, bay_notify, new_bay);
}
list_add(&new_bay->list, &drive_bays);
+
+ new_bay->present = bay_present(new_bay);
+
printk(KERN_INFO PREFIX "Bay [%s] Added\n", new_bay->name);
return 0;
@@ -329,10 +337,14 @@ static void bay_notify(acpi_handle handl
struct bay *bay_dev = (struct bay *)data;
struct device *dev = &bay_dev->pdev->dev;
- bay_dprintk(handle, "Bay event");
+ bay_dprintk(handle, "Bay event\n");
switch(event) {
case ACPI_NOTIFY_BUS_CHECK:
+ /* eliminate notifications on resumes */
+ if (bay_dev->present && bay_present(bay_dev))
+ break;
+ bay_dev->present = bay_present(bay_dev);
case ACPI_NOTIFY_DEVICE_CHECK:
case ACPI_NOTIFY_EJECT_REQUEST:
kobject_uevent(&dev->kobj, KOBJ_CHANGE);
next reply other threads:[~2007-03-06 23:43 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-06 23:40 Kristen Carlson Accardi [this message]
2007-03-07 2:16 ` Henrique de Moraes Holschuh
2007-03-14 18:25 ` Kristen Carlson Accardi
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=20070306154046.942b0706.kristen.c.accardi@intel.com \
--to=kristen.c.accardi@intel.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®