From 544bb6da0530e9c1af94c86a87920178e0641772 Mon Sep 17 00:00:00 2001 From: Ayaan <138162656+horrifyingHorse@users.noreply.github.com> Date: Fri, 5 Sep 2025 16:05:07 +0530 Subject: [PATCH] Documentation: correct return type of my_read and my_write functions Change return types of the my_read and my_write example functions to match the read and write func ptrs in file_operations struct. Signed-off-by: Ayaan Khan --- Documentation/teaching/labs/device_drivers.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/teaching/labs/device_drivers.rst b/Documentation/teaching/labs/device_drivers.rst index f73121b5396588..dd4c112941de59 100644 --- a/Documentation/teaching/labs/device_drivers.rst +++ b/Documentation/teaching/labs/device_drivers.rst @@ -220,7 +220,7 @@ my_device_data: //... } - static int my_read(struct file *file, char __user *user_buffer, size_t size, loff_t *offset) + static ssize_t my_read(struct file *file, char __user *user_buffer, size_t size, loff_t *offset) { struct my_device_data *my_data; @@ -525,7 +525,7 @@ into account the internal buffer size, user buffer size and the offset: .. code-block:: c - static int my_read(struct file *file, char __user *user_buffer, + static ssize_t my_read(struct file *file, char __user *user_buffer, size_t size, loff_t *offset) { struct my_device_data *my_data = (struct my_device_data *) file->private_data; @@ -565,7 +565,7 @@ The structure of the write function is similar: .. code-block:: c - static int my_write(struct file *file, const char __user *user_buffer, + static ssize_t my_write(struct file *file, const char __user *user_buffer, size_t size, loff_t * offset) { struct my_device_data *my_data = (struct my_device_data *) file->private_data;