Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751385AbdH3Ml1 (ORCPT ); Wed, 30 Aug 2017 08:41:27 -0400 Received: from nblzone-211-213.nblnetworks.fi ([83.145.211.213]:36524 "EHLO hillosipuli.retiisi.org.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751302AbdH3Ml0 (ORCPT ); Wed, 30 Aug 2017 08:41:26 -0400 Date: Wed, 30 Aug 2017 15:41:23 +0300 From: Sakari Ailus To: "Mohandass, Divagar" Cc: "robh+dt@kernel.org" , "mark.rutland@arm.com" , "wsa@the-dreams.de" , "devicetree@vger.kernel.org" , "linux-i2c@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Mani, Rajmohan" Subject: Re: [PATCH v3 3/3] eeprom: at24: enable runtime pm support Message-ID: <20170830124122.3oipo4ykpzmkzdy2@valkosipuli.retiisi.org.uk> References: <1504066266-30051-1-git-send-email-divagar.mohandass@intel.com> <1504066266-30051-4-git-send-email-divagar.mohandass@intel.com> <20170830075329.cyhzitpfwojq3aox@valkosipuli.retiisi.org.uk> <7B8CE47BD58441468D2BB13285B50E6031DE621E@BGSMSX107.gar.corp.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7B8CE47BD58441468D2BB13285B50E6031DE621E@BGSMSX107.gar.corp.intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 968 Lines: 31 On Wed, Aug 30, 2017 at 12:32:07PM +0000, Mohandass, Divagar wrote: > >> @@ -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@iki.fi