Skip to contentSkip to conversation

What happened to SUSPEND_SAVE_STATE?

DISCUSSION Pavel Machek 2 participants 7 messages Sep 10, 2003 Pcmcia

lore
Share & tools
lore
#0 lore raw

Hi!

What happened to SUSPEND_SAVE_STATE?

pcmcia_socket_dev_suspend() still expects to receive it, but I do not see any place where it is generated. Should it be killed from device.h? And these 6 places fixed?

pavel@amd:/usr/src/linux$ grep SUSPEND_SAVE_STATE `find . -name "*.c"`
./arch/ppc/ocp/ocp-driver.c:            if (level == SUSPEND_SAVE_STATE && ocp_dev->driver->save_state)
./arch/arm/mach-sa1100/neponset.c:      if (level == SUSPEND_SAVE_STATE ||
./drivers/pcmcia/i82092.c:      return pcmcia_socket_dev_suspend(&dev->dev, state, SUSPEND_SAVE_STATE);
./drivers/pcmcia/sa1111_generic.c:      return pcmcia_socket_dev_suspend(&dev->dev, state, SUSPEND_SAVE_STATE);
./drivers/serial/8250_pci.c:                    serial8250_suspend_port(priv->line[i], SUSPEND_SAVE_STATE);
./drivers/serial/core.c:        case SUSPEND_SAVE_STATE:
pavel@amd:/usr/src/linux$

Pavel

Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
#1 lore raw

Hi!

Quoted 1 line

What happened to SUSPEND_SAVE_STATE?

SUSPEND_NOTIFY seems dead, too. Should I simply ignore level parameter in pcmcia_socket_dev_suspend?
Pavel

Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
#2 lore raw
Quoted 6 lines · Pavel Machek

Hi!

Quoted 1 line

What happened to SUSPEND_SAVE_STATE?

SUSPEND_NOTIFY seems dead, too. Should I simply ignore level parameter in pcmcia_socket_dev_suspend?

No. Apply this patch (it's cut down from the stuff which is pending for Linus - I hope I didn't make any mistakes doing that 8))

drivers/pcmcia/cs.c +2 -8
diff -Nru a/drivers/pcmcia/cs.c b/drivers/pcmcia/cs.c
@@ -244,13 +244,10 @@
 static int socket_resume(struct pcmcia_socket *skt);
 static int socket_suspend(struct pcmcia_socket *skt);
 
