Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp501076pxx; Thu, 29 Oct 2020 07:39:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxAfrEIHvHQsCyLnlPVaZEU8KdxshysHW02hsfgfw5BweNKriWth9Rb5FhPDhUGj94k8AXS X-Received: by 2002:aa7:cc0e:: with SMTP id q14mr4257276edt.326.1603982392265; Thu, 29 Oct 2020 07:39:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603982392; cv=none; d=google.com; s=arc-20160816; b=xBH7Hn5B9v9aRFehO/tPQExD5RZwBnt9YeUX7esL+B1rP+NZdTs1RIW2RGeADeU8W6 v7Y4Y4Vk4/ELtD3erceKTtIFPum6zXDJBj/4wS3thPy5NHVriLzhF5LsQhVwohsvWsrg SlGhnow758kcqacLxHEI27PXGon+3acGQL3Y/jz9T93p8Gs+1D0YItl/q1SqAcYrk3kx /3b2FNw10bhVNqLuz9+R4Wf7c4EsFOXxkmHS/jeJb8h2PQW9ezH+GC4s2DhdQuqZniWn eDAKWNvHmFUqwRwr3kXXuMmx5jmJdTuueRDewUBbh9mX8USDzyhgRm5ghRvCq3cvuzmP yrmQ== 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:date:from:dkim-signature; bh=0Vvgyk1ppIl/T/Eqmf3bzsBqm8UMHTtFA399dLy7jnw=; b=sCVA/iNc8kIGXT0TUvZA+vYR9TEq5Y4//L+60baUZ53xdy1TQ9KKAEDbOKbxLJl7zA s3ZIsUpD0GToD0k+CiAXPGJLgXo25uPI022BT9Cc8upd19AFUAFx9PCScSPZdQj5VH0A wieKIR/Hir2l9c7/uaqEScJvZebyPGgUtckQBicfiYtMSIlmGRoHvpwvrx4f+3E5omF3 4x6je5p2qAlE4ODQch/1yUmVcsRpUejGZ9uQMPRoPA4hrwNWdruz4LtfOzgzdnaA09VP 61SJ4/BNoqyU8CMJLC0aufDm2CajhmNGt1Xhos69c+FgxN7/n6Uhe/aCPpQE5dwMUwPS GUXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=tLPZY9nw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t1si2264063edc.421.2020.10.29.07.39.28; Thu, 29 Oct 2020 07:39:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@gmail.com header.s=20161025 header.b=tLPZY9nw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727674AbgJ2OiA (ORCPT + 99 others); Thu, 29 Oct 2020 10:38:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38276 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726251AbgJ2OiA (ORCPT ); Thu, 29 Oct 2020 10:38:00 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 494EAC0613CF for ; Thu, 29 Oct 2020 07:38:00 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id i7so568146pgh.6 for ; Thu, 29 Oct 2020 07:38:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=0Vvgyk1ppIl/T/Eqmf3bzsBqm8UMHTtFA399dLy7jnw=; b=tLPZY9nwXhcpd/xxtFYpqk6+OT07X0f6Mzrac2gOvCqy5sy+oS5cWATMj8lsHkzwmf YjfcQuuJusTCFNrj9jBIZQWiaZdehlPuE+hW5xLqx+mh1zXzZUGRCMr2NXfeYPdtWgva Rt2Vou75O1jTuhNn6ecWzShtlapwrNobwXIwuSpKO7cMyq0GHug2DcMAHkYa5pRpwitK Ti6pfoZOw8oJnrC0cLip+eisDkW9lX+sUcsYwn3SO0Q3CPqm8AHXS89+qhnc/m8e71Ce Y5ogELfnBPTtAogFMGWVWtpj0BD+1lCAfYadugTEK3GpGG1iuE13GuXBZRThShsLCeOB PJHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=0Vvgyk1ppIl/T/Eqmf3bzsBqm8UMHTtFA399dLy7jnw=; b=pqPguTQxq071u21sCfThT8691iqRZiDtkoahSAvaBTp5f4f31enLMjVPEKFHyEuCzr AqbxigfqrttLdDbgLF1vm9aVfXlDQMa2cEB60Hu86M4rgiurUiRhhMInM+AQ0Ql66nYt epT9xT/KH5v0GgzjfVmDjyd7l8Z4IE+dA8+lvGb69ffW9lsiqz7ZaucEY0WgcxS8BqLo LmgrRshC16EOdXkY9dzF/AffPlvxf5R6dazDgjskBdHipqL/AyWPKbKuYj76PN2i8rs6 v/RfZ+Ltmu2Ov4s8WakQ45o3ixp15q13xLRpFXsf6t1ocYNCld0KMZ8AWaxsfysFEEYd bZCQ== X-Gm-Message-State: AOAM532QemwNgPF3CmfQTTusSypDLBm719iYgQb2zCDiQSqzwzCFcOpr XTe2yhHmnoTsKa0XKb3jwVU= X-Received: by 2002:a62:5213:0:b029:164:97aa:b672 with SMTP id g19-20020a6252130000b029016497aab672mr4448913pfb.15.1603982279695; Thu, 29 Oct 2020 07:37:59 -0700 (PDT) Received: from localhost ([2409:8a28:3c42:6840:9efc:e8ff:fef2:1cdc]) by smtp.gmail.com with ESMTPSA id k9sm3160208pfi.188.2020.10.29.07.37.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Oct 2020 07:37:59 -0700 (PDT) From: Coiby Xu X-Google-Original-From: Coiby Xu Date: Thu, 29 Oct 2020 22:37:33 +0800 To: Takashi Iwai Cc: Jaroslav Kysela , Takashi Iwai , "moderated list:SOUND" , open list Subject: Re: [PATCH 01/25] ALSA: core: pcm: remove unnecessary CONFIG_PM_SLEEP Message-ID: <20201029143733.d53pu2ri5ykqlff2@Rk> References: <20201029074301.226644-1-coiby.xu@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 29, 2020 at 08:48:55AM +0100, Takashi Iwai wrote: >On Thu, 29 Oct 2020 08:42:37 +0100, >Coiby Xu wrote: >> >> SET_SYSTEM_SLEEP_PM_OPS has already took good care of CONFIG_PM_CONFIG. >> >> Signed-off-by: Coiby Xu > >It caused compile warnings. Was it already addressed in general? > It hasn't been addressed in general. Thank you for the reminding! >Or we may use __maybe_unused attribute instead, but it's just a matter >of taste. > I'll add __maybe_unused in v2 since __maybe_unused should be preferred over CONFIG_PM_SLEEP according to Arnd Bergmann [1], > > By and large, drivers handle this by using a CONFIG_PM_SLEEP ifdef. > > > > Unless you can make an extremely convincing argument why not to do > > so here, I'd like you to handle it that way instead. > > [adding linux-pm to Cc] > > The main reason is that everyone gets the #ifdef wrong, I run into > half a dozen new build regressions with linux-next every week on > average, the typical problems being: > > - testing CONFIG_PM_SLEEP instead of CONFIG_PM, leading to an unused > function warning > - testing CONFIG_PM instead of CONFIG_PM_SLEEP, leading to a build > failure > - calling a function outside of the #ifdef only from inside an > otherwise correct #ifdef, again leading to an unused function > warning > - causing a warning inside of the #ifdef but only testing if that > is disabled, leading to a problem if the macro is set (this is > rare these days for CONFIG_PM as that is normally enabled) > > Using __maybe_unused avoids all of the above. [1] https://lore.kernel.org/patchwork/comment/919944/ > >thanks, > >Takashi > >> --- >> sound/core/pcm.c | 2 -- >> 1 file changed, 2 deletions(-) >> >> diff --git a/sound/core/pcm.c b/sound/core/pcm.c >> index be5714f1bb58..5a281ac92958 100644 >> --- a/sound/core/pcm.c >> +++ b/sound/core/pcm.c >> @@ -599,7 +599,6 @@ static const struct attribute_group *pcm_dev_attr_groups[]; >> * PM callbacks: we need to deal only with suspend here, as the resume is >> * triggered either from user-space or the driver's resume callback >> */ >> -#ifdef CONFIG_PM_SLEEP >> static int do_pcm_suspend(struct device *dev) >> { >> struct snd_pcm_str *pstr = container_of(dev, struct snd_pcm_str, dev); >> @@ -608,7 +607,6 @@ static int do_pcm_suspend(struct device *dev) >> snd_pcm_suspend_all(pstr->pcm); >> return 0; >> } >> -#endif >> >> static const struct dev_pm_ops pcm_dev_pm_ops = { >> SET_SYSTEM_SLEEP_PM_OPS(do_pcm_suspend, NULL) >> -- >> 2.28.0 >> -- Best regards, Coiby