Skip to content

Commit 7b9584f

Browse files
crorvicktiwai
authored andcommitted
staging: line6: Move altsetting to properties
The device type can now be used to determine the altsetting for the interface. Drop the conditional logic and make this value a property. Signed-off-by: Chris Rorvick <[email protected]> Reviewed-by: Stefan Hajnoczi <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
1 parent b98a811 commit 7b9584f

File tree

2 files changed

+25
-51
lines changed

2 files changed

+25
-51
lines changed

drivers/staging/line6/driver.c

Lines changed: 23 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -67,121 +67,141 @@ static const struct line6_properties line6_properties_table[] = {
6767
.capabilities = LINE6_CAP_CONTROL
6868
| LINE6_CAP_PCM
6969
| LINE6_CAP_HWMON,
70+
.altsetting = 5,
7071
},
7172
[LINE6_BASSPODXTLIVE] = {
7273
.id = "BassPODxtLive",
7374
.name = "BassPODxt Live",
7475
.capabilities = LINE6_CAP_CONTROL
7576
| LINE6_CAP_PCM
7677
| LINE6_CAP_HWMON,
78+
.altsetting = 1,
7779
},
7880
[LINE6_BASSPODXTPRO] = {
7981
.id = "BassPODxtPro",
8082
.name = "BassPODxt Pro",
8183
.capabilities = LINE6_CAP_CONTROL
8284
| LINE6_CAP_PCM
8385
| LINE6_CAP_HWMON,
86+
.altsetting = 5,
8487
},
8588
[LINE6_GUITARPORT] = {
8689
.id = "GuitarPort",
8790
.name = "GuitarPort",
8891
.capabilities = LINE6_CAP_PCM,
92+
.altsetting = 2, /* 1..4 seem to be ok */
8993
},
9094
[LINE6_POCKETPOD] = {
9195
.id = "PocketPOD",
9296
.name = "Pocket POD",
9397
.capabilities = LINE6_CAP_CONTROL,
98+
.altsetting = 0,
9499
},
95100
[LINE6_PODHD300] = {
96101
.id = "PODHD300",
97102
.name = "POD HD300",
98103
.capabilities = LINE6_CAP_CONTROL
99104
| LINE6_CAP_PCM
100105
| LINE6_CAP_HWMON,
106+
.altsetting = 5,
101107
},
102108
[LINE6_PODHD400] = {
103109
.id = "PODHD400",
104110
.name = "POD HD400",
105111
.capabilities = LINE6_CAP_CONTROL
106112
| LINE6_CAP_PCM
107113
| LINE6_CAP_HWMON,
114+
.altsetting = 5,
108115
},
109116
[LINE6_PODHD500_0] = {
110117
.id = "PODHD500",
111118
.name = "POD HD500",
112119
.capabilities = LINE6_CAP_CONTROL
113120
| LINE6_CAP_PCM
114121
| LINE6_CAP_HWMON,
122+
.altsetting = 1,
115123
},
116124
[LINE6_PODHD500_1] = {
117125
.id = "PODHD500",
118126
.name = "POD HD500",
119127
.capabilities = LINE6_CAP_CONTROL
120128
| LINE6_CAP_PCM
121129
| LINE6_CAP_HWMON,
130+
.altsetting = 1,
122131
},
123132
[LINE6_PODSTUDIO_GX] = {
124133
.id = "PODStudioGX",
125134
.name = "POD Studio GX",
126135
.capabilities = LINE6_CAP_PCM,
136+
.altsetting = 2, /* 1..4 seem to be ok */
127137
},
128138
[LINE6_PODSTUDIO_UX1] = {
129139
.id = "PODStudioUX1",
130140
.name = "POD Studio UX1",
131141
.capabilities = LINE6_CAP_PCM,
142+
.altsetting = 2, /* 1..4 seem to be ok */
132143
},
133144
[LINE6_PODSTUDIO_UX2] = {
134145
.id = "PODStudioUX2",
135146
.name = "POD Studio UX2",
136147
.capabilities = LINE6_CAP_PCM,
148+
.altsetting = 2, /* defaults to 44.1kHz, 16-bit */
137149
},
138150
[LINE6_PODXT] = {
139151
.id = "PODxt",
140152
.name = "PODxt",
141153
.capabilities = LINE6_CAP_CONTROL
142154
| LINE6_CAP_PCM
143155
| LINE6_CAP_HWMON,
156+
.altsetting = 5,
144157
},
145158
[LINE6_PODXTLIVE_POD] = {
146159
.id = "PODxtLive",
147160
.name = "PODxt Live",
148161
.capabilities = LINE6_CAP_CONTROL
149162
| LINE6_CAP_PCM
150163
| LINE6_CAP_HWMON,
164+
.altsetting = 1,
151165
},
152166
[LINE6_PODXTLIVE_VARIAX] = {
153167
.id = "PODxtLive",
154168
.name = "PODxt Live",
155169
.capabilities = LINE6_CAP_CONTROL
156170
| LINE6_CAP_PCM
157171
| LINE6_CAP_HWMON,
172+
.altsetting = 1,
158173
},
159174
[LINE6_PODXTPRO] = {
160175
.id = "PODxtPro",
161176
.name = "PODxt Pro",
162177
.capabilities = LINE6_CAP_CONTROL
163178
| LINE6_CAP_PCM
164179
| LINE6_CAP_HWMON,
180+
.altsetting = 5,
165181
},
166182
[LINE6_TONEPORT_GX] = {
167183
.id = "TonePortGX",
168184
.name = "TonePort GX",
169185
.capabilities = LINE6_CAP_PCM,
186+
.altsetting = 2, /* 1..4 seem to be ok */
170187
},
171188
[LINE6_TONEPORT_UX1] = {
172189
.id = "TonePortUX1",
173190
.name = "TonePort UX1",
174191
.capabilities = LINE6_CAP_PCM,
192+
.altsetting = 2, /* 1..4 seem to be ok */
175193
},
176194
[LINE6_TONEPORT_UX2] = {
177195
.id = "TonePortUX2",
178196
.name = "TonePort UX2",
179197
.capabilities = LINE6_CAP_PCM,
198+
.altsetting = 2, /* defaults to 44.1kHz, 16-bit */
180199
},
181200
[LINE6_VARIAX] = {
182201
.id = "Variax",
183202
.name = "Variax Workbench",
184203
.capabilities = LINE6_CAP_CONTROL,
204+
.altsetting = 1,
185205
}
186206
};
187207

