From patchwork Mon Feb 4 15:20:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 10795925 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 92FCD6C2 for ; Mon, 4 Feb 2019 15:21:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F76B2B502 for ; Mon, 4 Feb 2019 15:21:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 740062B9BB; Mon, 4 Feb 2019 15:21:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7FD02B502 for ; Mon, 4 Feb 2019 15:21:55 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 830CA2678FE; Mon, 4 Feb 2019 16:21:05 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id AD1E326755F; Mon, 4 Feb 2019 16:20:48 +0100 (CET) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 12C1F267568 for ; Mon, 4 Feb 2019 16:20:40 +0100 (CET) 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 A95F8AF51 for ; Mon, 4 Feb 2019 15:20:40 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Date: Mon, 4 Feb 2019 16:20:36 +0100 Message-Id: <20190204152036.14102-12-tiwai@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190204152036.14102-1-tiwai@suse.de> References: <20190204152036.14102-1-tiwai@suse.de> Subject: [alsa-devel] [PATCH 11/11] ALSA: usb: Clean up with new procfs helpers X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Simplify the proc fs creation code with new helper functions, snd_card_ro_proc_new() and snd_card_rw_proc_new(). Just a code refactoring and no functional changes. Signed-off-by: Takashi Iwai --- sound/usb/mixer.c | 7 +++---- sound/usb/mixer_quirks.c | 6 ++---- sound/usb/proc.c | 13 +++++-------- 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c index 8ad1a24c8f28..73d7dff425c1 100644 --- a/sound/usb/mixer.c +++ b/sound/usb/mixer.c @@ -3441,7 +3441,6 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif, .dev_free = snd_usb_mixer_dev_free }; struct usb_mixer_interface *mixer; - struct snd_info_entry *entry; int err; strcpy(chip->card->mixername, "USB Mixer"); @@ -3497,9 +3496,9 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif, if (err < 0) goto _error; - if (list_empty(&chip->mixer_list) && - !snd_card_proc_new(chip->card, "usbmixer", &entry)) - snd_info_set_text_ops(entry, chip, snd_usb_mixer_proc_read); + if (list_empty(&chip->mixer_list)) + snd_card_ro_proc_new(chip->card, "usbmixer", chip, + snd_usb_mixer_proc_read); list_add(&mixer->list, &chip->mixer_list); return 0; diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c index 85ae0ff2382a..a751a18ca4c2 100644 --- a/sound/usb/mixer_quirks.c +++ b/sound/usb/mixer_quirks.c @@ -2195,7 +2195,6 @@ static int snd_rme_controls_create(struct usb_mixer_interface *mixer) int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer) { int err = 0; - struct snd_info_entry *entry; err = snd_usb_soundblaster_remote_init(mixer); if (err < 0) @@ -2214,9 +2213,8 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer) err = snd_audigy2nx_controls_create(mixer); if (err < 0) break; - if (!snd_card_proc_new(mixer->chip->card, "audigy2nx", &entry)) - snd_info_set_text_ops(entry, mixer, - snd_audigy2nx_proc_read); + snd_card_ro_proc_new(mixer->chip->card, "audigy2nx", + mixer, snd_audigy2nx_proc_read); break; /* EMU0204 */ diff --git a/sound/usb/proc.c b/sound/usb/proc.c index 0ac89e294d31..e80c9d0749c9 100644 --- a/sound/usb/proc.c +++ b/sound/usb/proc.c @@ -61,11 +61,10 @@ static void proc_audio_usbid_read(struct snd_info_entry *entry, struct snd_info_ void snd_usb_audio_create_proc(struct snd_usb_audio *chip) { - struct snd_info_entry *entry; - if (!snd_card_proc_new(chip->card, "usbbus", &entry)) - snd_info_set_text_ops(entry, chip, proc_audio_usbbus_read); - if (!snd_card_proc_new(chip->card, "usbid", &entry)) - snd_info_set_text_ops(entry, chip, proc_audio_usbid_read); + snd_card_ro_proc_new(chip->card, "usbbus", chip, + proc_audio_usbbus_read); + snd_card_ro_proc_new(chip->card, "usbid", chip, + proc_audio_usbid_read); } /* @@ -167,12 +166,10 @@ static void proc_pcm_format_read(struct snd_info_entry *entry, struct snd_info_b void snd_usb_proc_pcm_format_add(struct snd_usb_stream *stream) { - struct snd_info_entry *entry; char name[32]; struct snd_card *card = stream->chip->card; sprintf(name, "stream%d", stream->pcm_index); - if (!snd_card_proc_new(card, name, &entry)) - snd_info_set_text_ops(entry, stream, proc_pcm_format_read); + snd_card_ro_proc_new(card, name, stream, proc_pcm_format_read); }