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

Commit b5b0f71f authored by Jeff Hugo's avatar Jeff Hugo
Browse files

msm: smp2p: Use seq_puts() where possible



Seq_puts() is preferred over seq_printf() for constant strings that do not
need printf type evaluation.

Change seq_printf() usage to seq_puts() where possible.

Change-Id: I83f87a2f0417f2e0a5b826b857ad9b8c6d7ec68f
Signed-off-by: default avatarJeffrey Hugo <jhugo@codeaurora.org>
parent 912b94f9
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
/* arch/arm/mach-msm/smp2p_debug.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
@@ -32,16 +32,15 @@ static void smp2p_int_stats(struct seq_file *s)
	if (!int_cfg)
		return;

	seq_printf(s, "| Processor | Incoming Id | Incoming # |");
	seq_printf(s, " Outgoing # | Base Ptr |   Mask   |\n");
	seq_puts(s, "| Processor | Incoming Id | Incoming # |");
	seq_puts(s, " Outgoing # | Base Ptr |   Mask   |\n");

	for (pid = 0; pid < SMP2P_NUM_PROCS; ++pid) {
		if (!int_cfg[pid].is_configured &&
				pid != SMP2P_REMOTE_MOCK_PROC)
			continue;

		seq_printf(s,
			"| %5s (%d) | %11u | %10u | %10u | %p | %08x |\n",
		seq_printf(s, "| %5s (%d) | %11u | %10u | %10u | %p | %08x |\n",
			int_cfg[pid].name,
			pid, int_cfg[pid].in_int_id,
			int_cfg[pid].in_interrupt_count,
+14 −14
Original line number Diff line number Diff line
/* arch/arm/mach-msm/smp2p_gpio_test.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
@@ -204,12 +204,12 @@ static void smp2p_ut_local_gpio_out(struct seq_file *s)
		if (failed)
			break;

		seq_printf(s, "\tOK\n");
		seq_puts(s, "\tOK\n");
	} while (0);

	if (failed) {
		pr_err("%s: Failed\n", __func__);
		seq_printf(s, "\tFailed\n");
		seq_puts(s, "\tFailed\n");
	}

	smp2p_gpio_open_test_entry("smp2p",
@@ -389,12 +389,12 @@ static void smp2p_ut_local_gpio_in(struct seq_file *s)
		if (failed)
			break;

		seq_printf(s, "\tOK\n");
		seq_puts(s, "\tOK\n");
	} while (0);

	if (failed) {
		pr_err("%s: Failed\n", __func__);
		seq_printf(s, "\tFailed\n");
		seq_puts(s, "\tFailed\n");
	}

	/* unregister for interrupts */
