__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>
WARNING: /home/viresh/work/repos/ara/greybus/greybus.o(.init.text+0xb8):
Section mismatch in reference from the function init_module() to the
function .exit.text:gb_endo_exit()
The function __init init_module() references
a function __exit gb_endo_exit().
Fix it by removing __exit from endo_exit().
Fixes: cf64356c5151 ("endo: define endo_init() and endo_exit()")
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Recently code was added (back) to assign a unique id to each
endo, so satisfy uniqueness requirements of the Linux device
subsystem. An ID allocator is used to manage the space of IDs.
Now that we have gb_endo_init(), we can initialize the map there,
and fully hide the ID map within "endo.c".
The original functions gb_endo_id_alloc() and gb_endo_id_free()
provided a nice abstract interface, but the direct ID allocation
calls are quite simple, so just call them directly.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Define init and exit functions to do one-time setup and teardown
of endo-related functionality. Currently they're place holders;
the next patch will populate them.
Note that we now call gb_operation_exit() from gb_init(), so
we can no longer mark that function with __exit.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
There is a sparse warning. The endo id map is also
used in endo.c. Should define in endo.h
Signed-off-by: Phong Tran <tranmanphong@gmail.com>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Currently we name the endo device as "endo". And it shows up with the
same name in sysfs directory: /sys/bus/greybus/devices/.
But each device in kernel should be represented by a unique id in
kernel, and "endo" isn't unique.
Lets generate unique ids for endo devices. The ida mechanism for
allocating ids may be overkill but it works.
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>
The AP resides in a particular position on an Endo, which is
identified by an interface ID. (For now we'll assume the AP uses
just one interface.) Record the this AP interface ID when creating
an Endo. Add a sysfs attribute to display it as well.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
We are going to want to defer creating the endo until we receive a
probe operation from the SVC, which will supply the endo id. Change
gb_endo_create() so it passes the endo_id value as an argument.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change the name of "struct gb_svc" to be "struct svc_info". The
structure now contains only the SVC's serial number and version (and
are place holders anyway). We will be defining a structure that
represents the SVC for the SVC protocol connection, and I want to
take back that name.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Endo is described by a 16 bit value. Which represents the properties of
modules, interface and ribs on front and back of endo.
This 16 bit value can be used to find all possible pairs of modules and
interfaces and creating modules based on that.
This patch provides helpers to parse 16 bit Endo ID.
(Based on original code written by Alex Elder.)
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>
There can be three Endo types: mini, medium and large. And that's what
Endo 'type' should refer to.
But we have named the 16 bit number that uniquely represents a valid
endo, as its type. 'id' seems to be a more suitable name to that instead
of 'type'. Lets rename it.
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>
This adds endo.c and endo.h and provides functions to create an endo and
the initial 0x0555 set of modules.
But, it doesn't hook this logic up into the running code yet, that comes
next.
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Alex Elder <elder@linaro.org>