Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4266902imm; Mon, 17 Sep 2018 10:52:03 -0700 (PDT) X-Google-Smtp-Source: ANB0VdagrXVqbQS+/JSK+wKoGIc3MhQWW0/u7ESuCNymu+AQ2ekTIPObdUtJsPLJnFp+MqiJNNBF X-Received: by 2002:a63:4d47:: with SMTP id n7-v6mr24575648pgl.270.1537206723243; Mon, 17 Sep 2018 10:52:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537206723; cv=none; d=google.com; s=arc-20160816; b=to4M1vfY9Cwup6eULyAnvDfp20WULEJ/cte6dkzAMJeGYVrg2BAnb+Pg8CzHmrrvL4 gqfOMlf+FpCgyaJUH+hL/XxSeJsfFxwnuc30EluBWsEexzmfjqcLmbAKYCdgyi0AbXDe HDrceUjSxqeXm0NPICQ3/jUm+1ZyCI09FYmFz83prpYBV7iRCsdSY6QPZgWmZOKSLyyg MkKlppJY96vgWL5ChqTGuIWyry+IdFOr4TllRmRypt4pj/ozdXyOPemYM6oXWy2uIwQX N/YftE4FhD9iz0S4pm6izIpsRxtckFI2rw3d1Kz6nXi15ISijdp/k/nhe0Gwlbbsz7To fA/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=7QqwkFGeyW0W6EfnTCDKFYl8ETeKiFXHK0qEGjF3Dkw=; b=uMMM/tj1+bs6lYAM9zx33FldCRJ4tr7BLjbNoQgLAAcR6uy6S8b2Xex+b3biMsYWU0 B+9QK2J+FOy0qQbDmFZw2tLcDSm+QjG9qy1d/p49Tx1TfH+mMYHdYQOCfr0NL8sNS9F9 R3SKrqmrP+e0zzOgmYUHU9Uc3dIa6kxiiDY7M0S7nwhO3I65TxIzat+/GeNusJbslZ0I VDwMGcXv2h/qaPb/rwWx2EtwEvJoQW0vfmZNPisfbjT7dI8rN245zHW30Ndf1kCZxIr8 rUGg68kahdjMZGG+MYvu/FR4h/Kea9mQQPgOhLj5x+uEOXcCuKmi2kRjIqx8cqqc/9jn 1AZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=E1f5pN6f; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r21-v6si15478491pgi.690.2018.09.17.10.51.42; Mon, 17 Sep 2018 10:52:03 -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=pass header.i=@gmail.com header.s=20161025 header.b=E1f5pN6f; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728084AbeIQXUA (ORCPT + 99 others); Mon, 17 Sep 2018 19:20:00 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:39533 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727052AbeIQXT7 (ORCPT ); Mon, 17 Sep 2018 19:19:59 -0400 Received: by mail-pf1-f195.google.com with SMTP id j8-v6so7910163pff.6; Mon, 17 Sep 2018 10:51:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=7QqwkFGeyW0W6EfnTCDKFYl8ETeKiFXHK0qEGjF3Dkw=; b=E1f5pN6fjdUtryvFc4uRjUttLTNBDUEkJ/wOnarriH56crZ0M0MXvxowcR/mMlB8hL j4NGeos6ZMOUMMnY8A/gWD1kOfttn6KUUbEOeW/VL8VIQ5JrIYOv4yrtMZZN1pf+Gc49 hEB20t3JWoYaBrl2nubqornrafR5SwF9tr43rpolNxVBePnllCphab1zCrQzLNDntDBL ayMYfb1xGnokZv3+qgMpZGtSf1ETQcdAsXDwajUbY4R+hp0cTfLI2LJlrAH4lHtANvCW des/7TzX9o6DeLg3PNGq3CsQUBLDxx+A48A46M/bvcjI+rKvC9HcqUuf0tGob/ntyeFY tKeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=7QqwkFGeyW0W6EfnTCDKFYl8ETeKiFXHK0qEGjF3Dkw=; b=hlDAnLaseA7heW72Nr1ASeRGmLhaLwJac/KHa63FxPyMTvnOQ+NyDCAN/3ssPEz0wa fUvrXYm9waiaynI/xD9NZKQ9gQ8U2jRCcVl7KM4YI8+rxatEzSkRxtnOpUUwUnblNHz+ 1MagUbO59IEzF6d6JwjiNvtEPf1sNZRSJvLPzHzS7El6yTEVIzxoEFXp1YzWkDN7LsON G6ne38ORvQ5w2LKJi5EjEKMsDdHF4YqDJnJzkSf46GahqUjVnRPpExKsCnG0HkZB5nOV qUQ5w7oUmmLEtTXbCG4zBDoQkIWNuKmTfbR0/1LXxNdDGDcWYGAqZvYooYD/yOjNlvVj hbdw== X-Gm-Message-State: APzg51Ahw18IOiNY6GGsf6JqJAeNZ9Mk/xG6dumq4j2f4USATQCu2zcv DuBWZmMY9WHq9LNrT5RkE5U= X-Received: by 2002:a63:555c:: with SMTP id f28-v6mr24782337pgm.37.1537206694665; Mon, 17 Sep 2018 10:51:34 -0700 (PDT) Received: from dtor-ws ([2620:15c:202:201:3adc:b08c:7acc:b325]) by smtp.gmail.com with ESMTPSA id e190-v6sm32665826pfc.81.2018.09.17.10.51.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 17 Sep 2018 10:51:33 -0700 (PDT) Date: Mon, 17 Sep 2018 10:51:31 -0700 From: Dmitry Torokhov To: Andreas Kemnade 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: <20180917175131.GA104770@dtor-ws> References: <20180917052254.12336-1-andreas@kemnade.info> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180917052254.12336-1-andreas@kemnade.info> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Andreas, 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. > > 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 > + */ How exactly can this happen? What disables (and later re-enables) runtime PM? How can we guarantee that the interrupt will be re-triggered? > + 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 > Thanks. -- Dmitry