Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ALSA: vx: Constify snd_vx_hardware and snd_vx_ops definitions

Both snd_vx_hardware and snd_vx_ops are only referred without
modification, hence they can be constified gracefully for further
optimizations.

There should be no functional changes by this patch.

Link: https://lore.kernel.org/r/20200103081714.9560-31-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>

+22 -20
+5 -4
include/sound/vx_core.h
··· 147 147 /* ports are defined externally */ 148 148 149 149 /* low-level functions */ 150 - struct snd_vx_hardware *hw; 151 - struct snd_vx_ops *ops; 150 + const struct snd_vx_hardware *hw; 151 + const struct snd_vx_ops *ops; 152 152 153 153 struct mutex lock; 154 154 ··· 193 193 /* 194 194 * constructor 195 195 */ 196 - struct vx_core *snd_vx_create(struct snd_card *card, struct snd_vx_hardware *hw, 197 - struct snd_vx_ops *ops, int extra_size); 196 + struct vx_core *snd_vx_create(struct snd_card *card, 197 + const struct snd_vx_hardware *hw, 198 + const struct snd_vx_ops *ops, int extra_size); 198 199 int snd_vx_setup_firmware(struct vx_core *chip); 199 200 int snd_vx_load_boot_image(struct vx_core *chip, const struct firmware *dsp); 200 201 int snd_vx_dsp_boot(struct vx_core *chip, const struct firmware *dsp);
+3 -2
sound/drivers/vx/vx_core.c
··· 765 765 * 766 766 * return the instance pointer if successful, NULL in error. 767 767 */ 768 - struct vx_core *snd_vx_create(struct snd_card *card, struct snd_vx_hardware *hw, 769 - struct snd_vx_ops *ops, 768 + struct vx_core *snd_vx_create(struct snd_card *card, 769 + const struct snd_vx_hardware *hw, 770 + const struct snd_vx_ops *ops, 770 771 int extra_size) 771 772 { 772 773 struct vx_core *chip;
+6 -6
sound/pci/vx222/vx222.c
··· 62 62 static const DECLARE_TLV_DB_SCALE(db_scale_old_vol, -11350, 50, 0); 63 63 static const DECLARE_TLV_DB_SCALE(db_scale_akm, -7350, 50, 0); 64 64 65 - static struct snd_vx_hardware vx222_old_hw = { 65 + static const struct snd_vx_hardware vx222_old_hw = { 66 66 67 67 .name = "VX222/Old", 68 68 .type = VX_TYPE_BOARD, ··· 74 74 .output_level_db_scale = db_scale_old_vol, 75 75 }; 76 76 77 - static struct snd_vx_hardware vx222_v2_hw = { 77 + static const struct snd_vx_hardware vx222_v2_hw = { 78 78 79 79 .name = "VX222/v2", 80 80 .type = VX_TYPE_V2, ··· 86 86 .output_level_db_scale = db_scale_akm, 87 87 }; 88 88 89 - static struct snd_vx_hardware vx222_mic_hw = { 89 + static const struct snd_vx_hardware vx222_mic_hw = { 90 90 91 91 .name = "VX222/Mic", 92 92 .type = VX_TYPE_MIC, ··· 122 122 123 123 124 124 static int snd_vx222_create(struct snd_card *card, struct pci_dev *pci, 125 - struct snd_vx_hardware *hw, 125 + const struct snd_vx_hardware *hw, 126 126 struct snd_vx222 **rchip) 127 127 { 128 128 struct vx_core *chip; ··· 131 131 static const struct snd_device_ops ops = { 132 132 .dev_free = snd_vx222_dev_free, 133 133 }; 134 - struct snd_vx_ops *vx_ops; 134 + const struct snd_vx_ops *vx_ops; 135 135 136 136 /* enable PCI device */ 137 137 if ((err = pci_enable_device(pci)) < 0) ··· 180 180 { 181 181 static int dev; 182 182 struct snd_card *card; 183 - struct snd_vx_hardware *hw; 183 + const struct snd_vx_hardware *hw; 184 184 struct snd_vx222 *vx; 185 185 int err; 186 186
+2 -2
sound/pci/vx222/vx222.h
··· 31 31 /* we use a lookup table with 148 values, see vx_mixer.c */ 32 32 #define VX2_AKM_LEVEL_MAX 0x93 33 33 34 - extern struct snd_vx_ops vx222_ops; 35 - extern struct snd_vx_ops vx222_old_ops; 34 + extern const struct snd_vx_ops vx222_ops; 35 + extern const struct snd_vx_ops vx222_old_ops; 36 36 37 37 /* Offset of registers with base equal to portDSP. */ 38 38 #define VX_RESET_DMA_REGISTER_OFFSET 0x00000008
+2 -2
sound/pci/vx222/vx222_ops.c
··· 984 984 /* 985 985 * callbacks 986 986 */ 987 - struct snd_vx_ops vx222_ops = { 987 + const struct snd_vx_ops vx222_ops = { 988 988 .in8 = vx2_inb, 989 989 .in32 = vx2_inl, 990 990 .out8 = vx2_outb, ··· 1004 1004 }; 1005 1005 1006 1006 /* for old VX222 board */ 1007 - struct snd_vx_ops vx222_old_ops = { 1007 + const struct snd_vx_ops vx222_old_ops = { 1008 1008 .in8 = vx2_inb, 1009 1009 .in32 = vx2_inl, 1010 1010 .out8 = vx2_outb,
+1 -1
sound/pcmcia/vx/vxp_ops.c
··· 581 581 * callbacks 582 582 */ 583 583 /* exported */ 584 - struct snd_vx_ops snd_vxpocket_ops = { 584 + const struct snd_vx_ops snd_vxpocket_ops = { 585 585 .in8 = vxp_inb, 586 586 .out8 = vxp_outb, 587 587 .test_and_ack = vxp_test_and_ack,
+2 -2
sound/pcmcia/vx/vxpocket.c
··· 82 82 83 83 static const DECLARE_TLV_DB_SCALE(db_scale_old_vol, -11350, 50, 0); 84 84 85 - static struct snd_vx_hardware vxpocket_hw = { 85 + static const struct snd_vx_hardware vxpocket_hw = { 86 86 .name = "VXPocket", 87 87 .type = VX_TYPE_VXPOCKET, 88 88 ··· 104 104 * UER, but only for the first two inputs and outputs. 105 105 */ 106 106 107 - static struct snd_vx_hardware vxp440_hw = { 107 + static const struct snd_vx_hardware vxp440_hw = { 108 108 .name = "VXPocket440", 109 109 .type = VX_TYPE_VXP440, 110 110
+1 -1
sound/pcmcia/vx/vxpocket.h
··· 32 32 33 33 #define to_vxpocket(x) container_of(x, struct snd_vxpocket, core) 34 34 35 - extern struct snd_vx_ops snd_vxpocket_ops; 35 + extern const struct snd_vx_ops snd_vxpocket_ops; 36 36 37 37 void vx_set_mic_boost(struct vx_core *chip, int boost); 38 38 void vx_set_mic_level(struct vx_core *chip, int level);