From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Lechner Subject: Re: [PATCH v2 3/5] counter: new TI eQEP driver Date: Sun, 11 Aug 2019 14:15:14 -0500 Message-ID: References: <20190807194023.15318-1-david@lechnology.com> <20190807194023.15318-4-david@lechnology.com> <20190811102345.1af5c23c@archlinux> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20190811102345.1af5c23c@archlinux> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org To: Jonathan Cameron , linux-omap@vger.kernel.org Cc: linux-iio@vger.kernel.org, Rob Herring , Mark Rutland , =?UTF-8?Q?Beno=c3=aet_Cousson?= , Tony Lindgren , William Breathitt Gray , Thierry Reding , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pwm@vger.kernel.org List-Id: devicetree@vger.kernel.org On 8/11/19 4:23 AM, Jonathan Cameron wrote: > On Wed, 7 Aug 2019 14:40:21 -0500 > David Lechner wrote: >> + >> + pm_runtime_enable(dev); >> + pm_runtime_get(dev); > I'm a little confused on the flow here. > > pm_runtime_enable turns on runtime pm in general. > > pm_runtime_get basically calls runtime_resume to ensrue the > device has power. > >> + >> + return devm_counter_register(dev, &priv->counter); > > This registers the userspace interfaces and exposes the device. > >> +} >> + >> +static int ti_eqep_remove(struct platform_device *pdev) >> +{ >> + struct device *dev = &pdev->dev; >> + >> + pm_runtime_put(dev), >> + pm_runtime_disable(dev); > > pm_runtime_put notifies the system that the device is idle > (and hence potentially turns it off). > > Not good if the counter is still registered. > > I'm assuming the presence of runtime pm at all is to interact > with a parent driver and hence stop that turning off if this > driver is probed? That's probably fine, but add a few comments > to make it clear that this driver itself doesn't really do > runtime pm at all. > To be honest, despite reading the runtime PM docs more than once, I still don't feel like I have a good grasp on how it is supposed to work. I just know that we get a crash if it is omitted because the IP block is not powered on. I will fix the ordering in _remove() and add a comment in v3.