From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Subject: Re: [PATCH] ALSA: pcm: constify action_ops structures Date: Mon, 30 Nov 2015 11:39:56 +0100 Message-ID: References: <1448811400-11304-1-git-send-email-Julia.Lawall@lip6.fr> 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 mx2.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 887B8261A03 for ; Mon, 30 Nov 2015 11:39:57 +0100 (CET) In-Reply-To: <1448811400-11304-1-git-send-email-Julia.Lawall@lip6.fr> 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: Julia Lawall Cc: alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org List-Id: alsa-devel@alsa-project.org On Sun, 29 Nov 2015 16:36:40 +0100, Julia Lawall wrote: > > The action_ops structures are never modified, so declare them as const. > > Done with the help of Coccinelle. > > Signed-off-by: Julia Lawall Applied, thanks. Takashi > > --- > sound/core/pcm_native.c | 26 +++++++++++++------------- > 1 file changed, 13 insertions(+), 13 deletions(-) > > diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c > index a8b27cd..fadd3eb 100644 > --- a/sound/core/pcm_native.c > +++ b/sound/core/pcm_native.c > @@ -875,7 +875,7 @@ struct action_ops { > * Note: the stream state might be changed also on failure > * Note2: call with calling stream lock + link lock > */ > -static int snd_pcm_action_group(struct action_ops *ops, > +static int snd_pcm_action_group(const struct action_ops *ops, > struct snd_pcm_substream *substream, > int state, int do_lock) > { > @@ -932,7 +932,7 @@ static int snd_pcm_action_group(struct action_ops *ops, > /* > * Note: call with stream lock > */ > -static int snd_pcm_action_single(struct action_ops *ops, > +static int snd_pcm_action_single(const struct action_ops *ops, > struct snd_pcm_substream *substream, > int state) > { > @@ -952,7 +952,7 @@ static int snd_pcm_action_single(struct action_ops *ops, > /* > * Note: call with stream lock > */ > -static int snd_pcm_action(struct action_ops *ops, > +static int snd_pcm_action(const struct action_ops *ops, > struct snd_pcm_substream *substream, > int state) > { > @@ -984,7 +984,7 @@ static int snd_pcm_action(struct action_ops *ops, > /* > * Note: don't use any locks before > */ > -static int snd_pcm_action_lock_irq(struct action_ops *ops, > +static int snd_pcm_action_lock_irq(const struct action_ops *ops, > struct snd_pcm_substream *substream, > int state) > { > @@ -998,7 +998,7 @@ static int snd_pcm_action_lock_irq(struct action_ops *ops, > > /* > */ > -static int snd_pcm_action_nonatomic(struct action_ops *ops, > +static int snd_pcm_action_nonatomic(const struct action_ops *ops, > struct snd_pcm_substream *substream, > int state) > { > @@ -1056,7 +1056,7 @@ static void snd_pcm_post_start(struct snd_pcm_substream *substream, int state) > snd_pcm_timer_notify(substream, SNDRV_TIMER_EVENT_MSTART); > } > > -static struct action_ops snd_pcm_action_start = { > +static const struct action_ops snd_pcm_action_start = { > .pre_action = snd_pcm_pre_start, > .do_action = snd_pcm_do_start, > .undo_action = snd_pcm_undo_start, > @@ -1107,7 +1107,7 @@ static void snd_pcm_post_stop(struct snd_pcm_substream *substream, int state) > wake_up(&runtime->tsleep); > } > > -static struct action_ops snd_pcm_action_stop = { > +static const struct action_ops snd_pcm_action_stop = { > .pre_action = snd_pcm_pre_stop, > .do_action = snd_pcm_do_stop, > .post_action = snd_pcm_post_stop > @@ -1224,7 +1224,7 @@ static void snd_pcm_post_pause(struct snd_pcm_substream *substream, int push) > } > } > > -static struct action_ops snd_pcm_action_pause = { > +static const struct action_ops snd_pcm_action_pause = { > .pre_action = snd_pcm_pre_pause, > .do_action = snd_pcm_do_pause, > .undo_action = snd_pcm_undo_pause, > @@ -1273,7 +1273,7 @@ static void snd_pcm_post_suspend(struct snd_pcm_substream *substream, int state) > wake_up(&runtime->tsleep); > } > > -static struct action_ops snd_pcm_action_suspend = { > +static const struct action_ops snd_pcm_action_suspend = { > .pre_action = snd_pcm_pre_suspend, > .do_action = snd_pcm_do_suspend, > .post_action = snd_pcm_post_suspend > @@ -1375,7 +1375,7 @@ static void snd_pcm_post_resume(struct snd_pcm_substream *substream, int state) > snd_pcm_timer_notify(substream, SNDRV_TIMER_EVENT_MRESUME); > } > > -static struct action_ops snd_pcm_action_resume = { > +static const struct action_ops snd_pcm_action_resume = { > .pre_action = snd_pcm_pre_resume, > .do_action = snd_pcm_do_resume, > .undo_action = snd_pcm_undo_resume, > @@ -1478,7 +1478,7 @@ static void snd_pcm_post_reset(struct snd_pcm_substream *substream, int state) > snd_pcm_playback_silence(substream, ULONG_MAX); > } > > -static struct action_ops snd_pcm_action_reset = { > +static const struct action_ops snd_pcm_action_reset = { > .pre_action = snd_pcm_pre_reset, > .do_action = snd_pcm_do_reset, > .post_action = snd_pcm_post_reset > @@ -1522,7 +1522,7 @@ static void snd_pcm_post_prepare(struct snd_pcm_substream *substream, int state) > snd_pcm_set_state(substream, SNDRV_PCM_STATE_PREPARED); > } > > -static struct action_ops snd_pcm_action_prepare = { > +static const struct action_ops snd_pcm_action_prepare = { > .pre_action = snd_pcm_pre_prepare, > .do_action = snd_pcm_do_prepare, > .post_action = snd_pcm_post_prepare > @@ -1618,7 +1618,7 @@ static void snd_pcm_post_drain_init(struct snd_pcm_substream *substream, int sta > { > } > > -static struct action_ops snd_pcm_action_drain_init = { > +static const struct action_ops snd_pcm_action_drain_init = { > .pre_action = snd_pcm_pre_drain_init, > .do_action = snd_pcm_do_drain_init, > .post_action = snd_pcm_post_drain_init > > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Takashi Iwai Date: Mon, 30 Nov 2015 10:39:56 +0000 Subject: Re: [PATCH] ALSA: pcm: constify action_ops structures Message-Id: List-Id: References: <1448811400-11304-1-git-send-email-Julia.Lawall@lip6.fr> In-Reply-To: <1448811400-11304-1-git-send-email-Julia.Lawall@lip6.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Julia Lawall Cc: alsa-devel@alsa-project.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org On Sun, 29 Nov 2015 16:36:40 +0100, Julia Lawall wrote: > > The action_ops structures are never modified, so declare them as const. > > Done with the help of Coccinelle. > > Signed-off-by: Julia Lawall Applied, thanks. Takashi > > --- > sound/core/pcm_native.c | 26 +++++++++++++------------- > 1 file changed, 13 insertions(+), 13 deletions(-) > > diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c > index a8b27cd..fadd3eb 100644 > --- a/sound/core/pcm_native.c > +++ b/sound/core/pcm_native.c > @@ -875,7 +875,7 @@ struct action_ops { > * Note: the stream state might be changed also on failure > * Note2: call with calling stream lock + link lock > */ > -static int snd_pcm_action_group(struct action_ops *ops, > +static int snd_pcm_action_group(const struct action_ops *ops, > struct snd_pcm_substream *substream, > int state, int do_lock) > { > @@ -932,7 +932,7 @@ static int snd_pcm_action_group(struct action_ops *ops, > /* > * Note: call with stream lock > */ > -static int snd_pcm_action_single(struct action_ops *ops, > +static int snd_pcm_action_single(const struct action_ops *ops, > struct snd_pcm_substream *substream, > int state) > { > @@ -952,7 +952,7 @@ static int snd_pcm_action_single(struct action_ops *ops, > /* > * Note: call with stream lock > */ > -static int snd_pcm_action(struct action_ops *ops, > +static int snd_pcm_action(const struct action_ops *ops, > struct snd_pcm_substream *substream, > int state) > { > @@ -984,7 +984,7 @@ static int snd_pcm_action(struct action_ops *ops, > /* > * Note: don't use any locks before > */ > -static int snd_pcm_action_lock_irq(struct action_ops *ops, > +static int snd_pcm_action_lock_irq(const struct action_ops *ops, > struct snd_pcm_substream *substream, > int state) > { > @@ -998,7 +998,7 @@ static int snd_pcm_action_lock_irq(struct action_ops *ops, > > /* > */ > -static int snd_pcm_action_nonatomic(struct action_ops *ops, > +static int snd_pcm_action_nonatomic(const struct action_ops *ops, > struct snd_pcm_substream *substream, > int state) > { > @@ -1056,7 +1056,7 @@ static void snd_pcm_post_start(struct snd_pcm_substream *substream, int state) > snd_pcm_timer_notify(substream, SNDRV_TIMER_EVENT_MSTART); > } > > -static struct action_ops snd_pcm_action_start = { > +static const struct action_ops snd_pcm_action_start = { > .pre_action = snd_pcm_pre_start, > .do_action = snd_pcm_do_start, > .undo_action = snd_pcm_undo_start, > @@ -1107,7 +1107,7 @@ static void snd_pcm_post_stop(struct snd_pcm_substream *substream, int state) > wake_up(&runtime->tsleep); > } > > -static struct action_ops snd_pcm_action_stop = { > +static const struct action_ops snd_pcm_action_stop = { > .pre_action = snd_pcm_pre_stop, > .do_action = snd_pcm_do_stop, > .post_action = snd_pcm_post_stop > @@ -1224,7 +1224,7 @@ static void snd_pcm_post_pause(struct snd_pcm_substream *substream, int push) > } > } > > -static struct action_ops snd_pcm_action_pause = { > +static const struct action_ops snd_pcm_action_pause = { > .pre_action = snd_pcm_pre_pause, > .do_action = snd_pcm_do_pause, > .undo_action = snd_pcm_undo_pause, > @@ -1273,7 +1273,7 @@ static void snd_pcm_post_suspend(struct snd_pcm_substream *substream, int state) > wake_up(&runtime->tsleep); > } > > -static struct action_ops snd_pcm_action_suspend = { > +static const struct action_ops snd_pcm_action_suspend = { > .pre_action = snd_pcm_pre_suspend, > .do_action = snd_pcm_do_suspend, > .post_action = snd_pcm_post_suspend > @@ -1375,7 +1375,7 @@ static void snd_pcm_post_resume(struct snd_pcm_substream *substream, int state) > snd_pcm_timer_notify(substream, SNDRV_TIMER_EVENT_MRESUME); > } > > -static struct action_ops snd_pcm_action_resume = { > +static const struct action_ops snd_pcm_action_resume = { > .pre_action = snd_pcm_pre_resume, > .do_action = snd_pcm_do_resume, > .undo_action = snd_pcm_undo_resume, > @@ -1478,7 +1478,7 @@ static void snd_pcm_post_reset(struct snd_pcm_substream *substream, int state) > snd_pcm_playback_silence(substream, ULONG_MAX); > } > > -static struct action_ops snd_pcm_action_reset = { > +static const struct action_ops snd_pcm_action_reset = { > .pre_action = snd_pcm_pre_reset, > .do_action = snd_pcm_do_reset, > .post_action = snd_pcm_post_reset > @@ -1522,7 +1522,7 @@ static void snd_pcm_post_prepare(struct snd_pcm_substream *substream, int state) > snd_pcm_set_state(substream, SNDRV_PCM_STATE_PREPARED); > } > > -static struct action_ops snd_pcm_action_prepare = { > +static const struct action_ops snd_pcm_action_prepare = { > .pre_action = snd_pcm_pre_prepare, > .do_action = snd_pcm_do_prepare, > .post_action = snd_pcm_post_prepare > @@ -1618,7 +1618,7 @@ static void snd_pcm_post_drain_init(struct snd_pcm_substream *substream, int sta > { > } > > -static struct action_ops snd_pcm_action_drain_init = { > +static const struct action_ops snd_pcm_action_drain_init = { > .pre_action = snd_pcm_pre_drain_init, > .do_action = snd_pcm_do_drain_init, > .post_action = snd_pcm_post_drain_init > > From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753683AbbK3KkD (ORCPT ); Mon, 30 Nov 2015 05:40:03 -0500 Received: from mx2.suse.de ([195.135.220.15]:43957 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753421AbbK3Kj6 (ORCPT ); Mon, 30 Nov 2015 05:39:58 -0500 Date: Mon, 30 Nov 2015 11:39:56 +0100 Message-ID: From: Takashi Iwai To: "Julia Lawall" Cc: "Jaroslav Kysela" , , , Subject: Re: [PATCH] ALSA: pcm: constify action_ops structures In-Reply-To: <1448811400-11304-1-git-send-email-Julia.Lawall@lip6.fr> References: <1448811400-11304-1-git-send-email-Julia.Lawall@lip6.fr> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.5 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 29 Nov 2015 16:36:40 +0100, Julia Lawall wrote: > > The action_ops structures are never modified, so declare them as const. > > Done with the help of Coccinelle. > > Signed-off-by: Julia Lawall Applied, thanks. Takashi > > --- > sound/core/pcm_native.c | 26 +++++++++++++------------- > 1 file changed, 13 insertions(+), 13 deletions(-) > > diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c > index a8b27cd..fadd3eb 100644 > --- a/sound/core/pcm_native.c > +++ b/sound/core/pcm_native.c > @@ -875,7 +875,7 @@ struct action_ops { > * Note: the stream state might be changed also on failure > * Note2: call with calling stream lock + link lock > */ > -static int snd_pcm_action_group(struct action_ops *ops, > +static int snd_pcm_action_group(const struct action_ops *ops, > struct snd_pcm_substream *substream, > int state, int do_lock) > { > @@ -932,7 +932,7 @@ static int snd_pcm_action_group(struct action_ops *ops, > /* > * Note: call with stream lock > */ > -static int snd_pcm_action_single(struct action_ops *ops, > +static int snd_pcm_action_single(const struct action_ops *ops, > struct snd_pcm_substream *substream, > int state) > { > @@ -952,7 +952,7 @@ static int snd_pcm_action_single(struct action_ops *ops, > /* > * Note: call with stream lock > */ > -static int snd_pcm_action(struct action_ops *ops, > +static int snd_pcm_action(const struct action_ops *ops, > struct snd_pcm_substream *substream, > int state) > { > @@ -984,7 +984,7 @@ static int snd_pcm_action(struct action_ops *ops, > /* > * Note: don't use any locks before > */ > -static int snd_pcm_action_lock_irq(struct action_ops *ops, > +static int snd_pcm_action_lock_irq(const struct action_ops *ops, > struct snd_pcm_substream *substream, > int state) > { > @@ -998,7 +998,7 @@ static int snd_pcm_action_lock_irq(struct action_ops *ops, > > /* > */ > -static int snd_pcm_action_nonatomic(struct action_ops *ops, > +static int snd_pcm_action_nonatomic(const struct action_ops *ops, > struct snd_pcm_substream *substream, > int state) > { > @@ -1056,7 +1056,7 @@ static void snd_pcm_post_start(struct snd_pcm_substream *substream, int state) > snd_pcm_timer_notify(substream, SNDRV_TIMER_EVENT_MSTART); > } > > -static struct action_ops snd_pcm_action_start = { > +static const struct action_ops snd_pcm_action_start = { > .pre_action = snd_pcm_pre_start, > .do_action = snd_pcm_do_start, > .undo_action = snd_pcm_undo_start, > @@ -1107,7 +1107,7 @@ static void snd_pcm_post_stop(struct snd_pcm_substream *substream, int state) > wake_up(&runtime->tsleep); > } > > -static struct action_ops snd_pcm_action_stop = { > +static const struct action_ops snd_pcm_action_stop = { > .pre_action = snd_pcm_pre_stop, > .do_action = snd_pcm_do_stop, > .post_action = snd_pcm_post_stop > @@ -1224,7 +1224,7 @@ static void snd_pcm_post_pause(struct snd_pcm_substream *substream, int push) > } > } > > -static struct action_ops snd_pcm_action_pause = { > +static const struct action_ops snd_pcm_action_pause = { > .pre_action = snd_pcm_pre_pause, > .do_action = snd_pcm_do_pause, > .undo_action = snd_pcm_undo_pause, > @@ -1273,7 +1273,7 @@ static void snd_pcm_post_suspend(struct snd_pcm_substream *substream, int state) > wake_up(&runtime->tsleep); > } > > -static struct action_ops snd_pcm_action_suspend = { > +static const struct action_ops snd_pcm_action_suspend = { > .pre_action = snd_pcm_pre_suspend, > .do_action = snd_pcm_do_suspend, > .post_action = snd_pcm_post_suspend > @@ -1375,7 +1375,7 @@ static void snd_pcm_post_resume(struct snd_pcm_substream *substream, int state) > snd_pcm_timer_notify(substream, SNDRV_TIMER_EVENT_MRESUME); > } > > -static struct action_ops snd_pcm_action_resume = { > +static const struct action_ops snd_pcm_action_resume = { > .pre_action = snd_pcm_pre_resume, > .do_action = snd_pcm_do_resume, > .undo_action = snd_pcm_undo_resume, > @@ -1478,7 +1478,7 @@ static void snd_pcm_post_reset(struct snd_pcm_substream *substream, int state) > snd_pcm_playback_silence(substream, ULONG_MAX); > } > > -static struct action_ops snd_pcm_action_reset = { > +static const struct action_ops snd_pcm_action_reset = { > .pre_action = snd_pcm_pre_reset, > .do_action = snd_pcm_do_reset, > .post_action = snd_pcm_post_reset > @@ -1522,7 +1522,7 @@ static void snd_pcm_post_prepare(struct snd_pcm_substream *substream, int state) > snd_pcm_set_state(substream, SNDRV_PCM_STATE_PREPARED); > } > > -static struct action_ops snd_pcm_action_prepare = { > +static const struct action_ops snd_pcm_action_prepare = { > .pre_action = snd_pcm_pre_prepare, > .do_action = snd_pcm_do_prepare, > .post_action = snd_pcm_post_prepare > @@ -1618,7 +1618,7 @@ static void snd_pcm_post_drain_init(struct snd_pcm_substream *substream, int sta > { > } > > -static struct action_ops snd_pcm_action_drain_init = { > +static const struct action_ops snd_pcm_action_drain_init = { > .pre_action = snd_pcm_pre_drain_init, > .do_action = snd_pcm_do_drain_init, > .post_action = snd_pcm_post_drain_init > >