-int pcmcia_socket_dev_suspend(struct device *dev, u32 state, u32 level)
+int pcmcia_socket_dev_suspend(struct device *dev, u32 state)
 {
 	struct pcmcia_socket *socket;
 
-	if (level != SUSPEND_SAVE_STATE)
-		return 0;
-
 	down_read(&pcmcia_socket_list_rwsem);
 	list_for_each_entry(socket, &pcmcia_socket_list, socket_list) {
 		if (socket->dev.dev != dev)
@@ -265,13 +262,10 @@
 }
 EXPORT_SYMBOL(pcmcia_socket_dev_suspend);
 
-int pcmcia_socket_dev_resume(struct device *dev, u32 level)
+int pcmcia_socket_dev_resume(struct device *dev)
 {
 	struct pcmcia_socket *socket;
 
-	if (level != RESUME_RESTORE_STATE)
-		return 0;
-
 	down_read(&pcmcia_socket_list_rwsem);
 	list_for_each_entry(socket, &pcmcia_socket_list, socket_list) {
 		if (socket->dev.dev != dev)
drivers/pcmcia/hd64465_ss.c +18 -5
diff -Nru a/drivers/pcmcia/hd64465_ss.c b/drivers/pcmcia/hd64465_ss.c
@@ -867,19 +867,32 @@
 	local_irq_restore(flags);
 }
 
+static int hd64465_suspend(struct device *dev, u32 state, u32 level)
+{
+	int ret = 0;
+	if (level == SUSPEND_SAVE_STATE)
+		ret = pcmcia_socket_dev_suspend(dev, state);
+	return ret;
+}
+
+static int hd64465_resume(struct device *dev, u32 level)
+{
+	int ret = 0;
+	if (level == RESUME_RESTORE_STATE)
+		ret = pcmcia_socket_dev_resume(dev);
+	return ret;
+}
+
 static struct device_driver hd64465_driver = {
 	.name = "hd64465-pcmcia",
 	.bus = &platform_bus_type,
-	.suspend = pcmcia_socket_dev_suspend,
-	.resume = pcmcia_socket_dev_resume,
+	.suspend = hd64465_suspend,
+	.resume = hd64465_resume,
 };
 
 static struct platform_device hd64465_device = {
 	.name = "hd64465-pcmcia",
 	.id = 0,
-	.dev = {
-		.name = "hd64465-pcmcia",
-	},
 };
 
 static int __init init_hs(void)
drivers/pcmcia/i82092.c +2 -2
diff -Nru a/drivers/pcmcia/i82092.c b/drivers/pcmcia/i82092.c
@@ -44,12 +44,12 @@
 
 static int i82092aa_socket_suspend (struct pci_dev *dev, u32 state)
 {
-	return pcmcia_socket_dev_suspend(&dev->dev, state, SUSPEND_SAVE_STATE);
+	return pcmcia_socket_dev_suspend(&dev->dev, state);
 }
 
 static int i82092aa_socket_resume (struct pci_dev *dev)
 {
-	return pcmcia_socket_dev_resume(&dev->dev, RESUME_RESTORE_STATE);
+	return pcmcia_socket_dev_resume(&dev->dev);
 }
 
 static struct pci_driver i82092aa_pci_drv = {
drivers/pcmcia/i82365.c +18 -2
diff -Nru a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c
@@ -1351,11 +1351,27 @@
 
 /*====================================================================*/
 
+static int i82365_suspend(struct device *dev, u32 state, u32 level)
+{
+	int ret = 0;
+	if (level == SUSPEND_SAVE_STATE)
+		ret = pcmcia_socket_dev_suspend(dev, state);
+	return ret;
+}
+
+static int i82365_resume(struct device *dev, u32 level)
+{
+	int ret = 0;
+	if (level == RESUME_RESTORE_STATE)
+		ret = pcmcia_socket_dev_resume(dev);
+	return ret;
+}
+
 static struct device_driver i82365_driver = {
 	.name = "i82365",
 	.bus = &platform_bus_type,
-	.suspend = pcmcia_socket_dev_suspend,
-	.resume = pcmcia_socket_dev_resume,
+	.suspend = i82365_suspend,
+	.resume = i82365_resume,
 };
 
 static struct platform_device i82365_device = {
drivers/pcmcia/sa1100_generic.c +18 -2
diff -Nru a/drivers/pcmcia/sa1100_generic.c b/drivers/pcmcia/sa1100_generic.c
@@ -100,13 +100,29 @@
 	return ret;
 }
 
+static int sa11x0_drv_pcmcia_suspend(struct device *dev, u32 state, u32 level)
+{
+	int ret = 0;
+	if (level == SUSPEND_SAVE_STATE)
+		ret = pcmcia_socket_dev_suspend(dev, state);
+	return ret;
+}
+
+static int sa11x0_drv_pcmcia_resume(struct device *dev, u32 level)
+{
+	int ret = 0;
+	if (level == RESUME_RESTORE_STATE)
+		ret = pcmcia_socket_dev_resume(dev);
+	return ret;
+}
+
 static struct device_driver sa11x0_pcmcia_driver = {
 	.probe		= sa11x0_drv_pcmcia_probe,
 	.remove		= sa11xx_drv_pcmcia_remove,
 	.name		= "sa11x0-pcmcia",
 	.bus		= &platform_bus_type,
-	.suspend 	= pcmcia_socket_dev_suspend,
-	.resume 	= pcmcia_socket_dev_resume,
+	.suspend 	= sa11x0_drv_pcmcia_suspend,
+	.resume 	= sa11x0_drv_pcmcia_resume,
 };
 
 /* sa11x0_pcmcia_init()
drivers/pcmcia/sa1111_generic.c +2 -2
diff -Nru a/drivers/pcmcia/sa1111_generic.c b/drivers/pcmcia/sa1111_generic.c
@@ -171,12 +171,12 @@
 
 static int pcmcia_suspend(struct sa1111_dev *dev, u32 state)
 {
-	return pcmcia_socket_dev_suspend(&dev->dev, state, SUSPEND_SAVE_STATE);
+	return pcmcia_socket_dev_suspend(&dev->dev, state);
 }
 
 static int pcmcia_resume(struct sa1111_dev *dev)
 {
-	return pcmcia_socket_dev_resume(&dev->dev, RESUME_RESTORE_STATE);
+	return pcmcia_socket_dev_resume(&dev->dev);
 }
 
 static struct sa1111_driver pcmcia_driver = {
drivers/pcmcia/tcic.c +18 -2
diff -Nru a/drivers/pcmcia/tcic.c b/drivers/pcmcia/tcic.c
@@ -362,11 +362,27 @@
 
 /*====================================================================*/
 
+static int tcic_drv_suspend(struct device *dev, u32 state, u32 level)
+{
+	int ret = 0;
+	if (level == SUSPEND_SAVE_STATE)
+		ret = pcmcia_socket_dev_suspend(dev, state);
+	return ret;
+}
+
+static int tcic_drv_resume(struct device *dev, u32 level)
+{
+	int ret = 0;
+	if (level == RESUME_RESTORE_STATE)
+		ret = pcmcia_socket_dev_resume(dev);
+	return ret;
+}
+
 static struct device_driver tcic_driver = {
 	.name = "tcic-pcmcia",
 	.bus = &platform_bus_type,
-	.suspend = pcmcia_socket_dev_suspend,
-	.resume = pcmcia_socket_dev_resume,
+	.suspend = tcic_drv_suspend,
+	.resume = tcic_drv_resume,
 };
 
 static struct platform_device tcic_device = {
drivers/pcmcia/yenta_socket.c +2 -2
diff -Nru a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
@@ -937,7 +933,7 @@
 	struct yenta_socket *socket = pci_get_drvdata(dev);
 	int ret;
 
-	ret = pcmcia_socket_dev_suspend(&dev->dev, state, SUSPEND_SAVE_STATE);
+	ret = pcmcia_socket_dev_suspend(&dev->dev, state);
 
 	if (socket) {
 		if (socket->type && socket->type->save_state)
@@ -969,7 +965,7 @@
 			socket->type->restore_state(socket);
 	}
 
-	return pcmcia_socket_dev_resume(&dev->dev, RESUME_RESTORE_STATE);
+	return pcmcia_socket_dev_resume(&dev->dev);
 }
 
 
include/pcmcia/ss.h +2 -2
diff -Nru a/include/pcmcia/ss.h b/include/pcmcia/ss.h
@@ -249,7 +249,7 @@
 extern struct class pcmcia_socket_class;
 
 /* socket drivers are expected to use these callbacks in their .drv struct */
-extern int pcmcia_socket_dev_suspend(struct device *dev, u32 state, u32 level);
-extern int pcmcia_socket_dev_resume(struct device *dev, u32 level);
+extern int pcmcia_socket_dev_suspend(struct device *dev, u32 state);
+extern int pcmcia_socket_dev_resume(struct device *dev);
 
 #endif /* _LINUX_SS_H */
Signature · 5 lines
Russell King ([email protected])	http://www.arm.linux.org.uk/personal/
Linux kernel maintainer of:
  2.6 ARM Linux   - http://www.arm.linux.org.uk/
  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
  2.6 Serial core
#3 lore raw

Hi!

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

What happened to SUSPEND_SAVE_STATE?

SUSPEND_NOTIFY seems dead, too. Should I simply ignore level parameter in pcmcia_socket_dev_suspend?

No. Apply this patch (it's cut down from the stuff which is pending for Linus - I hope I didn't make any mistakes doing that 8))

Thanks, but:

Quoted 23 lines

diff -Nru a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c

drivers/pcmcia/i82365.c +16 -0
@@ -1351,11 +1351,27 @@
 
 /*====================================================================*/
 
+static int i82365_suspend(struct device *dev, u32 state, u32 level)
+{
+	int ret = 0;
+	if (level == SUSPEND_SAVE_STATE)
+		ret = pcmcia_socket_dev_suspend(dev, state);
+	return ret;
+}
+
+static int i82365_resume(struct device *dev, u32 level)
+{
+	int ret = 0;
+	if (level == RESUME_RESTORE_STATE)
+		ret = pcmcia_socket_dev_resume(dev);
+	return ret;
+}
+

drivers/pcmcia/i82365.c line 1377

Quoted 10 lines
drivers/pcmcia/i82365.c +2 -2
 static struct device_driver i82365_driver = {
 	.name = "i82365",
 	.bus = &platform_bus_type,
-	.suspend = pcmcia_socket_dev_suspend,
-	.resume = pcmcia_socket_dev_resume,
+	.suspend = i82365_suspend,
+	.resume = i82365_resume,
 };
 
 static struct platform_device i82365_device = {

I was not able to find *any* place in the tree that would call suspend with SUSPEND_SAVE_STATE as level. Maybe just my grep was wrong?

Pavel

Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
#4 lore raw
Quoted 32 lines · Pavel Machek
Quoted 32 lines

diff -Nru a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c

drivers/pcmcia/i82365.c +18 -2
@@ -1351,11 +1351,27 @@
 
 /*====================================================================*/
 
+static int i82365_suspend(struct device *dev, u32 state, u32 level)
+{
+	int ret = 0;
+	if (level == SUSPEND_SAVE_STATE)
+		ret = pcmcia_socket_dev_suspend(dev, state);
+	return ret;
+}
+
+static int i82365_resume(struct device *dev, u32 level)
+{
+	int ret = 0;
+	if (level == RESUME_RESTORE_STATE)
+		ret = pcmcia_socket_dev_resume(dev);
+	return ret;
+}
+
 static struct device_driver i82365_driver = {
 	.name = "i82365",
 	.bus = &platform_bus_type,
-	.suspend = pcmcia_socket_dev_suspend,
-	.resume = pcmcia_socket_dev_resume,
+	.suspend = i82365_suspend,
+	.resume = i82365_resume,
 };
 
Quoted 4 lines

drivers/pcmcia/i82365.c line 1377

Quoted 1 line
drivers/pcmcia/i82365.c +0 -0
 static struct platform_device i82365_device = {

I was not able to find *any* place in the tree that would call suspend with SUSPEND_SAVE_STATE as level. Maybe just my grep was wrong?

It is correct for the time being. Well, as far as the ARM tree goes. At the moment, the attitude towards platform devices seems to be "tough, live with it." So, I have my own work-arounds, and until such time that mainline comes up with a solution, I'm happy.

Signature · 5 lines
Russell King ([email protected])	http://www.arm.linux.org.uk/personal/
Linux kernel maintainer of:
  2.6 ARM Linux   - http://www.arm.linux.org.uk/
  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
  2.6 Serial core
#5 lore raw

Hi!

Quoted 37 lines
Quoted 32 lines
Quoted 32 lines

diff -Nru a/drivers/pcmcia/i82365.c b/drivers/pcmcia/i82365.c

drivers/pcmcia/i82365.c +18 -2
@@ -1351,11 +1351,27 @@
 
 /*====================================================================*/
 
+static int i82365_suspend(struct device *dev, u32 state, u32 level)
+{
+	int ret = 0;
+	if (level == SUSPEND_SAVE_STATE)
+		ret = pcmcia_socket_dev_suspend(dev, state);
+	return ret;
+}
+
+static int i82365_resume(struct device *dev, u32 level)
+{
+	int ret = 0;
+	if (level == RESUME_RESTORE_STATE)
+		ret = pcmcia_socket_dev_resume(dev);
+	return ret;
+}
+
 static struct device_driver i82365_driver = {
 	.name = "i82365",
 	.bus = &platform_bus_type,
-	.suspend = pcmcia_socket_dev_suspend,
-	.resume = pcmcia_socket_dev_resume,
+	.suspend = i82365_suspend,
+	.resume = i82365_resume,
 };
 
Quoted 4 lines

drivers/pcmcia/i82365.c line 1377

Quoted 1 line
drivers/pcmcia/i82365.c +0 -0
 static struct platform_device i82365_device = {

I was not able to find *any* place in the tree that would call suspend with SUSPEND_SAVE_STATE as level. Maybe just my grep was wrong?

Quoted 4 lines

It is correct for the time being. Well, as far as the ARM tree goes. At the moment, the attitude towards platform devices seems to be "tough, live with it." So, I have my own work-arounds, and until such time that mainline comes up with a solution, I'm happy.

Ok, it probably means I should not try to fix pcmcia tonight. Patrick, what is the goal with "u32 level" in struct device_driver? Should the code be fixed to call it with SUSPEND_SAVE_STATE etc? Or is there some other plan?
Pavel

Signature · 2 lines
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]
#6 lore raw
In reply to Pavel Machek
Quoted 3 lines · Pavel Machek

pcmcia_socket_dev_suspend() still expects to receive it, but I do not see any place where it is generated. Should it be killed from device.h? And these 6 places fixed?

I've already fixed many of them, but I've introduced some others.

PPC people need to answer this:

Quoted 1 line

./arch/ppc/ocp/ocp-driver.c: if (level == SUSPEND_SAVE_STATE && ocp_dev->driver->save_state)

Fix pending merging:

Quoted 1 line

./arch/arm/mach-sa1100/neponset.c: if (level == SUSPEND_SAVE_STATE ||

These two will be gone shortly:

Quoted 2 lines

./drivers/pcmcia/i82092.c: return pcmcia_socket_dev_suspend(&dev->dev, state, SUSPEND_SAVE_STATE);
./drivers/pcmcia/sa1111_generic.c: return pcmcia_socket_dev_suspend(&dev->dev, state, SUSPEND_SAVE_STATE);

These two are already gone:

Quoted 2 lines

./drivers/serial/8250_pci.c: serial8250_suspend_port(priv->line[i], SUSPEND_SAVE_STATE);
./drivers/serial/core.c: case SUSPEND_SAVE_STATE:

Signature · 5 lines
Russell King ([email protected])	http://www.arm.linux.org.uk/personal/
Linux kernel maintainer of:
  2.6 ARM Linux   - http://www.arm.linux.org.uk/
  2.6 PCMCIA      - http://pcmcia.arm.linux.org.uk/
  2.6 Serial core