Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp2962464ybl; Sun, 11 Aug 2019 12:16:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqyyABdYyOKiT5k5voXXMQC87ZLrXD5nITv7HtrdGnx8TC71zvJqPlAi7KOJuiuHVYmrzpBD X-Received: by 2002:a17:902:8543:: with SMTP id d3mr22715045plo.80.1565550985951; Sun, 11 Aug 2019 12:16:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565550985; cv=none; d=google.com; s=arc-20160816; b=O/Nv+auS1ebQdfdFKtHmnRRon+UGDGDS5UsLWF7hHiepU+BVFCzhl2jpZkOO3itpgV 2RVCV8COSLYpE1eDBYA3h3wFXXwGNBWq8e6Pn3YCP4G0zimbLuYH6NHxOWzt5fBW/YRg fGG599mUhGKtVuaLAIIfU/4mdr0+w1pwKQpkuRkpm+bXhSVuc87P9fH2lMoE8hPzjFyN b4JEJyOuwk5AIY4Ofx4eB4TRm1ZPlIcBbaQevNkioLmikxWc1s6RLVJGhX/GPi4EIBgB +BjVFoGeY1kNBrHKayEU8ImlT9W1o1Uj+PG4YoMn5Bx5cFLxw+cTthnFjTO5Kr5Vlc3M LRIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=0v4NTPRprVy/Zt1y5RuGi+q3b5fOD7PiWsVJ8Qnqnh4=; b=UrxRF/3YyJxPvtS5T57WQXvnC6bRUc5W9CftyhSySBye+UgfbUwdiJoHRiYMLZwHSK bwxkrmLwoWP2P5xwWd1FaSgUsNbM5uOHpO+08MqZk3K7GSd3fVSr1uBkKwFswl2d1bMu 7CK/P2YgMr590MLYqfdboq5zRGAGTFqday4lW1/8+kpTYExwC8HiUVM7SkzgE6Augw+H OtRtlHeOs8QXHqB4vF7Nqv7mZc6ORoS+ZCel3eOoKQJZ40UsfzBjK8JKXx0jhClycsTf 8nh5+T92DIZE+QHEJBkmn1DKasou3E/VypteA+K+r6iEmIyz2GwKqw1nRLknUhcab1CZ psjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=mIr60g6i; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b34si6553176plc.19.2019.08.11.12.16.08; Sun, 11 Aug 2019 12:16:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@lechnology.com header.s=default header.b=mIr60g6i; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726358AbfHKTPS (ORCPT + 99 others); Sun, 11 Aug 2019 15:15:18 -0400 Received: from vern.gendns.com ([98.142.107.122]:44090 "EHLO vern.gendns.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726014AbfHKTPS (ORCPT ); Sun, 11 Aug 2019 15:15:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lechnology.com; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=0v4NTPRprVy/Zt1y5RuGi+q3b5fOD7PiWsVJ8Qnqnh4=; b=mIr60g6iV3vi4/B/X0kemTG/+K 9FiFiUoogvZg/oby/pTOYzhCVd3uCdEK6oyHJ0oF7njIyQH6gyBYLMb5erWKmky/lN5Or9y0aX5XJ 10/Rt6rUMxcPl/+cMFZgsrgbg2nuhhcRK0h1QszdS9NkQgHi5AARbcIhQNsTP2lw1ORJPgbPI2TI2 /m57C7ACnjUAYeLvSHkii15Gr5iQsNlE01E1zNIJgbMzQuYMzRH9Ba3QhGAAC/ux9F63BpjQIEPe2 PJQLNbkGanBRARVDS5Y/Rdis8cHK6QJ3+C4Fl7FCPW0870N+r7sy5PqCEek8mN7akGe8HtwMNUOAu lWQwJD8Q==; Received: from 108-198-5-147.lightspeed.okcbok.sbcglobal.net ([108.198.5.147]:43828 helo=[192.168.0.134]) by vern.gendns.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.92) (envelope-from ) id 1hwtJC-0001Mn-L3; Sun, 11 Aug 2019 15:15:14 -0400 Subject: Re: [PATCH v2 3/5] counter: new TI eQEP driver 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 References: <20190807194023.15318-1-david@lechnology.com> <20190807194023.15318-4-david@lechnology.com> <20190811102345.1af5c23c@archlinux> From: David Lechner Message-ID: Date: Sun, 11 Aug 2019 14:15:14 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190811102345.1af5c23c@archlinux> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - vern.gendns.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - lechnology.com X-Get-Message-Sender-Via: vern.gendns.com: authenticated_id: davidmain+lechnology.com/only user confirmed/virtual account not confirmed X-Authenticated-Sender: vern.gendns.com: davidmain@lechnology.com X-Source: X-Source-Args: X-Source-Dir: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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.