aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/dma-debug.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/lib/dma-debug.c b/lib/dma-debug.c
index 27b369da52c0..ad65fc0317d9 100644
--- a/lib/dma-debug.c
+++ b/lib/dma-debug.c
@@ -147,6 +147,10 @@ static inline void dump_entry_trace(struct dma_debug_entry *entry)
147 147
148static bool driver_filter(struct device *dev) 148static bool driver_filter(struct device *dev)
149{ 149{
150 struct device_driver *drv;
151 unsigned long flags;
152 bool ret;
153
150 /* driver filter off */ 154 /* driver filter off */
151 if (likely(!current_driver_name[0])) 155 if (likely(!current_driver_name[0]))
152 return true; 156 return true;
@@ -155,32 +159,28 @@ static bool driver_filter(struct device *dev)
155 if (current_driver && dev->driver == current_driver) 159 if (current_driver && dev->driver == current_driver)
156 return true; 160 return true;
157 161
158 /* driver filter on but not yet initialized */ 162 if (current_driver || !current_driver_name[0])
159 if (!current_driver && current_driver_name[0]) { 163 return false;
160 struct device_driver *drv = get_driver(dev->driver);
161 unsigned long flags;
162 bool ret = false;
163
164 if (!drv)
165 return false;
166
167 /* lock to protect against change of current_driver_name */
168 read_lock_irqsave(&driver_name_lock, flags);
169 164
170 if (drv->name && 165 /* driver filter on but not yet initialized */
171 strncmp(current_driver_name, drv->name, 166 drv = get_driver(dev->driver);
172 NAME_MAX_LEN-1) == 0) { 167 if (!drv)
173 current_driver = drv; 168 return false;
174 ret = true;
175 }
176 169
177 read_unlock_irqrestore(&driver_name_lock, flags); 170 /* lock to protect against change of current_driver_name */
178 put_driver(drv); 171 read_lock_irqsave(&driver_name_lock, flags);
179 172
180 return ret; 173 ret = false;
174 if (drv->name &&
175 strncmp(current_driver_name, drv->name, NAME_MAX_LEN - 1) == 0) {
176 current_driver = drv;
177 ret = true;
181 } 178 }
182 179
183 return false; 180 read_unlock_irqrestore(&driver_name_lock, flags);
181 put_driver(drv);
182
183 return ret;
184} 184}
185 185
186#define err_printk(dev, entry, format, arg...) do { \ 186#define err_printk(dev, entry, format, arg...) do { \