blob: 113c98542858a6c0c9e7e11bb81b8d80f6799b10 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
/*
* Greybus connections
*
* Copyright 2014 Google Inc.
*
* Released under the GPLv2 only.
*/
#include "greybus.h"
/*
* Set up a Greybus connection, representing the bidirectional link
* between a CPort on a (local) Greybus host device and a CPort on
* another Greybus module.
*
* Returns a pointer to the new connection if successful, or a null
* pointer otherwise.
*/
struct gb_connection *gb_connection_create(struct greybus_host_device *hd,
u16 cport_id, struct gb_function *function)
{
struct gb_connection *connection;
connection = kzalloc(sizeof(*connection), GFP_KERNEL);
if (!connection)
return NULL;
connection->hd = hd; /* XXX refcount? */
connection->cport_id = cport_id;
connection->function = function; /* XXX refcount? */
return connection;
}
/*
* Tear down a previously set up connection.
*/
void gb_connection_destroy(struct gb_connection *connection)
{
if (WARN_ON(!connection))
return;
/* XXX Need to wait for any outstanding requests to complete */
/* kref_put(function); */
/* kref_put(hd); */
kfree(connection);
}
|