aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2005-04-29 02:23:47 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-20 18:15:02 -0400
commit4a0c20bf8c0fe2116f8fd7d3da6122bf8a01f026 (patch)
tree48b6108a889f7cc007633c4d7d6f2c9fafe18082
parentc76d0abd07a9c9cf72bbb5b641e1e97f92ea8f3e (diff)
[PATCH] sysfs: (driver/base) if show/store is missing return -EIO
sysfs: fix drivers/base so if an attribute doesn't implement show or store method read/write will return -EIO instead of 0. Signed-off-by: Dmitry Torokhov <dtor@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/base/bus.c4
-rw-r--r--drivers/base/class.c4
-rw-r--r--drivers/base/core.c4
-rw-r--r--drivers/base/sys.c4
4 files changed, 8 insertions, 8 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 3cb04bb04c2b..80ce88de56fa 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -36,7 +36,7 @@ drv_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
36{ 36{
37 struct driver_attribute * drv_attr = to_drv_attr(attr); 37 struct driver_attribute * drv_attr = to_drv_attr(attr);
38 struct device_driver * drv = to_driver(kobj); 38 struct device_driver * drv = to_driver(kobj);
39 ssize_t ret = 0; 39 ssize_t ret = -EIO;
40 40
41 if (drv_attr->show) 41 if (drv_attr->show)
42 ret = drv_attr->show(drv, buf); 42 ret = drv_attr->show(drv, buf);
@@ -49,7 +49,7 @@ drv_attr_store(struct kobject * kobj, struct attribute * attr,
49{ 49{
50 struct driver_attribute * drv_attr = to_drv_attr(attr); 50 struct driver_attribute * drv_attr = to_drv_attr(attr);
51 struct device_driver * drv = to_driver(kobj); 51 struct device_driver * drv = to_driver(kobj);
52 ssize_t ret = 0; 52 ssize_t ret = -EIO;
53 53
54 if (drv_attr->store) 54 if (drv_attr->store)
55 ret = drv_attr->store(drv, buf, count); 55 ret = drv_attr->store(drv, buf, count);
diff --git a/drivers/base/class.c b/drivers/base/class.c
index ff33ebbf1dc7..344b8cd73901 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -26,7 +26,7 @@ class_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
26{ 26{
27 struct class_attribute * class_attr = to_class_attr(attr); 27 struct class_attribute * class_attr = to_class_attr(attr);
28 struct class * dc = to_class(kobj); 28 struct class * dc = to_class(kobj);
29 ssize_t ret = 0; 29 ssize_t ret = -EIO;
30 30
31 if (class_attr->show) 31 if (class_attr->show)
32 ret = class_attr->show(dc, buf); 32 ret = class_attr->show(dc, buf);
@@ -39,7 +39,7 @@ class_attr_store(struct kobject * kobj, struct attribute * attr,
39{ 39{
40 struct class_attribute * class_attr = to_class_attr(attr); 40 struct class_attribute * class_attr = to_class_attr(attr);
41 struct class * dc = to_class(kobj); 41 struct class * dc = to_class(kobj);
42 ssize_t ret = 0; 42 ssize_t ret = -EIO;
43 43
44 if (class_attr->store) 44 if (class_attr->store)
45 ret = class_attr->store(dc, buf, count); 45 ret = class_attr->store(dc, buf, count);
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 32f3f09a42e0..a293a788abd4 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -36,7 +36,7 @@ dev_attr_show(struct kobject * kobj, struct attribute * attr, char * buf)
36{ 36{
37 struct device_attribute * dev_attr = to_dev_attr(attr); 37 struct device_attribute * dev_attr = to_dev_attr(attr);
38 struct device * dev = to_dev(kobj); 38 struct device * dev = to_dev(kobj);
39 ssize_t ret = 0; 39 ssize_t ret = -EIO;
40 40
41 if (dev_attr->show) 41 if (dev_attr->show)
42 ret = dev_attr->show(dev, buf); 42 ret = dev_attr->show(dev, buf);
@@ -49,7 +49,7 @@ dev_attr_store(struct kobject * kobj, struct attribute * attr,
49{ 49{
50 struct device_attribute * dev_attr = to_dev_attr(attr); 50 struct device_attribute * dev_attr = to_dev_attr(attr);
51 struct device * dev = to_dev(kobj); 51 struct device * dev = to_dev(kobj);
52 ssize_t ret = 0; 52 ssize_t ret = -EIO;
53 53
54 if (dev_attr->store) 54 if (dev_attr->store)
55 ret = dev_attr->store(dev, buf, count); 55 ret = dev_attr->store(dev, buf, count);
diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index 9102e3756f95..f37a13de804a 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -37,7 +37,7 @@ sysdev_show(struct kobject * kobj, struct attribute * attr, char * buffer)
37 37
38 if (sysdev_attr->show) 38 if (sysdev_attr->show)
39 return sysdev_attr->show(sysdev, buffer); 39 return sysdev_attr->show(sysdev, buffer);
40 return 0; 40 return -EIO;
41} 41}
42 42
43 43
@@ -50,7 +50,7 @@ sysdev_store(struct kobject * kobj, struct attribute * attr,
50 50
51 if (sysdev_attr->store) 51 if (sysdev_attr->store)
52 return sysdev_attr->store(sysdev, buffer, count); 52 return sysdev_attr->store(sysdev, buffer, count);
53 return 0; 53 return -EIO;
54} 54}
55 55
56static struct sysfs_ops sysfs_ops = { 56static struct sysfs_ops sysfs_ops = {