Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d2196a79 authored by Linux Build Service Account's avatar Linux Build Service Account
Browse files

Merge 975d708f on remote branch

Change-Id: I2a6ef3f8a6191ff03d164aac515cdd23425fdb99
parents 433bc7c1 975d708f
Loading
Loading
Loading
Loading
+14 −9
Original line number Diff line number Diff line
/* Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2022, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -1619,7 +1619,6 @@ static int diag_send_dci_pkt(struct diag_cmd_reg_t *entry,
		return -EIO;
	}

	mutex_lock(&driver->dci_mutex);
	/* prepare DCI packet */
	header.start = CONTROL_CHAR;
	header.version = 1;
@@ -1638,7 +1637,6 @@ static int diag_send_dci_pkt(struct diag_cmd_reg_t *entry,
		diag_update_pkt_buffer(driver->apps_dci_buf, write_len,
				       DCI_PKT_TYPE);
		diag_update_sleeping_process(entry->pid, DCI_PKT_TYPE);
		mutex_unlock(&driver->dci_mutex);
		return DIAG_DCI_NO_ERROR;
	}

@@ -1658,7 +1656,6 @@ static int diag_send_dci_pkt(struct diag_cmd_reg_t *entry,
		       entry->proc);
		status = DIAG_DCI_SEND_DATA_FAIL;
	}
	mutex_unlock(&driver->dci_mutex);
	return status;
}

@@ -1984,12 +1981,13 @@ static int diag_process_dci_pkt_rsp(unsigned char *buf, int len)
{
	int ret = DIAG_DCI_TABLE_ERR;
	int common_cmd = 0, header_len = 0;
	int req_tag = 0;
	struct diag_pkt_header_t *header = NULL;
	unsigned char *temp = buf;
	unsigned char *req_buf = NULL;
	uint8_t retry_count = 0, max_retries = 3;
	uint32_t read_len = 0, req_len = len;
	struct dci_pkt_req_entry_t *req_entry = NULL;
	struct dci_pkt_req_entry_t *req_entry = NULL, *test_entry = NULL;
	struct diag_dci_client_tbl *dci_entry = NULL;
	struct dci_pkt_req_t req_hdr;
	struct diag_cmd_reg_t *reg_item;
@@ -2093,6 +2091,7 @@ static int diag_process_dci_pkt_rsp(unsigned char *buf, int len)
		mutex_unlock(&driver->dci_mutex);
		return DIAG_DCI_NO_REG;
	}
	req_tag = req_entry->tag;
	mutex_unlock(&driver->dci_mutex);

	/*
@@ -2100,14 +2099,14 @@ static int diag_process_dci_pkt_rsp(unsigned char *buf, int len)
	 * remote processor
	 */
	if (dci_entry->client_info.token > 0) {
		ret = diag_send_dci_pkt_remote(req_buf, req_len, req_entry->tag,
		ret = diag_send_dci_pkt_remote(req_buf, req_len, req_tag,
					       dci_entry->client_info.token);
		return ret;
	}

	/* Check if it is a dedicated Apps command */
	ret = diag_dci_process_apps_pkt(header, req_buf, req_len,
					req_entry->tag, header_len);
					req_tag, header_len);
	if ((ret == DIAG_DCI_NO_ERROR && !common_cmd) || ret < 0)
		return ret;

@@ -2130,8 +2129,14 @@ static int diag_process_dci_pkt_rsp(unsigned char *buf, int len)
	if (temp_entry) {
		reg_item = container_of(temp_entry, struct diag_cmd_reg_t,
								entry);
		mutex_lock(&driver->dci_mutex);
		test_entry = diag_dci_get_request_entry(req_tag);
		if (test_entry)
			ret = diag_send_dci_pkt(reg_item, req_buf, req_len,
					req_entry->tag);
					test_entry->tag);
		else
			ret = -EIO;
		mutex_unlock(&driver->dci_mutex);
	} else {
		DIAG_LOG(DIAG_DEBUG_DCI, "Command not found: %02x %02x %02x\n",
				reg_entry.cmd_code, reg_entry.subsys_id,
+3 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2018, 2021 The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -60,8 +60,10 @@ static long cam_subdev_ioctl(struct v4l2_subdev *sd, unsigned int cmd,

	switch (cmd) {
	case VIDIOC_CAM_CONTROL:
		cam_req_mgr_rwsem_read_op(CAM_SUBDEV_LOCK);
		rc = cam_node_handle_ioctl(node,
			(struct cam_control *) arg);
		cam_req_mgr_rwsem_read_op(CAM_SUBDEV_UNLOCK);
		break;
	default:
		CAM_ERR(CAM_CORE, "Invalid command %d for %s", cmd,
+6 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2018, 2021 The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -50,8 +50,11 @@ static int cam_fd_dev_open(struct v4l2_subdev *sd,
{
	struct cam_fd_dev *fd_dev = &g_fd_dev;

	cam_req_mgr_rwsem_read_op(CAM_SUBDEV_LOCK);

	if (!fd_dev->probe_done) {
		CAM_ERR(CAM_FD, "FD Dev not initialized, fd_dev=%pK", fd_dev);
		cam_req_mgr_rwsem_read_op(CAM_SUBDEV_UNLOCK);
		return -ENODEV;
	}

@@ -60,6 +63,8 @@ static int cam_fd_dev_open(struct v4l2_subdev *sd,
	CAM_DBG(CAM_FD, "FD Subdev open count %d", fd_dev->open_cnt);
	mutex_unlock(&fd_dev->lock);

	cam_req_mgr_rwsem_read_op(CAM_SUBDEV_UNLOCK);

	return 0;
}

+4 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2018, 2021The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -82,6 +82,8 @@ static int cam_icp_subdev_open(struct v4l2_subdev *sd,
	struct cam_node *node = v4l2_get_subdevdata(sd);
	int rc = 0;

	cam_req_mgr_rwsem_read_op(CAM_SUBDEV_LOCK);

	mutex_lock(&g_icp_dev.icp_lock);
	if (g_icp_dev.open_cnt >= 1) {
		CAM_ERR(CAM_ICP, "ICP subdev is already opened");
@@ -104,6 +106,7 @@ static int cam_icp_subdev_open(struct v4l2_subdev *sd,
	g_icp_dev.open_cnt++;
end:
	mutex_unlock(&g_icp_dev.icp_lock);
	cam_req_mgr_rwsem_read_op(CAM_SUBDEV_UNLOCK);
	return rc;
}

+5 −1
Original line number Diff line number Diff line
/* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
/* Copyright (c) 2017-2018, 2021 The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -59,10 +59,14 @@ static const struct of_device_id cam_isp_dt_match[] = {
static int cam_isp_subdev_open(struct v4l2_subdev *sd,
	struct v4l2_subdev_fh *fh)
{
	cam_req_mgr_rwsem_read_op(CAM_SUBDEV_LOCK);

	mutex_lock(&g_isp_dev.isp_mutex);
	g_isp_dev.open_cnt++;
	mutex_unlock(&g_isp_dev.isp_mutex);

	cam_req_mgr_rwsem_read_op(CAM_SUBDEV_UNLOCK);

	return 0;
}

Loading