summaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/module.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@google.com>2015-04-07 20:26:30 +0200
committerGreg Kroah-Hartman <gregkh@google.com>2015-04-09 22:50:09 +0200
commit764e824e2fa5cca0d7c671ae58e65cd06aed0fce (patch)
tree7b0fc0555e8111c80ecad1c895b003de4c86dc9d /drivers/staging/greybus/module.c
parent24ef4853986e740b90c4647b8ede70ed690185e2 (diff)
downloadlinux-764e824e2fa5cca0d7c671ae58e65cd06aed0fce.tar.gz
linux-764e824e2fa5cca0d7c671ae58e65cd06aed0fce.tar.bz2
linux-764e824e2fa5cca0d7c671ae58e65cd06aed0fce.zip
greybus: module.c: add attributes
This adds the attributes power_control and present to a module. It also removes the unneeded module_id attribute, as that comes from the name of the module itself. Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Reviewed-by: Alex Elder <elder@linaro.org>
Diffstat (limited to 'drivers/staging/greybus/module.c')
-rw-r--r--drivers/staging/greybus/module.c57
1 files changed, 41 insertions, 16 deletions
diff --git a/drivers/staging/greybus/module.c b/drivers/staging/greybus/module.c
index e8c1c07cff60..780d163b3e00 100644
--- a/drivers/staging/greybus/module.c
+++ b/drivers/staging/greybus/module.c
@@ -11,37 +11,62 @@
/* module sysfs attributes */
-#define gb_module_attr(field, type) \
-static ssize_t field##_show(struct device *dev, \
- struct device_attribute *attr, \
- char *buf) \
-{ \
- struct gb_module *module = to_gb_module(dev); \
- return sprintf(buf, "%"#type"\n", module->field); \
-} \
-static DEVICE_ATTR_RO(field)
-
-// FIXME, do we really need this attribute?
-gb_module_attr(module_id, x);
-
static ssize_t epm_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
- // FIXME, implement something here
+ // FIXME
+ // Implement something here when we have a working control protocol
return sprintf(buf, "1\n");
}
static ssize_t epm_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t size)
{
- // FIXME, implement something here.
+ // FIXME
+ // Implement something here when we have a working control protocol
return 0;
}
static DEVICE_ATTR_RW(epm);
+static ssize_t power_control_show(struct device *dev,
+ struct device_attribute *addr, char *buf)
+{
+ // FIXME
+ // Implement something here when we have a working control protocol
+ return sprintf(buf, "1\n");
+}
+
+static ssize_t power_control_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t size)
+{
+ // FIXME
+ // Implement something here when we have a working control protocol
+ return 0;
+}
+static DEVICE_ATTR_RW(power_control);
+
+static ssize_t present_show(struct device *dev,
+ struct device_attribute *addr, char *buf)
+{
+ // FIXME
+ // Implement something here when we have a working control protocol
+ return sprintf(buf, "1\n");
+}
+
+static ssize_t present_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t size)
+{
+ // FIXME
+ // Implement something here when we have a working control protocol
+ return 0;
+}
+static DEVICE_ATTR_RW(present);
+
static struct attribute *module_attrs[] = {
- &dev_attr_module_id.attr,
&dev_attr_epm.attr,
+ &dev_attr_power_control.attr,
+ &dev_attr_present.attr,
NULL,
};
ATTRIBUTE_GROUPS(module);