hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/sound/pci/emu10k1/emufx.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * Copyright (c) by Jaroslav Kysela <perex@perex.cz>
34 * Creative Labs, Inc.
....@@ -11,21 +12,6 @@
1112 *
1213 * TODO:
1314 * --
14
- *
15
- * This program is free software; you can redistribute it and/or modify
16
- * it under the terms of the GNU General Public License as published by
17
- * the Free Software Foundation; either version 2 of the License, or
18
- * (at your option) any later version.
19
- *
20
- * This program is distributed in the hope that it will be useful,
21
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- * GNU General Public License for more details.
24
- *
25
- * You should have received a copy of the GNU General Public License
26
- * along with this program; if not, write to the Free Software
27
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28
- *
2915 */
3016
3117 #include <linux/pci.h>
....@@ -60,7 +46,7 @@
6046 * Tables
6147 */
6248
63
-static char *fxbuses[16] = {
49
+static const char * const fxbuses[16] = {
6450 /* 0x00 */ "PCM Left",
6551 /* 0x01 */ "PCM Right",
6652 /* 0x02 */ "PCM Surround Left",
....@@ -79,7 +65,7 @@
7965 /* 0x0f */ NULL
8066 };
8167
82
-static char *creative_ins[16] = {
68
+static const char * const creative_ins[16] = {
8369 /* 0x00 */ "AC97 Left",
8470 /* 0x01 */ "AC97 Right",
8571 /* 0x02 */ "TTL IEC958 Left",
....@@ -98,7 +84,7 @@
9884 /* 0x0f */ NULL
9985 };
10086
101
-static char *audigy_ins[16] = {
87
+static const char * const audigy_ins[16] = {
10288 /* 0x00 */ "AC97 Left",
10389 /* 0x01 */ "AC97 Right",
10490 /* 0x02 */ "Audigy CD Left",
....@@ -117,7 +103,7 @@
117103 /* 0x0f */ NULL
118104 };
119105
120
-static char *creative_outs[32] = {
106
+static const char * const creative_outs[32] = {
121107 /* 0x00 */ "AC97 Left",
122108 /* 0x01 */ "AC97 Right",
123109 /* 0x02 */ "Optical IEC958 Left",
....@@ -152,7 +138,7 @@
152138 /* 0x1f */ NULL,
153139 };
154140
155
-static char *audigy_outs[32] = {
141
+static const char * const audigy_outs[32] = {
156142 /* 0x00 */ "Digital Front Left",
157143 /* 0x01 */ "Digital Front Right",
158144 /* 0x02 */ "Digital Center",
....@@ -477,7 +463,7 @@
477463 u_int32_t *code;
478464 if (snd_BUG_ON(*ptr >= 512))
479465 return;
480
- code = (u_int32_t __force *)icode->code + (*ptr) * 2;
466
+ code = icode->code + (*ptr) * 2;
481467 set_bit(*ptr, icode->code_valid);
482468 code[0] = ((x & 0x3ff) << 10) | (y & 0x3ff);
483469 code[1] = ((op & 0x0f) << 20) | ((r & 0x3ff) << 10) | (a & 0x3ff);
....@@ -494,7 +480,7 @@
494480 u_int32_t *code;
495481 if (snd_BUG_ON(*ptr >= 1024))
496482 return;
497
- code = (u_int32_t __force *)icode->code + (*ptr) * 2;
483
+ code = icode->code + (*ptr) * 2;
498484 set_bit(*ptr, icode->code_valid);
499485 code[0] = ((x & 0x7ff) << 12) | (y & 0x7ff);
500486 code[1] = ((op & 0x0f) << 24) | ((r & 0x7ff) << 12) | (a & 0x7ff);
....@@ -527,8 +513,8 @@
527513 if (!test_bit(gpr, icode->gpr_valid))
528514 continue;
529515 if (in_kernel)
530
- val = *(__force u32 *)&icode->gpr_map[gpr];
531
- else if (get_user(val, &icode->gpr_map[gpr]))
516
+ val = icode->gpr_map[gpr];
517
+ else if (get_user(val, (__user u32 *)&icode->gpr_map[gpr]))
532518 return -EFAULT;
533519 snd_emu10k1_ptr_write(emu, emu->gpr_base + gpr, 0, val);
534520 }
....@@ -544,7 +530,7 @@
544530 for (gpr = 0; gpr < (emu->audigy ? 0x200 : 0x100); gpr++) {
545531 set_bit(gpr, icode->gpr_valid);
546532 val = snd_emu10k1_ptr_read(emu, emu->gpr_base + gpr, 0);
547
- if (put_user(val, &icode->gpr_map[gpr]))
533
+ if (put_user(val, (__user u32 *)&icode->gpr_map[gpr]))
548534 return -EFAULT;
549535 }
550536 return 0;
....@@ -561,11 +547,11 @@
561547 if (!test_bit(tram, icode->tram_valid))
562548 continue;
563549 if (in_kernel) {
564
- val = *(__force u32 *)&icode->tram_data_map[tram];
565
- addr = *(__force u32 *)&icode->tram_addr_map[tram];
550
+ val = icode->tram_data_map[tram];
551
+ addr = icode->tram_addr_map[tram];
566552 } else {
567
- if (get_user(val, &icode->tram_data_map[tram]) ||
568
- get_user(addr, &icode->tram_addr_map[tram]))
553
+ if (get_user(val, (__user __u32 *)&icode->tram_data_map[tram]) ||
554
+ get_user(addr, (__user __u32 *)&icode->tram_addr_map[tram]))
569555 return -EFAULT;
570556 }
571557 snd_emu10k1_ptr_write(emu, TANKMEMDATAREGBASE + tram, 0, val);
....@@ -595,8 +581,8 @@
595581 addr = snd_emu10k1_ptr_read(emu, TANKMEMADDRREGBASE + tram, 0) >> 12;
596582 addr |= snd_emu10k1_ptr_read(emu, A_TANKMEMCTLREGBASE + tram, 0) << 20;
597583 }
598
- if (put_user(val, &icode->tram_data_map[tram]) ||
599
- put_user(addr, &icode->tram_addr_map[tram]))
584
+ if (put_user(val, (__user u32 *)&icode->tram_data_map[tram]) ||
585
+ put_user(addr, (__user u32 *)&icode->tram_addr_map[tram]))
600586 return -EFAULT;
601587 }
602588 return 0;
....@@ -612,11 +598,11 @@
612598 if (!test_bit(pc / 2, icode->code_valid))
613599 continue;
614600 if (in_kernel) {
615
- lo = *(__force u32 *)&icode->code[pc + 0];
616
- hi = *(__force u32 *)&icode->code[pc + 1];
601
+ lo = icode->code[pc + 0];
602
+ hi = icode->code[pc + 1];
617603 } else {
618
- if (get_user(lo, &icode->code[pc + 0]) ||
619
- get_user(hi, &icode->code[pc + 1]))
604
+ if (get_user(lo, (__user u32 *)&icode->code[pc + 0]) ||
605
+ get_user(hi, (__user u32 *)&icode->code[pc + 1]))
620606 return -EFAULT;
621607 }
622608 snd_emu10k1_efx_write(emu, pc + 0, lo);
....@@ -633,17 +619,21 @@
633619 memset(icode->code_valid, 0, sizeof(icode->code_valid));
634620 for (pc = 0; pc < (emu->audigy ? 2*1024 : 2*512); pc += 2) {
635621 set_bit(pc / 2, icode->code_valid);
636
- if (put_user(snd_emu10k1_efx_read(emu, pc + 0), &icode->code[pc + 0]))
622
+ if (put_user(snd_emu10k1_efx_read(emu, pc + 0),
623
+ (__user u32 *)&icode->code[pc + 0]))
637624 return -EFAULT;
638
- if (put_user(snd_emu10k1_efx_read(emu, pc + 1), &icode->code[pc + 1]))
625
+ if (put_user(snd_emu10k1_efx_read(emu, pc + 1),
626
+ (__user u32 *)&icode->code[pc + 1]))
639627 return -EFAULT;
640628 }
641629 return 0;
642630 }
643631
644632 static struct snd_emu10k1_fx8010_ctl *
645
-snd_emu10k1_look_for_ctl(struct snd_emu10k1 *emu, struct snd_ctl_elem_id *id)
633
+snd_emu10k1_look_for_ctl(struct snd_emu10k1 *emu,
634
+ struct emu10k1_ctl_elem_id *_id)
646635 {
636
+ struct snd_ctl_elem_id *id = (struct snd_ctl_elem_id *)_id;
647637 struct snd_emu10k1_fx8010_ctl *ctl;
648638 struct snd_kcontrol *kcontrol;
649639
....@@ -686,41 +676,60 @@
686676 }
687677
688678 static int copy_gctl(struct snd_emu10k1 *emu,
689
- struct snd_emu10k1_fx8010_control_gpr *gctl,
690
- struct snd_emu10k1_fx8010_control_gpr __user *_gctl,
679
+ struct snd_emu10k1_fx8010_control_gpr *dst,
680
+ struct snd_emu10k1_fx8010_control_gpr *src,
691681 int idx, bool in_kernel)
692682 {
693
- struct snd_emu10k1_fx8010_control_old_gpr __user *octl;
683
+ struct snd_emu10k1_fx8010_control_gpr __user *_src;
684
+ struct snd_emu10k1_fx8010_control_old_gpr *octl;
685
+ struct snd_emu10k1_fx8010_control_old_gpr __user *_octl;
694686
687
+ _src = (struct snd_emu10k1_fx8010_control_gpr __user *)src;
695688 if (emu->support_tlv) {
696689 if (in_kernel)
697
- memcpy(gctl, (__force void *)&_gctl[idx], sizeof(*gctl));
698
- else if (copy_from_user(gctl, &_gctl[idx], sizeof(*gctl)))
690
+ *dst = src[idx];
691
+ else if (copy_from_user(dst, &_src[idx], sizeof(*src)))
699692 return -EFAULT;
700693 return 0;
701694 }
702695
703
- octl = (struct snd_emu10k1_fx8010_control_old_gpr __user *)_gctl;
696
+ octl = (struct snd_emu10k1_fx8010_control_old_gpr *)src;
697
+ _octl = (struct snd_emu10k1_fx8010_control_old_gpr __user *)octl;
704698 if (in_kernel)
705
- memcpy(gctl, (__force void *)&octl[idx], sizeof(*octl));
706
- else if (copy_from_user(gctl, &octl[idx], sizeof(*octl)))
699
+ memcpy(dst, &octl[idx], sizeof(*octl));
700
+ else if (copy_from_user(dst, &_octl[idx], sizeof(*octl)))
707701 return -EFAULT;
708
- gctl->tlv = NULL;
702
+ dst->tlv = NULL;
709703 return 0;
710704 }
711705
712706 static int copy_gctl_to_user(struct snd_emu10k1 *emu,
713
- struct snd_emu10k1_fx8010_control_gpr __user *_gctl,
714
- struct snd_emu10k1_fx8010_control_gpr *gctl,
707
+ struct snd_emu10k1_fx8010_control_gpr *dst,
708
+ struct snd_emu10k1_fx8010_control_gpr *src,
715709 int idx)
716710 {
711
+ struct snd_emu10k1_fx8010_control_gpr __user *_dst;
717712 struct snd_emu10k1_fx8010_control_old_gpr __user *octl;
718713
714
+ _dst = (struct snd_emu10k1_fx8010_control_gpr __user *)dst;
719715 if (emu->support_tlv)
720
- return copy_to_user(&_gctl[idx], gctl, sizeof(*gctl));
716
+ return copy_to_user(&_dst[idx], src, sizeof(*src));
721717
722
- octl = (struct snd_emu10k1_fx8010_control_old_gpr __user *)_gctl;
723
- return copy_to_user(&octl[idx], gctl, sizeof(*octl));
718
+ octl = (struct snd_emu10k1_fx8010_control_old_gpr __user *)dst;
719
+ return copy_to_user(&octl[idx], src, sizeof(*octl));
720
+}
721
+
722
+static int copy_ctl_elem_id(const struct emu10k1_ctl_elem_id *list, int i,
723
+ struct emu10k1_ctl_elem_id *ret, bool in_kernel)
724
+{
725
+ struct emu10k1_ctl_elem_id __user *_id =
726
+ (struct emu10k1_ctl_elem_id __user *)&list[i];
727
+
728
+ if (in_kernel)
729
+ *ret = list[i];
730
+ else if (copy_from_user(ret, _id, sizeof(*ret)))
731
+ return -EFAULT;
732
+ return 0;
724733 }
725734
726735 static int snd_emu10k1_verify_controls(struct snd_emu10k1 *emu,
....@@ -728,17 +737,16 @@
728737 bool in_kernel)
729738 {
730739 unsigned int i;
731
- struct snd_ctl_elem_id __user *_id;
732
- struct snd_ctl_elem_id id;
740
+ struct emu10k1_ctl_elem_id id;
733741 struct snd_emu10k1_fx8010_control_gpr *gctl;
742
+ struct snd_ctl_elem_id *gctl_id;
734743 int err;
735744
736
- for (i = 0, _id = icode->gpr_del_controls;
737
- i < icode->gpr_del_control_count; i++, _id++) {
738
- if (in_kernel)
739
- id = *(__force struct snd_ctl_elem_id *)_id;
740
- else if (copy_from_user(&id, _id, sizeof(id)))
741
- return -EFAULT;
745
+ for (i = 0; i < icode->gpr_del_control_count; i++) {
746
+ err = copy_ctl_elem_id(icode->gpr_del_controls, i, &id,
747
+ in_kernel);
748
+ if (err < 0)
749
+ return err;
742750 if (snd_emu10k1_look_for_ctl(emu, &id) == NULL)
743751 return -ENOENT;
744752 }
....@@ -754,15 +762,16 @@
754762 }
755763 if (snd_emu10k1_look_for_ctl(emu, &gctl->id))
756764 continue;
765
+ gctl_id = (struct snd_ctl_elem_id *)&gctl->id;
757766 down_read(&emu->card->controls_rwsem);
758
- if (snd_ctl_find_id(emu->card, &gctl->id) != NULL) {
767
+ if (snd_ctl_find_id(emu->card, gctl_id)) {
759768 up_read(&emu->card->controls_rwsem);
760769 err = -EEXIST;
761770 goto __error;
762771 }
763772 up_read(&emu->card->controls_rwsem);
764
- if (gctl->id.iface != SNDRV_CTL_ELEM_IFACE_MIXER &&
765
- gctl->id.iface != SNDRV_CTL_ELEM_IFACE_PCM) {
773
+ if (gctl_id->iface != SNDRV_CTL_ELEM_IFACE_MIXER &&
774
+ gctl_id->iface != SNDRV_CTL_ELEM_IFACE_PCM) {
766775 err = -EINVAL;
767776 goto __error;
768777 }
....@@ -797,6 +806,7 @@
797806 {
798807 unsigned int i, j;
799808 struct snd_emu10k1_fx8010_control_gpr *gctl;
809
+ struct snd_ctl_elem_id *gctl_id;
800810 struct snd_emu10k1_fx8010_ctl *ctl, *nctl;
801811 struct snd_kcontrol_new knew;
802812 struct snd_kcontrol *kctl;
....@@ -817,24 +827,25 @@
817827 err = -EFAULT;
818828 goto __error;
819829 }
820
- if (gctl->id.iface != SNDRV_CTL_ELEM_IFACE_MIXER &&
821
- gctl->id.iface != SNDRV_CTL_ELEM_IFACE_PCM) {
830
+ gctl_id = (struct snd_ctl_elem_id *)&gctl->id;
831
+ if (gctl_id->iface != SNDRV_CTL_ELEM_IFACE_MIXER &&
832
+ gctl_id->iface != SNDRV_CTL_ELEM_IFACE_PCM) {
822833 err = -EINVAL;
823834 goto __error;
824835 }
825
- if (! gctl->id.name[0]) {
836
+ if (!*gctl_id->name) {
826837 err = -EINVAL;
827838 goto __error;
828839 }
829840 ctl = snd_emu10k1_look_for_ctl(emu, &gctl->id);
830841 memset(&knew, 0, sizeof(knew));
831
- knew.iface = gctl->id.iface;
832
- knew.name = gctl->id.name;
833
- knew.index = gctl->id.index;
834
- knew.device = gctl->id.device;
835
- knew.subdevice = gctl->id.subdevice;
842
+ knew.iface = gctl_id->iface;
843
+ knew.name = gctl_id->name;
844
+ knew.index = gctl_id->index;
845
+ knew.device = gctl_id->device;
846
+ knew.subdevice = gctl_id->subdevice;
836847 knew.info = snd_emu10k1_gpr_ctl_info;
837
- knew.tlv.p = copy_tlv((__force const unsigned int __user *)gctl->tlv, in_kernel);
848
+ knew.tlv.p = copy_tlv((const unsigned int __user *)gctl->tlv, in_kernel);
838849 if (knew.tlv.p)
839850 knew.access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
840851 SNDRV_CTL_ELEM_ACCESS_TLV_READ;
....@@ -890,17 +901,16 @@
890901 bool in_kernel)
891902 {
892903 unsigned int i;
893
- struct snd_ctl_elem_id id;
894
- struct snd_ctl_elem_id __user *_id;
904
+ struct emu10k1_ctl_elem_id id;
895905 struct snd_emu10k1_fx8010_ctl *ctl;
896906 struct snd_card *card = emu->card;
907
+ int err;
897908
898
- for (i = 0, _id = icode->gpr_del_controls;
899
- i < icode->gpr_del_control_count; i++, _id++) {
900
- if (in_kernel)
901
- id = *(__force struct snd_ctl_elem_id *)_id;
902
- else if (copy_from_user(&id, _id, sizeof(id)))
903
- return -EFAULT;
909
+ for (i = 0; i < icode->gpr_del_control_count; i++) {
910
+ err = copy_ctl_elem_id(icode->gpr_del_controls, i, &id,
911
+ in_kernel);
912
+ if (err < 0)
913
+ return err;
904914 down_write(&card->controls_rwsem);
905915 ctl = snd_emu10k1_look_for_ctl(emu, &id);
906916 if (ctl)
....@@ -929,7 +939,7 @@
929939 i < icode->gpr_list_control_count) {
930940 memset(gctl, 0, sizeof(*gctl));
931941 id = &ctl->kcontrol->id;
932
- gctl->id.iface = id->iface;
942
+ gctl->id.iface = (__force int)id->iface;
933943 strlcpy(gctl->id.name, id->name, sizeof(gctl->id.name));
934944 gctl->id.index = id->index;
935945 gctl->id.device = id->device;
....@@ -1107,7 +1117,7 @@
11071117 snd_emu10k1_init_mono_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
11081118 const char *name, int gpr, int defval)
11091119 {
1110
- ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
1120
+ ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER;
11111121 strcpy(ctl->id.name, name);
11121122 ctl->vcount = ctl->count = 1;
11131123 ctl->gpr[0] = gpr + 0; ctl->value[0] = defval;
....@@ -1128,7 +1138,7 @@
11281138 snd_emu10k1_init_stereo_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
11291139 const char *name, int gpr, int defval)
11301140 {
1131
- ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
1141
+ ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER;
11321142 strcpy(ctl->id.name, name);
11331143 ctl->vcount = ctl->count = 2;
11341144 ctl->gpr[0] = gpr + 0; ctl->value[0] = defval;
....@@ -1150,7 +1160,7 @@
11501160 snd_emu10k1_init_mono_onoff_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
11511161 const char *name, int gpr, int defval)
11521162 {
1153
- ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
1163
+ ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER;
11541164 strcpy(ctl->id.name, name);
11551165 ctl->vcount = ctl->count = 1;
11561166 ctl->gpr[0] = gpr + 0; ctl->value[0] = defval;
....@@ -1163,7 +1173,7 @@
11631173 snd_emu10k1_init_stereo_onoff_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
11641174 const char *name, int gpr, int defval)
11651175 {
1166
- ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
1176
+ ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER;
11671177 strcpy(ctl->id.name, name);
11681178 ctl->vcount = ctl->count = 2;
11691179 ctl->gpr[0] = gpr + 0; ctl->value[0] = defval;
....@@ -1216,8 +1226,8 @@
12161226 if (!icode)
12171227 return err;
12181228
1219
- icode->gpr_map = (u_int32_t __user *) kcalloc(512 + 256 + 256 + 2 * 1024,
1220
- sizeof(u_int32_t), GFP_KERNEL);
1229
+ icode->gpr_map = kcalloc(512 + 256 + 256 + 2 * 1024,
1230
+ sizeof(u_int32_t), GFP_KERNEL);
12211231 if (!icode->gpr_map)
12221232 goto __err_gpr;
12231233 controls = kcalloc(SND_EMU10K1_GPR_CONTROLS,
....@@ -1225,7 +1235,7 @@
12251235 if (!controls)
12261236 goto __err_ctrls;
12271237
1228
- gpr_map = (u32 __force *)icode->gpr_map;
1238
+ gpr_map = icode->gpr_map;
12291239
12301240 icode->tram_data_map = icode->gpr_map + 512;
12311241 icode->tram_addr_map = icode->tram_data_map + 256;
....@@ -1480,7 +1490,7 @@
14801490
14811491
14821492 ctl = &controls[nctl + 0];
1483
- ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
1493
+ ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER;
14841494 strcpy(ctl->id.name, "Tone Control - Bass");
14851495 ctl->vcount = 2;
14861496 ctl->count = 10;
....@@ -1489,7 +1499,7 @@
14891499 ctl->value[0] = ctl->value[1] = 20;
14901500 ctl->translation = EMU10K1_GPR_TRANSLATION_BASS;
14911501 ctl = &controls[nctl + 1];
1492
- ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
1502
+ ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER;
14931503 strcpy(ctl->id.name, "Tone Control - Treble");
14941504 ctl->vcount = 2;
14951505 ctl->count = 10;
....@@ -1770,7 +1780,7 @@
17701780 A_OP(icode, &ptr, 0x0f, 0xc0, 0xc0, 0xcf, 0xc0);
17711781
17721782 icode->gpr_add_control_count = nctl;
1773
- icode->gpr_add_controls = (struct snd_emu10k1_fx8010_control_gpr __user *)controls;
1783
+ icode->gpr_add_controls = controls;
17741784 emu->support_tlv = 1; /* support TLV */
17751785 err = snd_emu10k1_icode_poke(emu, icode, true);
17761786 emu->support_tlv = 0; /* clear again */
....@@ -1778,7 +1788,7 @@
17781788 __err:
17791789 kfree(controls);
17801790 __err_ctrls:
1781
- kfree((void __force *)icode->gpr_map);
1791
+ kfree(icode->gpr_map);
17821792 __err_gpr:
17831793 kfree(icode);
17841794 return err;
....@@ -1851,8 +1861,8 @@
18511861 if (!icode)
18521862 return err;
18531863
1854
- icode->gpr_map = (u_int32_t __user *) kcalloc(256 + 160 + 160 + 2 * 512,
1855
- sizeof(u_int32_t), GFP_KERNEL);
1864
+ icode->gpr_map = kcalloc(256 + 160 + 160 + 2 * 512,
1865
+ sizeof(u_int32_t), GFP_KERNEL);
18561866 if (!icode->gpr_map)
18571867 goto __err_gpr;
18581868
....@@ -1866,7 +1876,7 @@
18661876 if (!ipcm)
18671877 goto __err_ipcm;
18681878
1869
- gpr_map = (u32 __force *)icode->gpr_map;
1879
+ gpr_map = icode->gpr_map;
18701880
18711881 icode->tram_data_map = icode->gpr_map + 256;
18721882 icode->tram_addr_map = icode->tram_data_map + 160;
....@@ -2200,7 +2210,7 @@
22002210 OP(icode, &ptr, iACC3, GPR(playback + SND_EMU10K1_PLAYBACK_CHANNELS + 5), GPR(playback + 5), C_00000000, C_00000000); /* LFE */
22012211
22022212 ctl = &controls[i + 0];
2203
- ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
2213
+ ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER;
22042214 strcpy(ctl->id.name, "Tone Control - Bass");
22052215 ctl->vcount = 2;
22062216 ctl->count = 10;
....@@ -2210,7 +2220,7 @@
22102220 ctl->tlv = snd_emu10k1_bass_treble_db_scale;
22112221 ctl->translation = EMU10K1_GPR_TRANSLATION_BASS;
22122222 ctl = &controls[i + 1];
2213
- ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
2223
+ ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER;
22142224 strcpy(ctl->id.name, "Tone Control - Treble");
22152225 ctl->vcount = 2;
22162226 ctl->count = 10;
....@@ -2396,7 +2406,7 @@
23962406 if ((err = snd_emu10k1_fx8010_tram_setup(emu, ipcm->buffer_size)) < 0)
23972407 goto __err;
23982408 icode->gpr_add_control_count = i;
2399
- icode->gpr_add_controls = (struct snd_emu10k1_fx8010_control_gpr __user *)controls;
2409
+ icode->gpr_add_controls = controls;
24002410 emu->support_tlv = 1; /* support TLV */
24012411 err = snd_emu10k1_icode_poke(emu, icode, true);
24022412 emu->support_tlv = 0; /* clear again */
....@@ -2407,7 +2417,7 @@
24072417 __err_ipcm:
24082418 kfree(controls);
24092419 __err_ctrls:
2410
- kfree((void __force *)icode->gpr_map);
2420
+ kfree(icode->gpr_map);
24112421 __err_gpr:
24122422 kfree(icode);
24132423 return err;
....@@ -2478,7 +2488,7 @@
24782488 }
24792489
24802490 if (size > 0) {
2481
- if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci),
2491
+ if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &emu->pci->dev,
24822492 size * 2, &emu->fx8010.etram_pages) < 0)
24832493 return -ENOMEM;
24842494 memset(emu->fx8010.etram_pages.area, 0, size * 2);
....@@ -2497,7 +2507,7 @@
24972507 return 0;
24982508 }
24992509
2500
-static void copy_string(char *dst, char *src, char *null, int idx)
2510
+static void copy_string(char *dst, const char *src, const char *null, int idx)
25012511 {
25022512 if (src == NULL)
25032513 sprintf(dst, "%s %02X", null, idx);
....@@ -2508,7 +2518,7 @@
25082518 static void snd_emu10k1_fx8010_info(struct snd_emu10k1 *emu,
25092519 struct snd_emu10k1_fx8010_info *info)
25102520 {
2511
- char **fxbus, **extin, **extout;
2521
+ const char * const *fxbus, * const *extin, * const *extout;
25122522 unsigned short fxbus_mask, extin_mask, extout_mask;
25132523 int res;
25142524