Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp603015pxb; Thu, 30 Sep 2021 12:52:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcyOe0WStgyBCxjKi/VYlhVs/G9ydkUvczuS3Ai44sgNWBRZWKaYrq0U3HpJED/qFu/efN X-Received: by 2002:a17:906:280f:: with SMTP id r15mr1180253ejc.559.1633031530240; Thu, 30 Sep 2021 12:52:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633031530; cv=none; d=google.com; s=arc-20160816; b=BdKA5F6Kyb8yOHIT3ade7So5hVC1O2z7KWEZ3uszODFi6ebAHSuhY1NG0EsmhNl7DF E3IBP4y0urn8bkwfk9OhDDJ2bZVNYIwTyLe5ReTfFsIDkVv4es4amBGu+u9s8Q58iHoF 0tGfL4EUfXVi5wwqM9nlwVzfZXhup7DbQxxLReTA+esAFRgVuYLy4RletAL25CyxIUQe DMz/UADVEtCTBQLfz8f6RM/U4jSqu3hrCn/bGOs986LZyOiUZ0c4LxWrQu0QsyWcbnot AujoRrbXBbl4jQeFa9cFxFy179s1ZOzX1D6yWRHN820WDz6/QIyZN1YZ6Bcfybj7+LUy YxmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Y3dpOnDXlgJcFTCuS+F/+JL7imW1C4nTJ31Epoj0e+I=; b=whpkADI/w5YfJCxZ61U87ZQc27iTgGwYq7E41yYBF/0K6kNjH4gYvjuGjdFTFqNc7I JD1HZ9iz58ANsEsx4nZuM0DS5wT7ijIXTSjHmLpDI4U/y7/qqbEYYDgvDG2LRvFD5w7I RERjpXzyDkp0IfmUQBFOYvBKiRVKlGpZNPxMZG+iAe/LezhDif/mlqEp6/NR74ausbzs aL8vWAAWrsZbYToA9wckYn/obrZOr1Qyd0gwWYl1OugUP4wSw/egggylQXGh1/CuhL2H kEx6Hto4WIPsEBiiSGE7u608yPjHwZfrwv6HsTffCxQKB6TJ6L8MACZS+pyZzmX4NCns A1Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=bwAS4qXy; 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 u4si5591093ejt.53.2021.09.30.12.51.38; Thu, 30 Sep 2021 12:52:10 -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=bwAS4qXy; 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 S235171AbhI3TOh (ORCPT + 99 others); Thu, 30 Sep 2021 15:14:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46492 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229652AbhI3TOh (ORCPT ); Thu, 30 Sep 2021 15:14:37 -0400 Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D7F63C06176A for ; Thu, 30 Sep 2021 12:12:53 -0700 (PDT) Received: by mail-wm1-x334.google.com with SMTP id i6-20020a1c3b06000000b0030d05169e9bso7110182wma.4 for ; Thu, 30 Sep 2021 12:12:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Y3dpOnDXlgJcFTCuS+F/+JL7imW1C4nTJ31Epoj0e+I=; b=bwAS4qXyVy5lrCFNe3bp3qWlLe4NhL1c36wauGEWB6DyD18i4Ss7dObFv4YdMqDGZW skhpVHNiYGzPXclorFKhF9zPBjfhDnzW/qpNsANXsPMKKYLxc/XviSoH+sJAiBkMzdgI wKEx5UKAxPCIL8hdltmLbcOlHDNP+AQ4PpzueOtP9j4vx22We2l03/wwpCea8a9o0T2V FYwNPUkk8C7WfQan6eDbF8HI4PDVuZ33RSefMmtiPDFQFj+l6izgK1Uz42X2AnQ0QTli O0xEhuaqx4DgcH5xDKKHJE/F5qeaUOit6yCZTajclWlYqEC+pG3Tr1nZweP/b/RMnrEw 1vWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=Y3dpOnDXlgJcFTCuS+F/+JL7imW1C4nTJ31Epoj0e+I=; b=Zjrg2pMF2o6FgNZcc8nERqvoBxB0aShuOfjnvczL+o/Ca072HR9azm3ejjscn/N1L1 QZUX3/5juaOjD15kXwO1R1ClOtvUHa28GkKOXccCKpT8AWpSJ38lgSNamqCwinzal/mw KvnnTeXel4S3MmqrBNVuqAyOhsOTdlD/edLtUenSw3ZyTUNzqWAcCCqED5C/Alh7C93E I+OQpgvp4MaZzwo6vu5XFZchAHzKF6mtOYWJMP5MnPVP1aSmRAX/W0tLtQYgmL+YQojc EPS3HZv/yeUIvEjg2EEPcmpzx4ZAsIEoP7coT82bkNZBpS3dsPpUfkc7W8aQRShtN8eB MAaA== X-Gm-Message-State: AOAM533dt7S1zhZkNo0InosXqFvpDjKckgepEsvf46xgcd7PgXL5gZNR 6I7cRXBVpRaLCyQHt8wW2bzb+g== X-Received: by 2002:a05:600c:3506:: with SMTP id h6mr782894wmq.62.1633029172329; Thu, 30 Sep 2021 12:12:52 -0700 (PDT) Received: from blmsp.lan ([2a02:2454:3e6:c900::97e]) by smtp.gmail.com with ESMTPSA id l11sm4813809wms.45.2021.09.30.12.12.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Sep 2021 12:12:52 -0700 (PDT) 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, Markus Schneider-Pargmann Subject: [PATCH] hwrng: mediatek - Force runtime pm ops for sleep ops Date: Thu, 30 Sep 2021 21:12:42 +0200 Message-Id: <20210930191242.2542315-1-msp@baylibre.com> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 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 --- 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