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

Commit e62449cf authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: synx: separate lock for bind table"

parents 499fbab4 25871fc1
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -1434,7 +1434,7 @@ int synx_register_ops(const struct synx_register_params *params)
		return -EINVAL;
	}

	mutex_lock(&synx_dev->table_lock);
	mutex_lock(&synx_dev->vtbl_lock);
	client_ops = &synx_dev->bind_vtbl[params->type];
	if (!client_ops->valid) {
		client_ops->valid = true;
@@ -1451,7 +1451,7 @@ int synx_register_ops(const struct synx_register_params *params)
			client_ops->name);
		rc = -EINVAL;
	}
	mutex_unlock(&synx_dev->table_lock);
	mutex_unlock(&synx_dev->vtbl_lock);

	return rc;
}
@@ -1466,12 +1466,12 @@ int synx_deregister_ops(const struct synx_register_params *params)
		return -EINVAL;
	}

	mutex_lock(&synx_dev->table_lock);
	mutex_lock(&synx_dev->vtbl_lock);
	client_ops = &synx_dev->bind_vtbl[params->type];
	memset(client_ops, 0, sizeof(*client_ops));
	pr_info("deregistered bind ops for %s\n",
		params->name);
	mutex_unlock(&synx_dev->table_lock);
	mutex_unlock(&synx_dev->vtbl_lock);

	return 0;
}
@@ -1488,6 +1488,7 @@ static int __init synx_init(void)
		return -ENOMEM;

	mutex_init(&synx_dev->table_lock);
	mutex_init(&synx_dev->vtbl_lock);

	for (idx = 0; idx < SYNX_MAX_OBJS; idx++)
		spin_lock_init(&synx_dev->row_spinlocks[idx]);
+2 −0
Original line number Diff line number Diff line
@@ -198,6 +198,7 @@ struct synx_import_data {
 * synx_ids       : Global unique ids
 * idr_lock       : Spin lock for id allocation
 * dma_context    : dma context id
 * vtbl_lock      : Mutex used to lock the bind table
 * bind_vtbl      : Table with registered bind ops for external sync (bind)
 * client_list    : All the synx clients
 * debugfs_root   : Root directory for debugfs
@@ -218,6 +219,7 @@ struct synx_device {
	struct idr synx_ids;
	spinlock_t idr_lock;
	u64 dma_context;
	struct mutex vtbl_lock;
	struct synx_registered_ops bind_vtbl[SYNX_MAX_BIND_TYPES];
	struct list_head client_list;
	struct dentry *debugfs_root;
+3 −3
Original line number Diff line number Diff line
@@ -739,14 +739,14 @@ struct bind_operations *synx_get_bind_ops(u32 type)
	if (!is_valid_type(type))
		return NULL;

	mutex_lock(&synx_dev->table_lock);
	mutex_lock(&synx_dev->vtbl_lock);
	client_ops = &synx_dev->bind_vtbl[type];
	if (!client_ops->valid) {
		mutex_unlock(&synx_dev->table_lock);
		mutex_unlock(&synx_dev->vtbl_lock);
		return NULL;
	}
	pr_debug("found bind ops for %s\n", client_ops->name);
	mutex_unlock(&synx_dev->table_lock);
	mutex_unlock(&synx_dev->vtbl_lock);

	return &client_ops->ops;
}