@@ -703,7 +723,7 @@ static int line6_probe(struct usb_interface *interface,
703723
struct usb_device *usbdev;
704724
struct usb_line6 *line6;
705725
const struct line6_properties *properties;
706-
int interface_number, alternate = 0;
726+
int interface_number;
707727
int size = 0;
708728
int ep_read = 0, ep_write = 0;
709729
int ret;
@@ -729,56 +749,8 @@ static int line6_probe(struct usb_interface *interface,
729749
/* query interface number */
730750
interface_number = interface->cur_altsetting->desc.bInterfaceNumber;
731751

732-
switch (devtype) {
733-
case LINE6_BASSPODXTLIVE:
734-
case LINE6_PODXTLIVE_POD:
735-
case LINE6_PODXTLIVE_VARIAX:
736-
case LINE6_VARIAX:
737-
alternate = 1;
738-
break;
739-
740-
case LINE6_POCKETPOD:
741-
alternate = 0;
742-
break;
743-
744-
case LINE6_PODHD500_0:
745-
alternate = 1;
746-
break;
747-
748-
case LINE6_PODHD500_1:
749-
alternate = 0;
750-
break;
751-
752-
case LINE6_BASSPODXT:
753-
case LINE6_BASSPODXTPRO:
754-
case LINE6_PODXT:
755-
case LINE6_PODXTPRO:
756-
case LINE6_PODHD300:
757-
case LINE6_PODHD400:
758-
alternate = 5;
759-
break;
760-
761-
case LINE6_GUITARPORT:
762-
case LINE6_PODSTUDIO_GX:
763-
case LINE6_PODSTUDIO_UX1:
764-
case LINE6_TONEPORT_GX:
765-
case LINE6_TONEPORT_UX1:
766-
alternate = 2; /* 1..4 seem to be ok */
767-
break;
768-
769-
case LINE6_TONEPORT_UX2:
770-
case LINE6_PODSTUDIO_UX2:
771-
/* defaults to 44.1kHz, 16-bit */
772-
alternate = 2;
773-
break;
774-
775-
default:
776-
MISSING_CASE;
777-
ret = -ENODEV;
778-
goto err_put;
779-
}
780-
781-
ret = usb_set_interface(usbdev, interface_number, alternate);
752+
ret = usb_set_interface(usbdev, interface_number,
753+
properties->altsetting);
782754
if (ret < 0) {
783755
dev_err(&interface->dev, "set_interface failed\n");
784756
goto err_put;

drivers/staging/line6/driver.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,8 @@ struct line6_properties {
115115
line6usb driver.
116116
*/
117117
int capabilities;
118+
119+
int altsetting;
118120
};
119121

120122
/**

0 commit comments

Comments
 (0)