diff options
author | Arjan van de Ven <arjan@linux.intel.com> | 2008-07-25 22:45:39 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-26 15:00:07 -0400 |
commit | f810a5cf28a818db96333cd23646f0227ec015b4 (patch) | |
tree | 671eb15b7557d7cc68ebfb30df73ef666638bdcf /drivers | |
parent | 12e0036818eed243c8ed6583ebf98261a2554e12 (diff) |
Use WARN() in drivers/base/
Use WARN() instead of a printk+WARN_ON() pair; this way the message
becomes part of the warning section for better reporting/collection.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Cc: Greg KH <greg@kroah.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/base/core.c | 6 | ||||
-rw-r--r-- | drivers/base/memory.c | 3 | ||||
-rw-r--r-- | drivers/base/sys.c | 12 |
3 files changed, 7 insertions, 14 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index 7d5c63c81a59..068aa1c9538c 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -116,12 +116,10 @@ static void device_release(struct kobject *kobj) | |||
116 | dev->type->release(dev); | 116 | dev->type->release(dev); |
117 | else if (dev->class && dev->class->dev_release) | 117 | else if (dev->class && dev->class->dev_release) |
118 | dev->class->dev_release(dev); | 118 | dev->class->dev_release(dev); |
119 | else { | 119 | else |
120 | printk(KERN_ERR "Device '%s' does not have a release() " | 120 | WARN(1, KERN_ERR "Device '%s' does not have a release() " |
121 | "function, it is broken and must be fixed.\n", | 121 | "function, it is broken and must be fixed.\n", |
122 | dev->bus_id); | 122 | dev->bus_id); |
123 | WARN_ON(1); | ||
124 | } | ||
125 | } | 123 | } |
126 | 124 | ||
127 | static struct kobj_type device_ktype = { | 125 | static struct kobj_type device_ktype = { |
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 855ed1a9f97b..3ad49a00029f 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c | |||
@@ -204,9 +204,8 @@ memory_block_action(struct memory_block *mem, unsigned long action) | |||
204 | } | 204 | } |
205 | break; | 205 | break; |
206 | default: | 206 | default: |
207 | printk(KERN_WARNING "%s(%p, %ld) unknown action: %ld\n", | 207 | WARN(1, KERN_WARNING "%s(%p, %ld) unknown action: %ld\n", |
208 | __func__, mem, action, action); | 208 | __func__, mem, action, action); |
209 | WARN_ON(1); | ||
210 | ret = -EINVAL; | 209 | ret = -EINVAL; |
211 | } | 210 | } |
212 | 211 | ||
diff --git a/drivers/base/sys.c b/drivers/base/sys.c index 40fc14f03540..75dd6e22faff 100644 --- a/drivers/base/sys.c +++ b/drivers/base/sys.c | |||
@@ -168,19 +168,16 @@ int sysdev_driver_register(struct sysdev_class *cls, struct sysdev_driver *drv) | |||
168 | int err = 0; | 168 | int err = 0; |
169 | 169 | ||
170 | if (!cls) { | 170 | if (!cls) { |
171 | printk(KERN_WARNING "sysdev: invalid class passed to " | 171 | WARN(1, KERN_WARNING "sysdev: invalid class passed to " |
172 | "sysdev_driver_register!\n"); | 172 | "sysdev_driver_register!\n"); |
173 | WARN_ON(1); | ||
174 | return -EINVAL; | 173 | return -EINVAL; |
175 | } | 174 | } |
176 | 175 | ||
177 | /* Check whether this driver has already been added to a class. */ | 176 | /* Check whether this driver has already been added to a class. */ |
178 | if (drv->entry.next && !list_empty(&drv->entry)) { | 177 | if (drv->entry.next && !list_empty(&drv->entry)) |
179 | printk(KERN_WARNING "sysdev: class %s: driver (%p) has already" | 178 | WARN(1, KERN_WARNING "sysdev: class %s: driver (%p) has already" |
180 | " been registered to a class, something is wrong, but " | 179 | " been registered to a class, something is wrong, but " |
181 | "will forge on!\n", cls->name, drv); | 180 | "will forge on!\n", cls->name, drv); |
182 | WARN_ON(1); | ||
183 | } | ||
184 | 181 | ||
185 | mutex_lock(&sysdev_drivers_lock); | 182 | mutex_lock(&sysdev_drivers_lock); |
186 | if (cls && kset_get(&cls->kset)) { | 183 | if (cls && kset_get(&cls->kset)) { |
@@ -194,8 +191,7 @@ int sysdev_driver_register(struct sysdev_class *cls, struct sysdev_driver *drv) | |||
194 | } | 191 | } |
195 | } else { | 192 | } else { |
196 | err = -EINVAL; | 193 | err = -EINVAL; |
197 | printk(KERN_ERR "%s: invalid device class\n", __func__); | 194 | WARN(1, KERN_ERR "%s: invalid device class\n", __func__); |
198 | WARN_ON(1); | ||
199 | } | 195 | } |
200 | mutex_unlock(&sysdev_drivers_lock); | 196 | mutex_unlock(&sysdev_drivers_lock); |
201 | return err; | 197 | return err; |