From patchwork Wed Aug 7 15:27:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 13756433 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9060384A31 for ; Wed, 7 Aug 2024 15:26:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723044413; cv=none; b=IxGXgJA9kfsY89wBfCaMpY/MT3SwmmARP+m2ivNW8xLAqnJaihQcEHJFt7VIsdQf754ngVdvCL7QpUfZtWgdF7tnqGKr/J+GWhoByCd666kwccdYlOUBtiRtS1f9JXx+aorDPFGmUVXFcABUW4dI6h/1xSMSp0REFF6rrU+vens= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723044413; c=relaxed/simple; bh=ZpR4IYd5059GJ5+Gkzk/kISf8y3KUd8k6zEEoE3QmM0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=u4yeJ3jym7KzOx6xsDcwXsyK8tGQroKPzhhg35IPdFWyHyc5RIoMi5JZ281B/uB7qTjDXd4WlIfHQoWEn/uFwlTDh4cNCAg7QX6DV+slDm3tPrDMvkQyBgRkHLVdI+27hbZccVWngOmq+vuqW0KaMKm/1cOLTsISorDb7aIPx30= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=zyqJ3DYa; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=3+CHSE4Y; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=zyqJ3DYa; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=3+CHSE4Y; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="zyqJ3DYa"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="3+CHSE4Y"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="zyqJ3DYa"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="3+CHSE4Y" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 91DD41FB96; Wed, 7 Aug 2024 15:26:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1723044409; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K8WMcN5aTLqlNS8KglPxh5aEU6v/N8Os3PDJA9fbZ3I=; b=zyqJ3DYamR7kHubC7o/Z4M3/7ygkweW9f0yuYuPBQ0rFIzc9R+UMXrmCLbdOqlLv44HfXR ieHL38SUxCwezYaEpc7qbyntDdLyrW90z8OaRGgLXSMzoNZluRErtfPkWOetE7sbrVAVZc vu9Djk6gIcKDFZLq+ZP3dTm77EJCbqY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1723044409; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K8WMcN5aTLqlNS8KglPxh5aEU6v/N8Os3PDJA9fbZ3I=; b=3+CHSE4Y/I3ANYIp+5/XIjvWXX1tWxpxRYgSc02a3iIhAiNrNEZwWUZT1cFv7MDFsVVNgB YZGR3uUFj5rmvxDg== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=zyqJ3DYa; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=3+CHSE4Y DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1723044409; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K8WMcN5aTLqlNS8KglPxh5aEU6v/N8Os3PDJA9fbZ3I=; b=zyqJ3DYamR7kHubC7o/Z4M3/7ygkweW9f0yuYuPBQ0rFIzc9R+UMXrmCLbdOqlLv44HfXR ieHL38SUxCwezYaEpc7qbyntDdLyrW90z8OaRGgLXSMzoNZluRErtfPkWOetE7sbrVAVZc vu9Djk6gIcKDFZLq+ZP3dTm77EJCbqY= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1723044409; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K8WMcN5aTLqlNS8KglPxh5aEU6v/N8Os3PDJA9fbZ3I=; b=3+CHSE4Y/I3ANYIp+5/XIjvWXX1tWxpxRYgSc02a3iIhAiNrNEZwWUZT1cFv7MDFsVVNgB YZGR3uUFj5rmvxDg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 3A67113297; Wed, 7 Aug 2024 15:26:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 2K0hDTmSs2bxewAAD6G6ig (envelope-from ); Wed, 07 Aug 2024 15:26:49 +0000 From: Takashi Iwai To: linux-sound@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Subject: [PATCH 1/2] drm/bridge: dw-hdmi: Move vmalloc PCM buffer management into the driver Date: Wed, 7 Aug 2024 17:27:22 +0200 Message-ID: <20240807152725.18948-2-tiwai@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240807152725.18948-1-tiwai@suse.de> References: <20240807152725.18948-1-tiwai@suse.de> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Spamd-Result: default: False [-0.51 / 50.00]; DWL_DNSWL_MED(-2.00)[suse.de:dkim]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RBL_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:104:10:150:64:97:from]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_SOME(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; RCVD_TLS_ALL(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:email,suse.de:dkim,imap1.dmz-prg2.suse.org:rdns,imap1.dmz-prg2.suse.org:helo]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[intel.com,linaro.org,kernel.org,ideasonboard.com,kwiboo.se,gmail.com,linux.intel.com,suse.de]; DNSWL_BLOCKED(0.00)[2a07:de40:b281:106:10:150:64:167:received]; RECEIVED_SPAMHAUS_BLOCKED_OPENRESOLVER(0.00)[2a07:de40:b281:106:10:150:64:167:received]; DKIM_TRACE(0.00)[suse.de:+]; RCPT_COUNT_SEVEN(0.00)[11]; RCVD_VIA_SMTP_AUTH(0.00)[]; TAGGED_RCPT(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com] X-Spamd-Bar: / X-Rspamd-Queue-Id: 91DD41FB96 X-Spam-Level: X-Rspamd-Action: no action X-Spam-Flag: NO X-Spam-Score: -0.51 The dw-hdmi drm bridge driver is the only one who still uses the ALSA vmalloc helper API functions. A previous attempt to change the way of buffer management wasn't taken for this legacy stuff, as we had little chance for test and some risk of major breaking. Instead, this patch moves the vmalloc buffer stuff into the dw-hdmi driver code itself, so that we can drop them from ALSA core code afterwards. There should be no functional changes. Link: https://lore.kernel.org/20191210154536.29819-1-tiwai@suse.de Signed-off-by: Takashi Iwai Reviewed-by: Neil Armstrong --- .../drm/bridge/synopsys/dw-hdmi-ahb-audio.c | 30 ++++++++++++++++--- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c index 67b8d17a722a..221e9a4edb40 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-ahb-audio.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include @@ -388,15 +389,36 @@ static int dw_hdmi_close(struct snd_pcm_substream *substream) static int dw_hdmi_hw_free(struct snd_pcm_substream *substream) { - return snd_pcm_lib_free_vmalloc_buffer(substream); + struct snd_pcm_runtime *runtime = substream->runtime; + + vfree(runtime->dma_area); + runtime->dma_area = NULL; + return 0; } static int dw_hdmi_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { + struct snd_pcm_runtime *runtime = substream->runtime; + size_t size = params_buffer_bytes(params); + /* Allocate the PCM runtime buffer, which is exposed to userspace. */ - return snd_pcm_lib_alloc_vmalloc_buffer(substream, - params_buffer_bytes(params)); + if (runtime->dma_area) { + if (runtime->dma_bytes >= size) + return 0; /* already large enough */ + vfree(runtime->dma_area); + } + runtime->dma_area = vzalloc(size); + if (!runtime->dma_area) + return -ENOMEM; + runtime->dma_bytes = size; + return 1; +} + +static struct page *dw_hdmi_get_page(struct snd_pcm_substream *substream, + unsigned long offset) +{ + return vmalloc_to_page(substream->runtime->dma_area + offset); } static int dw_hdmi_prepare(struct snd_pcm_substream *substream) @@ -515,7 +537,7 @@ static const struct snd_pcm_ops snd_dw_hdmi_ops = { .prepare = dw_hdmi_prepare, .trigger = dw_hdmi_trigger, .pointer = dw_hdmi_pointer, - .page = snd_pcm_lib_get_vmalloc_page, + .page = dw_hdmi_get_page, }; static int snd_dw_hdmi_probe(struct platform_device *pdev) From patchwork Wed Aug 7 15:27:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 13756434 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30A0A12BF32 for ; Wed, 7 Aug 2024 15:26:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723044413; cv=none; b=j1LBqig5wqmWQlCFbro/QO7xPUeC0SFOl7B2/yHZzcimmcxSqGXgG111GNuoCTKVDmIbAWM8DTgLl2jfssN1f5R6K4MF8q1071LucYa+Qk9ODY5jhP7ngQnqLgrzLXiXT4vhPdIEOxWgeu6IyQCl01jPHjMk6b59KRCa6e59H3Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1723044413; c=relaxed/simple; bh=n7wcPyREd4NAvNXJWqoUtVHW9c3N2MeA3eSB7B4Gmdk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Jlk71cQijvyYCxgS7rl7cMRdY5Ici6dx+kjmZ/r96gKQ7QmVt9CHxkerlG4nuWcGQ2Sf9hML3tGgPcwCKtc6jqYNKPVkVMJ0hrbc1OHAK//au/jZlsf61+mqboQ4y+2t9yQLIpuht+i/ddHT7EW3IAhmD3HS83HQbe6czbr3VBU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=MXHQWiq3; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=Q/J78puK; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=MXHQWiq3; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=Q/J78puK; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="MXHQWiq3"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="Q/J78puK"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="MXHQWiq3"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="Q/J78puK" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 820CD21CFF; Wed, 7 Aug 2024 15:26:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1723044410; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tADxz/0yhbC81kKO8/23h1vQ6FFpecaRf/di915epZk=; b=MXHQWiq3cHR1EZT1eHHePh8EZXJTtYBkY/9sPLslUejgW0QvBBiA3EFvf71IvnQVWN0Kmj S2zwRC0Z+Wbanvh9Nq7XxIQlN/Qb6Etu6yVRkAYIPIDlStR+4fk5nxsOIt7OSMB3Ya7dvP qSosRVAbdzcIwyYBfIIr3Igw/82caSE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1723044410; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tADxz/0yhbC81kKO8/23h1vQ6FFpecaRf/di915epZk=; b=Q/J78puKCjVrziqO7FFGoRKOTvOZG9/ISjOICgbG67qEBbjrRJxxVSeXHxEKW+1YZdXtud Op93dSpjzcVMNyCw== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1723044410; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tADxz/0yhbC81kKO8/23h1vQ6FFpecaRf/di915epZk=; b=MXHQWiq3cHR1EZT1eHHePh8EZXJTtYBkY/9sPLslUejgW0QvBBiA3EFvf71IvnQVWN0Kmj S2zwRC0Z+Wbanvh9Nq7XxIQlN/Qb6Etu6yVRkAYIPIDlStR+4fk5nxsOIt7OSMB3Ya7dvP qSosRVAbdzcIwyYBfIIr3Igw/82caSE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1723044410; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tADxz/0yhbC81kKO8/23h1vQ6FFpecaRf/di915epZk=; b=Q/J78puKCjVrziqO7FFGoRKOTvOZG9/ISjOICgbG67qEBbjrRJxxVSeXHxEKW+1YZdXtud Op93dSpjzcVMNyCw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 36F8E13297; Wed, 7 Aug 2024 15:26:50 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id EBU4DDqSs2bxewAAD6G6ig (envelope-from ); Wed, 07 Aug 2024 15:26:50 +0000 From: Takashi Iwai To: linux-sound@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Subject: [PATCH 2/2] ALSA: pcm: Drop PCM vmalloc buffer helpers Date: Wed, 7 Aug 2024 17:27:23 +0200 Message-ID: <20240807152725.18948-3-tiwai@suse.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240807152725.18948-1-tiwai@suse.de> References: <20240807152725.18948-1-tiwai@suse.de> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Spam-Level: * X-Spamd-Result: default: False [1.70 / 50.00]; SUSPICIOUS_RECIPS(1.50)[]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_MISSING_CHARSET(0.50)[]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; TAGGED_RCPT(0.00)[]; FROM_HAS_DN(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_CC(0.00)[intel.com,linaro.org,kernel.org,ideasonboard.com,kwiboo.se,gmail.com,linux.intel.com,suse.de]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email]; RCVD_TLS_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCPT_COUNT_SEVEN(0.00)[11]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_DN_SOME(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FREEMAIL_ENVRCPT(0.00)[gmail.com] X-Spam-Flag: NO X-Spam-Score: 1.70 As the last-standing user of PCM vmalloc buffer helper API took its own buffer management, we can finally drop those API functions, which were leftover after reorganization of ALSA memalloc code. Signed-off-by: Takashi Iwai --- include/sound/pcm.h | 42 ----------------------------- sound/core/pcm_memory.c | 59 ----------------------------------------- 2 files changed, 101 deletions(-) diff --git a/include/sound/pcm.h b/include/sound/pcm.h index ac8f3aef9205..3c56a648bdcd 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -1355,48 +1355,6 @@ snd_pcm_set_fixed_buffer_all(struct snd_pcm *pcm, int type, return snd_pcm_set_managed_buffer_all(pcm, type, data, size, 0); } -int _snd_pcm_lib_alloc_vmalloc_buffer(struct snd_pcm_substream *substream, - size_t size, gfp_t gfp_flags); -int snd_pcm_lib_free_vmalloc_buffer(struct snd_pcm_substream *substream); -struct page *snd_pcm_lib_get_vmalloc_page(struct snd_pcm_substream *substream, - unsigned long offset); -/** - * snd_pcm_lib_alloc_vmalloc_buffer - allocate virtual DMA buffer - * @substream: the substream to allocate the buffer to - * @size: the requested buffer size, in bytes - * - * Allocates the PCM substream buffer using vmalloc(), i.e., the memory is - * contiguous in kernel virtual space, but not in physical memory. Use this - * if the buffer is accessed by kernel code but not by device DMA. - * - * Return: 1 if the buffer was changed, 0 if not changed, or a negative error - * code. - */ -static inline int snd_pcm_lib_alloc_vmalloc_buffer - (struct snd_pcm_substream *substream, size_t size) -{ - return _snd_pcm_lib_alloc_vmalloc_buffer(substream, size, - GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO); -} - -/** - * snd_pcm_lib_alloc_vmalloc_32_buffer - allocate 32-bit-addressable buffer - * @substream: the substream to allocate the buffer to - * @size: the requested buffer size, in bytes - * - * This function works like snd_pcm_lib_alloc_vmalloc_buffer(), but uses - * vmalloc_32(), i.e., the pages are allocated from 32-bit-addressable memory. - * - * Return: 1 if the buffer was changed, 0 if not changed, or a negative error - * code. - */ -static inline int snd_pcm_lib_alloc_vmalloc_32_buffer - (struct snd_pcm_substream *substream, size_t size) -{ - return _snd_pcm_lib_alloc_vmalloc_buffer(substream, size, - GFP_KERNEL | GFP_DMA32 | __GFP_ZERO); -} - #define snd_pcm_get_dma_buf(substream) ((substream)->runtime->dma_buffer_p) /** diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c index 506386959f08..8e4c68e3bbd0 100644 --- a/sound/core/pcm_memory.c +++ b/sound/core/pcm_memory.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -497,61 +496,3 @@ int snd_pcm_lib_free_pages(struct snd_pcm_substream *substream) return 0; } EXPORT_SYMBOL(snd_pcm_lib_free_pages); - -int _snd_pcm_lib_alloc_vmalloc_buffer(struct snd_pcm_substream *substream, - size_t size, gfp_t gfp_flags) -{ - struct snd_pcm_runtime *runtime; - - if (PCM_RUNTIME_CHECK(substream)) - return -EINVAL; - runtime = substream->runtime; - if (runtime->dma_area) { - if (runtime->dma_bytes >= size) - return 0; /* already large enough */ - vfree(runtime->dma_area); - } - runtime->dma_area = __vmalloc(size, gfp_flags); - if (!runtime->dma_area) - return -ENOMEM; - runtime->dma_bytes = size; - return 1; -} -EXPORT_SYMBOL(_snd_pcm_lib_alloc_vmalloc_buffer); - -/** - * snd_pcm_lib_free_vmalloc_buffer - free vmalloc buffer - * @substream: the substream with a buffer allocated by - * snd_pcm_lib_alloc_vmalloc_buffer() - * - * Return: Zero if successful, or a negative error code on failure. - */ -int snd_pcm_lib_free_vmalloc_buffer(struct snd_pcm_substream *substream) -{ - struct snd_pcm_runtime *runtime; - - if (PCM_RUNTIME_CHECK(substream)) - return -EINVAL; - runtime = substream->runtime; - vfree(runtime->dma_area); - runtime->dma_area = NULL; - return 0; -} -EXPORT_SYMBOL(snd_pcm_lib_free_vmalloc_buffer); - -/** - * snd_pcm_lib_get_vmalloc_page - map vmalloc buffer offset to page struct - * @substream: the substream with a buffer allocated by - * snd_pcm_lib_alloc_vmalloc_buffer() - * @offset: offset in the buffer - * - * This function is to be used as the page callback in the PCM ops. - * - * Return: The page struct, or %NULL on failure. - */ -struct page *snd_pcm_lib_get_vmalloc_page(struct snd_pcm_substream *substream, - unsigned long offset) -{ - return vmalloc_to_page(substream->runtime->dma_area + offset); -} -EXPORT_SYMBOL(snd_pcm_lib_get_vmalloc_page);