1
0
Fork 0
Commit Graph

20 Commits (6084653541ac5fb619c4338e6fa6a9d5d4a51713)

Author SHA1 Message Date
Viresh Kumar ee9627bce7 greybus: control: Fix sparse warnings
gb_control_get_version() is not used outside of the file and must be
marked as static. Following sparse warnings are reported today:

greybus/control.c:20:5: warning: symbol 'gb_control_get_version' was not declared. Should it be static?

Fix it by marking gb_control_get_version() 'static'.

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-02-02 21:26:32 -08:00
Johan Hovold 24e094d687 greybus: connection: return error-valued pointer on creation errors
Return an ERR_PTR on errors when creating connections.

This allows driver probe to fail with a more informative error message
as not all connection creation errors are due to memory exhaustion.

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-21 22:45:09 -08:00
Johan Hovold 59507e2612 greybus: connection: add helper to create control connections
Add dedicated helper to create control connections.

This will allow us to simplify the generic (dynamic) interface.

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-21 22:45:09 -08:00
Johan Hovold b807aa7aa5 greybus: control: add bundle-version operation
Add bundle-version operation to fetch the version of the bundle class.

Retrieve the bundle version of all bundles when initialising the
interface in case the control-protocol version is greater than 0.1.

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-19 12:17:13 -08:00
Johan Hovold e217ae762b greybus: control: drop legacy-protocol dependency
Drop dependency on the legacy protocol abstraction.

Instead implement the protocol-specific version request directly, and
use the new interface for managing the control connection.

Note that the version request is being removed from most protocols, but
we need to keep the current request for the control protocol as-is
indefinitely to maintain backwards compatibility (e.g. with the ES2/ES3
bootrom).

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-19 12:17:13 -08:00
Johan Hovold 6bd6e14893 greybus: greybus_protocols: remove control-protocol version
Remove control-protocol version from the exported protocol definitions
as it is an implementation detail that makes no sense to export.

Currently gbsim uses the kernel's control-protocol version definitions
directly instead of reporting the version of the protocol it actually
implements.

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-19 12:17:13 -08:00
Johan Hovold bc3be1705c greybus: connection: remove skip-connected legacy protocol flags
Remove the legacy protocol flags that were used to suppress the
connected and disconnected events.

Instead send the connected and disconnected event for all bundle
connections and explicitly exclude static connections and control
connections.

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-19 12:17:13 -08:00
Johan Hovold 6d3d95042e greybus: connection: rename legacy init and exit functions
Rename legacy connection init and exit functions.

This is a step towards removing the legacy-protocol handling from core.

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-19 12:12:40 -08:00
Viresh Kumar d39bf704ac greybus: interface: Fetch and expose version of interface's firmware
The version of the currently running firmware on the module is useful
for userspace as it can be used to find if an update is available or
not. This patch fetches interface's version with a new control operation
and exposes the same in userspace.

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-12-30 13:13:04 -08:00
Viresh Kumar 5b22521c89 greybus: control: Use Macro's instead of direct values for major/minor
We already have macro's defined for this, use them.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-12-22 18:20:39 -08:00
Johan Hovold c634650ecc greybus: interface: clean up control-connection handling
Clean up control-connection handling by managing it through the control
structure and a higher-level control interface. Also make both the
control structure and connection lifetimes coincide with that of the
interface.

The control connection is now only enabled and disabled when the
interface is initialised and removed.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-12-15 14:23:37 -08:00
Johan Hovold 7fa530ad1b greybus: control: do not assume a control bundle
The control bundle is going away so update the code.

Also remove defensive WARN_ON which would not just warn if our
implementation is broken, but also leak further memory unnecessarily.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-25 15:39:16 -08:00
Johan Hovold 41a7fe27d6 greybus: control: remove unused request handler
Remove request handler for control protocol that makes no sense as we do
not have any incoming control requests defined.

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-11-02 11:26:44 -08:00
Greg Kroah-Hartman defa37ea9b greybus: control: use the bundle struct device instead of the connector
We are removing struct device from the gb_connection structure in the
near future.  The gb_bundle structure's struct device should be used as
a replacement.

This patch moves the control code to use the bundle pointer instead
of the connection pointer for printing out error messages.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Alex Elder <elder@linaro.org>
2015-10-15 09:19:15 -07:00
Viresh Kumar 5a5296bb8d greybus: Add flags to struct gb_protocol
This helps in removing special per-protocol code, with the help of
generic flags passed by protocol drivers.

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-09-14 21:19:46 -07:00
Viresh Kumar 0e2462d1b7 greybus: Drop protocol specific _PROTOCOL_VERSION and _INVALID macros
Greybus core supports protocol independent macros for this now, use
them.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-08-14 14:34:14 -07:00
Viresh Kumar 507d75c4f4 greybus: control: Drop get_version support
This is done from a common place now, no need to replicate it.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-08-11 19:33:05 -07:00
Johan Hovold 1c7658cf51 greybus: operation: fix atomic response allocation
Response allocation also needs a GFP-flags argument as a response is
allocated as part of an outgoing operation.

Fixes: 9aa174d202e5 ("operation: allow atomic operation allocations")
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-20 16:14:29 -07:00
Viresh Kumar 463e8736a3 greybus: control: Use gb_builtin_protocol_driver()
No need to write simple init/exit routines, use
gb_builtin_protocol_driver().

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-07-01 16:34:55 -07:00
Viresh Kumar cdee4f7505 greybus: Add control protocol support
Add control protocol driver that is responsible for handling operations
on control CPort. The AP also needs to support incoming requests on its
control port. Features not implemented yet are marked as TODO for now.

NOTE: This also fixes cport-bundle-id to 0 and cport-id to 2 for control
protocol.

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-23 23:16:15 -07:00