Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1279382

[PATCH] ALSA: i2c: constify snd_i2c_ops structures

Path csiph.com!au2pb.net!feeder.erje.net!2.us.feeder.erje.net!border1.nntp.ams1.giganews.com!nntp.giganews.com!eternal-september.org!feeder.eternal-september.org!aioe.org!bofh.it!news.nic.it!robomod
From Julia Lawall <Julia.Lawall@lip6.fr>
Newsgroups linux.kernel
Subject [PATCH] ALSA: i2c: constify snd_i2c_ops structures
Date Sun, 29 Nov 2015 18:40:01 +0100
Message-ID <qAe77-DH-3@gated-at.bofh.it> (permalink)
X-Original-To Jaroslav Kysela <perex@perex.cz>
X-Ironport-Av E=Sophos;i="5.20,360,1444687200"; d="scan'208";a="155514648"
X-Mailer git-send-email 1.9.1
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 57
Organization linux.* mail to news gateway
X-Original-Cc kernel-janitors@vger.kernel.org, Takashi Iwai <tiwai@suse.com>, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org
X-Original-Date Sun, 29 Nov 2015 18:25:24 +0100
X-Original-Message-ID <1448817924-17447-1-git-send-email-Julia.Lawall@lip6.fr>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1279382

Show key headers only | View raw


The snd_i2c_ops structures are never modified, so declare them as const.

Done with the help of Coccinelle.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>

---
 include/sound/i2c.h       |    2 +-
 sound/i2c/i2c.c           |    2 +-
 sound/pci/ice1712/delta.c |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/sound/i2c.h b/include/sound/i2c.h
index d125ff8..835254d 100644
--- a/include/sound/i2c.h
+++ b/include/sound/i2c.h
@@ -66,7 +66,7 @@ struct snd_i2c_bus {
 		struct snd_i2c_bit_ops *bit;
 		void *ops;
 	} hw_ops;		/* lowlevel operations */
-	struct snd_i2c_ops *ops;	/* midlevel operations */
+	const struct snd_i2c_ops *ops;	/* midlevel operations */
 
 	unsigned long private_value;
 	void *private_data;
diff --git a/sound/i2c/i2c.c b/sound/i2c/i2c.c
index 4677037..ef2a9af 100644
--- a/sound/i2c/i2c.c
+++ b/sound/i2c/i2c.c
@@ -39,7 +39,7 @@ static int snd_i2c_bit_readbytes(struct snd_i2c_device *device,
 static int snd_i2c_bit_probeaddr(struct snd_i2c_bus *bus,
 				 unsigned short addr);
 
-static struct snd_i2c_ops snd_i2c_bit_ops = {
+static const struct snd_i2c_ops snd_i2c_bit_ops = {
 	.sendbytes = snd_i2c_bit_sendbytes,
 	.readbytes = snd_i2c_bit_readbytes,
 	.probeaddr = snd_i2c_bit_probeaddr,
diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c
index 496dbd0..3bfdc78 100644
--- a/sound/pci/ice1712/delta.c
+++ b/sound/pci/ice1712/delta.c
@@ -174,7 +174,7 @@ static int ap_cs8427_probeaddr(struct snd_i2c_bus *bus, unsigned short addr)
 	return -ENOENT;
 }
 
-static struct snd_i2c_ops ap_cs8427_i2c_ops = {
+static const struct snd_i2c_ops ap_cs8427_i2c_ops = {
 	.sendbytes = ap_cs8427_sendbytes,
 	.readbytes = ap_cs8427_readbytes,
 	.probeaddr = ap_cs8427_probeaddr,

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] ALSA: i2c: constify snd_i2c_ops structures Julia Lawall <Julia.Lawall@lip6.fr> - 2015-11-29 18:40 +0100
  Re: [PATCH] ALSA: i2c: constify snd_i2c_ops structures Takashi Iwai <tiwai@suse.de> - 2015-11-30 11:50 +0100

csiph-web