From: Rui Miguel Silva Date: Tue, 15 Sep 2015 14:33:51 +0000 (+0100) Subject: greybus: svc: fix endianness for svc message X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2498050b03399cc0df32863f9a4c2a63b1f30d79;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git greybus: svc: fix endianness for svc message Some fields in svc request were not being set with the correct endianness, which will trigger the following sparse issues as example: greybus/svc.c:116:22: warning: incorrect type in assignment (different base types) greybus/svc.c:116:22: expected unsigned short [unsigned] [assigned] [usertype] attr greybus/svc.c:116:22: got restricted __le16 [usertype] Signed-off-by: Rui Miguel Silva Reviewed-by: Viresh Kumar Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/greybus_protocols.h b/drivers/staging/greybus/greybus_protocols.h index 9b2d18916403..b3d0c57ea073 100644 --- a/drivers/staging/greybus/greybus_protocols.h +++ b/drivers/staging/greybus/greybus_protocols.h @@ -791,9 +791,9 @@ struct gb_svc_intf_reset_request { struct gb_svc_conn_create_request { __u8 intf1_id; - __u16 cport1_id; + __le16 cport1_id; __u8 intf2_id; - __u16 cport2_id; + __le16 cport2_id; __u8 tc; __u8 flags; } __packed; @@ -801,32 +801,32 @@ struct gb_svc_conn_create_request { struct gb_svc_conn_destroy_request { __u8 intf1_id; - __u16 cport1_id; + __le16 cport1_id; __u8 intf2_id; - __u16 cport2_id; + __le16 cport2_id; } __packed; /* connection destroy response has no payload */ struct gb_svc_dme_peer_get_request { __u8 intf_id; - __u16 attr; - __u16 selector; + __le16 attr; + __le16 selector; } __packed; struct gb_svc_dme_peer_get_response { - __u16 result_code; - __u32 attr_value; + __le16 result_code; + __le32 attr_value; } __packed; struct gb_svc_dme_peer_set_request { __u8 intf_id; - __u16 attr; - __u16 selector; - __u32 value; + __le16 attr; + __le16 selector; + __le32 value; } __packed; struct gb_svc_dme_peer_set_response { - __u16 result_code; + __le16 result_code; } __packed; struct gb_svc_route_create_request { diff --git a/drivers/staging/greybus/svc.c b/drivers/staging/greybus/svc.c index 28f03dc463f3..35e2fb525dfa 100644 --- a/drivers/staging/greybus/svc.c +++ b/drivers/staging/greybus/svc.c @@ -183,9 +183,9 @@ int gb_svc_connection_create(struct gb_svc *svc, struct gb_svc_conn_create_request request; request.intf1_id = intf1_id; - request.cport1_id = cport1_id; + request.cport1_id = cpu_to_le16(cport1_id); request.intf2_id = intf2_id; - request.cport2_id = cport2_id; + request.cport2_id = cpu_to_le16(cport2_id); /* * XXX: fix connections paramaters to TC0 and all CPort flags * for now. @@ -206,9 +206,9 @@ void gb_svc_connection_destroy(struct gb_svc *svc, u8 intf1_id, u16 cport1_id, int ret; request.intf1_id = intf1_id; - request.cport1_id = cport1_id; + request.cport1_id = cpu_to_le16(cport1_id); request.intf2_id = intf2_id; - request.cport2_id = cport2_id; + request.cport2_id = cpu_to_le16(cport2_id); ret = gb_operation_sync(connection, GB_SVC_TYPE_CONN_DESTROY, &request, sizeof(request), NULL, 0);