dm: Return newly created dm object

In order for the usb code to be able to post messages on the DM return
the handle to the newly created object.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
Bjorn Andersson 2018-07-19 21:25:23 -07:00
parent 6a96be0210
commit c3beba72f7
2 changed files with 4 additions and 2 deletions

View File

@ -65,7 +65,7 @@ struct list_head diag_clients = LIST_INIT(diag_clients);
* dm_add() - register new DM
* @dm: DM object to register
*/
void dm_add(const char *name, int in_fd, int out_fd, bool hdlc_encoded)
struct diag_client *dm_add(const char *name, int in_fd, int out_fd, bool hdlc_encoded)
{
struct diag_client *dm;
@ -83,6 +83,8 @@ void dm_add(const char *name, int in_fd, int out_fd, bool hdlc_encoded)
watch_add_writeq(dm->out_fd, &dm->outq);
list_add(&diag_clients, &dm->node);
return dm;
}
static int dm_recv_hdlc(struct diag_client *dm)

View File

@ -36,7 +36,7 @@
struct diag_client;
void dm_add(const char *name, int in_fd, int out_fd, bool hdlc_encoded);
struct diag_client *dm_add(const char *name, int in_fd, int out_fd, bool hdlc_encoded);
int dm_recv(int fd, void* data);
ssize_t dm_send(struct diag_client *dm, const void *ptr, size_t len);
void dm_broadcast(const void *ptr, size_t len);