X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=Documentation%2FDocBook%2Fwriting-an-alsa-driver.tmpl;h=0ba149de2608795726e8967d9531cbd3b9831358;hb=88e88374ee4958786397a57f684de6f1fc5e0242;hp=0d0f7b4d4b1a8cad9020274a5644a07c038e6a37;hpb=1954ee55605a75c91924b63c2584f4d53f11afc7;p=~andy%2Flinux diff --git a/Documentation/DocBook/writing-an-alsa-driver.tmpl b/Documentation/DocBook/writing-an-alsa-driver.tmpl index 0d0f7b4d4b1..0ba149de260 100644 --- a/Documentation/DocBook/writing-an-alsa-driver.tmpl +++ b/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. +