aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/greybus/manifest.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-11-11staging: greybus: Remove redundant license textGreg Kroah-Hartman1-2/+0
Now that the SPDX tag is in all greybus files, that identifies the license in a specific and legally-defined manner. So the extra GPL text wording can be removed as it is no longer needed at all. This is done on a quest to remove the 700+ different ways that files in the kernel describe the GPL license text. And there's unneeded stuff like the address (sometimes incorrect) for the FSF which is never needed. No copyright headers or other non-license-description text was removed. Cc: Vaibhav Hiremath <hvaibhav.linux@gmail.com> Reviewed-by: Alex Elder <elder@linaro.org> Acked-by: Vaibhav Agarwal <vaibhav.sr@gmail.com> Acked-by: David Lin <dtwlin@gmail.com> Acked-by: Johan Hovold <johan@kernel.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Mark Greer <mgreer@animalcreek.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Acked-by: "Bryan O'Donoghue" <pure.logic@nexus-software.ie> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-11-11staging: greybus: add SPDX identifiers to all greybus driver filesGreg Kroah-Hartman1-0/+1
It's good to have SPDX identifiers in all files to make it easier to audit the kernel tree for correct licenses. Update the drivers/staging/greybus files files with the correct SPDX license identifier based on the license text in the file itself. The SPDX identifier is a legally binding shorthand, which can be used instead of the full boiler plate text. This work is based on a script and data from Thomas Gleixner, Philippe Ombredanne, and Kate Stewart. Cc: Vaibhav Hiremath <hvaibhav.linux@gmail.com> Cc: "Bryan O'Donoghue" <pure.logic@nexus-software.ie> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Kate Stewart <kstewart@linuxfoundation.org> Cc: Philippe Ombredanne <pombredanne@nexb.com> Acked-by: Vaibhav Agarwal <vaibhav.sr@gmail.com> Acked-by: David Lin <dtwlin@gmail.com> Reviewed-by: Alex Elder <elder@linaro.org> Acked-by: Johan Hovold <johan@kernel.org> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Acked-by: Mark Greer <mgreer@animalcreek.com> Acked-by: Rui Miguel Silva <rmfrfs@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-09-27greybus: manifest: style fix missing space before '('Quentin Lambert1-1/+1
Checkpatch printed a style ERROR concerning a missing space before '('. This patch fixes this issue. Signed-off-by: Quentin Lambert <lambert.quentin@gmail.com> Acked-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-06-15greybus: manifest: Disallow reuse of control cportViresh Kumar1-0/+7
We should be checking if any of the bundles contains a CPort with its id set to the special value of '0', which is reserved for control CPort. Discard the bundle in that case. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-15greybus: interface: Extract and store Interface feature byteBryan O'Donoghue1-0/+3
The Interface description in the Greybus specification contains a 'features' field which is currently not implemented on the AP side. The Interface features field provides information on optional attributes of an Interface as a bitmask. Currently only GREYBUS_INTERFACE_FEATURE_TIMESYNC is implemented in the specification but, the expectation is that other feature flags will be added over time. This patch adds support to extract the feature byte communicated in the features field of the Interface Descriptor header and extends struct interface to contain a features field through which any user with a pointer to struct interface may interrogate the features of an Interface. This is a necessary pre-cursor for TimeSync to ensure only Interfaces which declare GREYBUS_INTERFACE_FEATURE_TIMESYNC will be included when we go through the process of FrameTime synchronization. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-04-21greybus: interface: move vendor and product strings to control deviceJohan Hovold1-6/+7
The control device is an abstraction of the control connection over which a greybus manifest is retrieved. As interfaces switch modes (e.g. after boot-over-unipro) they expose new manifests, which can contain different vendor and product strings. Eventually control devices will be deregistered and recreated after an interface mode switch, while the interface itself remains registered. Note that only interfaces of type greybus will have control devices. Specifically, dummy interfaces will not. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-04-21greybus: manifest: fix illegal free in error pathJohan Hovold1-4/+7
The manifest-parsing code could end up leaving the interface vendor_string set to an error pointer that we'd eventually try to free when destroying the interface. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-02-15greybus: manifest: Parse cports (within a bundle) in the order from manifest blobViresh Kumar1-1/+1
The order in which cports (of a bundle) are present in the manifest blob is important for gbsim, as it allocates hd_cport_id's for them sequentially. For example, if there are two cports (1 and 2, in order 1->2) present in a bundle in the manifest blob, then gbsim allocates hd_cport_id X and X+1 for them. This is done on the assumption that kernel will do the same. Though it shouldn't have had any such assumptions since the beginning. But with a recent patch that sequence is changed, and it broke the assumption gbsim had. While parsing the manifest blob, the cports within a bundle are now moved to another list using list_move() and then they are picked one by one from the HEAD of the list. list_move() first deletes the node and then adds it to HEAD as it uses list_add() and not list_add_tail(). And that reverses the order in which the cports were present in the original list. And because of this, the messages destined for cport 1 are delivered to cport 2 and the ones for cport 2 are delivered to cport 1. In order to get gbsim working with greybus, keep the cport list in the order in which they were present in manifest, by replacing list_move() with list_move_tail(). Its a trivial patch and shouldn't have any side effects on the working of greybus with nuttx. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-02-11greybus: manifest: add interface-device prefix to messagesJohan Hovold1-20/+21
Use dev_err and friends so that we can tell which interface (and module) a manifest-parsing error messages was for. Testing Done: Tested on DB3.5 with the generic bridge firmware on APB2. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-02-03greybus: fix sparse warning in manifest.cGreg Kroah-Hartman1-1/+1
The cport id field is a le16, so treat it as such when comparing it to something else. Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-21greybus: manifest: check for duplicate CPort descriptors when parsingJohan Hovold1-3/+14
Now that connection creation has been separated from interface initialisation, we should explicitly check for duplicate CPort descriptors when parsing the manifest. Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-21greybus: core: defer connection creation to driver probeJohan Hovold1-13/+22
Defer connection creation to bundle driver probe instead of creating them when initialising the interface and parsing the manifest. Store copies of the CPorts descriptors in the bundle for the drivers to use, and update the legacy driver. This is needed for drivers that need more control over host-device resource management, for example, when a protocol needs to use a dedicated host CPort for traffic offloading (e.g. camera data). This also avoids allocating host CPorts for bundles that are not bound to a driver or for remote CPorts that a driver does not need. Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-12-08greybus: interface: separate manifest parsing from bundle registrationJohan Hovold1-19/+0
Separate manifest parsing, including bundle and connection creation, from bundle registration. Note that this is also needed to allow the interface to not be registered until the manifest has been parsed. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-12-08greybus: bundle: separate bundle creation and registrationJohan Hovold1-7/+19
Separate bundle creation and registration. Note that the bundle connections still needs to be initialised post registration as protocol drivers create child devices to the bundle. This will ultimately allow connection structures to be created while parsing manifests, but the connections to not be enabled until a driver is bound. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-12-08greybus: use decimal notation for interfaces, bundles and cportsJohan Hovold1-1/+1
Fix up the last few places where hexadecimal rather than decimal notation was used for interface, bundle and cport ids. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-12-08greybus: connection: separate connection creation and enablingJohan Hovold1-2/+12
Separate connection creation from enabling. This will ultimately allow connection structures to be created while parsing manifests, but the connections to not be enabled until a driver is bound. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-12-04greybus: don't use %h and %hh for printing short and char variablesViresh Kumar1-3/+3
Because the width of our fields is already known, we can use %0Nx (for hex) to print N bytes and %u (for unsigned decimal), instead of using %h and %hh, which isn't that readable. This patch makes following changes: - s/%hx/%04x - s/%04hx/%04x - s/%hhx/%02x - s/%02hhx/%02x - s/%hhu/%u - s/%hu/%u - s/%x/%02x for u8 value (only at a single place) Suggested-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-25greybus: interface: drop the control bundleJohan Hovold1-44/+13
Drop the control bundle and ignore control descriptors when parsing manifests. Every interface has a control connection with a well defined remote CPort 0 and there's no longer any need to create a bundle for it. As the control connection is setup and enabled before parsing the manifest, ignore any legacy descriptors for control cports and bundles in a manifest. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-25greybus: manifest: refactor cport-descriptor releaseJohan Hovold1-8/+17
Add helper function to release cport-descriptors with a given bundle id. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-25greybus: connection: clean up connection-creation interfaceJohan Hovold1-1/+2
Clean up the connection-creation interface by clearly separating our two types of connections: static and dynamic. Add two convenience functions for creating static and dynamic connections. A static connection is a pre-setup connection that is defined by a host device and a host-device cport id. Specifically, the remote interface or cport id need not be known. The SVC connection is a static connection. A dynamic connection is defined by a host device and a remote interface and cport id. This is our normal connections where the host-device cport is (generally) allocated dynamically. Note that the new generic interface is marked static, but can be exported later to allow dynamic connections to be created also from fixed host-device cports (e.g. for CSI). Also note that a connection of either type is uniquely identified by its host-device and host-device cport id once created. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-23greybus: manifest: simplify descriptor address calculationSachin Pandhare1-1/+1
This patch doesn't change any functionality. It just improves the readability of the code. Current code to get 'descriptors' pointer looks as if we are forcing the pointer type change. To simplify the address calculations, use 'descriptors' member directly from greybus_manifest structure. Signed-off-by: Sachin Pandhare <sachin.pandhare@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-21greybus: fix vendor and product matchingJohan Hovold1-5/+0
Fix vendor and product matching by matching on the 32-bit Ara vendor and product ids. Remove the "fake" 16-bit vendor and product ids and export the Ara ids using the "vendor" and "product" interface attributes instead. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-21greybus: interface: remove unique idJohan Hovold1-1/+0
Remove the unimplemented interface unique-id. There will eventually be an interface-serial-number attribute provided, but let's not export it or commit to a name for this attribute until we need it. Signed-off-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-16greybus: manifest: fix bundle descriptor parseRui Miguel Silva1-5/+13
The descriptor list is walked in two points, in the bundle parsing and cport parsing, this can make the next descriptor pointer in bundle to be already removed by the cport remove descriptor and become invalid. So, just get the next bundle until there no more left. Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-02greybus: manifest: fix the placement of arguments to pr_errBryan O'Donoghue1-2/+2
We're one character out here in the placement of the inputs to pr_err(). Later patches show this up when pushing through checkpatch.pl. This patch fixes by moving the offending variables one character left. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-09-14greybus: manifest: release cport descriptors to avoid 'excess descriptors' warningViresh Kumar1-0/+13
If we fail to initialize a cport of a bundle, we abort the entire bundle. But that leads to following (unnecessary) warnings as few of the cport descriptors, belonging to the aborted bundle were never parsed: "greybus: excess descriptors in interface manifest" Fix that by releasing all cport descriptors for the aborted bundle. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-09-14greybus: manifest: don't reject the interface on failing to initialize a cportViresh Kumar1-8/+35
A 'bundle' represents a device in greybus. It may require multiple cports for its functioning. If we fail to setup any cport of a bundle, we better reject the complete bundle as the device may not be able to function properly then. But, failing to setup a cport of bundle X doesn't mean that the device corresponding to bundle Y will not work properly. Bundles should be treated as separate independent devices. While parsing manifest for an interface, treat bundles as separate entities and don't reject entire interface and its bundles on failing to initialize a cport. But make sure the bundle which needs the cport, gets destroyed properly. We now release the bundle descriptor before parsing the cports, but that shouldn't make any difference. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-22greybus: manifest: convert pr_err to dev_errBryan O'Donoghue1-1/+1
This patch converts a dangling pr_err in the manifest parsing error path to a dev_err in order to remain consistent with similar error messages elsewhere. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-22greybus: manifest: reserve control connection cport/bundle idsBryan O'Donoghue1-26/+32
5ae6906e ('interface: Get manifest using Control protocol') in gb_create_control_connection introduces the concept that the Control Protocol is at cport_id 2 and bundle_id 0. Currently the manifest parsing code does not enforce that concept and as a result it is possible for a manifest to declare the Control Protocol at a different address. Based on that change 6a6945c9684e ('greybus-spec/control: Formally define Control Protocol reserved addresses') makes the above coding convention a formal requirement of the greybus specification. This patch implements the change introduced in the specification @ 6a6945c9684e. This patch will reject a manifest if it doesn't match the critiera laid down in the spec. This patch makes three changes: - Changes gb_manifest_parse_cports so that only GB_CONTROL_CPORT_ID may have a protocol_id of GREYBUS_PROTOCOL_CONTROL, otherwise the manifest will be rejected. - Changes gb_manifest_parse_bundles so that only GB_CONTROL_BUNDLE_ID may have a class of GREYBUS_CLASS_CONTROL, otherwise the manifest will be rejected. - gb_connection_exit() and gb_connection_destroy() are removed from gb_manifest_parse_cports on error - since gb_manifest_parse_bundles() already has a call into gb_bundle_destroy() which will again call gb_connection_exit() and gb_connection_destroy() leading to an oops. Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-08greybus: connection: Exit connection before destroying itViresh Kumar1-0/+1
gb_connection_create() can initialize a connection if bundle->device id is valid. And so the connection must be destroyed by calling gb_connection_exit() before gb_connection_destroy(). This wasn't done in the code that is parsing the manifest. Fix it. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-23greybus: control: Warn if non-control cport/bundles have control protocol/classesViresh Kumar1-3/+19
It is possible that (by mistake) the manifest contains non-control cports with their protocol set as control-protocol or non-control bundle with their class set as control-class. Catch such cases, WARN for them and finally ignore them. Also WARN if the control cport doesn't have its protocol as control-protocol and control bundle doesn't have its class as control-class. Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-23greybus: interface: Get manifest using Control protocolViresh Kumar1-0/+14
Control protocol is ready to be used for fetching manifest. Lets do it. This changes few things: - Creates/initializes bundle/connection for control protocol initially and skips doing the same later. - Manifest is parsed at link-up now, instead of hotplug which was the case earlier. This is because we need device_id (provided during link-up) for registering bundle. - Manifest is fetched using control protocol. So the sequence of events is: Event Previously Now ----- ---------- --- Interface Hotplug create intf create intf parse mfst Interface Link Up init bundles create control conn get mfst size get mfst parse mfst init bundles Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-23greybus: manifest: Allow bundles/connections list to be non-empty at manifest parsingViresh Kumar1-6/+0
A connection and a bundle will be created for interfaces at the very beginning for control protocol's functioning. And so the list of bundles and connections for a interface will be non-empty by the time manifest is parsed. Currently we are firing a WARN when these lists are found to be non-empty. Lets fix that to contain single bundle and connection for control protocol. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-15greybus: rename HOST_DEV_CPORT_ID_MAXAlex Elder1-1/+4
We limit the number of host-side CPorts to a fixed maximum (which is less than the 4096 that UniPro allows). This patch imposes a similar limit on the CPort IDs defined by modules (signaling an error if one too large is found in a manifest). It seems reasonable to use the same value for both limits. Change the name of the constant that defines the host limit and use it for both. Update cport_id_valid() to enforce the maximum. (Ultimately we should impose a limit like this; this change is being made in preparation for supporting multiple connections over a single CPort.) Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-12greybus: manifest: clean up properly when parsing bundlesAlex Elder1-3/+14
Currently, if an error occurs creating a bundle, we simply return an error without cleaning up any of the bundles that had already been successfully set up. Add code to destroy bundles that have been created in the event an error occurs. Add a check to ensure the interface's list of bundles was empty before parsing for bundles begins. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-12greybus: manifest: clean up properly when parsing cportsAlex Elder1-1/+14
Currently, if an error occurs creating a connection, we simply return an error without cleaning up any of the connections that had already been successfully set up. Add code to destroy connections that have been created in the event an error occurs. Add a check to ensure the bundle's list of connections was empty before parsing for CPorts begins. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-10greybus: manifest: rework bundle parsingAlex Elder1-15/+8
Rework the the code that parses the manifest for bundles so it only touches each manifest descriptor once. (Previously the list was scanned from the beginning repeatedly until all bundles were found.) Shorten the name of the descriptor variable, to avoid line wrap. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-10greybus: manifest: rework cport parsingAlex Elder1-16/+13
Rework the the code that parses the manifest for CPorts associated with a bundle so it only touches each manifest descriptor once. (Previously the list was scanned from the beginning repeatedly until all bundle CPorts were found.) Shorten the name of the descriptor variable, to avoid line wrap. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-10greybus: manifest: use bundle's embedded interface pointerAlex Elder1-3/+3
An initialized bundle structure contains a pointer to its interface. Because of this there's no need to provide the interface pointer to gb_manifest_parse_cports(). This also precludes the possibility of passing a bad interface pointer. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-10greybus: manifest: really minor cleanupsAlex Elder1-17/+15
This patch incorporates some very small cleanups to "manifest.c": - Rearrange code a bit in gb_manifest_parse() that ensures a manifest is big enough to hold a header. If the manifest is exactly the size of a header, the error reported will now be "...must have 1 interface..." rather than "short manifest". - Fix the function comment for gb_manifest_parse_cports(). - Use "an interface," not "a interface," and don't capitalize. - Delete some braces when getting interface product string. - A few other minor changes to comments and white space. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-10greybus: drop some unnecessary headersAlex Elder1-2/+0
There's no need to include anything other than "greybus.h" in "connection.c". Same thing in "core.c" and "manifest.c" and "svc.c". Some files need headers included, but most come along with "greybus.h". Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-08greybus: manifest: clean up a few pr_err() callsAlex Elder1-3/+4
Provide a little more information in two pr_err() calls. Also enclose a reported condition in parentheses, to match the style used everywhere else in the file. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-05-01greybus: Remove class descriptorViresh Kumar1-5/+0
We carry this information as part of bundle descriptor now and this can be removed. Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-05-01greybus: manifest: Remove vendor, product and unique-id from interface descriptorViresh Kumar1-3/+5
These should come from control protocol instead. For now, initialize this statically with a FIXME to not forget it later. Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-04-29greybus: manifest: Warn if descriptor size > expected sizeViresh Kumar1-0/+7
A descriptor passed to AP can be bigger than what AP expects, if manifest's minor version is higher with same major number as the AP. As it can have some extra data in descriptor. But, if AP and manifest versions are identical, or if the AP's minor version is greater than the manifest version, we should at least warn (if not fail). Doing this would require some changes to record the manifest version somewhere reachable by identify_descriptor(). For now, just warn if descriptor is bigger than expected. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-04-29greybus: manifest: Account for padding in string descriptorViresh Kumar1-0/+3
String descriptors are padded towards the end to align them to 4 byte boundaries. Take that into account while calculating expected size. Reviewed-by: Alex Elder <elder@linaro.org> Reviewed-by: Johan Hovold <johan@hovoldconsulting.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-04-06greybus: bundle: s/class_type/classViresh Kumar1-1/+1
Alex suggested to name it class instead of class type. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-04-06greybus: drop module descriptorsViresh Kumar1-5/+0
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-04-06greybus: manifest: Use interface descriptor instead of module descriptor to get informationViresh Kumar1-22/+23
A module can have more than one interfaces and we get hotplug events or manifests for interfaces, not modules. Details like version, vendor, product id, etc. can be different for different interfaces within the same module and so shall be fetched from interface descriptor instead of module descriptor. So what we have been doing for module descriptors until now must be done for interface descriptors. There can only be one interface descriptor in the manifest. Module descriptor isn't used anymore and probably most of its fields can be removed now. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-04-06greybus: bundle: Create bundles using bundle descriptorsViresh Kumar1-5/+9
Currently we are creating bundles based on interface descriptors. An interface can have one or more bundles associated with it and so a bundle must be created based on a bundle descriptor. Also get class_type from bundle descriptor. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>