From patchwork Tue Dec 10 14:18:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 11282559 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3A95715AB for ; Tue, 10 Dec 2019 14:18:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1996A21D7D for ; Tue, 10 Dec 2019 14:18:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727324AbfLJOSb (ORCPT ); Tue, 10 Dec 2019 09:18:31 -0500 Received: from mx2.suse.de ([195.135.220.15]:35824 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727178AbfLJOSb (ORCPT ); Tue, 10 Dec 2019 09:18:31 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id AD14AB1F7; Tue, 10 Dec 2019 14:18:29 +0000 (UTC) From: Takashi Iwai To: Felipe Balbi Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH for-5.6 1/2] usb: gadget: u_audio: Use managed buffer allocation Date: Tue, 10 Dec 2019 15:18:21 +0100 Message-Id: <20191210141822.18705-2-tiwai@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20191210141822.18705-1-tiwai@suse.de> References: <20191210141822.18705-1-tiwai@suse.de> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Clean up the driver with the new managed buffer allocation API. The hw_params and hw_free callbacks became superfluous and dropped. Signed-off-by: Takashi Iwai --- drivers/usb/gadget/function/u_audio.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c index 7ec6a996af26..67c4c85433d1 100644 --- a/drivers/usb/gadget/function/u_audio.c +++ b/drivers/usb/gadget/function/u_audio.c @@ -239,18 +239,6 @@ static snd_pcm_uframes_t uac_pcm_pointer(struct snd_pcm_substream *substream) return bytes_to_frames(substream->runtime, prm->hw_ptr); } -static int uac_pcm_hw_params(struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *hw_params) -{ - return snd_pcm_lib_malloc_pages(substream, - params_buffer_bytes(hw_params)); -} - -static int uac_pcm_hw_free(struct snd_pcm_substream *substream) -{ - return snd_pcm_lib_free_pages(substream); -} - static int uac_pcm_open(struct snd_pcm_substream *substream) { struct snd_uac_chip *uac = snd_pcm_substream_chip(substream); @@ -327,8 +315,6 @@ static const struct snd_pcm_ops uac_pcm_ops = { .open = uac_pcm_open, .close = uac_pcm_null, .ioctl = snd_pcm_lib_ioctl, - .hw_params = uac_pcm_hw_params, - .hw_free = uac_pcm_hw_free, .trigger = uac_pcm_trigger, .pointer = uac_pcm_pointer, .prepare = uac_pcm_null, @@ -584,8 +570,8 @@ int g_audio_setup(struct g_audio *g_audio, const char *pcm_name, strlcpy(card->shortname, card_name, sizeof(card->shortname)); sprintf(card->longname, "%s %i", card_name, card->dev->id); - snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, - NULL, 0, BUFF_SIZE_MAX); + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS, + NULL, 0, BUFF_SIZE_MAX); err = snd_card_register(card); From patchwork Tue Dec 10 14:18:22 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 11282561 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AE988930 for ; Tue, 10 Dec 2019 14:18:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9775F20828 for ; Tue, 10 Dec 2019 14:18:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727349AbfLJOSb (ORCPT ); Tue, 10 Dec 2019 09:18:31 -0500 Received: from mx2.suse.de ([195.135.220.15]:35830 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727272AbfLJOSb (ORCPT ); Tue, 10 Dec 2019 09:18:31 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id C0094B1FA; Tue, 10 Dec 2019 14:18:29 +0000 (UTC) From: Takashi Iwai To: Felipe Balbi Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, alsa-devel@alsa-project.org Subject: [PATCH for-5.6 2/2] usb: gadget: u_audio: Drop superfluous ioctl PCM ops Date: Tue, 10 Dec 2019 15:18:22 +0100 Message-Id: <20191210141822.18705-3-tiwai@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20191210141822.18705-1-tiwai@suse.de> References: <20191210141822.18705-1-tiwai@suse.de> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org PCM core deals the empty ioctl field now as default. Let's kill the redundant lines. Signed-off-by: Takashi Iwai --- drivers/usb/gadget/function/u_audio.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/usb/gadget/function/u_audio.c b/drivers/usb/gadget/function/u_audio.c index 67c4c85433d1..cf4f2358889b 100644 --- a/drivers/usb/gadget/function/u_audio.c +++ b/drivers/usb/gadget/function/u_audio.c @@ -314,7 +314,6 @@ static int uac_pcm_null(struct snd_pcm_substream *substream) static const struct snd_pcm_ops uac_pcm_ops = { .open = uac_pcm_open, .close = uac_pcm_null, - .ioctl = snd_pcm_lib_ioctl, .trigger = uac_pcm_trigger, .pointer = uac_pcm_pointer, .prepare = uac_pcm_null,