From patchwork Sun Aug 7 09:48:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Sakamoto X-Patchwork-Id: 9266269 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 E98556075A for ; Sun, 7 Aug 2016 09:50:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DAE6A27F2B for ; Sun, 7 Aug 2016 09:50:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CE4DF2808C; Sun, 7 Aug 2016 09:50:55 +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 22A6327F2B for ; Sun, 7 Aug 2016 09:50:54 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id C77202669AA; Sun, 7 Aug 2016 11:50:53 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 12FF0265919; Sun, 7 Aug 2016 11:49:50 +0200 (CEST) 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 09962265E0E; Sun, 7 Aug 2016 11:49:45 +0200 (CEST) Received: from smtp-proxy004.phy.lolipop.jp (smtp-proxy004.phy.lolipop.jp [157.7.104.45]) by alsa0.perex.cz (Postfix) with ESMTP id 711B6265895 for ; Sun, 7 Aug 2016 11:49:36 +0200 (CEST) Received: from smtp-proxy004.phy.lolipop.lan (HELO smtp-proxy004.phy.lolipop.jp) (172.19.44.45) (smtp-auth username m12129643-o-takashi, mechanism plain) by smtp-proxy004.phy.lolipop.jp (qpsmtpd/0.82) with ESMTPA; Sun, 07 Aug 2016 18:49:33 +0900 Received: from 127.0.0.1 (127.0.0.1) by smtp-proxy004.phy.lolipop.jp (LOLIPOP-Fsecure); Sun, 07 Aug 2016 18:49:15 +0900 (JST) X-Virus-Status: clean(LOLIPOP-Fsecure) From: Takashi Sakamoto To: clemens@ladisch.de, tiwai@suse.de Date: Sun, 7 Aug 2016 18:48:39 +0900 Message-Id: <1470563355-18368-4-git-send-email-o-takashi@sakamocchi.jp> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1470563355-18368-1-git-send-email-o-takashi@sakamocchi.jp> References: <1470563355-18368-1-git-send-email-o-takashi@sakamocchi.jp> Cc: alsa-devel@alsa-project.org Subject: [alsa-devel] [PATCH 03/39] ALSA: seq: fulfill callback entry for 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 Most of callback functions corresponding to each ioctl command are in local table, while two of them are not. This is a bit worse to handle the command in a consistent way. This commit adds entries for these two functions in the table. Signed-off-by: Takashi Sakamoto --- sound/core/seq/seq_clientmgr.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c index 1331103..d6c1219 100644 --- a/sound/core/seq/seq_clientmgr.c +++ b/sound/core/seq/seq_clientmgr.c @@ -1129,6 +1129,16 @@ static unsigned int snd_seq_poll(struct file *file, poll_table * wait) /*-----------------------------------------------------*/ +static int seq_ioctl_pversion(struct snd_seq_client *client, void __user *arg) +{ + return put_user(SNDRV_SEQ_VERSION, (int __user *)arg) ? -EFAULT : 0; +} + +static int seq_ioctl_client_id(struct snd_seq_client *client, void __user *arg) +{ + return put_user(client->number, (int __user *)arg) ? -EFAULT : 0; +} + /* SYSTEM_INFO ioctl() */ static int seq_ioctl_system_info(struct snd_seq_client *client, void __user *arg) @@ -2174,6 +2184,8 @@ static const struct seq_ioctl_table { unsigned int cmd; int (*func)(struct snd_seq_client *client, void __user * arg); } ioctl_tables[] = { + { SNDRV_SEQ_IOCTL_PVERSION, seq_ioctl_pversion }, + { SNDRV_SEQ_IOCTL_CLIENT_ID, seq_ioctl_client_id }, { SNDRV_SEQ_IOCTL_SYSTEM_INFO, seq_ioctl_system_info }, { SNDRV_SEQ_IOCTL_RUNNING_MODE, seq_ioctl_running_mode }, { SNDRV_SEQ_IOCTL_GET_CLIENT_INFO, seq_ioctl_get_client_info }, @@ -2211,15 +2223,6 @@ static int seq_do_ioctl(struct snd_seq_client *client, unsigned int cmd, { const struct seq_ioctl_table *p; - switch (cmd) { - case SNDRV_SEQ_IOCTL_PVERSION: - /* return sequencer version number */ - return put_user(SNDRV_SEQ_VERSION, (int __user *)arg) ? -EFAULT : 0; - case SNDRV_SEQ_IOCTL_CLIENT_ID: - /* return the id of this client */ - return put_user(client->number, (int __user *)arg) ? -EFAULT : 0; - } - if (! arg) return -EFAULT; for (p = ioctl_tables; p->cmd; p++) {