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

* Re: [PATCH] ACPI: eliminate useless bay events
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Henrique de Moraes Holschuh @ 2007-03-07  2:16 UTC (permalink / raw)
  To: Kristen Carlson Accardi; +Cc: lenb, linux-acpi, linux-kernel

On Tue, 06 Mar 2007, Kristen Carlson Accardi wrote:
> Eliminate bay events on resume if nothing has changed.

Are these *really* useless?  What if the *contents* of the bay changed?

-- 
  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

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

* Re: [PATCH] ACPI: eliminate useless bay events
  2007-03-07  2:16 ` Henrique de Moraes Holschuh
@ 2007-03-14 18:25   ` Kristen Carlson Accardi
  0 siblings, 0 replies; 3+ messages in thread
From: Kristen Carlson Accardi @ 2007-03-14 18:25 UTC (permalink / raw)
  To: Henrique de Moraes Holschuh; +Cc: lenb, linux-acpi, linux-kernel

On Tue, 6 Mar 2007 23:16:49 -0300
Henrique de Moraes Holschuh <hmh@hmh.eng.br> wrote:

> On Tue, 06 Mar 2007, Kristen Carlson Accardi wrote:
> > Eliminate bay events on resume if nothing has changed.
> 
> Are these *really* useless?  What if the *contents* of the bay changed?

Humm... good point.  I will play with this some more to solve the bug
I'm trying to fix a different way.

Please ignore the patch.

Kristen

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