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

Commit 0bf84128 authored by Joerg Roedel's avatar Joerg Roedel
Browse files

dma-debug: simplify logic in driver_filter()



This patch makes the driver_filter function more readable by
reorganizing the code. The removal of a code code block to an upper
indentation level makes hard-to-read line-wraps unnecessary.

Signed-off-by: default avatarJoerg Roedel <joerg.roedel@amd.com>
parent be81c6ea
Loading
Loading
Loading
Loading
+21 −21
Original line number Original line Diff line number Diff line
@@ -147,6 +147,10 @@ static inline void dump_entry_trace(struct dma_debug_entry *entry)


static bool driver_filter(struct device *dev)
static bool driver_filter(struct device *dev)
{
{
	struct device_driver *drv;
	unsigned long flags;
	bool ret;

	/* driver filter off */
	/* driver filter off */
	if (likely(!current_driver_name[0]))
	if (likely(!current_driver_name[0]))
		return true;
		return true;
@@ -155,21 +159,20 @@ static bool driver_filter(struct device *dev)
	if (current_driver && dev->driver == current_driver)
	if (current_driver && dev->driver == current_driver)
		return true;
		return true;


	/* driver filter on but not yet initialized */
	if (current_driver || !current_driver_name[0])
	if (!current_driver && current_driver_name[0]) {
		return false;
		struct device_driver *drv = get_driver(dev->driver);
		unsigned long flags;
		bool ret = false;


	/* driver filter on but not yet initialized */
	drv = get_driver(dev->driver);
	if (!drv)
	if (!drv)
		return false;
		return false;


	/* lock to protect against change of current_driver_name */
	/* lock to protect against change of current_driver_name */
	read_lock_irqsave(&driver_name_lock, flags);
	read_lock_irqsave(&driver_name_lock, flags);


	ret = false;
	if (drv->name &&
	if (drv->name &&
		    strncmp(current_driver_name, drv->name,
	    strncmp(current_driver_name, drv->name, NAME_MAX_LEN - 1) == 0) {
			    NAME_MAX_LEN-1) == 0) {
		current_driver = drv;
		current_driver = drv;
		ret = true;
		ret = true;
	}
	}
@@ -180,9 +183,6 @@ static bool driver_filter(struct device *dev)
	return ret;
	return ret;
}
}


	return false;
}

#define err_printk(dev, entry, format, arg...) do {		\
#define err_printk(dev, entry, format, arg...) do {		\
		error_count += 1;				\
		error_count += 1;				\
		if (driver_filter(dev) &&			\
		if (driver_filter(dev) &&			\