diff options
author | Takashi Iwai <tiwai@suse.de> | 2015-01-25 12:22:58 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2015-01-28 01:21:59 -0500 |
commit | f66fd990c5db177d6b9f0eae301ca6b15882eb2e (patch) | |
tree | e583afc51d0962a9f803adfe40e77ff6adefc690 /sound/usb | |
parent | 62a109d9e2ce948ee75222bbb92a97669f683875 (diff) |
ALSA: line6: Drop interface argument from private_init and disconnect callbacks
The interface argument is used just for retrieving the assigned
device, which can be already found in line6->ifcdev. Drop them from
the callbacks. Also, pass the usb id to private_init so that the
driver can deal with it there. This is a preliminary work for the
further cleanup to move the whole allocation into driver.c.
Tested-by: Chris Rorvick <chris@rorvick.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/line6/driver.c | 9 | ||||
-rw-r--r-- | sound/usb/line6/driver.h | 6 | ||||
-rw-r--r-- | sound/usb/line6/pod.c | 14 | ||||
-rw-r--r-- | sound/usb/line6/podhd.c | 6 | ||||
-rw-r--r-- | sound/usb/line6/toneport.c | 14 | ||||
-rw-r--r-- | sound/usb/line6/variax.c | 12 |
6 files changed, 31 insertions, 30 deletions
diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c index 4d2d233d0505..e2fbff05c1b1 100644 --- a/sound/usb/line6/driver.c +++ b/sound/usb/line6/driver.c | |||
@@ -488,9 +488,10 @@ static int line6_init_cap_control(struct usb_line6 *line6) | |||
488 | Probe USB device. | 488 | Probe USB device. |
489 | */ | 489 | */ |
490 | int line6_probe(struct usb_interface *interface, | 490 | int line6_probe(struct usb_interface *interface, |
491 | const struct usb_device_id *id, | ||
491 | struct usb_line6 *line6, | 492 | struct usb_line6 *line6, |
492 | const struct line6_properties *properties, | 493 | const struct line6_properties *properties, |
493 | int (*private_init)(struct usb_interface *, struct usb_line6 *)) | 494 | int (*private_init)(struct usb_line6 *, const struct usb_device_id *id)) |
494 | { | 495 | { |
495 | struct usb_device *usbdev = interface_to_usbdev(interface); | 496 | struct usb_device *usbdev = interface_to_usbdev(interface); |
496 | struct snd_card *card; | 497 | struct snd_card *card; |
@@ -552,7 +553,7 @@ int line6_probe(struct usb_interface *interface, | |||
552 | } | 553 | } |
553 | 554 | ||
554 | /* initialize device data based on device: */ | 555 | /* initialize device data based on device: */ |
555 | ret = private_init(interface, line6); | 556 | ret = private_init(line6, id); |
556 | if (ret < 0) | 557 | if (ret < 0) |
557 | goto error; | 558 | goto error; |
558 | 559 | ||
@@ -565,7 +566,7 @@ int line6_probe(struct usb_interface *interface, | |||
565 | 566 | ||
566 | error: | 567 | error: |
567 | if (line6->disconnect) | 568 | if (line6->disconnect) |
568 | line6->disconnect(interface); | 569 | line6->disconnect(line6); |
569 | snd_card_free(card); | 570 | snd_card_free(card); |
570 | return ret; | 571 | return ret; |
571 | } | 572 | } |
@@ -592,7 +593,7 @@ void line6_disconnect(struct usb_interface *interface) | |||
592 | if (line6->line6pcm) | 593 | if (line6->line6pcm) |
593 | line6_pcm_disconnect(line6->line6pcm); | 594 | line6_pcm_disconnect(line6->line6pcm); |
594 | if (line6->disconnect) | 595 | if (line6->disconnect) |
595 | line6->disconnect(interface); | 596 | line6->disconnect(line6); |
596 | 597 | ||
597 | dev_info(&interface->dev, "Line 6 %s now disconnected\n", | 598 | dev_info(&interface->dev, "Line 6 %s now disconnected\n", |
598 | line6->properties->name); | 599 | line6->properties->name); |
diff --git a/sound/usb/line6/driver.h b/sound/usb/line6/driver.h index a6c0b2f08ba8..4dc6c28e8224 100644 --- a/sound/usb/line6/driver.h +++ b/sound/usb/line6/driver.h | |||
@@ -157,7 +157,7 @@ struct usb_line6 { | |||
157 | int message_length; | 157 | int message_length; |
158 | 158 | ||
159 | void (*process_message)(struct usb_line6 *); | 159 | void (*process_message)(struct usb_line6 *); |
160 | void (*disconnect)(struct usb_interface *); | 160 | void (*disconnect)(struct usb_line6 *line6); |
161 | }; | 161 | }; |
162 | 162 | ||
163 | extern char *line6_alloc_sysex_buffer(struct usb_line6 *line6, int code1, | 163 | extern char *line6_alloc_sysex_buffer(struct usb_line6 *line6, int code1, |
@@ -180,9 +180,11 @@ extern int line6_write_data(struct usb_line6 *line6, int address, void *data, | |||
180 | size_t datalen); | 180 | size_t datalen); |
181 | 181 | ||
182 | int line6_probe(struct usb_interface *interface, | 182 | int line6_probe(struct usb_interface *interface, |
183 | const struct usb_device_id *id, | ||
183 | struct usb_line6 *line6, | 184 | struct usb_line6 *line6, |
184 | const struct line6_properties *properties, | 185 | const struct line6_properties *properties, |
185 | int (*private_init)(struct usb_interface *, struct usb_line6 *)); | 186 | int (*private_init)(struct usb_line6 *, const struct usb_device_id *id)); |
187 | |||
186 | void line6_disconnect(struct usb_interface *interface); | 188 | void line6_disconnect(struct usb_interface *interface); |
187 | 189 | ||
188 | #ifdef CONFIG_PM | 190 | #ifdef CONFIG_PM |
diff --git a/sound/usb/line6/pod.c b/sound/usb/line6/pod.c index 26ecf26a33ec..d1e952fbcae7 100644 --- a/sound/usb/line6/pod.c +++ b/sound/usb/line6/pod.c | |||
@@ -399,10 +399,10 @@ static struct snd_kcontrol_new pod_control_monitor = { | |||
399 | /* | 399 | /* |
400 | POD device disconnected. | 400 | POD device disconnected. |
401 | */ | 401 | */ |
402 | static void line6_pod_disconnect(struct usb_interface *interface) | 402 | static void line6_pod_disconnect(struct usb_line6 *line6) |
403 | { | 403 | { |
404 | struct usb_line6_pod *pod = usb_get_intfdata(interface); | 404 | struct usb_line6_pod *pod = (struct usb_line6_pod *)line6; |
405 | struct device *dev = &interface->dev; | 405 | struct device *dev = line6->ifcdev; |
406 | 406 | ||
407 | /* remove sysfs entries: */ | 407 | /* remove sysfs entries: */ |
408 | device_remove_file(dev, &dev_attr_device_id); | 408 | device_remove_file(dev, &dev_attr_device_id); |
@@ -435,8 +435,8 @@ static int pod_create_files2(struct device *dev) | |||
435 | /* | 435 | /* |
436 | Try to init POD device. | 436 | Try to init POD device. |
437 | */ | 437 | */ |
438 | static int pod_init(struct usb_interface *interface, | 438 | static int pod_init(struct usb_line6 *line6, |
439 | struct usb_line6 *line6) | 439 | const struct usb_device_id *id) |
440 | { | 440 | { |
441 | int err; | 441 | int err; |
442 | struct usb_line6_pod *pod = (struct usb_line6_pod *) line6; | 442 | struct usb_line6_pod *pod = (struct usb_line6_pod *) line6; |
@@ -448,7 +448,7 @@ static int pod_init(struct usb_interface *interface, | |||
448 | INIT_WORK(&pod->startup_work, pod_startup4); | 448 | INIT_WORK(&pod->startup_work, pod_startup4); |
449 | 449 | ||
450 | /* create sysfs entries: */ | 450 | /* create sysfs entries: */ |
451 | err = pod_create_files2(&interface->dev); | 451 | err = pod_create_files2(line6->ifcdev); |
452 | if (err < 0) | 452 | if (err < 0) |
453 | return err; | 453 | return err; |
454 | 454 | ||
@@ -596,7 +596,7 @@ static int pod_probe(struct usb_interface *interface, | |||
596 | pod = kzalloc(sizeof(*pod), GFP_KERNEL); | 596 | pod = kzalloc(sizeof(*pod), GFP_KERNEL); |
597 | if (!pod) | 597 | if (!pod) |
598 | return -ENODEV; | 598 | return -ENODEV; |
599 | return line6_probe(interface, &pod->line6, | 599 | return line6_probe(interface, id, &pod->line6, |
600 | &pod_properties_table[id->driver_info], | 600 | &pod_properties_table[id->driver_info], |
601 | pod_init); | 601 | pod_init); |
602 | } | 602 | } |
diff --git a/sound/usb/line6/podhd.c b/sound/usb/line6/podhd.c index 59abbd92624e..21d7edcfa272 100644 --- a/sound/usb/line6/podhd.c +++ b/sound/usb/line6/podhd.c | |||
@@ -87,8 +87,8 @@ static struct line6_pcm_properties podhd_pcm_properties = { | |||
87 | /* | 87 | /* |
88 | Try to init POD HD device. | 88 | Try to init POD HD device. |
89 | */ | 89 | */ |
90 | static int podhd_init(struct usb_interface *interface, | 90 | static int podhd_init(struct usb_line6 *line6, |
91 | struct usb_line6 *line6) | 91 | const struct usb_device_id *id) |
92 | { | 92 | { |
93 | int err; | 93 | int err; |
94 | 94 | ||
@@ -182,7 +182,7 @@ static int podhd_probe(struct usb_interface *interface, | |||
182 | podhd = kzalloc(sizeof(*podhd), GFP_KERNEL); | 182 | podhd = kzalloc(sizeof(*podhd), GFP_KERNEL); |
183 | if (!podhd) | 183 | if (!podhd) |
184 | return -ENODEV; | 184 | return -ENODEV; |
185 | return line6_probe(interface, &podhd->line6, | 185 | return line6_probe(interface, id, &podhd->line6, |
186 | &podhd_properties_table[id->driver_info], | 186 | &podhd_properties_table[id->driver_info], |
187 | podhd_init); | 187 | podhd_init); |
188 | } | 188 | } |
diff --git a/sound/usb/line6/toneport.c b/sound/usb/line6/toneport.c index 9a769463f7bf..8e7020df0d10 100644 --- a/sound/usb/line6/toneport.c +++ b/sound/usb/line6/toneport.c | |||
@@ -387,11 +387,11 @@ static void toneport_setup(struct usb_line6_toneport *toneport) | |||
387 | /* | 387 | /* |
388 | Toneport device disconnected. | 388 | Toneport device disconnected. |
389 | */ | 389 | */ |
390 | static void line6_toneport_disconnect(struct usb_interface *interface) | 390 | static void line6_toneport_disconnect(struct usb_line6 *line6) |
391 | { | 391 | { |
392 | struct usb_line6_toneport *toneport; | 392 | struct usb_line6_toneport *toneport = |
393 | (struct usb_line6_toneport *)line6; | ||
393 | 394 | ||
394 | toneport = usb_get_intfdata(interface); | ||
395 | del_timer_sync(&toneport->timer); | 395 | del_timer_sync(&toneport->timer); |
396 | 396 | ||
397 | if (toneport_has_led(toneport->type)) | 397 | if (toneport_has_led(toneport->type)) |
@@ -402,12 +402,13 @@ static void line6_toneport_disconnect(struct usb_interface *interface) | |||
402 | /* | 402 | /* |
403 | Try to init Toneport device. | 403 | Try to init Toneport device. |
404 | */ | 404 | */ |
405 | static int toneport_init(struct usb_interface *interface, | 405 | static int toneport_init(struct usb_line6 *line6, |
406 | struct usb_line6 *line6) | 406 | const struct usb_device_id *id) |
407 | { | 407 | { |
408 | int err; | 408 | int err; |
409 | struct usb_line6_toneport *toneport = (struct usb_line6_toneport *) line6; | 409 | struct usb_line6_toneport *toneport = (struct usb_line6_toneport *) line6; |
410 | 410 | ||
411 | toneport->type = id->driver_info; | ||
411 | setup_timer(&toneport->timer, toneport_start_pcm, | 412 | setup_timer(&toneport->timer, toneport_start_pcm, |
412 | (unsigned long)toneport); | 413 | (unsigned long)toneport); |
413 | 414 | ||
@@ -562,8 +563,7 @@ static int toneport_probe(struct usb_interface *interface, | |||
562 | toneport = kzalloc(sizeof(*toneport), GFP_KERNEL); | 563 | toneport = kzalloc(sizeof(*toneport), GFP_KERNEL); |
563 | if (!toneport) | 564 | if (!toneport) |
564 | return -ENODEV; | 565 | return -ENODEV; |
565 | toneport->type = id->driver_info; | 566 | return line6_probe(interface, id, &toneport->line6, |
566 | return line6_probe(interface, &toneport->line6, | ||
567 | &toneport_properties_table[id->driver_info], | 567 | &toneport_properties_table[id->driver_info], |
568 | toneport_init); | 568 | toneport_init); |
569 | } | 569 | } |
diff --git a/sound/usb/line6/variax.c b/sound/usb/line6/variax.c index cd3adeffde02..ba6e85eed2ba 100644 --- a/sound/usb/line6/variax.c +++ b/sound/usb/line6/variax.c | |||
@@ -210,11 +210,9 @@ static void line6_variax_process_message(struct usb_line6 *line6) | |||
210 | /* | 210 | /* |
211 | Variax destructor. | 211 | Variax destructor. |
212 | */ | 212 | */ |
213 | static void line6_variax_disconnect(struct usb_interface *interface) | 213 | static void line6_variax_disconnect(struct usb_line6 *line6) |
214 | { | 214 | { |
215 | struct usb_line6_variax *variax; | 215 | struct usb_line6_variax *variax = (struct usb_line6_variax *)line6; |
216 | |||
217 | variax = usb_get_intfdata(interface); | ||
218 | 216 | ||
219 | del_timer(&variax->startup_timer1); | 217 | del_timer(&variax->startup_timer1); |
220 | del_timer(&variax->startup_timer2); | 218 | del_timer(&variax->startup_timer2); |
@@ -226,8 +224,8 @@ static void line6_variax_disconnect(struct usb_interface *interface) | |||
226 | /* | 224 | /* |
227 | Try to init workbench device. | 225 | Try to init workbench device. |
228 | */ | 226 | */ |
229 | static int variax_init(struct usb_interface *interface, | 227 | static int variax_init(struct usb_line6 *line6, |
230 | struct usb_line6 *line6) | 228 | const struct usb_device_id *id) |
231 | { | 229 | { |
232 | struct usb_line6_variax *variax = (struct usb_line6_variax *) line6; | 230 | struct usb_line6_variax *variax = (struct usb_line6_variax *) line6; |
233 | int err; | 231 | int err; |
@@ -303,7 +301,7 @@ static int variax_probe(struct usb_interface *interface, | |||
303 | variax = kzalloc(sizeof(*variax), GFP_KERNEL); | 301 | variax = kzalloc(sizeof(*variax), GFP_KERNEL); |
304 | if (!variax) | 302 | if (!variax) |
305 | return -ENODEV; | 303 | return -ENODEV; |
306 | return line6_probe(interface, &variax->line6, | 304 | return line6_probe(interface, id, &variax->line6, |
307 | &variax_properties_table[id->driver_info], | 305 | &variax_properties_table[id->driver_info], |
308 | variax_init); | 306 | variax_init); |
309 | } | 307 | } |