Skip to contentSkip to conversation

Add Legacy PM OPS usage checks to class, bus, and driver register functions

PATCH Superseded Shuah Khan 3 participants 10 messages Nov 8, 2013 – Jan 2, 2014 Driver core

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Shuah Khan

author
#0 lore raw

cover Add Legacy PM OPS usage checks to class, bus, and driver register functions

Add Legacy PM OPS usage checks to class, bus, and driver register functions. If Legacy PM OPS usage is found, print warning message to indicate the driver code needs updating to use Dev PM OPS interfaces. This will help serve as a way to track drivers that still use Legacy PM OPS and fix them.

This patch set adds Legacy PM OPS usage check and warning to bus_register(), __class_register(), and driver_register() functions.

Individual patches in this series are not dependent on each other. The only reason this is a series is for context and facilitating discussion on the overall change as opposed individual patches.

Shuah Khan (3):
drivers/bus: Add Legacy PM OPS usage check and warning to
bus_register()
drivers/class: Add Legacy PM OPS usage check and warning to

    __class_register()

driver: Add Legacy PM OPS usage check and warning to driver_register()

 drivers/base/bus.c    | 3 +++
 drivers/base/class.c  | 4 ++++
 drivers/base/driver.c | 4 ++++
 3 files changed, 11 insertions(+)
Signature · 1 line
1.8.3.2
author
#1 lore raw

PATCH 1/3 drivers/bus: Add Legacy PM OPS usage check and warning to bus_register()

Add Legacy PM OPS usage checks to bus_register() function. If Legacy PM OPS usage is found, print warning message to indicate the driver code needs updating to use Dev PM OPS interfaces. This will help serve as a way to track drivers that still use Legacy PM OPS and fix them.

The Legacy PM OPS check looks for suspend(struct device *, pm_message_t) or resume(struct device *) bus level interfaces.

---
 drivers/base/bus.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/base/bus.c +3 -0
index 4c289ab..9e68453 100644
@@ -991,6 +991,9 @@ int bus_register(struct bus_type *bus)
 		goto bus_groups_fail;
 
 	pr_debug("bus: '%s': registered\n", bus->name);
+	if (bus->suspend || bus->resume)
+		pr_warn("bus '%s': Please update to use dev pm ops.\n",
+			bus->name);
 	return 0;
 
 bus_groups_fail:
Signature · 1 line
1.8.3.2
author
#2 lore raw

PATCH 2/3 drivers/class: Add Legacy PM OPS usage check and warning to __class_register()

In reply to Shuah Khan

Add Legacy PM OPS usage checks to __class_register() function. If Legacy PM OPS usage is found, print warning message to indicate the driver code needs updating to use Dev PM OPS interfaces. This will help serve as a way to track drivers that still use Legacy PM OPS and fix them.

The Legacy PM OPS check looks for suspend(struct device *, pm_message_t) or resume(struct device *) class level interfaces.

---
 drivers/base/class.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/base/class.c +4 -0
index 8b7818b..f26a3f2 100644
@@ -180,6 +180,10 @@ int __class_register(struct class *cls, struct lock_class_key *key)
 
 	pr_debug("device class '%s': registering\n", cls->name);
 
+	if (cls->suspend || cls->resume)
+		pr_warn("device class '%s': Please update to use dev pm ops\n",
+			cls->name);
+
 	cp = kzalloc(sizeof(*cp), GFP_KERNEL);
 	if (!cp)
 		return -ENOMEM;
Signature · 1 line
1.8.3.2
author
#3 lore raw

PATCH 3/3 driver: Add Legacy PM OPS usage check and warning to driver_register()

In reply to Shuah Khan

Add Legacy PM OPS usage checks to driver_register() function. If Legacy PM OPS usage is found, print warning message to indicate the driver code needs updating to use Dev PM OPS interfaces. This will help serve as a way to track drivers that still use Legacy PM OPS and fix them.

The Legacy PM OPS check looks for suspend(struct device *, pm_message_t) or resume(struct device *) struct device_driver interfaces.

---
 drivers/base/driver.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/base/driver.c +4 -0
index 9e29943..10ff280 100644
@@ -157,6 +157,10 @@ int driver_register(struct device_driver *drv)
 		printk(KERN_WARNING "Driver '%s' needs updating - please use "
 			"bus_type methods\n", drv->name);
 
