diff options
author | Takashi Iwai <tiwai@suse.de> | 2020-11-23 09:53:24 +0100 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2020-11-23 15:14:09 +0100 |
commit | d767aba2023c80ff0247b45526358d9a30af8293 (patch) | |
tree | e2ccf0bd0031c9e9a5c2ab57fb21e10d73cf7a35 /sound/usb/pcm.c | |
parent | c7f902015e1e86117e6cd3dde17d5964d88a9559 (diff) |
ALSA: usb-audio: Pass snd_usb_audio object to quirk functions
A preliminary patch for the later big change. Just a minor code
refactoring.
Tested-by: Keith Milner <kamilner@superlative.org>
Tested-by: Dylan Robinson <dylan_robinson@motu.com>
Link: https://lore.kernel.org/r/20201123085347.19667-19-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb/pcm.c')
-rw-r--r-- | sound/usb/pcm.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index b0961ebd71f4..2518d4c82ad5 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c @@ -553,6 +553,7 @@ static int set_sync_endpoint(struct snd_usb_substream *subs, { struct usb_device *dev = subs->dev; struct usb_host_interface *alts; + struct snd_usb_audio *chip = subs->stream->chip; int is_playback = subs->direction == SNDRV_PCM_STREAM_PLAYBACK; unsigned int ep; int err; @@ -569,7 +570,7 @@ static int set_sync_endpoint(struct snd_usb_substream *subs, if (!alts) return 0; - subs->sync_endpoint = snd_usb_get_endpoint(subs->stream->chip, ep); + subs->sync_endpoint = snd_usb_get_endpoint(chip, ep); if (!subs->sync_endpoint) { if (is_playback && (fmt->ep_attr & USB_ENDPOINT_SYNCTYPE) == USB_ENDPOINT_SYNC_NONE) @@ -596,7 +597,7 @@ static int set_sync_endpoint(struct snd_usb_substream *subs, dev_dbg(&dev->dev, "setting usb interface %d:%d\n", subs->sync_endpoint->iface, subs->sync_endpoint->altsetting); - snd_usb_set_interface_quirk(dev); + snd_usb_set_interface_quirk(chip); } return 0; @@ -608,6 +609,7 @@ static int set_sync_endpoint(struct snd_usb_substream *subs, static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt) { struct usb_device *dev = subs->dev; + struct snd_usb_audio *chip = subs->stream->chip; struct usb_host_interface *alts; struct usb_interface *iface; struct snd_usb_endpoint *ep; @@ -625,7 +627,7 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt) /* shared EP with implicit fb */ if (fmt->implicit_fb && !subs->need_setup_fmt) { - ep = snd_usb_get_endpoint(subs->stream->chip, fmt->endpoint); + ep = snd_usb_get_endpoint(chip, fmt->endpoint); if (ep && ep->use_count > 0) goto add_data_ep; } @@ -648,7 +650,7 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt) /* set interface */ if (iface->cur_altsetting != alts) { - err = snd_usb_select_mode_quirk(subs, fmt); + err = snd_usb_select_mode_quirk(chip, fmt); if (err < 0) return -EIO; @@ -661,7 +663,7 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt) } dev_dbg(&dev->dev, "setting usb interface %d:%d\n", fmt->iface, fmt->altsetting); - snd_usb_set_interface_quirk(dev); + snd_usb_set_interface_quirk(chip); } subs->need_setup_ep = true; @@ -669,8 +671,7 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt) add_data_ep: subs->interface = fmt->iface; subs->altset_idx = fmt->altset_idx; - subs->data_endpoint = snd_usb_get_endpoint(subs->stream->chip, - fmt->endpoint); + subs->data_endpoint = snd_usb_get_endpoint(chip, fmt->endpoint); if (!subs->data_endpoint) return -EINVAL; subs->data_endpoint->iface = fmt->iface; @@ -681,7 +682,7 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt) return err; if (subs->need_setup_ep) { - err = snd_usb_init_pitch(subs->stream->chip, fmt->iface, alts, fmt); + err = snd_usb_init_pitch(chip, fmt->iface, alts, fmt); if (err < 0) return err; } |