Commit 72a1e8c1 authored by Patrick Mochel's avatar Patrick Mochel

sysfs: reinstate count parameter to sysfs_ops.store() methods.

- Fixup struct device_attribute.
- Fix the default device attributes.
parent 67eeb0b5
......@@ -47,14 +47,15 @@ dev_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
}
static ssize_t
dev_attr_store(struct kobject * kobj, struct attribute * attr, const char * buf)
dev_attr_store(struct kobject * kobj, struct attribute * attr,
const char * buf, size_t count)
{
struct device_attribute * dev_attr = to_dev_attr(attr);
struct device * dev = to_dev(kobj);
ssize_t ret = 0;
if (dev_attr->store)
ret = dev_attr->store(dev,buf);
ret = dev_attr->store(dev,buf,count);
return ret;
}
......
......@@ -24,7 +24,7 @@ device_read_power(struct device * dev, char * page)
}
static ssize_t
device_write_power(struct device * dev, const char * buf)
device_write_power(struct device * dev, const char * buf, size_t count)
{
char str_command[20];
char str_level[20];
......@@ -80,7 +80,7 @@ device_write_power(struct device * dev, const char * buf)
error = 0;
}
done:
return error < 0 ? error : strlen(buf);
return error < 0 ? error : count;
}
static DEVICE_ATTR(power,S_IWUSR | S_IRUGO,
......
......@@ -320,7 +320,7 @@ extern void device_release_driver(struct device * dev);
struct device_attribute {
struct attribute attr;
ssize_t (*show)(struct device * dev, char * buf);
ssize_t (*store)(struct device * dev, const char * buf);
ssize_t (*store)(struct device * dev, const char * buf, size_t count);
};
#define DEVICE_ATTR(_name,_mode,_show,_store) \
......
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