connection: pass kdbus_bus instead of kdbus_ep where possible

Pass a pointer to a kdbus_bus instead of a kdbus_ep in
kdbus_conn_broadcast() and kdbus_conn_eavesdrop().

Drop unused argument from kdbus_conn_wait_reply().

Signed-off-by: Daniel Mack <daniel@zonque.org>
Revert "domain: embed kdbus_node"

This reverts commit f801b59f9127643866656ae9df77e452edb41f48.
Followup-commits will rework the kdbus_node logic. Lets revert this for
now so we can start over.
node: rework and allow embedding into parent objects

Rework the node logic to allow embedding it into the parent object.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
test-sync: use ASSERT_EXIT() instead of ASSERT_RETURN() in child

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
connection: move the attach entry for synchronous messages into its own function

Move the create and attach entry for synchronous replies to its own
function, while we are it simplify code add more comments.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
node: only drop IDs if allocated

kdbus_node_init() might fail, though the refcnt is initialized. In those
cases, we want kdbus_node_unref() to still work, so make sure to not try
to remove zeroed IDs.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
domain: embed new kdbus_node

Use the new kdbus_node object in domains.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
domain: reorder functions

Re-order functions to be:
  _new()
  _free()
  _ref()
  _unref()
  (_register())
  _unregister()

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
domain: split domain_new()

Provide separate activation and allocation functions. Also renamed
everything to better reflect what it does.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
endpoint: embed new kdbus_node

Use the new kdbus_node object in endpoints.

Signed-off-by: Daniel Mack <daniel@zonque.org>
endpoint: drop unneeded put_device()

Signed-off-by: Daniel Mack <daniel@zonque.org>
endpoint: reorder functions

Re-order functions to follow the same order as domains.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
endpoint: split kdbus_ep_new()

Same as for domains, split off kdbus_ep_activate() from kdbus_ep_new() and
perform some renaming while at it.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
handle: drop _cdev and use _node

There is no more use for _cdev so drop it. We can use the _node
implementation to lookup minor numbers.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
node: call release_cb() only from drain()

We should not make node_release() cause a call to ->release_cb().
node_release() might hold outer locks that the node-implementor needs
during release. Therefore, make sure ->release_cb() is _only_ called from
drain().

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
bus: use kdbus_node instead of kref

We need a relationship between nodes, hence all types need to be
converted to kdbus_node first.

Signed-off-by: Daniel Mack <daniel@zonque.org>
bus: s/kdbus_bus_disconnect/kdbus_bus_deactivate

Rename kdbus_bus_disconnect() → kdbus_bus_deactivate() to unify
the internal API.

Signed-off-by: Daniel Mack <daniel@zonque.org>
tree-wide: fix kerneldocs

Signed-off-by: Daniel Mack <daniel@zonque.org>
node: move umode_t into kdbus_node

We need API access modes in a generic way to avoid calling into underlying
objects. Therefore, move it into the kdbus_node.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
connection: fix compilation error

Include kref.h now that bus.h doesn't include it anymore.

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>