From patchwork Tue Feb 5 16:07:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 10797651 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 62E4B186D for ; Tue, 5 Feb 2019 16:16:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4C5052C625 for ; Tue, 5 Feb 2019 16:16:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 40D762C5FD; Tue, 5 Feb 2019 16:16:21 +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 62E072BE00 for ; Tue, 5 Feb 2019 16:16:20 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id DD4FA2674C5; Tue, 5 Feb 2019 17:08: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 B507F267900; Tue, 5 Feb 2019 17:08:03 +0100 (CET) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 4CB5A2674C5 for ; Tue, 5 Feb 2019 17:08:01 +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 CB572B67F; Tue, 5 Feb 2019 16:08:00 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Date: Tue, 5 Feb 2019 17:07:55 +0100 Message-Id: <20190205160758.9172-2-tiwai@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190205160758.9172-1-tiwai@suse.de> References: <20190205160758.9172-1-tiwai@suse.de> Subject: [alsa-devel] [PATCH 1/4] ALSA: info: Drop unused snd_info_entry.card field 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 It's referred only in snd_card_id_read() which can receive the card object via private_data. Signed-off-by: Takashi Iwai --- include/sound/info.h | 1 - sound/core/info.c | 4 +--- sound/core/init.c | 6 ++++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/include/sound/info.h b/include/sound/info.h index 96530f7599e1..97fdda41e076 100644 --- a/include/sound/info.h +++ b/include/sound/info.h @@ -82,7 +82,6 @@ struct snd_info_entry { struct snd_info_entry_ops *ops; } c; struct snd_info_entry *parent; - struct snd_card *card; struct module *module; void *private_data; void (*private_free)(struct snd_info_entry *entry); diff --git a/sound/core/info.c b/sound/core/info.c index 92edc9488b5b..76800326ac56 100644 --- a/sound/core/info.c +++ b/sound/core/info.c @@ -750,10 +750,8 @@ struct snd_info_entry *snd_info_create_card_entry(struct snd_card *card, if (!parent) parent = card->proc_root; entry = snd_info_create_entry(name, parent); - if (entry) { + if (entry) entry->module = card->module; - entry->card = card; - } return entry; } EXPORT_SYMBOL(snd_info_create_card_entry); diff --git a/sound/core/init.c b/sound/core/init.c index 4849c611c0fe..5252a9ce13dc 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -104,7 +104,9 @@ EXPORT_SYMBOL(snd_mixer_oss_notify_callback); static void snd_card_id_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer) { - snd_iprintf(buffer, "%s\n", entry->card->id); + struct snd_card *card = entry->private_data; + + snd_iprintf(buffer, "%s\n", card->id); } static int init_info_for_card(struct snd_card *card) @@ -116,7 +118,7 @@ static int init_info_for_card(struct snd_card *card) dev_dbg(card->dev, "unable to create card entry\n"); return -ENOMEM; } - entry->c.text.read = snd_card_id_read; + snd_info_set_text_ops(entry, card, snd_card_id_read); card->proc_id = entry; return snd_info_card_register(card); From patchwork Tue Feb 5 16:07:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 10797653 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 7376213BF for ; Tue, 5 Feb 2019 16:16:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 603702BE00 for ; Tue, 5 Feb 2019 16:16:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 550442C660; Tue, 5 Feb 2019 16:16:21 +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 755902C5BB for ; Tue, 5 Feb 2019 16:16:20 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id D8F2B26793F; Tue, 5 Feb 2019 17:08:10 +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 7F17626790F; Tue, 5 Feb 2019 17:08:06 +0100 (CET) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id A2F572678F6 for ; Tue, 5 Feb 2019 17:08:01 +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 D9141B680; Tue, 5 Feb 2019 16:08:00 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Date: Tue, 5 Feb 2019 17:07:56 +0100 Message-Id: <20190205160758.9172-3-tiwai@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190205160758.9172-1-tiwai@suse.de> References: <20190205160758.9172-1-tiwai@suse.de> Subject: [alsa-devel] [PATCH 2/4] ALSA: info: Minor optimization 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 Just a minor code optimization to reduce the source code size slightly. No functional changes. Signed-off-by: Takashi Iwai --- sound/core/info.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/sound/core/info.c b/sound/core/info.c index 76800326ac56..12b80e6d9ee4 100644 --- a/sound/core/info.c +++ b/sound/core/info.c @@ -463,11 +463,12 @@ static struct snd_info_entry *create_subdir(struct module *mod, } static struct snd_info_entry * -snd_info_create_entry(const char *name, struct snd_info_entry *parent); +snd_info_create_entry(const char *name, struct snd_info_entry *parent, + struct module *module); int __init snd_info_init(void) { - snd_proc_root = snd_info_create_entry("asound", NULL); + snd_proc_root = snd_info_create_entry("asound", NULL, THIS_MODULE); if (!snd_proc_root) return -ENOMEM; snd_proc_root->mode = S_IFDIR | 0555; @@ -684,7 +685,8 @@ EXPORT_SYMBOL(snd_info_get_str); * Return: The pointer of the new instance, or %NULL on failure. */ static struct snd_info_entry * -snd_info_create_entry(const char *name, struct snd_info_entry *parent) +snd_info_create_entry(const char *name, struct snd_info_entry *parent, + struct module *module) { struct snd_info_entry *entry; entry = kzalloc(sizeof(*entry), GFP_KERNEL); @@ -701,6 +703,7 @@ snd_info_create_entry(const char *name, struct snd_info_entry *parent) INIT_LIST_HEAD(&entry->children); INIT_LIST_HEAD(&entry->list); entry->parent = parent; + entry->module = module; if (parent) list_add_tail(&entry->list, &parent->children); return entry; @@ -720,14 +723,9 @@ struct snd_info_entry *snd_info_create_module_entry(struct module * module, const char *name, struct snd_info_entry *parent) { - struct snd_info_entry *entry; - if (!parent) parent = snd_proc_root; - entry = snd_info_create_entry(name, parent); - if (entry) - entry->module = module; - return entry; + return snd_info_create_entry(name, parent, module); } EXPORT_SYMBOL(snd_info_create_module_entry); @@ -745,14 +743,9 @@ struct snd_info_entry *snd_info_create_card_entry(struct snd_card *card, const char *name, struct snd_info_entry * parent) { - struct snd_info_entry *entry; - if (!parent) parent = card->proc_root; - entry = snd_info_create_entry(name, parent); - if (entry) - entry->module = card->module; - return entry; + return snd_info_create_entry(name, parent, card->module); } EXPORT_SYMBOL(snd_info_create_card_entry); From patchwork Tue Feb 5 16:07:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 10797649 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 1FE5C1823 for ; Tue, 5 Feb 2019 16:16:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B3592BA78 for ; Tue, 5 Feb 2019 16:16:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F03EB2C5C7; Tue, 5 Feb 2019 16:16:20 +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 3FA892BBA8 for ; Tue, 5 Feb 2019 16:16:20 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 6B79226792E; Tue, 5 Feb 2019 17:08:12 +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 ADA15267909; Tue, 5 Feb 2019 17:08:06 +0100 (CET) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id A34AD2678FD for ; Tue, 5 Feb 2019 17:08:01 +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 E807BB681; Tue, 5 Feb 2019 16:08:00 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Date: Tue, 5 Feb 2019 17:07:57 +0100 Message-Id: <20190205160758.9172-4-tiwai@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190205160758.9172-1-tiwai@suse.de> References: <20190205160758.9172-1-tiwai@suse.de> Subject: [alsa-devel] [PATCH 3/4] ALSA: info: Move card id proc creation into info.c 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 creation of card's id proc file can be moved gracefully into info.c. Also, the assignment of card->proc_id is superfluous and can be dropped. So let's do it. Basically this is no functional change but code refactoring, but one potential behavior change is that now it returns properly the error code from snd_info_card_register(). Signed-off-by: Takashi Iwai --- include/sound/core.h | 1 - sound/core/info.c | 11 ++++++++++- sound/core/init.c | 33 ++++----------------------------- 3 files changed, 14 insertions(+), 31 deletions(-) diff --git a/include/sound/core.h b/include/sound/core.h index 36a5934cf4b1..e923c23e05dd 100644 --- a/include/sound/core.h +++ b/include/sound/core.h @@ -120,7 +120,6 @@ struct snd_card { struct list_head ctl_files; /* active control files */ struct snd_info_entry *proc_root; /* root for soundcard specific files */ - struct snd_info_entry *proc_id; /* the card id */ struct proc_dir_entry *proc_root_link; /* number link to real id */ struct list_head files_list; /* all files associated to this card */ diff --git a/sound/core/info.c b/sound/core/info.c index 12b80e6d9ee4..f8e054b9f1ae 100644 --- a/sound/core/info.c +++ b/sound/core/info.c @@ -504,6 +504,14 @@ int __exit snd_info_done(void) return 0; } +static void snd_card_id_read(struct snd_info_entry *entry, + struct snd_info_buffer *buffer) +{ + struct snd_card *card = entry->private_data; + + snd_iprintf(buffer, "%s\n", card->id); +} + /* * create a card proc file * called from init.c @@ -521,7 +529,8 @@ int snd_info_card_create(struct snd_card *card) if (!entry) return -ENOMEM; card->proc_root = entry; - return 0; + + return snd_card_ro_proc_new(card, "id", card, snd_card_id_read); } /* diff --git a/sound/core/init.c b/sound/core/init.c index 5252a9ce13dc..0c4dc40376a7 100644 --- a/sound/core/init.c +++ b/sound/core/init.c @@ -100,33 +100,6 @@ int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int free_flag); EXPORT_SYMBOL(snd_mixer_oss_notify_callback); #endif -#ifdef CONFIG_SND_PROC_FS -static void snd_card_id_read(struct snd_info_entry *entry, - struct snd_info_buffer *buffer) -{ - struct snd_card *card = entry->private_data; - - snd_iprintf(buffer, "%s\n", card->id); -} - -static int init_info_for_card(struct snd_card *card) -{ - struct snd_info_entry *entry; - - entry = snd_info_create_card_entry(card, "id", card->proc_root); - if (!entry) { - dev_dbg(card->dev, "unable to create card entry\n"); - return -ENOMEM; - } - snd_info_set_text_ops(entry, card, snd_card_id_read); - card->proc_id = entry; - - return snd_info_card_register(card); -} -#else /* !CONFIG_SND_PROC_FS */ -#define init_info_for_card(card) -#endif - static int check_empty_slot(struct module *module, int slot) { return !slots[slot] || !*slots[slot]; @@ -493,7 +466,6 @@ static int snd_card_do_free(struct snd_card *card) snd_device_free_all(card); if (card->private_free) card->private_free(card); - snd_info_free_entry(card->proc_id); if (snd_info_card_free(card) < 0) { dev_warn(card->dev, "unable to free card info\n"); /* Not fatal error */ @@ -797,7 +769,10 @@ int snd_card_register(struct snd_card *card) } snd_cards[card->number] = card; mutex_unlock(&snd_card_mutex); - init_info_for_card(card); + err = snd_info_card_register(card); + if (err < 0) + return err; + #if IS_ENABLED(CONFIG_SND_MIXER_OSS) if (snd_mixer_oss_notify_callback) snd_mixer_oss_notify_callback(card, SND_MIXER_OSS_NOTIFY_REGISTER); From patchwork Tue Feb 5 16:07:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 10797655 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 2A41F1823 for ; Tue, 5 Feb 2019 16:16:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 173702BBA8 for ; Tue, 5 Feb 2019 16:16:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B75A2C668; Tue, 5 Feb 2019 16:16:22 +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 31E2B2BBA8 for ; Tue, 5 Feb 2019 16:16:21 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id A65072678FD; Tue, 5 Feb 2019 17:08: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 070EB2678FF; Tue, 5 Feb 2019 17:08:04 +0100 (CET) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id 492752666B3 for ; Tue, 5 Feb 2019 17:08:01 +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 EC81CB682; Tue, 5 Feb 2019 16:08:00 +0000 (UTC) From: Takashi Iwai To: alsa-devel@alsa-project.org Date: Tue, 5 Feb 2019 17:07:58 +0100 Message-Id: <20190205160758.9172-5-tiwai@suse.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190205160758.9172-1-tiwai@suse.de> References: <20190205160758.9172-1-tiwai@suse.de> Subject: [alsa-devel] [PATCH 4/4] ALSA: cs46xx: Clean up proc file creations 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 Again no functional changes, but only code clean up. Use a standard macro for initializing the procfs entries, also drop the info entries stored in dsp_spos_instance, as they are removed recursively by a single snd_info_free_entry() calls. Signed-off-by: Takashi Iwai --- sound/pci/cs46xx/cs46xx_dsp_spos.h | 6 --- sound/pci/cs46xx/dsp_spos.c | 87 ++++++++++++------------------------- sound/pci/cs46xx/dsp_spos_scb_lib.c | 13 +++--- 3 files changed, 33 insertions(+), 73 deletions(-) diff --git a/sound/pci/cs46xx/cs46xx_dsp_spos.h b/sound/pci/cs46xx/cs46xx_dsp_spos.h index 8008c59288a6..a02e1e19c021 100644 --- a/sound/pci/cs46xx/cs46xx_dsp_spos.h +++ b/sound/pci/cs46xx/cs46xx_dsp_spos.h @@ -177,22 +177,16 @@ struct dsp_spos_instance { /* proc fs */ struct snd_card *snd_card; struct snd_info_entry * proc_dsp_dir; - struct snd_info_entry * proc_sym_info_entry; - struct snd_info_entry * proc_modules_info_entry; - struct snd_info_entry * proc_parameter_dump_info_entry; - struct snd_info_entry * proc_sample_dump_info_entry; /* SCB's descriptors */ int nscb; int scb_highest_frag_index; struct dsp_scb_descriptor scbs[DSP_MAX_SCB_DESC]; - struct snd_info_entry * proc_scb_info_entry; struct dsp_scb_descriptor * the_null_scb; /* Task's descriptors */ int ntask; struct dsp_task_descriptor tasks[DSP_MAX_TASK_DESC]; - struct snd_info_entry * proc_task_info_entry; /* SPDIF status */ int spdif_status_out; diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c index 3555f839371e..c28e58602679 100644 --- a/sound/pci/cs46xx/dsp_spos.c +++ b/sound/pci/cs46xx/dsp_spos.c @@ -809,52 +809,39 @@ int cs46xx_dsp_proc_init (struct snd_card *card, struct snd_cs46xx *chip) 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; - } - ins->proc_sym_info_entry = entry; + if (entry) + snd_info_set_text_ops(entry, chip, + cs46xx_dsp_proc_symbol_table_read); - if ((entry = snd_info_create_card_entry(card, "spos_modules", ins->proc_dsp_dir)) != NULL) { - entry->content = SNDRV_INFO_CONTENT_TEXT; - entry->private_data = chip; - entry->mode = S_IFREG | 0644; - entry->c.text.read = cs46xx_dsp_proc_modules_read; - } - ins->proc_modules_info_entry = entry; + entry = snd_info_create_card_entry(card, "spos_modules", + ins->proc_dsp_dir); + if (entry) + snd_info_set_text_ops(entry, chip, + cs46xx_dsp_proc_modules_read); - if ((entry = snd_info_create_card_entry(card, "parameter", ins->proc_dsp_dir)) != NULL) { - entry->content = SNDRV_INFO_CONTENT_TEXT; - entry->private_data = chip; - entry->mode = S_IFREG | 0644; - entry->c.text.read = cs46xx_dsp_proc_parameter_dump_read; - } - ins->proc_parameter_dump_info_entry = entry; + entry = snd_info_create_card_entry(card, "parameter", + ins->proc_dsp_dir); + if (entry) + snd_info_set_text_ops(entry, chip, + cs46xx_dsp_proc_parameter_dump_read); - if ((entry = snd_info_create_card_entry(card, "sample", ins->proc_dsp_dir)) != NULL) { - entry->content = SNDRV_INFO_CONTENT_TEXT; - entry->private_data = chip; - entry->mode = S_IFREG | 0644; - entry->c.text.read = cs46xx_dsp_proc_sample_dump_read; - } - ins->proc_sample_dump_info_entry = entry; + entry = snd_info_create_card_entry(card, "sample", + ins->proc_dsp_dir); + if (entry) + snd_info_set_text_ops(entry, chip, + cs46xx_dsp_proc_sample_dump_read); - if ((entry = snd_info_create_card_entry(card, "task_tree", ins->proc_dsp_dir)) != NULL) { - entry->content = SNDRV_INFO_CONTENT_TEXT; - entry->private_data = chip; - entry->mode = S_IFREG | 0644; - entry->c.text.read = cs46xx_dsp_proc_task_tree_read; - } - ins->proc_task_info_entry = entry; + entry = snd_info_create_card_entry(card, "task_tree", + ins->proc_dsp_dir); + if (entry) + snd_info_set_text_ops(entry, chip, + cs46xx_dsp_proc_task_tree_read); - if ((entry = snd_info_create_card_entry(card, "scb_info", ins->proc_dsp_dir)) != NULL) { - entry->content = SNDRV_INFO_CONTENT_TEXT; - entry->private_data = chip; - entry->mode = S_IFREG | 0644; - entry->c.text.read = cs46xx_dsp_proc_scb_read; - } - ins->proc_scb_info_entry = entry; + entry = snd_info_create_card_entry(card, "scb_info", + ins->proc_dsp_dir); + if (entry) + snd_info_set_text_ops(entry, chip, + cs46xx_dsp_proc_scb_read); mutex_lock(&chip->spos_mutex); /* register/update SCB's entries on proc */ @@ -876,24 +863,6 @@ int cs46xx_dsp_proc_done (struct snd_cs46xx *chip) if (!ins) return 0; - snd_info_free_entry(ins->proc_sym_info_entry); - ins->proc_sym_info_entry = NULL; - - snd_info_free_entry(ins->proc_modules_info_entry); - ins->proc_modules_info_entry = NULL; - - snd_info_free_entry(ins->proc_parameter_dump_info_entry); - ins->proc_parameter_dump_info_entry = NULL; - - snd_info_free_entry(ins->proc_sample_dump_info_entry); - ins->proc_sample_dump_info_entry = NULL; - - snd_info_free_entry(ins->proc_scb_info_entry); - ins->proc_scb_info_entry = NULL; - - snd_info_free_entry(ins->proc_task_info_entry); - ins->proc_task_info_entry = NULL; - mutex_lock(&chip->spos_mutex); for (i = 0; i < ins->nscb; ++i) { if (ins->scbs[i].deleted) continue; diff --git a/sound/pci/cs46xx/dsp_spos_scb_lib.c b/sound/pci/cs46xx/dsp_spos_scb_lib.c index e056f9dc228b..1d9d610262de 100644 --- a/sound/pci/cs46xx/dsp_spos_scb_lib.c +++ b/sound/pci/cs46xx/dsp_spos_scb_lib.c @@ -254,8 +254,9 @@ void cs46xx_dsp_proc_register_scb_desc (struct snd_cs46xx *chip, if (ins->snd_card != NULL && ins->proc_dsp_dir != NULL && scb->proc_info == NULL) { - if ((entry = snd_info_create_card_entry(ins->snd_card, scb->scb_name, - ins->proc_dsp_dir)) != NULL) { + entry = snd_info_create_card_entry(ins->snd_card, scb->scb_name, + ins->proc_dsp_dir); + if (entry) { scb_info = kmalloc(sizeof(struct proc_scb_info), GFP_KERNEL); if (!scb_info) { snd_info_free_entry(entry); @@ -265,12 +266,8 @@ void cs46xx_dsp_proc_register_scb_desc (struct snd_cs46xx *chip, scb_info->chip = chip; scb_info->scb_desc = scb; - - entry->content = SNDRV_INFO_CONTENT_TEXT; - entry->private_data = scb_info; - entry->mode = S_IFREG | 0644; - - entry->c.text.read = cs46xx_dsp_proc_scb_info_read; + snd_info_set_text_ops(entry, scb_info, + cs46xx_dsp_proc_scb_info_read); } out: scb->proc_info = entry;