And return the response num_streams field through a pointer variable
instead of using the return value of the function as both an error code
and a positive number of streams, it makes the API more consistent.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
} __packed;
static int gb_camera_configure_streams(struct gb_camera *gcam,
} __packed;
static int gb_camera_configure_streams(struct gb_camera *gcam,
- unsigned int nstreams,
- unsigned int flags,
+ unsigned int *num_streams,
+ unsigned int *flags,
struct gb_camera_stream_config *streams)
{
struct gb_camera_configure_streams_request *req;
struct gb_camera_configure_streams_response *resp;
struct ap_csi_config_request csi_cfg;
struct gb_camera_stream_config *streams)
{
struct gb_camera_configure_streams_request *req;
struct gb_camera_configure_streams_response *resp;
struct ap_csi_config_request csi_cfg;
+ unsigned int nstreams = *num_streams;
unsigned int i;
size_t req_size;
size_t resp_size;
unsigned int i;
size_t req_size;
size_t resp_size;
}
req->num_streams = nstreams;
}
req->num_streams = nstreams;
req->padding = 0;
for (i = 0; i < nstreams; ++i) {
req->padding = 0;
for (i = 0; i < nstreams; ++i) {
+ *flags = resp->flags;
+
for (i = 0; i < nstreams; ++i) {
struct gb_camera_stream_config_response *cfg = &resp->config[i];
for (i = 0; i < nstreams; ++i) {
struct gb_camera_stream_config_response *cfg = &resp->config[i];
gcam_err(gcam, "failed to %s the CSI transmitter\n",
nstreams ? "start" : "stop");
gcam_err(gcam, "failed to %s the CSI transmitter\n",
nstreams ? "start" : "stop");
- ret = resp->num_streams;
+ *num_streams = resp->num_streams;
+ ret = 0;
{
struct gb_camera *gcam = priv;
struct gb_camera_stream_config *gb_streams;
{
struct gb_camera *gcam = priv;
struct gb_camera_stream_config *gb_streams;
+ unsigned int flags = 0;
gb_camera_mbus_to_gb(streams[i].pixel_code);
}
gb_camera_mbus_to_gb(streams[i].pixel_code);
}
- ret = gb_camera_configure_streams(gcam, nstreams, 0, gb_streams);
+ ret = gb_camera_configure_streams(gcam, &nstreams, &flags, gb_streams);
- ret = gb_camera_configure_streams(gcam, nstreams, flags, streams);
+ ret = gb_camera_configure_streams(gcam, &nstreams, &flags, streams);
- nstreams = ret;
- buffer->length = sprintf(buffer->data, "%u;", nstreams);
+ buffer->length = sprintf(buffer->data, "%u;%u;", nstreams, flags);
for (i = 0; i < nstreams; ++i) {
struct gb_camera_stream_config *stream = &streams[i];
for (i = 0; i < nstreams; ++i) {
struct gb_camera_stream_config *stream = &streams[i];