1
0
Fork 0
Commit Graph

183 Commits (c0219cbf72418d5355e319a0d787dc2671df9d4f)

Author SHA1 Message Date
David Lin 30a3bf7b30 greybus: interface: add runtime pm support
Configure and enable runtime pm support for the Interface. Refer to the
12.2. The Interface Lifecycle of the Greybus specification for details
on the requirements for transitioning from ENUMERATED to SUSPEND and
vice versa. All the Bundles for the Interface have to be either OFF or
SUSPENDED before the Interface can be autosuspended.

Testing Done:
 - Check the runtime_status of an interface driver and validate the
   suspend current of a module.

Signed-off-by: David Lin <dtwlin@google.com>
Signed-off-by: Axel Haslam <ahaslam@baylibre.com>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Alex Elder <elder@linaro.org>
2016-07-14 16:53:55 -05:00
Viresh Kumar c05d471b2d greybus: Remove legacy suspend/resume callbacks
We should be using the PM hooks available within the 'struct
device_driver', instead of adding legacy suspend/resume callbacks.
Remove them.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-06-09 17:28:02 -07:00
Bryan O'Donoghue 970dc85bd9 greybus: timesync: Add timesync core driver
This patch adds the core timesync functionality.

0. arche-platform.c/arche-apb-ctrl.c
   Modifies the platform layer to hook the incoming TIME_SYNC signal up to
   the timesync strobe IRQ handler. If the arche-platform driver can't
   satisfy the request for the wake-detect line, it will return -EAGAIN and
   the calling work-queue must reschedule the attempt to get exclusive
   access to the wake-detect pin logic. A private data field is added to
   the arche-platform driver to enable passing of a timesync pointer to the
   ISR responsible for synchronizing time.

1. timesync.c
   A new file added which contains all of the logic associated with sending
   greybus commands to SVC, APBx or Interfaces to enable, disable and
   disseminate timing information.

2. timesync_platform.c
   Any platform/arch specific code goes into timesync_platform.c.
   Originally the idea was to keep the x86 and ARM arch dependencies in a
   timesync_platform_arch.c file - however with further refinement that's
   currently not necessary however just-in-case it becomes necessary to
   resuscitate arch or platform specific methods for accessing timer
   resources that access shouldn't be part of the core timesync.c logic and
   so for the moment we access these timer resources through a thin access
   layer in timesync_platform.c. Expect this to go away long term ideally.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Acked-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-06-06 20:37:47 -07:00
David Lin 428888a2b6 greybus: legacy: remove legacy driver support
This patch removes the greybus legacy driver support

Signed-off-by: David Lin <dtwlin@google.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-05-20 16:47:30 -07:00
Johan Hovold b15d97d770 greybus: core: add module abstraction
Add Greybus module abstraction that will be used to implement controlled
module removal (eject) and represent module geometry.

Greybus module devices correspond to physical modules and have one or
more interfaces. Modules have an id that is identical to the id of their
primary interface, which in turn is the interface with lowest numbered
id. The module name is constructed from the bus and module id:

        <bus_id>-<module_id>

Interfaces, bundles, and control devices are consequently renamed as

        <bus_id>-<module_id>.<interface_id>
        <bus_id>-<module_id>.<interface_id>.<bundle_id>
        <bus_id>-<module_id>.<interface_id>.ctrl

As before, interface ids (and therefore in a sense now also module ids)
correspond to physical interface positions on the frame.

Modules have the following attributes:

        module_id
        num_interfaces

where module_id is the id of the module and num_interface the number of
interfaces the module has.

Note that until SVC module-size detection has been implemented, all
interfaces are considered to be part of 1x2 modules. Specifically, the
two interfaces of a 2x2 module will be presented as two 1x2 modules for
now.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-04-25 11:08:30 -07:00
Johan Hovold a6e5b014b8 greybus: core: make the control object be a device
Make the control object be a greybus device.

The control device will be used to expose attributes specific to
greybus-type interfaces.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-04-21 10:06:00 +09:00
Johan Hovold 8ec589b979 greybus: firmware: convert to bundle driver
Convert the legacy firmware protocol driver to a bundle driver.

This also fixes a potential crash should a (malicious) module have sent
an early request before the private data had been initialised.

Note that the firmware protocol needs to support the version request
indefinitely since it has been burnt into ROM.

In order to avoid having to update current module-loading scripts, keep
this driver internal to greybus core at least until modalias support is
added.

Note that there is no MODULE_DEVICE_TABLE defined for firmware as we
cannot have two greybus tables in one module on ancient 3.10 kernels and
that the legacy driver is currently also internal to core. This needs be
added once the driver can be built as a module.

Testing Done: Tested on DB3.

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-02-01 17:52:20 -08:00
Johan Hovold 13da9e11e9 greybus: core: add drvdata accessors
Add greybus driver-data accessors.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2016-01-09 00:41:46 -08:00
Johan Hovold 0f37860de9 greybus: kill the endo
Remove the now unused endo and module code.

Note that the never-implemented serial and version attributes of the
endo can be implemented as svc attributes if needed.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-25 15:35:59 -08:00
Johan Hovold 88f7b96da7 greybus: svc: register svc device at hello
Register the svc device upon reception of the HELLO request.

The SVC HELLO request contains the endo id and AP interface id, which
will be exposed from the svc device rather than the endo.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-25 15:30:03 -08:00
Johan Hovold 2adaefb145 greybus: hd: make host device a device
Make the host device a proper device in the kernel device model.

Host devices will be our new greybus-bus root devices.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-25 15:27:06 -08:00
Johan Hovold 3823c61479 greybus: add class matching macro
Add matching macro for bundle class.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-21 17:15:35 -08:00
Johan Hovold 9784a591f0 greybus: remove unique-id matching
Remove unique-id matching as it does not make much sense to have a
driver match a specific device serial number.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-21 17:15:35 -08:00
Johan Hovold 358e9400f4 greybus: fix bundle-id match macros
The matching flags were renamed over a year ago but the so far unused
id-macros were never updated.

Also rename the GREYBUS_ID_MATCH_DEVICE mask to use the common
GREYBUS_ID_MATCH-prefix.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-11-21 17:15:35 -08:00
Johan Hovold 2537636aba greybus: hd: rename host-device structure
Rename host-device structure gb_host_device to match our other
structures.

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-04 20:25:57 -08:00
Johan Hovold 7bc6faaca7 greybus: create host-device compilation unit
Move everything host-device related to hd.c and hd.h.

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-04 20:25:57 -08:00
Johan Hovold 04fdd6a51a greybus: remove obsolete comment
Remove obsolete comment about the driver model.

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-04 20:25:57 -08:00
Johan Hovold 0e30550665 greybus: remove unused connection device type
The connection device type is no longer used.

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-04 20:20:23 -08:00
Johan Hovold e96e616863 greybus: remove unused host-device id
Remove unused device_id field from host-device structure.

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-04 20:20:23 -08:00
Viresh Kumar 92cc1d2252 greybus: endo: move greybus_endo_setup() to endo.c
It belongs to the endo layer and should be placed in endo.c instead. Do
it.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-10-21 16:24:31 -07:00
Greg Kroah-Hartman c69b98d15f greybus: core: remove uevent handling for gb_connection
As we are going to be removing the struct device from gb_connection,
there is no need to do anything for uevents for them.  So just remove
the code.  It wasn't doing anything anyway, so no functionality is lost
here at all.

As is_gb_connection() is no longer used, that is also removed in this
patch.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Reviewed-by: Johan Hovold <johan@hovoldconsulting.com>
2015-10-19 12:09:10 -07:00
Bryan O'Donoghue 608ab2fe99 greybus: es1,es2: add USB vendor command to timestamp
As part of an effort to get deep inspection of latencies throughout the
greybus network including HSIC, UniPro and firmware incurred latencies a
new command to the APBridge to tag a known offset with timestamping data
has been introduced. This patch adds that code to the es1 and es2 drivers.

- latency_tag_enable
- latency_tag_disable

Respectively send the enable/disable command to APBridge on a per-CPort
basis. This allows only specified cports to have timestamping data added by
APBridge, leaving any CPort not specifically enabled untouched.

Signed-off-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-10-15 11:31:08 -07:00
Johan Hovold 3afe952127 greybus: hd: remove connection-create/destroy callbacks
These host-driver callbacks were intended to allow host drivers to
prepare a cport, something which can now be handled by the cport
enable/disable callbacks instead.

The current create/destroy are somewhat confusingly named as they were
not supposed to create or destroy connections. They were however called
from the unrelated helper functions that do create and destroy SVC
connections.

Furthermore, no errors were returned should the create callback fail,
which should have caused the connection initialisation to fail.

Remove these unused callbacks for now, and let us use the cport
enable/disable callbacks that should be able handle all host cport
initialisation (possibly after also adding an interface to provide
information for endpoint-cport mapping).

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-09-17 14:35:47 -07:00
Johan Hovold d7ea30a571 greybus: hd: add optional cport enable and disable callbacks
Add optional cport enable and disable callbacks to the greybus host
drivers, that can be used to initialise and allocate/release resources
associated with a cport during connection setup/teardown (e.g. software
queues and hardware state).

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-09-17 14:35:47 -07:00
Alexandre Bailon 8afd831ea0 greybus: Greybus driver: add a new callbacks to driver
Add connection_create and connection_destroy callbacks.

ES2 can map a cport to a pair of endpoints.
Because ES2 have only a few pair of endpoints, ES2 need to have
access to some high level connection information such as protocol id
to effectively map the cports.
These callback will provide these information and help ES2 to map cports.

Signed-off-by: Alexandre Bailon <abailon@baylibre.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-09-04 14:49:09 -07:00
Johan Hovold 1dc5392265 greybus: fix cport-id defines
The CPORT_ID_MAX define has been used by host drivers as a device limit,
but also for sanity checks when parsing manifests.

Now that it's only used for sanity checks we can increase it to the
specification maximum (4095) and get rid of the config-option that could
be used to override the previous limit (128).

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
2015-09-03 09:45:32 +02:00
Fabien Parent 144670c2ae greybus: add num_cports field to greybus hd
This commit is doing the preparation work in order to get the number of cports
supported from the UniPro IP instead of using a constant defined in a Kconfig
file.

Greybus host device is now holding the cport count, and all the code will now
use this value instead of the constant CPORT_ID_MAX when referring to an AP's
CPort ID.

Signed-off-by: Fabien Parent <fparent@baylibre.com>
[johan: es1 supports 256 cports, minor style changes ]
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
2015-09-02 16:21:54 +02:00
Greg Kroah-Hartman d706ef8f1b greybus: Merge branch 'master' into branch 'svc'.
This drags in the firmware driver, and the start of some loopback
changes.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-08-11 22:14:06 -07:00
Viresh Kumar 90f1b617d8 greybus: Add firmware protocol driver
This adds firmware protocol driver based on the latest specs available
on mailing lists. This uses the firmware framework present in kernel.

Refer Documentation/firmware_class/README on how it works.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-08-11 22:12:59 -07:00
Viresh Kumar ca539a67c6 greybus: remove svc_msg.h
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-29 10:06:18 -07:00
Greg Kroah-Hartman 260998ebc6 greybus: remove submit_svc from the host driver
The callback is never used anymore, so remove it from struct
greybus_host_driver as well as from the es1 and es2 drivers.

Tested-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-29 10:06:18 -07:00
Greg Kroah-Hartman 8476ec60e1 greybus: greybus.h: remove greybus_svc_in()
The function is gone, remove it from the header file as well.

Tested-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-29 10:06:18 -07:00
Perry Hung 75a60ed20d greybus: svc: connection: ask SVC to create connections
Ask the SVC to do all the necessary bits for creating a new connection.
This is skipped for the initial SVC connection.

Tested-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Perry Hung <perry@leaflabs.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-29 10:06:18 -07:00
Viresh Kumar 38e7b48b0c greybus: get rid of old svc-protocol
Its not used anymore as we have more sophisticated svc protocol in
place, lets get rid of earlier code.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Perry Hung <perry@leaflabs.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-29 10:06:18 -07:00
Greg Kroah-Hartman 3eac885de2 greybus: svc: revert svc changes to keep things working for a while.
The firmware for the svc changes isn't quite ready, so revert the whole
set of patches in one hunk to get things back to a working state for the
other firmware developers.  The svc patches will be added back in a
separate branch.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-29 10:05:09 -07:00
Viresh Kumar d8742156c1 greybus: remove svc_msg.h
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-27 14:13:22 -07:00
Greg Kroah-Hartman d187576fbe greybus: remove submit_svc from the host driver
The callback is never used anymore, so remove it from struct
greybus_host_driver as well as from the es1 and es2 drivers.

Tested-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-27 14:13:16 -07:00
Greg Kroah-Hartman 90c807e4fb greybus: greybus.h: remove greybus_svc_in()
The function is gone, remove it from the header file as well.

Tested-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-27 14:13:12 -07:00
Perry Hung 9c1552d7c4 greybus: svc: connection: ask SVC to create connections
Ask the SVC to do all the necessary bits for creating a new connection.
This is skipped for the initial SVC connection.

