mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Julia Lawall <julia.lawall@lip6.fr>
To: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: Clemens Ladisch <clemens@ladisch.de>,
	linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org,
	kernel-janitors@vger.kernel.org, Takashi Iwai <tiwai@suse.com>
Subject: Re: [PATCH] ALSA: bebob: constify snd_bebob_rate_spec structures
Date: Sat, 10 Oct 2015 17:57:59 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.10.1510101755020.2354@hadrien> (raw)
In-Reply-To: <5619308C.7000601@sakamocchi.jp>



On Sun, 11 Oct 2015, Takashi Sakamoto wrote:

> Hi,
>
> On Oct 10 2015 22:39, Julia Lawall wrote:
> > The snd_bebob_rate_spec structure type contains only function pointers.  In
> > all instances of this structure type, the functions are provided statically
> > and are never changed subsequently.  Add a const annotation on all
> > initializations and uses.
> >
> > Done with the help of Coccinelle.
> >
> > Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
> >
> > ---
> >  sound/firewire/bebob/bebob.c           |    2 +-
> >  sound/firewire/bebob/bebob.h           |    2 +-
> >  sound/firewire/bebob/bebob_focusrite.c |    4 ++--
> >  sound/firewire/bebob/bebob_maudio.c    |    4 ++--
> >  sound/firewire/bebob/bebob_pcm.c       |    2 +-
> >  sound/firewire/bebob/bebob_proc.c      |    2 +-
> >  sound/firewire/bebob/bebob_stream.c    |    2 +-
> >  sound/firewire/bebob/bebob_terratec.c  |    2 +-
> >  sound/firewire/bebob/bebob_yamaha.c    |    2 +-
> >  9 files changed, 11 insertions(+), 11 deletions(-)
>
> Thanks. This patch, itself, is OK to me, while I wonder why this patch
> doesn't change the other members like rate and meter.

I only checked for structures that only contain function pointers, and the
other fields contain structures that contain other things.  I could check
whether they can be made const also.

julia

>
>
> Regards
>
> Takashi Sakamoto
>
> > diff --git a/sound/firewire/bebob/bebob_yamaha.c b/sound/firewire/bebob/bebob_yamaha.c
> > index 5810170..2a9ffdb 100644
> > --- a/sound/firewire/bebob/bebob_yamaha.c
> > +++ b/sound/firewire/bebob/bebob_yamaha.c
> > @@ -51,7 +51,7 @@ static struct snd_bebob_clock_spec clock_spec = {
> >  	.types	= clk_src_types,
> >  	.get	= &clk_src_get,
> >  };
> > -static struct snd_bebob_rate_spec rate_spec = {
> > +static const struct snd_bebob_rate_spec rate_spec = {
> >  	.get	= &snd_bebob_stream_get_rate,
> >  	.set	= &snd_bebob_stream_set_rate,
> >  };
> > diff --git a/sound/firewire/bebob/bebob_focusrite.c b/sound/firewire/bebob/bebob_focusrite.c
> > index a1a3949..e62923e 100644
> > --- a/sound/firewire/bebob/bebob_focusrite.c
> > +++ b/sound/firewire/bebob/bebob_focusrite.c
> > @@ -260,7 +260,7 @@ saffire_meter_get(struct snd_bebob *bebob, u32 *buf, unsigned int size)
> >  	return err;
> >  }
> >
> > -static struct snd_bebob_rate_spec saffirepro_both_rate_spec = {
> > +static const struct snd_bebob_rate_spec saffirepro_both_rate_spec = {
> >  	.get	= &saffirepro_both_clk_freq_get,
> >  	.set	= &saffirepro_both_clk_freq_set,
> >  };
> > @@ -287,7 +287,7 @@ struct snd_bebob_spec saffirepro_10_spec = {
> >  	.meter	= NULL
> >  };
> >
> > -static struct snd_bebob_rate_spec saffire_both_rate_spec = {
> > +static const struct snd_bebob_rate_spec saffire_both_rate_spec = {
> >  	.get	= &snd_bebob_stream_get_rate,
> >  	.set	= &snd_bebob_stream_set_rate,
> >  };
> > diff --git a/sound/firewire/bebob/bebob.c b/sound/firewire/bebob/bebob.c
> > index 0ed5e5f..091290d 100644
> > --- a/sound/firewire/bebob/bebob.c
> > +++ b/sound/firewire/bebob/bebob.c
> > @@ -335,7 +335,7 @@ static void bebob_remove(struct fw_unit *unit)
> >  	snd_card_free_when_closed(bebob->card);
> >  }
> >
> > -static struct snd_bebob_rate_spec normal_rate_spec = {
> > +static const struct snd_bebob_rate_spec normal_rate_spec = {
> >  	.get	= &snd_bebob_stream_get_rate,
> >  	.set	= &snd_bebob_stream_set_rate
> >  };
> > diff --git a/sound/firewire/bebob/bebob.h b/sound/firewire/bebob/bebob.h
> > index d3c9d8d..aff9da3 100644
> > --- a/sound/firewire/bebob/bebob.h
> > +++ b/sound/firewire/bebob/bebob.h
> > @@ -71,7 +71,7 @@ struct snd_bebob_meter_spec {
> >  };
> >  struct snd_bebob_spec {
> >  	struct snd_bebob_clock_spec *clock;
> > -	struct snd_bebob_rate_spec *rate;
> > +	const struct snd_bebob_rate_spec *rate;
> >  	struct snd_bebob_meter_spec *meter;
> >  };
> >
> > diff --git a/sound/firewire/bebob/bebob_terratec.c b/sound/firewire/bebob/bebob_terratec.c
> > index 9242e33..470d526 100644
> > --- a/sound/firewire/bebob/bebob_terratec.c
> > +++ b/sound/firewire/bebob/bebob_terratec.c
> > @@ -55,7 +55,7 @@ phase24_series_clk_src_get(struct snd_bebob *bebob, unsigned int *id)
> >  	return 0;
> >  }
> >
> > -static struct snd_bebob_rate_spec phase_series_rate_spec = {
> > +static const struct snd_bebob_rate_spec phase_series_rate_spec = {
> >  	.get	= &snd_bebob_stream_get_rate,
> >  	.set	= &snd_bebob_stream_set_rate,
> >  };
> > diff --git a/sound/firewire/bebob/bebob_pcm.c b/sound/firewire/bebob/bebob_pcm.c
> > index 2fdc1f1..ef224d6 100644
> > --- a/sound/firewire/bebob/bebob_pcm.c
> > +++ b/sound/firewire/bebob/bebob_pcm.c
> > @@ -155,7 +155,7 @@ static int
> >  pcm_open(struct snd_pcm_substream *substream)
> >  {
> >  	struct snd_bebob *bebob = substream->private_data;
> > -	struct snd_bebob_rate_spec *spec = bebob->spec->rate;
> > +	const struct snd_bebob_rate_spec *spec = bebob->spec->rate;
> >  	unsigned int sampling_rate;
> >  	enum snd_bebob_clock_type src;
> >  	int err;
> > diff --git a/sound/firewire/bebob/bebob_stream.c b/sound/firewire/bebob/bebob_stream.c
> > index a2baa47..fc7a66d 100644
> > --- a/sound/firewire/bebob/bebob_stream.c
> > +++ b/sound/firewire/bebob/bebob_stream.c
> > @@ -580,7 +580,7 @@ end:
> >
> >  int snd_bebob_stream_start_duplex(struct snd_bebob *bebob, unsigned int rate)
> >  {
> > -	struct snd_bebob_rate_spec *rate_spec = bebob->spec->rate;
> > +	const struct snd_bebob_rate_spec *rate_spec = bebob->spec->rate;
> >  	struct amdtp_stream *master, *slave;
> >  	enum cip_flags sync_mode;
> >  	unsigned int curr_rate;
> > diff --git a/sound/firewire/bebob/bebob_maudio.c b/sound/firewire/bebob/bebob_maudio.c
> > index 057495d..dc9cd0c 100644
> > --- a/sound/firewire/bebob/bebob_maudio.c
> > +++ b/sound/firewire/bebob/bebob_maudio.c
> > @@ -712,7 +712,7 @@ end:
> >  }
> >
> >  /* for special customized devices */
> > -static struct snd_bebob_rate_spec special_rate_spec = {
> > +static const struct snd_bebob_rate_spec special_rate_spec = {
> >  	.get	= &special_get_rate,
> >  	.set	= &special_set_rate,
> >  };
> > @@ -733,7 +733,7 @@ struct snd_bebob_spec maudio_special_spec = {
> >  };
> >
> >  /* Firewire 410 specification */
> > -static struct snd_bebob_rate_spec usual_rate_spec = {
> > +static const struct snd_bebob_rate_spec usual_rate_spec = {
> >  	.get	= &snd_bebob_stream_get_rate,
> >  	.set	= &snd_bebob_stream_set_rate,
> >  };
> > diff --git a/sound/firewire/bebob/bebob_proc.c b/sound/firewire/bebob/bebob_proc.c
> > index 301cc6a..0f3b2ca 100644
> > --- a/sound/firewire/bebob/bebob_proc.c
> > +++ b/sound/firewire/bebob/bebob_proc.c
> > @@ -138,7 +138,7 @@ proc_read_clock(struct snd_info_entry *entry,
> >  		"SYT-Match",
> >  	};
> >  	struct snd_bebob *bebob = entry->private_data;
> > -	struct snd_bebob_rate_spec *rate_spec = bebob->spec->rate;
> > +	const struct snd_bebob_rate_spec *rate_spec = bebob->spec->rate;
> >  	struct snd_bebob_clock_spec *clk_spec = bebob->spec->clock;
> >  	enum snd_bebob_clock_type src;
> >  	unsigned int rate;
> --
> To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>

  reply	other threads:[~2015-10-10 15:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-10 13:39 Julia Lawall
2015-10-10 15:36 ` Takashi Sakamoto
2015-10-10 15:57   ` Julia Lawall [this message]
2015-10-10 21:24   ` [PATCH v2] " Julia Lawall
2015-10-11  3:41     ` Takashi Sakamoto
2015-10-11  6:08       ` Julia Lawall
2015-10-11  6:10       ` [PATCH v3] ALSA: bebob: constify various snd_bebob structures Julia Lawall
2015-10-11 12:29         ` Takashi Sakamoto
2015-10-11 16:13           ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.10.1510101755020.2354@hadrien \
    --to=julia.lawall@lip6.fr \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=o-takashi@sakamocchi.jp \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®