Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751959AbcCKSqY (ORCPT ); Fri, 11 Mar 2016 13:46:24 -0500 Received: from iolanthe.rowland.org ([192.131.102.54]:39923 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751424AbcCKSqN (ORCPT ); Fri, 11 Mar 2016 13:46:13 -0500 Date: Fri, 11 Mar 2016 13:46:12 -0500 (EST) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Krzysztof Kozlowski cc: Ulf Hansson , Kevin Hilman , "Rafael J. Wysocki" , Len Brown , Pavel Machek , "linux-pm@vger.kernel.org" , linux-kernel Subject: Re: [BUG] Device unbound in a resumed state In-Reply-To: <56E26EE9.8040400@samsung.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1204 Lines: 40 On Fri, 11 Mar 2016, Krzysztof Kozlowski wrote: > Hi, > > > Could be related (the same?) with [0]. > > I have a driver (hwrng/exynos-rng) which in probe does: > pm_runtime_set_autosuspend_delay(&pdev->dev, EXYNOS_AUTOSUSPEND_DELAY); > pm_runtime_use_autosuspend(&pdev->dev); > pm_runtime_enable(&pdev->dev); > > and in remove: > pm_runtime_disable(&pdev->dev) But not pm_runtime_dont_use_autosuspend()? Why disable runtime PM if you want the runtime-PM methods to put the device into a low-power state? > Just before unbinding in __device_release_driver() the device is resumed > but unfortunately not suspended later. I mean the > __device_release_driver()->pm_runtime_put_sync() does not trigger > runtime suspend. Because autosuspend is still in use at this point. > This leads to leaving the device in active state (e.g. clocks enabled). > > It does not happen after removal of autosuspend. Also runtime suspend > happens after very fast unbind-bind. Overall it sounds like the system is behaving the way it is supposed to. But maybe we should make pm_runtime_use_autosuspend() call pm_runtime_mark_last_busy(), to avoid the unbind - bind - immediate autosuspend behavior. Alan Stern