Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp611247pxb; Thu, 30 Sep 2021 13:04:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx0sMZhdH0FloTOYlBKt5IcQfe9UI5fgjnNRw2LSUjU2anyhhbkZaJShBUof7bTOBw85o6N X-Received: by 2002:a50:becb:: with SMTP id e11mr9620041edk.161.1633032284476; Thu, 30 Sep 2021 13:04:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633032284; cv=none; d=google.com; s=arc-20160816; b=qCUstkR0ZWxDO3j7g827Gjczczx2qROPAh/+fTGR1hh7nUcEb2HGLSCNegFl8J+Emt w+0aCeppLIlKQMGIbDDdNT+Qw4wS/6mkjQbTigvZhtlST4M96gtRptbjEcJ4eCMEdWSi Nhy+wIj67Zf8H8wmYgg/x5VOOcJ5x3O8yEzeWwqtiWEdJe7Rx7sVvo4sGdMDFkZ6GgRQ 4SiBHDokRP1IQuI3bGh1PVGOerOrmBUiED7LrjZDpSJrufm0a2Kqx+DSQR5N6V6x4rYg pRdKe5JrIMwg7sVJwGAtQLXzZA4w0CiOMNt4Zw0H1KPLBhzExKW4UIEAkwR42LWUg5MW 4/3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Hx/tBsdkeGhZxG52QWJPz9Kz/HAe/yuuGxlrpK5+Bs0=; b=GDl7HvS0160urynuf5N1EikAl5GNsi2xWoGKMZkCwY9o4Sc64/nSMhe8r+xt9cjpPb 7TukaTqHJEHMz8a87JPUCKeCWKWu+31VKChwYzxM1IDzf2pdBDD90IeEI0BGZg75ZsCf vgvBhnPxD6b2wZose4ibInX9Vq1f88aLKM4v0KN/LIEt7AOKbgGhNeuTOLbcQAPVFbFJ wunZLS2JmbO8W2H/aRL8AZNZktyHyhhVvE5eHdfrRgEwnf9cO8RfaZFueZFlKWFaoyt5 kD2Vrod47LUs7L8kKP88EM8i4mj5aGe4yqdUL1tWPa07uRvJxRnPWH/NfhtvbRaL/5MK aa8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=pGEwkWuK; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n1si4641735edf.201.2021.09.30.13.04.12; Thu, 30 Sep 2021 13:04:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=pGEwkWuK; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344889AbhI3Tmo (ORCPT + 99 others); Thu, 30 Sep 2021 15:42:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345855AbhI3Tmo (ORCPT ); Thu, 30 Sep 2021 15:42:44 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D3388C06176A for ; Thu, 30 Sep 2021 12:41:00 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id q2so2000624wrc.4 for ; Thu, 30 Sep 2021 12:41:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Hx/tBsdkeGhZxG52QWJPz9Kz/HAe/yuuGxlrpK5+Bs0=; b=pGEwkWuKW4obTzm9tbCH+Qhm6GafqSky9gPfAPfj9/ZynrhBmRHqkwF+H9EGA74sZ+ e65f5loIGlF2z9PQbnab4xRbb3yDQJ/km66crhkHwhTxN1awrIBZNo3u0ERqhPwovU9V kwegr6/GU7a9cg+KQ7u51n6TXjbYmROF3vCM4TlVy6iwZ60hnen/i7qJMO9rDoaz9kuJ TVZulsdDjJ+zcSoGoLkBHB6sLJrs862Qc2Lg43bki0ztoRX7zWsp7EDGcY5JubxtwWcq SBlIX2ZRI0c8idL5Vi1z3XNjCaSY1JOPkyx4pqHbKKIJJu94y6LGa5TWmR8Wb9mZLGSB MHgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=Hx/tBsdkeGhZxG52QWJPz9Kz/HAe/yuuGxlrpK5+Bs0=; b=rM7CpmSfa34mR9MbX4qo00q4R7ZYuRoSIFYQHNgHhE7SorEMPIsPPcaVTpFbQ2CA7Q MO1P7ywByb7NGKQAjZ3gus9vOg+t0WcL0Rp5Xc7pwGU9dlwP2bwqRP+Syi32oUtVuMuf sUSea+5HOxgoILujJCJxussGl50DvsaEcbK4hzOWFFD7Gw1qzHbUaOY9j6pPYCTt6m+l 1HESXrizkc6gCNEcWUbrihBLu3y3+rUPrQEYn6qf4H+vrpF1k8yFBUACy94OlQKMQqES ATNRmOe+QI8LnCGSGsHxbID8zuhgg9YbcGNF2bmLN7DVY5I5WNejiXTSxtL1+2R9zsXm kfHA== X-Gm-Message-State: AOAM532C/a7RcC5kMkYL4oF5gBAj1hnG+1+cA2tmVAyxePY0MjFtZWYd PuaSkqR39RB84D9H7vzSHGpAhg== X-Received: by 2002:adf:cf10:: with SMTP id o16mr8056065wrj.12.1633030859457; Thu, 30 Sep 2021 12:40:59 -0700 (PDT) Received: from blmsp ([2a02:2454:3e6:c900::97e]) by smtp.gmail.com with ESMTPSA id l124sm5576156wml.8.2021.09.30.12.40.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 12:40:59 -0700 (PDT) Date: Thu, 30 Sep 2021 21:40:58 +0200 From: Markus Schneider-Pargmann To: Sean Wang , Herbert Xu , Matt Mackall Cc: linux-mediatek@lists.infradead.org, linux-crypto@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] hwrng: mediatek - Force runtime pm ops for sleep ops Message-ID: <20210930194058.oe5vlqlelilekdde@blmsp> References: <20210930191242.2542315-1-msp@baylibre.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210930191242.2542315-1-msp@baylibre.com> Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org Hi, On Thu, Sep 30, 2021 at 09:12:42PM +0200, Markus Schneider-Pargmann wrote: > Currently mtk_rng_runtime_suspend/resume is called for both runtime pm > and system sleep operations. > > This is wrong as these should only be runtime ops as the name already > suggests. Currently freezing the system will lead to a call to > mtk_rng_runtime_suspend even if the device currently isn't active. This > leads to a clock warning because it is disabled/unprepared although it > isn't enabled/prepared currently. > > This patch fixes this by only setting the runtime pm ops and forces to > call the runtime pm ops from the system sleep ops as well if active but > not otherwise. > > Signed-off-by: Markus Schneider-Pargmann Fixes: 81d2b34508c6 (hwrng: mtk - add runtime PM support) Sorry, forgot to add this line in the commit message. I can add it for the next version. Best, Markus > --- > drivers/char/hw_random/mtk-rng.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/char/hw_random/mtk-rng.c b/drivers/char/hw_random/mtk-rng.c > index 8ad7b515a51b..6c00ea008555 100644 > --- a/drivers/char/hw_random/mtk-rng.c > +++ b/drivers/char/hw_random/mtk-rng.c > @@ -166,8 +166,13 @@ static int mtk_rng_runtime_resume(struct device *dev) > return mtk_rng_init(&priv->rng); > } > > -static UNIVERSAL_DEV_PM_OPS(mtk_rng_pm_ops, mtk_rng_runtime_suspend, > - mtk_rng_runtime_resume, NULL); > +static const struct dev_pm_ops mtk_rng_pm_ops = { > + SET_RUNTIME_PM_OPS(mtk_rng_runtime_suspend, > + mtk_rng_runtime_resume, NULL) > + SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, > + pm_runtime_force_resume) > +}; > + > #define MTK_RNG_PM_OPS (&mtk_rng_pm_ops) > #else /* CONFIG_PM */ > #define MTK_RNG_PM_OPS NULL > -- > 2.33.0 >