diff options
author | Greg Kroah-Hartman <greg@kroah.com> | 2014-11-17 16:03:34 -0800 |
---|---|---|
committer | Greg Kroah-Hartman <greg@kroah.com> | 2014-11-17 16:03:34 -0800 |
commit | ac4029fb60abd00f63cfb4c626f1653a918dcc66 (patch) | |
tree | 509e3c650fd16763a47309f59f8b7c9eea7eb680 /drivers/staging/greybus/kernel_ver.h | |
parent | 68190676b78a4736081e13d67d3d5bc2a519df5c (diff) |
greybus: vibrator-gb: add vibrator driver
This driver implements the Greybus vibrator protocol, as defined in the
Greybus protocol specification. It interacts to userspace with a single
sysfs file, "timeout", and a separate "class" called "vibrator". That
interface can/should be changed in the future depending on what Android
wants for its HAL, but for now should be good enough to test with.
There are some changes needed to kernel_ver.h to support some
sysfs/driver core changes that happened after the 3.10 kernel was
released to try to make the code simpler. Even with those changes,
there are #ifdefs in the code to do different things depending on the
kernel version to implement the same userspace api.
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Diffstat (limited to 'drivers/staging/greybus/kernel_ver.h')
-rw-r--r-- | drivers/staging/greybus/kernel_ver.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/staging/greybus/kernel_ver.h b/drivers/staging/greybus/kernel_ver.h index e4cda5ce65fa..ca0da11e4d8d 100644 --- a/drivers/staging/greybus/kernel_ver.h +++ b/drivers/staging/greybus/kernel_ver.h @@ -18,6 +18,18 @@ struct device_attribute dev_attr_##_name = __ATTR_RO(_name) #endif +#ifndef DEVICE_ATTR_WO +#define DEVICE_ATTR_WO(_name) \ + struct device_attribute dev_attr_##_name = __ATTR_WO(_name) +#endif + +#ifndef __ATTR_WO +#define __ATTR_WO(_name) { \ + .attr = { .name = __stringify(_name), .mode = S_IWUSR }, \ + .store = _name##_store, \ +} +#endif + #ifndef U8_MAX #define U8_MAX ((u8)~0U) #endif /* ! U8_MAX */ |