Skip to contentSkip to conversation

acer-wmi: switch driver to dev_pm_ops

PATCH In review Arnaud Faucher 4 participants 19 messages Jul 25, 2009 – Jul 31, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 acer-wmi: switch driver to dev_pm_ops

Gets rid of the following warning:
Platform driver 'acer-wmi' needs updating - please use dev_pm_ops

---
 drivers/platform/x86/acer-wmi.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
drivers/platform/x86/acer-wmi.c +8 -5
index be2fd6f..b2b6aef 100644
@@ -1152,8 +1152,7 @@ static int acer_platform_remove(struct platform_device *device)
 	return 0;
 }
 
-static int acer_platform_suspend(struct platform_device *dev,
-pm_message_t state)
+static int acer_platform_suspend(struct device *dev)
 {
 	u32 value;
 	struct acer_data *data = &interface->data;
@@ -1174,7 +1173,7 @@ pm_message_t state)
 	return 0;
 }
 
-static int acer_platform_resume(struct platform_device *device)
+static int acer_platform_resume(struct device *dev)
 {
 	struct acer_data *data = &interface->data;
 
@@ -1190,15 +1189,19 @@ static int acer_platform_resume(struct platform_device *device)
 	return 0;
 }
 
+static struct dev_pm_ops acer_platform_pm_ops = {
+	.suspend = acer_platform_suspend,
+	.resume = acer_platform_resume,
+};
+
 static struct platform_driver acer_platform_driver = {
 	.driver = {
 		.name = "acer-wmi",
 		.owner = THIS_MODULE,
+		.pm = &acer_platform_pm_ops,
 	},
 	.probe = acer_platform_probe,
 	.remove = acer_platform_remove,
-	.suspend = acer_platform_suspend,
-	.resume = acer_platform_resume,
 };
 
 static struct platform_device *acer_platform_device;
Signature · 1 line
1.6.3.3
#1 lore raw

Hi Arnaud,

Quoted 3 lines · Arnaud Faucher

Gets rid of the following warning:
Platform driver 'acer-wmi' needs updating - please use dev_pm_ops

Have you tested it with Suspend to disk? You are [potentially] breaking it since the new suspend and resume methods are not used by it, it calls freeze() and thaw() instead.

Rafael,

I wonder if PM core should automatically use suspend()/resume() in place of freeze()/thaw() when the latter pair is missing.

Quoted 58 lines
---
 drivers/platform/x86/acer-wmi.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)
drivers/platform/x86/acer-wmi.c +8 -5
index be2fd6f..b2b6aef 100644
@@ -1152,8 +1152,7 @@ static int acer_platform_remove(struct platform_device *device)
 	return 0;
 }
 
-static int acer_platform_suspend(struct platform_device *dev,
-pm_message_t state)
+static int acer_platform_suspend(struct device *dev)
 {
 	u32 value;
 	struct acer_data *data = &interface->data;
@@ -1174,7 +1173,7 @@ pm_message_t state)
 	return 0;
 }
 
-static int acer_platform_resume(struct platform_device *device)
+static int acer_platform_resume(struct device *dev)
 {
 	struct acer_data *data = &interface->data;
 
@@ -1190,15 +1189,19 @@ static int acer_platform_resume(struct platform_device *device)
 	return 0;
 }
 
+static struct dev_pm_ops acer_platform_pm_ops = {
+	.suspend = acer_platform_suspend,
+	.resume = acer_platform_resume,
+};
+
 static struct platform_driver acer_platform_driver = {
 	.driver = {
 		.name = "acer-wmi",
 		.owner = THIS_MODULE,
+		.pm = &acer_platform_pm_ops,
 	},
 	.probe = acer_platform_probe,
 	.remove = acer_platform_remove,
-	.suspend = acer_platform_suspend,
-	.resume = acer_platform_resume,
 };
 
 static struct platform_device *acer_platform_device;
Signature · 7 lines
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Signature · 1 line
Dmitry
#2 lore raw
Quoted 7 lines · Dmitry Torokhov

Hi Arnaud,

Quoted 3 lines · Arnaud Faucher

Gets rid of the following warning:
Platform driver 'acer-wmi' needs updating - please use dev_pm_ops

Quoted 8 lines

Have you tested it with Suspend to disk? You are [potentially] breaking it since the new suspend and resume methods are not used by it, it calls freeze() and thaw() instead.

Rafael,

I wonder if PM core should automatically use suspend()/resume() in place of freeze()/thaw() when the latter pair is missing.

Well, in fact it often is not necessary to do .thaw() at all, because the state of the device doesn't change in .freeze(). Also, PCI drivers should not need .thaw(), unless they manipulate the standard PM registers of the device themselves.

That said, if .suspend() is defined, then most probably .freeze() is necessary as well. Also, if .resume() is defined, .restore() is most probably necessary and it should be safe to use .suspend() as .freeze() and .resume() as .restore().

OTOH, it's really easy to point .restore() to the same routine as .resume() etc., so I'm not sure.

Best,
Rafael

#3 lore raw

Gets rid of the following warning:
Platform driver 'acer-wmi' needs updating - please use dev_pm_ops

Take 2, thanks to Dmitry, Rafael and Frans for pointing out PM issue on hibernation when using dev_pm_ops blindly.

This patch was tested against suspendand hibernation (Acer mail led status).

---
 drivers/platform/x86/acer-wmi.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
(quoted diff) +0 -0

b/drivers/platform/x86/acer-wmi.c
index be2fd6f..29374bc 100644

drivers/platform/x86/acer-wmi.c +0 -0
@@ -1152,8 +1152,7 @@ static int acer_platform_remove(struct

platform_device *device)
return 0;
}

-static int acer_platform_suspend(struct platform_device *dev, -pm_message_t state)
+static int acer_platform_suspend(struct device *dev)
{
u32 value;
struct acer_data *data = &interface->data;
@@ -1174,7 +1173,7 @@ pm_message_t state)
return 0;
}

