From nobody Wed Dec 17 05:45:43 2025 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A21621482EE for ; Wed, 19 Jun 2024 14:09:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718806149; cv=none; b=GdTi4UyS//vdxWgAmEmG9luGPH0dkPsi3Ko6rEY1Ngiq7IideR8RFCT3pUoLQDd6lxnHfAPMrzjPGBZaieA5meZVXZOLmS8c++kag6iQTrd4NVJ0pX4FSkLiMI3S/URil0HvIPEjZ3PLbAoH8Mk1TnSakIBNEitT62ogxXWU3tQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718806149; c=relaxed/simple; bh=O83FNAdgJkgnscldJT04vDrZcANIzWxDsUu1SHrFuVQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=U3N/U1CBA3YaxewE4rLVlShfLGrERGr39w92/rhTWdAmErBA2Xp03eay+itx//jNq5gZ87Jo0dNRD2Jdx7pTB9v4ZzJjtL1AhPLwAT+Mn+bwvH2vBM4FvBtSjCZq+ocfyCkFknV33hAKYbAEchW4TNQLxy4T4G4jqS/x/16Ii5E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Aa9e9Z4q; arc=none smtp.client-ip=209.85.167.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Aa9e9Z4q" Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-52c82101407so11022927e87.3 for ; Wed, 19 Jun 2024 07:09:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718806146; x=1719410946; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=j0o2btwvxJuAvs23zoxm88cS8MnRzldpGlzftLOxRCk=; b=Aa9e9Z4qC+7FRcAJ1q2bo3powkg2C0Eji6uh/qT8BlN6pbygVtWXlC4Z1NUFWoY5Ov CWW9Kxr6kafVXafeZxEvTQgiJ1untXlvfuG2i8Ttd/NV+6kGhINmMTblQwWUd3tEKzLc vMkb/NuOjstnpFgVQa94K7Htzwmb7oE8xv4mUhHThgiyzrYrSBFZ8qqqDFeo3+Pscyvq QRzqfK7G8hbj/mZmBoqMYogESV50dA6KQ4sz04UNZM5g7NqtJDcwkHAviTLPJZbLcUsN oP6kr414Und5rnU1baOpQwzopZrD0jxCaiBcfHF1pAG8j3mLkWSh+NZeait5QzhY7xhN Y7Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718806146; x=1719410946; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=j0o2btwvxJuAvs23zoxm88cS8MnRzldpGlzftLOxRCk=; b=t0sZwx5R3viGSp7MmcgnkNu+1sBIvhtLkKFTj7DJYulmN4+rz1+0pggR2cQ0zfZJHs o7E0LimhbZadOrmSLbIm37YI6iw32ue6wEI485PXrvz83U35PE0phKbjHVU//HgknAK6 0qNCfaMKLrKQHFe3SaeOJESM6QuXNdrt32ecTBSEpT1gImWofk73I+q/Jk2sG5CI12Cf rfnLJh6ieUVrf6DjOXW8mfpEF0xgPhczIl3+9NpJsjbWOu/zux8RYlF3IKfZ2Sds0FUS kGSCUSzI/pViZpNym9XiNJjXQji0I8XFjeKvyn7+Q1+3g2mN6l2SdPTaDXgT1Pr9e4+0 4Bqg== X-Forwarded-Encrypted: i=1; AJvYcCWzC9xhZZsAWKYi3PWnA/vdoHruwsfFy+oa48PMTCnTaTk3lrdyWZQAIAhT1jwA02c/t2ziOECHUlozsUQKRQx3SRwQzZiAH+/y0gQ/ X-Gm-Message-State: AOJu0Yz1QsHtZOazvHrSfWAzzudsfpyCU3P1/UP5eXXYj0CsR4p3d66a OkONYHU+LMqgZLnZvZlUGDG9nIGHUl319siy7Flii2EyGGp2ikq2NBrnq4aMvCLpjbKSDt06Ll3 e X-Google-Smtp-Source: AGHT+IGQ+IYY+K5JUtUrmVUaq99dM/Fd1SYa57uUXgyiboWmtgSst2pNGb8vCO3FJvkmSr34Pv77RQ== X-Received: by 2002:ac2:5f93:0:b0:52b:e7ff:32b with SMTP id 2adb3069b0e04-52ccaa32fbdmr1920541e87.23.1718806145693; Wed, 19 Jun 2024 07:09:05 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ca2872241sm1787003e87.124.2024.06.19.07.09.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 07:09:05 -0700 (PDT) From: Ulf Hansson To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Bjorn Andersson , Konrad Dybcio , Nikunj Kela , Prasad Sodagudi , Thierry Reding , Jonathan Hunter , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH 1/7] OPP: Fix support for required OPPs for multiple PM domains Date: Wed, 19 Jun 2024 16:08:43 +0200 Message-Id: <20240619140849.368580-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240619140849.368580-1-ulf.hansson@linaro.org> References: <20240619140849.368580-1-ulf.hansson@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In _set_opp() we are normally bailing out when trying to set an OPP that is the current one. This make perfect sense, but becomes a problem when _set_required_opps() calls it recursively. More precisely, when a required OPP is being shared by multiple PM domains, we end up skipping to request the corresponding performance-state for all of the PM domains, but the first one. Let's fix the problem, by calling _set_opp_level() from _set_required_opps() instead. Fixes: e37440e7e2c2 ("OPP: Call dev_pm_opp_set_opp() for required OPPs") Cc: stable@vger.kernel.org Signed-off-by: Ulf Hansson --- drivers/opp/core.c | 47 +++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index cb4611fe1b5b..45eca65f27f9 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1061,6 +1061,28 @@ static int _set_opp_bw(const struct opp_table *opp_t= able, return 0; } =20 +static int _set_opp_level(struct device *dev, struct opp_table *opp_table, + struct dev_pm_opp *opp) +{ + unsigned int level =3D 0; + int ret =3D 0; + + if (opp) { + if (opp->level =3D=3D OPP_LEVEL_UNSET) + return 0; + + level =3D opp->level; + } + + /* Request a new performance state through the device's PM domain. */ + ret =3D dev_pm_domain_set_performance_state(dev, level); + if (ret) + dev_err(dev, "Failed to set performance state %u (%d)\n", level, + ret); + + return ret; +} + /* This is only called for PM domain for now */ static int _set_required_opps(struct device *dev, struct opp_table *opp_ta= ble, struct dev_pm_opp *opp, bool up) @@ -1091,7 +1113,8 @@ static int _set_required_opps(struct device *dev, str= uct opp_table *opp_table, if (devs[index]) { required_opp =3D opp ? opp->required_opps[index] : NULL; =20 - ret =3D dev_pm_opp_set_opp(devs[index], required_opp); + ret =3D _set_opp_level(devs[index], opp_table, + required_opp); if (ret) return ret; } @@ -1102,28 +1125,6 @@ static int _set_required_opps(struct device *dev, st= ruct opp_table *opp_table, return 0; } =20 -static int _set_opp_level(struct device *dev, struct opp_table *opp_table, - struct dev_pm_opp *opp) -{ - unsigned int level =3D 0; - int ret =3D 0; - - if (opp) { - if (opp->level =3D=3D OPP_LEVEL_UNSET) - return 0; - - level =3D opp->level; - } - - /* Request a new performance state through the device's PM domain. */ - ret =3D dev_pm_domain_set_performance_state(dev, level); - if (ret) - dev_err(dev, "Failed to set performance state %u (%d)\n", level, - ret); - - return ret; -} - static void _find_current_opp(struct device *dev, struct opp_table *opp_ta= ble) { struct dev_pm_opp *opp =3D ERR_PTR(-ENODEV); --=20 2.34.1 From nobody Wed Dec 17 05:45:43 2025 Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0395E15098F for ; Wed, 19 Jun 2024 14:09:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718806150; cv=none; b=tRgyjcl4ElUNoA8tNDKtAOi28Wl1OMCiZb1ZUzIa8macjwFGTsWZNvGwDnW+HvQixNnII4cug6gRjtcMegBbwZ7Q9QZZik7dqiTWKmzBckXyxN4aYQetcABI1IIIjC9zDPRWf6jX3rNsJI81sNgph9UdY3VbZyz6OA5YjoO8etA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718806150; c=relaxed/simple; bh=p1L/5WV4IXuFQfEzRqNkQGg76bWmSg2tiKmoi6P2mIg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=Ziz+UV+hHqJG3ErA4Jm1/BPanB1FRijEN//9n1/FT7FC0oh0bVFAtUnU2OeJ1NoRbnhN1tIwBP74i4udpel1D8++F1MVSlraiH419Q3F9xedau4YV80XK8EMdEYl3iMsUHXja874jizp6yXdJZ6Hv2MhxaOijFAVb9rfiNFFYyc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=P7yF7jEU; arc=none smtp.client-ip=209.85.167.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="P7yF7jEU" Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-5295eb47b48so7712524e87.1 for ; Wed, 19 Jun 2024 07:09:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718806147; x=1719410947; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=u1K1pfLjx3yXde9nph0uxH/MYhA+YR/At4AWwuoRbU0=; b=P7yF7jEUQoKqne+fN5LFnkYRcW2vYKJBuVwDTBKCLV+ub0r0OJBbgaLvfyfz0Um8Te N7TB4ly/88uZV0qwc3F5Xqp++h/U8PpstQXa5UlC2b2D0agiTPydkibtsdN0TODEXmUI BFty1N7iv28efjLTE8rWeLd95/IJ3rqYN+nT2WXkLyBxrxsMeqse8fv1lpN2IoEd3VKA WGcq1ahZnu1zHciMKsDfZhX7mWmlbV4LyHW0Bw13rT9/23o3n6kHxUNTXmh1WqxFOljZ FgWt/Uqy3k4bDU5tRxfYBpAGsJO2NL5w1TAjlpLAI0AhIZOlHIuA7qBCZ2Nw0Nyp7mux n1Gg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718806147; x=1719410947; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=u1K1pfLjx3yXde9nph0uxH/MYhA+YR/At4AWwuoRbU0=; b=HzFpJz4VeGd+B6X1wJlbNAzdpStu5LB2nQwIvqrz6aXj5HrpdUioHAOfFGa/NnVD3a vo6tAfWv4zRMwutV09qIkx69AUBgp0DuWtqt4Mrv7ZnjNaXsQzzPoUlGz+oMyy73TYN7 f55qcu5KFbAztOl4c6/F4lrINKeM7twPMn5lbVH0dfosmxCJcAE32woZGwSQMA/iRNEZ UkiSxb3GDJV7cZQW3589Yw4pPG3fcnimBwtuOWFigqJiyzZiQjZNXi01rDbgI2KsLfAo TJax3/TOp9VheGyi6bSkNrDJDk8zW+FgrbPNhVGrWk0Uk6EWTVquiJKGJ7kCUu8f0MAa f8hA== X-Forwarded-Encrypted: i=1; AJvYcCU/8DmGPZiCZZRsaeTXq6A+OhYsX0jtfYs0SwlN6AP9ePUrqTs81uSbL2FLKGbsfuafTavRCnd/SfQnR+ejhwNLLNktJywYmdcGjpzS X-Gm-Message-State: AOJu0YwGXcY1BTDCaXPjoJBJBv7q1p5WGxbb4XKFdox3L63pRtfV6iJo 4NZ6Q44WtOe9P/jNw5ne9o0JGDuVf+p0lPXuwxYFE3k9SPHeG6rqcpEcvTDwLOs= X-Google-Smtp-Source: AGHT+IEVGpl8euILARdKcz9t6ynE/gJP+grfmU6GsH/Be6u3fMQfkdUuTeM52zWE+8c5drYOKvWenA== X-Received: by 2002:a19:7006:0:b0:52c:c725:9d16 with SMTP id 2adb3069b0e04-52ccaa5f3dfmr1796341e87.30.1718806147197; Wed, 19 Jun 2024 07:09:07 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ca2872241sm1787003e87.124.2024.06.19.07.09.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 07:09:06 -0700 (PDT) From: Ulf Hansson To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Bjorn Andersson , Konrad Dybcio , Nikunj Kela , Prasad Sodagudi , Thierry Reding , Jonathan Hunter , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/7] OPP: Drop a redundant in-parameter to _set_opp_level() Date: Wed, 19 Jun 2024 16:08:44 +0200 Message-Id: <20240619140849.368580-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240619140849.368580-1-ulf.hansson@linaro.org> References: <20240619140849.368580-1-ulf.hansson@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The in-parameter "opp_table" isn't needed by _set_opp_level(). Let's therefore drop it. Signed-off-by: Ulf Hansson --- drivers/opp/core.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 45eca65f27f9..02ba963d11ff 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1061,8 +1061,7 @@ static int _set_opp_bw(const struct opp_table *opp_ta= ble, return 0; } =20 -static int _set_opp_level(struct device *dev, struct opp_table *opp_table, - struct dev_pm_opp *opp) +static int _set_opp_level(struct device *dev, struct dev_pm_opp *opp) { unsigned int level =3D 0; int ret =3D 0; @@ -1113,8 +1112,7 @@ static int _set_required_opps(struct device *dev, str= uct opp_table *opp_table, if (devs[index]) { required_opp =3D opp ? opp->required_opps[index] : NULL; =20 - ret =3D _set_opp_level(devs[index], opp_table, - required_opp); + ret =3D _set_opp_level(devs[index], required_opp); if (ret) return ret; } @@ -1172,7 +1170,7 @@ static int _disable_opp_table(struct device *dev, str= uct opp_table *opp_table) if (opp_table->regulators) regulator_disable(opp_table->regulators[0]); =20 - ret =3D _set_opp_level(dev, opp_table, NULL); + ret =3D _set_opp_level(dev, NULL); if (ret) goto out; =20 @@ -1221,7 +1219,7 @@ static int _set_opp(struct device *dev, struct opp_ta= ble *opp_table, return ret; } =20 - ret =3D _set_opp_level(dev, opp_table, opp); + ret =3D _set_opp_level(dev, opp); if (ret) return ret; =20 @@ -1268,7 +1266,7 @@ static int _set_opp(struct device *dev, struct opp_ta= ble *opp_table, return ret; } =20 - ret =3D _set_opp_level(dev, opp_table, opp); + ret =3D _set_opp_level(dev, opp); if (ret) return ret; =20 --=20 2.34.1 From nobody Wed Dec 17 05:45:43 2025 Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A41815252B for ; Wed, 19 Jun 2024 14:09:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718806154; cv=none; b=Q6l686C+65AVccjPT/dUPtrisT1RQLHtwA7q+ELaB7x0vPV6XU6DLvbtcY9BS4aSoJ+JGfUR9E9JsXK38/QIukg7qO35kUpZ7KiPR37f/5Kn75FhuolFX6V5yVC1kwkDA2zC18UsJD5G0XklxHKD4Ts6LZyWwCfwhMLJDQ3Eyp0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718806154; c=relaxed/simple; bh=r7WdFwdIx0SvBrhoxR/qHtGpCRe300sQa3NmHIufVxI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=q85w/bV5h87fPlo/2Yx03MAMvdEpdUwI/6S29UjU2hoFXoIqHoeour5XV0E2mTf8ujRL9wQc259ciznKjEp2HmAGG5faecJnR82nUkDPas25tS8H65Gj/V+4SKPvCRxVb1MoOlo2eZe3uIfFdcOFL9khF0CHGquEkXDhAKdRIM4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=NdSfIRHU; arc=none smtp.client-ip=209.85.167.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="NdSfIRHU" Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-52cc671f170so820086e87.1 for ; Wed, 19 Jun 2024 07:09:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718806150; x=1719410950; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aJlwtJVzi6XNiVK5ZSTOV746RcDL3LF9tmFw5hjmIxo=; b=NdSfIRHUQLGX1+aZpgzO59rYyhDd+mNcpsuHilBoqGnXidcoqFfBi2Yg2gzXonqEow Dm6SlvTPv/2lu81v7B0F7Xvt43vpX/6v7pbfBO+fnV2MIX7PlCLAT3Vp2CFoNhoSQUB5 qhLZXlexWocdoUTMysJzcerzGvfU6+YBKOq6oJN6n5LXEn3+mWFN6wLwmyW0F7Q1eEhI oaCCBrd4D9QjM2Dhp0NkRIzEGdl+MVFac/ObLbTCQoECae+cf+0ZQQj9N/Eape6U6jJ0 M7oQOBC5Z7EFi4QtlFwQO3gy0s677IdVXKy5bkkzF9t0Skxw8IxTx2JzVEUVDQ4e6+db OKEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718806150; x=1719410950; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aJlwtJVzi6XNiVK5ZSTOV746RcDL3LF9tmFw5hjmIxo=; b=nRrP2fi2K4DQqx9C/6N/mvzZ/cXFgdO1/PQ6vEvz8C1O2mp5pbrVaWgSRADz93zZA6 AU+vgygzb93KZoQsCGi4hZDP6BQA62Gu904hau1pAYBFY8oDU/2+SjvHpZRogMXHnPXd kzZ4lrnx7KB2G83O47QcsWT0m2z5b8TdJBL9QkHI2uiL7NVevsIQV2X6ljelA3TWewG5 0iVE4F0Wc2O52Z8rJEQpv8ek1zaCG+ngSSo18TSIHORD9uF/jT/6XxdaHdUpE3isG47I SKWFqH0J6Csb9uHDg/lwbiVtiYodaFshUitq+TpG1gCtgi2LcGXY6+OVNAqMs/IgBzXl /djw== X-Forwarded-Encrypted: i=1; AJvYcCXSK7QlJE4Mvda+DQyl4/YawFE+HrkP6d1WLS4c0ryM1ZLyIpsCf9iFSmHb2WehXqjJjg65DQPldUVu8K2xjorb6pR3aqSvC0rljZUk X-Gm-Message-State: AOJu0YynC8X0ZFF7dA42+vmPU9MEFZoiKa96lYjJf+kHe+G7UcBjK40S QdT/oVorhs+gCSP7TUqIaIKcyKceFkCkYTfdhVtkOnMs7kWoeKa4cVZv2PJNW5s= X-Google-Smtp-Source: AGHT+IH8szx+wGfNF7xCKKOXXggxhUc5i6OCYEwmr+61pe4qfUaU6Uy78GSQKKnrYH7d3bzd2PkMRA== X-Received: by 2002:a05:6512:31d4:b0:52c:c64e:b902 with SMTP id 2adb3069b0e04-52cca1ea264mr869272e87.27.1718806148309; Wed, 19 Jun 2024 07:09:08 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ca2872241sm1787003e87.124.2024.06.19.07.09.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 07:09:07 -0700 (PDT) From: Ulf Hansson To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Bjorn Andersson , Konrad Dybcio , Nikunj Kela , Prasad Sodagudi , Thierry Reding , Jonathan Hunter , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/7] OPP: Rework _set_required_devs() to manage a single device per call Date: Wed, 19 Jun 2024 16:08:45 +0200 Message-Id: <20240619140849.368580-4-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240619140849.368580-1-ulf.hansson@linaro.org> References: <20240619140849.368580-1-ulf.hansson@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" At this point there are no consumer drivers that makes use of _set_required_devs(), hence it should be straightforward to rework the code to enable it to better integrate with the genpd attach procedure. During genpd attach, one device is being attached to its PM domain. Therefore, let's also update the _set_required_devs() to work with this behaviour and instead trust callers to fill out one required_dev per call. Moving forward and as shown from a subsequent change, genpd becomes the first user of the reworked _set_required_dev(). Signed-off-by: Ulf Hansson --- drivers/opp/core.c | 89 +++++++++++++++++++++++++++++------------- drivers/opp/opp.h | 4 +- include/linux/pm_opp.h | 10 +++-- 3 files changed, 71 insertions(+), 32 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 02ba963d11ff..bc1ed1d3d60d 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2483,9 +2483,10 @@ static int _opp_attach_genpd(struct opp_table *opp_t= able, struct device *dev, =20 } =20 -static int _opp_set_required_devs(struct opp_table *opp_table, - struct device *dev, - struct device **required_devs) +static int _opp_set_required_dev(struct opp_table *opp_table, + struct device *dev, + struct device *required_dev, + struct opp_table *required_opp_table) { int i; =20 @@ -2494,36 +2495,68 @@ static int _opp_set_required_devs(struct opp_table = *opp_table, return -EINVAL; } =20 - /* Another device that shares the OPP table has set the required devs ? */ - if (opp_table->required_devs[0]) - return 0; + /* Genpd core takes care of propagation to parent genpd */ + if (opp_table->is_genpd) { + dev_err(dev, "%s: Operation not supported for genpds\n", __func__); + return -EOPNOTSUPP; + } =20 for (i =3D 0; i < opp_table->required_opp_count; i++) { - /* Genpd core takes care of propagation to parent genpd */ - if (required_devs[i] && opp_table->is_genpd && - opp_table->required_opp_tables[i]->is_genpd) { - dev_err(dev, "%s: Operation not supported for genpds\n", __func__); - return -EOPNOTSUPP; - } + struct opp_table *table =3D opp_table->required_opp_tables[i]; + + /* + * The OPP table should be available at this point. If not, it's + * not the one we are looking for. + */ + if (IS_ERR(table)) + continue; + + /* Move to the next available index. */ + if (opp_table->required_devs[i]) + continue; =20 - opp_table->required_devs[i] =3D required_devs[i]; + /* + * We need to compare the nodes for the OPP tables, rather than + * the OPP tables themselves, as we may have separate instances. + */ + if (required_opp_table->np =3D=3D table->np) { + + /* Cross check the OPP tables and fix it if needed. */ + if (required_opp_table !=3D table) { + dev_pm_opp_put_opp_table(table); + _get_opp_table_kref(required_opp_table); + opp_table->required_opp_tables[i] =3D required_opp_table; + } + + opp_table->required_devs[i] =3D required_dev; + + /* + * Add the required_dev as a user of the OPP table, so + * we can call dev_pm_opp_set_opp() on it directly. + */ + if (!_add_opp_dev(required_dev, required_opp_table)) { + dev_err(dev, "Failed to add the device to the required OPP table\n"); + return -ENOMEM; + } + + return i; + } } =20 - return 0; + dev_err(dev, "Missing OPP table, unable to set the required dev\n"); + return -ENODEV; } =20 -static void _opp_put_required_devs(struct opp_table *opp_table) +static void _opp_put_required_dev(struct opp_table *opp_table, + unsigned int index) { - int i; - - for (i =3D 0; i < opp_table->required_opp_count; i++) - opp_table->required_devs[i] =3D NULL; + opp_table->required_devs[index] =3D NULL; } =20 static void _opp_clear_config(struct opp_config_data *data) { - if (data->flags & OPP_CONFIG_REQUIRED_DEVS) - _opp_put_required_devs(data->opp_table); + if (data->flags & OPP_CONFIG_REQUIRED_DEV) + _opp_put_required_dev(data->opp_table, data->index); else if (data->flags & OPP_CONFIG_GENPD) _opp_detach_genpd(data->opp_table); =20 @@ -2640,7 +2673,7 @@ int dev_pm_opp_set_config(struct device *dev, struct = dev_pm_opp_config *config) =20 /* Attach genpds */ if (config->genpd_names) { - if (config->required_devs) + if (config->required_dev) goto err; =20 ret =3D _opp_attach_genpd(opp_table, dev, config->genpd_names, @@ -2649,13 +2682,15 @@ int dev_pm_opp_set_config(struct device *dev, struc= t dev_pm_opp_config *config) goto err; =20 data->flags |=3D OPP_CONFIG_GENPD; - } else if (config->required_devs) { - ret =3D _opp_set_required_devs(opp_table, dev, - config->required_devs); - if (ret) + } else if (config->required_dev && config->required_opp_table) { + ret =3D _opp_set_required_dev(opp_table, dev, + config->required_dev, + config->required_opp_table); + if (ret < 0) goto err; =20 - data->flags |=3D OPP_CONFIG_REQUIRED_DEVS; + data->index =3D ret; + data->flags |=3D OPP_CONFIG_REQUIRED_DEV; } =20 ret =3D xa_alloc(&opp_configs, &id, data, XA_LIMIT(1, INT_MAX), diff --git a/drivers/opp/opp.h b/drivers/opp/opp.h index cff1fabd1ae3..5b5a4bd89c9e 100644 --- a/drivers/opp/opp.h +++ b/drivers/opp/opp.h @@ -35,12 +35,13 @@ extern struct list_head opp_tables; #define OPP_CONFIG_PROP_NAME BIT(3) #define OPP_CONFIG_SUPPORTED_HW BIT(4) #define OPP_CONFIG_GENPD BIT(5) -#define OPP_CONFIG_REQUIRED_DEVS BIT(6) +#define OPP_CONFIG_REQUIRED_DEV BIT(6) =20 /** * struct opp_config_data - data for set config operations * @opp_table: OPP table * @flags: OPP config flags + * @index: The position in the array of required_devs * * This structure stores the OPP config information for each OPP table * configuration by the callers. @@ -48,6 +49,7 @@ extern struct list_head opp_tables; struct opp_config_data { struct opp_table *opp_table; unsigned int flags; + unsigned int index; }; =20 /** diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index dd7c8441af42..2b6599f6037d 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -63,10 +63,11 @@ typedef int (*config_clks_t)(struct device *dev, struct= opp_table *opp_table, * @supported_hw_count: Number of elements in the array. * @regulator_names: Array of pointers to the names of the regulator, NULL= terminated. * @genpd_names: Null terminated array of pointers containing names of gen= pd to - * attach. Mutually exclusive with required_devs. + * attach. Mutually exclusive with required_dev. * @virt_devs: Pointer to return the array of genpd virtual devices. Mutua= lly - * exclusive with required_devs. - * @required_devs: Required OPP devices. Mutually exclusive with genpd_nam= es/virt_devs. + * exclusive with required_dev. + * @required_dev: Required OPP device. Mutually exclusive with genpd_names= /virt_devs. + * @required_opp_table: The corresponding required OPP table for @required= _dev. * * This structure contains platform specific OPP configurations for the de= vice. */ @@ -81,7 +82,8 @@ struct dev_pm_opp_config { const char * const *regulator_names; const char * const *genpd_names; struct device ***virt_devs; - struct device **required_devs; + struct device *required_dev; + struct opp_table *required_opp_table; }; =20 #define OPP_LEVEL_UNSET U32_MAX --=20 2.34.1 From nobody Wed Dec 17 05:45:43 2025 Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B1AD2152787 for ; Wed, 19 Jun 2024 14:09:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718806156; cv=none; b=CmXG67vdJnp/OYlY1LEPTDPAFqeVkzDFWCJU2NimW5SBAWQ6gGRucaq/G+t6uSWAHFE61RygXJPLw5tCH6eqQ/zEXXbbJD7sLjwz5v7vyuWmrmnC4F+hY0O0WN4j16G6jIR4NgxQPJT2vtm8F/pfmDpOhgUjqObvo1w+u+Hu+i0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718806156; c=relaxed/simple; bh=xVTzIOADtFMWN8HF0VXifzBdG/mUYz+OV6Ng8rERawc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=IxgSfQ0Gx74pGaBQffR49KZNvRJDCfYoVGdVzaTRobCye3MZccDkpiRsoLd1QQSe2Z9qWcV3TLTVeFGz+PsM4ozb/+x90zAIh6k8OKHSDboO15mF6qX8rbIqup62lnXSDACXCi404QWeBvf1PxLw1L7/46CizxMaBos9k/6Ryc0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ig9zOITN; arc=none smtp.client-ip=209.85.167.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ig9zOITN" Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-52c9034860dso8376262e87.2 for ; Wed, 19 Jun 2024 07:09:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718806152; x=1719410952; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CDWaPf7+TN9M1cnbl/7mu5+omOHy+MPUVcUqdXnYMd8=; b=ig9zOITN5Bv/ZTGOI7aJ4UnF62+XsCDxc5reJAm++NzDbhe/zNs8Z0pUJ2h1scak0Q lhLjjoEgyEOOesAr7lEjZkfmgGAM0Wy8q17MuPlbeQzPNdyu4v6aZmIAXcR8hMNhwlJC DCmHKj+1daWXe0/zRUsy5uB9af+7hDBBQj73Lse3PR97pUGYh011iVckBBIRWs/TNXRF X0D4t9AnOF+Cnjw57heRJaA9uLogTxJMJX9asOn9azpCYgRMzjpevDYYxcL2sM4JrNkl 2d5tOX68to9dukh5VX16NbKQttW1PaIWNIfcvSgLI5dDh+VLVdYr8mK+8iYndMwIQgGv brqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718806152; x=1719410952; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CDWaPf7+TN9M1cnbl/7mu5+omOHy+MPUVcUqdXnYMd8=; b=ap9VPC1FhupqmoQOd/1Dbx2cusxQlDMrY6TXjsEj6LQ1wkZN3Spb4TtWxI//G2w3yr 5SkazrOt//ZauI4UzF/pLAz7rlePtVBiP4/7T+oUcCtXIlOj4tAfY8NjZKkTThNXzz7o 8fDWQ1TW0ZvDS/+b4ZSftpr8AHc1dVmkW5+PDgGGLMNbmSEtzegbiXbSS8+PC6eZnCLd hJLIQquaAdlvVygrHE7xwHjYKj9PnZwCWoaDls3F++Yp8VEbNk5mLBTVaIi4p18cRWO1 ijuvza4LNL81KEWNHf1760JC50l2YpR4sygFHHIrAtJpZHjY7RpLaX7iWC7bRRZoidv7 zPGg== X-Forwarded-Encrypted: i=1; AJvYcCW5rqPz0mAA9SCsYZ+r+pRocX3dVMZ5ua1a13xvAlAV26HbRqHK1FP7LO/IGm03JmsagFsC14CHvssw88Wzr/Jbm5T/3Lq4moNTTFGA X-Gm-Message-State: AOJu0Ywr9x9+yj3PaJWeQfx8E112GH5GM0M0NHu065Dzdp/5HSgiXzB1 O8miv86ETRCSD5CV1lj7djGAJaDsVrBkCbuq5edV814dzuQdfWpH1yzDayG0Ujh0a2dd6vQUH6L 9 X-Google-Smtp-Source: AGHT+IFbKCEpIt59r0vwx09Jj3ZBoGPhwAYQUSf6Kkwln2POjh4upJ24OJAsVYPh1tHMRchYqc0ZgA== X-Received: by 2002:a05:6512:e8c:b0:52c:aaa1:977e with SMTP id 2adb3069b0e04-52cca8b0e87mr2662675e87.0.1718806151472; Wed, 19 Jun 2024 07:09:11 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ca2872241sm1787003e87.124.2024.06.19.07.09.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 07:09:11 -0700 (PDT) From: Ulf Hansson To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Bjorn Andersson , Konrad Dybcio , Nikunj Kela , Prasad Sodagudi , Thierry Reding , Jonathan Hunter , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/7] OPP: Introduce an OF helper function to inform if required-opps is used Date: Wed, 19 Jun 2024 16:08:46 +0200 Message-Id: <20240619140849.368580-5-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240619140849.368580-1-ulf.hansson@linaro.org> References: <20240619140849.368580-1-ulf.hansson@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" As being shown from a subsequent change to genpd, it's useful to understand if a device's OF node has an OPP-table described and whether it contains OPP nodes that makes use of the required-opps DT property. For this reason, let's introduce an OPP OF helper function called dev_pm_opp_of_has_required_opp(). Signed-off-by: Ulf Hansson --- drivers/opp/of.c | 32 ++++++++++++++++++++++++++++++++ include/linux/pm_opp.h | 6 ++++++ 2 files changed, 38 insertions(+) diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 282eb5966fd0..55c8cfef97d4 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -1443,6 +1443,38 @@ int of_get_required_opp_performance_state(struct dev= ice_node *np, int index) } EXPORT_SYMBOL_GPL(of_get_required_opp_performance_state); =20 +/** + * dev_pm_opp_of_has_required_opp - Find out if a required-opps exists. + * @dev: The device to investigate. + * + * Returns true if the device's node has a "operating-points-v2" property = and if + * the corresponding node for the opp-table describes opp nodes that uses = the + * "required-opps" property. + * + * Return: True if a required-opps is present, else false. + */ +bool dev_pm_opp_of_has_required_opp(struct device *dev) +{ + struct device_node *opp_np, *np; + int count; + + opp_np =3D _opp_of_get_opp_desc_node(dev->of_node, 0); + if (!opp_np) + return false; + + np =3D of_get_next_available_child(opp_np, NULL); + of_node_put(opp_np); + if (!np) { + dev_warn(dev, "Empty OPP table\n"); + return false; + } + + count =3D of_count_phandle_with_args(np, "required-opps", NULL); + of_node_put(np); + + return count > 0; +} + /** * dev_pm_opp_get_of_node() - Gets the DT node corresponding to an opp * @opp: opp for which DT node has to be returned for diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index 2b6599f6037d..5fade5c4de40 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -476,6 +476,7 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_d= ev, struct cpumask *cpuma struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev); struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp); int of_get_required_opp_performance_state(struct device_node *np, int inde= x); +bool dev_pm_opp_of_has_required_opp(struct device *dev); int dev_pm_opp_of_find_icc_paths(struct device *dev, struct opp_table *opp= _table); int dev_pm_opp_of_register_em(struct device *dev, struct cpumask *cpus); int dev_pm_opp_calc_power(struct device *dev, unsigned long *uW, @@ -554,6 +555,11 @@ static inline int of_get_required_opp_performance_stat= e(struct device_node *np, return -EOPNOTSUPP; } =20 +static inline bool dev_pm_opp_of_has_required_opp(struct device *dev) +{ + return false; +} + static inline int dev_pm_opp_of_find_icc_paths(struct device *dev, struct = opp_table *opp_table) { return -EOPNOTSUPP; --=20 2.34.1 From nobody Wed Dec 17 05:45:43 2025 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5F18A153582 for ; Wed, 19 Jun 2024 14:09:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718806159; cv=none; b=YpMPlNHyUw1XbhoyjH6jfiAthLG+lU13WQkUwI3Csft9N0tIiBa2u0meJVfv8Y3yU4q+2b7mQUsLHsro7w9QzLnAxzbHMfWsiKkBfiTyoU/xrTSbXUEMRVmKHsgsOQC8ZdibwJCf6P7BcI/9sBAhjUH2ed+QtyD9TeZNTbJfy5w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718806159; c=relaxed/simple; bh=BCICaCFGMmLOmUyHekQXCYwkgEJHZLXP9WCwg2mTagk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=F28lb6520Orn1kvAFN/tY3XvZu9JNwfIJnH583X/Xk6NvZkvCkwG2+kMDZ11reOkvL3sTT4u881oYF1U5c3hBE9Tv4TiQuu9IkLez4qhe7iXuXzr8WvjyZQJv7YzrSheA/SzSZTp1CNzogAwuCV2FEhK2Mx4aEEkaCHT+J9uJ3A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=cDMuDzVA; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="cDMuDzVA" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-5295e488248so7162568e87.2 for ; Wed, 19 Jun 2024 07:09:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718806155; x=1719410955; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=htFpAgDo306pFLyFNLJIsFnxeXuNDgJdkPPYgP2iQ3A=; b=cDMuDzVAxB+RkzVufgRrgeI2dN1yf80nzlXdJ8BvBTplY9O2Kkl6UF9iHJcc312xEZ poLY6VOqX0xoyAY9s4xEDNVkvW9zd24fOFvOI9lUPwML6daw5exQ0KdYDqdQNhDPzmXn CbNwCqTXf+DW4AnUoWECdnfMr2RWgfVQ1cNH3g24Tv5x7/ajuu57yJHDY0lXilC8xy1G U9GlBK/16ZTlRhiYA+oTOBt9kQXiC2PXejwNqt/10pqmpF0hK0smeZoXu7V9PFtT6Xwl /m+sHbW+LLk6JfV+27cadEMkw0KPl5pvA1dl0HQ95MJvyMsxUANTyYTJoxs0UlrIFndP qlyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718806155; x=1719410955; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=htFpAgDo306pFLyFNLJIsFnxeXuNDgJdkPPYgP2iQ3A=; b=h1PHSqPYDb7IR+lEwQg+S3RMyHueTvwg6jLCYaMbktpmucRtmbOXkqJZXL/S2BYJQy giurkH85CB59e5Rrx0QsuX59XhdJ0shUgIjGbOimHHpXBrs1SG2PJJlgYdecq0AI1Hmq SWC788seANRAQZSzLFGQZDfYyAZbmigIeOurZeFMNt6oo71beAFk4pTkwR7OoAXdAPS9 gawS4PFuAjL6U2N3eUkPy42cOmYVFXuwo5SBmZW12cZXbrWOCMN+HLswgHoNzwVghRz/ RXObig+92TgalIabz9W+6wu4P3y4Gh9WA7+lSS+/QIPpkJ6mtA+GakPP7eA+kboj/Nmb abAg== X-Forwarded-Encrypted: i=1; AJvYcCUZotNu91YWdj5CrkH3dLrtnY4XUfe60gIHCAKTvCpGx9f+IZFfTmS5ioWmXSUcRYO4a4Kc2G8eDuRgqwLdigF/cmnf2cx+bpZz7r7/ X-Gm-Message-State: AOJu0YxHf0U7t7RZpyaTzgbm8Lz09nQi853or+VBo0JuJmM9uc7YRATy JFKDjD0rtY1PkesvK5CJ49cGGm9j0NTzH6B6hbUCMKcSvpX5TnQ0sbQSTCOW/OY= X-Google-Smtp-Source: AGHT+IHfAlr5DrpIAaWiiNsj4x6QaAAeJHHW2gKvh16J7kuwaVsds0u8zDkuPraMr/WEHw60Qa+NSw== X-Received: by 2002:ac2:44b6:0:b0:52c:893c:6c2c with SMTP id 2adb3069b0e04-52ccaa3756amr1415929e87.40.1718806153456; Wed, 19 Jun 2024 07:09:13 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ca2872241sm1787003e87.124.2024.06.19.07.09.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 07:09:13 -0700 (PDT) From: Ulf Hansson To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Bjorn Andersson , Konrad Dybcio , Nikunj Kela , Prasad Sodagudi , Thierry Reding , Jonathan Hunter , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/7] pmdomain: core: Manage the default required OPP from a separate function Date: Wed, 19 Jun 2024 16:08:47 +0200 Message-Id: <20240619140849.368580-6-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240619140849.368580-1-ulf.hansson@linaro.org> References: <20240619140849.368580-1-ulf.hansson@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" To improve the readability of the code in __genpd_dev_pm_attach(), let's move out the required OPP handling into a separate function. Signed-off-by: Ulf Hansson --- drivers/pmdomain/core.c | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c index 83d978743659..74ebb8a423be 100644 --- a/drivers/pmdomain/core.c +++ b/drivers/pmdomain/core.c @@ -2774,12 +2774,34 @@ static void genpd_dev_pm_sync(struct device *dev) genpd_queue_power_off_work(pd); } =20 +static int genpd_set_required_opp(struct device *dev, unsigned int index) +{ + int ret, pstate; + + /* Set the default performance state */ + pstate =3D of_get_required_opp_performance_state(dev->of_node, index); + if (pstate < 0 && pstate !=3D -ENODEV && pstate !=3D -EOPNOTSUPP) { + ret =3D pstate; + goto err; + } else if (pstate > 0) { + ret =3D dev_pm_genpd_set_performance_state(dev, pstate); + if (ret) + goto err; + dev_gpd_data(dev)->default_pstate =3D pstate; + } + + return 0; +err: + dev_err(dev, "failed to set required performance state for power-domain %= s: %d\n", + dev_to_genpd(dev)->name, ret); + return ret; +} + static int __genpd_dev_pm_attach(struct device *dev, struct device *base_d= ev, unsigned int index, bool power_on) { struct of_phandle_args pd_args; struct generic_pm_domain *pd; - int pstate; int ret; =20 ret =3D of_parse_phandle_with_args(dev->of_node, "power-domains", @@ -2808,17 +2830,9 @@ static int __genpd_dev_pm_attach(struct device *dev,= struct device *base_dev, dev->pm_domain->detach =3D genpd_dev_pm_detach; dev->pm_domain->sync =3D genpd_dev_pm_sync; =20 - /* Set the default performance state */ - pstate =3D of_get_required_opp_performance_state(dev->of_node, index); - if (pstate < 0 && pstate !=3D -ENODEV && pstate !=3D -EOPNOTSUPP) { - ret =3D pstate; + ret =3D genpd_set_required_opp(dev, index); + if (ret) goto err; - } else if (pstate > 0) { - ret =3D dev_pm_genpd_set_performance_state(dev, pstate); - if (ret) - goto err; - dev_gpd_data(dev)->default_pstate =3D pstate; - } =20 if (power_on) { genpd_lock(pd); @@ -2840,8 +2854,6 @@ static int __genpd_dev_pm_attach(struct device *dev, = struct device *base_dev, return 1; =20 err: - dev_err(dev, "failed to set required performance state for power-domain %= s: %d\n", - pd->name, ret); genpd_remove_device(pd, dev); return ret; } --=20 2.34.1 From nobody Wed Dec 17 05:45:43 2025 Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D09115381C for ; Wed, 19 Jun 2024 14:09:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718806160; cv=none; b=VTXsgXpE01SukJQN8XsGNqzMDYgSQWaoY74Y7eCIJpp9Nj8CXgYupnQA4DlnPbIYma8U+/reK59L0R4mbZIDJTKwHyS3GZ3geK8Eub/RBsoJP6MXWJhCa08e4ciydVhQ/8BDIfOBofXVsZKM70JM2bFCxfH4ylF7hq25PkyDNzU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718806160; c=relaxed/simple; bh=UqitLzzPeo8+v+foWj/D1g1tTUg9dHcKK5jhxbU/5dc=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ku0TgJ7LU4PNtSjNSDEQWzOrcmyGIS5WZs90wE/NUZz6XMLYtSXKAJuiUOz//ytgHwUenanSnIOGUn5eYQ8Mi4o6Sl9kPkyasuUCfDZZMEXPRVWRnwm8QkBIzK4L3szfK5vI34ZDcH+MFBqd8ADl6Z539f1ZNxaydhysgo9aHYk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Qs/GKz/5; arc=none smtp.client-ip=209.85.208.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Qs/GKz/5" Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2ebe40673e8so68811861fa.3 for ; Wed, 19 Jun 2024 07:09:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718806157; x=1719410957; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jH7teSUneCZWfoVt/91/lHeZpMwu3/Yn++4TJjeU7NA=; b=Qs/GKz/5laiNYvsjeBxiBkVMGf/5lX6TdCWc6ifXLOHgmafbxHh2zpaImHh9Aj7Z2y TyThogMJ1kLkUrYNneisnVLk0Xo6zFuDgxy/H+IAcao0s98TKJrXJ+4812XNsNKFpvMr Q4WH+vfDxF3QDnMROa3kDLorTNL2hG+0xoD+C/wUumglztuHan1jB5e1hvG/OxlbGnAk iC3q199BeVgMRNPD9Buz20CPnxCc/mWExi6FmsV4hi6MZQ5wOlIrnSVeaGPeS6LO71Zb 0vZJoHp7bz4l7vpkJdZantaZNhc6nhoMXd39Fov9k1UcZeiceWknmsAaPpiZkv+S+agn fBzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718806157; x=1719410957; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jH7teSUneCZWfoVt/91/lHeZpMwu3/Yn++4TJjeU7NA=; b=TPTWziBqCJJRxgHn//Mx2VsSnOHDhebvkBfd30Epm3GMOv5onI+5na+BFo4dMuI+WO A1L4ZISmZJoebHce2jpy+0b69KhL/4Oogz5aCSWijhfMtCXmpaBd2uKw40m3Ygn3Vpl1 YcpleMEhfv7yTZCaazRoPA4pitz8iPC40S6ZUhtDUKPvg+fTLtCElk6DbuFe368soKaz dd6gpB/gUMzUB0/Xh/ngWRSMm11NdNf71SHvDa7X0H2xe4vujpVpwEQ8jyd3KvCOrivB XFk6Alr9clFsKdgTJGbRRQFkhNTe4sd98i/Jmx7GLtmQBHP42NPDYGMcXz2ysq/3H47r wZbQ== X-Forwarded-Encrypted: i=1; AJvYcCUcF+4qFxZdK8QupGTcagkqF1R+lkayshiyME43ewfii0FaGD4IYO1aUDb1BDVODVHYIV52g5m0r+MVAPeArdH5/ltLTuzXt1YdlV9s X-Gm-Message-State: AOJu0YwH5Bdl5sUKqga7H8rK4+7XSGoC2xIGZYRbY7Olg6bk62BTJg+t hIhyUp3iRLhASdKF+CskuBD5oLgJJvyUvOphQwzgZ+7JTQy8t3GGCK/UCfG9qF8= X-Google-Smtp-Source: AGHT+IGoJr5DuwJJ1A2TjVENIUslYHC6GqIXMmnq00+SVaUdczAOZsm6VolY8hrQoNfjsd/Xd4Uhig== X-Received: by 2002:a05:6512:3d0e:b0:52c:cda0:18bf with SMTP id 2adb3069b0e04-52ccda019d6mr967714e87.4.1718806156688; Wed, 19 Jun 2024 07:09:16 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ca2872241sm1787003e87.124.2024.06.19.07.09.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 07:09:16 -0700 (PDT) From: Ulf Hansson To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Bjorn Andersson , Konrad Dybcio , Nikunj Kela , Prasad Sodagudi , Thierry Reding , Jonathan Hunter , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/7] OPP/pmdomain: Set the required_dev for a required OPP during genpd attach Date: Wed, 19 Jun 2024 16:08:48 +0200 Message-Id: <20240619140849.368580-7-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240619140849.368580-1-ulf.hansson@linaro.org> References: <20240619140849.368580-1-ulf.hansson@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Through dev_pm_opp_set_config() the _opp_attach_genpd() allows consumer drivers to hook up a device to its PM domains. This works for both a single and multiple PM domains. Their corresponding virtual devices that are created by genpd during attach, are later being assigned as the required_devs for the corresponding required OPPs. In principle this works fine, but there are some problems. Especially as the index for a "required-opps" may not necessarily need to match the index for the "power-domain" in DT, in which case things gets screwed up. To improve the situation, let's instead assign the required_devs during device attach in genpd, by using _opp_set_required_dev(). At this point the genpd and the genpd's OPP table are known for the device in question, which then can be used to find the correct index for the required-dev. As a part of this change, genpd also starts to assign the required_devs even for the single PM domain case, as a way to align the behaviour. Furthermore, to maintain the existing behaviour for consumers of _opp_attach_genpd(), let's adapt it to the new genpd behaviour. Signed-off-by: Ulf Hansson --- drivers/opp/core.c | 45 +-------------------------------- drivers/pmdomain/core.c | 55 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 44 deletions(-) diff --git a/drivers/opp/core.c b/drivers/opp/core.c index bc1ed1d3d60d..7e567b479c3d 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -2369,7 +2369,6 @@ static void _opp_detach_genpd(struct opp_table *opp_t= able) continue; =20 dev_pm_domain_detach(opp_table->required_devs[index], false); - opp_table->required_devs[index] =3D NULL; } } =20 @@ -2393,8 +2392,7 @@ static void _opp_detach_genpd(struct opp_table *opp_t= able) static int _opp_attach_genpd(struct opp_table *opp_table, struct device *d= ev, const char * const *names, struct device ***virt_devs) { - struct device *virt_dev, *gdev; - struct opp_table *genpd_table; + struct device *virt_dev; int index =3D 0, ret =3D -EINVAL; const char * const *name =3D names; =20 @@ -2427,47 +2425,6 @@ static int _opp_attach_genpd(struct opp_table *opp_t= able, struct device *dev, goto err; } =20 - /* - * The required_opp_tables parsing is not perfect, as the OPP - * core does the parsing solely based on the DT node pointers. - * The core sets the required_opp_tables entry to the first OPP - * table in the "opp_tables" list, that matches with the node - * pointer. - * - * If the target DT OPP table is used by multiple devices and - * they all create separate instances of 'struct opp_table' from - * it, then it is possible that the required_opp_tables entry - * may be set to the incorrect sibling device. - * - * Cross check it again and fix if required. - */ - gdev =3D dev_to_genpd_dev(virt_dev); - if (IS_ERR(gdev)) - return PTR_ERR(gdev); - - genpd_table =3D _find_opp_table(gdev); - if (!IS_ERR(genpd_table)) { - if (genpd_table !=3D opp_table->required_opp_tables[index]) { - dev_pm_opp_put_opp_table(opp_table->required_opp_tables[index]); - opp_table->required_opp_tables[index] =3D genpd_table; - } else { - dev_pm_opp_put_opp_table(genpd_table); - } - } - - /* - * Add the virtual genpd device as a user of the OPP table, so - * we can call dev_pm_opp_set_opp() on it directly. - * - * This will be automatically removed when the OPP table is - * removed, don't need to handle that here. - */ - if (!_add_opp_dev(virt_dev, opp_table->required_opp_tables[index])) { - ret =3D -ENOMEM; - goto err; - } - - opp_table->required_devs[index] =3D virt_dev; index++; name++; } diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c index 74ebb8a423be..a38d08862a61 100644 --- a/drivers/pmdomain/core.c +++ b/drivers/pmdomain/core.c @@ -2774,6 +2774,57 @@ static void genpd_dev_pm_sync(struct device *dev) genpd_queue_power_off_work(pd); } =20 +static struct opp_table *genpd_find_opp_table(struct generic_pm_domain *ge= npd, + unsigned int depth) +{ + struct opp_table *opp_table; + struct gpd_link *link; + + if (genpd->opp_table) + return genpd->opp_table; + + list_for_each_entry(link, &genpd->child_links, child_node) { + struct generic_pm_domain *parent =3D link->parent; + + genpd_lock_nested(parent, depth + 1); + opp_table =3D genpd_find_opp_table(parent, depth + 1); + genpd_unlock(parent); + + if (opp_table) + return opp_table; + } + + return NULL; +} + +static int genpd_set_required_opp_dev(struct device *dev, + struct device *base_dev) +{ + struct generic_pm_domain *genpd =3D dev_to_genpd(dev); + struct opp_table *opp_table; + int ret =3D 0; + + if (!dev_pm_opp_of_has_required_opp(base_dev)) + return 0; + + genpd_lock(genpd); + opp_table =3D genpd_find_opp_table(genpd, 0); + genpd_unlock(genpd); + + if (opp_table) { + struct dev_pm_opp_config config =3D { + .required_dev =3D dev, + .required_opp_table =3D opp_table, + }; + + ret =3D devm_pm_opp_set_config(base_dev, &config); + if (ret < 0) + dev_err(dev, "failed to set opp config %d\n", ret); + } + + return ret; +} + static int genpd_set_required_opp(struct device *dev, unsigned int index) { int ret, pstate; @@ -2830,6 +2881,10 @@ static int __genpd_dev_pm_attach(struct device *dev,= struct device *base_dev, dev->pm_domain->detach =3D genpd_dev_pm_detach; dev->pm_domain->sync =3D genpd_dev_pm_sync; =20 + ret =3D genpd_set_required_opp_dev(dev, base_dev); + if (ret) + goto err; + ret =3D genpd_set_required_opp(dev, index); if (ret) goto err; --=20 2.34.1 From nobody Wed Dec 17 05:45:43 2025 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 920F5153BFC for ; Wed, 19 Jun 2024 14:09:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718806161; cv=none; b=TGiVd+hmCukbK5/oK7PoWUYY/dZKfKeaapkKMA4XTigpz62k4LnnWo3967u/QQRhtXdo3tOwGcghiTQu8PI8sBAMyJbzsuxuFdx7qAL/bbx0jCgHhEB5aHr9PZX5MiU/9vBf8+tERPlEfM/Rsf5lssOYmttx+AdENy1n9cSuFU0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718806161; c=relaxed/simple; bh=tMkKP1j3bPuCq4pIK6nHgDfdOCxrfuXOdv1IXJAZ2JI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MNocW8InXCT2HqiivcHubqnWlRX8389Rgo/cPe35QUNHS7+859haMlvwvYx7W3xcu72JFltb5ofQ10mdh8SNZ+cULQS4AGwSzTFg+xogOXzPVzqIPOHfGZADxMCo8JePXJrW9aMxwNYhtmrvc8QvAm3reMBGT3v2MtQjiJ43YwA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=uXlD6olg; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="uXlD6olg" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-52c84a21c62so7187184e87.1 for ; Wed, 19 Jun 2024 07:09:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1718806158; x=1719410958; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8CngIhS3kRulmGpU0Rg5JrWUuRc/630k552QGhg/cDY=; b=uXlD6olgAX1XYnFHcIuNNjtrSHiXI4DaZY3yL2t5QT2XfkplFCnxbZdJTviVhc39fR 3K9D01pwUPEg28oXcKRIjlNSrZK1yk9a5kaMp2BhqMV8SgPN7OIdzAdwC8uY0PLBK3wh 5+HcyOU+scfZ7ICiiqPrrOiIl0jnd3c9eT5uFm9NwBZasV3zdQEWlP/1Ox/PUsxH/b4l Obso2qXO+lpG1WymmtK4ktMsg6iVtpdKh1gVh6S7rpsae5dovkiark6HMxNSXvKwJKu2 wMq45yGBQxehJ2KV3pxHmG35I3OOsIFf219XluuRanpdLwi7FnGV40N/wC53m8h9aV4p Wlsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718806158; x=1719410958; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8CngIhS3kRulmGpU0Rg5JrWUuRc/630k552QGhg/cDY=; b=W1sJ7GTBdTsWV8VFJ28vW08AMhfEE+B11+U+3QRkBDhJ0YKVLgmeADr00snut4VQpZ ryj1m7bYvaCYYGIt2vM1nPFJ1AhLD9YsRsvDU51kbQWRG8bhZ+NllPsD7gXohmjhen1r t+Y/kMVXusFKcicmceXHcUaRztPiD7w/N5UwfIVrTgGldmxUjJxxbPnJJHn/TsYqxRMV fjXZmifrKrwijZQaDFDrWxoTO/IBilm4v1b5K8A2+NwMwf6lB7IB367bv0zH6RSHmhZa L41711XJeusgpMVAD4YHv+jlySR5gTszXYwBTaomcxG3JqwemswwAHHxFCZG/zMFb/A5 6FrQ== X-Forwarded-Encrypted: i=1; AJvYcCWgLdNeRHHahAPcU+uOgOC1vmlCxYUX527+dKK7mGOC+aOK7oWy3duydqSwIIpBoby4EBeMAS0qgQ9WsJVJa4Y3RiBj3KIQ+75BEgaw X-Gm-Message-State: AOJu0YyleepcOolflIARlozQmsUHafzz0zLEsW3tR1tiy6OKT3AAvuhW PfrFC9XixboORP0DBd93+8j/6WDHW8NZBAAFeiXUMPnk5DLNjU3WrGDQL/vPbR0= X-Google-Smtp-Source: AGHT+IGtMjaVRxqwME3U7CGrSptN6JfejN8F/ypK0frJbXiy1thTIGiCDNeAXU2vN4DLOqXBQiFdNw== X-Received: by 2002:a05:6512:3ca1:b0:52c:8b03:99d6 with SMTP id 2adb3069b0e04-52ccaa585e9mr2256803e87.6.1718806157835; Wed, 19 Jun 2024 07:09:17 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52ca2872241sm1787003e87.124.2024.06.19.07.09.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 19 Jun 2024 07:09:17 -0700 (PDT) From: Ulf Hansson To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: Bjorn Andersson , Konrad Dybcio , Nikunj Kela , Prasad Sodagudi , Thierry Reding , Jonathan Hunter , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 7/7] pmdomain: core: Drop the redundant dev_to_genpd_dev() Date: Wed, 19 Jun 2024 16:08:49 +0200 Message-Id: <20240619140849.368580-8-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240619140849.368580-1-ulf.hansson@linaro.org> References: <20240619140849.368580-1-ulf.hansson@linaro.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" There's no longer any users of dev_to_genpd_dev(), hence let's drop it. Signed-off-by: Ulf Hansson --- drivers/pmdomain/core.c | 10 ---------- include/linux/pm_domain.h | 6 ------ 2 files changed, 16 deletions(-) diff --git a/drivers/pmdomain/core.c b/drivers/pmdomain/core.c index a38d08862a61..4abedbb65354 100644 --- a/drivers/pmdomain/core.c +++ b/drivers/pmdomain/core.c @@ -184,16 +184,6 @@ static struct generic_pm_domain *dev_to_genpd(struct d= evice *dev) return pd_to_genpd(dev->pm_domain); } =20 -struct device *dev_to_genpd_dev(struct device *dev) -{ - struct generic_pm_domain *genpd =3D dev_to_genpd(dev); - - if (IS_ERR(genpd)) - return ERR_CAST(genpd); - - return &genpd->dev; -} - static int genpd_stop_dev(const struct generic_pm_domain *genpd, struct device *dev) { diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h index f24546a3d3db..772d3280d35f 100644 --- a/include/linux/pm_domain.h +++ b/include/linux/pm_domain.h @@ -260,7 +260,6 @@ int pm_genpd_remove_subdomain(struct generic_pm_domain = *genpd, int pm_genpd_init(struct generic_pm_domain *genpd, struct dev_power_governor *gov, bool is_off); int pm_genpd_remove(struct generic_pm_domain *genpd); -struct device *dev_to_genpd_dev(struct device *dev); int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int st= ate); int dev_pm_genpd_add_notifier(struct device *dev, struct notifier_block *n= b); int dev_pm_genpd_remove_notifier(struct device *dev); @@ -308,11 +307,6 @@ static inline int pm_genpd_remove(struct generic_pm_do= main *genpd) return -EOPNOTSUPP; } =20 -static inline struct device *dev_to_genpd_dev(struct device *dev) -{ - return ERR_PTR(-EOPNOTSUPP); -} - static inline int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state) { --=20 2.34.1