]> err.no Git - linux-2.6/commitdiff
airo: use simple_read_from_buffer()
authorAkinobu Mita <akinobu.mita@gmail.com>
Mon, 9 Jun 2008 23:44:30 +0000 (16:44 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Sat, 14 Jun 2008 16:17:59 +0000 (12:17 -0400)
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: Dan Williams <dcbw@redhat.com>
Cc: Michal Schmidt <mschmidt@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/airo.c

index 1e1446bf4b488891dcfb1bd56bf82e2a60ffede9..e30f8b79ea89e94f48f967950abbee7fabc1c70e 100644 (file)
@@ -4561,22 +4561,13 @@ static ssize_t proc_read( struct file *file,
                          size_t len,
                          loff_t *offset )
 {
-       loff_t pos = *offset;
-       struct proc_data *priv = (struct proc_data*)file->private_data;
+       struct proc_data *priv = file->private_data;
 
        if (!priv->rbuffer)
                return -EINVAL;
 
-       if (pos < 0)
-               return -EINVAL;
-       if (pos >= priv->readlen)
-               return 0;
-       if (len > priv->readlen - pos)
-               len = priv->readlen - pos;
-       if (copy_to_user(buffer, priv->rbuffer + pos, len))
-               return -EFAULT;
-       *offset = pos + len;
-       return len;
+       return simple_read_from_buffer(buffer, len, offset, priv->rbuffer,
+                                       priv->readlen);
 }
 
 /*