From: Tony Lindgren Subject: Re: [PATCH 2/2] wlcore: Add support runtime PM Date: Tue, 15 May 2018 09:25:46 -0700 Message-ID: <20180515162546.GO98604@atomide.com> References: <20180515161315.1997-1-tony@atomide.com> <20180515161315.1997-3-tony@atomide.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-wireless-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Michael Nazzareno Trimarchi Cc: Kalle Valo , Eyal Reizer , Kishon Vijay Abraham I , Guy Mishol , Luca Coelho , Maital Hahn , Maxim Altshul , Shahar Patury , linux-wireless-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Linux OMAP Mailing List List-Id: linux-omap@vger.kernel.org * Michael Nazzareno Trimarchi [180515 16:19]: > On Tue, May 15, 2018 at 6:13 PM, Tony Lindgren wrote: > > @@ -315,15 +319,17 @@ static ssize_t dynamic_fw_traces_write(struct file *file, > > if (unlikely(wl->state != WLCORE_STATE_ON)) > > goto out; > > > > - ret = wl1271_ps_elp_wakeup(wl); > > - if (ret < 0) > > + ret = pm_runtime_get_sync(wl->dev); > > + if (ret < 0) { > > + pm_runtime_put_noidle(wl->dev); > > goto out; > > + } > > > > Can you just change ps_elp_wakeup with > ret = pm_runtime_get_sync(wl->dev); > if (ret < 0) { > pm_runtime_put_noidle(wl->dev); > goto out; > } > > > ret = wl18xx_acx_dynamic_fw_traces(wl); > > if (ret < 0) > > count = ret; > > > > - wl1271_ps_elp_sleep(wl); > > + pm_runtime_put(wl->dev); > > and elp_sleep with this one That's what I started with, but they really behave in a different way. And there is no usage count. It's really best to just get rid of the custom PM calls in favor of generic calls. That's because then we have much better control for future changes in the driver with pm_runtime_use_autosuspend() and pm_runtime_put_sync() for example. Regards, Tony