From 052a356856a441c2dec6c2bd37b7bb7908c79289 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 13 Apr 2010 12:55:09 +0200 Subject: [PATCH] --- yaml --- r: 193205 b: refs/heads/master c: c56a3b18475b0f93b484c25162c1379f5aee367a h: refs/heads/master i: 193203: 678e0b9b97111e55a207ffc18e40fc2278c3c549 v: v3 --- [refs] | 2 +- .../DocBook/writing-an-alsa-driver.tmpl | 27 ++++++++++++------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/[refs] b/[refs] index f4aa4755318c..63cd6077cd0f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 02f4865fa415a87de28cc8c2e4d798ff46be1cf8 +refs/heads/master: c56a3b18475b0f93b484c25162c1379f5aee367a diff --git a/trunk/Documentation/DocBook/writing-an-alsa-driver.tmpl b/trunk/Documentation/DocBook/writing-an-alsa-driver.tmpl index 0d0f7b4d4b1a..0ba149de2608 100644 --- a/trunk/Documentation/DocBook/writing-an-alsa-driver.tmpl +++ b/trunk/Documentation/DocBook/writing-an-alsa-driver.tmpl @@ -5518,34 +5518,41 @@ struct _snd_pcm_runtime { ]]> + + For the raw data, size field must be + set properly. This specifies the maximum size of the proc file access. - The callback is much more complicated than the text-file - version. You need to use a low-level I/O functions such as + The read/write callbacks of raw mode are more direct than the text mode. + You need to use a low-level I/O functions such as copy_from/to_user() to transfer the data. local_max_size) - size = local_max_size - pos; - if (copy_to_user(buf, local_data + pos, size)) + if (copy_to_user(buf, local_data + pos, count)) return -EFAULT; - return size; + return count; } ]]> + + If the size of the info entry has been set up properly, + count and pos are + guaranteed to fit within 0 and the given size. + You don't have to check the range in the callbacks unless any + other condition is required. +