Commit e8e8babf authored by Daniel Mack's avatar Daniel Mack Committed by Takashi Iwai

ALSA: snd-usb: re-order code

Move code from endpoint.c into a new file called stream.c and rename
functions so that their names actually reflect what they're doing.

This way, endpoint.c will be available to functions that hold all the
endpoint logic.
Signed-off-by: default avatarDaniel Mack <zonque@gmail.com>
Acked-by: default avatarClemens Ladisch <clemens@ladisch.de>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 358e2bd4
...@@ -12,6 +12,7 @@ snd-usb-audio-objs := card.o \ ...@@ -12,6 +12,7 @@ snd-usb-audio-objs := card.o \
pcm.o \ pcm.o \
proc.o \ proc.o \
quirks.o \ quirks.o \
stream.o \
urb.o urb.o
snd-usbmidi-lib-objs := midi.o snd-usbmidi-lib-objs := midi.o
......
...@@ -68,6 +68,7 @@ ...@@ -68,6 +68,7 @@
#include "urb.h" #include "urb.h"
#include "format.h" #include "format.h"
#include "power.h" #include "power.h"
#include "stream.h"
MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>"); MODULE_AUTHOR("Takashi Iwai <tiwai@suse.de>");
MODULE_DESCRIPTION("USB Audio"); MODULE_DESCRIPTION("USB Audio");
...@@ -185,7 +186,7 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int ...@@ -185,7 +186,7 @@ static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int int
return -EINVAL; return -EINVAL;
} }
if (! snd_usb_parse_audio_endpoints(chip, interface)) { if (! snd_usb_parse_audio_interface(chip, interface)) {
usb_set_interface(dev, interface, 0); /* reset the current interface */ usb_set_interface(dev, interface, 0); /* reset the current interface */
usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L); usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L);
return -EINVAL; return -EINVAL;
......
This diff is collapsed.
#ifndef __USBAUDIO_ENDPOINT_H #ifndef __USBAUDIO_ENDPOINT_H
#define __USBAUDIO_ENDPOINT_H #define __USBAUDIO_ENDPOINT_H
int snd_usb_parse_audio_endpoints(struct snd_usb_audio *chip,
int iface_no);
int snd_usb_add_audio_endpoint(struct snd_usb_audio *chip,
int stream,
struct audioformat *fp);
#endif /* __USBAUDIO_ENDPOINT_H */ #endif /* __USBAUDIO_ENDPOINT_H */
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "endpoint.h" #include "endpoint.h"
#include "pcm.h" #include "pcm.h"
#include "clock.h" #include "clock.h"
#include "stream.h"
/* /*
* handle the quirks for the contained interfaces * handle the quirks for the contained interfaces
...@@ -106,7 +107,7 @@ static int create_standard_audio_quirk(struct snd_usb_audio *chip, ...@@ -106,7 +107,7 @@ static int create_standard_audio_quirk(struct snd_usb_audio *chip,
alts = &iface->altsetting[0]; alts = &iface->altsetting[0];
altsd = get_iface_desc(alts); altsd = get_iface_desc(alts);
err = snd_usb_parse_audio_endpoints(chip, altsd->bInterfaceNumber); err = snd_usb_parse_audio_interface(chip, altsd->bInterfaceNumber);
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR "cannot setup if %d: error %d\n", snd_printk(KERN_ERR "cannot setup if %d: error %d\n",
altsd->bInterfaceNumber, err); altsd->bInterfaceNumber, err);
...@@ -147,7 +148,7 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip, ...@@ -147,7 +148,7 @@ static int create_fixed_stream_quirk(struct snd_usb_audio *chip,
stream = (fp->endpoint & USB_DIR_IN) stream = (fp->endpoint & USB_DIR_IN)
? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK; ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
err = snd_usb_add_audio_endpoint(chip, stream, fp); err = snd_usb_add_audio_stream(chip, stream, fp);
if (err < 0) { if (err < 0) {
kfree(fp); kfree(fp);
kfree(rate_table); kfree(rate_table);
...@@ -254,7 +255,7 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip, ...@@ -254,7 +255,7 @@ static int create_uaxx_quirk(struct snd_usb_audio *chip,
stream = (fp->endpoint & USB_DIR_IN) stream = (fp->endpoint & USB_DIR_IN)
? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK; ? SNDRV_PCM_STREAM_CAPTURE : SNDRV_PCM_STREAM_PLAYBACK;
err = snd_usb_add_audio_endpoint(chip, stream, fp); err = snd_usb_add_audio_stream(chip, stream, fp);
if (err < 0) { if (err < 0) {
kfree(fp); kfree(fp);
return err; return err;
......
This diff is collapsed.
#ifndef __USBAUDIO_STREAM_H
#define __USBAUDIO_STREAM_H
int snd_usb_parse_audio_interface(struct snd_usb_audio *chip,
int iface_no);
int snd_usb_add_audio_stream(struct snd_usb_audio *chip,
int stream,
struct audioformat *fp);
#endif /* __USBAUDIO_STREAM_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment