Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 370131
b: refs/heads/master
c: 4c23782
h: refs/heads/master
i:
  370129: 5408541
  370127: 53b8aba
v: v3
  • Loading branch information
David Howells authored and Al Viro committed May 1, 2013
1 parent 3eec05b commit 9c0c404
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e8eeded3c5226fe420f9c6733cf5ada2faa3087a
refs/heads/master: 4c23782091dc98221dc149e844ab128771a78ea2
29 changes: 11 additions & 18 deletions trunk/arch/powerpc/platforms/pseries/scanlog.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@


static unsigned int ibm_scan_log_dump; /* RTAS token */
static struct proc_dir_entry *proc_ppc64_scan_log_dump; /* The proc file */
static unsigned int *scanlog_buffer; /* The data buffer */

static ssize_t scanlog_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
unsigned int *data = PDE_DATA(file_inode(file));
unsigned int *data = scanlog_buffer;
int status;
unsigned long len, off;
unsigned int wait_time;
Expand Down Expand Up @@ -134,7 +134,7 @@ static ssize_t scanlog_write(struct file * file, const char __user * buf,

static int scanlog_open(struct inode * inode, struct file * file)
{
unsigned int *data = PDE_DATA(file_inode(file));
unsigned int *data = scanlog_buffer;

if (data[0] != 0) {
/* This imperfect test stops a second copy of the
Expand All @@ -150,10 +150,9 @@ static int scanlog_open(struct inode * inode, struct file * file)

static int scanlog_release(struct inode * inode, struct file * file)
{
unsigned int *data = PDE_DATA(file_inode(file));
unsigned int *data = scanlog_buffer;

data[0] = 0;

return 0;
}

Expand All @@ -169,37 +168,31 @@ const struct file_operations scanlog_fops = {
static int __init scanlog_init(void)
{
struct proc_dir_entry *ent;
void *data;
int err = -ENOMEM;

ibm_scan_log_dump = rtas_token("ibm,scan-log-dump");
if (ibm_scan_log_dump == RTAS_UNKNOWN_SERVICE)
return -ENODEV;

/* Ideally we could allocate a buffer < 4G */
data = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL);
if (!data)
scanlog_buffer = kzalloc(RTAS_DATA_BUF_SIZE, GFP_KERNEL);
if (!scanlog_buffer)
goto err;

ent = proc_create_data("powerpc/rtas/scan-log-dump", S_IRUSR, NULL,
&scanlog_fops, data);
ent = proc_create("powerpc/rtas/scan-log-dump", S_IRUSR, NULL,
&scanlog_fops);
if (!ent)
goto err;

proc_ppc64_scan_log_dump = ent;

return 0;
err:
kfree(data);
kfree(scanlog_buffer);
return err;
}

static void __exit scanlog_cleanup(void)
{
if (proc_ppc64_scan_log_dump) {
kfree(proc_ppc64_scan_log_dump->data);
remove_proc_entry("scan-log-dump", proc_ppc64_scan_log_dump->parent);
}
remove_proc_entry("powerpc/rtas/scan-log-dump", NULL);
kfree(scanlog_buffer);
}

module_init(scanlog_init);
Expand Down

0 comments on commit 9c0c404

Please sign in to comment.