Commit 6a1d2959 authored by Bryan O'Donoghue's avatar Bryan O'Donoghue Committed by Greg Kroah-Hartman

greybus: greybus_protocols.h/es2: Ensure __le32 is used not u32

There is a dangling u32 in es2/greybus_protocols.h that is only obvious
when you try to compile up gbsim. We need to do a cpu_to_le32 and declare
the 32-bit int in the header as __le32. This patch does that and splits out
the assignment of the req->flags parameter to a temporary variable to allow
for later printing.
Signed-off-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
Suggested-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Reviewed-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 433aa123
...@@ -690,19 +690,23 @@ static int cport_enable(struct gb_host_device *hd, u16 cport_id, ...@@ -690,19 +690,23 @@ static int cport_enable(struct gb_host_device *hd, u16 cport_id,
struct es2_ap_dev *es2 = hd_to_es2(hd); struct es2_ap_dev *es2 = hd_to_es2(hd);
struct usb_device *udev = es2->usb_dev; struct usb_device *udev = es2->usb_dev;
struct gb_apb_request_cport_flags *req; struct gb_apb_request_cport_flags *req;
u32 connection_flags;
int ret; int ret;
req = kzalloc(sizeof(*req), GFP_KERNEL); req = kzalloc(sizeof(*req), GFP_KERNEL);
if (!req) if (!req)
return -ENOMEM; return -ENOMEM;
connection_flags = 0;
if (flags & GB_CONNECTION_FLAG_CONTROL) if (flags & GB_CONNECTION_FLAG_CONTROL)
req->flags |= GB_APB_CPORT_FLAG_CONTROL; connection_flags |= GB_APB_CPORT_FLAG_CONTROL;
if (flags & GB_CONNECTION_FLAG_HIGH_PRIO) if (flags & GB_CONNECTION_FLAG_HIGH_PRIO)
req->flags |= GB_APB_CPORT_FLAG_HIGH_PRIO; connection_flags |= GB_APB_CPORT_FLAG_HIGH_PRIO;
req->flags = cpu_to_le32(connection_flags);
dev_dbg(&hd->dev, "%s - cport = %u, flags = %02x\n", __func__, dev_dbg(&hd->dev, "%s - cport = %u, flags = %02x\n", __func__,
cport_id, req->flags); cport_id, connection_flags);
ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
GB_APB_REQUEST_CPORT_FLAGS, GB_APB_REQUEST_CPORT_FLAGS,
......
...@@ -272,7 +272,7 @@ struct gb_control_intf_pm_response { ...@@ -272,7 +272,7 @@ struct gb_control_intf_pm_response {
#define APBA_REQUEST_ARPC_RUN 0x12 #define APBA_REQUEST_ARPC_RUN 0x12
struct gb_apb_request_cport_flags { struct gb_apb_request_cport_flags {
u32 flags; __le32 flags;
#define GB_APB_CPORT_FLAG_CONTROL 0x01 #define GB_APB_CPORT_FLAG_CONTROL 0x01
#define GB_APB_CPORT_FLAG_HIGH_PRIO 0x02 #define GB_APB_CPORT_FLAG_HIGH_PRIO 0x02
} __packed; } __packed;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment