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

Commit 7fc2a456 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: smp2p: Fix init ordering problem"

parents 71a45015 9a548525
Loading
Loading
Loading
Loading
+57 −1
Original line number Diff line number Diff line
/* arch/arm/mach-msm/smp2p.c
 *
 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2014, 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
@@ -1141,6 +1141,13 @@ int msm_smp2p_out_open(int remote_pid, const char *name,
	if (remote_pid >= SMP2P_NUM_PROCS || !name || !open_notifier || !handle)
		return -EINVAL;

	if ((remote_pid != SMP2P_REMOTE_MOCK_PROC) &&
			!smp2p_int_cfgs[remote_pid].is_configured) {
		SMP2P_INFO("%s before msm_smp2p_init(): pid[%d] name[%s]\n",
						__func__, remote_pid, name);
		return -EPROBE_DEFER;
	}

	/* Allocate the smp2p object and node */
	out_entry = kzalloc(sizeof(*out_entry), GFP_KERNEL);
	if (!out_entry)
@@ -1211,6 +1218,13 @@ int msm_smp2p_out_close(struct msm_smp2p_out **handle)
	out_entry = *handle;
	*handle = NULL;

	if ((out_entry->remote_pid != SMP2P_REMOTE_MOCK_PROC) &&
			!smp2p_int_cfgs[out_entry->remote_pid].is_configured) {
		SMP2P_INFO("%s before msm_smp2p_init(): pid[%d] name[%s]\n",
			__func__, out_entry->remote_pid, out_entry->name);
		return -EPROBE_DEFER;
	}

	out_item = &out_list[out_entry->remote_pid];
	spin_lock_irqsave(&out_item->out_item_lock_lha1, flags);
	list_del(&out_entry->out_edge_list);
@@ -1243,6 +1257,13 @@ int msm_smp2p_out_read(struct msm_smp2p_out *handle, uint32_t *data)
	if (!handle || !data)
		return ret;

	if ((handle->remote_pid != SMP2P_REMOTE_MOCK_PROC) &&
			!smp2p_int_cfgs[handle->remote_pid].is_configured) {
		SMP2P_INFO("%s before msm_smp2p_init(): pid[%d] name[%s]\n",
			__func__, handle->remote_pid, handle->name);
		return -EPROBE_DEFER;
	}

	out_item = &out_list[handle->remote_pid];
	spin_lock_irqsave(&out_item->out_item_lock_lha1, flags);
	ret = out_item->ops_ptr->read_entry(handle, data);
@@ -1274,6 +1295,13 @@ int msm_smp2p_out_write(struct msm_smp2p_out *handle, uint32_t data)
	if (!handle)
		return ret;

	if ((handle->remote_pid != SMP2P_REMOTE_MOCK_PROC) &&
			!smp2p_int_cfgs[handle->remote_pid].is_configured) {
		SMP2P_INFO("%s before msm_smp2p_init(): pid[%d] name[%s]\n",
			__func__, handle->remote_pid, handle->name);
		return -EPROBE_DEFER;
	}

	out_item = &out_list[handle->remote_pid];
	spin_lock_irqsave(&out_item->out_item_lock_lha1, flags);
	ret = out_item->ops_ptr->write_entry(handle, data);
