Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp6278172imm; Mon, 27 Aug 2018 12:50:16 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbCXir2mV5zSZNJ8SzVFy37Gp95YjT+82JNNLMYoYrPdnnKf+EYlnVy1Cpg2at6rGz2mqk8 X-Received: by 2002:a63:524e:: with SMTP id s14-v6mr13212391pgl.35.1535399416772; Mon, 27 Aug 2018 12:50:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535399416; cv=none; d=google.com; s=arc-20160816; b=nAuW4Sh+ZsNusE1Ejx12J+wBiHDuRQwvDgK8FU6fnOj9rYQ7pTbqR4TjGiAu1qSZ2G btSxkJzQ2AxHRl+YS++NPWRuNnOUUoEjkxPDHwfZPt/DdeMyY97AjZnPV4dxfxzTpwHA ntzGa4si6u3ZN611OSv+/BWYa88a9j9QevH9t2+BZzfGN185063LlaCBQSYkmkIYqegV ntpLJbCxGzmR15x91+l6kiwiCycM5DayjxvqeN3Bu9JIZu7lT/PWqQhZF0gM7Z3a2p7j NWHYzojTpJXYLtu7jDnIxtzd6F9I08wu/5oX5ztYAIQdgjRiIGBd9/oNhtM2Zukinh17 gd4A== 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:arc-authentication-results; bh=rmr8r/dvg5zBfzVzBC6i7VTPg85Egzw2u+whUMYD8Oc=; b=RAPAPo4P89FMJsxNbiaKLcQl7xa3ghnDZ2+xJ8d1R1J1+RxmxzM50H9B3Tt8kUtror tGa5UPB0SlgEwapvaQ8yt0zdt9s50WdAEZWlqs6z3KupYfdbBSHaqqlodXKeJ8JYfWco qcRjBHpvnHj2WN7tqcENJiajIw2Cg+el0gTrSYo8PVLzR0ll08AGvcBNxN872ml+DI// hpDdwuqCSsYCVLQ9L+twrUH4mtXAZmAR4bPMY1fpVc0IwD07ob3AaCVhmUdncjvwzE7a 5/T7xkxAFQcxcIdEpcByKjMFDeY8VCJgWN7aZiTiVf7gIGaz40kAyG823ePn+IV8MVst 6c7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kemnade.info header.s=20180802 header.b=CplMJ+Kh; 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 w11-v6si110902pgm.531.2018.08.27.12.50.01; Mon, 27 Aug 2018 12:50:16 -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=CplMJ+Kh; 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 S1727281AbeH0Xgb (ORCPT + 99 others); Mon, 27 Aug 2018 19:36:31 -0400 Received: from mail.andi.de1.cc ([85.214.239.24]:43660 "EHLO h2641619.stratoserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726939AbeH0Xgb (ORCPT ); Mon, 27 Aug 2018 19:36:31 -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=CplMJ+Khlytg1LbTN34mcvdbcT BJAkMhkOI6oNxHmQdROyMY9ylvZ7Wy6jwdWWlNYI22MhKOQEhxJjBuvw/d78Fr3rZjHAp3XVg1koJ FzJ48ZhCeUYHsKWgGS337cLiEwZLEqq1hiz0c54PLcMoecS1efJu2Z9N71rHKwlXFs9Y=; Received: from p200300ccfbc7a8001a3da2fffebfd33a.dip0.t-ipconnect.de ([2003:cc:fbc7:a800: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 1fuNUu-0003EA-Qx; Mon, 27 Aug 2018 21:48:24 +0200 Received: from andi by aktux with local (Exim 4.89) (envelope-from ) id 1fuNUu-0005Fu-Fc; Mon, 27 Aug 2018 21:48:24 +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] phy: phy-twl4030-usb: fix denied runtime access Date: Mon, 27 Aug 2018 21:48:05 +0200 Message-Id: <20180827194805.20139-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