[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <s5htupwjve8.wl-tiwai@suse.de>
Date: Sun, 28 Feb 2021 12:15:27 +0100
From: Takashi Iwai <tiwai@...e.de>
To: Anton Yakovlev <anton.yakovlev@...nsynergy.com>
Cc: <virtualization@...ts.linux-foundation.org>,
<alsa-devel@...a-project.org>, <virtio-dev@...ts.oasis-open.org>,
"Michael S. Tsirkin" <mst@...hat.com>,
Jaroslav Kysela <perex@...ex.cz>,
Takashi Iwai <tiwai@...e.com>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v6 4/9] ALSA: virtio: build PCM devices and substream hardware descriptors
On Sat, 27 Feb 2021 09:59:51 +0100,
Anton Yakovlev wrote:
> +static int virtsnd_pcm_build_hw(struct virtio_pcm_substream *vss,
> + struct virtio_snd_pcm_info *info)
> +{
....
> + for (i = 0; i < ARRAY_SIZE(g_v2a_format_map); ++i)
> + if (values & (1ULL << i)) {
> + snd_pcm_format_t alsa_fmt = g_v2a_format_map[i];
> + int bytes = snd_pcm_format_physical_width(alsa_fmt) / 8;
> +
> + if (!sample_min || sample_min > bytes)
> + sample_min = bytes;
> +
> + if (sample_max < bytes)
> + sample_max = bytes;
> +
> + vss->hw.formats |= (1ULL << (__force int)alsa_fmt);
Please use pcm_format_to_bits().
> + /* Align the buffer size to the page size */
> + vss->hw.buffer_bytes_max =
> + (vss->hw.buffer_bytes_max + PAGE_SIZE - 1) & -PAGE_SIZE;
You can use PAGE_ALIGN() macro.
thanks,
Takashi
Powered by blists - more mailing lists