Commit graph

23 commits

Author SHA1 Message Date
Viresh Kumar 696e0ccabd greybus: Random spell fixes
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-11-21 12:25:57 -08:00
Viresh Kumar 64e69291d9 greybus: Pass '*ptr' to sizeof() wherever possible
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>
2014-11-19 10:38:50 -08:00
Greg Kroah-Hartman 86bf33afa3 greybus: Revert "manifest: remove extra loop for finding module descriptor"
This reverts commit 4d1529e6687d53878b71cdcd646e28e10d62c2e8.

Alex reports that this causes problems.

Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-11-14 14:37:56 -08:00
Greg Kroah-Hartman b7be8d2eb3 greybus: Revert "manifest: improve print message"
This reverts commit b8ba855506906de71df5b12b50cdbbf7259a930c.

needed to revert an older change.

Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-11-14 14:37:32 -08:00
Viresh Kumar 1dd90df403 greybus: manifest: make sure manifest_descs list is empty before parsing manifest
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>
2014-11-14 13:32:27 -08:00
Viresh Kumar 219871e252 greybus: manifest: improve print message
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>
2014-11-14 13:19:16 -08:00
Viresh Kumar 85f3aeeda6 greybus: manifest: remove extra loop for finding module descriptor
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>
2014-11-14 13:19:16 -08:00
Viresh Kumar 50fc08f8c0 greybus: manifest: don't free unallocated resources
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>
2014-11-14 13:16:05 -08:00
Viresh Kumar 4ed16a81c1 greybus: manifest: initialize variable during definition
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-11-14 13:14:37 -08:00
Viresh Kumar 43d9431f6b greybus: manifest: no need to initialize 'result'
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>
2014-11-14 13:14:37 -08:00
Alex Elder 545a697512 greybus: control printing message
There's a message that gets printed in gb_manifest_parse() if excess
descriptors are found in the manifest.  This should only be printed
if the parse was successful.  If it was not successful it's not
really very helpful.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-11-05 14:12:26 -08:00
Alex Elder 7fba0079ad greybus: use protocol_id for numeric values
Switch to using "protocol_id" to refer to a byte-sized numeric
protocol number.  A "protocol" will represent a protocol structure
(created in the next patch).

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-10-29 08:42:17 +08:00
Matt Porter ff8aed5274 greybus: fix gb_manifest_parse() successful return path
Even if we successfully parse a manifest we are returning
failure. Instead, we now proudly proclaim success.

Signed-off-by: Matt Porter <mporter@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-10-06 10:50:51 -07:00
Matt Porter 7a13e2f688 greybus: fix manifest parsing problem with descriptor payload
The internal struct manifest_desc needs the data payload, rather
than the entire descriptor with header to be populated into the
data field. Also fix two places where the parser was trying to
extract the entire descriptor with header for the data payload
field.

Signed-off-by: Matt Porter <mporter@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-10-06 08:57:15 -07:00
Greg Kroah-Hartman 2fb5c518fc greybus: manifest.c: minor sparse cleanup 2014-10-04 18:43:41 -07:00
Alex Elder 937d0da83f greybus: fix module setup
The code that was setting up a module was not properly initializing
the module data structure.  Fixing this required a little rework.

Now gb_add_module() (which the host device pointer and module id)
allocates and initializes the structure, and passes it to
gb_manifest_parse() for populating it further.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-10-03 19:00:10 -07:00
Greg Kroah-Hartman 2f30d9ffee greybus: manifest: some minor sparse warning fixups. 2014-10-02 21:26:26 -07:00
Alex Elder ad1c449eb9 greybus: record connection protocol
Record the protocol association with a connection when it gets
created.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-10-02 21:22:45 -07:00
Alex Elder cd345074bb greybus: get rid of functions now...
We decided yesterday that we would no longer support the notion of a
"function."  Instead, a connection will simply exist between the AP
and an interface on a module (and a CPort Id on each end).  What
was previously considered the "function type" will now be handled
as the "protocol" associated with the connection.

Update gb_connection_create() to take just the interface and a cport
id associated with that interface.

Right now every module points back to a host device, so for now
we'll establish the connection back to that.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-10-02 21:22:45 -07:00
Alex Elder 63cc932b02 greybus: October 1 updates
Update the definitions in "greybus_manifest.h" to reflect the
changes to the Greybus specification made on October 1.

They are:
    - renaming "device" to be "interface"
    - renumbering greybus descriptor type
    - eliminating the notion of a "function"
    - defining a CPort's protocol in the CPort descriptor
    - having a "class" take on the types previously used for "function"
    - renaming "serial number" to be "unique id" (for now)
    - relying on an interface's maximum cport id to determine how
      much device+cport address space the interface consumes
    - adding a simple class descriptor
    - renaming gb_interface->interface_id to be gb_interface->id

This also reorders some things to match ordering in the document,
and adds some commentary for the various structures.

Since greybus_function_type is gone, we eliminate the "type" field
from a function structure.  (Functions are going away, next.)

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-10-02 21:22:04 -07:00
Alex Elder c095bbcfcb greybus: manifest cport descriptor parsing
Add support for parsing one or more cports descriptors in a module
manifest.  There must be at least one for each interface, but we impose
no limit on the number of interfaces associated with a module.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2014-10-02 21:19:56 -07:00
Alex Elder d88bfb5b7d greybus: manifest interface descriptor parsing
Add support for parsing one or more interface descriptors in a module
manifest.  There must be at least one, but we impose no limit on the
number of interfaces associated with a module.

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
Alex Elder b09c94a1b7 greybus: start improving manifest parsing
Currently the module manifest parsing code is sort of representative
only and is not really very useful.

This patch begins doing "real" parsing of the module manifest.
It scans the module manifest to identify the descriptors it holds.
It then verifies there's only one module descriptor found, and
initializes new some fields in the gb_module structure based on what
it contains (converting what's found to native byte order).
Note that if anything unexpected is found or other errors occur when
parsing the manifest, the parse fails.

Because we now save this converted information when it's parsed we
no longer have a greybus_descriptor_module struct within a struct
gb_module.  And because we've already converted these values, we can
do a little less work displaying values in sysfs.  (We also now show
vendor, product, and version values in the right byte order.)  This
eliminates the need for greybus_string(), so get rid of it.

It also slightly simplifies the greybus module matching code.

Move some existing parsing code into a new file, "manifest.c".

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