[PATCH] ACPI: eliminate useless bay events

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Eliminate bay events on resume if nothing has changed.

Signed-off-by: Kristen Carlson Accardi <kristen.c.accardi@xxxxxxxxx>
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-acpi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux IBM ACPI]     [Linux Power Management]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux