lkml.org 
[lkml]   [2009]   [Jun]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/4] dma-debug: add variables and checks for driver filter
On Thu, 28 May 2009 17:19:28 +0200
Joerg Roedel <joerg.roedel@amd.com> wrote:

> This patch adds the state variables for the driver filter and a function
> to check if the filter is enabled and matches to the current device. The
> check is built into the err_printk function.
>

The path by which lib/dma-debug.c patches get into mainline seems to
be largely random. Is it a dwmw2 tree? An Ingo tree? A Joerg tree? -mm?


> @@ -128,9 +137,47 @@ static inline void dump_entry_trace(struct dma_debug_entry *entry)
> #endif
> }
>
> +static inline bool driver_filter(struct device *dev)
> +{
> + /* driver filter off */
> + if (likely(!current_driver_name[0]))
> + return true;
> +
> + /* driver filter on and initialized */
> + if (current_driver && dev->driver == current_driver)
> + return true;
> +
> + /* driver filter on but not yet initialized */
> + if (!current_driver && current_driver_name[0]) {
> + struct device_driver *drv = get_driver(dev->driver);
> + unsigned long flags;
> + bool ret = false;
> +
> + if (!drv)
> + return false;
> +
> + /* lock to protect against change of current_driver_name */
> + read_lock_irqsave(&driver_name_lock, flags);
> +
> + if (drv->name &&
> + strncmp(current_driver_name, drv->name, 63) == 0) {
> + current_driver = drv;
> + ret = true;
> + }
> +
> + read_unlock_irqrestore(&driver_name_lock, flags);
> + put_driver(drv);
> +
> + return ret;
> + }
> +
> + return false;
> +}
> +
> #define err_printk(dev, entry, format, arg...) do { \
> error_count += 1; \
> - if (show_all_errors || show_num_errors > 0) { \
> + if (driver_filter(dev) && \
> + (show_all_errors || show_num_errors > 0)) { \
> WARN(1, "%s %s: " format, \
> dev_driver_string(dev), \
> dev_name(dev) , ## arg); \

The patch attempts to inline the very large driver_filter() into every
err_printk() callsite. That's not at all desirable!



\
 
 \ /
  Last update: 2009-06-02 00:03    [from the cache]
©2003-2011 Jasper Spaans