From: Matt Porter Date: Wed, 22 Oct 2014 06:06:09 +0000 (-0400) Subject: greybus: ap: add svc_set_route_send() command and use it on a link up event X-Git-Tag: v4.9-rc1~119^2~378^2~21^2~1974 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=060b93ddbb5dedd10bddb61664815752db56a9f3;p=karo-tx-linux.git greybus: ap: add svc_set_route_send() command and use it on a link up event When the AP receives a link up event, request that the SVC set a route to the interface's device id (this device id has been previously reported to the AP). In the future, we may not always immediately set a route upon receiving a link up event but this is sufficient for the known use cases at this time. Signed-off-by: Matt Porter Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/ap.c b/drivers/staging/greybus/ap.c index c8f30f64e375..46553b1cf312 100644 --- a/drivers/staging/greybus/ap.c +++ b/drivers/staging/greybus/ap.c @@ -103,6 +103,23 @@ static void svc_handshake(struct svc_function_handshake *handshake, svc_msg_send(svc_msg, hd); } +static void svc_set_route_send(struct gb_interface *interface, + struct greybus_host_device *hd) +{ + struct svc_msg *svc_msg; + + svc_msg = svc_msg_alloc(SVC_FUNCTION_UNIPRO_NETWORK_MANAGEMENT); + if (!svc_msg) + return; + + svc_msg->header.function_id = SVC_FUNCTION_UNIPRO_NETWORK_MANAGEMENT; + svc_msg->header.message_type = SVC_MSG_DATA; + svc_msg->header.payload_length = + cpu_to_le16(sizeof(struct svc_function_unipro_set_route)); + svc_msg->management.set_route.device_id = interface->device_id; + svc_msg_send(svc_msg, hd); +} + static void svc_management(struct svc_function_unipro_management *management, int payload_length, struct greybus_host_device *hd) { @@ -132,6 +149,7 @@ static void svc_management(struct svc_function_unipro_management *management, return; } interface->device_id = management->link_up.device_id; + svc_set_route_send(interface, hd); break; case SVC_MANAGEMENT_AP_DEVICE_ID: hd->device_id = management->ap_device_id.device_id;