From patchwork Tue Jun 8 09:02:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 455763 Delivered-To: patches@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp3491945jae; Tue, 8 Jun 2021 02:03:03 -0700 (PDT) X-Received: by 2002:a05:6512:54b:: with SMTP id h11mr14922358lfl.236.1623142983078; Tue, 08 Jun 2021 02:03:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623142983; cv=none; d=google.com; s=arc-20160816; b=arba2VlQxGgiRLAHYYw+VoLZmTuMGp1UTlD49BClEnR/AxF7pkgkrKb6CbmpjpPCzF q7aTlvTbOcsjY+AR4uEC+TUqtsrTKXg/UaK6YEYWx0Me6N0XdY6URwZwZZ5lHGH0dCLD D0cs05MvnBT15nAZHWew6+VxqFJlcd/GwOBZ6w/8Zv3spXcArgXuk6+g/cyQ+qtw2IJR sKz1syzs4RUqLmcViMarnM7o1sMPP0JEG4WlJbbUphNpa70ERqvBKfPeFp70rfbXA3Bm 7n/8sh511detuN9qp2/GegffQ97uvlv2ZLcA3AnGqSPPDILRLYyHKFz1RTP6d6B9N30K l5Tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=K0ds+l2wwmikGBIkarzC+RWkNxvJMelGG4IknEWp7ak=; b=Mk7bHeRqNmwsGSboPQ+GgydkSA6o3O7chm/5r4EYPZe1P2S44R7PDTuRgASs/w6iKB TZ/x2UOe8FNDV5Jr/rzJHPv2fToIpya9f/mMNLlzsoeCfQAGJHkJlRbDQIeloCMrmwZS KiA3fsEKywrHRVnM0Q9R5FPqjp+Q0uJJtV72vC8XNGOmJ3rFEXaReKCTfLw/Q/CsRSqx HJKo0DpodQmEKBgpyXqaDKY6sB3fi6OW1+N49VxVpvUrVbb/DXjILb5lHUJaror2kmSA PQqV7Kd3hSytENne7iMhiD6qNo13PWgictsLMe/0U+KeH2xaaclvfUgOqk2tg11FloA0 n+Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QzWpE4d7; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 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-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id n13sor2985688ljg.36.2021.06.08.02.03.02 for (Google Transport Security); Tue, 08 Jun 2021 02:03:03 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QzWpE4d7; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 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:mime-version :content-transfer-encoding; bh=K0ds+l2wwmikGBIkarzC+RWkNxvJMelGG4IknEWp7ak=; b=QzWpE4d7Czo3Zzuvhv+Wm8SOjKM7edThMVzlJK8RuUE5nNdoUEl19aWE/sd7LJmDHJ VqKCUb0i6PoLbvwyCMdn1VDa7/12/HC0sX0CyTwfcQgofGUxwmOY6YgoMa4J8armXTDn Jemd4DUXYbGk5wjagB0xfxRN/IIdjw1HWDjwNwFFMNbSnCA+s/WWOwZ1C+XkH5sN4nlm Sx8R1byKEXnCGlAClEtDjrPJJiL9xxPGswV/Z8x/EGAGVU/Lijv5j4QTCUXfqJdPvQ/k A6MmbefYfSU/d7S32LbjloQfzUELzcIHsB+ty+To3ojyeGIM6fvi7luoHXiA8treZv9K xbjw== 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:mime-version :content-transfer-encoding; bh=K0ds+l2wwmikGBIkarzC+RWkNxvJMelGG4IknEWp7ak=; b=kJSEgUlvUJQWDk1FGjLyc9kItpCtF6CUUIn74l5IWZ4x/TP9Iqb6jOQoAW2sRA14kZ WTnbHGKLYld2ieTUX6lXs02rf1WcLDXhPJWneZfbkgZbZazOdxXH0zOS8+mD+YemEnrZ s9ypKGbN7lGNnEIcFd5+0iziA8gUvfrnLHSpXr1R3Xhf0n+KJhEjnzwATS8VK+6aho+7 p3mD9PufJ1LmeI03Ry46FvDDVf2qGTupwJQHlH47IjidV/tTb6JEt5kk8MvN0V1woTqH EgOn1Kot/UGqXCaxGAy6Hk5unrHEFUotIr+McY/xllMu9POn2HPWhs97tCHhPQgUg0aj Dv1g== X-Gm-Message-State: AOAM531cspG+/NktH+AwXCXUF+FhpcXURf5MQbcC6KP52UTPliVFZQhZ aCODdUB3eOcl1hy2ntBHHfbUB9Wc X-Google-Smtp-Source: ABdhPJwkH3G8ZdlvfKKYqYu8Q01goGfnSxTrJLfHwYUX4RxNytFLFgCXQO7z+MAGuPyDCnsi8X9ewg== X-Received: by 2002:a2e:8817:: with SMTP id x23mr17928556ljh.17.1623142982721; Tue, 08 Jun 2021 02:03:02 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-155-4-129-146.NA.cust.bahnhof.se. [155.4.129.146]) by smtp.gmail.com with ESMTPSA id n17sm1295197lfq.118.2021.06.08.02.03.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Jun 2021 02:03:01 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Ulf Hansson , Saravana Kannan , Alan Stern , Adrian Hunter , Tony Lindgren , Kevin Hilman , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 0/3] PM: runtime: Update behaviour for no callbacks Date: Tue, 8 Jun 2021 11:02:47 +0200 Message-Id: <20210608090250.85256-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 While reviewing a patch on the mmc-list, I ended up inspecting the behaviour of how we deal with the no callback case for runtime PM. A couple of observations: *) When pm_runtime_no_callbacks() have been called, it allows the PM core to takes a quicker path, but at the same time, consumer/supplier device links are being skipped in rpm_resume|suspend(). **) Calling pm_runtime_no_callbacks() to avoid boiler plate code (assigning empty functions to ->runtime_suspend|resume()), doesn't work if there could be consumer/supplier device link being used or a platform dependent PM domain that could get attached to the device. Therefore, this series suggests to change the behaviour in the PM core, to allow the ->runtime_suspend|resume() callbacks to be unassigned. This is already supported for ->runtime_idle() callbacks, so it would also move things into a more consistent behaviour. I have looked at various error paths, in the kernel of callers of pm_runtime_get_sync(). I couldn't find anyone that made sense, that looked for the special error code, -ENOSYS, which is the error code getting returned when a callback is missing. Whether that is sufficient proof that these changes are 100% safe, I can't guarantee, but I think it would be worth a try as the benefits of avoiding boilerplate code and the corresponding additional code paths are quite nice, if you ask me. Kind regards Ulf Hansson Ulf Hansson (3): PM: runtime: Improve path in rpm_idle() when no callback PM: runtime: Allow unassigned ->runtime_suspend|resume callbacks PM: runtime: Clarify documentation when callbacks are unassigned Documentation/power/runtime_pm.rst | 8 ++++++++ drivers/base/power/runtime.c | 18 ++++++++---------- 2 files changed, 16 insertions(+), 10 deletions(-) -- 2.25.1 Acked-by: Alan Stern