From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A95CFC4332F for ; Fri, 4 Nov 2022 14:02:45 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2395A163C; Fri, 4 Nov 2022 15:01:53 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2395A163C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1667570563; bh=efmcWroeuQyRtmDkFtVeu8ScT8EbrzgbnEizz5PylEI=; h=Date:From:Subject:To:References:In-Reply-To:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=AQiBGCdsP8QJklHFBDHu4YJTi9hQlV6jQlBle7j9fyrGEGJLVbg3KvLzEUF86owWu r1Ak8YtguaPVdnxbFYxQnTuTFdrHyfuLdrF+hGP44OuaTTRxQr2q6Nr14HAgwLIboF 0w0H0EcSgMKWioXznSUYF59ZFKEvOiN/H450ECNE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7E944F8047D; Fri, 4 Nov 2022 15:01:32 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 774DEF804AC; Fri, 4 Nov 2022 15:01:30 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 4E09BF80431 for ; Fri, 4 Nov 2022 15:01:23 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4E09BF80431 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YilKUkcO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1667570484; x=1699106484; h=message-id:date:mime-version:from:subject:to:cc: references:in-reply-to:content-transfer-encoding; bh=efmcWroeuQyRtmDkFtVeu8ScT8EbrzgbnEizz5PylEI=; b=YilKUkcOD52bdj+/Qj2+Pswhk7T/GEbbp3cyO8lRVc/7dba7HneEvZAV ELudP+SfMonFvaPLMYK0Vb/o4f+iwEN6vgGmWXuJRDlIs8Z1tKoC1Du7C XlZrOwh47RyjQA7LvbVfjeqJtpOwKoTJ0ltxf5jR74gJx55R9mTg/7hdQ gKkg5M3C4D+By/FQZFqHLRCKGsZXKcVbrTZiDuKtboecFgIdOsRG8ypL+ t9oG4205NLC78dFQg6XvOUJU4cphLlk3hsfAeK+7YF8EJw53co34+Rb/J jJ3br6tgIgruFonOwSgrxzW9v5CvwY1nN0hDXOIwMl5/E+77yZUKckXE4 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10521"; a="293298011" X-IronPort-AV: E=Sophos;i="5.96,137,1665471600"; d="scan'208";a="293298011" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2022 07:01:18 -0700 X-IronPort-AV: E=McAfee;i="6500,9779,10521"; a="668363707" X-IronPort-AV: E=Sophos;i="5.96,137,1665471600"; d="scan'208";a="668363707" Received: from cavargas-mobl.amr.corp.intel.com (HELO [10.212.85.188]) ([10.212.85.188]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Nov 2022 07:01:17 -0700 Message-ID: Date: Fri, 4 Nov 2022 10:00:23 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.2.2 From: Pierre-Louis Bossart Subject: Re: [PATCH 1/3] ASoC: component: Propagate result of suspend and resume callbacks To: Cezary Rojewski , alsa-devel@alsa-project.org, broonie@kernel.org References: <20221104131244.3920179-1-cezary.rojewski@intel.com> <20221104131244.3920179-2-cezary.rojewski@intel.com> Content-Language: en-US In-Reply-To: <20221104131244.3920179-2-cezary.rojewski@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: hdegoede@redhat.com, amadeuszx.slawinski@linux.intel.com, tiwai@suse.com X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" On 11/4/22 09:12, Cezary Rojewski wrote: > From: Amadeusz Sławiński > > Both component->driver->suspend and ->resume() do return an int value > but it isn't propagated to the core later on. Update > snd_soc_component_suspend() and snd_soc_component_resume() so that the > possible errors are not squelched. This looks alright on paper but could break existing solutions. There are a number of cases where an error during suspend is not fatal and you don't want to prevent a system suspend if this is recoverable on resume. See for example the errors on clock-stop for SoundWire, which are squelched on purpose. See also Andy Ross' PR to precisely stop propagating errors in SOF https://github.com/thesofproject/linux/pull/3863 Maybe a less intrusive change would be to add a WARN_ON or something visible to make sure solutions are fixed, and only critical issues can prevent suspend? And in a second step the errors are propagated. > Signed-off-by: Amadeusz Sławiński > Signed-off-by: Cezary Rojewski > --- > include/sound/soc-component.h | 4 ++-- > sound/soc/soc-component.c | 22 ++++++++++++++++------ > 2 files changed, 18 insertions(+), 8 deletions(-) > > diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h > index c26ffb033777..421f0fc4df3e 100644 > --- a/include/sound/soc-component.h > +++ b/include/sound/soc-component.h > @@ -456,8 +456,8 @@ int snd_soc_component_open(struct snd_soc_component *component, > int snd_soc_component_close(struct snd_soc_component *component, > struct snd_pcm_substream *substream, > int rollback); > -void snd_soc_component_suspend(struct snd_soc_component *component); > -void snd_soc_component_resume(struct snd_soc_component *component); > +int snd_soc_component_suspend(struct snd_soc_component *component); > +int snd_soc_component_resume(struct snd_soc_component *component); > int snd_soc_component_is_suspended(struct snd_soc_component *component); > int snd_soc_component_probe(struct snd_soc_component *component); > void snd_soc_component_remove(struct snd_soc_component *component); > diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c > index e12f8244242b..27b862ded846 100644 > --- a/sound/soc/soc-component.c > +++ b/sound/soc/soc-component.c > @@ -318,18 +318,28 @@ int snd_soc_component_close(struct snd_soc_component *component, > return soc_component_ret(component, ret); > } > > -void snd_soc_component_suspend(struct snd_soc_component *component) > +int snd_soc_component_suspend(struct snd_soc_component *component) > { > + int ret = 0; > + > if (component->driver->suspend) > - component->driver->suspend(component); > - component->suspended = 1; > + ret = component->driver->suspend(component); > + if (!ret) > + component->suspended = 1; > + > + return soc_component_ret(component, ret); > } > > -void snd_soc_component_resume(struct snd_soc_component *component) > +int snd_soc_component_resume(struct snd_soc_component *component) > { > + int ret = 0; > + > if (component->driver->resume) > - component->driver->resume(component); > - component->suspended = 0; > + ret = component->driver->resume(component); > + if (!ret) > + component->suspended = 0; > + > + return soc_component_ret(component, ret); > } > > int snd_soc_component_is_suspended(struct snd_soc_component *component)