From: Takashi Iwai Subject: Re: [PATCH 14/14] ALSA: pcm: Make snd_pcm_suspend() local static Date: Thu, 17 Jan 2019 08:43:46 +0100 Message-ID: References: <20190115162155.6308-1-tiwai@suse.de> <20190115162155.6308-15-tiwai@suse.de> <96A12704CE18D347B625EE2D4A099D19527B2688@SHSMSX103.ccr.corp.intel.com> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 771602667E7 for ; Thu, 17 Jan 2019 08:43:47 +0100 (CET) In-Reply-To: <96A12704CE18D347B625EE2D4A099D19527B2688@SHSMSX103.ccr.corp.intel.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: "Yang, Libin" Cc: "alsa-devel@alsa-project.org" , "Lin, Mengdong" , Keyon Jie , Pierre-Louis Bossart , "liam.r.girdwood@linux.intel.com" , "broonie@kernel.org" List-Id: alsa-devel@alsa-project.org On Thu, 17 Jan 2019 02:50:21 +0100, Yang, Libin wrote: > > > >-----Original Message----- > >From: Takashi Iwai [mailto:tiwai@suse.de] > >Sent: Wednesday, January 16, 2019 12:22 AM > >To: alsa-devel@alsa-project.org > >Cc: Yang, Libin ; Keyon Jie ; > >liam.r.girdwood@linux.intel.com; Pierre-Louis Bossart >louis.bossart@linux.intel.com>; broonie@kernel.org; Lin, Mengdong > > > >Subject: [PATCH 14/14] ALSA: pcm: Make snd_pcm_suspend() local static > > > >snd_pcm_suspend() is no longer called from outside, so let's make it local > >static. Also drop a superfluous NULL check there. > > > >Signed-off-by: Takashi Iwai > >--- > > include/sound/pcm.h | 5 ----- > > sound/core/pcm_native.c | 11 +++-------- > > 2 files changed, 3 insertions(+), 13 deletions(-) > > > >diff --git a/include/sound/pcm.h b/include/sound/pcm.h index > >04e97564949c..2c30c1ad1b0d 100644 > >--- a/include/sound/pcm.h > >+++ b/include/sound/pcm.h > >@@ -582,13 +582,8 @@ int snd_pcm_stop(struct snd_pcm_substream > >*substream, snd_pcm_state_t status); int snd_pcm_drain_done(struct > >snd_pcm_substream *substream); int snd_pcm_stop_xrun(struct > >snd_pcm_substream *substream); #ifdef CONFIG_PM -int > >snd_pcm_suspend(struct snd_pcm_substream *substream); int > >snd_pcm_suspend_all(struct snd_pcm *pcm); #else -static inline int > >snd_pcm_suspend(struct snd_pcm_substream *substream) -{ > >- return 0; > >-} > > static inline int snd_pcm_suspend_all(struct snd_pcm *pcm) { > > return 0; > >diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index > >818dff1de545..26afb6b0889a 100644 > >--- a/sound/core/pcm_native.c > >+++ b/sound/core/pcm_native.c > >@@ -1460,29 +1460,24 @@ static const struct action_ops > >snd_pcm_action_suspend = { > > .post_action = snd_pcm_post_suspend > > }; > > > >-/** > >+/* > > * snd_pcm_suspend - trigger SUSPEND to all linked streams > > * @substream: the PCM substream > > * > > * After this call, all streams are changed to SUSPENDED state. > > * > >- * Return: Zero if successful (or @substream is %NULL), or a negative error > >- * code. > >+ * Return: Zero if successful, or a negative error code. > > */ > >-int snd_pcm_suspend(struct snd_pcm_substream *substream) > >+static int snd_pcm_suspend(struct snd_pcm_substream *substream) > > If some drivers may use snd_pcm_suspend() later for corner cases, > is it OK to make it be external again? Yes. But it means that you're doing something special and often wrong. We can catch such a case more easily by this action :) thanks, Takashi