From 5e56450d7faccf3058e98611ca46c6079022bfda Mon Sep 17 00:00:00 2001 From: Alexander Aksenov Date: Thu, 26 Sep 2013 17:24:00 +0400 Subject: [PATCH] [IMPROVE] Add wake up ioctl command It should be given after chainging opened driver descriptor attributes to nonblock. Change-Id: Iaf0c492d6ce668250934e5e5a7ffd7686efb185d Signed-off-by: Alexander Aksenov --- driver/device_driver.c | 11 +++++++++-- driver/swap_ioctl.h | 1 + 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/driver/device_driver.c b/driver/device_driver.c index 50e1278..9ef5bb4 100644 --- a/driver/device_driver.c +++ b/driver/device_driver.c @@ -322,8 +322,7 @@ static long swap_device_ioctl(struct file *filp, unsigned int cmd, { result = driver_to_buffer_uninitialize(); if (result < 0) - print_err("Buffer uninitialization failed %d\n", result); - + print_err("Buffer uninitialization failed %d\n", result); break; } case SWAP_DRIVER_NEXT_BUFFER_TO_READ: @@ -342,6 +341,7 @@ static long swap_device_ioctl(struct file *filp, unsigned int cmd, break; } case SWAP_DRIVER_MSG: + { if (msg_handler) { result = msg_handler((void __user *)arg); } else { @@ -349,6 +349,13 @@ static long swap_device_ioctl(struct file *filp, unsigned int cmd, result = -EINVAL; } break; + } + case SWAP_DRIVER_WAKE_UP: + { + swap_device_wake_up_process(); + result = E_SD_SUCCESS; + break; + } default: print_warn("Unknown command %d\n", cmd); result = -EINVAL; diff --git a/driver/swap_ioctl.h b/driver/swap_ioctl.h index 5b133ea..38d7a01 100644 --- a/driver/swap_ioctl.h +++ b/driver/swap_ioctl.h @@ -43,5 +43,6 @@ struct buffer_initialize { #define SWAP_DRIVER_FLUSH_BUFFER _IO(SWAP_DRIVER_IOC_MAGIC, 4) #define SWAP_DRIVER_MSG _IOW(SWAP_DRIVER_IOC_MAGIC, 5, \ void *) +#define SWAP_DRIVER_WAKE_UP _IO(SWAP_DRIVER_IOC_MAGIC, 6) #endif /* __SWAP_IOCTL_H__ */ -- 2.7.4