Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754668AbcDTNxY (ORCPT ); Wed, 20 Apr 2016 09:53:24 -0400 Received: from mga14.intel.com ([192.55.52.115]:57999 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754589AbcDTNxN (ORCPT ); Wed, 20 Apr 2016 09:53:13 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.24,509,1455004800"; d="scan'208";a="959018642" Subject: Re: [PATCH 1/4] i2c: designware-platdrv: Fix runtime PM initialization To: Jisheng Zhang , andriy.shevchenko@linux.intel.com, mika.westerberg@linux.intel.com, wsa@the-dreams.de References: <1460638414-5987-1-git-send-email-jszhang@marvell.com> <1460638414-5987-2-git-send-email-jszhang@marvell.com> Cc: linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org From: Jarkko Nikula Message-ID: <571789C4.5020904@linux.intel.com> Date: Wed, 20 Apr 2016 16:53:08 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.6.0 MIME-Version: 1.0 In-Reply-To: <1460638414-5987-2-git-send-email-jszhang@marvell.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1363 Lines: 32 On 04/14/2016 03:53 PM, Jisheng Zhang wrote: > When pm_runtime_enable() was being called, the device's usage counter > was 0, causing the PM layer to runtime-suspend the device. We then > went on to call i2c_dw_probe() on a suspended device, which could hung. > > Fix this by incrementing the usage counter before pm_runtime_enable(). > > Signed-off-by: Jisheng Zhang > --- > drivers/i2c/busses/i2c-designware-platdrv.c | 14 +++++++++++++- > 1 file changed, 13 insertions(+), 1 deletion(-) > > diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c > index d656657..00f9e99 100644 > --- a/drivers/i2c/busses/i2c-designware-platdrv.c > +++ b/drivers/i2c/busses/i2c-designware-platdrv.c > @@ -246,6 +246,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) > if (dev->pm_runtime_disabled) { > pm_runtime_forbid(&pdev->dev); > } else { > + pm_runtime_get_noresume(&pdev->dev); > pm_runtime_set_autosuspend_delay(&pdev->dev, 1000); > pm_runtime_use_autosuspend(&pdev->dev); > pm_runtime_set_active(&pdev->dev); pm_runtime_enable() here after pm_runtime_set_active() shouldn't suspend as far as I understand which made me thinking if there is some other issue that cause the symptoms what you are seeing? Like race with runtime PM or similar. -- Jarkko