Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2497341pxb; Sun, 28 Feb 2021 03:17:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJybN7qspKQCpnJkg6KoZrKhM6nzjsrSiDTKpm2FGWS5vS43XJoMv4BprI1ni33GfwQYqE0n X-Received: by 2002:a17:906:38da:: with SMTP id r26mr622644ejd.251.1614511028249; Sun, 28 Feb 2021 03:17:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614511028; cv=none; d=google.com; s=arc-20160816; b=penQjC+XQsjrUeX+t85GrpH2YQagg8jqfmcOFLJS8losieWrdupvgebHNwxD99OBJB 5YYDybO0+s7w360LfgHiGLtK3NKCXZ8WJ7Uiw9/gIdLUx/BO4crXfCOE+zAFoA/XVgiu h3SJDZzMX6jB8/SZ0rLHwpQ/uA8oWNmBeUJouCi04XTsP4yct6WcrmLCtW5JDgvSQbbI Mly/IC4Ny2Qhtalwm+FkpC/hpG4Ifnggaj/Hvr/CWlruKqolb8EK/q8gP6ptv8R7AIFJ mW7Vya65TYcZEIdOIsTC1Tms3ZgTrGvL5xUcUFaOexg6QsltuzBhyWkHuZv9ov3Icuad J5HQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:in-reply-to :subject:cc:to:from:message-id:date; bh=7hRqtF56PMpfP8HhmkPU3/N4Dmz3q1owgXh7cojtowk=; b=bGO1Kd8gZxcQSiwzvpqYwYrCRKdIQbTRXIHqzZ+b1YoSiLEkQiFp1o1HPgvSzJee9V o8HLNt8h9dD4nCiqLs4TkVIkvKVjm0O3WeaQ82uYoALtWAG0r7Q3mNo24/XZbeMwa+JA UTiwlhNZhs4e5ZKSXiez9aHUNUG3p+OXT1UheMXlhfkzUhWVmy/gv5Ne4cR9+R5oaoNa l/ZpCzfzm2/GWLHP9HOXOy4hg8EcjtN11uYIKezXoArrqvDEekngsVnNU9JJnh+wmJxH kG4vC2U8C+imND1SAxp2itVaURK1yrT7AoenJm+f5RnzjRz7+PmpZ1UO3UEQ6E44qfO7 xRKQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m12si6089598ejx.720.2021.02.28.03.16.46; Sun, 28 Feb 2021 03:17:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230390AbhB1LQK (ORCPT + 99 others); Sun, 28 Feb 2021 06:16:10 -0500 Received: from mx2.suse.de ([195.135.220.15]:38964 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230165AbhB1LQJ (ORCPT ); Sun, 28 Feb 2021 06:16:09 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A833DAB7D; Sun, 28 Feb 2021 11:15:27 +0000 (UTC) Date: Sun, 28 Feb 2021 12:15:27 +0100 Message-ID: From: Takashi Iwai To: Anton Yakovlev Cc: , , , "Michael S. Tsirkin" , Jaroslav Kysela , Takashi Iwai , Subject: Re: [PATCH v6 4/9] ALSA: virtio: build PCM devices and substream hardware descriptors In-Reply-To: <20210227085956.1700687-5-anton.yakovlev@opensynergy.com> References: <20210227085956.1700687-1-anton.yakovlev@opensynergy.com> <20210227085956.1700687-5-anton.yakovlev@opensynergy.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/25.3 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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