[alsa-devel] [PATCH 27/39] ALSA: seq: optimize get_queue_tempo function to new design
Takashi Sakamoto
o-takashi at sakamocchi.jp
Sun Aug 7 11:49:03 CEST 2016
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 at sakamocchi.jp>
---
sound/core/seq/seq_clientmgr.c | 24 +++++++++---------------
1 file changed, 9 insertions(+), 15 deletions(-)
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index 40346f2..2338468 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -1643,32 +1643,26 @@ static int seq_ioctl_get_queue_status(struct snd_seq_client *client, void *arg)
/* GET_QUEUE_TEMPO ioctl() */
-static int seq_ioctl_get_queue_tempo(struct snd_seq_client *client,
- void __user *arg)
+static int seq_ioctl_get_queue_tempo(struct snd_seq_client *client, void *arg)
{
- struct snd_seq_queue_tempo tempo;
+ struct snd_seq_queue_tempo *tempo = arg;
struct snd_seq_queue *queue;
struct snd_seq_timer *tmr;
- if (copy_from_user(&tempo, arg, sizeof(tempo)))
- return -EFAULT;
-
- queue = queueptr(tempo.queue);
+ queue = queueptr(tempo->queue);
if (queue == NULL)
return -EINVAL;
- memset(&tempo, 0, sizeof(tempo));
- tempo.queue = queue->queue;
+ memset(tempo, 0, sizeof(*tempo));
+ tempo->queue = queue->queue;
tmr = queue->timer;
- tempo.tempo = tmr->tempo;
- tempo.ppq = tmr->ppq;
- tempo.skew_value = tmr->skew;
- tempo.skew_base = tmr->skew_base;
+ tempo->tempo = tmr->tempo;
+ tempo->ppq = tmr->ppq;
+ tempo->skew_value = tmr->skew;
+ tempo->skew_base = tmr->skew_base;
queuefree(queue);
- if (copy_to_user(arg, &tempo, sizeof(tempo)))
- return -EFAULT;
return 0;
}
--
2.7.4
More information about the Alsa-devel
mailing list