Commit 81d2d7de authored by Benjamin Romer's avatar Benjamin Romer Committed by Greg Kroah-Hartman

staging: unisys: move uislib/smart_wakeup proc entry to debugfs

Convert /proc/uislib/smart_wakeup to an equivalent entry in debugfs.
Signed-off-by: default avatarBenjamin Romer <benjamin.romer@unisys.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent b913a2ef
...@@ -92,12 +92,11 @@ static int Go_Polling_Device_Channels; ...@@ -92,12 +92,11 @@ static int Go_Polling_Device_Channels;
static struct proc_dir_entry *uislib_proc_dir; static struct proc_dir_entry *uislib_proc_dir;
static struct proc_dir_entry *uislib_proc_vbus_dir; static struct proc_dir_entry *uislib_proc_vbus_dir;
static struct proc_dir_entry *info_proc_entry; static struct proc_dir_entry *info_proc_entry;
static struct proc_dir_entry *smart_wakeup_proc_entry;
#define DIR_PROC_ENTRY "uislib" #define DIR_PROC_ENTRY "uislib"
#define DIR_VBUS_PROC_ENTRY "vbus" #define DIR_VBUS_PROC_ENTRY "vbus"
#define INFO_PROC_ENTRY_FN "info" #define INFO_PROC_ENTRY_FN "info"
#define SMART_WAKEUP_PROC_ENTRY_FN "smart_wakeup"
#define CALLHOME_PROC_ENTRY_FN "callhome" #define CALLHOME_PROC_ENTRY_FN "callhome"
#define CALLHOME_THROTTLED_PROC_ENTRY_FN "callhome_throttled" #define CALLHOME_THROTTLED_PROC_ENTRY_FN "callhome_throttled"
...@@ -110,6 +109,9 @@ static struct dentry *platformnumber_debugfs_read; ...@@ -110,6 +109,9 @@ static struct dentry *platformnumber_debugfs_read;
#define CYCLES_BEFORE_WAIT_DEBUGFS_ENTRY_FN "cycles_before_wait" #define CYCLES_BEFORE_WAIT_DEBUGFS_ENTRY_FN "cycles_before_wait"
static struct dentry *cycles_before_wait_debugfs_read; static struct dentry *cycles_before_wait_debugfs_read;
#define SMART_WAKEUP_DEBUGFS_ENTRY_FN "smart_wakeup"
static struct dentry *smart_wakeup_debugfs_entry;
static unsigned long long cycles_before_wait, wait_cycles; static unsigned long long cycles_before_wait, wait_cycles;
/*****************************************************/ /*****************************************************/
...@@ -143,14 +145,6 @@ static const struct file_operations proc_info_fops = { ...@@ -143,14 +145,6 @@ static const struct file_operations proc_info_fops = {
.read = info_proc_read, .read = info_proc_read,
}; };
static ssize_t smart_wakeup_proc_write(struct file *file,
const char __user *buffer,
size_t count, loff_t *ppos);
static const struct file_operations proc_smart_wakeup_fops = {
.read = uislib_proc_read_writeonly,
.write = smart_wakeup_proc_write,
};
static void static void
init_msg_header(CONTROLVM_MESSAGE *msg, U32 id, uint rsp, uint svr) init_msg_header(CONTROLVM_MESSAGE *msg, U32 id, uint rsp, uint svr)
{ {
...@@ -1423,39 +1417,6 @@ uislib_proc_read_writeonly(struct file *file, char __user *buffer, ...@@ -1423,39 +1417,6 @@ uislib_proc_read_writeonly(struct file *file, char __user *buffer,
return 0; return 0;
} }
static ssize_t
smart_wakeup_proc_write(struct file *file, const char __user *buffer,
size_t count, loff_t *ppos)
{
char buf[16];
int new_value;
#define SMART_WAKEUP_USE_ERROR { \
LOGERR("Incorrect smart_wakeup Input 0 disables smart_wakeup, and 1 enables smart_wakeup.\n"); \
pr_info("echo 0 > smart_wakeup\n"); \
pr_info("echo 1 > smart_wakeup\n"); \
return -EFAULT; \
}
if (count >= ARRAY_SIZE(buf))
return -EINVAL;
if (count == 0)
SMART_WAKEUP_USE_ERROR;
if (copy_from_user(buf, buffer, count)) {
LOGERR("copy_from_user failed.\n");
return -EFAULT;
}
buf[count - 1] = '\0'; /* Replace the LF at the end of the
* input with a NULL */
/* Pull out the smart_wakeup must be decimal integer */
if (sscanf(buf, "%d", &new_value) != 1)
SMART_WAKEUP_USE_ERROR;
en_smart_wakeup = new_value;
return count;
}
static struct device_info * static struct device_info *
find_dev(U32 busNo, U32 devNo) find_dev(U32 busNo, U32 devNo)
{ {
...@@ -1765,12 +1726,11 @@ uislib_mod_init(void) ...@@ -1765,12 +1726,11 @@ uislib_mod_init(void)
cycles_before_wait_debugfs_read = debugfs_create_u64( cycles_before_wait_debugfs_read = debugfs_create_u64(
CYCLES_BEFORE_WAIT_DEBUGFS_ENTRY_FN, 0666, dir_debugfs, CYCLES_BEFORE_WAIT_DEBUGFS_ENTRY_FN, 0666, dir_debugfs,
&cycles_before_wait); &cycles_before_wait);
}
smart_wakeup_proc_entry = smart_wakeup_debugfs_entry = debugfs_create_bool(
proc_create(SMART_WAKEUP_PROC_ENTRY_FN, 0, uislib_proc_dir, SMART_WAKEUP_DEBUGFS_ENTRY_FN, 0666, dir_debugfs,
&proc_smart_wakeup_fops); &en_smart_wakeup);
SET_PROC_OWNER(smart_wakeup_proc_entry, THIS_MODULE); }
POSTCODE_LINUX_3(DRIVER_EXIT_PC, 0, POSTCODE_SEVERITY_INFO); POSTCODE_LINUX_3(DRIVER_EXIT_PC, 0, POSTCODE_SEVERITY_INFO);
return 0; return 0;
...@@ -1779,8 +1739,6 @@ uislib_mod_init(void) ...@@ -1779,8 +1739,6 @@ uislib_mod_init(void)
static void __exit static void __exit
uislib_mod_exit(void) uislib_mod_exit(void)
{ {
if (smart_wakeup_proc_entry)
remove_proc_entry(SMART_WAKEUP_PROC_ENTRY_FN, uislib_proc_dir);
if (info_proc_entry) if (info_proc_entry)
remove_proc_entry(INFO_PROC_ENTRY_FN, uislib_proc_dir); remove_proc_entry(INFO_PROC_ENTRY_FN, uislib_proc_dir);
if (uislib_proc_vbus_dir) if (uislib_proc_vbus_dir)
...@@ -1793,6 +1751,7 @@ uislib_mod_exit(void) ...@@ -1793,6 +1751,7 @@ uislib_mod_exit(void)
ProcReadBuffer = NULL; ProcReadBuffer = NULL;
} }
debugfs_remove(smart_wakeup_debugfs_entry);
debugfs_remove(cycles_before_wait_debugfs_read); debugfs_remove(cycles_before_wait_debugfs_read);
debugfs_remove(platformnumber_debugfs_read); debugfs_remove(platformnumber_debugfs_read);
debugfs_remove(dir_debugfs); debugfs_remove(dir_debugfs);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment