From patchwork Mon Aug 5 00:37:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13752849 Received: from OS0P286CU011.outbound.protection.outlook.com (mail-japanwestazon11010045.outbound.protection.outlook.com [52.101.228.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5AF82AD5F for ; Mon, 5 Aug 2024 00:37:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.228.45 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722818254; cv=fail; b=r2r/xEu9lyV6tEBb6fJelfBL0oG9gu/U8HXU+yDsmlv70v5iGukgXla2NXKh2VKBDuP7amzSeHEtjNpFc5Tejctzz7dEHqquLeTliZG5Ontm+mnNZ9jSys2/qQe70+PAIAIGHIv/QlJmFzYG1vFtMrSVFoJ6BwPvCJA8rGKjezo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722818254; c=relaxed/simple; bh=BZvktJfse6DJvdv1KZoBYZ/DlJ6YUma/3x69Hgn3tHY=; h=Message-ID:From:Subject:To:Cc:In-Reply-To:References:Content-Type: Date:MIME-Version; b=GkEcvXGU9XPh9EvJwT4hLosAXevPRXsMsWzcaWL+SUT3V2jSo4qexmR+/WndE0qaa1OlJ8HnQBE/YNgm/SY5YZAvpbL46V3/s7HeGY/iVcTlJ4kQQorahCQQUjnUOQRmYRyivRDVm5vyLsK9Tep0LwgYp/UM80fTyM3asTgEPEM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b=dzjgFphK; arc=fail smtp.client-ip=52.101.228.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b="dzjgFphK" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LOGp/HEc2nzEByAmShfx+Au9yxNnSffzAt2hnd1rxybe4ullej3j6OJTCWZS7m9qywUxf6p3gLDPxCfA4pHvIbTUx0HtS4tFXUG/YcSX1wePQNJMApjSDLwEgrmjROkcNE4IedaI1R9oM52Nj8mrpnuYlA88v7MmMlDoA4s7IWo21EoRVjXJO2HsOSR0X1RTXdJvCYj1jRkpC9X3PKgw/hos/K/mfLvvCL2Z9LjP98sOA1jxu9zUVbXm6TdqWd4onaMLFd5IiQ8pH+wQv91feWIktn7GMPAPThkSnhNgYk/crZMhL3nU4BhFxpYvUSIY+Ld+W8PYtk5nkOtN8RbsXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=cU8s26hr/REx39uwIqvIC6UC8Mih1rf08xzWkM0Mq3U=; b=LVtUQdRhS60h1tkGpO3efm6qljAOJkOkF69oZj6LArbqdk0ShikKjzbUe5xaSZxY20QXLXpOp/iPBrUr7q9L9g4JVHkVPvGoh2DOotABUvYMfpAFKKBbhyZNEuiK1di+xLR5Hr5b0n/lsQUQ/01iX6ys58s+8W5cgiumCDdMl+Os+NOzBiAKjQ5TtcFQ4hoUhDlwq5qg4a4AryA3/Lq6MLiRxZ125kwRtxsHhNClF8XP2uL/HSp8LI96tiLwJUnQrlkXI5NNuqcA3xWYeieJTuoWEyJ2KpvxoMRtA9yvu74qGb7BmMq7UIA05Ve1NJZiKrsTODkqgKpr1IVkNQpt0w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=cU8s26hr/REx39uwIqvIC6UC8Mih1rf08xzWkM0Mq3U=; b=dzjgFphKVn5QqQ7ooyXurVP7ra3+UgofyunfBWCkNpTXaij+4iVoTG+AemQFtRKEdq9kdL/pSWavT2Blj93/O/tV/wfpvQTAhxejzDAM62d423dYhxRFy3P6zl2memiKFIZH1jWFDj/R0ZwXEPQ4qqB3s4aqW8REZKoXLnLMurk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by TYCPR01MB6318.jpnprd01.prod.outlook.com (2603:1096:400:7a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.25; Mon, 5 Aug 2024 00:37:29 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.7828.023; Mon, 5 Aug 2024 00:37:29 +0000 Message-ID: <87v80fztx3.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 031/113] ALSA: core: oss: use snd_pcm_is_playback/capture() User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 To: Mark Brown Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-staging@lists.linux.dev, Linux-ALSA In-Reply-To: <874j7z3j1a.wl-kuninori.morimoto.gx@renesas.com> References: <874j7z3j1a.wl-kuninori.morimoto.gx@renesas.com> Date: Mon, 5 Aug 2024 00:37:28 +0000 X-ClientProxiedBy: TYWPR01CA0031.jpnprd01.prod.outlook.com (2603:1096:400:aa::18) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYCPR01MB6318:EE_ X-MS-Office365-Filtering-Correlation-Id: edc7e49b-ab78-4e1b-772b-08dcb4e6c918 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: 8h+awG9Ihi2jOe4vKB8dAVS5sL/epIDj4+8Vtp00Sqy4WJqNIVfTNThGHGun9drPrt3Qz8wMka/2wx9t8AJh3WxLM+uDIV5OMThFtAjhBmvDvDuq1q0aqjGqp/l8/lahS2KalRkqfKXZjfpqVkWD3cmhw2wg00KLB6dFOibXAnOB6e9ObVKoLfDV37MfREImvAmDkrXKTTROOw8QDans9SQ/06PPjCXJZTctnjquA2e/GqZ7d9PPweXZejcpdwqgSTVqYfBzEZ5ZpZT/rpR4MFMFBWcZiZHmDVu+5Sq7Vp+bVSgnb5rZpqQPZ9KZD2moOUxDKwnheZmBPo9K2p3zP+Q9WHAFI4Gdv5Zyg8xilBMPuqDZV0haMuTHw8ZyzfvF53tfiqbh0gvEgFHdMJisZ3LlH8+/NGS8ABvL4bjecnY+PLUzeNT64ULkLknQOtq/HZRx3JTKQIYxJUrjYtkAWMtBJY/IsdbC5qs237b5okomTWaHX9m3aZMGaYjnpUajXLn8FzfCasvnfeZ2fuFqm6IFAd2NDrcfNA3nP/QV0C2r9eDpzXH/xBZXQDF92R0wbyucCaKaxIy6BMUgJF0flCE4oHeUAy0PHp6eW5GYiXHQ1FALXTPzG47VceJsuh6DL1wxz/HFHAblVDtcr7KgC6madorn0MSEFsYaJiyqDZW02iNUXJulQMuTPzHIdB4Z9gfAL+6pLUFiCPpwNEQYYZ2cUZZWADkvofpOGcFPJEuOy3y+ai3hFpoUTqsGgp4KMWQ2z+aozCq4VdOOgW20iwI80YbS8t3e/4CV26LZs9DIR7T0TeWS9HbCEWHRyUvAy3NZCm59LPUEZkqFWvYjCzC3LnhVs1lzK0bI141V45h1YhUmxY1sNR1HOU7lLyhtjDX3Gj8HH1YMcH+lat40/3KoNSz+JMXlhfqMACP7bp3i4MZGol32REbndMY5axqKWG/8h11dXXHke0++ovLEHxcbjMSE/C3xYKH1tr6borknI0Ks+4SKfGAoDfA23NRSlAFfUbReKEhvnVCsxD3vnRTBQC8Hwvsjep0Wk3RoJfCw+EZavsQDjE1fm55J8ksnJ/bJnTJbSsFMSRhNkfpVPFijv+ics6qm8WOZ5nYfnfmlqzWeUCBi+D3OJ1N1f6vsD7MgzNBLXTmDkd0k49T/nhSl1CgYU88Y33ZpCRzAv2jqFbMP1CdjykDS5SJeJ8ERdxW+VWXDRMtQbxm1nyN92Y5temHiUK49GgcUwnz6fSaHioeVMM3FPnbuYZJH/CXwKJc559/M35herxqsQob54qGSIW7ZiUGWkcd7/kPtxiD1DG35ak+qFrgVviKtt+hn7bSOsxPaAB8QrdHOdG994PP1UABlXlJZGDWGwihcPcoxfczUEEjlIKfOXyooNumXNNXP4/M6ZejkZtEEBcYj9Q== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYCPR01MB10914.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 9F9tzpZK3CAaetxPKEsCpDIoRsWucObyyXmDeGf8QoY+n01kXhJOuWA+B8JjMIsguUZvcx2htU/UBgaQ/y9ugVA1qpeb8ktMm4Kzk2XOtDhqkoZpTrcPZRqpO9dbFvLZhtee6hWhEFmDltTduYijWKbyR8SiA8PemGTDBqGUKciKRCGUPsKYQO3HFGLr+zCMxKG0CF4ZqaSBBKXRM6NH0iwHSa59LukD84AiTLAl2ZgtL2QH6c8M+rp/S/dJFNTNaVO5QJ8B7AOxzkmgkhoUiy9xapRfJLfucVvI30n7Dk401oiriFLx/oSe5inrxZ6PyCkN45tNprRBRwXeMyU99idmpr3r3CppWyApCWKpXgt7htQOkkxp2/grHflVTnqiTpfUtLQTHzgV2lB3QShkbPUWoP8R/JMgA780B9emZE4Ikic1zRQo9TkjnqBhEKhJSiLOr4/B8H0P3ni3WeulTbfFBNexYFOQOF0Qe89RwQflCPT1LqlUJNewNmEIB8fdLtKFAz/Fq21Ey4BX4y7SC4sKCaCFRpAriBVTLLx1WunBtRlyMg33pt39ua1lBISg6gwGD3jXPysPcRMXDPGKWbylLGU2u0AZe+NkArDJW0cQ84/6T2v5fgEWBT/uT37eUSRCuWpGbtBA6ky8R2Rk7QuQN60Luu2kToinlTEpg8UF0nBmDV0ByL3ppwYBOBqG0ymzapuNdO7lp26yyDsQyMzlkAzdcYjpLqImqVvdzlwIzhHIN103UgvL6cJQG031E2J/nJ2sUDgeqZeMRufFVzd3HURFnN6cdsLh1Yoc0OgSWiZ0Ndf5INbOiAVet5mJ3iP7hQ5NjcSdPAjCM/CQ5Qx+s7bH6TLJmKylAg+EjFOTI9aGBG0udoRsoj5XAqfSqhMj1WV91s0u1Id7wO039koR83/PFmu3YgX3ilyYc707voCGHXOorsxOq8ojJiyRjyocucxkds9PYd/SlNbGW3k2Ir+sEpYK5RldJGzF3wCTjbdOrG0fgWjtoaCMQd87jzR4i6g4+mmqVomlgsc2I0MAx0Lalv7yvIgA9NLYhGlMvPAq9ognJAhoEWUjhJod7N+cIqhtrF/Etl4Dgq9k+f7km0x/N6htFR7/+rnTuJCfPzUwLnDDbKSwmcNXnUAPCiC+bUtG126+T4Q2ApY90khRQaRbSP6wtsyMP2THJLythIl5Bi13XyPn9C5RPbcEA1gK4FsCHZjOH4n9H3w/Frg+y262jEbFa8EYJ7CHdCg0k2z+iMMGbOQmg8iGPaExLF3SvM+vKjGiWrDqK8pKwIhfOJ++Z/sv86ZkktE/2p+6PfDDfx/2UPUu6yeBCNHI7KBlb4HsE8Y2GCdLiQXoDpppJMo9EBgW7w8r8wQwiicfJKY0EIKUtyOp2zUc+rgkm6p4M2ScwSsZBISJXnixTfPXrie8J33vjN8on+revjocAMtZIXHgdqDs53CTlaz9qJX4S6PCJip3I4f0ZNxTayO+UQyRvM6JEXZ+HrBrHtBsgqlrgEL92muEiA/4fu2z6zTXCTV9988+0GEhrldK7ww0pCeLMzKUoikexbcwPv980xeNx/NKqABGs6bIs1mwLc29ilQsNd5MfJiDLYU0i7lAWtGirPa0yVcgT5PD+nw= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: edc7e49b-ab78-4e1b-772b-08dcb4e6c918 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Aug 2024 00:37:29.0137 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: n0yIdWpWn2E2KmJSVD13k11bXHxGVwutXTbGWvqeZEWLMTH6Lh8l9u1NrHojK0B7uohcV69Gv/gsJ0xHsGs2+VMb52dXWShqsxEMJllWIZ2h7Q2owh3vSoNjcCb5hmT5 X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB6318 We can use snd_pcm_is_playback/capture(). Let's use it. Signed-off-by: Kuninori Morimoto --- sound/core/oss/io.c | 2 +- sound/core/oss/pcm_oss.c | 20 ++++++++++---------- sound/core/oss/pcm_plugin.c | 10 +++++----- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/sound/core/oss/io.c b/sound/core/oss/io.c index d870b2d93135d..86d25f2e01ea6 100644 --- a/sound/core/oss/io.c +++ b/sound/core/oss/io.c @@ -128,7 +128,7 @@ int snd_pcm_plugin_build_io(struct snd_pcm_substream *plug, if (err < 0) return err; plugin->access = params_access(params); - if (snd_pcm_plug_stream(plug) == SNDRV_PCM_STREAM_PLAYBACK) { + if (snd_pcm_is_playback(snd_pcm_plug_stream(plug))) { plugin->transfer = io_playback_transfer; if (plugin->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED) plugin->client_channels = io_src_channels; diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c index 7386982cf40ed..aeaf9c69e791f 100644 --- a/sound/core/oss/pcm_oss.c +++ b/sound/core/oss/pcm_oss.c @@ -986,7 +986,7 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream) "snd_pcm_plugin_build_io failed: %i\n", err); goto failure; } - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { + if (snd_pcm_is_playback(substream)) { err = snd_pcm_plugin_append(plugin); } else { err = snd_pcm_plugin_insert(plugin); @@ -1003,13 +1003,13 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream) sw_params->start_threshold = runtime->boundary; } if (atomic_read(&substream->mmap_count) || - substream->stream == SNDRV_PCM_STREAM_CAPTURE) + snd_pcm_is_capture(substream)) sw_params->stop_threshold = runtime->boundary; else sw_params->stop_threshold = runtime->buffer_size; sw_params->tstamp_mode = SNDRV_PCM_TSTAMP_NONE; sw_params->period_step = 1; - sw_params->avail_min = substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? + sw_params->avail_min = snd_pcm_is_playback(substream) ? 1 : runtime->period_size; if (atomic_read(&substream->mmap_count) || substream->oss.setup.nosilence) { @@ -2017,7 +2017,7 @@ static int snd_pcm_oss_get_caps1(struct snd_pcm_substream *substream, int res) return res; } #ifdef DSP_CAP_MULTI - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + if (snd_pcm_is_playback(substream)) if (substream->pstr->substream_count > 1) res |= DSP_CAP_MULTI; #endif @@ -2201,7 +2201,7 @@ static int snd_pcm_oss_get_ptr(struct snd_pcm_oss_file *pcm_oss_file, int stream return -EFAULT; return 0; } - if (stream == SNDRV_PCM_STREAM_PLAYBACK) { + if (snd_pcm_is_playback(stream)) { err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &delay); if (err == -EPIPE || err == -ESTRPIPE || (! err && delay < 0)) { err = 0; @@ -2225,12 +2225,12 @@ static int snd_pcm_oss_get_ptr(struct snd_pcm_oss_file *pcm_oss_file, int stream n += runtime->boundary; info.blocks = n / runtime->period_size; runtime->oss.prev_hw_ptr_period = delay; - if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) + if (snd_pcm_is_playback(substream)) snd_pcm_oss_simulate_fill(substream, delay); info.bytes = snd_pcm_oss_bytes(substream, runtime->status->hw_ptr) & INT_MAX; } else { delay = snd_pcm_oss_bytes(substream, delay); - if (stream == SNDRV_PCM_STREAM_PLAYBACK) { + if (snd_pcm_is_playback(stream)) { if (substream->oss.setup.buggyptr) info.blocks = (runtime->oss.buffer_bytes - delay - fixup) / runtime->oss.period_bytes; else @@ -2272,7 +2272,7 @@ static int snd_pcm_oss_get_space(struct snd_pcm_oss_file *pcm_oss_file, int stre info.fragsize = runtime->oss.period_bytes; info.fragstotal = runtime->periods; if (runtime->oss.prepare) { - if (stream == SNDRV_PCM_STREAM_PLAYBACK) { + if (snd_pcm_is_playback(stream)) { info.bytes = runtime->oss.period_bytes * runtime->oss.periods; info.fragments = runtime->oss.periods; } else { @@ -2280,7 +2280,7 @@ static int snd_pcm_oss_get_space(struct snd_pcm_oss_file *pcm_oss_file, int stre info.fragments = 0; } } else { - if (stream == SNDRV_PCM_STREAM_PLAYBACK) { + if (snd_pcm_is_playback(stream)) { err = snd_pcm_kernel_ioctl(substream, SNDRV_PCM_IOCTL_DELAY, &avail); if (err == -EPIPE || err == -ESTRPIPE || (! err && avail < 0)) { avail = runtime->buffer_size; @@ -2429,7 +2429,7 @@ static int snd_pcm_oss_open_file(struct file *file, continue; if (! pcm->streams[idx].substream_count) continue; /* no matching substream */ - if (idx == SNDRV_PCM_STREAM_PLAYBACK) { + if (snd_pcm_is_playback(idx)) { if (! (f_mode & FMODE_WRITE)) continue; } else { diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c index 82e180c776ae1..47168e175c966 100644 --- a/sound/core/oss/pcm_plugin.c +++ b/sound/core/oss/pcm_plugin.c @@ -54,7 +54,7 @@ static int snd_pcm_plugin_alloc(struct snd_pcm_plugin *plugin, snd_pcm_uframes_t unsigned int channel; struct snd_pcm_plugin_channel *c; - if (plugin->stream == SNDRV_PCM_STREAM_PLAYBACK) { + if (snd_pcm_is_playback(plugin->stream)) { format = &plugin->src_format; } else { format = &plugin->dst_format; @@ -110,7 +110,7 @@ int snd_pcm_plug_alloc(struct snd_pcm_substream *plug, snd_pcm_uframes_t frames) int err; if (snd_BUG_ON(!snd_pcm_plug_first(plug))) return -ENXIO; - if (snd_pcm_plug_stream(plug) == SNDRV_PCM_STREAM_PLAYBACK) { + if (snd_pcm_is_playback(snd_pcm_plug_stream(plug))) { struct snd_pcm_plugin *plugin = snd_pcm_plug_first(plug); while (plugin->next) { if (plugin->dst_frames) @@ -174,7 +174,7 @@ int snd_pcm_plugin_build(struct snd_pcm_substream *plug, plugin->dst_format = *dst_format; plugin->dst_width = snd_pcm_format_physical_width(dst_format->format); snd_BUG_ON(plugin->dst_width <= 0); - if (plugin->stream == SNDRV_PCM_STREAM_PLAYBACK) + if (snd_pcm_is_playback(plugin->stream)) channels = src_format->channels; else channels = dst_format->channels; @@ -567,7 +567,7 @@ snd_pcm_sframes_t snd_pcm_plug_client_channels_buf(struct snd_pcm_substream *plu if (snd_BUG_ON(!buf)) return -ENXIO; - if (stream == SNDRV_PCM_STREAM_PLAYBACK) { + if (snd_pcm_is_playback(stream)) { plugin = snd_pcm_plug_first(plug); format = &plugin->src_format; } else { @@ -586,7 +586,7 @@ snd_pcm_sframes_t snd_pcm_plug_client_channels_buf(struct snd_pcm_substream *plu for (channel = 0; channel < nchannels; channel++, v++) { v->frames = count; v->enabled = 1; - v->wanted = (stream == SNDRV_PCM_STREAM_CAPTURE); + v->wanted = snd_pcm_is_capture(stream); v->area.addr = buf; v->area.first = channel * width; v->area.step = nchannels * width;