Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4327620imm; Mon, 17 Sep 2018 11:57:42 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaAtMkAaW1seJ0+sZguxv+pwqeCcVEhnQy+IpaW7A0lAcm835/+gxrTooozoFjgHTu2jK3Q X-Received: by 2002:a17:902:7287:: with SMTP id d7-v6mr26557112pll.54.1537210662072; Mon, 17 Sep 2018 11:57:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537210662; cv=none; d=google.com; s=arc-20160816; b=gdn+oLcnDrKVYP+5fyXn68birN5iceuYmIpoM156exEAeNU+aTOM1U1nHphkGGq6N6 nkeWc+a509fqABPZWluVBy88NH5dNlGmihTSPIxJt97tiVQI4Y+I/Qt/9fcR7H2JCAik XHpbyH5AILIdbilIkrVMVUqWp32l5vdZM89wFslomz55iZ/qU1SQO6c2yuu1e+ZwuOSe 449/nQ9A+9/Gatz7XdGY474ParUJXQLOWg3znv2sDQD75r6m0HrdyyUKFDGtqML5RrW/ U0x7okvStX3bc8tGJ8TkSaWy90RdIC1kNgn1GiOUQbFCi3GVWc1RZmzX/e4HkN0zBk/a GxSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:dkim-signature; bh=HFkPIiS3GJ6HInmMVUsTkdcwicZMxBQKnnzDZF2/Qq0=; b=PHK9gjcJOQweuu17xlOqs5JV1vVczE7CV0ssnlF4cKMcpJkEGhuQ8T2KA2XScC5ZkV kcMn3qUKobx9A3IzxNK7JkCLHEXzGzeGefKskKAcOq/n2fSW2zkKevkv8ggN4FXEPk57 MVrkHgwuyjUwYhwejNEM2jga1P6RuzyWzCQllmn6+UMDnqqV4Cgvy1XjWX692QQIjMCj WbMuEqDW1actbT+mb9NVwZFsWj4MMFicG3UVYJg8u72ZGhhkWrDEoUuB49NbeFhlk8F1 LkYfbXGOK52sNSWroc6Le7NLPpQI6h2s0upzqM1PZTgWUg+HBKmHG38/w1HtB9ZDgllr eL5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kemnade.info header.s=20180802 header.b=hJOFE9c4; 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 68-v6si14765142pga.113.2018.09.17.11.57.26; Mon, 17 Sep 2018 11:57:42 -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=@kemnade.info header.s=20180802 header.b=hJOFE9c4; 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 S1728253AbeIRAZk (ORCPT + 99 others); Mon, 17 Sep 2018 20:25:40 -0400 Received: from mail.andi.de1.cc ([85.214.239.24]:41876 "EHLO h2641619.stratoserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727375AbeIRAZj (ORCPT ); Mon, 17 Sep 2018 20:25:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kemnade.info; s=20180802; h=Content-Type:MIME-Version:References: In-Reply-To:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding: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=HFkPIiS3GJ6HInmMVUsTkdcwicZMxBQKnnzDZF2/Qq0=; b=hJOFE9c4g2xtyE0UBiDeCMIe+ uk+4TFXt3ur9UCvffioZnMqAUav3E30uO97rwS1l8UDjnQAYitQFZTOT2mox2Lx+e9+Mkw58m/KUA JJ0AlEB8a38iz1VjD3nJEa8MTmwY01ETL32h674P1T96MX6IHbw11HHYl+quKmVCT1qMM=; Received: from pd9e2f8fa.dip0.t-ipconnect.de ([217.226.248.250] helo=aktux) by h2641619.stratoserver.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1g1yhe-0007yO-7i; Mon, 17 Sep 2018 20:56:58 +0200 Date: Mon, 17 Sep 2018 20:56:34 +0200 From: Andreas Kemnade To: Dmitry Torokhov Cc: kishon@ti.com, lee.jones@linaro.org, daniel.thompson@linaro.org, wsa@the-dreams.de, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Discussions about the Letux Kernel Subject: Re: [PATCH RESEND] phy: phy-twl4030-usb: fix denied runtime access Message-ID: <20180917205634.6a320cad@aktux> In-Reply-To: <20180917175131.GA104770@dtor-ws> References: <20180917052254.12336-1-andreas@kemnade.info> <20180917175131.GA104770@dtor-ws> X-Mailer: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/_BaF6VuUb2T=xBhucJeMtCQ"; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Sig_/_BaF6VuUb2T=xBhucJeMtCQ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Dmitry, On Mon, 17 Sep 2018 10:51:31 -0700 Dmitry Torokhov wrote: > Hi Andreas, >=20 > On Mon, Sep 17, 2018 at 07:22:54AM +0200, Andreas Kemnade wrote: > > When runtime is not enabled, pm_runtime_get_sync() returns -EACCESS, > > the counter will be incremented but the resume callback not called, > > so enumeration and charging will not start properly. > > To avoid that happen, wait and try again later. > >=20 > > Practically this happens when the device is woken up from suspend by > > plugging in usb. > >=20 > > Signed-off-by: Andreas Kemnade > > --- > > drivers/phy/ti/phy-twl4030-usb.c | 9 +++++++++ > > 1 file changed, 9 insertions(+) > >=20 > > diff --git a/drivers/phy/ti/phy-twl4030-usb.c b/drivers/phy/ti/phy-twl4= 030-usb.c > > index a44680d64f9b..1f3cf4e48383 100644 > > --- a/drivers/phy/ti/phy-twl4030-usb.c > > +++ b/drivers/phy/ti/phy-twl4030-usb.c > > @@ -552,6 +552,15 @@ static irqreturn_t twl4030_usb_irq(int irq, void *= _twl) > > =20 > > status =3D twl4030_usb_linkstat(twl); > > =20 > > + /* we might get here too early when runtime is not ready yet > > + * and we will get an EACCESS later, so try again later > > + */ =20 >=20 > How exactly can this happen? What disables (and later re-enables) > runtime PM?=20 If the whole resume process is started by plugging in usb, the interrupt will be triggered still in the resume process so that=20 runtime resume is not yet possible, pm_runtime_get_sync() returns EACCESS > How can we guarantee that the interrupt will be > re-triggered? >=20 The interrupt will not be re-triggered but the handler will be called at some other places... > > + if (!pm_runtime_enabled(twl->dev)) { > > + cancel_delayed_work(&twl->id_workaround_work); > > + schedule_delayed_work(&twl->id_workaround_work, HZ); > > + return IRQ_HANDLED; > > + } > > + ... for example by this delayed work which is already there. Regards, Andreas --Sig_/_BaF6VuUb2T=xBhucJeMtCQ Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEE7sDbhY5mwNpwYgrAfb1qx03ikyQFAluf+OIACgkQfb1qx03i kyRQxRAAp2oiba12dAqVJ0koPsr4bVmUmFxie9a7uIHvqLPGYyWKqcjqhQ26BX/d +SjniI1RzTuybPRP4+lp/cvl96BHVRJmSj4yMku+oE42BC4JcIX1+v3uTif9oNZ7 io2vF/U/q1cVMLL0NCYLBBIL8K3d51SIBAeHdzD2jGWCcbTlly1zyUR/f15NdKlp 5DJDLcfbLFWpl5zZPac3aKz51ZR6fmqCeKqDdY6vrH1TRXOJpGLiZbtCsO0oGzGj 44wfo0g0FMOiaQ676HLlc49VFJzvArmWI0Q3EPdiyYA9fLbLq7mQwHtGF7FPNf3F LjShqq0VKYR4QCzTt7qF2Lw8OiVwz7PtRn8j4etwd4czdQS6MKztFZxsilN2qzi3 GekY8iqQYqYqVPXSA25zhkSirEnWIbY6xwMkRJwQu7axfff3Y851rR3jl3M/Ef+y GEnkCXJIUKenOtZl5T9bqep22FBcq2YO6mHdBIjuK6tW+bYJt5yVmfyBp5lPHMd4 HmwekF2e+XkJhcw8SJ4ELjGQbI+PQ4W4qo8Aqc2wjxXnL55tELpGSlcB53y3JLog MTNcoB6D837mjjd5NO4lZRTZSp8BfQcDh8jM4DEb9/cpnHon0h+zW/4DRyjjeyE5 rdaMm1RkBPhwIAR0vvGtUYlxCot6QNycF+Lx8xIzIYJFEv4gXi4= =l+nW -----END PGP SIGNATURE----- --Sig_/_BaF6VuUb2T=xBhucJeMtCQ--