-static int acer_platform_resume(struct platform_device *device) +static int acer_platform_resume(struct device *dev)
{
struct acer_data *data = &interface->data;

@@ -1190,15 +1189,23 @@ static int acer_platform_resume(struct platform_device *device)
return 0;
}

+static struct dev_pm_ops acer_platform_pm_ops = {
+ .suspend = acer_platform_suspend,
+ .resume = acer_platform_resume,
+ .freeze = acer_platform_suspend,
+ .thaw = acer_platform_resume,
+ .poweroff = acer_platform_suspend,
+ .restore = acer_platform_resume,
+};
+
static struct platform_driver acer_platform_driver = {
.driver = {
.name = "acer-wmi",
.owner = THIS_MODULE,
+ .pm = &acer_platform_pm_ops,
},
.probe = acer_platform_probe,
.remove = acer_platform_remove,
- .suspend = acer_platform_suspend,
- .resume = acer_platform_resume,
};

static struct platform_device *acer_platform_device;

Signature · 1 line
1.6.3.3
#4 lore raw

[Removing linux-mips from CC - I don't know why they'd be interested in an x86 only platform driver...]

Quoted 40 lines · On Sunday 26 July 2009 14:53:33 Arnaud Faucher wrote:

Gets rid of the following warning:
Platform driver 'acer-wmi' needs updating - please use dev_pm_ops

Take 2, thanks to Dmitry, Rafael and Frans for pointing out PM issue on hibernation when using dev_pm_ops blindly.

This patch was tested against suspendand hibernation (Acer mail led status).

---
 drivers/platform/x86/acer-wmi.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
drivers/platform/x86/acer-wmi.c +1 -2
index be2fd6f..29374bc 100644
@@ -1152,8 +1152,7 @@ static int acer_platform_remove(struct
 platform_device *device)
 	return 0;
 }
 
-static int acer_platform_suspend(struct platform_device *dev,
-pm_message_t state)
+static int acer_platform_suspend(struct device *dev)
 {
 	u32 value;
drivers/platform/x86/acer-wmi.c +1 -1
 	struct acer_data *data = &interface->data;
@@ -1174,7 +1173,7 @@ pm_message_t state)
 	return 0;
 }
 
-static int acer_platform_resume(struct platform_device *device)
+static int acer_platform_resume(struct device *dev)
 {
 	struct acer_data *data = &interface->data;
 

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1195

Quoted 7 lines
drivers/platform/x86/acer-wmi.c +3 -0
@@ -1190,15 +1189,23 @@ static int acer_platform_resume(struct
 platform_device *device)
 	return 0;
 }
 
+static struct dev_pm_ops acer_platform_pm_ops = {
+	.suspend = acer_platform_suspend,
+	.resume = acer_platform_resume,

Are these necessary? For suspend-to-RAM, I've never needed these. The old callbacks here were just for suspend-to-disk.

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1197

Quoted 2 lines
drivers/platform/x86/acer-wmi.c +2 -0
+	.freeze = acer_platform_suspend,
+	.thaw = acer_platform_resume,

If we only need these callbacks for freeze & thaw, they should be rebamed.

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1199

Quoted 2 lines
drivers/platform/x86/acer-wmi.c +2 -0
+	.poweroff = acer_platform_suspend,
+	.restore = acer_platform_resume,

What do poweroff and restore mean in this context. Do my comments above apply again (i.e. are the callbacks necessary here)?

Quoted 14 lines
drivers/platform/x86/acer-wmi.c +3 -2
+};
+
 static struct platform_driver acer_platform_driver = {
 	.driver = {
 		.name = "acer-wmi",
 		.owner = THIS_MODULE,
+		.pm = &acer_platform_pm_ops,
 	},
 	.probe = acer_platform_probe,
 	.remove = acer_platform_remove,
-	.suspend = acer_platform_suspend,
-	.resume = acer_platform_resume,
 };
 
Quoted 1 line

static struct platform_device *acer_platform_device;

-Carlos

Signature · 3 lines
E-Mail: [email protected]
Web: strangeworlds.co.uk
GPG Key ID: 0x23EE722D
#5 lore raw
Quoted 48 lines · Carlos Corbacho

[Removing linux-mips from CC - I don't know why they'd be interested in an x86 only platform driver...]

Quoted 44 lines · On Sunday 26 July 2009 14:53:33 Arnaud Faucher wrote:

Gets rid of the following warning:
Platform driver 'acer-wmi' needs updating - please use dev_pm_ops

Take 2, thanks to Dmitry, Rafael and Frans for pointing out PM issue on hibernation when using dev_pm_ops blindly.

This patch was tested against suspendand hibernation (Acer mail led status).

---
 drivers/platform/x86/acer-wmi.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
drivers/platform/x86/acer-wmi.c +1 -2
index be2fd6f..29374bc 100644
@@ -1152,8 +1152,7 @@ static int acer_platform_remove(struct
 platform_device *device)
 	return 0;
 }
 
-static int acer_platform_suspend(struct platform_device *dev,
-pm_message_t state)
+static int acer_platform_suspend(struct device *dev)
 {
 	u32 value;
drivers/platform/x86/acer-wmi.c +1 -1
 	struct acer_data *data = &interface->data;
@@ -1174,7 +1173,7 @@ pm_message_t state)
 	return 0;
 }
 
-static int acer_platform_resume(struct platform_device *device)
+static int acer_platform_resume(struct device *dev)
 {
 	struct acer_data *data = &interface->data;
 
@@ -1190,15 +1189,23 @@ static int acer_platform_resume(struct
 platform_device *device)
 	return 0;
 }
 
Quoted 7 lines

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1195

Quoted 3 lines
drivers/platform/x86/acer-wmi.c +3 -0
+static struct dev_pm_ops acer_platform_pm_ops = {
+	.suspend = acer_platform_suspend,
+	.resume = acer_platform_resume,

Are these necessary? For suspend-to-RAM, I've never needed these. The old callbacks here were just for suspend-to-disk.

That is not correct. Old suspend and resume callbacks were called for both S2R and S2D. Whether it is actually needed for S2R I don't know but looking at the code they should not hurt.

Quoted 11 lines

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1197

Quoted 2 lines
drivers/platform/x86/acer-wmi.c +2 -0
+	.freeze = acer_platform_suspend,
+	.thaw = acer_platform_resume,

If we only need these callbacks for freeze & thaw, they should be rebamed.

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1199

Quoted 2 lines
drivers/platform/x86/acer-wmi.c +2 -0
+	.poweroff = acer_platform_suspend,
+	.restore = acer_platform_resume,

What do poweroff and restore mean in this context. Do my comments above apply again (i.e. are the callbacks necessary here)?

I don't think poweroff handler is needed.

BTW, why so we retuen -ENOMEM from these methods if interface->data is missing? I'd say we should not fail suspend resume in that case or if we fail then with somethig like -EINVAL - we did not have mempry allocation failure.

Signature · 1 line
Dmitry
#6 lore raw
Quoted 56 lines · On Sunday 26 July 2009 19:08:09 Dmitry Torokhov wrote:
Quoted 48 lines · Carlos Corbacho

[Removing linux-mips from CC - I don't know why they'd be interested in an x86 only platform driver...]

Quoted 44 lines · On Sunday 26 July 2009 14:53:33 Arnaud Faucher wrote:

Gets rid of the following warning:
Platform driver 'acer-wmi' needs updating - please use dev_pm_ops

Take 2, thanks to Dmitry, Rafael and Frans for pointing out PM issue on hibernation when using dev_pm_ops blindly.

This patch was tested against suspendand hibernation (Acer mail led status).

---
 drivers/platform/x86/acer-wmi.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
drivers/platform/x86/acer-wmi.c +1 -2
index be2fd6f..29374bc 100644
@@ -1152,8 +1152,7 @@ static int acer_platform_remove(struct
 platform_device *device)
 	return 0;
 }
 
-static int acer_platform_suspend(struct platform_device *dev,
-pm_message_t state)
+static int acer_platform_suspend(struct device *dev)
 {
 	u32 value;
drivers/platform/x86/acer-wmi.c +1 -1
 	struct acer_data *data = &interface->data;
@@ -1174,7 +1173,7 @@ pm_message_t state)
 	return 0;
 }
 
-static int acer_platform_resume(struct platform_device *device)
+static int acer_platform_resume(struct device *dev)
 {
 	struct acer_data *data = &interface->data;
 
@@ -1190,15 +1189,23 @@ static int acer_platform_resume(struct
 platform_device *device)
 	return 0;
 }
 
Quoted 6 lines

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1195

Quoted 3 lines
drivers/platform/x86/acer-wmi.c +3 -0
+static struct dev_pm_ops acer_platform_pm_ops = {
+	.suspend = acer_platform_suspend,
+	.resume = acer_platform_resume,

Are these necessary? For suspend-to-RAM, I've never needed these. The old callbacks here were just for suspend-to-disk.

Quoted 3 lines

That is not correct. Old suspend and resume callbacks were called for both S2R and S2D. Whether it is actually needed for S2R I don't know but looking at the code they should not hurt.

I'm aware they were called for S2RAM as well, but that was just a limitation of the old calls - as I say, they're not needed for it (at least on my hardware anyway).

Quoted 12 lines
Quoted 11 lines

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1197

Quoted 2 lines
drivers/platform/x86/acer-wmi.c +2 -0
+	.freeze = acer_platform_suspend,
+	.thaw = acer_platform_resume,

If we only need these callbacks for freeze & thaw, they should be rebamed.

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1199

Quoted 2 lines
drivers/platform/x86/acer-wmi.c +2 -0
+	.poweroff = acer_platform_suspend,
+	.restore = acer_platform_resume,

What do poweroff and restore mean in this context. Do my comments above apply again (i.e. are the callbacks necessary here)?

Quoted 6 lines

I don't think poweroff handler is needed.

BTW, why so we retuen -ENOMEM from these methods if interface->data is missing? I'd say we should not fail suspend resume in that case or if we fail then with somethig like -EINVAL - we did not have mempry allocation failure.

Ok.

-Carlos

Signature · 3 lines
E-Mail: [email protected]
Web: strangeworlds.co.uk
GPG Key ID: 0x23EE722D
#7 lore raw
Quoted 57 lines · Carlos Corbacho
Quoted 56 lines · On Sunday 26 July 2009 19:08:09 Dmitry Torokhov wrote:
Quoted 54 lines · Carlos Corbacho

[Removing linux-mips from CC - I don't know why they'd be interested in an x86 only platform driver...]

Quoted 40 lines · On Sunday 26 July 2009 14:53:33 Arnaud Faucher wrote:

Gets rid of the following warning:
Platform driver 'acer-wmi' needs updating - please use dev_pm_ops

Take 2, thanks to Dmitry, Rafael and Frans for pointing out PM issue on hibernation when using dev_pm_ops blindly.

This patch was tested against suspendand hibernation (Acer mail led status).

---
 drivers/platform/x86/acer-wmi.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
drivers/platform/x86/acer-wmi.c +1 -2
index be2fd6f..29374bc 100644
@@ -1152,8 +1152,7 @@ static int acer_platform_remove(struct
 platform_device *device)
 	return 0;
 }
 
-static int acer_platform_suspend(struct platform_device *dev,
-pm_message_t state)
+static int acer_platform_suspend(struct device *dev)
 {
 	u32 value;
drivers/platform/x86/acer-wmi.c +1 -1
 	struct acer_data *data = &interface->data;
@@ -1174,7 +1173,7 @@ pm_message_t state)
 	return 0;
 }
 
-static int acer_platform_resume(struct platform_device *device)
+static int acer_platform_resume(struct device *dev)
 {
 	struct acer_data *data = &interface->data;
 

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1195

Quoted 7 lines
drivers/platform/x86/acer-wmi.c +3 -0
@@ -1190,15 +1189,23 @@ static int acer_platform_resume(struct
 platform_device *device)
 	return 0;
 }
 
+static struct dev_pm_ops acer_platform_pm_ops = {
+	.suspend = acer_platform_suspend,
+	.resume = acer_platform_resume,

Are these necessary? For suspend-to-RAM, I've never needed these. The old callbacks here were just for suspend-to-disk.

Quoted 8 lines
Quoted 3 lines

That is not correct. Old suspend and resume callbacks were called for both S2R and S2D. Whether it is actually needed for S2R I don't know but looking at the code they should not hurt.

I'm aware they were called for S2RAM as well, but that was just a limitation of the old calls - as I say, they're not needed for it (at least on my hardware anyway).

I was looking for similar functionality.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1197

Quoted 2 lines
drivers/platform/x86/acer-wmi.c +2 -0
+	.freeze = acer_platform_suspend,
+	.thaw = acer_platform_resume,

If we only need these callbacks for freeze & thaw, they should be rebamed.

Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1199

Quoted 2 lines
drivers/platform/x86/acer-wmi.c +2 -0
+	.poweroff = acer_platform_suspend,
+	.restore = acer_platform_resume,

What do poweroff and restore mean in this context. Do my comments above apply again (i.e. are the callbacks necessary here)?

I don't think poweroff handler is needed.

After testing many combinations, I observed that I had to use that much callbacks. For example, when omitting to wire .poweroff/.restore, with .freeze/.thaw linked to suspend()/resume(), the state (of the mail led) is not restored correctly after S2D.

Quoted 9 lines
Quoted 5 lines

BTW, why so we retuen -ENOMEM from these methods if interface->data is missing? I'd say we should not fail suspend resume in that case or if we fail then with somethig like -EINVAL - we did not have mempry allocation failure.

Ok.

-Carlos

#8 lore raw
Quoted 81 lines · Arnaud Faucher
Quoted 57 lines · Carlos Corbacho
Quoted 56 lines · On Sunday 26 July 2009 19:08:09 Dmitry Torokhov wrote:
Quoted 54 lines · Carlos Corbacho

[Removing linux-mips from CC - I don't know why they'd be interested in an x86 only platform driver...]

Quoted 40 lines · On Sunday 26 July 2009 14:53:33 Arnaud Faucher wrote:

Gets rid of the following warning:
Platform driver 'acer-wmi' needs updating - please use dev_pm_ops

Take 2, thanks to Dmitry, Rafael and Frans for pointing out PM issue on hibernation when using dev_pm_ops blindly.

This patch was tested against suspendand hibernation (Acer mail led status).

---
drivers/platform/x86/acer-wmi.c | 17 ++++++++++++-----

1 files changed, 12 insertions(+), 5 deletions(-)
drivers/platform/x86/acer-wmi.c +1 -2
index be2fd6f..29374bc 100644
@@ -1152,8 +1152,7 @@ static int acer_platform_remove(struct
 platform_device *device)
   return 0;
 }
 
-static int acer_platform_suspend(struct platform_device *dev,
-pm_message_t state)
+static int acer_platform_suspend(struct device *dev)
 {
   u32 value;
   struct acer_data *data = &interface->data;
drivers/platform/x86/acer-wmi.c +1 -1
@@ -1174,7 +1173,7 @@ pm_message_t state)
   return 0;
 }
 
-static int acer_platform_resume(struct platform_device *device)
+static int acer_platform_resume(struct device *dev)
 {
   struct acer_data *data = &interface->data;
 

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1195

Quoted 7 lines
drivers/platform/x86/acer-wmi.c +3 -0
@@ -1190,15 +1189,23 @@ static int acer_platform_resume(struct
 platform_device *device)
   return 0;
 }
 
+static struct dev_pm_ops acer_platform_pm_ops = {
+    .suspend = acer_platform_suspend,
+    .resume = acer_platform_resume,

Are these necessary? For suspend-to-RAM, I've never needed these. The old callbacks here were just for suspend-to-disk.

Quoted 8 lines
Quoted 3 lines

That is not correct. Old suspend and resume callbacks were called for both S2R and S2D. Whether it is actually needed for S2R I don't know but looking at the code they should not hurt.

I'm aware they were called for S2RAM as well, but that was just a limitation of the old calls - as I say, they're not needed for it (at least on my hardware anyway).

I was looking for similar functionality.

Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1197

Quoted 2 lines
drivers/platform/x86/acer-wmi.c +2 -0
+    .freeze = acer_platform_suspend,
+    .thaw = acer_platform_resume,

If we only need these callbacks for freeze & thaw, they should be rebamed.

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1199

Quoted 2 lines
drivers/platform/x86/acer-wmi.c +2 -0
+    .poweroff = acer_platform_suspend,
+    .restore = acer_platform_resume,

What do poweroff and restore mean in this context. Do my comments above apply again (i.e. are the callbacks necessary here)?

Quoted 6 lines
Quoted 1 line
Quoted 1 line

I don't think poweroff handler is needed.

After testing many combinations, I observed that I had to use that much callbacks. For example, when omitting to wire .poweroff/.restore, with .freeze/.thaw linked to suspend()/resume(), the state (of the mail led) is not restored correctly after S2D.

Have you tried with just 3 - freeze, thaw and restore?

Quoted 1 line
Signature · 1 line
Dmitry
#9 lore raw
Quoted 103 lines · Dmitry Torokhov
Quoted 90 lines · Arnaud Faucher
Quoted 67 lines · Carlos Corbacho
Quoted 60 lines · On Sunday 26 July 2009 19:08:09 Dmitry Torokhov wrote:
Quoted 51 lines · Carlos Corbacho

[Removing linux-mips from CC - I don't know why they'd be interested in
an x86 only platform driver...]

Quoted 46 lines · On Sunday 26 July 2009 14:53:33 Arnaud Faucher wrote:

Gets rid of the following warning:
Platform driver 'acer-wmi' needs updating - please use dev_pm_ops

Take 2, thanks to Dmitry, Rafael and Frans for pointing out PM issue on
hibernation when using dev_pm_ops blindly.

This patch was tested against suspendand hibernation (Acer mail led
status).

---
drivers/platform/x86/acer-wmi.c | 17 ++++++++++++-----

1 files changed, 12 insertions(+), 5 deletions(-)
drivers/platform/x86/acer-wmi.c +1 -2
index be2fd6f..29374bc 100644
@@ -1152,8 +1152,7 @@ static int acer_platform_remove(struct
 platform_device *device)
   return 0;
 }
 
-static int acer_platform_suspend(struct platform_device *dev,
-pm_message_t state)
+static int acer_platform_suspend(struct device *dev)
 {
   u32 value;
   struct acer_data *data = &interface->data;
drivers/platform/x86/acer-wmi.c +1 -1
@@ -1174,7 +1173,7 @@ pm_message_t state)
   return 0;
 }
 
-static int acer_platform_resume(struct platform_device *device)
+static int acer_platform_resume(struct device *dev)
 {
   struct acer_data *data = &interface->data;
 
@@ -1190,15 +1189,23 @@ static int acer_platform_resume(struct
 platform_device *device)
   return 0;
 }
 
Quoted 7 lines

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1195

Quoted 3 lines
drivers/platform/x86/acer-wmi.c +3 -0
+static struct dev_pm_ops acer_platform_pm_ops = {
+    .suspend = acer_platform_suspend,
+    .resume = acer_platform_resume,

Are these necessary? For suspend-to-RAM, I've never needed these. The old
callbacks here were just for suspend-to-disk.

Quoted 5 lines

That is not correct. Old suspend and resume callbacks were called for
both S2R and S2D. Whether it is actually needed for S2R I don't know but
looking at the code they should not hurt.

Quoted 6 lines

I'm aware they were called for S2RAM as well, but that was just a limitation
of the old calls - as I say, they're not needed for it (at least on my
hardware anyway).

I was looking for similar functionality.

Quoted 13 lines
Quoted 13 lines
Quoted 12 lines

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1197

Quoted 2 lines
drivers/platform/x86/acer-wmi.c +2 -0
+    .freeze = acer_platform_suspend,
+    .thaw = acer_platform_resume,

If we only need these callbacks for freeze & thaw, they should be rebamed.

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1199

Quoted 2 lines
drivers/platform/x86/acer-wmi.c +2 -0
+    .poweroff = acer_platform_suspend,
+    .restore = acer_platform_resume,

What do poweroff and restore mean in this context. Do my comments above
apply again (i.e. are the callbacks necessary here)?

Quoted 8 lines
Quoted 1 line
Quoted 1 line

I don't think poweroff handler is needed.

After testing many combinations, I observed that I had to use that much
callbacks. For example, when omitting to wire .poweroff/.restore, with .freeze/.thaw linked to suspend()/resume(), the state (of the mail
led) is not restored correctly after S2D.

Quoted 2 lines

Have you tried with just 3 - freeze, thaw and restore?

State restoration seems to be OK with only those three ones (tested against both S2RAM and S2D on my Acer Aspire 5680).

BTW, in the "struct dev_pm_ops" documentation, it would be interesting to know which callback sequence occurs in case of S2RAM and S2D events.

#10 lore raw
Quoted 104 lines · Arnaud Faucher
Quoted 103 lines · Dmitry Torokhov
Quoted 98 lines · Arnaud Faucher
Quoted 67 lines · Carlos Corbacho
Quoted 60 lines · On Sunday 26 July 2009 19:08:09 Dmitry Torokhov wrote:
Quoted 51 lines · Carlos Corbacho

[Removing linux-mips from CC - I don't know why they'd be interested in
an x86 only platform driver...]

Quoted 46 lines · On Sunday 26 July 2009 14:53:33 Arnaud Faucher wrote:

Gets rid of the following warning:
Platform driver 'acer-wmi' needs updating - please use dev_pm_ops

Take 2, thanks to Dmitry, Rafael and Frans for pointing out PM issue on
hibernation when using dev_pm_ops blindly.

This patch was tested against suspendand hibernation (Acer mail led
status).

---
drivers/platform/x86/acer-wmi.c | 17 ++++++++++++-----

1 files changed, 12 insertions(+), 5 deletions(-)
drivers/platform/x86/acer-wmi.c +1 -2
index be2fd6f..29374bc 100644
@@ -1152,8 +1152,7 @@ static int acer_platform_remove(struct
 platform_device *device)
   return 0;
 }
 
-static int acer_platform_suspend(struct platform_device *dev,
-pm_message_t state)
+static int acer_platform_suspend(struct device *dev)
 {
   u32 value;
   struct acer_data *data = &interface->data;
drivers/platform/x86/acer-wmi.c +1 -1
@@ -1174,7 +1173,7 @@ pm_message_t state)
   return 0;
 }
 
-static int acer_platform_resume(struct platform_device *device)
+static int acer_platform_resume(struct device *dev)
 {
   struct acer_data *data = &interface->data;
 
@@ -1190,15 +1189,23 @@ static int acer_platform_resume(struct
 platform_device *device)
   return 0;
 }
 
Quoted 7 lines

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1195

Quoted 3 lines
drivers/platform/x86/acer-wmi.c +3 -0
+static struct dev_pm_ops acer_platform_pm_ops = {
+    .suspend = acer_platform_suspend,
+    .resume = acer_platform_resume,

Are these necessary? For suspend-to-RAM, I've never needed these. The old
callbacks here were just for suspend-to-disk.

Quoted 5 lines

That is not correct. Old suspend and resume callbacks were called for
both S2R and S2D. Whether it is actually needed for S2R I don't know but
looking at the code they should not hurt.

Quoted 6 lines

I'm aware they were called for S2RAM as well, but that was just a limitation
of the old calls - as I say, they're not needed for it (at least on my
hardware anyway).

I was looking for similar functionality.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1197

Quoted 2 lines
drivers/platform/x86/acer-wmi.c +2 -0
+    .freeze = acer_platform_suspend,
+    .thaw = acer_platform_resume,

If we only need these callbacks for freeze & thaw, they should be rebamed.

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1199

Quoted 2 lines
drivers/platform/x86/acer-wmi.c +2 -0
+    .poweroff = acer_platform_suspend,
+    .restore = acer_platform_resume,

What do poweroff and restore mean in this context. Do my comments above
apply again (i.e. are the callbacks necessary here)?

I don't think poweroff handler is needed.

After testing many combinations, I observed that I had to use that much
callbacks. For example, when omitting to wire .poweroff/.restore, with .freeze/.thaw linked to suspend()/resume(), the state (of the mail
led) is not restored correctly after S2D.

Quoted 10 lines
Quoted 2 lines

Have you tried with just 3 - freeze, thaw and restore?

State restoration seems to be OK with only those three ones (tested against both S2RAM and S2D on my Acer Aspire 5680).

BTW, in the "struct dev_pm_ops" documentation, it would be interesting to know which callback sequence occurs in case of S2RAM and S2D events.

Here are my observations regarding PM events and callbacks:

S2RAM ("Suspend"):
event trigged -> .suspend gets called
recover from S2RAM -> .resume gets called
For *this module*, these callbacks seem not necessary, because the state of hardware seems to be automatically restored on resume from S2RAM (by BIOS ???).

S2DISK ("Hibernation"):
event trigged -> .freeze, then .thaw gets called
recover from S2DISK -> .restore gets called
As per the pm.h documentation .thaw is called after RAM image has been created, in order to restore hardware state in case RAM image failed and the system cannot power off. So this callback should be linked to something similar to the .restore callback. For *this module*, though it may not be necessary because the state of both LCD backlight and mail LED persist after RAM image creation, I have linked this callback anyway.

After around 2 days of testing, here is a third attempt for this patch. Please note that I renamed the functions to better reflect their use. Can you please stress it ?

---
 drivers/platform/x86/acer-wmi.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
(quoted diff) +0 -0

b/drivers/platform/x86/acer-wmi.c
index fb45f5e..331771d 100644

drivers/platform/x86/acer-wmi.c +0 -0
@@ -1152,8 +1152,7 @@ static int acer_platform_remove(struct

platform_device *device)
return 0;
}

-static int acer_platform_suspend(struct platform_device *dev, -pm_message_t state)
+static int acer_platform_freeze(struct device *dev)
{
u32 value;
struct acer_data *data = &interface->data;
@@ -1174,7 +1173,7 @@ pm_message_t state)
return 0;
}

-static int acer_platform_resume(struct platform_device *device) +static int acer_platform_restore(struct device *dev)
{
struct acer_data *data = &interface->data;

@@ -1190,15 +1189,20 @@ static int acer_platform_resume(struct platform_device *device)
return 0;
}

+static struct dev_pm_ops acer_platform_pm_ops = {
+ .freeze = acer_platform_freeze,
+ .thaw = acer_platform_restore,
+ .restore = acer_platform_restore,
+};
+
static struct platform_driver acer_platform_driver = {
.driver = {
.name = "acer-wmi",
.owner = THIS_MODULE,
+ .pm = &acer_platform_pm_ops,
},
.probe = acer_platform_probe,
.remove = acer_platform_remove,
- .suspend = acer_platform_suspend,
- .resume = acer_platform_resume,
};

static struct platform_device *acer_platform_device;

Signature · 1 line
1.6.3.3
#11 lore raw
Quoted 116 lines · Arnaud Faucher
Quoted 104 lines · Arnaud Faucher
Quoted 103 lines · Dmitry Torokhov
Quoted 98 lines · Arnaud Faucher
Quoted 67 lines · Carlos Corbacho
Quoted 60 lines · On Sunday 26 July 2009 19:08:09 Dmitry Torokhov wrote:
Quoted 51 lines · Carlos Corbacho

[Removing linux-mips from CC - I don't know why they'd be interested in
an x86 only platform driver...]

Quoted 46 lines · On Sunday 26 July 2009 14:53:33 Arnaud Faucher wrote:

Gets rid of the following warning:
Platform driver 'acer-wmi' needs updating - please use dev_pm_ops

Take 2, thanks to Dmitry, Rafael and Frans for pointing out PM issue on
hibernation when using dev_pm_ops blindly.

This patch was tested against suspendand hibernation (Acer mail led
status).

---
drivers/platform/x86/acer-wmi.c | 17 ++++++++++++-----

1 files changed, 12 insertions(+), 5 deletions(-)
drivers/platform/x86/acer-wmi.c +1 -2
index be2fd6f..29374bc 100644
@@ -1152,8 +1152,7 @@ static int acer_platform_remove(struct
 platform_device *device)
   return 0;
 }
 
-static int acer_platform_suspend(struct platform_device *dev,
-pm_message_t state)
+static int acer_platform_suspend(struct device *dev)
 {
   u32 value;
   struct acer_data *data = &interface->data;
drivers/platform/x86/acer-wmi.c +1 -1
@@ -1174,7 +1173,7 @@ pm_message_t state)
   return 0;
 }
 
-static int acer_platform_resume(struct platform_device *device)
+static int acer_platform_resume(struct device *dev)
 {
   struct acer_data *data = &interface->data;
 
@@ -1190,15 +1189,23 @@ static int acer_platform_resume(struct
 platform_device *device)
   return 0;
 }
 
Quoted 7 lines

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1195

Quoted 3 lines
drivers/platform/x86/acer-wmi.c +3 -0
+static struct dev_pm_ops acer_platform_pm_ops = {
+    .suspend = acer_platform_suspend,
+    .resume = acer_platform_resume,

Are these necessary? For suspend-to-RAM, I've never needed these. The old
callbacks here were just for suspend-to-disk.

Quoted 5 lines

That is not correct. Old suspend and resume callbacks were called for
both S2R and S2D. Whether it is actually needed for S2R I don't know but
looking at the code they should not hurt.

Quoted 6 lines

I'm aware they were called for S2RAM as well, but that was just a limitation
of the old calls - as I say, they're not needed for it (at least on my
hardware anyway).

I was looking for similar functionality.

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1197

Quoted 2 lines
drivers/platform/x86/acer-wmi.c +2 -0
+    .freeze = acer_platform_suspend,
+    .thaw = acer_platform_resume,

If we only need these callbacks for freeze & thaw, they should be rebamed.

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1199

Quoted 2 lines
drivers/platform/x86/acer-wmi.c +2 -0
+    .poweroff = acer_platform_suspend,
+    .restore = acer_platform_resume,

What do poweroff and restore mean in this context. Do my comments above
apply again (i.e. are the callbacks necessary here)?

I don't think poweroff handler is needed.

After testing many combinations, I observed that I had to use that much
callbacks. For example, when omitting to wire .poweroff/.restore, with .freeze/.thaw linked to suspend()/resume(), the state (of the mail
led) is not restored correctly after S2D.

Quoted 10 lines
Quoted 2 lines

Have you tried with just 3 - freeze, thaw and restore?

State restoration seems to be OK with only those three ones (tested against both S2RAM and S2D on my Acer Aspire 5680).

BTW, in the "struct dev_pm_ops" documentation, it would be interesting to know which callback sequence occurs in case of S2RAM and S2D events.

Quoted 5 lines

Here are my observations regarding PM events and callbacks:

S2RAM ("Suspend"):
event trigged -> .suspend gets called
recover from S2RAM -> .resume gets called

That's correct, plus there are .suspend_noirq() which is called during suspend, after suspend_device_irqs(), and .resume_noirq() which is called during resume, before resume_device_irqs().

Quoted 1 line

For *this module*,

What's *this module*? acer-wmi?

Quoted 6 lines

these callbacks seem not necessary, because the state
of hardware seems to be automatically restored on resume from S2RAM (by BIOS ???).

S2DISK ("Hibernation"):
event trigged -> .freeze, then .thaw gets called

To be precise, the ordering is

.freeze()
.freeze_noirq()
create image
.thaw_noirq()
.thaw()
save image
.poweroff()
.poweroff_noirq()
enter sleep state

Quoted 1 line

recover from S2DISK -> .restore gets called

To be precise, the ordering is:

Boot kernel:
load image
.freeze()
.freeze_noirq()
pass control to the image kernel
Image kernel:
.restore_noirq()
.restore()

Quoted 3 lines

As per the pm.h documentation .thaw is called after RAM image has been created, in order to restore hardware state in case RAM image failed and the system cannot power off.

That's not correct (please see above). .thaw() is called after creating the image in case .freeze() has changed the state of the device. This often is not necessary, though, so .thaw() may be skipped in many cases. Of course, you should know exactly what you're doing.

Quoted 41 lines

So this callback should be linked to
something similar to the .restore callback. For *this module*, though it may not be necessary because the state of both LCD backlight and mail LED persist after RAM image creation, I have linked this callback anyway.

After around 2 days of testing, here is a third attempt for this patch. Please note that I renamed the functions to better reflect their use. Can you please stress it ?

---
 drivers/platform/x86/acer-wmi.c |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
drivers/platform/x86/acer-wmi.c +1 -2
index fb45f5e..331771d 100644
@@ -1152,8 +1152,7 @@ static int acer_platform_remove(struct
 platform_device *device)
 	return 0;
 }
 
-static int acer_platform_suspend(struct platform_device *dev,
-pm_message_t state)
+static int acer_platform_freeze(struct device *dev)
 {
 	u32 value;
drivers/platform/x86/acer-wmi.c +1 -1
 	struct acer_data *data = &interface->data;
@@ -1174,7 +1173,7 @@ pm_message_t state)
 	return 0;
 }
 
-static int acer_platform_resume(struct platform_device *device)
+static int acer_platform_restore(struct device *dev)
 {
 	struct acer_data *data = &interface->data;
 

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1194

Quoted 6 lines
drivers/platform/x86/acer-wmi.c +2 -0
@@ -1190,15 +1189,20 @@ static int acer_platform_resume(struct
 platform_device *device)
 	return 0;
 }
 