+	if (drv->suspend || drv->resume)
+		pr_warn("Please update driver '%s' to use dev pm ops.\n",
+			drv->name);
+
 	other = driver_find(drv->name, drv->bus);
 	if (other) {
 		printk(KERN_ERR "Error: Driver '%s' is already registered, "
Signature · 1 line
1.8.3.2
#4 lore raw

Re: [PATCH 3/3] driver: Add Legacy PM OPS usage check and warning to driver_register()

Quoted 18 lines · Shuah Khan

Add Legacy PM OPS usage checks to driver_register() function. If Legacy PM OPS usage is found, print warning message to indicate the driver code needs updating to use Dev PM OPS interfaces. This will help serve as a way to track drivers that still use Legacy PM OPS and fix them.

The Legacy PM OPS check looks for suspend(struct device *, pm_message_t) or resume(struct device *) struct device_driver interfaces.

---
 drivers/base/driver.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/base/driver.c +0 -0
index 9e29943..10ff280 100644

drivers/base/driver.c int driver_register(struct device_driver *drv) · line 162

Quoted 6 lines
drivers/base/driver.c +3 -0
@@ -157,6 +157,10 @@ int driver_register(struct device_driver *drv)
 		printk(KERN_WARNING "Driver '%s' needs updating - please use "
 			"bus_type methods\n", drv->name);
 
+	if (drv->suspend || drv->resume)
+		pr_warn("Please update driver '%s' to use dev pm ops.\n",
+			drv->name);

What about the following message instead:

		pr_warn("Driver '%s' needs updating - please use the pm pointer.\n",
			drv->name);

And analogously for bus types and classes?

drivers/base/driver.c int driver_register(struct device_driver *drv) · line 166

Quoted 5 lines
drivers/base/driver.c +1 -0
+
 	other = driver_find(drv->name, drv->bus);
 	if (other) {
 		printk(KERN_ERR "Error: Driver '%s' is already registered, "

Thanks!

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.
author
#5 lore raw

Re: [PATCH 3/3] driver: Add Legacy PM OPS usage check and warning to driver_register()

Quoted 22 lines · Rafael J. Wysocki
Quoted 21 lines · Shuah Khan

Add Legacy PM OPS usage checks to driver_register() function. If Legacy PM OPS usage is found, print warning message to indicate the driver code needs updating to use Dev PM OPS interfaces. This will help serve as a way to track drivers that still use Legacy PM OPS and fix them.

The Legacy PM OPS check looks for suspend(struct device *, pm_message_t) or resume(struct device *) struct device_driver interfaces.

---
  drivers/base/driver.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/base/driver.c +0 -0
index 9e29943..10ff280 100644
@@ -157,6 +157,10 @@ int driver_register(struct device_driver *drv)
  		printk(KERN_WARNING "Driver '%s' needs updating - please use "
  			"bus_type methods\n", drv->name);
 
Quoted 8 lines

drivers/base/driver.c int driver_register(struct device_driver *drv) · line 162

Quoted 3 lines
drivers/base/driver.c +3 -0
+	if (drv->suspend || drv->resume)
+		pr_warn("Please update driver '%s' to use dev pm ops.\n",
+			drv->name);

What about the following message instead:

		pr_warn("Driver '%s' needs updating - please use the pm pointer.\n",
			drv->name);

I thought pm ops would be more informative for driver developers. That said, I will change the message and re-send the patch.

Quoted 11 lines

And analogously for bus types and classes?

drivers/base/driver.c int driver_register(struct device_driver *drv) · line 166

Quoted 5 lines
drivers/base/driver.c +1 -0
+
  	other = driver_find(drv->name, drv->bus);
  	if (other) {
  		printk(KERN_ERR "Error: Driver '%s' is already registered, "

Thanks!

Signature · 4 lines
Shuah Khan
Senior Linux Kernel Developer - Open Source Group
Samsung Research America(Silicon Valley)
[email protected] | (970) 672-0658
author
#6 lore raw
In reply to Shuah Khan
Quoted 16 lines · Shuah Khan

Add Legacy PM OPS usage checks to class, bus, and driver register functions. If Legacy PM OPS usage is found, print warning message to indicate the driver code needs updating to use Dev PM OPS interfaces. This will help serve as a way to track drivers that still use Legacy PM OPS and fix them.

This patch set adds Legacy PM OPS usage check and warning to bus_register(), __class_register(), and driver_register() functions.

Individual patches in this series are not dependent on each other. The only reason this is a series is for context and facilitating discussion on the overall change as opposed individual patches.

Shuah Khan (3):
drivers/bus: Add Legacy PM OPS usage check and warning to
bus_register()
drivers/class: Add Legacy PM OPS usage check and warning to

Quoted 8 lines
     __class_register()

driver: Add Legacy PM OPS usage check and warning to driver_register()

  drivers/base/bus.c    | 3 +++
  drivers/base/class.c  | 4 ++++
  drivers/base/driver.c | 4 ++++
  3 files changed, 11 insertions(+)

Greg/Rafael,

Any feedback on this series? Haven't gotten to it or don't like it?

-- Shuah

Signature · 4 lines
Shuah Khan
Senior Linux Kernel Developer - Open Source Group
Samsung Research America(Silicon Valley)
[email protected] | (970) 672-0658
#7 lore raw
Quoted 26 lines · Shuah Khan
Quoted 16 lines · Shuah Khan

Add Legacy PM OPS usage checks to class, bus, and driver register functions. If Legacy PM OPS usage is found, print warning message to indicate the driver code needs updating to use Dev PM OPS interfaces. This will help serve as a way to track drivers that still use Legacy PM OPS and fix them.

This patch set adds Legacy PM OPS usage check and warning to bus_register(), __class_register(), and driver_register() functions.

Individual patches in this series are not dependent on each other. The only reason this is a series is for context and facilitating discussion on the overall change as opposed individual patches.

Shuah Khan (3):
drivers/bus: Add Legacy PM OPS usage check and warning to
bus_register()
drivers/class: Add Legacy PM OPS usage check and warning to

Quoted 8 lines
     __class_register()

driver: Add Legacy PM OPS usage check and warning to driver_register()

  drivers/base/bus.c    | 3 +++
  drivers/base/class.c  | 4 ++++
  drivers/base/driver.c | 4 ++++
  3 files changed, 11 insertions(+)
Quoted 3 lines

Greg/Rafael,

Any feedback on this series? Haven't gotten to it or don't like it?

I haven't had the time to review this, sorry.

Thanks,
Rafael

maintainer
#8 lore raw
Quoted 27 lines · Rafael J. Wysocki
Quoted 26 lines · Shuah Khan
Quoted 24 lines · Shuah Khan

Add Legacy PM OPS usage checks to class, bus, and driver register functions. If Legacy PM OPS usage is found, print warning message to indicate the driver code needs updating to use Dev PM OPS interfaces. This will help serve as a way to track drivers that still use Legacy PM OPS and fix them.

This patch set adds Legacy PM OPS usage check and warning to bus_register(), __class_register(), and driver_register() functions.

Individual patches in this series are not dependent on each other. The only reason this is a series is for context and facilitating discussion on the overall change as opposed individual patches.

Shuah Khan (3):
drivers/bus: Add Legacy PM OPS usage check and warning to
bus_register()
drivers/class: Add Legacy PM OPS usage check and warning to

     __class_register()

driver: Add Legacy PM OPS usage check and warning to driver_register()

  drivers/base/bus.c    | 3 +++
  drivers/base/class.c  | 4 ++++
  drivers/base/driver.c | 4 ++++
  3 files changed, 11 insertions(+)
Quoted 5 lines
Quoted 3 lines

Greg/Rafael,

Any feedback on this series? Haven't gotten to it or don't like it?

I haven't had the time to review this, sorry.

ping?

maintainer
#9 lore raw
In reply to Shuah Khan
Quoted 26 lines · Shuah Khan
Quoted 16 lines · Shuah Khan

Add Legacy PM OPS usage checks to class, bus, and driver register functions. If Legacy PM OPS usage is found, print warning message to indicate the driver code needs updating to use Dev PM OPS interfaces. This will help serve as a way to track drivers that still use Legacy PM OPS and fix them.

This patch set adds Legacy PM OPS usage check and warning to bus_register(), __class_register(), and driver_register() functions.

Individual patches in this series are not dependent on each other. The only reason this is a series is for context and facilitating discussion on the overall change as opposed individual patches.

Shuah Khan (3):
drivers/bus: Add Legacy PM OPS usage check and warning to
bus_register()
drivers/class: Add Legacy PM OPS usage check and warning to

Quoted 8 lines
     __class_register()

driver: Add Legacy PM OPS usage check and warning to driver_register()

  drivers/base/bus.c    | 3 +++
  drivers/base/class.c  | 4 ++++
  drivers/base/driver.c | 4 ++++
  3 files changed, 11 insertions(+)
Quoted 3 lines

Greg/Rafael,

Any feedback on this series? Haven't gotten to it or don't like it?

It's the middle of the merge window, where I can't apply any new patches, and I'm traveling in Korea, so nothing is getting done on any patches anyone has sent me, you aren't alone :)

Wait until 3.13-rc1 is out, then I'll start digging through my patch queue and reviewing them, your's is in there as well.

thanks,

greg k-h