@@ -478,18 +478,18 @@ static void smp2p_ut_local_gpio_in_update_open(struct seq_file *s)
			if (0x1 & (0xDEADDEAD >> id)) {
				/* rising edge should have been triggered */
				if (!test_bit(id, cb_info->triggered_irqs)) {
					seq_printf(s,
						"%s:%d bit %d clear, expected set\n",
					seq_printf(s, "%s:%d bit %d clear, ",
						__func__, __LINE__, id);
					seq_puts(s, "expected set\n");
					failed = 1;
					break;
				}
			} else {
				/* edge should not have been triggered */
				if (test_bit(id, cb_info->triggered_irqs)) {
					seq_printf(s,
						"%s:%d bit %d set, expected clear\n",
					seq_printf(s, "%s:%d bit %d set, ",
						__func__, __LINE__, id);
					seq_puts(s, "expected clear\n");
					failed = 1;
					break;
				}
@@ -498,12 +498,12 @@ static void smp2p_ut_local_gpio_in_update_open(struct seq_file *s)
		if (failed)
			break;

		seq_printf(s, "\tOK\n");
		seq_puts(s, "\tOK\n");
	} while (0);

	if (failed) {
		pr_err("%s: Failed\n", __func__);
		seq_printf(s, "\tFailed\n");
		seq_puts(s, "\tFailed\n");
	}

	/* unregister for interrupts */
@@ -664,12 +664,12 @@ static void smp2p_ut_remote_inout_core(struct seq_file *s, int remote_pid,
		UT_ASSERT_HEX(request, ==, response);
		UT_ASSERT_INT(24, ==, cb_in->cb_count);

		seq_printf(s, "\tOK\n");
		seq_puts(s, "\tOK\n");
	} while (0);

	if (failed) {
		pr_err("%s: Failed\n", name);
		seq_printf(s, "\tFailed\n");
		seq_puts(s, "\tFailed\n");
	}

	/* unregister for interrupts */
@@ -697,7 +697,7 @@ static void smp2p_ut_remote_inout(struct seq_file *s)

	int_cfg = smp2p_get_interrupt_config();
	if (!int_cfg) {
		seq_printf(s, "Remote processor config unavailable\n");
		seq_puts(s, "Remote processor config unavailable\n");
		return;
	}

+23 −22
Original line number Diff line number Diff line
/* arch/arm/mach-msm/smp2p_spinlock_test.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
@@ -141,9 +141,9 @@ static void smp2p_ut_remote_spinlock_core(struct seq_file *s, int remote_pid,

		/* Run spinlock test */
		if (use_trylock)
			seq_printf(s, "\tUsing remote_spin_trylock\n");
			seq_puts(s, "\tUsing remote_spin_trylock\n");
		else
			seq_printf(s, "\tUsing remote_spin_lock\n");
			seq_puts(s, "\tUsing remote_spin_lock\n");

		flags = 0;
		have_lock = false;
@@ -152,10 +152,12 @@ static void smp2p_ut_remote_spinlock_core(struct seq_file *s, int remote_pid,
		test_request = 0x0;
		SMP2P_SET_RMT_CMD_TYPE_REQ(test_request);
		end = jiffies + (ut_remote_spinlock_run_time * HZ);
		if (ut_remote_spinlock_run_time < 300)
				seq_printf(s,
					"\tRunning test for %u seconds; on physical hardware please run >= 300 seconds by doing 'echo 300 >  ut_remote_spinlock_time'\n",
		if (ut_remote_spinlock_run_time < 300) {
				seq_printf(s, "\tRunning test for %u seconds; ",
					ut_remote_spinlock_run_time);
				seq_puts(s,
					"on physical hardware please run >= 300 seconds by doing 'echo 300 >  ut_remote_spinlock_time'\n");
		}
		while (time_is_after_jiffies(end)) {
			/* try to acquire spinlock */
			if (use_trylock) {
@@ -164,7 +166,7 @@ static void smp2p_ut_remote_spinlock_core(struct seq_file *s, int remote_pid,
						smem_spinlock, flags)) {
					if (jiffies_to_msecs(jiffies - j_start)
							> 1000) {
						seq_printf(s,
						seq_puts(s,
							"\tFail: Timeout trying to get the lock\n");
						timeout = true;
						break;
@@ -191,8 +193,8 @@ static void smp2p_ut_remote_spinlock_core(struct seq_file *s, int remote_pid,
					remote_spin_owner(smem_spinlock);
				if (spinlock_owner != REMOTE_SPIN_PID) {
					/* lock stolen by remote side */
					seq_printf(s,
						"\tFail: Remote side (%d) stole lock (pid %d)\n",
					seq_puts(s, "\tFail: Remote side: ");
					seq_printf(s, "%d stole lock pid: %d\n",
						remote_pid, spinlock_owner);
					failed = true;
					break;
@@ -246,20 +248,20 @@ static void smp2p_ut_remote_spinlock_core(struct seq_file *s, int remote_pid,
		failed = failed_tmp;

		test_response = SMP2P_GET_RMT_DATA(test_response);
		seq_printf(s,
			"\tLocked spinlock local %u times; remote %u times",
		seq_puts(s, "\tLocked spinlock ");
		seq_printf(s, "local %u times; remote %u times",
			lock_count,
			test_response & ((1 << RS_END_THIEF_PID_BIT) - 1)
			);
		if (test_response & RS_END_THIEF_MASK) {
			seq_printf(s,
				"Remote side reporting lock stolen by pid %d.\n",
			seq_puts(s, "Remote side reporting lock stolen by ");
			seq_printf(s, "pid %d.\n",
				SMP2P_GET_BITS(test_response,
					RS_END_THIEF_MASK,
					RS_END_THIEF_PID_BIT));
			failed = 1;
		}
		seq_printf(s, "\n");
		seq_puts(s, "\n");

		/* Cleanup */
		ret = msm_smp2p_out_close(&handle);
@@ -270,7 +272,7 @@ static void smp2p_ut_remote_spinlock_core(struct seq_file *s, int remote_pid,
		UT_ASSERT_INT(ret, ==, 0);

		if (!failed && !timeout)
			seq_printf(s, "\tOK\n");
			seq_puts(s, "\tOK\n");
	} while (0);

	if (failed) {
@@ -286,7 +288,7 @@ static void smp2p_ut_remote_spinlock_core(struct seq_file *s, int remote_pid,
				SMP2P_RLPB_ENTRY_NAME, &cb_in.nb);

		pr_err("%s: Failed\n", __func__);
		seq_printf(s, "\tFailed\n");
		seq_puts(s, "\tFailed\n");
	}
}

@@ -305,7 +307,7 @@ static void smp2p_ut_remote_spinlock_pid(struct seq_file *s, int pid,

	int_cfg = smp2p_get_interrupt_config();
	if (!int_cfg) {
		seq_printf(s, "Remote processor config unavailable\n");
		seq_puts(s, "Remote processor config unavailable\n");
		return;
	}

@@ -397,7 +399,7 @@ static void smp2p_ut_remote_spinlock_rpm(struct seq_file *s)
		writel_relaxed(0, &data_ptr->apps_lock_count);
		writel_relaxed(RPM_CMD_START, &data_ptr->apps_cmd);

		seq_printf(s, "\tWaiting for RPM to start test\n");
		seq_puts(s, "\tWaiting for RPM to start test\n");
		for (n = 0; n < 1000; ++n) {
			if (readl_relaxed(&data_ptr->rpm_cmd) !=
					RPM_CMD_INVALID)
@@ -449,18 +451,17 @@ static void smp2p_ut_remote_spinlock_rpm(struct seq_file *s)

		/* End test */
		writel_relaxed(RPM_CMD_INVALID, &data_ptr->apps_cmd);
		seq_printf(s,
				"\tLocked spinlock local %u remote %u\n",
		seq_printf(s, "\tLocked spinlock local %u remote %u\n",
				readl_relaxed(&data_ptr->apps_lock_count),
				readl_relaxed(&data_ptr->rpm_lock_count));

		if (!failed)
			seq_printf(s, "\tOK\n");
			seq_puts(s, "\tOK\n");
	} while (0);

	if (failed) {
		pr_err("%s: Failed\n", __func__);
		seq_printf(s, "\tFailed\n");
		seq_puts(s, "\tFailed\n");
	}
}

+19 −21
Original line number Diff line number Diff line
/* arch/arm/mach-msm/smp2p_test.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
@@ -106,12 +106,12 @@ static void smp2p_ut_local_basic(struct seq_file *s)
		UT_ASSERT_INT(ret, ==, 0);
		UT_ASSERT_PTR(smp2p_obj, ==, 0);

		seq_printf(s, "\tOK\n");
		seq_puts(s, "\tOK\n");
	} while (0);

	if (failed) {
		pr_err("%s: Failed\n", __func__);
		seq_printf(s, "\tFailed\n");
		seq_puts(s, "\tFailed\n");
		(void)msm_smp2p_out_close(&smp2p_obj);
	}
}
@@ -195,12 +195,12 @@ static void smp2p_ut_local_late_open(struct seq_file *s)
		UT_ASSERT_INT(ret, ==, 0);
		UT_ASSERT_PTR(smp2p_obj, ==, 0);

		seq_printf(s, "\tOK\n");
		seq_puts(s, "\tOK\n");
	} while (0);

	if (failed) {
		pr_err("%s: Failed\n", __func__);
		seq_printf(s, "\tFailed\n");
		seq_puts(s, "\tFailed\n");
		(void)msm_smp2p_out_close(&smp2p_obj);
	}
}
@@ -316,12 +316,12 @@ static void smp2p_ut_local_early_open(struct seq_file *s)
		UT_ASSERT_INT(ret, ==, 0);
		UT_ASSERT_PTR(smp2p_obj, ==, 0);

		seq_printf(s, "\tOK\n");
		seq_puts(s, "\tOK\n");
	} while (0);

	if (failed) {
		pr_err("%s: Failed\n", __func__);
		seq_printf(s, "\tFailed\n");
		seq_puts(s, "\tFailed\n");
		(void)msm_smp2p_out_close(&smp2p_obj);
	}
}
@@ -455,12 +455,12 @@ static void smp2p_ut_mock_loopback(struct seq_file *s)

		ret = msm_smp2p_deinit_rmt_lpb_proc(SMP2P_REMOTE_MOCK_PROC);
		UT_ASSERT_INT(ret, ==, 0);
		seq_printf(s, "\tOK\n");
		seq_puts(s, "\tOK\n");
	} while (0);

	if (failed) {
		pr_err("%s: Failed\n", __func__);
		seq_printf(s, "\tFailed\n");
		seq_puts(s, "\tFailed\n");
		msm_smp2p_deinit_rmt_lpb_proc(SMP2P_REMOTE_MOCK_PROC);
	}
}
@@ -613,7 +613,7 @@ static void smp2p_ut_remote_inout_core(struct seq_file *s, int remote_pid)
		ret = msm_smp2p_in_unregister(remote_pid, "smp2p", &cb_in.nb);
		UT_ASSERT_INT(ret, ==, 0);

		seq_printf(s, "\tOK\n");
		seq_puts(s, "\tOK\n");
	} while (0);

	if (failed) {
@@ -622,7 +622,7 @@ static void smp2p_ut_remote_inout_core(struct seq_file *s, int remote_pid)
		(void)msm_smp2p_in_unregister(remote_pid, "smp2p", &cb_in.nb);

		pr_err("%s: Failed\n", __func__);
		seq_printf(s, "\tFailed\n");
		seq_puts(s, "\tFailed\n");
	}
}

@@ -641,8 +641,7 @@ static void smp2p_ut_remote_inout(struct seq_file *s)

	int_cfg = smp2p_get_interrupt_config();
	if (!int_cfg) {
		seq_printf(s,
			"Remote processor config unavailable\n");
		seq_puts(s, "Remote processor config unavailable\n");
		return;
	}

@@ -704,12 +703,12 @@ static void smp2p_ut_remote_out_max_entries_core(struct seq_file *s,
		UT_ASSERT_INT(num_created, <=, SMP2P_MAX_ENTRY);
		UT_ASSERT_INT(num_created, >, 0);

		seq_printf(s, "\tOK\n");
		seq_puts(s, "\tOK\n");
	} while (0);

	if (failed) {
		pr_err("%s: Failed\n", __func__);
		seq_printf(s, "\tFailed\n");
		seq_puts(s, "\tFailed\n");
	}

	/* cleanup */
@@ -732,8 +731,7 @@ static void smp2p_ut_remote_out_max_entries(struct seq_file *s)

	int_cfg = smp2p_get_interrupt_config();
	if (!int_cfg) {
		seq_printf(s,
			"Remote processor config unavailable\n");
		seq_puts(s, "Remote processor config unavailable\n");
		return;
	}

@@ -830,12 +828,12 @@ static void smp2p_ut_local_in_max_entries(struct seq_file *s)
		}
		UT_ASSERT_INT(j, ==, SMP2P_MAX_ENTRY);

		seq_printf(s, "\tOK\n");
		seq_puts(s, "\tOK\n");
	} while (0);

	if (failed) {
		pr_err("%s: Failed\n", __func__);
		seq_printf(s, "\tFailed\n");
		seq_puts(s, "\tFailed\n");

		for (j = 0; j < SMP2P_MAX_ENTRY; j++)
			ret = msm_smp2p_in_unregister(SMP2P_REMOTE_MOCK_PROC,
@@ -937,12 +935,12 @@ static void smp2p_ut_local_in_multiple(struct seq_file *s)
				&(cb_in_2.nb));
		UT_ASSERT_INT(ret, ==, 0);

		seq_printf(s, "\tOK\n");
		seq_puts(s, "\tOK\n");
	} while (0);

	if (failed) {
		pr_err("%s: Failed\n", __func__);
		seq_printf(s, "\tFailed\n");
		seq_puts(s, "\tFailed\n");

		ret = msm_smp2p_in_unregister(SMP2P_REMOTE_MOCK_PROC,
				rmp->remote_item.entries[0].name,
+6 −11
Original line number Diff line number Diff line
/* arch/arm/mach-msm/smp2p_test_common.h
 *
 * 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
@@ -36,8 +36,7 @@
	int a_tmp = (a); \
	int b_tmp = (b); \
	if (!((a_tmp)cmp(b_tmp))) { \
		seq_printf(s, \
			"%s:%d Fail: " #a "(%d) " #cmp " " #b "(%d)\n", \
		seq_printf(s, "%s:%d Fail: " #a "(%d) " #cmp " " #b "(%d)\n", \
				__func__, __LINE__, \
				a_tmp, b_tmp); \
		failed = 1; \
@@ -50,8 +49,7 @@
	void *a_tmp = (a); \
	void *b_tmp = (b); \
	if (!((a_tmp)cmp(b_tmp))) { \
		seq_printf(s, \
			"%s:%d Fail: " #a "(%p) " #cmp " " #b "(%p)\n", \
		seq_printf(s, "%s:%d Fail: " #a "(%p) " #cmp " " #b "(%p)\n", \
				__func__, __LINE__, \
				a_tmp, b_tmp); \
		failed = 1; \
@@ -64,8 +62,7 @@
	unsigned a_tmp = (a); \
	unsigned b_tmp = (b); \
	if (!((a_tmp)cmp(b_tmp))) { \
		seq_printf(s, \
			"%s:%d Fail: " #a "(%u) " #cmp " " #b "(%u)\n", \
		seq_printf(s, "%s:%d Fail: " #a "(%u) " #cmp " " #b "(%u)\n", \
				__func__, __LINE__, \
				a_tmp, b_tmp); \
		failed = 1; \
@@ -78,8 +75,7 @@
	unsigned a_tmp = (a); \
	unsigned b_tmp = (b); \
	if (!((a_tmp)cmp(b_tmp))) { \
		seq_printf(s, \
			"%s:%d Fail: " #a "(%x) " #cmp " " #b "(%x)\n", \
		seq_printf(s, "%s:%d Fail: " #a "(%x) " #cmp " " #b "(%x)\n", \
				__func__, __LINE__, \
				a_tmp, b_tmp); \
		failed = 1; \
@@ -109,8 +105,7 @@
	int minv_tmp = (minv); \
	int maxv_tmp = (maxv); \
	if (((a_tmp) < (minv_tmp)) || ((a_tmp) > (maxv_tmp))) { \
		seq_printf(s, \
			"%s:%d Fail: " #a "(%d) < " #minv "(%d) or " \
		seq_printf(s, "%s:%d Fail: " #a "(%d) < " #minv "(%d) or " \
				 #a "(%d) > " #maxv "(%d)\n", \
				__func__, __LINE__, \
				a_tmp, minv_tmp, a_tmp, maxv_tmp); \