[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20070306154046.942b0706.kristen.c.accardi@intel.com>
Date: Tue, 6 Mar 2007 15:40:46 -0800
From: Kristen Carlson Accardi <kristen.c.accardi@...el.com>
To: lenb@...nel.org
Cc: linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] ACPI: eliminate useless bay events
Eliminate bay events on resume if nothing has changed.
Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@...el.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);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists