Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 235964
b: refs/heads/master
c: 31a3da4
h: refs/heads/master
v: v3
  • Loading branch information
Marek Belisko authored and Greg Kroah-Hartman committed Feb 18, 2011
1 parent 420594f commit 1d72024
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 36 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: 45bfe97276856b866dd73fdadb65fb928c0c9bc1
refs/heads/master: 31a3da4146c120e87b8d42d033760fe49704a233
57 changes: 22 additions & 35 deletions trunk/drivers/staging/olpc_dcon/olpc_dcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -549,48 +549,33 @@ static ssize_t dcon_resumeline_show(struct device *dev,
return sprintf(buf, "%d\n", resumeline);
}

static int _strtoul(const char *buf, int len, unsigned int *val)
{

char *endp;
unsigned int output = simple_strtoul(buf, &endp, 0);
int size = endp - buf;

if (*endp && isspace(*endp))
size++;

if (size != len)
return -EINVAL;

*val = output;
return 0;
}

static ssize_t dcon_mono_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
int enable_mono;
int rc = -EINVAL;
unsigned long enable_mono;
int rc;

if (_strtoul(buf, count, &enable_mono))
return -EINVAL;
rc = strict_strtoul(buf, 10, &enable_mono);
if (rc)
return rc;

dcon_set_mono_mode(dev_get_drvdata(dev), enable_mono ? true : false);
rc = count;

return rc;
return count;
}

static ssize_t dcon_freeze_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
struct dcon_priv *dcon = dev_get_drvdata(dev);
int output;
unsigned long output;
int ret;

if (_strtoul(buf, count, &output))
return -EINVAL;
ret = strict_strtoul(buf, 10, &output);
if (ret)
return ret;

printk(KERN_INFO "dcon_freeze_store: %d\n", output);
printk(KERN_INFO "dcon_freeze_store: %lu\n", output);

switch (output) {
case 0:
Expand All @@ -612,26 +597,28 @@ static ssize_t dcon_freeze_store(struct device *dev,
static ssize_t dcon_resumeline_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
int rl;
int rc = -EINVAL;
unsigned long rl;
int rc;

if (_strtoul(buf, count, &rl))
rc = strict_strtoul(buf, 10, &rl);
if (rc)
return rc;

resumeline = rl;
dcon_write(dev_get_drvdata(dev), DCON_REG_SCAN_INT, resumeline);
rc = count;

return rc;
return count;
}

static ssize_t dcon_sleep_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count)
{
int output;
unsigned long output;
int ret;

if (_strtoul(buf, count, &output))
return -EINVAL;
ret = strict_strtoul(buf, 10, &output);
if (ret)
return ret;

dcon_sleep(dev_get_drvdata(dev), output ? true : false);
return count;
Expand Down

0 comments on commit 1d72024

Please sign in to comment.