From patchwork Thu Apr 25 09:04:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 162831 Delivered-To: patches@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp1671678jan; Thu, 25 Apr 2019 02:04:31 -0700 (PDT) X-Received: by 2002:a2e:80c8:: with SMTP id r8mr2521608ljg.112.1556183071052; Thu, 25 Apr 2019 02:04:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556183071; cv=none; d=google.com; s=arc-20160816; b=jlG2KGLJtRi1ILguZBC2drfI3Y76Ni1vqlWKreAuSa8NKctp3M52S28v+4aLPvMrxc 4cmjD7ikQtcwdEHiN7jFL2/GaFgue1e4H+rzbhdVEi2IF7u+h3LsOwMnI89PzoOekFSA qsqbKWZ/Q4wtZGknCao1E+y6Nn7GXFtb6eDfGGXvDxPhxi8y6nCoaV/Xz2cluyCToAwP mZcBgDZo9YPTBu4ylhCtxEA8HilNczR6DjQz2K6L+2jL1xRtmEnJgj5p12YJaBRRRW5p q1Nm8hXORvrMLLnPKNnM2dz6yy0dPVn++yEqtj39/ukAROW8bTphFL6TGGkl5d69kDKp Ej8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+54V2h/XgAc13rlQ/SlFnygRmRch2uFRJkG3WKQRigw=; b=jkwjnCQhTBqkZl/f4IcMhAfYhNmcQ4vLlvfrivrNeTEjSJGy3kM7nGVip3qm0XuYoL vwWm/AwhexNGobtM05LNgRwNpjGN3mv9b0SCroqu0fZ3wVaH7gSzN+MRPuPuQGh6PyCD +iFqJM90uZ1UsmorHp1MSAOg469DEnrINk4K/MIBq6QIvluzo9QjPrldorVEs4drtxrA OgkbWy7yL3c0zDeCTqaus/BDtiuHTNyI+c/3ntiIB41xh8IpyVmBTdJMLzjPRix6SV6e aKVP2G3Mb2AH+qKWw64KTM5RDoeaq4ZMR+krWqqcZL5xIUEZbmTysQ95df1wCR762b1V wd8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KQmk7AwU; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id d20sor11074993lji.12.2019.04.25.02.04.30 for (Google Transport Security); Thu, 25 Apr 2019 02:04:31 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KQmk7AwU; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+54V2h/XgAc13rlQ/SlFnygRmRch2uFRJkG3WKQRigw=; b=KQmk7AwUQoPW2mhxbS6TbUc3r7+PGjbj3/fAGNr0k/M5E/bxs6vjesb1EMTfE7qahu mjo053Qcdz2MYbIjtNyE7tk3CSwVWY4AmlrbjMN2XtSANsD7HX0Y7TKnR6+OsbtFse5O sXUna4rQr9RO0G+sqR3DobsE8n83OOOlNyW5KXVh7DjHRh3P8pUEFJTfACqAyKBwI7TX yktVEhPgbp3tH5ruHg2A3odsJAf2+82PNfNTMHdnf/kcNOBJVo1U7s3bMp8koLCvLKHk 2U+oyKLdPNs9YiCni7hh9xZrSXDJCI96Ma0iVYbbGcQUyP6JBLg4WTbWJOAdQkbS322B mX/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+54V2h/XgAc13rlQ/SlFnygRmRch2uFRJkG3WKQRigw=; b=VM0wLtfjxiaWjTcNcU+8Y+CGNroQsXj6S4SkOh0fNX3iEVvYJkwO5np/Z+a8Ao+27Q lhsGGiLRfVK1olSK18A6/AB0ZqLPkkPkGou3hiPyA160wMX+RrCCmPJ6Esd1SdO4Pctt SgKa4+v+UIGrSPdmMtfDUFN99aihvtQztQpQnVzv9tezBzc8v09v1dIyNW93ckO0AQHy UW5N1UW6O02VUNyxOCVdpUHVp6FewRxNwxIgkM6+xz617cjCLBSq9UhtIHf8GC789LMY 1wB5Hpdwcb7NywHh4cO7WpqeMTFLn97etI50vlIXp13/kE8BAAE0YOOajLJZZ1sFZnrI bBrw== X-Gm-Message-State: APjAAAXPRYdKvdPw2AosQjNnmDol88ON5GkTiETM+WX6BRXHSr61qCkw wgomYpZHb+e/3JlFkU2kvcJTRnrb X-Google-Smtp-Source: APXvYqwTUexwmpqjGqL8ndwTScbQ3jA2Gi9wk4uhiTaDz25Zi5/AQ81/TdtnywrUEXCFKwJaXlLlVg== X-Received: by 2002:a2e:9e04:: with SMTP id e4mr9087891ljk.74.1556183070284; Thu, 25 Apr 2019 02:04:30 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id v26sm4517353lja.60.2019.04.25.02.04.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 25 Apr 2019 02:04:29 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Ulf Hansson , Daniel Lezcano , "Raju P . L . S . S . S . N" , Stephen Boyd , Tony Lindgren , Kevin Hilman , Lina Iyer , Rajendra Nayak , Viresh Kumar , Niklas Cassel , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Rob Herring Subject: [PATCH 1/4] PM / Domains: Use the base device for driver_deferred_probe_check_state() Date: Thu, 25 Apr 2019 11:04:10 +0200 Message-Id: <20190425090413.10700-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190425090413.10700-1-ulf.hansson@linaro.org> References: <20190425090413.10700-1-ulf.hansson@linaro.org> When genpd fails to attach a device to one of its multiple PM domains, we end up calling driver_deferred_probe_check_state() for the recently allocated virtual device. This is wrong, as it's the base device that is being probed. Fix this, by passing along the base device to __genpd_dev_pm_attach() and use that instead. Fixes: e01afc325025 ("PM / Domains: Stop deferring probe at the end of initcall") Cc: Rob Herring Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.17.1 Acked-by: Viresh Kumar diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 8362dfe187f5..8aca1c9b4406 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -2405,8 +2405,8 @@ static void genpd_dev_pm_sync(struct device *dev) genpd_queue_power_off_work(pd); } -static int __genpd_dev_pm_attach(struct device *dev, unsigned int index, - bool power_on) +static int __genpd_dev_pm_attach(struct device *dev, struct device *base_dev, + unsigned int index, bool power_on) { struct of_phandle_args pd_args; struct generic_pm_domain *pd; @@ -2424,7 +2424,7 @@ static int __genpd_dev_pm_attach(struct device *dev, unsigned int index, mutex_unlock(&gpd_list_lock); dev_dbg(dev, "%s() failed to find PM domain: %ld\n", __func__, PTR_ERR(pd)); - return driver_deferred_probe_check_state(dev); + return driver_deferred_probe_check_state(base_dev); } dev_dbg(dev, "adding to PM domain %s\n", pd->name); @@ -2480,7 +2480,7 @@ int genpd_dev_pm_attach(struct device *dev) "#power-domain-cells") != 1) return 0; - return __genpd_dev_pm_attach(dev, 0, true); + return __genpd_dev_pm_attach(dev, dev, 0, true); } EXPORT_SYMBOL_GPL(genpd_dev_pm_attach); @@ -2533,7 +2533,7 @@ struct device *genpd_dev_pm_attach_by_id(struct device *dev, } /* Try to attach the device to the PM domain at the specified index. */ - ret = __genpd_dev_pm_attach(virt_dev, index, false); + ret = __genpd_dev_pm_attach(virt_dev, dev, index, false); if (ret < 1) { device_unregister(virt_dev); return ret ? ERR_PTR(ret) : NULL;