diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-21 18:49:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-21 18:49:58 -0400 |
commit | e80ab411e589e00550e2e6e5a6a02d59cc730357 (patch) | |
tree | 870225ff7b5b8d03e82a996963213a4bb9cce248 /drivers/base/sys.c | |
parent | 529a41e36673b518c9e091f3a8d932b6b9e3c461 (diff) | |
parent | ee959b00c335d7780136c5abda37809191fe52c3 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-2.6: (36 commits)
SCSI: convert struct class_device to struct device
DRM: remove unused dev_class
IB: rename "dev" to "srp_dev" in srp_host structure
IB: convert struct class_device to struct device
memstick: convert struct class_device to struct device
driver core: replace remaining __FUNCTION__ occurrences
sysfs: refill attribute buffer when reading from offset 0
PM: Remove destroy_suspended_device()
Firmware: add iSCSI iBFT Support
PM: Remove legacy PM (fix)
Kobject: Replace list_for_each() with list_for_each_entry().
SYSFS: Explicitly include required header file slab.h.
Driver core: make device_is_registered() work for class devices
PM: Convert wakeup flag accessors to inline functions
PM: Make wakeup flags available whenever CONFIG_PM is set
PM: Fix misuse of wakeup flag accessors in serial core
Driver core: Call device_pm_add() after bus_add_device() in device_add()
PM: Handle device registrations during suspend/resume
block: send disk "change" event for rescan_partitions()
sysdev: detect multiple driver registrations
...
Fixed trivial conflict in include/linux/memory.h due to semaphore header
file change (made irrelevant by the change to mutex).
Diffstat (limited to 'drivers/base/sys.c')
-rw-r--r-- | drivers/base/sys.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/drivers/base/sys.c b/drivers/base/sys.c index 8e13fd942163..4fbb56bcb1ee 100644 --- a/drivers/base/sys.c +++ b/drivers/base/sys.c | |||
@@ -167,6 +167,22 @@ int sysdev_driver_register(struct sysdev_class *cls, struct sysdev_driver *drv) | |||
167 | { | 167 | { |
168 | int err = 0; | 168 | int err = 0; |
169 | 169 | ||
170 | if (!cls) { | ||
171 | printk(KERN_WARNING "sysdev: invalid class passed to " | ||
172 | "sysdev_driver_register!\n"); | ||
173 | WARN_ON(1); | ||
174 | return -EINVAL; | ||
175 | } | ||
176 | |||
177 | /* Check whether this driver has already been added to a class. */ | ||
178 | if ((drv->entry.next != drv->entry.prev) || | ||
179 | (drv->entry.next != NULL)) { | ||
180 | printk(KERN_WARNING "sysdev: class %s: driver (%p) has already" | ||
181 | " been registered to a class, something is wrong, but " | ||
182 | "will forge on!\n", cls->name, drv); | ||
183 | WARN_ON(1); | ||
184 | } | ||
185 | |||
170 | mutex_lock(&sysdev_drivers_lock); | 186 | mutex_lock(&sysdev_drivers_lock); |
171 | if (cls && kset_get(&cls->kset)) { | 187 | if (cls && kset_get(&cls->kset)) { |
172 | list_add_tail(&drv->entry, &cls->drivers); | 188 | list_add_tail(&drv->entry, &cls->drivers); |
@@ -179,7 +195,7 @@ int sysdev_driver_register(struct sysdev_class *cls, struct sysdev_driver *drv) | |||
179 | } | 195 | } |
180 | } else { | 196 | } else { |
181 | err = -EINVAL; | 197 | err = -EINVAL; |
182 | printk(KERN_ERR "%s: invalid device class\n", __FUNCTION__); | 198 | printk(KERN_ERR "%s: invalid device class\n", __func__); |
183 | WARN_ON(1); | 199 | WARN_ON(1); |
184 | } | 200 | } |
185 | mutex_unlock(&sysdev_drivers_lock); | 201 | mutex_unlock(&sysdev_drivers_lock); |