From patchwork Mon Feb 4 15:20:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 10795913 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 409836C2 for ; Mon, 4 Feb 2019 15:21:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2E86B2B99C for ; Mon, 4 Feb 2019 15:21:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 230CE2B9DF; Mon, 4 Feb 2019 15:21:17 +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 6DD782B99C for ; Mon, 4 Feb 2019 15:21:16 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 04B2326758B; Mon, 4 Feb 2019 16:20:54 +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 62C522674D5; Mon, 4 Feb 2019 16:20:45 +0100 (CET) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id DD49526755C 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 6062DAEDC for ; Mon, 4 Feb 2019 15:20:39 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Date: Mon, 4 Feb 2019 16:20:30 +0100 Message-Id: <20190204152036.14102-6-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 05/11] ALSA: drivers: 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/drivers/aloop.c | 10 ++-------- sound/drivers/dummy.c | 10 ++-------- sound/drivers/vx/vx_core.c | 5 +---- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c index 65c903b639c2..8c3fbe1276be 100644 --- a/sound/drivers/aloop.c +++ b/sound/drivers/aloop.c @@ -1133,16 +1133,10 @@ static void print_cable_info(struct snd_info_entry *entry, static int loopback_proc_new(struct loopback *loopback, int cidx) { char name[32]; - struct snd_info_entry *entry; - int err; snprintf(name, sizeof(name), "cable#%d", cidx); - err = snd_card_proc_new(loopback->card, name, &entry); - if (err < 0) - return err; - - snd_info_set_text_ops(entry, loopback, print_cable_info); - return 0; + return snd_card_ro_proc_new(loopback->card, name, loopback, + print_cable_info); } static int loopback_probe(struct platform_device *devptr) diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c index c8d31550e9a1..2672c2e13334 100644 --- a/sound/drivers/dummy.c +++ b/sound/drivers/dummy.c @@ -1037,14 +1037,8 @@ static void dummy_proc_write(struct snd_info_entry *entry, static void dummy_proc_init(struct snd_dummy *chip) { - struct snd_info_entry *entry; - - if (!snd_card_proc_new(chip->card, "dummy_pcm", &entry)) { - snd_info_set_text_ops(entry, chip, dummy_proc_read); - entry->c.text.write = dummy_proc_write; - entry->mode |= 0200; - entry->private_data = chip; - } + snd_card_rw_proc_new(chip->card, "dummy_pcm", chip, + dummy_proc_read, dummy_proc_write); } #else #define dummy_proc_init(x) diff --git a/sound/drivers/vx/vx_core.c b/sound/drivers/vx/vx_core.c index 19496fa486aa..543945643a76 100644 --- a/sound/drivers/vx/vx_core.c +++ b/sound/drivers/vx/vx_core.c @@ -643,10 +643,7 @@ static void vx_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *b static void vx_proc_init(struct vx_core *chip) { - struct snd_info_entry *entry; - - if (! snd_card_proc_new(chip->card, "vx-status", &entry)) - snd_info_set_text_ops(entry, chip, vx_proc_read); + snd_card_ro_proc_new(chip->card, "vx-status", chip, vx_proc_read); }