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

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

Merge "mmc: core: Add IPC logging for mmc"

parents 1be549fd 38fc8df2
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -597,6 +597,13 @@ int mmc_add_host(struct mmc_host *host)
	mmc_add_host_debugfs(host);
#endif

#ifdef CONFIG_MMC_IPC_LOGGING
	host->ipc_log_ctxt = ipc_log_context_create(NUM_LOG_PAGES,
					dev_name(&host->class_dev), 0);
	if (!host->ipc_log_ctxt)
		pr_err("%s: Error getting ipc_log_ctxt\n", __func__);
#endif

	err = sysfs_create_group(&host->class_dev.kobj, &clk_scaling_attr_grp);
	if (err)
		pr_err("%s: failed to create clk scale sysfs group with err %d\n",
@@ -628,6 +635,11 @@ void mmc_remove_host(struct mmc_host *host)
#ifdef CONFIG_DEBUG_FS
	mmc_remove_host_debugfs(host);
#endif

#ifdef CONFIG_MMC_IPC_LOGGING
	ipc_log_context_destroy(host->ipc_log_ctxt);
	host->ipc_log_ctxt = NULL;
#endif
	sysfs_remove_group(&host->class_dev.kobj, &clk_scaling_attr_grp);

	device_del(&host->class_dev);
+17 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@
#include <linux/fault-inject.h>
#include <linux/blkdev.h>
#include <linux/extcon.h>
#include <linux/ipc_logging.h>

#include <linux/mmc/core.h>
#include <linux/mmc/card.h>
@@ -618,6 +619,11 @@ struct mmc_host {
	} perf;
	bool perf_enable;
#endif

#ifdef CONFIG_MMC_IPC_LOGGING
	void *ipc_log_ctxt;
	bool stop_tracing;
#endif
	enum dev_state dev_status;
	bool inlinecrypt_support;  /* Inline encryption support */
	bool crash_on_err;	/* crash the system on error */
@@ -635,6 +641,17 @@ void mmc_free_host(struct mmc_host *);
int mmc_of_parse(struct mmc_host *host);
int mmc_of_parse_voltage(struct device_node *np, u32 *mask);

#ifdef CONFIG_MMC_IPC_LOGGING
#define NUM_LOG_PAGES	10
#define mmc_log_string(mmc_host, fmt, ...)	do {	\
	if ((mmc_host)->ipc_log_ctxt && !(mmc_host)->stop_tracing)	\
		ipc_log_string((mmc_host)->ipc_log_ctxt,	\
			"%s: " fmt, __func__, ##__VA_ARGS__);	\
	} while (0)
#else
#define mmc_log_string(mmc_host, fmt, ...)	do { } while (0)
#endif

static inline void *mmc_priv(struct mmc_host *host)
{
	return (void *)host->private;