Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751863AbcDUDNM (ORCPT ); Wed, 20 Apr 2016 23:13:12 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:25185 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751706AbcDUDNJ (ORCPT ); Wed, 20 Apr 2016 23:13:09 -0400 Date: Thu, 21 Apr 2016 11:08:59 +0800 From: Jisheng Zhang To: Jarkko Nikula CC: , , , , , Subject: Re: [PATCH 1/4] i2c: designware-platdrv: Fix runtime PM initialization Message-ID: <20160421110859.1509ad2c@xhacker> In-Reply-To: <571789C4.5020904@linux.intel.com> References: <1460638414-5987-1-git-send-email-jszhang@marvell.com> <1460638414-5987-2-git-send-email-jszhang@marvell.com> <571789C4.5020904@linux.intel.com> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-04-21_02:,, signatures=0 X-Proofpoint-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1603290000 definitions=main-1604210048 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1642 Lines: 41 Dear Jarkko, On Wed, 20 Apr 2016 16:53:08 +0300 Jarkko Nikula wrote: > 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 FWICT, on arm DT platform, the device usage counter is zero at the beginning, once we enable rpm, the i2c have chance to runtime suspend. Thanks, Jisheng > issue that cause the symptoms what you are seeing? Like race with > runtime PM or similar. >