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

Commit 83b94d2c authored by Jeff Hugo's avatar Jeff Hugo Committed by Gerrit - the friendly Code Review server
Browse files

msm: smp2p: Test SMEM availability before probe completes



SMP2P depends on the SMEM driver and requires it to be in a ready state
before SMP2P can provide service to clients.  As a result, SMP2P should
check the state of SMEM before declaring SMP2P is ready.

Check the state of SMEM in the SMP2P probe, and appropriately handle cases
where SMEM is not ready at the time of the check.

Change-Id: I47913a36e58b4a7c922d1133e58249deb4f1796a
Signed-off-by: default avatarJeffrey Hugo <jhugo@codeaurora.org>
parent d474ce20
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
#include <linux/platform_device.h>
#include <linux/interrupt.h>
#include <linux/ipc_logging.h>
#include <linux/err.h>
#include <soc/qcom/smem.h>
#include "smp2p_private_api.h"
#include "smp2p_private.h"
@@ -1788,6 +1789,8 @@ static int msm_smp2p_probe(struct platform_device *pdev)
	struct device_node *node;
	uint32_t irq_bitmask;
	uint32_t irq_line;
	void *temp_p;
	unsigned temp_sz;

	node = pdev->dev.of_node;

@@ -1824,6 +1827,23 @@ static int msm_smp2p_probe(struct platform_device *pdev)
	if (irq_line == -ENXIO)
		goto missing_key;

	/*
	 * We depend on the SMEM driver, so do a test access to see if SMEM is
	 * ready.  We don't want any side effects at this time (so no alloc)
	 * and the return doesn't matter, so long as it is not -EPROBE_DEFER.
	 */
	temp_p = smem_get_entry(
		smp2p_get_smem_item_id(SMP2P_APPS_PROC, SMP2P_MODEM_PROC),
		&temp_sz,
		0,
		SMEM_ANY_HOST_FLAG);
	if (PTR_ERR(temp_p) == -EPROBE_DEFER) {
		SMP2P_INFO("%s: edge:%d probe before smem ready\n", __func__,
									edge);
		ret = -EPROBE_DEFER;
		goto fail;
	}

	ret = request_irq(irq_line, smp2p_interrupt_handler,
			IRQF_TRIGGER_RISING, "smp2p", (void *)(uintptr_t)edge);
	if (ret < 0) {