From patchwork Tue Jun 23 19:53:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 191554 Delivered-To: patch@linaro.org Received: by 2002:a92:1f07:0:0:0:0:0 with SMTP id i7csp2305957ile; Tue, 23 Jun 2020 13:22:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3hsV/WnUaeBSC/BJqW6iMRZe9N/4BWM8iW3WQcvS1dTVpbBN0QAN22GZtAitlDJave4oP X-Received: by 2002:aa7:c38f:: with SMTP id k15mr24444202edq.342.1592943762584; Tue, 23 Jun 2020 13:22:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592943762; cv=none; d=google.com; s=arc-20160816; b=uN57UGEf2uWzPKBQ9ktRJX0t3mQKCYa3VbJtzm3vaXI1ReLjy5CDn44kE2tlxj3o4y jujiVQ+XM5nb+3KCVgHjRlI3AEMmjxW7gSfrZfeVRafhNWhogGYoBhbp6tb3+2AqFI76 f2ZpT0yt6fd4Samd17mVglF42mSr2zZ6cSJLsPpHEJThBYPw+PAwxS+LYet37f36nsHA +2IQeenKmIOwPO0HOxX7yFOiB4h6abY2vTdpaOlf2pjNNYgyOOH+7r5e3+mjIn4iRyi5 7mXQ/7wBsWzxF72zgww6ce1VNFbTSy0oOo9q1bb5SqOLguGrGtO8WJkAMq/99Bh3nqcX veaQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gzpUGqDeSFb8kIkBIhBXdwo85N5VhstJj85Iyrns2as=; b=tGw0AOFbzRgKn0zMe0kNvpa9jqcYOYqXFAUHYao4+PU9iE9YdUC6IrCihSXjrUW2Ay 6+ErtyKZLOmMHGYaPhzUxqf5Uygfu+Wh4TqJvNnMMDJ17Is0EQJrP0UNktNoVISBCN4O kWKYq5EaSs2ur1OG010Q4vr2skfZVBKAubiLkskHYmQFx9P//KOyesFJssJnK1AVLyQj SC4bz3T6PLveFNzCtJivXshN4jSPwjagXgeK5UPhRhqTLKFmLGjX4vte98Pu7vsaGyF4 FIzkajpyGysM8qN/2Wj8rzQDpjxwQrkPvVXbB8h9ZJl4V3gmIgk7XYdizQDhjCky+z2h fFSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=FcG83Iib; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 t25si11765618edq.407.2020.06.23.13.22.42; Tue, 23 Jun 2020 13:22:42 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=@kernel.org header.s=default header.b=FcG83Iib; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390200AbgFWUWk (ORCPT + 15 others); Tue, 23 Jun 2020 16:22:40 -0400 Received: from mail.kernel.org ([198.145.29.99]:40648 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390196AbgFWUWj (ORCPT ); Tue, 23 Jun 2020 16:22:39 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9A2FD2073E; Tue, 23 Jun 2020 20:22:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592943759; bh=w6ZOsNqSph3+zxkDGVwNoJmA44m+dH/qiJLveJ0AUaw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FcG83IibNnNkM9YTOOem0KFENxf0s0Y04ZgzLiCZ8i+GwmI7/g5bxU3l4uCOREJ7x syMZxGhrszLwfDzcxzvMJnqssdux5XBCYTgn5BBqx0mv9ALQqHEWEAhcki4VNBYihJ mtj/eYrwFwBpLJIJVumIYKx3VGEhU/+aG6QO/NRY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Daniel Baluta , Kai Vehmanen , Pierre-Louis Bossart , Ranjani Sridharan , Mark Brown , Sasha Levin Subject: [PATCH 5.4 040/314] ASoC: SOF: Do nothing when DSP PM callbacks are not set Date: Tue, 23 Jun 2020 21:53:55 +0200 Message-Id: <20200623195340.722635988@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200623195338.770401005@linuxfoundation.org> References: <20200623195338.770401005@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Daniel Baluta [ Upstream commit c26fde3b15ed41f5f452f1da727795f787833287 ] This provides a better separation between runtime and PM sleep callbacks. Only do nothing if given runtime flag is set and calback is not set. With the current implementation, if PM sleep callback is set but runtime callback is not set then at runtime resume we reload the firmware even if we do not support runtime resume callback. Signed-off-by: Daniel Baluta Signed-off-by: Kai Vehmanen Reviewed-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Link: https://lore.kernel.org/r/20200515135958.17511-2-kai.vehmanen@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/sof/pm.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.25.1 diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c index 195af259e78e3..128680b09c20b 100644 --- a/sound/soc/sof/pm.c +++ b/sound/soc/sof/pm.c @@ -266,7 +266,10 @@ static int sof_resume(struct device *dev, bool runtime_resume) int ret; /* do nothing if dsp resume callbacks are not set */ - if (!sof_ops(sdev)->resume || !sof_ops(sdev)->runtime_resume) + if (!runtime_resume && !sof_ops(sdev)->resume) + return 0; + + if (runtime_resume && !sof_ops(sdev)->runtime_resume) return 0; /* DSP was never successfully started, nothing to resume */ @@ -346,7 +349,10 @@ static int sof_suspend(struct device *dev, bool runtime_suspend) int ret; /* do nothing if dsp suspend callback is not set */ - if (!sof_ops(sdev)->suspend) + if (!runtime_suspend && !sof_ops(sdev)->suspend) + return 0; + + if (runtime_suspend && !sof_ops(sdev)->runtime_suspend) return 0; if (sdev->fw_state != SOF_FW_BOOT_COMPLETE)