Skip to contentSkip to conversation

drm/i2c/ch7006: Convert to dev_pm_ops

PATCH In review Mark Brown 2 participants 3 messages Jun 12, 2012 – Jun 27, 2012

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 drm/i2c/ch7006: Convert to dev_pm_ops

The I2C specific suspend and resume functions have been deprecated and printing a warning on boot for over a year, dev_pm_ops should be used instead so convert to that.

Also remove the suspend function since all it does is log.

---

This patch has been sitting around for quite a while now, it's going to end up blocking improvements in the I2C subsystem at some point.

 drivers/gpu/drm/i2c/ch7006_drv.c |   16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)
drivers/gpu/drm/i2c/ch7006_drv.c +7 -9
index d3f2e87..74ad254 100644
@@ -427,15 +427,10 @@ static int ch7006_remove(struct i2c_client *client)
 	return 0;
 }
 
-static int ch7006_suspend(struct i2c_client *client, pm_message_t mesg)
+static int ch7006_resume(struct device *dev)
 {
-	ch7006_dbg(client, "\n");
-
-	return 0;
-}
+	struct i2c_client *client = to_i2c_device(dev);
 
-static int ch7006_resume(struct i2c_client *client)
-{
 	ch7006_dbg(client, "\n");
 
 	ch7006_write(client, 0x3d, 0x0);
@@ -499,15 +494,18 @@ static struct i2c_device_id ch7006_ids[] = {
 };
 MODULE_DEVICE_TABLE(i2c, ch7006_ids);
 
+static const struct dev_pm_ops ch7006_pm_ops = {
+	.resume = ch7006_resume,
+};
+
 static struct drm_i2c_encoder_driver ch7006_driver = {
 	.i2c_driver = {
 		.probe = ch7006_probe,
 		.remove = ch7006_remove,
-		.suspend = ch7006_suspend,
-		.resume = ch7006_resume,
 
 		.driver = {
 			.name = "ch7006",
+			.pm = &ch7006_pm_ops,
 		},
 
 		.id_table = ch7006_ids,
Signature · 1 line
1.7.10
maintainer
#1 lore raw
Quoted 8 lines · Mark Brown

The I2C specific suspend and resume functions have been deprecated and printing a warning on boot for over a year, dev_pm_ops should be used instead so convert to that.

Also remove the suspend function since all it does is log.

Thanks for this and I like the fact its been posted 5 times but never compiled once.

Can you at least test compile it?

comment below:

Quoted 3 lines

-}
+       struct i2c_client *client = to_i2c_device(dev);

This isn't a function ^^

Dave.

author
#2 lore raw
Quoted 2 lines · Dave Airlie

Thanks for this and I like the fact its been posted 5 times but never compiled once.

It's hard to remember since it was so long ago that I wrote the patch but I rather suspect the reason this didn't happen is that it's actually fairly hard to enable for test builds as the relevant Kconfig is buried in a different directory (it's done as part of the Nouveau driver) with no immediate relationship with the code. That said...

Quoted 1 line

Can you at least test compile it?

...it could also be that the build error I get when I enable CONFIG_DRM with -next is a long standing one:

In file included from include/drm/drmP.h:75,

                 from drivers/gpu/drm/drm_auth.c:36:

include/drm/drm.h:47: fatal error: sys/ioccom.h: No such file or directory compilation terminated.
make[3]: *** [drivers/gpu/drm/drm_auth.o] Error 1

The error here seems to be that you're relying on __linux__ to decide if you're building the kernel but that's not something you can rely on, we can build the kernel with a freestanding compiler and the compiler will only define this if it targets a Linux userspace. I happen to do pretty much all of my kernel builds with a freestanding compiler.