mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ACPI: eliminate useless bay events
@ 2007-03-06 23:40 Kristen Carlson Accardi
  2007-03-07  2:16 ` Henrique de Moraes Holschuh
  0 siblings, 1 reply; 3+ messages in thread
From: Kristen Carlson Accardi @ 2007-03-06 23:40 UTC (permalink / raw)
  To: lenb; +Cc: linux-acpi, linux-kernel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-03-14 18:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-06 23:40 [PATCH] ACPI: eliminate useless bay events Kristen Carlson Accardi
2007-03-07  2:16 ` Henrique de Moraes Holschuh
2007-03-14 18:25   ` Kristen Carlson Accardi

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®