- 18 Nov, 2014 9 commits
-
-
Alex Elder authored
Nobody dynamically allocates gbufs any more, so we can get rid of the allocation and free routines, as as the slab cache and its related code. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Alex Elder authored
Embed the gbuf structures for operation messages into the message structure rather than pointing to a dynamically allocated one. Use a null gbuf->transfer_buffer pointer rather than a null gbuf pointer to indicate an unused gbuf. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Alex Elder authored
Make sure gbuf->transfer_buffer gets reset to NULL when the buffer is freed. We can leverage that to do a little extra error checking. We'll also use a null transfer buffer in the next patch to indicate an unused gbuf. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Alex Elder authored
Change greybus_alloc_gbuf() so all it does is allocate the gbuf data structure. Move all of the initialization of the gbuf structure in the caller. Do the inverse in the caller prior to freeing the gbuf structure via greybus_free_gbuf(). Use a null gbuf->transfer_buffer pointer rather than a null gbuf pointer to indicate an unused gbuf. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Alex Elder authored
This converts some of the operation code to start leveraging the new gb_message type. Instead of creating the request and response gbufs, we initialize (and tear down with a new function) the request and response message structures. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Alex Elder authored
A Greybus buffer (gbuf) is a generic buffer used for data transfer over a Greybus interconnect. We only ever use gbufs in operations, which always involve exactly two of them. The lifetime of a gbuf is therefore directly connected to the lifetime of an operation, so there no real need to manage gbufs separate from operations. This patch begins the process of removing the gbuf abstraction, on favor of a new data type, gb_message. The purpose of a gb_message is--like a gbuf--to represent data to be transferred over Greybus. However a gb_message is oriented toward the more restrictive way we do Greybus transfers--as operation messages (either a request or a response). This patch simply defines the structure in its initial form, and defines the request and response fields in a Greybus operation structure as embedded instances of that type. The gbuf pointer is defined within the gb_message structure, and as a result lots of code needs to be tweaked to reference the request and response gbufs as subfields of the request and response structures. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Alex Elder authored
We no longer need struct gbuf defined in "greybus.h". An upcoming patch will embed a gbuf struct (not a pointer) into the operation structure, and to do that we'll need the struct defined prior to the operation. Just move the gbuf definition into "operation.h". Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Alex Elder authored
Since there is only ever one reference to a gbuf, we don't need a kref to figure out when it can be freed. Get rid of the kref and its supporting code. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Alex Elder authored
These functions are never used, so we can get rid of them. Since there's no reference-getting function any more, we no longer need "gbuf_mutex" to avoid racing gets and puts, so get rid of that too. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
- 17 Nov, 2014 12 commits
-
-
Greg Kroah-Hartman authored
The protocol values had gotten out of sync with the Greybus Protocol specification document, so bring them back into sync by changing a few values, and adding the missing values. Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Greg Kroah-Hartman authored
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Alex Elder authored
The only time we get a cport id is when setting up a new connection. We already have a (coarser-grained) spin lock that's used to protect the connection lists, and we can use that same lock for protecting the hd's connection id map. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Alex Elder authored
First of all, there's a bug in _gb_hd_connection_insert, which Viresh found. But pointing out that problem just called attention to the fact that I have planning to to remove the affected block of code. The set of connections associated with a host device is currently maintained in a red-black tree. The number of connections we're likely to have is on the order of a hundred, and at least for now isn't even going to approach that. When this code first went in, Greg asserted that using a list is speedier than a red-black tree for smallish numbers of elements (maybe up to a few hundred?). So this patch just removes the host device's red-black tree of connections, using a simple list instead. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Alex Elder authored
The only thing we now use the gbuf->operation pointer for is to get access to its connection's host device. Record the host device pointer directly in the gbuf, rather than keeping a pointer to the operation. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Alex Elder authored
If the buffer allocated in the ES1 alloc_gbuf_data() routine is for outbound data, we are getting the destination CPort id from the connection. Switch to using the copy of the destination cport id we now have in the gbuf instead. Check for a valid CPort id there only if we're inserting it into the buffer. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Alex Elder authored
Rather than indicating whether a gbuf is intended for outbound data, record its destination CPort id. That's what's really needed by the ES1 host driver. Use CPORT_ID_BAD when the buffer is intended for inbound data. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Alex Elder authored
Add a reference counter to the operations structure. We'll need this when operations are actually allowed to complete asynchronously. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Alex Elder authored
This patch does some cleanup of gb_connection_operation_recv(). - Improve the header comments - Verify message is big enough for header before interpreting beginning of the message as a header - Verify at buffer creation time rather than receive time that no operation buffer is bigger than the maximum allowed. We can then compare the incoming data size against the buffer. - When a response message arrives, record its status in the operation result, not in the buffer status. - Record a buffer overflow as an operation error. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Alex Elder authored
It's possible this function was destined to do something important, but at this point it's pretty pointless. Get rid of it. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Alex Elder authored
This gets rid of a block of unnecessary forward declarations in "greybus.h". Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Alex Elder authored
Move the cancel_delayed_work() call so it's done separate from the removing the operation from the pending list. This should have been part of this commit: d3809f7 greybus: move timeout out of gb_operation_insert() Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
- 16 Nov, 2014 1 commit
-
-
Greg Kroah-Hartman authored
Flush out the Greybus UART driver to actually implement greybus requests. The number of Greybus Protocol operations has been reduced down to a managable number, and, if you look closely, you will notice it follows the CDC ACM USB specification, which can drive UART devices quite well, no need for complex UART state changes, leave all of that logic up to the firmware, if it wants/needs it. The Greybus Protocol spec has been updated to match the driver. TODO: There are 2 requests from the device to the host that need to be implemented. As this isn't fully hooked up in the Greybus core, that is not implemented here yet either. Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
- 15 Nov, 2014 1 commit
-
-
Greg Kroah-Hartman authored
Implement a skeleton for the uevent framework, to be filled in later when we figure out what type of module "matching" we want to do for things (connections, interfaces, modules, etc.) Based on a patch from Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
- 14 Nov, 2014 17 commits
-
-
Greg Kroah-Hartman authored
This reverts commit 4d1529e6687d53878b71cdcd646e28e10d62c2e8. Alex reports that this causes problems. Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Greg Kroah-Hartman authored
This reverts commit b8ba855506906de71df5b12b50cdbbf7259a930c. needed to revert an older change. Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Viresh Kumar authored
That's where it belong to. Also rename it in a similar way to: gb_interface_create() and gb_interface_destroy(). Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Viresh Kumar authored
Some of module specific routines were present in core.c instead of module.c. Move them to the right place. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Viresh Kumar authored
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Viresh Kumar authored
Also fix print message. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Viresh Kumar authored
Though this doesn't cause any logical issues as far as the behavior of the routine is concerned as the local variable would be considered inside the 'while' loop. But its better not to use the same name for variables at different levels. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Viresh Kumar authored
Just an extra check to make sure the list isn't corrupted. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Viresh Kumar authored
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Viresh Kumar authored
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Viresh Kumar authored
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Viresh Kumar authored
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Viresh Kumar authored
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Viresh Kumar authored
Suggested-by: Alex Elder <elder@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Viresh Kumar authored
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Viresh Kumar authored
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-
Viresh Kumar authored
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
-