From 00d2e7588c79a2b9681f243d06ad02a254ab4ff9 Mon Sep 17 00:00:00 2001 From: Alex Elder Date: Mon, 6 Oct 2014 06:53:09 -0500 Subject: [PATCH] greybus: look up connection for recevied messages Look up the connection that an incoming message is associated with. This is the start of making message handling oriented toward the the connection rather than the cport. Signed-off-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/gbuf.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/staging/greybus/gbuf.c b/drivers/staging/greybus/gbuf.c index fada12192726..17c1af8a00e8 100644 --- a/drivers/staging/greybus/gbuf.c +++ b/drivers/staging/greybus/gbuf.c @@ -179,6 +179,14 @@ void greybus_cport_in(struct greybus_host_device *hd, u16 cport_id, { struct gb_cport_handler *ch; struct gbuf *gbuf; + struct gb_connection *connection; + + connection = gb_hd_connection_find(hd, cport_id); + if (!connection) { + dev_err(hd->parent, + "nonexistent connection (%zu bytes dropped)\n", length); + return; + } /* first check to see if we have a cport handler for this cport */ ch = &cport_handler[cport_id]; -- 2.39.5