rpm-smd: Remove redundant spinlocks which are not required

As rpmsg takes care of locking when sending data, this patch
removes the redundant locking by removing the smd_write spinlock.

Also this patch reverts the 'commit 808861b856d1 ("drivers: rpmsg:
fix to avoid dump stack in rpm-smd driver")' which is not required
after removing extra spinlocks.

It removes the unsed smd_read spinlock aswell.

Change-Id: I7b15d19add2c4da876aa127be233331b58d3c8ae
Signed-off-by: Raghavendra Kakarla <rkakarla@codeaurora.org>
This commit is contained in:
Raghavendra Kakarla 2020-05-22 21:52:48 +05:30 committed by Raghavendra Kakarla
parent 0609fc4d66
commit 5701c02136

View File

@ -99,8 +99,6 @@ struct msm_rpm_driver_data {
uint32_t ch_type;
struct smd_channel *ch_info;
struct work_struct work;
spinlock_t smd_lock_write;
spinlock_t smd_lock_read;
struct completion smd_open;
};
@ -201,7 +199,6 @@ enum rpm_msg_fmts {
};
static struct rb_root tr_root = RB_ROOT;
static int msm_rpm_send_smd_buffer(char *buf, uint32_t size);
static uint32_t msm_rpm_get_next_msg_id(void);
static inline uint32_t get_offset_value(uint32_t val, uint32_t offset,
@ -718,8 +715,8 @@ static int msm_rpm_flush_requests(void)
set_msg_id(s->buf, msm_rpm_get_next_msg_id());
ret = msm_rpm_send_smd_buffer(s->buf,
get_buf_len(s->buf));
ret = rpmsg_send(rpm->rpm_channel, s->buf, get_buf_len(s->buf));
WARN_ON(ret != 0);
trace_rpm_smd_send_sleep_set(get_msg_id(s->buf), type, id);
@ -1168,17 +1165,6 @@ static void msm_rpm_log_request(struct msm_rpm_request *cdata)
pr_info("request info %s\n", buf);
}
static int msm_rpm_send_smd_buffer(char *buf, uint32_t size)
{
unsigned long flags;
int ret;
spin_lock_irqsave(&msm_rpm_data.smd_lock_write, flags);
ret = rpmsg_send(rpm->rpm_channel, buf, size);
spin_unlock_irqrestore(&msm_rpm_data.smd_lock_write, flags);
return ret;
}
static int msm_rpm_send_data(struct msm_rpm_request *cdata,
int msg_type, bool noack)
{
@ -1269,7 +1255,7 @@ static int msm_rpm_send_data(struct msm_rpm_request *cdata,
msm_rpm_add_wait_list(msg_id, noack);
ret = msm_rpm_send_smd_buffer(&cdata->buf[0], msg_size);
ret = rpmsg_send(rpm->rpm_channel, &cdata->buf[0], msg_size);
if (!ret) {
for (i = 0; (i < cdata->write_idx); i++)
@ -1647,8 +1633,6 @@ static int qcom_smd_rpm_probe(struct rpmsg_device *rpdev)
mutex_init(&rpm->lock);
init_completion(&rpm->ack);
spin_lock_init(&msm_rpm_data.smd_lock_write);
spin_lock_init(&msm_rpm_data.smd_lock_read);
probe_status = 0;
fail: