Skip to contentSkip to conversation

ALSA: constify snd_timer_hardware structures

PATCH New Bhumika Goyal 1 participant 7 messages Jul 28, 2017 Sound

lore
Share & tools
lore
#0 lore raw

cover ALSA: constify snd_timer_hardware structures

Declare snd_timer_hardware structures as const.

Bhumika Goyal (5):
ALSA: sound/core: constify snd_timer_hardware structures
ALSA: isa: constify snd_timer_hardware structures
ALSA: pci: constify snd_timer_hardware structures
ALSA: sparc: constify snd_timer_hardware structure
ALSA: opl3: constify snd_timer_hardware structures

 sound/core/hrtimer.c            | 2 +-
 sound/core/pcm_timer.c          | 2 +-
 sound/core/timer.c              | 2 +-
 sound/drivers/opl3/opl3_lib.c   | 4 ++--
 sound/isa/ad1816a/ad1816a_lib.c | 2 +-
 sound/isa/gus/gus_timer.c       | 4 ++--
 sound/isa/wss/wss_lib.c         | 2 +-
 sound/pci/emu10k1/timer.c       | 2 +-
 sound/pci/ymfpci/ymfpci_main.c  | 2 +-
 sound/sparc/cs4231.c            | 2 +-
 10 files changed, 12 insertions(+), 12 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/5 ALSA: sound/core: constify snd_timer_hardware structures

Declare snd_timer_hardware structures as const as their only usage is during a copy operation. As they are not modified anywhere, they can be made const.

---
 sound/core/hrtimer.c   | 2 +-
 sound/core/pcm_timer.c | 2 +-
 sound/core/timer.c     | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
sound/core/hrtimer.c +1 -1
index 1ac0c42..1ba70bc 100644
@@ -127,7 +127,7 @@ static int snd_hrtimer_stop(struct snd_timer *t)
 	return 0;
 }
 
-static struct snd_timer_hardware hrtimer_hw = {
+static const struct snd_timer_hardware hrtimer_hw = {
 	.flags =	SNDRV_TIMER_HW_AUTO | SNDRV_TIMER_HW_TASKLET,
 	.open =		snd_hrtimer_open,
 	.close =	snd_hrtimer_close,
sound/core/pcm_timer.c +1 -1
index 11389f1..3aa2152 100644
@@ -90,7 +90,7 @@ static int snd_pcm_timer_stop(struct snd_timer * timer)
 	return 0;
 }
 
-static struct snd_timer_hardware snd_pcm_timer =
+static const struct snd_timer_hardware snd_pcm_timer =
 {
 	.flags =	SNDRV_TIMER_HW_AUTO | SNDRV_TIMER_HW_SLAVE,
 	.resolution =	0,
sound/core/timer.c +1 -1
index a9b9a27..e156aa8 100644
@@ -1086,7 +1086,7 @@ static int snd_timer_s_close(struct snd_timer *timer)
 	return 0;
 }
 
-static struct snd_timer_hardware snd_timer_system =
+static const struct snd_timer_hardware snd_timer_system =
 {
 	.flags =	SNDRV_TIMER_HW_FIRST | SNDRV_TIMER_HW_TASKLET,
 	.resolution =	1000000000L / HZ,
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/5 ALSA: isa: constify snd_timer_hardware structures

In reply to Bhumika Goyal

Declare snd_timer_hardware structures as const as their only usage is during a copy operation. As they are not modified anywhere, they can be made const.

---
 sound/isa/ad1816a/ad1816a_lib.c | 2 +-
 sound/isa/gus/gus_timer.c       | 4 ++--
 sound/isa/wss/wss_lib.c         | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)
sound/isa/ad1816a/ad1816a_lib.c +1 -1
index 5c815f5..6130fc3 100644
@@ -431,7 +431,7 @@ static int snd_ad1816a_timer_stop(struct snd_timer *timer)
 	return 0;
 }
 
-static struct snd_timer_hardware snd_ad1816a_timer_table = {
+static const struct snd_timer_hardware snd_ad1816a_timer_table = {
 	.flags =	SNDRV_TIMER_HW_AUTO,
 	.resolution =	10000,
 	.ticks =	65535,
sound/isa/gus/gus_timer.c +2 -2
index c537271..8fd0327 100644
@@ -123,7 +123,7 @@ static void snd_gf1_interrupt_timer2(struct snd_gus_card * gus)
 
  */
 
-static struct snd_timer_hardware snd_gf1_timer1 =
+static const struct snd_timer_hardware snd_gf1_timer1 =
 {
 	.flags =	SNDRV_TIMER_HW_STOP,
 	.resolution =	80000,
@@ -132,7 +132,7 @@ static void snd_gf1_interrupt_timer2(struct snd_gus_card * gus)
 	.stop =		snd_gf1_timer1_stop,
 };
 
-static struct snd_timer_hardware snd_gf1_timer2 =
+static const struct snd_timer_hardware snd_gf1_timer2 =
 {
 	.flags =	SNDRV_TIMER_HW_STOP,
 	.resolution =	320000,
sound/isa/wss/wss_lib.c +1 -1
index 9f4e2e3..4016677 100644
@@ -975,7 +975,7 @@ static int snd_wss_timer_close(struct snd_timer *timer)
 	return 0;
 }
 
-static struct snd_timer_hardware snd_wss_timer_table =
+static const struct snd_timer_hardware snd_wss_timer_table =
 {
 	.flags =	SNDRV_TIMER_HW_AUTO,
 	.resolution =	9945,
Signature · 1 line
1.9.1
#3 lore raw

PATCH 3/5 ALSA: pci: constify snd_timer_hardware structures

In reply to Bhumika Goyal

Declare snd_timer_hardware structures as const as their only usage is during a copy operation. As they are not modified anywhere, they can be made const.

---
 sound/pci/emu10k1/timer.c      | 2 +-
 sound/pci/ymfpci/ymfpci_main.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
sound/pci/emu10k1/timer.c +1 -1
index b69a7f8..cf43908 100644
@@ -66,7 +66,7 @@ static int snd_emu10k1_timer_precise_resolution(struct snd_timer *timer,
 	return 0;
 }
 
-static struct snd_timer_hardware snd_emu10k1_timer_hw = {
+static const struct snd_timer_hardware snd_emu10k1_timer_hw = {
 	.flags = SNDRV_TIMER_HW_AUTO,
 	.resolution = 20833, /* 1 sample @ 48KHZ = 20.833...us */
 	.ticks = 1024,
sound/pci/ymfpci/ymfpci_main.c +1 -1
index 1114166..39b1d11 100644
@@ -1938,7 +1938,7 @@ static int snd_ymfpci_timer_precise_resolution(struct snd_timer *timer,
 	return 0;
 }
 
-static struct snd_timer_hardware snd_ymfpci_timer_hw = {
+static const struct snd_timer_hardware snd_ymfpci_timer_hw = {
 	.flags = SNDRV_TIMER_HW_AUTO,
 	.resolution = 10417, /* 1 / 96 kHz = 10.41666...us */
 	.ticks = 0x10000,
Signature · 1 line
1.9.1
#4 lore raw

PATCH 3/5 ALSA: pci: constify snd_timer_hardware structures

In reply to Bhumika Goyal

Declare snd_timer_hardware structures as const as their only usage is during a copy operation. As they are not modified anywhere, they can be made const.

---
 sound/pci/emu10k1/timer.c      | 2 +-
 sound/pci/ymfpci/ymfpci_main.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
sound/pci/emu10k1/timer.c +1 -1
index b69a7f8..cf43908 100644
@@ -66,7 +66,7 @@ static int snd_emu10k1_timer_precise_resolution(struct snd_timer *timer,
 	return 0;
 }
 
-static struct snd_timer_hardware snd_emu10k1_timer_hw = {
+static const struct snd_timer_hardware snd_emu10k1_timer_hw = {
 	.flags = SNDRV_TIMER_HW_AUTO,
 	.resolution = 20833, /* 1 sample @ 48KHZ = 20.833...us */
 	.ticks = 1024,
sound/pci/ymfpci/ymfpci_main.c +1 -1
index 1114166..39b1d11 100644
@@ -1938,7 +1938,7 @@ static int snd_ymfpci_timer_precise_resolution(struct snd_timer *timer,
 	return 0;
 }
 
-static struct snd_timer_hardware snd_ymfpci_timer_hw = {
+static const struct snd_timer_hardware snd_ymfpci_timer_hw = {
 	.flags = SNDRV_TIMER_HW_AUTO,
 	.resolution = 10417, /* 1 / 96 kHz = 10.41666...us */
 	.ticks = 0x10000,
Signature · 1 line
1.9.1
#5 lore raw

PATCH 4/5 ALSA: sparc: constify snd_timer_hardware structure

In reply to Bhumika Goyal

Declare snd_timer_hardware structure as const as it is only used during a copy operation. As it is not modified anywhere, it can be made const.

Cross compiled for sparc architecture.

---
 sound/sparc/cs4231.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/sparc/cs4231.c +1 -1
index 3d7d425..0a97e97 100644
@@ -868,7 +868,7 @@ static int snd_cs4231_timer_close(struct snd_timer *timer)
 	return 0;
 }
 
-static struct snd_timer_hardware snd_cs4231_timer_table = {
+static const struct snd_timer_hardware snd_cs4231_timer_table = {
 	.flags		=	SNDRV_TIMER_HW_AUTO,
 	.resolution	=	9945,
 	.ticks		=	65535,
Signature · 1 line
1.9.1
#6 lore raw

PATCH 5/5 ALSA: opl3: constify snd_timer_hardware structures

In reply to Bhumika Goyal

Declare snd_timer_hardware structures as const as their only usage is during a copy operation. As they are not modified anywhere, they can be made const.

---
 sound/drivers/opl3/opl3_lib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/drivers/opl3/opl3_lib.c +2 -2
index d5e5b46..5259904 100644
@@ -229,7 +229,7 @@ static int snd_opl3_timer2_stop(struct snd_timer * timer)
 
  */
 
-static struct snd_timer_hardware snd_opl3_timer1 =
+static const struct snd_timer_hardware snd_opl3_timer1 =
 {
 	.flags =	SNDRV_TIMER_HW_STOP,
 	.resolution =	80000,
@@ -238,7 +238,7 @@ static int snd_opl3_timer2_stop(struct snd_timer * timer)
 	.stop =		snd_opl3_timer1_stop,
 };
 
-static struct snd_timer_hardware snd_opl3_timer2 =
+static const struct snd_timer_hardware snd_opl3_timer2 =
 {
 	.flags =	SNDRV_TIMER_HW_STOP,
 	.resolution =	320000,
Signature · 1 line
1.9.1