Commit 53837b4a authored by Takashi Iwai's avatar Takashi Iwai

ALSA: usb-audio: Replace slave/master terms

Follow the inclusive terminology, just replace sync_master/sync_slave
with sync_source/sync_sink.  It's also a bit clearer from its meaning,
too.
Tested-by: default avatarKeith Milner <kamilner@superlative.org>
Tested-by: default avatarDylan Robinson <dylan_robinson@motu.com>
Link: https://lore.kernel.org/r/20201123085347.19667-34-tiwai@suse.deSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 13ee0336
...@@ -71,8 +71,8 @@ struct snd_usb_endpoint { ...@@ -71,8 +71,8 @@ struct snd_usb_endpoint {
struct urb *urb); struct urb *urb);
struct snd_usb_substream *data_subs; struct snd_usb_substream *data_subs;
struct snd_usb_endpoint *sync_master; struct snd_usb_endpoint *sync_source;
struct snd_usb_endpoint *sync_slave; struct snd_usb_endpoint *sync_sink;
struct snd_urb_ctx urb[MAX_URBS]; struct snd_urb_ctx urb[MAX_URBS];
......
...@@ -175,7 +175,7 @@ int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep, ...@@ -175,7 +175,7 @@ int snd_usb_endpoint_next_packet_size(struct snd_usb_endpoint *ep,
{ {
if (ctx->packet_size[idx]) if (ctx->packet_size[idx])
return ctx->packet_size[idx]; return ctx->packet_size[idx];
else if (ep->sync_master) else if (ep->sync_source)
return slave_next_packet_size(ep); return slave_next_packet_size(ep);
else else
return next_packet_size(ep); return next_packet_size(ep);
...@@ -205,16 +205,16 @@ static void retire_inbound_urb(struct snd_usb_endpoint *ep, ...@@ -205,16 +205,16 @@ static void retire_inbound_urb(struct snd_usb_endpoint *ep,
struct snd_urb_ctx *urb_ctx) struct snd_urb_ctx *urb_ctx)
{ {
struct urb *urb = urb_ctx->urb; struct urb *urb = urb_ctx->urb;
struct snd_usb_endpoint *sync_slave; struct snd_usb_endpoint *sync_sink;
if (unlikely(ep->skip_packets > 0)) { if (unlikely(ep->skip_packets > 0)) {
ep->skip_packets--; ep->skip_packets--;
return; return;
} }
sync_slave = READ_ONCE(ep->sync_slave); sync_sink = READ_ONCE(ep->sync_sink);
if (sync_slave) if (sync_sink)
snd_usb_handle_sync_urb(sync_slave, ep, urb); snd_usb_handle_sync_urb(sync_sink, ep, urb);
call_retire_callback(ep, urb); call_retire_callback(ep, urb);
} }
...@@ -708,7 +708,7 @@ void snd_usb_endpoint_set_sync(struct snd_usb_audio *chip, ...@@ -708,7 +708,7 @@ void snd_usb_endpoint_set_sync(struct snd_usb_audio *chip,
struct snd_usb_endpoint *data_ep, struct snd_usb_endpoint *data_ep,
struct snd_usb_endpoint *sync_ep) struct snd_usb_endpoint *sync_ep)
{ {
data_ep->sync_master = sync_ep; data_ep->sync_source = sync_ep;
} }
/* /*
...@@ -802,7 +802,7 @@ static int wait_clear_urbs(struct snd_usb_endpoint *ep) ...@@ -802,7 +802,7 @@ static int wait_clear_urbs(struct snd_usb_endpoint *ep)
alive, ep->ep_num); alive, ep->ep_num);
clear_bit(EP_FLAG_STOPPING, &ep->flags); clear_bit(EP_FLAG_STOPPING, &ep->flags);
ep->sync_slave = NULL; ep->sync_sink = NULL;
snd_usb_endpoint_set_callback(ep, NULL, NULL, NULL); snd_usb_endpoint_set_callback(ep, NULL, NULL, NULL);
return 0; return 0;
...@@ -969,9 +969,9 @@ static int data_ep_set_params(struct snd_usb_endpoint *ep) ...@@ -969,9 +969,9 @@ static int data_ep_set_params(struct snd_usb_endpoint *ep)
packs_per_ms = 1; packs_per_ms = 1;
max_packs_per_urb = MAX_PACKS; max_packs_per_urb = MAX_PACKS;
} }
if (ep->sync_master && !ep->implicit_fb_sync) if (ep->sync_source && !ep->implicit_fb_sync)
max_packs_per_urb = min(max_packs_per_urb, max_packs_per_urb = min(max_packs_per_urb,
1U << ep->sync_master->syncinterval); 1U << ep->sync_source->syncinterval);
max_packs_per_urb = max(1u, max_packs_per_urb >> ep->datainterval); max_packs_per_urb = max(1u, max_packs_per_urb >> ep->datainterval);
/* /*
...@@ -1015,7 +1015,7 @@ static int data_ep_set_params(struct snd_usb_endpoint *ep) ...@@ -1015,7 +1015,7 @@ static int data_ep_set_params(struct snd_usb_endpoint *ep)
minsize = (ep->freqn >> (16 - ep->datainterval)) * minsize = (ep->freqn >> (16 - ep->datainterval)) *
(frame_bits >> 3); (frame_bits >> 3);
/* with sync from device, assume it can be 12% lower */ /* with sync from device, assume it can be 12% lower */
if (ep->sync_master) if (ep->sync_source)
minsize -= minsize >> 3; minsize -= minsize >> 3;
minsize = max(minsize, 1u); minsize = max(minsize, 1u);
...@@ -1272,8 +1272,8 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep) ...@@ -1272,8 +1272,8 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep)
if (atomic_read(&ep->chip->shutdown)) if (atomic_read(&ep->chip->shutdown))
return -EBADFD; return -EBADFD;
if (ep->sync_master) if (ep->sync_source)
WRITE_ONCE(ep->sync_master->sync_slave, ep); WRITE_ONCE(ep->sync_source->sync_sink, ep);
usb_audio_dbg(ep->chip, "Starting %s EP 0x%x (running %d)\n", usb_audio_dbg(ep->chip, "Starting %s EP 0x%x (running %d)\n",
ep_type_name(ep->type), ep->ep_num, ep_type_name(ep->type), ep->ep_num,
...@@ -1366,8 +1366,8 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep) ...@@ -1366,8 +1366,8 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep)
if (snd_BUG_ON(!atomic_read(&ep->running))) if (snd_BUG_ON(!atomic_read(&ep->running)))
return; return;
if (ep->sync_master) if (ep->sync_source)
WRITE_ONCE(ep->sync_master->sync_slave, NULL); WRITE_ONCE(ep->sync_source->sync_sink, NULL);
if (!atomic_dec_return(&ep->running)) if (!atomic_dec_return(&ep->running))
stop_and_unlink_urbs(ep, false, false); stop_and_unlink_urbs(ep, false, false);
......
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