From patchwork Sat Nov 25 09:19:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 10074761 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4B19860383 for ; Sat, 25 Nov 2017 09:33:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C690298CC for ; Sat, 25 Nov 2017 09:33:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 31444298EC; Sat, 25 Nov 2017 09:33:32 +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=-1.9 required=2.0 tests=BAYES_00, 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 6D28C298CC for ; Sat, 25 Nov 2017 09:33:31 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 37DA226799D; Sat, 25 Nov 2017 10:20:34 +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 DFE632678A5; Sat, 25 Nov 2017 10:20:24 +0100 (CET) Received: from smtp-proxy003.phy.lolipop.jp (smtp-proxy003.phy.lolipop.jp [157.7.104.44]) by alsa0.perex.cz (Postfix) with ESMTP id E354D266F72 for ; Sat, 25 Nov 2017 10:20:15 +0100 (CET) Received: from smtp-proxy003.phy.lolipop.lan (HELO smtp-proxy003.phy.lolipop.jp) (172.19.44.44) (smtp-auth username m12129643-o-takashi, mechanism plain) by smtp-proxy003.phy.lolipop.jp (qpsmtpd/0.82) with ESMTPA; Sat, 25 Nov 2017 18:20:11 +0900 Received: from 127.0.0.1 (127.0.0.1) by smtp-proxy003.phy.lolipop.jp (LOLIPOP-Fsecure); Sat, 25 Nov 2017 18:20:06 +0900 (JST) X-Virus-Status: clean(LOLIPOP-Fsecure) From: Takashi Sakamoto To: tiwai@suse.de, perex@perex.cz Date: Sat, 25 Nov 2017 18:19:48 +0900 Message-Id: <20171125092006.24408-7-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20171125092006.24408-1-o-takashi@sakamocchi.jp> References: <20171125092006.24408-1-o-takashi@sakamocchi.jp> Cc: alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 06/24] ALSA: ctl: change prototype of local function for ELEM_LIST ioctl 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 When investigating compatibility layer, several functions for native ABI are called by the layer. A 'snd_ctl_elem_list()' is such a function, while it's prototype is not similar to the others. This will bring a future inconvenience in integration of the layer. This commit changes its prototype to get a first argument for data of 'struct snd_ctl_file' type. Signed-off-by: Takashi Sakamoto --- sound/core/control.c | 12 ++++++------ sound/core/control_compat.c | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sound/core/control.c b/sound/core/control.c index 56b3e2d49c82..8baee922a400 100644 --- a/sound/core/control.c +++ b/sound/core/control.c @@ -744,7 +744,7 @@ static int snd_ctl_card_info(struct snd_card *card, struct snd_ctl_file * ctl, return 0; } -static int snd_ctl_elem_list(struct snd_card *card, +static int snd_ctl_elem_list(struct snd_ctl_file *ctl_file, struct snd_ctl_elem_list __user *_list) { struct snd_ctl_elem_list list; @@ -758,11 +758,11 @@ static int snd_ctl_elem_list(struct snd_card *card, offset = list.offset; space = list.space; - down_read(&card->controls_rwsem); - list.count = card->controls_count; + down_read(&ctl_file->card->controls_rwsem); + list.count = ctl_file->card->controls_count; list.used = 0; if (space > 0) { - list_for_each_entry(kctl, &card->controls, list) { + list_for_each_entry(kctl, &ctl_file->card->controls, list) { if (offset >= kctl->count) { offset -= kctl->count; continue; @@ -782,7 +782,7 @@ static int snd_ctl_elem_list(struct snd_card *card, } } out: - up_read(&card->controls_rwsem); + up_read(&ctl_file->card->controls_rwsem); if (!err && copy_to_user(_list, &list, sizeof(list))) err = -EFAULT; return err; @@ -1552,7 +1552,7 @@ static long snd_ctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg case SNDRV_CTL_IOCTL_CARD_INFO: return snd_ctl_card_info(card, ctl, cmd, argp); case SNDRV_CTL_IOCTL_ELEM_LIST: - return snd_ctl_elem_list(card, argp); + return snd_ctl_elem_list(ctl, argp); case SNDRV_CTL_IOCTL_ELEM_INFO: return snd_ctl_elem_info_user(ctl, argp); case SNDRV_CTL_IOCTL_ELEM_READ: diff --git a/sound/core/control_compat.c b/sound/core/control_compat.c index 5dfb31a22470..3594bd41750e 100644 --- a/sound/core/control_compat.c +++ b/sound/core/control_compat.c @@ -406,7 +406,7 @@ struct snd_ctl_elem_list32 { unsigned char reserved[50]; } /* don't set packed attribute here */; -static int snd_ctl_elem_list_compat(struct snd_card *card, +static int snd_ctl_elem_list_compat(struct snd_ctl_file *ctl_file, struct snd_ctl_elem_list32 __user *data32) { struct snd_ctl_elem_list __user *data; @@ -422,7 +422,7 @@ static int snd_ctl_elem_list_compat(struct snd_card *card, if (get_user(ptr, &data32->pids) || put_user(compat_ptr(ptr), &data->pids)) return -EFAULT; - err = snd_ctl_elem_list(card, data); + err = snd_ctl_elem_list(ctl_file, data); if (err < 0) return err; /* copy the result */ @@ -844,7 +844,7 @@ static long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, switch (cmd) { case SNDRV_CTL_IOCTL_ELEM_LIST32: - return snd_ctl_elem_list_compat(ctl->card, argp); + return snd_ctl_elem_list_compat(ctl, argp); case SNDRV_CTL_IOCTL_ELEM_INFO32: return snd_ctl_elem_info_compat(ctl, argp); case SNDRV_CTL_IOCTL_ELEM_READ32: