diff mbox

[31/39] ALSA: seq: optimize get_queue_client function to new design

Message ID 1470563355-18368-32-git-send-email-o-takashi@sakamocchi.jp (mailing list archive)
State New, archived
Headers show

Commit Message

Takashi Sakamoto Aug. 7, 2016, 9:49 a.m. UTC
In former commit, actual operations of each ioctl command get argument
in kernel space. Copying from/to user space is performed outside of
the function.

This commit optimizes to the new design.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/core/seq/seq_clientmgr.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)
diff mbox

Patch

diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index 667ad23..30aac28 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -1757,23 +1757,17 @@  static int seq_ioctl_set_queue_timer(struct snd_seq_client *client, void *arg)
 
 
 /* GET_QUEUE_CLIENT ioctl() */
-static int seq_ioctl_get_queue_client(struct snd_seq_client *client,
-				      void __user *arg)
+static int seq_ioctl_get_queue_client(struct snd_seq_client *client, void *arg)
 {
-	struct snd_seq_queue_client info;
+	struct snd_seq_queue_client *info = arg;
 	int used;
 
-	if (copy_from_user(&info, arg, sizeof(info)))
-		return -EFAULT;
-
-	used = snd_seq_queue_is_used(info.queue, client->number);
+	used = snd_seq_queue_is_used(info->queue, client->number);
 	if (used < 0)
 		return -EINVAL;
-	info.used = used;
-	info.client = client->number;
+	info->used = used;
+	info->client = client->number;
 
-	if (copy_to_user(arg, &info, sizeof(info)))
-		return -EFAULT;
 	return 0;
 }