diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2015-12-18 21:23:21 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2015-12-21 16:34:46 -0800 |
commit | c6622216ffaacc6286189121e63cdaae1b6bcbce (patch) | |
tree | 69f9cf2232e79d06a20aa690768e316c35af009a /drivers | |
parent | 70b3b3e77a87d40ceae6e5f4f6afedbd725fd636 (diff) |
greybus: camera: Fix endian conversion issues
Convert all Greybus operation fields between CPU and protocol
endianness.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reported-by: Rui Silva <rui.silva@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/staging/greybus/camera.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c index b7d9384e9471..545ed632901a 100644 --- a/drivers/staging/greybus/camera.c +++ b/drivers/staging/greybus/camera.c @@ -103,9 +103,9 @@ static int gb_camera_configure_streams(struct gb_camera *gcam, for (i = 0; i < nstreams; ++i) { struct gb_camera_stream_config_request *cfg = &req->config[i]; - cfg->width = streams[i].width; - cfg->height = streams[i].height; - cfg->format = streams[i].format; + cfg->width = cpu_to_le16(streams[i].width); + cfg->height = cpu_to_le16(streams[i].height); + cfg->format = cpu_to_le16(streams[i].format); cfg->padding = 0; } @@ -131,13 +131,13 @@ static int gb_camera_configure_streams(struct gb_camera *gcam, for (i = 0; i < nstreams; ++i) { struct gb_camera_stream_config_response *cfg = &resp->config[i]; - streams[i].width = cfg->width; - streams[i].height = cfg->height; - streams[i].format = cfg->format; + streams[i].width = le16_to_cpu(cfg->width); + streams[i].height = le16_to_cpu(cfg->height); + streams[i].format = le16_to_cpu(cfg->format); streams[i].vc = cfg->virtual_channel; streams[i].dt[0] = cfg->data_type[0]; streams[i].dt[1] = cfg->data_type[1]; - streams[i].max_size = cfg->max_size; + streams[i].max_size = le32_to_cpu(cfg->max_size); if (cfg->padding[0] || cfg->padding[1] || cfg->padding[2]) { gcam_dbg(gcam, "stream #%u padding != 0", i); @@ -169,10 +169,10 @@ static int gb_camera_capture(struct gb_camera *gcam, u32 request_id, if (!req) return -ENOMEM; - req->request_id = request_id; + req->request_id = cpu_to_le32(request_id); req->streams = streams; req->padding = 0; - req->num_frames = num_frames; + req->num_frames = cpu_to_le16(num_frames); memcpy(req->settings, settings, settings_size); return gb_operation_sync(gcam->connection, GB_CAMERA_TYPE_CAPTURE, @@ -190,7 +190,7 @@ static int gb_camera_flush(struct gb_camera *gcam, u32 *request_id) return ret; if (request_id) - *request_id = resp.request_id; + *request_id = le32_to_cpu(resp.request_id); return 0; } |