v4 patch series fixes

This commit is contained in:
Šerif Rami 2025-08-13 15:45:08 +02:00
parent 80fda86179
commit beaa28b590
2 changed files with 12 additions and 19 deletions

View File

@ -4,7 +4,7 @@
#include "us144mkii.h" #include "us144mkii.h"
/** /**
* fpoInitPattern() - Generates a packet distribution pattern. * fpo_init_pattern() - Generates a packet distribution pattern.
* @size: The number of elements in the pattern array (e.g., 8). * @size: The number of elements in the pattern array (e.g., 8).
* @pattern_array: Pointer to the array to be populated. * @pattern_array: Pointer to the array to be populated.
* @initial_value: The base value to initialize each element with. * @initial_value: The base value to initialize each element with.
@ -115,7 +115,6 @@ void process_capture_routing_us144mkii(struct tascam_card *tascam,
int us144mkii_configure_device_for_rate(struct tascam_card *tascam, int rate) int us144mkii_configure_device_for_rate(struct tascam_card *tascam, int rate)
{ {
struct usb_device *dev = tascam->dev; struct usb_device *dev = tascam->dev;
u8 *rate_payload_buf __free(kfree) = NULL; u8 *rate_payload_buf __free(kfree) = NULL;
u16 rate_vendor_wValue; u16 rate_vendor_wValue;
int err = 0; int err = 0;
@ -209,7 +208,6 @@ int us144mkii_configure_device_for_rate(struct tascam_card *tascam, int rate)
USB_CTRL_TIMEOUT_MS); USB_CTRL_TIMEOUT_MS);
if (err < 0) if (err < 0)
goto fail; goto fail;
return 0; return 0;
fail: fail:

View File

@ -182,9 +182,7 @@ void playback_urb_complete(struct urb *urb)
goto out; goto out;
runtime = substream->runtime; runtime = substream->runtime;
{ scoped_guard(spinlock_irqsave, &tascam->lock) {
guard(spinlock_irqsave)(&tascam->lock);
for (i = 0; i < urb->number_of_packets; i++) { for (i = 0; i < urb->number_of_packets; i++) {
unsigned int frames_for_packet; unsigned int frames_for_packet;
size_t bytes_for_packet; size_t bytes_for_packet;
@ -290,12 +288,11 @@ void feedback_urb_complete(struct urb *urb)
capture_ss = tascam->capture_substream; capture_ss = tascam->capture_substream;
capture_rt = capture_ss ? capture_ss->runtime : NULL; capture_rt = capture_ss ? capture_ss->runtime : NULL;
scoped_guard(spinlock_irqsave, &tascam->lock)
{ {
guard(spinlock_irqsave)(&tascam->lock);
if (tascam->feedback_urb_skip_count > 0) { if (tascam->feedback_urb_skip_count > 0) {
tascam->feedback_urb_skip_count--; tascam->feedback_urb_skip_count--;
goto continue_unlock; break;
} }
old_in_idx = tascam->feedback_pattern_in_idx; old_in_idx = tascam->feedback_pattern_in_idx;
@ -314,8 +311,8 @@ void feedback_urb_complete(struct urb *urb)
if (packet_ok) { if (packet_ok) {
int delta = feedback_value - int delta = feedback_value -
tascam->fpo.base_feedback_value + tascam->fpo.base_feedback_value +
tascam->fpo.feedback_offset; tascam->fpo.feedback_offset;
int pattern_idx; int pattern_idx;
if (delta < 0) { if (delta < 0) {
@ -356,9 +353,9 @@ void feedback_urb_complete(struct urb *urb)
dev_err(tascam->card->dev, dev_err(tascam->card->dev,
"Fatal: Feedback sync lost. Stopping stream.\n"); "Fatal: Feedback sync lost. Stopping stream.\n");
schedule_work( schedule_work(
&tascam->stop_pcm_work); &tascam->stop_pcm_work);
tascam->feedback_synced = false; tascam->feedback_synced = false;
goto continue_unlock; break;
} }
} }
for (i = 0; i < 8; i++) { for (i = 0; i < 8; i++) {
@ -385,8 +382,8 @@ void feedback_urb_complete(struct urb *urb)
FEEDBACK_ACCUMULATOR_SIZE < FEEDBACK_ACCUMULATOR_SIZE <
(FEEDBACK_ACCUMULATOR_SIZE / 2); (FEEDBACK_ACCUMULATOR_SIZE / 2);
bool was_behind = (old_in_idx - out_idx) % bool was_behind = (old_in_idx - out_idx) %
FEEDBACK_ACCUMULATOR_SIZE >= FEEDBACK_ACCUMULATOR_SIZE >=
(FEEDBACK_ACCUMULATOR_SIZE / 2); (FEEDBACK_ACCUMULATOR_SIZE / 2);
if (is_ahead && was_behind) { if (is_ahead && was_behind) {
dev_dbg(tascam->card->dev, dev_dbg(tascam->card->dev,
@ -407,7 +404,7 @@ void feedback_urb_complete(struct urb *urb)
if (playback_rt->period_size > 0) { if (playback_rt->period_size > 0) {
u64 current_period = u64 current_period =
div_u64(tascam->playback_frames_consumed, div_u64(tascam->playback_frames_consumed,
playback_rt->period_size); playback_rt->period_size);
if (current_period > tascam->last_period_pos) { if (current_period > tascam->last_period_pos) {
tascam->last_period_pos = current_period; tascam->last_period_pos = current_period;
@ -419,7 +416,7 @@ void feedback_urb_complete(struct urb *urb)
capture_rt->period_size > 0) { capture_rt->period_size > 0) {
u64 current_capture_period = u64 current_capture_period =
div_u64(tascam->capture_frames_processed, div_u64(tascam->capture_frames_processed,
capture_rt->period_size); capture_rt->period_size);
if (current_capture_period > if (current_capture_period >
tascam->last_capture_period_pos) { tascam->last_capture_period_pos) {
@ -429,8 +426,6 @@ void feedback_urb_complete(struct urb *urb)
} }
} }
} }
continue_unlock:
if (playback_period_elapsed) if (playback_period_elapsed)
snd_pcm_period_elapsed(playback_ss); snd_pcm_period_elapsed(playback_ss);
if (capture_period_elapsed) if (capture_period_elapsed)