Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Šerif Rami" <ramiserifpersia@gmail.com>
Cc: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/7] ALSA: usb-audio: us144mkii: Implement audio playback and feedback
Date: Tue, 12 Aug 2025 08:48:52 +0200	[thread overview]
Message-ID: <87sehxyqzv.wl-tiwai@suse.de> (raw)
In-Reply-To: <20250810124958.25309-4-ramiserifpersia@gmail.com>

On Sun, 10 Aug 2025 14:49:54 +0200,
Šerif Rami wrote:
> 
> +/**
> + * fpoInitPattern() - Generates a packet distribution pattern.
> + * @size: The number of elements in the pattern array (e.g., 8).
> + * @pattern_array: Pointer to the array to be populated.
> + * @initial_value: The base value to initialize each element with.
> + * @target_sum: The desired sum of all elements in the final array.
> + *
> + * This function initializes an array with a base value and then iteratively
> + * adjusts the elements to match a target sum, distributing the difference
> + * as evenly as possible.
> + */
> +static void fpoInitPattern(unsigned int size, unsigned int *pattern_array,
> +			   unsigned int initial_value, int target_sum)

Any need for camel case only for this?

> +int us144mkii_configure_device_for_rate(struct tascam_card *tascam, int rate)
> +{
> +	struct usb_device *dev = tascam->dev;
> +	u8 *rate_payload_buf;
> +	u16 rate_vendor_wValue;
> +	int err = 0;
> +	const u8 *current_payload_src;

Use __free(kfree) for temporary allocation/free for this function.

> @@ -36,29 +209,82 @@ int tascam_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
>  {
>  	struct tascam_card *tascam = snd_pcm_substream_chip(substream);
>  	int err = 0;
> +	int i;
> +	bool do_start = false;
> +	bool do_stop = false;
>  
> -	guard(spinlock_irqsave)(&tascam->lock);
> -	switch (cmd) {
> -	case SNDRV_PCM_TRIGGER_START:
> -	case SNDRV_PCM_TRIGGER_RESUME:
> -		if (!atomic_read(&tascam->playback_active)) {
> -			atomic_set(&tascam->playback_active, 1);
> -			atomic_set(&tascam->capture_active, 1);
> +	{
> +		guard(spinlock_irqsave)(&tascam->lock);

You can use scoped_guard() instead, e.g.

	scoped_guard(spinlock_irqsave, &tascam->lock) {
		switch (cmd) {
		.....
		}
	}


thanks,

Takashi

  reply	other threads:[~2025-08-12  6:48 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-10 12:49 [PATCH 0/7] ALSA: usb-audio: Add driver for TASCAM US-144MKII Šerif Rami
2025-08-10 12:49 ` [PATCH 1/7] ALSA: usb-audio: Add initial " Šerif Rami
2025-08-12  6:41   ` Takashi Iwai
2025-08-22 12:00     ` Markus Elfring
2025-08-10 12:49 ` [PATCH 2/7] ALSA: usb-audio: us144mkii: Add PCM core infrastructure Šerif Rami
2025-08-12  6:43   ` Takashi Iwai
2025-08-10 12:49 ` [PATCH 3/7] ALSA: usb-audio: us144mkii: Implement audio playback and feedback Šerif Rami
2025-08-12  6:48   ` Takashi Iwai [this message]
2025-08-10 12:49 ` [PATCH 4/7] ALSA: usb-audio: us144mkii: Implement audio capture and decoding Šerif Rami
2025-08-10 12:49 ` [PATCH 5/7] ALSA: usb-audio: us144mkii: Add MIDI support and mixer controls Šerif Rami
2025-08-12  6:59   ` Takashi Iwai
2025-08-10 12:49 ` [PATCH 6/7] ALSA: usb-audio: us144mkii: Add deep sleep and code style alignments Šerif Rami
2025-08-12  7:00   ` Takashi Iwai
2025-08-10 12:49 ` [PATCH 7/7] ALSA: usb-audio: Add infrastructure for TASCAM US-144MKII Šerif Rami
2025-08-12  7:01 ` [PATCH 0/7] ALSA: usb-audio: Add driver " Takashi Iwai
2025-08-12 12:56 ` [PATCH v2 " Šerif Rami
2025-08-12 12:56   ` [PATCH v2 1/7] ALSA: usb-audio: Add initial " Šerif Rami
2025-08-12 12:56   ` [PATCH v2 1/6] ALSA: usb-audio: us144mkii: Add PCM core infrastructure Šerif Rami
2025-08-12 12:56   ` [PATCH v2 2/7] " Šerif Rami
2025-08-12 12:56   ` [PATCH v2 2/6] ALSA: usb-audio: us144mkii: Implement audio playback and feedback Šerif Rami
2025-08-12 12:56   ` [PATCH v2 3/6] ALSA: usb-audio: us144mkii: Implement audio capture and decoding Šerif Rami
2025-08-12 12:56   ` [PATCH v2 3/7] ALSA: usb-audio: us144mkii: Implement audio playback and feedback Šerif Rami
2025-08-12 12:56   ` [PATCH v2 4/6] ALSA: usb-audio: us144mkii: Add MIDI support and mixer controls Šerif Rami
2025-08-12 12:56   ` [PATCH v2 4/7] ALSA: usb-audio: us144mkii: Implement audio capture and decoding Šerif Rami
2025-08-12 12:56   ` [PATCH v2 5/6] ALSA: usb-audio: us144mkii: Add deep sleep command Šerif Rami
2025-08-12 12:56   ` [PATCH v2 5/7] ALSA: usb-audio: us144mkii: Add MIDI support and mixer controls Šerif Rami
2025-08-12 12:56   ` [PATCH v2 6/6] ALSA: usb-audio: Add infrastructure for TASCAM US-144MKII Šerif Rami
2025-08-12 12:56   ` [PATCH v2 6/7] ALSA: usb-audio: us144mkii: Add deep sleep command Šerif Rami
2025-08-12 12:56   ` [PATCH v2 7/7] ALSA: usb-audio: Add infrastructure for TASCAM US-144MKII Šerif Rami
2025-08-12 13:22 ` [PATCH v3 0/7] ALSA: usb-audio: Add driver " Šerif Rami
2025-08-12 13:22   ` [PATCH v3 1/7] ALSA: usb-audio: Add initial " Šerif Rami
2025-08-13  8:34     ` Takashi Iwai
2025-08-12 13:22   ` [PATCH v3 2/7] ALSA: usb-audio: us144mkii: Add PCM core infrastructure Šerif Rami
2025-08-12 13:22   ` [PATCH v3 3/7] ALSA: usb-audio: us144mkii: Implement audio playback and feedback Šerif Rami
2025-08-13  8:38     ` Takashi Iwai
2025-08-12 13:22   ` [PATCH v3 4/7] ALSA: usb-audio: us144mkii: Implement audio capture and decoding Šerif Rami
2025-08-12 13:22   ` [PATCH v3 5/7] ALSA: usb-audio: us144mkii: Add MIDI support and mixer controls Šerif Rami
2025-08-12 13:22   ` [PATCH v3 6/7] ALSA: usb-audio: us144mkii: Add deep sleep command Šerif Rami
2025-08-12 13:22   ` [PATCH v3 7/7] ALSA: usb-audio: Add infrastructure for TASCAM US-144MKII Šerif Rami
2025-08-13  8:43   ` [PATCH v3 0/7] ALSA: usb-audio: Add driver " Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sehxyqzv.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=ramiserifpersia@gmail.com \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox