diff --git a/samples/kfifo/bytestream-example.c b/samples/kfifo/bytestream-example.c
index 8c58fb46a2bf..214e46a64cc1 100644
--- a/samples/kfifo/bytestream-example.c
+++ b/samples/kfifo/bytestream-example.c
@@ -125,26 +125,23 @@ static ssize_t fifo_write(struct file *file, char *buf,
return copied;
}
-static ssize_t fifo_read(struct file *file, char __user *buf,
+static ssize_t fifo_read(struct file *file, char *buf,
size_t count, loff_t *ppos)
{
- int ret;
unsigned int copied;
if (mutex_lock_interruptible(&read_access))
return -ERESTARTSYS;
- ret = kfifo_to_user(&test, buf, count, &copied);
+ copied = kfifo_out(&test, buf, count);
mutex_unlock(&read_access);
- if (ret)
- return ret;
return copied;
}
static const struct proc_ops fifo_proc_ops = {
- .proc_read = fifo_read,
+ .proc_read_buf = fifo_read,
.proc_write_buf = fifo_write,
.proc_lseek = noop_llseek,
};diff --git a/samples/kfifo/inttype-example.c b/samples/kfifo/inttype-example.c
index c5d16b815e73..8384d7f8de6c 100644
--- a/samples/kfifo/inttype-example.c
+++ b/samples/kfifo/inttype-example.c
@@ -119,26 +119,24 @@ static ssize_t fifo_write(struct file *file, char *buf,
return copied;
}
-static ssize_t fifo_read(struct file *file, char __user *buf,
+static ssize_t fifo_read(struct file *file, char *buf,
size_t count, loff_t *ppos)
{
- int ret;
unsigned int copied;
if (mutex_lock_interruptible(&read_access))
return -ERESTARTSYS;
- ret = kfifo_to_user(&test, buf, count, &copied);
+ copied = kfifo_out(&test, (int *)buf, count / sizeof(int)) *
+ sizeof(int);
mutex_unlock(&read_access);
- if (ret)
- return ret;
return copied;
}
static const struct proc_ops fifo_proc_ops = {
- .proc_read = fifo_read,
+ .proc_read_buf = fifo_read,
.proc_write_buf = fifo_write,
.proc_lseek = noop_llseek,
};diff --git a/samples/kfifo/record-example.c b/samples/kfifo/record-example.c
index dcc749247c64..29d08e90a63d 100644
--- a/samples/kfifo/record-example.c
+++ b/samples/kfifo/record-example.c
@@ -132,26 +132,23 @@ static ssize_t fifo_write(struct file *file, char *buf,
return copied;
}
-static ssize_t fifo_read(struct file *file, char __user *buf,
+static ssize_t fifo_read(struct file *file, char *buf,
size_t count, loff_t *ppos)
{
- int ret;
unsigned int copied;
if (mutex_lock_interruptible(&read_access))
return -ERESTARTSYS;
- ret = kfifo_to_user(&test, buf, count, &copied);
+ copied = kfifo_out(&test, buf, count);
mutex_unlock(&read_access);
- if (ret)
- return ret;
return copied;
}
static const struct proc_ops fifo_proc_ops = {
- .proc_read = fifo_read,
+ .proc_read_buf = fifo_read,
.proc_write_buf = fifo_write,
.proc_lseek = noop_llseek,
/* kfifo_from_user() cut a record to what its length byte holds */
--
2.53.0