From patchwork Tue Jan 16 08:01:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 124613 Delivered-To: patches@linaro.org Received: by 10.46.64.148 with SMTP id r20csp930485lje; Tue, 16 Jan 2018 00:01:41 -0800 (PST) X-Received: by 10.25.56.13 with SMTP id f13mr4937018lfa.16.1516089701647; Tue, 16 Jan 2018 00:01:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516089701; cv=none; d=google.com; s=arc-20160816; b=ouS0+wl9TyP5dl3NJlBSX+vJmfyN513DIIA7YbnCsc205RXZwg15tTOUw3DvPI1dgz NPyRrCwqI9fD199FRMdnKb6231EDnrJArK+IQ+q4RL/OGIMxT7q6amy3bqy0RRQi5nLl 11NsiT+mPEQ0DE08DXQhGw8GKfz6BJpJHHyNKbxbx3GwR2boR//ktT/B/29p6CGGGlNS RoHUuFuhS9B2P5XwNfEqtwsBxwuZ6TsekQ20nfDzL7iQpZpl2EQTJxzoSwXkSMZWjcXM qeLASFv8v5s+ydCxin3PFHjERexk+VEbLWCaIXSvrrWnL6wV9gEaCTAAYIXUsLY3WqZF UV3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=gRI1vhikbWK/qnHuze+oQpFHAq0hLoUV8TIv03MMiEg=; b=N3U28GEytzl4bZrglrqw+nA3fQ6/YQyW0W5a9g/275Q5XJdkKdzDTNZqmXVYMph0Me /GKu/+JvrbPStBWEX18XtxAz/PjjYgc+mCldXXCtG7aWQblDE7olXIjicL9Lp1yk7QE1 ENeyOOctG1xtiNosziC8CkocYngqMPuo3qFjvycvOR9rOKta4qiFyVvdAwTrgydOK+tf JtDS4BGyCD60b/y2OBt7piErF1phJOIxXrBnsugJtqjz/uQ8AkVQl7UvtMcGvEGldTdN H9w9f5ci2MetBA0KkVL68kGlsBLiGiDgJJA/cX1ffG82U/IWGINULPPwktHCg4uazcKb Sx0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OX5tOAsP; 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 g14sor242974ljf.29.2018.01.16.00.01.41 for (Google Transport Security); Tue, 16 Jan 2018 00:01:41 -0800 (PST) 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=OX5tOAsP; 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; bh=gRI1vhikbWK/qnHuze+oQpFHAq0hLoUV8TIv03MMiEg=; b=OX5tOAsPdxRpp2cDQ2dQkTmFyuwJa1jaSa+xOVyXj+oTvMzqi1LjIm22uGwRXE6VP2 WT4IjvZLYYrx+XxSy/0qbV9XGY2NagVsamMHtmYmU5+g3yTSvaL/FKfcLEtbj0JsC+4I qHWHZ8xS/rW+aX8lk4x/KFcDJPGxvN1HEqZ6Q= 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; bh=gRI1vhikbWK/qnHuze+oQpFHAq0hLoUV8TIv03MMiEg=; b=LTfOuxs2+BLEFi+yW9KSR3UNuCJo0kuSVn7hApB8qfftKKqA0M28HTFWXBfxMe3T1G MQmOS+CbtD/TJxo8bwBPhAoWX7+x4QWoPUCv1reGZZOY6sotTdW+GTBJdJRChQYFs70K K/3ZFcrcikVjf9INJpFZ2jn9blfGDjKuu0TElfBEkGHlG9inRvIaTojqqUvWkC8XpcAS y/EozGCPy9vuo7K/GpmMxpn8jxvVIIwucCk8XlEeICA7xfQTqhB1JwrLv7IIujlbaW71 tdRINa6JO7NnIYDhxivk6K3xDR1ZtbUbg3P6VHVoJz7JU4WItwZojEPaMdbgj1Yexztc G15w== X-Gm-Message-State: AKwxyte58pp69gH/dsWQq1VG0a93rxaNj7teJI7Ox70wVxBgSQwo3qZC +/V5K9d/Sg6ydn2Z6zCwxH683mKs X-Google-Smtp-Source: ACJfBou/QXi0lBrvQDfL26BGRFZw51krW5p0OhGy+jSS2JJLlkhMN2nlIy21P8YKU9ggJ75TZN4rzA== X-Received: by 10.46.27.10 with SMTP id b10mr5298559ljb.60.1516089701347; Tue, 16 Jan 2018 00:01:41 -0800 (PST) Return-Path: Received: from localhost.localdomain (h-158-174-22-67.NA.cust.bahnhof.se. [158.174.22.67]) by smtp.gmail.com with ESMTPSA id 21sm285146lje.96.2018.01.16.00.01.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Jan 2018 00:01:40 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Geert Uytterhoeven , Ulf Hansson Subject: [PATCH] PM / runtime: Allow no callbacks in pm_runtime_force_suspend|resume() Date: Tue, 16 Jan 2018 09:01:27 +0100 Message-Id: <1516089687-32003-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 The pm_runtime_force_suspend|resume() helpers currently requires the device to at some level (PM domain, bus, etc), have the ->runtime_suspend|resume() callbacks assigned for it, else -ENOSYS is returned as an error. However, there are no reason for this requirement, so let's simply remove it by allowing these callbacks to be NULL. Signed-off-by: Ulf Hansson --- drivers/base/power/runtime.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) -- 2.7.4 diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index cb5e48b..8bef3cb 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -1640,7 +1640,7 @@ static bool pm_runtime_need_not_resume(struct device *dev) int pm_runtime_force_suspend(struct device *dev) { int (*callback)(struct device *); - int ret = 0; + int ret; pm_runtime_disable(dev); if (pm_runtime_status_suspended(dev)) @@ -1648,12 +1648,7 @@ int pm_runtime_force_suspend(struct device *dev) callback = RPM_GET_CALLBACK(dev, runtime_suspend); - if (!callback) { - ret = -ENOSYS; - goto err; - } - - ret = callback(dev); + ret = callback ? callback(dev) : 0; if (ret) goto err; @@ -1704,7 +1699,7 @@ int pm_runtime_force_resume(struct device *dev) callback = RPM_GET_CALLBACK(dev, runtime_resume); - ret = callback ? callback(dev) : -ENOSYS; + ret = callback ? callback(dev) : 0; if (ret) { pm_runtime_set_suspended(dev); goto out;