Commit b25f8641 authored by Patrick Mochel's avatar Patrick Mochel

sysfs: fix up device attribute read/write methods.

Remove @off and @count from the sysfs_ops, and the core attribute methods.
parent 0f902ed5
......@@ -35,28 +35,26 @@ DECLARE_MUTEX(device_sem);
extern struct attribute * dev_default_attrs[];
static ssize_t
dev_attr_show(struct kobject * kobj, struct attribute * attr,
char * buf, size_t count, loff_t off)
dev_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
{
struct device_attribute * dev_attr = to_dev_attr(attr);
struct device * dev = to_dev(kobj);
ssize_t ret = 0;
if (dev_attr->show)
ret = dev_attr->show(dev,buf,count,off);
ret = dev_attr->show(dev,buf);
return ret;
}
static ssize_t
dev_attr_store(struct kobject * kobj, struct attribute * attr,
const char * buf, size_t count, loff_t off)
dev_attr_store(struct kobject * kobj, struct attribute * attr, const char * buf)
{
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,count,off);
ret = dev_attr->store(dev,buf);
return ret;
}
......
......@@ -10,21 +10,21 @@
#include <linux/stat.h>
#include <linux/string.h>
static ssize_t device_read_name(struct device * dev, char * buf, size_t count, loff_t off)
static ssize_t device_read_name(struct device * dev, char * buf)
{
return off ? 0 : sprintf(buf,"%s\n",dev->name);
return sprintf(buf,"%s\n",dev->name);
}
static DEVICE_ATTR(name,S_IRUGO,device_read_name,NULL);
static ssize_t
device_read_power(struct device * dev, char * page, size_t count, loff_t off)
device_read_power(struct device * dev, char * page)
{
return off ? 0 : sprintf(page,"%d\n",dev->power_state);
return sprintf(page,"%d\n",dev->power_state);
}
static ssize_t
device_write_power(struct device * dev, const char * buf, size_t count, loff_t off)
device_write_power(struct device * dev, const char * buf)
{
char str_command[20];
char str_level[20];
......@@ -33,9 +33,6 @@ device_write_power(struct device * dev, const char * buf, size_t count, loff_t o
u32 int_level;
int error = 0;
if (off)
return 0;
if (!dev->driver)
goto done;
......@@ -83,7 +80,7 @@ device_write_power(struct device * dev, const char * buf, size_t count, loff_t o
error = 0;
}
done:
return error < 0 ? error : count;
return error < 0 ? error : strlen(buf);
}
static DEVICE_ATTR(power,S_IWUSR | S_IRUGO,
......
......@@ -319,8 +319,8 @@ extern void device_release_driver(struct device * dev);
struct device_attribute {
struct attribute attr;
ssize_t (*show)(struct device * dev, char * buf, size_t count, loff_t off);
ssize_t (*store)(struct device * dev, const char * buf, size_t count, loff_t off);
ssize_t (*show)(struct device * dev, char * buf);
ssize_t (*store)(struct device * dev, const char * buf);
};
#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