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] <noident>

Signed-off-by: Rui Miguel Silva <rui.silva@linaro.org>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Rui Miguel Silva 2015-09-15 15:33:51 +01:00 committed by Greg Kroah-Hartman
parent cfb1690686
commit 2498050b03
2 changed files with 16 additions and 16 deletions

View File

@ -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 {

View File

@ -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);