From patchwork Mon Feb 4 15:20:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 10795917 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 0CDA06C2 for ; Mon, 4 Feb 2019 15:21:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ED5372B552 for ; Mon, 4 Feb 2019 15:21:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1FA72BA1D; Mon, 4 Feb 2019 15:21:30 +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 E682C2B552 for ; Mon, 4 Feb 2019 15:21:29 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 325342675A7; Mon, 4 Feb 2019 16:20:57 +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 CA3CB267574; 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 B1624267546 for ; Mon, 4 Feb 2019 16:20:39 +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 35146AD25 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:26 +0100 Message-Id: <20190204152036.14102-2-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 01/11] ALSA: pcm: Remove superfluous snd_info_register() calls 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 The calls of snd_info_register() are superfluous and should be avoided at the procfs creation time. They are called at the end of the whole initialization via snd_card_register(). This patch drops such superfluous calls, as well as cleaning up the calls of substream proc entries with a common helper. Signed-off-by: Takashi Iwai --- sound/core/pcm.c | 79 +++++++++++++++++++------------------------------------- 1 file changed, 26 insertions(+), 53 deletions(-) diff --git a/sound/core/pcm.c b/sound/core/pcm.c index 4f45b3000347..a49c866541cb 100644 --- a/sound/core/pcm.c +++ b/sound/core/pcm.c @@ -528,18 +528,10 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr) if (!entry) return -ENOMEM; entry->mode = S_IFDIR | 0555; - if (snd_info_register(entry) < 0) { - snd_info_free_entry(entry); - return -ENOMEM; - } pstr->proc_root = entry; entry = snd_info_create_card_entry(pcm->card, "info", pstr->proc_root); - if (entry) { + if (entry) snd_info_set_text_ops(entry, pstr, snd_pcm_stream_proc_info_read); - if (snd_info_register(entry) < 0) - snd_info_free_entry(entry); - } - #ifdef CONFIG_SND_PCM_XRUN_DEBUG entry = snd_info_create_card_entry(pcm->card, "xrun_debug", pstr->proc_root); @@ -547,9 +539,6 @@ static int snd_pcm_stream_proc_init(struct snd_pcm_str *pstr) entry->c.text.read = snd_pcm_xrun_debug_read; entry->c.text.write = snd_pcm_xrun_debug_write; entry->mode |= 0200; - entry->private_data = pstr; - if (snd_info_register(entry) < 0) - snd_info_free_entry(entry); } #endif return 0; @@ -562,6 +551,21 @@ static int snd_pcm_stream_proc_done(struct snd_pcm_str *pstr) return 0; } +static struct snd_info_entry * +create_substream_info_entry(struct snd_pcm_substream *substream, + const char *name, + void (*read)(struct snd_info_entry *, + struct snd_info_buffer *)) +{ + struct snd_info_entry *entry; + + entry = snd_info_create_card_entry(substream->pcm->card, name, + substream->proc_root); + if (entry) + snd_info_set_text_ops(entry, substream, read); + return entry; +} + static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream) { struct snd_info_entry *entry; @@ -576,53 +580,22 @@ static int snd_pcm_substream_proc_init(struct snd_pcm_substream *substream) if (!entry) return -ENOMEM; entry->mode = S_IFDIR | 0555; - if (snd_info_register(entry) < 0) { - snd_info_free_entry(entry); - return -ENOMEM; - } substream->proc_root = entry; - entry = snd_info_create_card_entry(card, "info", substream->proc_root); - if (entry) { - snd_info_set_text_ops(entry, substream, - snd_pcm_substream_proc_info_read); - if (snd_info_register(entry) < 0) - snd_info_free_entry(entry); - } - entry = snd_info_create_card_entry(card, "hw_params", - substream->proc_root); - if (entry) { - snd_info_set_text_ops(entry, substream, - snd_pcm_substream_proc_hw_params_read); - if (snd_info_register(entry) < 0) - snd_info_free_entry(entry); - } - entry = snd_info_create_card_entry(card, "sw_params", - substream->proc_root); - if (entry) { - snd_info_set_text_ops(entry, substream, - snd_pcm_substream_proc_sw_params_read); - if (snd_info_register(entry) < 0) - snd_info_free_entry(entry); - } - entry = snd_info_create_card_entry(card, "status", - substream->proc_root); - if (entry) { - snd_info_set_text_ops(entry, substream, - snd_pcm_substream_proc_status_read); - if (snd_info_register(entry) < 0) - snd_info_free_entry(entry); - } + + create_substream_info_entry(substream, "info", + snd_pcm_substream_proc_info_read); + create_substream_info_entry(substream, "hw_params", + snd_pcm_substream_proc_hw_params_read); + create_substream_info_entry(substream, "sw_params", + snd_pcm_substream_proc_sw_params_read); + create_substream_info_entry(substream, "status", + snd_pcm_substream_proc_status_read); #ifdef CONFIG_SND_PCM_XRUN_DEBUG - entry = snd_info_create_card_entry(card, "xrun_injection", - substream->proc_root); + entry = create_substream_info_entry(substream, "xrun_injection", NULL); if (entry) { - entry->private_data = substream; - entry->c.text.read = NULL; entry->c.text.write = snd_pcm_xrun_injection_write; entry->mode = S_IFREG | 0200; - if (snd_info_register(entry) < 0) - snd_info_free_entry(entry); } #endif /* CONFIG_SND_PCM_XRUN_DEBUG */ From patchwork Mon Feb 4 15:20:27 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 10795909 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 8748B13BF for ; Mon, 4 Feb 2019 15:21:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7254A2AD3C for ; Mon, 4 Feb 2019 15:21:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 66C4B2B988; Mon, 4 Feb 2019 15:21:01 +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 DE8982AD3C for ; Mon, 4 Feb 2019 15:21:00 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 641C1267567; Mon, 4 Feb 2019 16:20:50 +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 36EA42674D5; 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 B575B267557 for ; Mon, 4 Feb 2019 16:20:39 +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 427C7AD3F 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:27 +0100 Message-Id: <20190204152036.14102-3-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 02/11] ALSA: compress: Remove superfluous snd_info_register() calls 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 The calls of snd_info_register() are superfluous and should be avoided at the procfs creation time. They are called at the end of the whole initialization via snd_card_register(). This patch drops such superfluous calls. Signed-off-by: Takashi Iwai --- sound/core/compress_offload.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c index f7d2b373da0a..a1a6fd75cfe5 100644 --- a/sound/core/compress_offload.c +++ b/sound/core/compress_offload.c @@ -1015,22 +1015,13 @@ static int snd_compress_proc_init(struct snd_compr *compr) if (!entry) return -ENOMEM; entry->mode = S_IFDIR | 0555; - if (snd_info_register(entry) < 0) { - snd_info_free_entry(entry); - return -ENOMEM; - } compr->proc_root = entry; entry = snd_info_create_card_entry(compr->card, "info", compr->proc_root); - if (entry) { + if (entry) snd_info_set_text_ops(entry, compr, snd_compress_proc_info_read); - if (snd_info_register(entry) < 0) { - snd_info_free_entry(entry); - entry = NULL; - } - } compr->proc_info_entry = entry; return 0; From patchwork Mon Feb 4 15:20:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 10795905 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 C62066C2 for ; Mon, 4 Feb 2019 15:20:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B38192B461 for ; Mon, 4 Feb 2019 15:20:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A825B2B540; Mon, 4 Feb 2019 15:20:48 +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 D825E2B55E for ; Mon, 4 Feb 2019 15:20:47 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 8CA22267558; Mon, 4 Feb 2019 16:20:45 +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 92428267572; Mon, 4 Feb 2019 16:20:42 +0100 (CET) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id AEE0F2674D5 for ; Mon, 4 Feb 2019 16:20:39 +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 4AE8AAEBC 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:28 +0100 Message-Id: <20190204152036.14102-4-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 03/11] ALSA: pci: Remove superfluous snd_info_register() calls 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 The calls of snd_info_register() are superfluous and should be avoided at the procfs creation time. They are called at the end of the whole initialization via snd_card_register(). This patch drops such superfluous calls, as well as dropping the superfluous setup of SNDRV_INFO_CONTENT_TEXT. Signed-off-by: Takashi Iwai --- sound/pci/ac97/ac97_proc.c | 26 +++++++++----------------- sound/pci/cs46xx/dsp_spos.c | 16 +++++----------- 2 files changed, 14 insertions(+), 28 deletions(-) diff --git a/sound/pci/ac97/ac97_proc.c b/sound/pci/ac97/ac97_proc.c index e120a11c69e8..20516b6907b5 100644 --- a/sound/pci/ac97/ac97_proc.c +++ b/sound/pci/ac97/ac97_proc.c @@ -436,25 +436,20 @@ void snd_ac97_proc_init(struct snd_ac97 * ac97) return; prefix = ac97_is_audio(ac97) ? "ac97" : "mc97"; sprintf(name, "%s#%d-%d", prefix, ac97->addr, ac97->num); - if ((entry = snd_info_create_card_entry(ac97->bus->card, name, ac97->bus->proc)) != NULL) { + entry = snd_info_create_card_entry(ac97->bus->card, name, + ac97->bus->proc); + if (entry) snd_info_set_text_ops(entry, ac97, snd_ac97_proc_read); - if (snd_info_register(entry) < 0) { - snd_info_free_entry(entry); - entry = NULL; - } - } ac97->proc = entry; sprintf(name, "%s#%d-%d+regs", prefix, ac97->addr, ac97->num); - if ((entry = snd_info_create_card_entry(ac97->bus->card, name, ac97->bus->proc)) != NULL) { + entry = snd_info_create_card_entry(ac97->bus->card, name, + ac97->bus->proc); + if (entry) { snd_info_set_text_ops(entry, ac97, snd_ac97_proc_regs_read); #ifdef CONFIG_SND_DEBUG entry->mode |= 0200; entry->c.text.write = snd_ac97_proc_regs_write; #endif - if (snd_info_register(entry) < 0) { - snd_info_free_entry(entry); - entry = NULL; - } } ac97->proc_regs = entry; } @@ -473,13 +468,10 @@ void snd_ac97_bus_proc_init(struct snd_ac97_bus * bus) char name[32]; sprintf(name, "codec97#%d", bus->num); - if ((entry = snd_info_create_card_entry(bus->card, name, bus->card->proc_root)) != NULL) { + entry = snd_info_create_card_entry(bus->card, name, + bus->card->proc_root); + if (entry) entry->mode = S_IFDIR | 0555; - if (snd_info_register(entry) < 0) { - snd_info_free_entry(entry); - entry = NULL; - } - } bus->proc = entry; } diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c index 5fc497c6d738..19739f2d1abf 100644 --- a/sound/pci/cs46xx/dsp_spos.c +++ b/sound/pci/cs46xx/dsp_spos.c @@ -799,23 +799,17 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip) ins->snd_card = card; - if ((entry = snd_info_create_card_entry(card, "dsp", card->proc_root)) != NULL) { - entry->content = SNDRV_INFO_CONTENT_TEXT; + entry = snd_info_create_card_entry(card, "dsp", card->proc_root); + if (entry) entry->mode = S_IFDIR | 0555; - - if (snd_info_register(entry) < 0) { - snd_info_free_entry(entry); - entry = NULL; - } - } - ins->proc_dsp_dir = entry; if (!ins->proc_dsp_dir) return -ENOMEM; - if ((entry = snd_info_create_card_entry(card, "spos_symbols", ins->proc_dsp_dir)) != NULL) { - entry->content = SNDRV_INFO_CONTENT_TEXT; + entry = snd_info_create_card_entry(card, "spos_symbols", + ins->proc_dsp_dir); + if (entry) { entry->private_data = chip; entry->mode = S_IFREG | 0644; entry->c.text.read = cs46xx_dsp_proc_symbol_table_read; From patchwork Mon Feb 4 15:20:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 10795907 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 0E56513BF for ; Mon, 4 Feb 2019 15:20:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF3E42B567 for ; Mon, 4 Feb 2019 15:20:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E3E2B2B76F; Mon, 4 Feb 2019 15:20:54 +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 2D71B2B567 for ; Mon, 4 Feb 2019 15:20:54 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id D81D5267546; Mon, 4 Feb 2019 16:20:47 +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 A50F426756C; Mon, 4 Feb 2019 16:20:42 +0100 (CET) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id ACBBB2674C0 for ; Mon, 4 Feb 2019 16:20:39 +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 533D3AEC8 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:29 +0100 Message-Id: <20190204152036.14102-5-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 04/11] ALSA: info: Add standard helpers for card proc file entries 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 Two new helper functions are added here for cleaning up the existing lengthy calls. Signed-off-by: Takashi Iwai --- include/sound/info.h | 35 +++++++++++++++++++++++++++++++++++ sound/core/info.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) diff --git a/include/sound/info.h b/include/sound/info.h index becdf66d2825..96530f7599e1 100644 --- a/include/sound/info.h +++ b/include/sound/info.h @@ -160,6 +160,13 @@ static inline void snd_info_set_text_ops(struct snd_info_entry *entry, entry->c.text.read = read; } +int snd_card_rw_proc_new(struct snd_card *card, const char *name, + void *private_data, + void (*read)(struct snd_info_entry *, + struct snd_info_buffer *), + void (*write)(struct snd_info_entry *entry, + struct snd_info_buffer *buffer)); + int snd_info_check_reserved_words(const char *str); #else @@ -189,10 +196,38 @@ static inline int snd_card_proc_new(struct snd_card *card, const char *name, static inline void snd_info_set_text_ops(struct snd_info_entry *entry __attribute__((unused)), void *private_data, void (*read)(struct snd_info_entry *, struct snd_info_buffer *)) {} +static inline int snd_card_rw_proc_new(struct snd_card *card, const char *name, + void *private_data, + void (*read)(struct snd_info_entry *, + struct snd_info_buffer *), + void (*write)(struct snd_info_entry *entry, + struct snd_info_buffer *buffer)) +{ + return 0; +} static inline int snd_info_check_reserved_words(const char *str) { return 1; } #endif +/** + * snd_card_ro_proc_new - Create a read-only text proc file entry for the card + * @card: the card instance + * @name: the file name + * @private_data: the arbitrary private data + * @read: the read callback + * + * This proc file entry will be registered via snd_card_register() call, and + * it will be removed automatically at the card removal, too. + */ +static inline int +snd_card_ro_proc_new(struct snd_card *card, const char *name, + void *private_data, + void (*read)(struct snd_info_entry *, + struct snd_info_buffer *)) +{ + return snd_card_rw_proc_new(card, name, private_data, read, NULL); +} + /* * OSS info part */ diff --git a/sound/core/info.c b/sound/core/info.c index 2dfb6389c084..6f047582d0a5 100644 --- a/sound/core/info.c +++ b/sound/core/info.c @@ -863,6 +863,37 @@ int snd_info_register(struct snd_info_entry * entry) } EXPORT_SYMBOL(snd_info_register); +/** + * snd_card_ro_proc_new - Create a read/write text proc file entry for the card + * @card: the card instance + * @name: the file name + * @private_data: the arbitrary private data + * @read: the read callback + * + * This proc file entry will be registered via snd_card_register() call, and + * it will be removed automatically at the card removal, too. + */ +int snd_card_rw_proc_new(struct snd_card *card, const char *name, + void *private_data, + void (*read)(struct snd_info_entry *, + struct snd_info_buffer *), + void (*write)(struct snd_info_entry *entry, + struct snd_info_buffer *buffer)) +{ + struct snd_info_entry *entry; + + entry = snd_info_create_card_entry(card, name, card->proc_root); + if (!entry) + return -ENOMEM; + snd_info_set_text_ops(entry, private_data, read); + if (write) { + entry->mode |= 0200; + entry->c.text.write = write; + } + return 0; +} +EXPORT_SYMBOL_GPL(snd_card_rw_proc_new); + /* */ 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); } From patchwork Mon Feb 4 15:20:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 10795923 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 7341613BF for ; Mon, 4 Feb 2019 15:21:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 60AFF2BA36 for ; Mon, 4 Feb 2019 15:21:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 555252BA6B; Mon, 4 Feb 2019 15:21:50 +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 79E0B2BA58 for ; Mon, 4 Feb 2019 15:21:49 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 0D49B26758F; Mon, 4 Feb 2019 16:21:04 +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 6FDC3267574; 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 DFAC326755F 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 6AF0AAF27 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:31 +0100 Message-Id: <20190204152036.14102-7-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 06/11] ALSA: isa: 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/isa/gus/gus_irq.c | 5 +---- sound/isa/gus/gus_mem.c | 6 +----- sound/isa/opti9xx/miro.c | 5 +---- sound/isa/sb/sb16_csp.c | 5 ++--- 4 files changed, 5 insertions(+), 16 deletions(-) diff --git a/sound/isa/gus/gus_irq.c b/sound/isa/gus/gus_irq.c index 2055aff71b50..0ca6c38e2ed9 100644 --- a/sound/isa/gus/gus_irq.c +++ b/sound/isa/gus/gus_irq.c @@ -140,10 +140,7 @@ static void snd_gus_irq_info_read(struct snd_info_entry *entry, void snd_gus_irq_profile_init(struct snd_gus_card *gus) { - struct snd_info_entry *entry; - - if (! snd_card_proc_new(gus->card, "gusirq", &entry)) - snd_info_set_text_ops(entry, gus, snd_gus_irq_info_read); + snd_card_ro_proc_new(gus->card, "gusirq", gus, snd_gus_irq_info_read); } #endif diff --git a/sound/isa/gus/gus_mem.c b/sound/isa/gus/gus_mem.c index af888a022fc0..4ac76f46dd76 100644 --- a/sound/isa/gus/gus_mem.c +++ b/sound/isa/gus/gus_mem.c @@ -238,9 +238,6 @@ int snd_gf1_mem_init(struct snd_gus_card * gus) { struct snd_gf1_mem *alloc; struct snd_gf1_mem_block block; -#ifdef CONFIG_SND_DEBUG - struct snd_info_entry *entry; -#endif alloc = &gus->gf1.mem_alloc; mutex_init(&alloc->memory_mutex); @@ -263,8 +260,7 @@ int snd_gf1_mem_init(struct snd_gus_card * gus) if (snd_gf1_mem_xalloc(alloc, &block) == NULL) return -ENOMEM; #ifdef CONFIG_SND_DEBUG - if (! snd_card_proc_new(gus->card, "gusmem", &entry)) - snd_info_set_text_ops(entry, gus, snd_gf1_mem_info_read); + snd_card_ro_proc_new(gus->card, "gusmem", gus, snd_gf1_mem_info_read); #endif return 0; } diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c index c6136c6b0214..997cdfd7b1ea 100644 --- a/sound/isa/opti9xx/miro.c +++ b/sound/isa/opti9xx/miro.c @@ -997,10 +997,7 @@ static void snd_miro_proc_read(struct snd_info_entry * entry, static void snd_miro_proc_init(struct snd_card *card, struct snd_miro *miro) { - struct snd_info_entry *entry; - - if (!snd_card_proc_new(card, "miro", &entry)) - snd_info_set_text_ops(entry, miro, snd_miro_proc_read); + snd_card_ro_proc_new(card, "miro", miro, snd_miro_proc_read); } /* diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c index bf3db0d2ea12..a09ad57b8313 100644 --- a/sound/isa/sb/sb16_csp.c +++ b/sound/isa/sb/sb16_csp.c @@ -1126,10 +1126,9 @@ static int snd_sb_csp_qsound_transfer(struct snd_sb_csp * p) static int init_proc_entry(struct snd_sb_csp * p, int device) { char name[16]; - struct snd_info_entry *entry; + sprintf(name, "cspD%d", device); - if (! snd_card_proc_new(p->chip->card, name, &entry)) - snd_info_set_text_ops(entry, p, info_read); + snd_card_ro_proc_new(p->chip->card, name, p, info_read); return 0; } From patchwork Mon Feb 4 15:20:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 10795911 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 2D35E6C2 for ; Mon, 4 Feb 2019 15:21:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AA692B552 for ; Mon, 4 Feb 2019 15:21:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0EFF82B988; Mon, 4 Feb 2019 15:21:09 +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 529222B99C for ; Mon, 4 Feb 2019 15:21:08 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 3498C26757C; Mon, 4 Feb 2019 16:20:52 +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 6152A267557; 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 DF48726755E 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 768F3ADBE 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:32 +0100 Message-Id: <20190204152036.14102-8-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 07/11] ALSA: i2c: 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/i2c/other/ak4113.c | 5 ++--- sound/i2c/other/ak4114.c | 5 ++--- sound/i2c/other/ak4xxx-adda.c | 8 +------- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/sound/i2c/other/ak4113.c b/sound/i2c/other/ak4113.c index 4099e6062d3c..573599d0378d 100644 --- a/sound/i2c/other/ak4113.c +++ b/sound/i2c/other/ak4113.c @@ -492,9 +492,8 @@ static void snd_ak4113_proc_regs_read(struct snd_info_entry *entry, static void snd_ak4113_proc_init(struct ak4113 *ak4113) { - struct snd_info_entry *entry; - if (!snd_card_proc_new(ak4113->card, "ak4113", &entry)) - snd_info_set_text_ops(entry, ak4113, snd_ak4113_proc_regs_read); + snd_card_ro_proc_new(ak4113->card, "ak4113", ak4113, + snd_ak4113_proc_regs_read); } int snd_ak4113_build(struct ak4113 *ak4113, diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c index 7fb1aeb46915..76afb975782d 100644 --- a/sound/i2c/other/ak4114.c +++ b/sound/i2c/other/ak4114.c @@ -465,9 +465,8 @@ static void snd_ak4114_proc_regs_read(struct snd_info_entry *entry, static void snd_ak4114_proc_init(struct ak4114 *ak4114) { - struct snd_info_entry *entry; - if (!snd_card_proc_new(ak4114->card, "ak4114", &entry)) - snd_info_set_text_ops(entry, ak4114, snd_ak4114_proc_regs_read); + snd_card_ro_proc_new(ak4114->card, "ak4114", ak4114, + snd_ak4114_proc_regs_read); } int snd_ak4114_build(struct ak4114 *ak4114, diff --git a/sound/i2c/other/ak4xxx-adda.c b/sound/i2c/other/ak4xxx-adda.c index 7f2761a2e7c8..62a6c5fa96b5 100644 --- a/sound/i2c/other/ak4xxx-adda.c +++ b/sound/i2c/other/ak4xxx-adda.c @@ -875,13 +875,7 @@ static void proc_regs_read(struct snd_info_entry *entry, static int proc_init(struct snd_akm4xxx *ak) { - struct snd_info_entry *entry; - int err; - err = snd_card_proc_new(ak->card, ak->name, &entry); - if (err < 0) - return err; - snd_info_set_text_ops(entry, ak, proc_regs_read); - return 0; + return snd_card_ro_proc_new(ak->card, ak->name, ak, proc_regs_read); } int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak) From patchwork Mon Feb 4 15:20:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 10795927 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 2BB4E13BF for ; Mon, 4 Feb 2019 15:22:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 152442B552 for ; Mon, 4 Feb 2019 15:22:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 095C22BA6B; Mon, 4 Feb 2019 15:22:04 +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 BFD4F2BA7D for ; Mon, 4 Feb 2019 15:22:01 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 1BDB3267588; Mon, 4 Feb 2019 16:21:07 +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 D21E226755D; Mon, 4 Feb 2019 16:20:49 +0100 (CET) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id DEE5226755D 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 8D52DAF4A 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:33 +0100 Message-Id: <20190204152036.14102-9-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 08/11] ALSA: pci: 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/pci/ad1889.c | 6 +-- sound/pci/ak4531_codec.c | 5 +-- sound/pci/ali5451/ali5451.c | 4 +- sound/pci/asihpi/asihpi.c | 6 +-- sound/pci/atiixp.c | 5 +-- sound/pci/atiixp_modem.c | 6 +-- sound/pci/ca0106/ca0106_proc.c | 40 ++++++++------------ sound/pci/cmipci.c | 5 +-- sound/pci/cs4281.c | 3 +- sound/pci/emu10k1/emu10k1x.c | 12 ++---- sound/pci/emu10k1/emuproc.c | 81 +++++++++++++++------------------------- sound/pci/ens1370.c | 6 +-- sound/pci/hda/hda_proc.c | 9 +---- sound/pci/ice1712/ice1712.c | 5 +-- sound/pci/ice1712/ice1724.c | 5 +-- sound/pci/ice1712/pontis.c | 12 ++---- sound/pci/ice1712/prodigy192.c | 5 +-- sound/pci/ice1712/prodigy_hifi.c | 8 +--- sound/pci/ice1712/quartet.c | 4 +- sound/pci/intel8x0.c | 6 +-- sound/pci/intel8x0m.c | 6 +-- sound/pci/korg1212/korg1212.c | 6 +-- sound/pci/lola/lola_proc.c | 16 +++----- sound/pci/lx6464es/lx6464es.c | 8 +--- sound/pci/mixart/mixart.c | 6 +-- sound/pci/oxygen/oxygen_lib.c | 5 +-- sound/pci/pcxhr/pcxhr.c | 21 ++++------- sound/pci/riptide/riptide.c | 6 +-- sound/pci/rme32.c | 5 +-- sound/pci/rme96.c | 5 +-- sound/pci/rme9652/hdsp.c | 5 +-- sound/pci/rme9652/hdspm.c | 55 ++++++++++++--------------- sound/pci/rme9652/rme9652.c | 6 +-- sound/pci/sonicvibes.c | 6 +-- sound/pci/trident/trident_main.c | 4 +- sound/pci/via82xx.c | 6 +-- sound/pci/via82xx_modem.c | 6 +-- sound/pci/ymfpci/ymfpci_main.c | 6 +-- 38 files changed, 133 insertions(+), 278 deletions(-) diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c index d9c54c08e2db..f333bbf41870 100644 --- a/sound/pci/ad1889.c +++ b/sound/pci/ad1889.c @@ -741,10 +741,8 @@ snd_ad1889_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffe static void snd_ad1889_proc_init(struct snd_ad1889 *chip) { - struct snd_info_entry *entry; - - if (!snd_card_proc_new(chip->card, chip->card->driver, &entry)) - snd_info_set_text_ops(entry, chip, snd_ad1889_proc_read); + snd_card_ro_proc_new(chip->card, chip->card->driver, + chip, snd_ad1889_proc_read); } static const struct ac97_quirk ac97_quirks[] = { diff --git a/sound/pci/ak4531_codec.c b/sound/pci/ak4531_codec.c index 2fb1fbba3e5e..11e902cac71b 100644 --- a/sound/pci/ak4531_codec.c +++ b/sound/pci/ak4531_codec.c @@ -481,8 +481,5 @@ static void snd_ak4531_proc_read(struct snd_info_entry *entry, static void snd_ak4531_proc_init(struct snd_card *card, struct snd_ak4531 *ak4531) { - struct snd_info_entry *entry; - - if (! snd_card_proc_new(card, "ak4531", &entry)) - snd_info_set_text_ops(entry, ak4531, snd_ak4531_proc_read); + snd_card_ro_proc_new(card, "ak4531", ak4531, snd_ak4531_proc_read); } diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c index e781ccca1793..f7fbe05836b3 100644 --- a/sound/pci/ali5451/ali5451.c +++ b/sound/pci/ali5451/ali5451.c @@ -2049,9 +2049,7 @@ static void snd_ali_proc_read(struct snd_info_entry *entry, static void snd_ali_proc_init(struct snd_ali *codec) { - struct snd_info_entry *entry; - if (!snd_card_proc_new(codec->card, "ali5451", &entry)) - snd_info_set_text_ops(entry, codec, snd_ali_proc_read); + snd_card_ro_proc_new(codec->card, "ali5451", codec, snd_ali_proc_read); } static int snd_ali_resources(struct snd_ali *codec) diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c index aad74e809797..32b2f9802479 100644 --- a/sound/pci/asihpi/asihpi.c +++ b/sound/pci/asihpi/asihpi.c @@ -2782,10 +2782,8 @@ snd_asihpi_proc_read(struct snd_info_entry *entry, static void snd_asihpi_proc_init(struct snd_card_asihpi *asihpi) { - struct snd_info_entry *entry; - - if (!snd_card_proc_new(asihpi->card, "info", &entry)) - snd_info_set_text_ops(entry, asihpi, snd_asihpi_proc_read); + snd_card_ro_proc_new(asihpi->card, "info", asihpi, + snd_asihpi_proc_read); } /*------------------------------------------------------------ diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c index 7715d26916ac..169763c88f5e 100644 --- a/sound/pci/atiixp.c +++ b/sound/pci/atiixp.c @@ -1543,10 +1543,7 @@ static void snd_atiixp_proc_read(struct snd_info_entry *entry, static void snd_atiixp_proc_init(struct atiixp *chip) { - struct snd_info_entry *entry; - - if (! snd_card_proc_new(chip->card, "atiixp", &entry)) - snd_info_set_text_ops(entry, chip, snd_atiixp_proc_read); + snd_card_ro_proc_new(chip->card, "atiixp", chip, snd_atiixp_proc_read); } diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c index a357a8e2e73d..cece66bb3644 100644 --- a/sound/pci/atiixp_modem.c +++ b/sound/pci/atiixp_modem.c @@ -1170,10 +1170,8 @@ static void snd_atiixp_proc_read(struct snd_info_entry *entry, static void snd_atiixp_proc_init(struct atiixp_modem *chip) { - struct snd_info_entry *entry; - - if (! snd_card_proc_new(chip->card, "atiixp-modem", &entry)) - snd_info_set_text_ops(entry, chip, snd_atiixp_proc_read); + snd_card_ro_proc_new(chip->card, "atiixp-modem", chip, + snd_atiixp_proc_read); } diff --git a/sound/pci/ca0106/ca0106_proc.c b/sound/pci/ca0106/ca0106_proc.c index a2c85cc37972..f5b8934db735 100644 --- a/sound/pci/ca0106/ca0106_proc.c +++ b/sound/pci/ca0106/ca0106_proc.c @@ -424,30 +424,20 @@ static void snd_ca0106_proc_i2c_write(struct snd_info_entry *entry, int snd_ca0106_proc_init(struct snd_ca0106 *emu) { - struct snd_info_entry *entry; - - if(! snd_card_proc_new(emu->card, "iec958", &entry)) - snd_info_set_text_ops(entry, emu, snd_ca0106_proc_iec958); - if(! snd_card_proc_new(emu->card, "ca0106_reg32", &entry)) { - snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read32); - entry->c.text.write = snd_ca0106_proc_reg_write32; - entry->mode |= 0200; - } - if(! snd_card_proc_new(emu->card, "ca0106_reg16", &entry)) - snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read16); - if(! snd_card_proc_new(emu->card, "ca0106_reg8", &entry)) - snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read8); - if(! snd_card_proc_new(emu->card, "ca0106_regs1", &entry)) { - snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read1); - entry->c.text.write = snd_ca0106_proc_reg_write; - entry->mode |= 0200; - } - if(! snd_card_proc_new(emu->card, "ca0106_i2c", &entry)) { - entry->c.text.write = snd_ca0106_proc_i2c_write; - entry->private_data = emu; - entry->mode |= 0200; - } - if(! snd_card_proc_new(emu->card, "ca0106_regs2", &entry)) - snd_info_set_text_ops(entry, emu, snd_ca0106_proc_reg_read2); + snd_card_ro_proc_new(emu->card, "iec958", emu, snd_ca0106_proc_iec958); + snd_card_rw_proc_new(emu->card, "ca0106_reg32", emu, + snd_ca0106_proc_reg_read32, + snd_ca0106_proc_reg_write32); + snd_card_ro_proc_new(emu->card, "ca0106_reg16", emu, + snd_ca0106_proc_reg_read16); + snd_card_ro_proc_new(emu->card, "ca0106_reg8", emu, + snd_ca0106_proc_reg_read8); + snd_card_rw_proc_new(emu->card, "ca0106_regs1", emu, + snd_ca0106_proc_reg_read1, + snd_ca0106_proc_reg_write); + snd_card_rw_proc_new(emu->card, "ca0106_i2c", emu, NULL, + snd_ca0106_proc_i2c_write); + snd_card_ro_proc_new(emu->card, "ca0106_regs2", emu, + snd_ca0106_proc_reg_read2); return 0; } diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index 5bbf31c1695c..701be04aed53 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c @@ -2792,10 +2792,7 @@ static void snd_cmipci_proc_read(struct snd_info_entry *entry, static void snd_cmipci_proc_init(struct cmipci *cm) { - struct snd_info_entry *entry; - - if (! snd_card_proc_new(cm->card, "cmipci", &entry)) - snd_info_set_text_ops(entry, cm, snd_cmipci_proc_read); + snd_card_ro_proc_new(cm->card, "cmipci", cm, snd_cmipci_proc_read); } static const struct pci_device_id snd_cmipci_ids[] = { diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c index a9fb819cad1d..15bbf9564c82 100644 --- a/sound/pci/cs4281.c +++ b/sound/pci/cs4281.c @@ -1174,8 +1174,7 @@ static void snd_cs4281_proc_init(struct cs4281 *chip) { struct snd_info_entry *entry; - if (! snd_card_proc_new(chip->card, "cs4281", &entry)) - snd_info_set_text_ops(entry, chip, snd_cs4281_proc_read); + snd_card_ro_proc_new(chip->card, "cs4281", chip, snd_cs4281_proc_read); if (! snd_card_proc_new(chip->card, "cs4281_BA0", &entry)) { entry->content = SNDRV_INFO_CONTENT_DATA; entry->private_data = chip; diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c index 611589cbdad6..576c7bd03a1a 100644 --- a/sound/pci/emu10k1/emu10k1x.c +++ b/sound/pci/emu10k1/emu10k1x.c @@ -1065,15 +1065,9 @@ static void snd_emu10k1x_proc_reg_write(struct snd_info_entry *entry, static int snd_emu10k1x_proc_init(struct emu10k1x *emu) { - struct snd_info_entry *entry; - - if(! snd_card_proc_new(emu->card, "emu10k1x_regs", &entry)) { - snd_info_set_text_ops(entry, emu, snd_emu10k1x_proc_reg_read); - entry->c.text.write = snd_emu10k1x_proc_reg_write; - entry->mode |= 0200; - entry->private_data = emu; - } - + snd_card_rw_proc_new(emu->card, "emu10k1x_regs", emu, + snd_emu10k1x_proc_reg_read, + snd_emu10k1x_proc_reg_write); return 0; } diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c index b57008031792..a3d9f06e8e6a 100644 --- a/sound/pci/emu10k1/emuproc.c +++ b/sound/pci/emu10k1/emuproc.c @@ -568,55 +568,40 @@ int snd_emu10k1_proc_init(struct snd_emu10k1 *emu) struct snd_info_entry *entry; #ifdef CONFIG_SND_DEBUG if (emu->card_capabilities->emu_model) { - if (! snd_card_proc_new(emu->card, "emu1010_regs", &entry)) - snd_info_set_text_ops(entry, emu, snd_emu_proc_emu1010_reg_read); - } - if (! snd_card_proc_new(emu->card, "io_regs", &entry)) { - snd_info_set_text_ops(entry, emu, snd_emu_proc_io_reg_read); - entry->c.text.write = snd_emu_proc_io_reg_write; - entry->mode |= 0200; - } - if (! snd_card_proc_new(emu->card, "ptr_regs00a", &entry)) { - snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read00a); - entry->c.text.write = snd_emu_proc_ptr_reg_write00; - entry->mode |= 0200; - } - if (! snd_card_proc_new(emu->card, "ptr_regs00b", &entry)) { - snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read00b); - entry->c.text.write = snd_emu_proc_ptr_reg_write00; - entry->mode |= 0200; - } - if (! snd_card_proc_new(emu->card, "ptr_regs20a", &entry)) { - snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read20a); - entry->c.text.write = snd_emu_proc_ptr_reg_write20; - entry->mode |= 0200; - } - if (! snd_card_proc_new(emu->card, "ptr_regs20b", &entry)) { - snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read20b); - entry->c.text.write = snd_emu_proc_ptr_reg_write20; - entry->mode |= 0200; - } - if (! snd_card_proc_new(emu->card, "ptr_regs20c", &entry)) { - snd_info_set_text_ops(entry, emu, snd_emu_proc_ptr_reg_read20c); - entry->c.text.write = snd_emu_proc_ptr_reg_write20; - entry->mode |= 0200; + snd_card_ro_proc_new(emu->card, "emu1010_regs", + emu, snd_emu_proc_emu1010_reg_read); } + snd_card_rw_proc_new(emu->card, "io_regs", emu, + snd_emu_proc_io_reg_read, + snd_emu_proc_io_reg_write); + snd_card_rw_proc_new(emu->card, "ptr_regs00a", emu, + snd_emu_proc_ptr_reg_read00a, + snd_emu_proc_ptr_reg_write00); + snd_card_rw_proc_new(emu->card, "ptr_regs00b", emu, + snd_emu_proc_ptr_reg_read00b, + snd_emu_proc_ptr_reg_write00); + snd_card_rw_proc_new(emu->card, "ptr_regs20a", emu, + snd_emu_proc_ptr_reg_read20a, + snd_emu_proc_ptr_reg_write20); + snd_card_rw_proc_new(emu->card, "ptr_regs20b", emu, + snd_emu_proc_ptr_reg_read20b, + snd_emu_proc_ptr_reg_write20); + snd_card_rw_proc_new(emu->card, "ptr_regs20c", emu, + snd_emu_proc_ptr_reg_read20c, + snd_emu_proc_ptr_reg_write20); #endif - if (! snd_card_proc_new(emu->card, "emu10k1", &entry)) - snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_read); + snd_card_ro_proc_new(emu->card, "emu10k1", emu, snd_emu10k1_proc_read); - if (emu->card_capabilities->emu10k2_chip) { - if (! snd_card_proc_new(emu->card, "spdif-in", &entry)) - snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_spdif_read); - } - if (emu->card_capabilities->ca0151_chip) { - if (! snd_card_proc_new(emu->card, "capture-rates", &entry)) - snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_rates_read); - } + if (emu->card_capabilities->emu10k2_chip) + snd_card_ro_proc_new(emu->card, "spdif-in", emu, + snd_emu10k1_proc_spdif_read); + if (emu->card_capabilities->ca0151_chip) + snd_card_ro_proc_new(emu->card, "capture-rates", emu, + snd_emu10k1_proc_rates_read); - if (! snd_card_proc_new(emu->card, "voices", &entry)) - snd_info_set_text_ops(entry, emu, snd_emu10k1_proc_voices_read); + snd_card_ro_proc_new(emu->card, "voices", emu, + snd_emu10k1_proc_voices_read); if (! snd_card_proc_new(emu->card, "fx8010_gpr", &entry)) { entry->content = SNDRV_INFO_CONTENT_DATA; @@ -646,11 +631,7 @@ int snd_emu10k1_proc_init(struct snd_emu10k1 *emu) entry->size = emu->audigy ? A_TOTAL_SIZE_CODE : TOTAL_SIZE_CODE; entry->c.ops = &snd_emu10k1_proc_ops_fx8010; } - if (! snd_card_proc_new(emu->card, "fx8010_acode", &entry)) { - entry->content = SNDRV_INFO_CONTENT_TEXT; - entry->private_data = emu; - entry->mode = S_IFREG | 0444 /*| S_IWUSR*/; - entry->c.text.read = snd_emu10k1_proc_acode_read; - } + snd_card_ro_proc_new(emu->card, "fx8010_acode", emu, + snd_emu10k1_proc_acode_read); return 0; } diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index 1f2960ecc57e..1cfff35e370e 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c @@ -1902,10 +1902,8 @@ static void snd_ensoniq_proc_read(struct snd_info_entry *entry, static void snd_ensoniq_proc_init(struct ensoniq *ensoniq) { - struct snd_info_entry *entry; - - if (! snd_card_proc_new(ensoniq->card, "audiopci", &entry)) - snd_info_set_text_ops(entry, ensoniq, snd_ensoniq_proc_read); + snd_card_ro_proc_new(ensoniq->card, "audiopci", ensoniq, + snd_ensoniq_proc_read); } /* diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c index a65740419650..853842987fa1 100644 --- a/sound/pci/hda/hda_proc.c +++ b/sound/pci/hda/hda_proc.c @@ -919,15 +919,8 @@ static void print_codec_info(struct snd_info_entry *entry, int snd_hda_codec_proc_new(struct hda_codec *codec) { char name[32]; - struct snd_info_entry *entry; - int err; snprintf(name, sizeof(name), "codec#%d", codec->core.addr); - err = snd_card_proc_new(codec->card, name, &entry); - if (err < 0) - return err; - - snd_info_set_text_ops(entry, codec, print_codec_info); - return 0; + return snd_card_ro_proc_new(codec->card, name, codec, print_codec_info); } diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index dda9b26192cb..fa7d90ee6e2d 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c @@ -1603,10 +1603,7 @@ static void snd_ice1712_proc_read(struct snd_info_entry *entry, static void snd_ice1712_proc_init(struct snd_ice1712 *ice) { - struct snd_info_entry *entry; - - if (!snd_card_proc_new(ice->card, "ice1712", &entry)) - snd_info_set_text_ops(entry, ice, snd_ice1712_proc_read); + snd_card_ro_proc_new(ice->card, "ice1712", ice, snd_ice1712_proc_read); } /* diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 42994cf36156..a7d640ee4a17 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -1571,10 +1571,7 @@ static void snd_vt1724_proc_read(struct snd_info_entry *entry, static void snd_vt1724_proc_init(struct snd_ice1712 *ice) { - struct snd_info_entry *entry; - - if (!snd_card_proc_new(ice->card, "ice1724", &entry)) - snd_info_set_text_ops(entry, ice, snd_vt1724_proc_read); + snd_card_ro_proc_new(ice->card, "ice1724", ice, snd_vt1724_proc_read); } /* diff --git a/sound/pci/ice1712/pontis.c b/sound/pci/ice1712/pontis.c index 93b8cfc6636f..f499f1e8d0c9 100644 --- a/sound/pci/ice1712/pontis.c +++ b/sound/pci/ice1712/pontis.c @@ -659,12 +659,8 @@ static void wm_proc_regs_read(struct snd_info_entry *entry, struct snd_info_buff static void wm_proc_init(struct snd_ice1712 *ice) { - struct snd_info_entry *entry; - if (! snd_card_proc_new(ice->card, "wm_codec", &entry)) { - snd_info_set_text_ops(entry, ice, wm_proc_regs_read); - entry->mode |= 0200; - entry->c.text.write = wm_proc_regs_write; - } + snd_card_rw_proc_new(ice->card, "wm_codec", ice, wm_proc_regs_read, + wm_proc_regs_write); } static void cs_proc_regs_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) @@ -684,9 +680,7 @@ static void cs_proc_regs_read(struct snd_info_entry *entry, struct snd_info_buff static void cs_proc_init(struct snd_ice1712 *ice) { - struct snd_info_entry *entry; - if (! snd_card_proc_new(ice->card, "cs_codec", &entry)) - snd_info_set_text_ops(entry, ice, cs_proc_regs_read); + snd_card_ro_proc_new(ice->card, "cs_codec", ice, cs_proc_regs_read); } diff --git a/sound/pci/ice1712/prodigy192.c b/sound/pci/ice1712/prodigy192.c index 3919aed39ca0..d243309029d3 100644 --- a/sound/pci/ice1712/prodigy192.c +++ b/sound/pci/ice1712/prodigy192.c @@ -651,9 +651,8 @@ static void stac9460_proc_regs_read(struct snd_info_entry *entry, static void stac9460_proc_init(struct snd_ice1712 *ice) { - struct snd_info_entry *entry; - if (!snd_card_proc_new(ice->card, "stac9460_codec", &entry)) - snd_info_set_text_ops(entry, ice, stac9460_proc_regs_read); + snd_card_ro_proc_new(ice->card, "stac9460_codec", ice, + stac9460_proc_regs_read); } diff --git a/sound/pci/ice1712/prodigy_hifi.c b/sound/pci/ice1712/prodigy_hifi.c index c97b5528e4b8..72f252c936e5 100644 --- a/sound/pci/ice1712/prodigy_hifi.c +++ b/sound/pci/ice1712/prodigy_hifi.c @@ -904,12 +904,8 @@ static void wm_proc_regs_read(struct snd_info_entry *entry, static void wm_proc_init(struct snd_ice1712 *ice) { - struct snd_info_entry *entry; - if (!snd_card_proc_new(ice->card, "wm_codec", &entry)) { - snd_info_set_text_ops(entry, ice, wm_proc_regs_read); - entry->mode |= 0200; - entry->c.text.write = wm_proc_regs_write; - } + snd_card_rw_proc_new(ice->card, "wm_codec", ice, wm_proc_regs_read, + wm_proc_regs_write); } static int prodigy_hifi_add_controls(struct snd_ice1712 *ice) diff --git a/sound/pci/ice1712/quartet.c b/sound/pci/ice1712/quartet.c index 5bc836241c97..8ad964ee0b65 100644 --- a/sound/pci/ice1712/quartet.c +++ b/sound/pci/ice1712/quartet.c @@ -502,9 +502,7 @@ static void proc_regs_read(struct snd_info_entry *entry, static void proc_init(struct snd_ice1712 *ice) { - struct snd_info_entry *entry; - if (!snd_card_proc_new(ice->card, "quartet", &entry)) - snd_info_set_text_ops(entry, ice, proc_regs_read); + snd_card_ro_proc_new(ice->card, "quartet", ice, proc_regs_read); } static int qtet_mute_get(struct snd_kcontrol *kcontrol, diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c index 885e1d488ed6..2784bf48cf5a 100644 --- a/sound/pci/intel8x0.c +++ b/sound/pci/intel8x0.c @@ -2863,10 +2863,8 @@ static void snd_intel8x0_proc_read(struct snd_info_entry * entry, static void snd_intel8x0_proc_init(struct intel8x0 *chip) { - struct snd_info_entry *entry; - - if (! snd_card_proc_new(chip->card, "intel8x0", &entry)) - snd_info_set_text_ops(entry, chip, snd_intel8x0_proc_read); + snd_card_ro_proc_new(chip->card, "intel8x0", chip, + snd_intel8x0_proc_read); } static int snd_intel8x0_dev_free(struct snd_device *device) diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c index 44eb9e28a1eb..43c654e15452 100644 --- a/sound/pci/intel8x0m.c +++ b/sound/pci/intel8x0m.c @@ -1084,10 +1084,8 @@ static void snd_intel8x0m_proc_read(struct snd_info_entry * entry, static void snd_intel8x0m_proc_init(struct intel8x0m *chip) { - struct snd_info_entry *entry; - - if (! snd_card_proc_new(chip->card, "intel8x0m", &entry)) - snd_info_set_text_ops(entry, chip, snd_intel8x0m_proc_read); + snd_card_ro_proc_new(chip->card, "intel8x0m", chip, + snd_intel8x0m_proc_read); } static int snd_intel8x0m_dev_free(struct snd_device *device) diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c index 4e189a93f475..fe4aba8a08ea 100644 --- a/sound/pci/korg1212/korg1212.c +++ b/sound/pci/korg1212/korg1212.c @@ -2090,10 +2090,8 @@ static void snd_korg1212_proc_read(struct snd_info_entry *entry, static void snd_korg1212_proc_init(struct snd_korg1212 *korg1212) { - struct snd_info_entry *entry; - - if (! snd_card_proc_new(korg1212->card, "korg1212", &entry)) - snd_info_set_text_ops(entry, korg1212, snd_korg1212_proc_read); + snd_card_ro_proc_new(korg1212->card, "korg1212", korg1212, + snd_korg1212_proc_read); } static int diff --git a/sound/pci/lola/lola_proc.c b/sound/pci/lola/lola_proc.c index 904e3c4f4dfe..1603f9c81897 100644 --- a/sound/pci/lola/lola_proc.c +++ b/sound/pci/lola/lola_proc.c @@ -208,15 +208,9 @@ static void lola_proc_regs_read(struct snd_info_entry *entry, void lola_proc_debug_new(struct lola *chip) { - struct snd_info_entry *entry; - - if (!snd_card_proc_new(chip->card, "codec", &entry)) - snd_info_set_text_ops(entry, chip, lola_proc_codec_read); - if (!snd_card_proc_new(chip->card, "codec_rw", &entry)) { - snd_info_set_text_ops(entry, chip, lola_proc_codec_rw_read); - entry->mode |= 0200; - entry->c.text.write = lola_proc_codec_rw_write; - } - if (!snd_card_proc_new(chip->card, "regs", &entry)) - snd_info_set_text_ops(entry, chip, lola_proc_regs_read); + snd_card_ro_proc_new(chip->card, "codec", chip, lola_proc_codec_read); + snd_card_rw_proc_new(chip->card, "codec_rw", chip, + lola_proc_codec_rw_read, + lola_proc_codec_rw_write); + snd_card_ro_proc_new(chip->card, "regs", chip, lola_proc_regs_read); } diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c index 54f6252faca6..198ccf9b5eb3 100644 --- a/sound/pci/lx6464es/lx6464es.c +++ b/sound/pci/lx6464es/lx6464es.c @@ -948,13 +948,7 @@ static void lx_proc_levels_read(struct snd_info_entry *entry, static int lx_proc_create(struct snd_card *card, struct lx6464es *chip) { - struct snd_info_entry *entry; - int err = snd_card_proc_new(card, "levels", &entry); - if (err < 0) - return err; - - snd_info_set_text_ops(entry, chip, lx_proc_levels_read); - return 0; + return snd_card_ro_proc_new(card, "levels", chip, lx_proc_levels_read); } diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c index 9cd297a42f24..92f616df3863 100644 --- a/sound/pci/mixart/mixart.c +++ b/sound/pci/mixart/mixart.c @@ -1220,10 +1220,8 @@ static void snd_mixart_proc_init(struct snd_mixart *chip) struct snd_info_entry *entry; /* text interface to read perf and temp meters */ - if (! snd_card_proc_new(chip->card, "board_info", &entry)) { - entry->private_data = chip; - entry->c.text.read = snd_mixart_proc_read; - } + snd_card_ro_proc_new(chip->card, "board_info", chip, + snd_mixart_proc_read); if (! snd_card_proc_new(chip->card, "mixart_BA0", &entry)) { entry->content = SNDRV_INFO_CONTENT_DATA; diff --git a/sound/pci/oxygen/oxygen_lib.c b/sound/pci/oxygen/oxygen_lib.c index d4cfff7e49e1..3ae9dd4b39e8 100644 --- a/sound/pci/oxygen/oxygen_lib.c +++ b/sound/pci/oxygen/oxygen_lib.c @@ -244,10 +244,7 @@ static void oxygen_proc_read(struct snd_info_entry *entry, static void oxygen_proc_init(struct oxygen *chip) { - struct snd_info_entry *entry; - - if (!snd_card_proc_new(chip->card, "oxygen", &entry)) - snd_info_set_text_ops(entry, chip, oxygen_proc_read); + snd_card_ro_proc_new(chip->card, "oxygen", chip, oxygen_proc_read); } static const struct pci_device_id * diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c index e57da4036231..4ab7efc6e9f7 100644 --- a/sound/pci/pcxhr/pcxhr.c +++ b/sound/pci/pcxhr/pcxhr.c @@ -1454,21 +1454,14 @@ static void pcxhr_proc_ltc(struct snd_info_entry *entry, static void pcxhr_proc_init(struct snd_pcxhr *chip) { - struct snd_info_entry *entry; - - if (! snd_card_proc_new(chip->card, "info", &entry)) - snd_info_set_text_ops(entry, chip, pcxhr_proc_info); - if (! snd_card_proc_new(chip->card, "sync", &entry)) - snd_info_set_text_ops(entry, chip, pcxhr_proc_sync); + snd_card_ro_proc_new(chip->card, "info", chip, pcxhr_proc_info); + snd_card_ro_proc_new(chip->card, "sync", chip, pcxhr_proc_sync); /* gpio available on stereo sound cards only */ - if (chip->mgr->is_hr_stereo && - !snd_card_proc_new(chip->card, "gpio", &entry)) { - snd_info_set_text_ops(entry, chip, pcxhr_proc_gpio_read); - entry->c.text.write = pcxhr_proc_gpo_write; - entry->mode |= 0200; - } - if (!snd_card_proc_new(chip->card, "ltc", &entry)) - snd_info_set_text_ops(entry, chip, pcxhr_proc_ltc); + if (chip->mgr->is_hr_stereo) + snd_card_rw_proc_new(chip->card, "gpio", chip, + pcxhr_proc_gpio_read, + pcxhr_proc_gpo_write); + snd_card_ro_proc_new(chip->card, "ltc", chip, pcxhr_proc_ltc); } /* end of proc interface */ diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c index 1d431c8052d6..8d1a56a9bcfd 100644 --- a/sound/pci/riptide/riptide.c +++ b/sound/pci/riptide/riptide.c @@ -1973,10 +1973,8 @@ snd_riptide_proc_read(struct snd_info_entry *entry, static void snd_riptide_proc_init(struct snd_riptide *chip) { - struct snd_info_entry *entry; - - if (!snd_card_proc_new(chip->card, "riptide", &entry)) - snd_info_set_text_ops(entry, chip, snd_riptide_proc_read); + snd_card_ro_proc_new(chip->card, "riptide", chip, + snd_riptide_proc_read); } static int snd_riptide_mixer(struct snd_riptide *chip) diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c index 3ac8c71d567c..c6bcc0715716 100644 --- a/sound/pci/rme32.c +++ b/sound/pci/rme32.c @@ -1568,10 +1568,7 @@ snd_rme32_proc_read(struct snd_info_entry * entry, struct snd_info_buffer *buffe static void snd_rme32_proc_init(struct rme32 *rme32) { - struct snd_info_entry *entry; - - if (! snd_card_proc_new(rme32->card, "rme32", &entry)) - snd_info_set_text_ops(entry, rme32, snd_rme32_proc_read); + snd_card_ro_proc_new(rme32->card, "rme32", rme32, snd_rme32_proc_read); } /* diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c index c56702e6cb60..42c6b5e09072 100644 --- a/sound/pci/rme96.c +++ b/sound/pci/rme96.c @@ -1868,10 +1868,7 @@ snd_rme96_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer static void snd_rme96_proc_init(struct rme96 *rme96) { - struct snd_info_entry *entry; - - if (! snd_card_proc_new(rme96->card, "rme96", &entry)) - snd_info_set_text_ops(entry, rme96, snd_rme96_proc_read); + snd_card_ro_proc_new(rme96->card, "rme96", rme96, snd_rme96_proc_read); } /* diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c index ba99ff0e93e0..29bef48a3af3 100644 --- a/sound/pci/rme9652/hdsp.c +++ b/sound/pci/rme9652/hdsp.c @@ -3708,10 +3708,7 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) static void snd_hdsp_proc_init(struct hdsp *hdsp) { - struct snd_info_entry *entry; - - if (! snd_card_proc_new(hdsp->card, "hdsp", &entry)) - snd_info_set_text_ops(entry, hdsp, snd_hdsp_proc_read); + snd_card_ro_proc_new(hdsp->card, "hdsp", hdsp, snd_hdsp_proc_read); } static void snd_hdsp_free_buffers(struct hdsp *hdsp) diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c index 679ad0415e3b..d485dd8a7b72 100644 --- a/sound/pci/rme9652/hdspm.c +++ b/sound/pci/rme9652/hdspm.c @@ -5287,44 +5287,35 @@ static void snd_hdspm_proc_ports_out(struct snd_info_entry *entry, static void snd_hdspm_proc_init(struct hdspm *hdspm) { - struct snd_info_entry *entry; + void (*read)(struct snd_info_entry *, struct snd_info_buffer *) = NULL; - if (!snd_card_proc_new(hdspm->card, "hdspm", &entry)) { - switch (hdspm->io_type) { - case AES32: - snd_info_set_text_ops(entry, hdspm, - snd_hdspm_proc_read_aes32); - break; - case MADI: - snd_info_set_text_ops(entry, hdspm, - snd_hdspm_proc_read_madi); - break; - case MADIface: - /* snd_info_set_text_ops(entry, hdspm, - snd_hdspm_proc_read_madiface); */ - break; - case RayDAT: - snd_info_set_text_ops(entry, hdspm, - snd_hdspm_proc_read_raydat); - break; - case AIO: - break; - } - } - - if (!snd_card_proc_new(hdspm->card, "ports.in", &entry)) { - snd_info_set_text_ops(entry, hdspm, snd_hdspm_proc_ports_in); + switch (hdspm->io_type) { + case AES32: + read = snd_hdspm_proc_read_aes32; + break; + case MADI: + read = snd_hdspm_proc_read_madi; + break; + case MADIface: + /* read = snd_hdspm_proc_read_madiface; */ + break; + case RayDAT: + read = snd_hdspm_proc_read_raydat; + break; + case AIO: + break; } - if (!snd_card_proc_new(hdspm->card, "ports.out", &entry)) { - snd_info_set_text_ops(entry, hdspm, snd_hdspm_proc_ports_out); - } + snd_card_ro_proc_new(hdspm->card, "hdspm", hdspm, read); + snd_card_ro_proc_new(hdspm->card, "ports.in", hdspm, + snd_hdspm_proc_ports_in); + snd_card_ro_proc_new(hdspm->card, "ports.out", hdspm, + snd_hdspm_proc_ports_out); #ifdef CONFIG_SND_DEBUG /* debug file to read all hdspm registers */ - if (!snd_card_proc_new(hdspm->card, "debug", &entry)) - snd_info_set_text_ops(entry, hdspm, - snd_hdspm_proc_read_debug); + snd_card_ro_proc_new(hdspm->card, "debug", hdspm, + snd_hdspm_proc_read_debug); #endif } diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c index edd765e22377..5228b982da5a 100644 --- a/sound/pci/rme9652/rme9652.c +++ b/sound/pci/rme9652/rme9652.c @@ -1737,10 +1737,8 @@ snd_rme9652_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buff static void snd_rme9652_proc_init(struct snd_rme9652 *rme9652) { - struct snd_info_entry *entry; - - if (! snd_card_proc_new(rme9652->card, "rme9652", &entry)) - snd_info_set_text_ops(entry, rme9652, snd_rme9652_proc_read); + snd_card_ro_proc_new(rme9652->card, "rme9652", rme9652, + snd_rme9652_proc_read); } static void snd_rme9652_free_buffers(struct snd_rme9652 *rme9652) diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c index 7218f38b59db..71d5ad3cffd6 100644 --- a/sound/pci/sonicvibes.c +++ b/sound/pci/sonicvibes.c @@ -1171,10 +1171,8 @@ static void snd_sonicvibes_proc_read(struct snd_info_entry *entry, static void snd_sonicvibes_proc_init(struct sonicvibes *sonic) { - struct snd_info_entry *entry; - - if (! snd_card_proc_new(sonic->card, "sonicvibes", &entry)) - snd_info_set_text_ops(entry, sonic, snd_sonicvibes_proc_read); + snd_card_ro_proc_new(sonic->card, "sonicvibes", sonic, + snd_sonicvibes_proc_read); } /* diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c index f271ea436cff..0ff32d3f5d3b 100644 --- a/sound/pci/trident/trident_main.c +++ b/sound/pci/trident/trident_main.c @@ -3320,13 +3320,11 @@ static void snd_trident_proc_read(struct snd_info_entry *entry, static void snd_trident_proc_init(struct snd_trident *trident) { - struct snd_info_entry *entry; const char *s = "trident"; if (trident->device == TRIDENT_DEVICE_ID_SI7018) s = "sis7018"; - if (! snd_card_proc_new(trident->card, s, &entry)) - snd_info_set_text_ops(entry, trident, snd_trident_proc_read); + snd_card_ro_proc_new(trident->card, s, trident, snd_trident_proc_read); } static int snd_trident_dev_free(struct snd_device *device) diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index 736ac79901b3..dee1c487d6ba 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c @@ -2144,10 +2144,8 @@ static void snd_via82xx_proc_read(struct snd_info_entry *entry, static void snd_via82xx_proc_init(struct via82xx *chip) { - struct snd_info_entry *entry; - - if (! snd_card_proc_new(chip->card, "via82xx", &entry)) - snd_info_set_text_ops(entry, chip, snd_via82xx_proc_read); + snd_card_ro_proc_new(chip->card, "via82xx", chip, + snd_via82xx_proc_read); } /* diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c index 3f59e0279058..848bf9dbf8cd 100644 --- a/sound/pci/via82xx_modem.c +++ b/sound/pci/via82xx_modem.c @@ -937,10 +937,8 @@ static void snd_via82xx_proc_read(struct snd_info_entry *entry, struct snd_info_ static void snd_via82xx_proc_init(struct via82xx_modem *chip) { - struct snd_info_entry *entry; - - if (! snd_card_proc_new(chip->card, "via82xx", &entry)) - snd_info_set_text_ops(entry, chip, snd_via82xx_proc_read); + snd_card_ro_proc_new(chip->card, "via82xx", chip, + snd_via82xx_proc_read); } /* diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c index c688b7f481da..4d48877f211f 100644 --- a/sound/pci/ymfpci/ymfpci_main.c +++ b/sound/pci/ymfpci/ymfpci_main.c @@ -1985,11 +1985,7 @@ static void snd_ymfpci_proc_read(struct snd_info_entry *entry, static int snd_ymfpci_proc_init(struct snd_card *card, struct snd_ymfpci *chip) { - struct snd_info_entry *entry; - - if (! snd_card_proc_new(card, "ymfpci", &entry)) - snd_info_set_text_ops(entry, chip, snd_ymfpci_proc_read); - return 0; + return snd_card_ro_proc_new(card, "ymfpci", chip, snd_ymfpci_proc_read); } /* From patchwork Mon Feb 4 15:20:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 10795921 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 5DD4B13BF for ; Mon, 4 Feb 2019 15:21:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 474202B9BB for ; Mon, 4 Feb 2019 15:21:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 390772B9DF; Mon, 4 Feb 2019 15:21:44 +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 8F11C2B9DF for ; Mon, 4 Feb 2019 15:21:43 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 8C9112675B2; Mon, 4 Feb 2019 16:21:02 +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 2D5D0267572; 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 12590267567 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 9A65FAF4D 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:34 +0100 Message-Id: <20190204152036.14102-10-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 09/11] ALSA: pcmcia: 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/pcmcia/pdaudiocf/pdaudiocf_core.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c index eabf29252895..910478275fd9 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c @@ -148,10 +148,7 @@ static void pdacf_proc_read(struct snd_info_entry * entry, static void pdacf_proc_init(struct snd_pdacf *chip) { - struct snd_info_entry *entry; - - if (! snd_card_proc_new(chip->card, "pdaudiocf", &entry)) - snd_info_set_text_ops(entry, chip, pdacf_proc_read); + snd_card_ro_proc_new(chip->card, "pdaudiocf", chip, pdacf_proc_read); } struct snd_pdacf *snd_pdacf_create(struct snd_card *card) From patchwork Mon Feb 4 15:20:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 10795919 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 430DB6C2 for ; Mon, 4 Feb 2019 15:21:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 312C62BA36 for ; Mon, 4 Feb 2019 15:21:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 256672BA25; Mon, 4 Feb 2019 15:21:38 +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 A33182BA38 for ; Mon, 4 Feb 2019 15:21:37 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 03FF32675BB; Mon, 4 Feb 2019 16:21:01 +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 E831926755C; Mon, 4 Feb 2019 16:20:47 +0100 (CET) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id DFF83267563 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 A6E82AF50 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:35 +0100 Message-Id: <20190204152036.14102-11-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 10/11] ALSA: sparc: 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/sparc/dbri.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c index 7609eceba1a2..682166202098 100644 --- a/sound/sparc/dbri.c +++ b/sound/sparc/dbri.c @@ -2510,16 +2510,10 @@ static void dbri_debug_read(struct snd_info_entry *entry, static void snd_dbri_proc(struct snd_card *card) { struct snd_dbri *dbri = card->private_data; - struct snd_info_entry *entry; - - if (!snd_card_proc_new(card, "regs", &entry)) - snd_info_set_text_ops(entry, dbri, dbri_regs_read); + snd_card_ro_proc_new(card, "regs", dbri, dbri_regs_read); #ifdef DBRI_DEBUG - if (!snd_card_proc_new(card, "debug", &entry)) { - snd_info_set_text_ops(entry, dbri, dbri_debug_read); - entry->mode = S_IFREG | 0444; /* Readable only. */ - } + snd_card_ro_proc_new(card, "debug", dbri, dbri_debug_read); #endif } 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); }