Commit 28fa597f authored by Benjamin Romer's avatar Benjamin Romer Committed by Greg Kroah-Hartman

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

Convert /proc/uislib/platform 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 b27a00de
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <config/modversions.h> #include <config/modversions.h>
#endif #endif
#include <linux/module.h> #include <linux/module.h>
#include <linux/debugfs.h>
#include "commontypes.h" #include "commontypes.h"
...@@ -91,19 +92,23 @@ static int Go_Polling_Device_Channels; ...@@ -91,19 +92,23 @@ 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 *platformnumber_proc_entry;
static struct proc_dir_entry *cycles_before_wait_proc_entry; static struct proc_dir_entry *cycles_before_wait_proc_entry;
static struct proc_dir_entry *smart_wakeup_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 PLATFORMNUMBER_PROC_ENTRY_FN "platform"
#define CYCLES_BEFORE_WAIT_PROC_ENTRY_FN "cycles_before_wait" #define CYCLES_BEFORE_WAIT_PROC_ENTRY_FN "cycles_before_wait"
#define SMART_WAKEUP_PROC_ENTRY_FN "smart_wakeup" #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"
#define DIR_DEBUGFS_ENTRY "uislib"
static struct dentry *dir_debugfs;
#define PLATFORMNUMBER_DEBUGFS_ENTRY_FN "platform"
static struct dentry *platformnumber_debugfs_read;
static unsigned long long cycles_before_wait, wait_cycles; static unsigned long long cycles_before_wait, wait_cycles;
/*****************************************************/ /*****************************************************/
...@@ -137,12 +142,6 @@ static const struct file_operations proc_info_fops = { ...@@ -137,12 +142,6 @@ static const struct file_operations proc_info_fops = {
.read = info_proc_read, .read = info_proc_read,
}; };
static ssize_t platformnumber_proc_read(struct file *file, char __user *buf,
size_t len, loff_t *offset);
static const struct file_operations proc_platformnumber_fops = {
.read = platformnumber_proc_read,
};
static ssize_t cycles_before_wait_proc_write(struct file *file, static ssize_t cycles_before_wait_proc_write(struct file *file,
const char __user *buffer, const char __user *buffer,
size_t count, loff_t *ppos); size_t count, loff_t *ppos);
...@@ -1386,36 +1385,6 @@ info_proc_read(struct file *file, char __user *buf, size_t len, loff_t *offset) ...@@ -1386,36 +1385,6 @@ info_proc_read(struct file *file, char __user *buf, size_t len, loff_t *offset)
ProcReadBuffer, totalBytes); ProcReadBuffer, totalBytes);
} }
static ssize_t
platformnumber_proc_read(struct file *file, char __user *buf,
size_t len, loff_t *offset)
{
int length = 0;
char *vbuf;
loff_t pos = *offset;
if (pos < 0)
return -EINVAL;
if (pos > 0 || !len)
return 0;
vbuf = kzalloc(len, GFP_KERNEL);
if (!vbuf)
return -ENOMEM;
length = sprintf(vbuf, "%d\n", PlatformNumber);
if (copy_to_user(buf, vbuf, length)) {
kfree(vbuf);
return -EFAULT;
}
kfree(vbuf);
*offset += length;
return length;
}
/* proc/uislib/vbus/<x>/info */ /* proc/uislib/vbus/<x>/info */
static int static int
proc_info_vbus_show(struct seq_file *m, void *v) proc_info_vbus_show(struct seq_file *m, void *v)
...@@ -1824,10 +1793,13 @@ uislib_mod_init(void) ...@@ -1824,10 +1793,13 @@ uislib_mod_init(void)
&proc_info_fops); &proc_info_fops);
SET_PROC_OWNER(info_proc_entry, THIS_MODULE); SET_PROC_OWNER(info_proc_entry, THIS_MODULE);
platformnumber_proc_entry = dir_debugfs = debugfs_create_dir(DIR_DEBUGFS_ENTRY, NULL);
proc_create(PLATFORMNUMBER_PROC_ENTRY_FN, 0, uislib_proc_dir,
&proc_platformnumber_fops); if (dir_debugfs) {
SET_PROC_OWNER(platformnumberinfo_proc_entry, THIS_MODULE); platformnumber_debugfs_read = debugfs_create_u32(
PLATFORMNUMBER_DEBUGFS_ENTRY_FN, 0444, dir_debugfs,
&PlatformNumber);
}
cycles_before_wait_proc_entry = cycles_before_wait_proc_entry =
proc_create(CYCLES_BEFORE_WAIT_PROC_ENTRY_FN, 0, uislib_proc_dir, proc_create(CYCLES_BEFORE_WAIT_PROC_ENTRY_FN, 0, uislib_proc_dir,
...@@ -1853,9 +1825,6 @@ uislib_mod_exit(void) ...@@ -1853,9 +1825,6 @@ uislib_mod_exit(void)
remove_proc_entry(SMART_WAKEUP_PROC_ENTRY_FN, uislib_proc_dir); 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 (platformnumber_proc_entry)
remove_proc_entry(PLATFORMNUMBER_PROC_ENTRY_FN,
uislib_proc_dir);
if (uislib_proc_vbus_dir) if (uislib_proc_vbus_dir)
remove_proc_entry(DIR_VBUS_PROC_ENTRY, uislib_proc_dir); remove_proc_entry(DIR_VBUS_PROC_ENTRY, uislib_proc_dir);
if (uislib_proc_dir) if (uislib_proc_dir)
...@@ -1866,6 +1835,9 @@ uislib_mod_exit(void) ...@@ -1866,6 +1835,9 @@ uislib_mod_exit(void)
ProcReadBuffer = NULL; ProcReadBuffer = NULL;
} }
debugfs_remove(platformnumber_debugfs_read);
debugfs_remove(dir_debugfs);
DBGINF("goodbye.\n"); DBGINF("goodbye.\n");
return; return;
} }
......
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