Thread (8 messages) 8 messages, 2 authors, 2017-08-30

Re: [PATCH v3 3/3] eeprom: at24: enable runtime pm support

From: Sakari Ailus <hidden>
Date: 2017-08-30 12:41:27
Also in: linux-i2c, lkml

On Wed, Aug 30, 2017 at 12:32:07PM +0000, Mohandass, Divagar wrote:
quoted
quoted
@@ -743,6 +770,15 @@ static int at24_probe(struct i2c_client *client,
const struct i2c_device_id *id)

 	i2c_set_clientdata(client, at24);

+	/* enable runtime pm */
+	pm_runtime_get_noresume(&client->dev);
+	err = pm_runtime_set_active(&client->dev);
+	if (err < 0)
+		goto err_clients;
+
+	pm_runtime_enable(&client->dev);
+	pm_runtime_put(&client->dev);
+
You're just about to perform a read here. I believe you should move the last
put after that.
At the end of at24_read we are performing a pm_runtime_put, still we need this change ?
True, so this isn't an actual problem.

It'll still power the chip down when you're about to need it, so it'd make
sense to perform the check before pm_runtime_put().

I might move the runtime PM setup after the check altogether.

-- 
Sakari Ailus
e-mail: sakari.ailus-X3B1VOXEql0@public.gmane.org
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help