Tested-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Perry Hung <perry@leaflabs.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-27 14:13:07 -07:00
Viresh Kumar 0af7268882 greybus: get rid of old svc-protocol
Its not used anymore as we have more sophisticated svc protocol in
place, lets get rid of earlier code.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Perry Hung <perry@leaflabs.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-27 14:12:58 -07:00
Viresh Kumar d3d4484067 greybus: svc: Add helpers to create AP<->SVC connection
SVC connection is required before the AP knows its position on the endo
and type of endo. To enable message processing between the AP and SVC at
this time, we need a partially initialized connection which can handle
these messages.

Once the AP receives more information from the SVC, it can discard this
partially initialized connection and create a proper one, tied to a
bundle and interface.

Destroying the partially initialized connection is a bit tricky, as it
is required to send a response to svc-hello. That part will be properly
fixed separately.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-22 10:12:41 -07:00
Johan Hovold 3e136cc9e0 greybus: operation/esx: fix message-cancellation lifetime bugs
The current host-controller message-cancellation implementation suffer
from a lifetime bug as dynamically allocated URBs would complete and be
deallocated while being unlinked as part of cancellation.

The current locking is also insufficient to prevent the related race
where the URB is deallocated before being unlinked.

Fix this by pushing the cancellation implementation from greybus core
down to the host-controller drivers, and replace the "cookie" pointer
with a hcpriv field that those drivers can use to maintain their state
with the required locking and reference counting in place.

Specifically the drivers need to acquire a reference to the URB under a
lock before calling usb_kill_urb as part of cancellation.

Note that this also removes the insufficient gb_message_mutex, which
also effectively prevented us from implementing support for submissions
from atomic context.

Instead the host-controller drivers must now explicitly make sure that
the pre-allocated URBs are not reused while cancellation is in progress.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-07-01 16:43:02 -07:00
Viresh Kumar 7e9017d482 greybus: svc: Drop svc_set_route_send()
The responsibility of this routine is to configure ARA switch to
establish a connection between a cport on the AP and a cport on an
interface.

The SVC protocol is responsible for such requests and we already have
connection_{create|destroy}_operation() to take care of this.

Moreover, this request is not served by the firmware or gbsim today and
they just print a debug message on this request. And so it is safe to
drop svc_set_route_send() function and fix the required functionality of
configuring the switch in svc protocol driver later.

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:38:42 -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
Greg Kroah-Hartman fd7b435f21 greybus: Revert "greybus: reserve host cport id 0"
This reverts commit 698d4bd3e7541a660a3c3665f0af9e787650a239 as Alex
says it is broken.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-16 19:43:05 -07:00
Alex Elder 88d18a975d greybus: reserve host cport id 0
For ES1 and ES2, we use pad bytes in an operation message header to
encode the CPort ID used for transferring the message.  The pad
bytes should otherwise be zero, and we ensure this as the message
is passed to or from the upper layer.

If host-side CPort ID 0 is used, we have no way of knowing whether
the CPort field has been "packed" into the header.

To allow detection of this, reserve host CPort id 0.  Update
cport_id_valid() to treat 0 as invalid.

(CPort ID 0 is reserved by one of the UniPro standards.  We'll
assume for now that we never use it for Greybus.)

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-15 16:49:00 -07:00
Alex Elder fb690ca96f greybus: rename HOST_DEV_CPORT_ID_MAX
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-15 16:49:00 -07:00
Alex Elder 821c620afa greybus: introduce cport_id_valid()
Define a public predicate that defines whether a CPort ID is valid.

Use it in the message_send() routine, and make the message reported
more accurately reflect the error.  Also use it to check whether the
CPort ID in a received message is valid; if it is not, just drop the
message.

Get rid of local variable "buffer" in message_send(); it adds no
value.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-15 16:49:00 -07:00
Greg Kroah-Hartman 3d0421e0ab greybus: remove __init from .h files
__init does not belong in a .h file, as it does not do anything there,
so remove all instances of it.

Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-11 09:35:00 -07:00
Alex Elder 47ed2c9240 greybus: tag core init and exit functions
The top-level functions gb_init() and gb_exit() are tagged with
__init and __exit, respectively.  These functions call a few
other functions that are similarly used only at initialization
and termination time.  So mark those functions accordingly.

Note that, because gb_ap_exit() and gb_debugfs_cleanup()
are called by gb_init() in error paths, these functions
cannot be declared with the __exit attribute.

Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2015-06-10 10:38:23 -07:00