Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3567171imm; Sun, 16 Sep 2018 22:24:13 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZyQhqVzD7TJDM+cls6VgcI7CtfLZdBvqCje6j/jTonsLaorEy7fu9UQJ5DGFB54RtpW9n4 X-Received: by 2002:a17:902:b115:: with SMTP id q21-v6mr23362755plr.333.1537161852993; Sun, 16 Sep 2018 22:24:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537161852; cv=none; d=google.com; s=arc-20160816; b=TCgkhvQIbY+A6FbM170wxd5TGppFzxsvTmJugjgiiq92QYE3n88nD32qM5tiRUMXPV H+30aoXUyX3ch5T99jdiachmgYnG8lPsZR+SPqtKfy836DCZOLk7X+bDBiseNjmc2mpk 0FpVRoxlcz+3PRwKc2Gg/yEFp51UlFt3KYnOLpN6v5FY77ZYAidLohpv68pNn7OErQBg BeS3WRg9gngG/LPNsVG/dDd0SplkAO9FiHtye2mnvqz1lr5iyEzetqW3Q0m/rfoxCevm tQtGxfAUy5eZSs1YmX0xFF91MZlHmLltYuqsd9aaq2xsFBUjSKkmrclJE27rKfrdKiXn /naA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=rmr8r/dvg5zBfzVzBC6i7VTPg85Egzw2u+whUMYD8Oc=; b=xT+1osEs9XP2jM0JQKg75T3WWiiKo4R4P5Yuyq710aiMo/JFMZmQ7afN/H+MmZuMrN XEisOmX8McxCGX7Z9YSgce/SAQT8ZeihbbktxUMwRvgL6naqX9+1u96AxJT+qxtuWnmR xLt8p+skf0Tk4cueM/+MGKGsAja5gXYS/ucBiFm25/emYsiJZOW/+vAVXte/cDCCKQXW vTknmuJi4Xi/NRYyc0+jDoUYz5NoqD0pSP2hgOxKoik4P+vh2rptXG1FtDLvHVhw7rcd avHotQfMBzQQ/z1QQQrmumPYRjmiuGbqxMXRpTCddb5uyRadz7Jixiv01xMphjhNKcud dZwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kemnade.info header.s=20180802 header.b=ksb3gIPg; 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 t80-v6si15607234pfk.228.2018.09.16.22.23.57; Sun, 16 Sep 2018 22:24:12 -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=ksb3gIPg; 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 S1728459AbeIQKtf (ORCPT + 99 others); Mon, 17 Sep 2018 06:49:35 -0400 Received: from mail.andi.de1.cc ([85.214.239.24]:40190 "EHLO h2641619.stratoserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727851AbeIQKtf (ORCPT ); Mon, 17 Sep 2018 06:49:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kemnade.info; s=20180802; h=Message-Id:Date:Subject:Cc:To:From:Sender: Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=rmr8r/dvg5zBfzVzBC6i7VTPg85Egzw2u+whUMYD8Oc=; b=ksb3gIPgbAQi0oL1iCZk+LwADH b5jjVmNTUkTp5lzG50Bfu2V7b0+vh03kbeWhHadu/+GZWt6uARMyMP+h3CeIA76dFilf1bj03J/wi PEw7BAl51GL0/eVGpiZV0AbpXq60iavoqAN+4B+e1hM8JEm5HNFoSwNcct231e+dbVRM=; Received: from p200300ccfbca24001a3da2fffebfd33a.dip0.t-ipconnect.de ([2003:cc:fbca:2400:1a3d:a2ff:febf:d33a] helo=aktux) by h2641619.stratoserver.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1g1m0g-0006W0-3k; Mon, 17 Sep 2018 07:23:46 +0200 Received: from andi by aktux with local (Exim 4.89) (envelope-from ) id 1g1m0f-0003Gz-Rk; Mon, 17 Sep 2018 07:23:45 +0200 From: Andreas Kemnade To: kishon@ti.com, lee.jones@linaro.org, dmitry.torokhov@gmail.com, daniel.thompson@linaro.org, wsa@the-dreams.de, linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Discussions about the Letux Kernel Cc: Andreas Kemnade Subject: [PATCH RESEND] phy: phy-twl4030-usb: fix denied runtime access Date: Mon, 17 Sep 2018 07:22:54 +0200 Message-Id: <20180917052254.12336-1-andreas@kemnade.info> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Practically this happens when the device is woken up from suspend by plugging in usb. Signed-off-by: Andreas Kemnade --- drivers/phy/ti/phy-twl4030-usb.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/phy/ti/phy-twl4030-usb.c b/drivers/phy/ti/phy-twl4030-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) status = twl4030_usb_linkstat(twl); + /* we might get here too early when runtime is not ready yet + * and we will get an EACCESS later, so try again later + */ + if (!pm_runtime_enabled(twl->dev)) { + cancel_delayed_work(&twl->id_workaround_work); + schedule_delayed_work(&twl->id_workaround_work, HZ); + return IRQ_HANDLED; + } + mutex_lock(&twl->lock); if (status >= 0 && status != twl->linkstat) { status_changed = -- 2.11.0