Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 232046
b: refs/heads/master
c: 4c4a5cf
h: refs/heads/master
v: v3
  • Loading branch information
Akinobu Mita authored and Benjamin Herrenschmidt committed Jan 21, 2011
1 parent db913ae commit 484bbe7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 48 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: 63c3b9d71bb66f4b62059713201f066ad9415bb5
refs/heads/master: 4c4a5cf64bfa0ddbe4145e6ca18a62eb70706edd
53 changes: 6 additions & 47 deletions trunk/arch/powerpc/kernel/rtas_flash.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,31 +256,16 @@ static ssize_t rtas_flash_read(struct file *file, char __user *buf,
struct proc_dir_entry *dp = PDE(file->f_path.dentry->d_inode);
struct rtas_update_flash_t *uf;
char msg[RTAS_MSG_MAXLEN];
int msglen;

uf = (struct rtas_update_flash_t *) dp->data;
uf = dp->data;

if (!strcmp(dp->name, FIRMWARE_FLASH_NAME)) {
get_flash_status_msg(uf->status, msg);
} else { /* FIRMWARE_UPDATE_NAME */
sprintf(msg, "%d\n", uf->status);
}
msglen = strlen(msg);
if (msglen > count)
msglen = count;

if (ppos && *ppos != 0)
return 0; /* be cheap */

if (!access_ok(VERIFY_WRITE, buf, msglen))
return -EINVAL;

if (copy_to_user(buf, msg, msglen))
return -EFAULT;

if (ppos)
*ppos = msglen;
return msglen;
return simple_read_from_buffer(buf, count, ppos, msg, strlen(msg));
}

/* constructor for flash_block_cache */
Expand Down Expand Up @@ -394,26 +379,13 @@ static ssize_t manage_flash_read(struct file *file, char __user *buf,
char msg[RTAS_MSG_MAXLEN];
int msglen;

args_buf = (struct rtas_manage_flash_t *) dp->data;
args_buf = dp->data;
if (args_buf == NULL)
return 0;

msglen = sprintf(msg, "%d\n", args_buf->status);
if (msglen > count)
msglen = count;

if (ppos && *ppos != 0)
return 0; /* be cheap */

if (!access_ok(VERIFY_WRITE, buf, msglen))
return -EINVAL;

if (copy_to_user(buf, msg, msglen))
return -EFAULT;

if (ppos)
*ppos = msglen;
return msglen;
return simple_read_from_buffer(buf, count, ppos, msg, msglen);
}

static ssize_t manage_flash_write(struct file *file, const char __user *buf,
Expand Down Expand Up @@ -495,24 +467,11 @@ static ssize_t validate_flash_read(struct file *file, char __user *buf,
char msg[RTAS_MSG_MAXLEN];
int msglen;

args_buf = (struct rtas_validate_flash_t *) dp->data;
args_buf = dp->data;

if (ppos && *ppos != 0)
return 0; /* be cheap */

msglen = get_validate_flash_msg(args_buf, msg);
if (msglen > count)
msglen = count;

if (!access_ok(VERIFY_WRITE, buf, msglen))
return -EINVAL;

if (copy_to_user(buf, msg, msglen))
return -EFAULT;

if (ppos)
*ppos = msglen;
return msglen;
return simple_read_from_buffer(buf, count, ppos, msg, msglen);
}

static ssize_t validate_flash_write(struct file *file, const char __user *buf,
Expand Down

0 comments on commit 484bbe7

Please sign in to comment.