Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 261869
b: refs/heads/master
c: 8504d63
h: refs/heads/master
i:
  261867: cd9097a
v: v3
  • Loading branch information
Peter Huewe authored and Samuel Ortiz committed Jul 31, 2011
1 parent b9e21f8 commit d3cd6bf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 31 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: 402fb487005d0fcbd4ce627b10426b3491ac0590
refs/heads/master: 8504d638041d50901b8bfba4fe646bd0bbb5cbb9
41 changes: 11 additions & 30 deletions trunk/drivers/mfd/ab8500-debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -419,20 +419,13 @@ static ssize_t ab8500_bank_write(struct file *file,
size_t count, loff_t *ppos)
{
struct device *dev = ((struct seq_file *)(file->private_data))->private;
char buf[32];
int buf_size;
unsigned long user_bank;
int err;

/* Get userspace string and assure termination */
buf_size = min(count, (sizeof(buf) - 1));
if (copy_from_user(buf, user_buf, buf_size))
return -EFAULT;
buf[buf_size] = 0;

err = strict_strtoul(buf, 0, &user_bank);
err = kstrtoul_from_user(user_buf, count, 0, &user_bank);
if (err)
return -EINVAL;
return err;

if (user_bank >= AB8500_NUM_BANKS) {
dev_err(dev, "debugfs error input > number of banks\n");
Expand All @@ -441,7 +434,7 @@ static ssize_t ab8500_bank_write(struct file *file,

debug_bank = user_bank;

return buf_size;
return count;
}

static int ab8500_address_print(struct seq_file *s, void *p)
Expand All @@ -459,26 +452,20 @@ static ssize_t ab8500_address_write(struct file *file,
size_t count, loff_t *ppos)
{
struct device *dev = ((struct seq_file *)(file->private_data))->private;
char buf[32];
int buf_size;
unsigned long user_address;
int err;

/* Get userspace string and assure termination */
buf_size = min(count, (sizeof(buf) - 1));
if (copy_from_user(buf, user_buf, buf_size))
return -EFAULT;
buf[buf_size] = 0;

err = strict_strtoul(buf, 0, &user_address);
err = kstrtoul_from_user(user_buf, count, 0, &user_address);
if (err)
return -EINVAL;
return err;

if (user_address > 0xff) {
dev_err(dev, "debugfs error input > 0xff\n");
return -EINVAL;
}
debug_address = user_address;
return buf_size;
return count;
}

static int ab8500_val_print(struct seq_file *s, void *p)
Expand Down Expand Up @@ -509,20 +496,14 @@ static ssize_t ab8500_val_write(struct file *file,
size_t count, loff_t *ppos)
{
struct device *dev = ((struct seq_file *)(file->private_data))->private;
char buf[32];
int buf_size;
unsigned long user_val;
int err;

/* Get userspace string and assure termination */
buf_size = min(count, (sizeof(buf)-1));
if (copy_from_user(buf, user_buf, buf_size))
return -EFAULT;
buf[buf_size] = 0;

err = strict_strtoul(buf, 0, &user_val);
err = kstrtoul_from_user(user_buf, count, 0, &user_val);
if (err)
return -EINVAL;
return err;

if (user_val > 0xff) {
dev_err(dev, "debugfs error input > 0xff\n");
return -EINVAL;
Expand All @@ -534,7 +515,7 @@ static ssize_t ab8500_val_write(struct file *file,
return -EINVAL;
}

return buf_size;
return count;
}

static const struct file_operations ab8500_bank_fops = {
Expand Down

0 comments on commit d3cd6bf

Please sign in to comment.