]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
greybus: look up connection for recevied messages
authorAlex Elder <elder@linaro.org>
Mon, 6 Oct 2014 11:53:09 +0000 (06:53 -0500)
committerGreg Kroah-Hartman <greg@kroah.com>
Mon, 6 Oct 2014 15:56:42 +0000 (08:56 -0700)
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 <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
drivers/staging/greybus/gbuf.c

index fada1219272669e0a43166f3c58466f0ea3ec9f7..17c1af8a00e822880f964818dfd007167576c059 100644 (file)
@@ -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];