Skip to contentSkip to conversation

spi core stops updating dev->power.power_state

PATCH In review David Brownell 2 participants 3 messages Dec 4, 2007 2 messages not in the archive SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi core stops updating dev->power.power_state

Don't update dev->power.power_state any more in the SPI core. The only reason to update this scheduled-to-be-removed field was to make the already-removed /sys/devices/.../power/state files work better.

drivers/spi/spi.c +14 -20
@@ -77,39 +77,33 @@ static int spi_uevent(struct device *dev
 
 #ifdef	CONFIG_PM
 
-/*
- * NOTE:  the suspend() method for an spi_master controller driver
- * should verify that all its child devices are marked as suspended;
- * suspend requests delivered through sysfs power/state files don't
- * enforce such constraints.
- */
 static int spi_suspend(struct device *dev, pm_message_t message)
 {
-	int			value;
+	int			value = 0;
 	struct spi_driver	*drv = to_spi_driver(dev->driver);
 
-	if (!drv || !drv->suspend)
-		return 0;
-
 	/* suspend will stop irqs and dma; no more i/o */
-	value = drv->suspend(to_spi_device(dev), message);
-	if (value == 0)
-		dev->power.power_state = message;
+	if (drv) {
+		if (drv->suspend)
+			value = drv->suspend(to_spi_device(dev), message);
+		else
+			dev_dbg(dev, "... can't suspend\n");
+	}
 	return value;
 }
 
 static int spi_resume(struct device *dev)
 {
-	int			value;
+	int			value = 0;
 	struct spi_driver	*drv = to_spi_driver(dev->driver);
 
-	if (!drv || !drv->resume)
-		return 0;
-
 	/* resume may restart the i/o queue */
-	value = drv->resume(to_spi_device(dev));
-	if (value == 0)
-		dev->power.power_state = PMSG_ON;
+	if (drv) {
+		if (drv->resume)
+			value = drv->resume(to_spi_device(dev));
+		else
+			dev_dbg(dev, "... can't resume\n");
+	}
 	return value;
 }
 

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4

A message that is not in the archive (sent off-list or not yet received): 200712041159.43712.david-b-yBeKhBN/[email protected]

#2 lore raw
Quoted 1 line · On Tue, 4 Dec 2007 11:59:42 -0800 David Brownell…

Subject: [patch 2.6.24-rc4] spi core stops updating dev->power.power_state

Methinks this should have been "spi core: stop updating dev->power.power_state"?

Quoted 5 lines

Don't update dev->power.power_state any more in the SPI core. The only reason to update this scheduled-to-be-removed field was to make the already-removed /sys/devices/.../power/state files work better.

For 2.6.25, yes?

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4

A message that is not in the archive (sent off-list or not yet received): 20071204122401.d06d6699.akpm-de/[email protected]

#4 lore raw
Quoted 7 lines · Andrew Morton
Quoted 1 line · On Tue, 4 Dec 2007 11:59:42 -0800 David Brownell…

Subject: [patch 2.6.24-rc4] spi core stops updating dev->power.power_state

Methinks this should have been "spi core: stop updating dev->power.power_state"?

Either one seems correct to me ... The Chicago Manual of Style doesn't seem to cover such issues. ;)

Quoted 6 lines
Quoted 4 lines

Don't update dev->power.power_state any more in the SPI core. The only reason to update this scheduled-to-be-removed field was to make the already-removed /sys/devices/.../power/state files work better.

For 2.6.25, yes?

Absolutely. Ditto for the other similar patches you're about to see.

- Dave

-------------------------------------------------------------------------
SF.Net email is sponsored by: The Future of Linux Business White Paper from Novell. From the desktop to the data center, Linux is going mainstream. Let it simplify your IT future.
http://altfarm.mediaplex.com/ad/ck/8857-50307-18918-4