+static struct dev_pm_ops acer_platform_pm_ops = {
+	.freeze = acer_platform_freeze,

+ .suspend = acer_platform_freeze,

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1195

Quoted 1 line
drivers/platform/x86/acer-wmi.c +1 -0
+	.thaw = acer_platform_restore,

.thaw is not necessary AFAICS.

drivers/platform/x86/acer-wmi.c static int acer_platform_resume(struct · line 1196

Quoted 1 line
drivers/platform/x86/acer-wmi.c +1 -0
+	.restore = acer_platform_restore,

+ .resume = acer_platform_restore,

Quoted 14 lines
drivers/platform/x86/acer-wmi.c +3 -2
+};
+
 static struct platform_driver acer_platform_driver = {
 	.driver = {
 		.name = "acer-wmi",
 		.owner = THIS_MODULE,
+		.pm = &acer_platform_pm_ops,
 	},
 	.probe = acer_platform_probe,
 	.remove = acer_platform_remove,
-	.suspend = acer_platform_suspend,
-	.resume = acer_platform_resume,
 };
 
Quoted 1 line

static struct platform_device *acer_platform_device;

Thanks,
Rafael

#12 lore raw
Quoted 11 lines · Rafael J. Wysocki
Quoted 3 lines · Arnaud Faucher

As per the pm.h documentation .thaw is called after RAM image has been created, in order to restore hardware state in case RAM image failed and the system cannot power off.

That's not correct (please see above). .thaw() is called after creating the image in case .freeze() has changed the state of the device. This often is not necessary, though, so .thaw() may be skipped in many cases. Of course, you should know exactly what you're doing.

Umm, but thaw() _is_ called in case of hibernate failure:

        case PM_EVENT_THAW:
        case PM_EVENT_RECOVER:
                if (ops->thaw) {
                        error = ops->thaw(dev);
                        suspend_report_result(ops->thaw, error);
                }
                break;

so I don't believe you can easily skip thaw() if you have freeze() that stops/resets device.

Signature · 1 line
Dmitry
#13 lore raw
Quoted 23 lines · Dmitry Torokhov
Quoted 11 lines · Rafael J. Wysocki
Quoted 3 lines · Arnaud Faucher

As per the pm.h documentation .thaw is called after RAM image has been created, in order to restore hardware state in case RAM image failed and the system cannot power off.

That's not correct (please see above). .thaw() is called after creating the image in case .freeze() has changed the state of the device. This often is not necessary, though, so .thaw() may be skipped in many cases. Of course, you should know exactly what you're doing.

Umm, but thaw() _is_ called in case of hibernate failure:

        case PM_EVENT_THAW:
        case PM_EVENT_RECOVER:
                if (ops->thaw) {
                        error = ops->thaw(dev);
                        suspend_report_result(ops->thaw, error);
                }
                break;
Quoted 3 lines

so I don't believe you can easily skip thaw() if you have freeze() that stops/resets device.

As of today, acer_platform_freeze() does not stop/reset any device, so, I agree with Rafael that for acer-wmi, .thaw() can be skipped. I had also tested this configuration and it was working like the non-patched code.

Carlos, do you think that any acer-specific hardware could be switched off or reset inside acer_platform_freeze() ? If this was the case, we would have to wire .thaw()...

#14 lore raw
Quoted 9 lines · Arnaud Faucher

As of today, acer_platform_freeze() does not stop/reset any device, so, I agree with Rafael that for acer-wmi, .thaw() can be skipped. I had also tested this configuration and it was working like the non-patched code.

Carlos, do you think that any acer-specific hardware could be switched off or reset inside acer_platform_freeze() ? If this was the case, we would have to wire .thaw()...

Should I send a new patch with only .freeze() and .restore() wired ?

---
Hope to see Cox and Torvalds reconcile...

#15 lore raw
Quoted 6 lines · Arnaud Faucher
Quoted 5 lines · Arnaud Faucher

As of today, acer_platform_freeze() does not stop/reset any device, so, I agree with Rafael that for acer-wmi, .thaw() can be skipped. I had also tested this configuration and it was working like the non-patched code.

Quoted 6 lines
Quoted 4 lines

Carlos, do you think that any acer-specific hardware could be switched off or reset inside acer_platform_freeze() ? If this was the case, we would have to wire .thaw()...

Should I send a new patch with only .freeze() and .restore() wired ?

Just for clarification.

If you need .freeze(), then you need .suspend() as well (they can both point to the same function). Similarly, if you .restore(), then .resume() is needed as well.

Otherwise the driver is going to break suspend to RAM (or resume).

Best,
Rafael

#16 lore raw
In reply to Dmitry Torokhov
Quoted 23 lines · Dmitry Torokhov
Quoted 11 lines · Rafael J. Wysocki
Quoted 3 lines · Arnaud Faucher

As per the pm.h documentation .thaw is called after RAM image has been created, in order to restore hardware state in case RAM image failed and the system cannot power off.

That's not correct (please see above). .thaw() is called after creating the image in case .freeze() has changed the state of the device. This often is not necessary, though, so .thaw() may be skipped in many cases. Of course, you should know exactly what you're doing.

Umm, but thaw() _is_ called in case of hibernate failure:

        case PM_EVENT_THAW:
        case PM_EVENT_RECOVER:
                if (ops->thaw) {
                        error = ops->thaw(dev);
                        suspend_report_result(ops->thaw, error);
                }
                break;
Quoted 2 lines

so I don't believe you can easily skip thaw() if you have freeze() that stops/resets device.

_RECOVER means "image creation failed or unable to run the image kernel", so from the devices' point of view it's the same as _THAW.

Still, if your .freeze() modifies the device's registers, then most likely .thaw() _is_ necessary.

Best,
Rafael

#17 lore raw
In reply to Dmitry Torokhov
Quoted 7 lines · Dmitry Torokhov

Hi Arnaud,

Quoted 3 lines · Arnaud Faucher

Gets rid of the following warning:
Platform driver 'acer-wmi' needs updating - please use dev_pm_ops

Quoted 8 lines

Have you tested it with Suspend to disk? You are [potentially] breaking it since the new suspend and resume methods are not used by it, it calls freeze() and thaw() instead.

Rafael,

I wonder if PM core should automatically use suspend()/resume() in place of freeze()/thaw() when the latter pair is missing.

Well, in fact it often is not necessary to do .thaw() at all, because the state of the device doesn't change in .freeze(). Also, PCI drivers should not need .thaw(), unless they manipulate the standard PM registers of the device themselves.

That said, if .suspend() is defined, then most probably .freeze() is necessary as well. Also, if .resume() is defined, .restore() is most probably necessary and it should be safe to use .suspend() as .freeze() and .resume() as .restore().

OTOH, it's really easy to point .restore() to the same routine as .resume() etc., so I'm not sure.

Best,
Rafael

#18 lore raw
In reply to Dmitry Torokhov
Quoted 7 lines · Dmitry Torokhov

Hi Arnaud,

Quoted 3 lines · Arnaud Faucher

Gets rid of the following warning:
Platform driver 'acer-wmi' needs updating - please use dev_pm_ops

Quoted 9 lines

Have you tested it with Suspend to disk? You are [potentially] breaking it since the new suspend and resume methods are not used by it, it calls freeze() and thaw() instead.

Rafael,

I wonder if PM core should automatically use suspend()/resume() in place of freeze()/thaw() when the latter pair is missing.

By studying drivers/base/platform.c, suspend()/resume() are not called when freeze()/thaw() are missing. So you're right, this patch breaks something.

I am testing right now a new patch against hibernation.