@@ -1311,6 +1339,13 @@ int msm_smp2p_out_modify(struct msm_smp2p_out *handle, uint32_t set_mask,
	if (!handle)
		return ret;

	if ((handle->remote_pid != SMP2P_REMOTE_MOCK_PROC) &&
			!smp2p_int_cfgs[handle->remote_pid].is_configured) {
		SMP2P_INFO("%s before msm_smp2p_init(): pid[%d] name[%s]\n",
			__func__, handle->remote_pid, handle->name);
		return -EPROBE_DEFER;
	}

	out_item = &out_list[handle->remote_pid];
	spin_lock_irqsave(&out_item->out_item_lock_lha1, flags);
	ret = out_item->ops_ptr->modify_entry(handle, set_mask, clear_mask);
@@ -1337,6 +1372,13 @@ int msm_smp2p_in_read(int remote_pid, const char *name, uint32_t *data)
	if (remote_pid >= SMP2P_NUM_PROCS)
		return -EINVAL;

	if ((remote_pid != SMP2P_REMOTE_MOCK_PROC) &&
			!smp2p_int_cfgs[remote_pid].is_configured) {
		SMP2P_INFO("%s before msm_smp2p_init(): pid[%d] name[%s]\n",
						__func__, remote_pid, name);
		return -EPROBE_DEFER;
	}

	out_item = &out_list[remote_pid];
	spin_lock_irqsave(&out_item->out_item_lock_lha1, flags);
	spin_lock(&in_list[remote_pid].in_item_lock_lhb1);
@@ -1386,6 +1428,13 @@ int msm_smp2p_in_register(int pid, const char *name,
	if (pid >= SMP2P_NUM_PROCS || !name || !in_notifier)
		return -EINVAL;

	if ((pid != SMP2P_REMOTE_MOCK_PROC) &&
			!smp2p_int_cfgs[pid].is_configured) {
		SMP2P_INFO("%s before msm_smp2p_init(): pid[%d] name[%s]\n",
						__func__, pid, name);
		return -EPROBE_DEFER;
	}

	/* Pre-allocate before spinlock since we will likely needed it */
	in = kzalloc(sizeof(*in), GFP_KERNEL);
	if (!in)
@@ -1468,6 +1517,13 @@ int msm_smp2p_in_unregister(int remote_pid, const char *name,
	if (remote_pid >= SMP2P_NUM_PROCS || !name || !in_notifier)
		return -EINVAL;

	if ((remote_pid != SMP2P_REMOTE_MOCK_PROC) &&
			!smp2p_int_cfgs[remote_pid].is_configured) {
		SMP2P_INFO("%s before msm_smp2p_init(): pid[%d] name[%s]\n",
						__func__, remote_pid, name);
		return -EPROBE_DEFER;
	}

	spin_lock_irqsave(&in_list[remote_pid].in_item_lock_lhb1, flags);
	list_for_each_entry(pos, &in_list[remote_pid].list,
			in_edge_list) {
+7 −3
Original line number Diff line number Diff line
/* arch/arm/mach-msm/smp2p_gpio.c
 *
 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2014, 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
@@ -608,7 +608,7 @@ static int smp2p_gpio_probe(struct platform_device *pdev)
					   &chip->out_notifier,
					   &chip->out_handle);
			if (ret < 0)
				goto fail;
				goto error;
		}
	} else {
		chip->in_notifier.notifier_call = smp2p_gpio_in_notify;
@@ -617,7 +617,7 @@ static int smp2p_gpio_probe(struct platform_device *pdev)
					chip->name,
					&chip->in_notifier);
			if (ret < 0)
				goto fail;
				goto error;
		}
	}

@@ -642,6 +642,10 @@ static int smp2p_gpio_probe(struct platform_device *pdev)
			chip->gpio.base, chip->irq_base);

	return 0;
error:
	if (gpiochip_remove(&chip->gpio))
		SMP2P_ERR("%s: unable to Remove GPIO '%s'\n",
				__func__, chip->name);

fail:
	kfree(chip);
+10 −1
Original line number Diff line number Diff line
/* arch/arm/mach-msm/smp2p_loopback.c
 *
 * Copyright (c) 2013, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2014, 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
@@ -414,6 +414,7 @@ static void smp2p_remote_mock_tx_interrupt(void)
static int __init smp2p_remote_mock_init(void)
{
	int i;
	struct smp2p_interrupt_config *int_cfg;

	smp2p_init_header(&remote_mock.remote_item.header,
			SMP2P_REMOTE_MOCK_PROC, SMP2P_APPS_PROC,
@@ -432,6 +433,14 @@ static int __init smp2p_remote_mock_init(void)
			/* do not register loopback for remote mock proc */
			continue;

		int_cfg = smp2p_get_interrupt_config();
		if (!int_cfg) {
			SMP2P_ERR("Remote processor config unavailable\n");
			return 0;
		}
		if (!int_cfg[i].is_configured)
			continue;

		msm_smp2p_init_rmt_lpb(&remote_loopback[i],
			i, SMP2P_RLPB_ENTRY_NAME);
	}