linux-stable/drivers/staging/greybus/kernel_ver.h
Alex Elder e88afa5811 greybus: introduce an operation abstraction
This patch defines a new "operation" abstraction.  An operation is a
request from by one end of a connection to the function (or AP) on
the other, coupled with a matching response returned to the requestor.
The request indicates some action to be performed by the target of
the request (such as "read some data").  Once the action has
completed the target sends back an operation response message.
Additional data can be supplied by the sender with its request,
and/or by the target with its resposne message.

Each request message has a unique id, generated by the sender.
The sender recognizes the matching response by the presence
of this id value.  Each end of a connection is responsible
for creating unique ids for the requests it sends.

An operation also has a type, whose interpretation is dependent on
the function type on the end of the connection opposite the sender.
It is up to the creator of an operation to fill in the data (if any)
to be sent with the request.

Note that not all requests are initiated by the AP.  Incoming data
on a module function can result in a request message being sent from
that function to the AP to notify of the data's arrival.  Once the
AP has processed this, it sends a response to the sender.

Every operation response contains a status byte.  If it's value
is 0, the operation was successful.  Any other value indicates
an error.

Add a defintion of U16_MAX to "kernel_ver.h".

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-10-02 21:18:41 -07:00

29 lines
652 B
C

/*
* Greybus kernel "version" glue logic.
*
* Copyright 2014 Google Inc.
*
* Released under the GPLv2 only.
*
* Backports of newer kernel apis to allow the code to build properly on older
* kernel versions. Remove this file when merging to upstream, it should not be
* needed at all
*/
#ifndef __GREYBUS_KERNEL_VER_H
#define __GREYBUS_KERNEL_VER_H
#ifndef DEVICE_ATTR_RO
#define DEVICE_ATTR_RO(_name) \
struct device_attribute dev_attr_##_name = __ATTR_RO(_name)
#endif
#ifndef U8_MAX
#define U8_MAX ((u8)~0U)
#endif /* ! U8_MAX */
#ifndef U16_MAX
#define U16_MAX ((u16)(~0U))
#endif /* !U16_MAX */
#endif /* __GREYBUS_KERNEL_VER_H */