Skip to contentSkip to conversation

i2c: Encourage move to dev_pm_ops by warning on use of legacy methods

PATCH In review Mark Brown 3 participants 4 messages Dec 20, 2010 – Jan 13, 2011 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 i2c: Encourage move to dev_pm_ops by warning on use of legacy methods

Since the PM core wishes to transition away from the legacy suspend and resume methods and since removing them makes using PM core features like runtime PM much easier start warning when a driver is registered using the legacy methods.

---

Clearly this is going to generate reams of warnings when lots of stuff is built in - I'm willing to work on fixing up drivers - so it should only be applied after the next merge window to give a chance for an active effort at migrating drivers before we spam everyone's logs.

 drivers/i2c/i2c-core.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/i2c/i2c-core.c +8 -0
index 6b4cc56..8cd82f4 100644
@@ -1140,6 +1140,14 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver)
 	if (res)
 		return res;
 
+	/* Drivers should switch to dev_pm_ops instead. */
+	if (driver->suspend)
+		pr_warn("i2c-core: driver [%s] using legacy suspend method\n",
+			driver->driver.name);
+	if (driver->resume)
+		pr_warn("i2c-core: driver [%s] using legacy resume method\n",
+			driver->driver.name);
+
 	pr_debug("i2c-core: driver [%s] registered\n", driver->driver.name);
 
 	INIT_LIST_HEAD(&driver->clients);
Signature · 1 line
1.7.1

A message that is not in the archive (sent off-list or not yet received): 1292881260-31987-1-git-send-email-broonie-yzvPICuk2AATkU/[email protected]

#2 lore raw
Quoted 5 lines · Mark Brown

Since the PM core wishes to transition away from the legacy suspend and resume methods and since removing them makes using PM core features like runtime PM much easier start warning when a driver is registered using the legacy methods.

Quoted 7 lines

---

Clearly this is going to generate reams of warnings when lots of stuff is built in - I'm willing to work on fixing up drivers - so it should only be applied after the next merge window to give a chance for an active effort at migrating drivers before we spam everyone's logs.

Ok, it'll generate warnings at load-time, maybe move it to when the drive is actually bound to a device?

Otherwise looks ok to me.

I'll look at pm-ops for the bus drivers after christmas, once the pre-emptive house spring-clean has finished...

Signature · 3 lines
Ben Dooks, [email protected], http://www.fluff.org/ben/

Large Hadron Colada: A large Pina Colada that makes the universe disappear.

A message that is not in the archive (sent off-list or not yet received): 20101220215958.GB1126-SMNkleLxa3Z6Wcw2j4pizdi2O/[email protected]

author
#4 lore raw
Quoted 2 lines · Ben Dooks

Ok, it'll generate warnings at load-time, maybe move it to when the drive is actually bound to a device?

It struck me that this warning was more likely to trigger as you don't need to actually have the device present in a particular system, just built into or loaded into the kernel, and that it probably ought to only go off once per driver anyway.

Quoted 2 lines

I'll look at pm-ops for the bus drivers after christmas, once the pre-emptive house spring-clean has finished...

With the patch I sent yesterday this should now all be delegated to the PM core.

#5 lore raw
In reply to a message not in the archive
Quoted 25 lines · Mark Brown

Since the PM core wishes to transition away from the legacy suspend and resume methods and since removing them makes using PM core features like runtime PM much easier start warning when a driver is registered using the legacy methods.

---

Clearly this is going to generate reams of warnings when lots of stuff is built in - I'm willing to work on fixing up drivers - so it should only be applied after the next merge window to give a chance for an active effort at migrating drivers before we spam everyone's logs.

 drivers/i2c/i2c-core.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
drivers/i2c/i2c-core.c +1 -0
index 6b4cc56..8cd82f4 100644
@@ -1140,6 +1140,14 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver)
 	if (res)
 		return res;
 
+	/* Drivers should switch to dev_pm_ops instead. */

drivers/i2c/i2c-core.c int i2c_register_driver(struct module *owner, struct i2c_driver *driver) · line 1153

Quoted 10 lines
drivers/i2c/i2c-core.c +7 -0
+	if (driver->suspend)
+		pr_warn("i2c-core: driver [%s] using legacy suspend method\n",
+			driver->driver.name);
+	if (driver->resume)
+		pr_warn("i2c-core: driver [%s] using legacy resume method\n",
+			driver->driver.name);
+
 	pr_debug("i2c-core: driver [%s] registered\n", driver->driver.name);
 
 	INIT_LIST_HEAD(&driver->clients);

Sorry for the delay. Applied, thanks.

Signature · 1 line
Jean Delvare