summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-21 16:21:52 -0800
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-21 16:21:52 -0800
commite6364cd3a1a3e7c3e9a80bad15698afe6cc7ee75 (patch)
treece8d5b1ba0e246c32b232a09a713cf49d999971d /drivers
parentb8967d8883aadf36351b568c1f1301ad3f46fc3d (diff)
parent120fc3d77acfd91f3521737a440d42839c475982 (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: modules: do not try to add sysfs attributes if !CONFIG_SYSFS POWERPC: fix typo in pseries/power.c PM: Remove unbalanced mutex_unlock() from dpm_resume() UIO: fix Greg's stupid changes stable_kernel_rules: fix must already be in mainline ide: mark "ide=reverse" option as obsolete Driver core: Fix error handling in bus_add_driver(). driver-core: fix kernel-doc function parameters cpufreq: fix kobject reference count handling slabinfo: fall back from /sys/kernel/slab to /sys/slab Fix broken utf-8 encodings in ja_JP translation of stable_kernel_rules.txt
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/bus.c9
-rw-r--r--drivers/base/driver.c3
-rw-r--r--drivers/base/power/main.c2
-rw-r--r--drivers/cpufreq/cpufreq.c8
-rw-r--r--drivers/ide/ide.c2
-rw-r--r--drivers/uio/uio.c54
6 files changed, 47 insertions, 31 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 055989e94799..2d207ad30336 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -658,9 +658,10 @@ int bus_add_driver(struct device_driver *drv)
pr_debug("bus: '%s': add driver %s\n", bus->name, drv->name);
priv = kzalloc(sizeof(*priv), GFP_KERNEL);
- if (!priv)
- return -ENOMEM;
-
+ if (!priv) {
+ error = -ENOMEM;
+ goto out_put_bus;
+ }
klist_init(&priv->klist_devices, NULL, NULL);
priv->driver = drv;
drv->p = priv;
@@ -668,7 +669,7 @@ int bus_add_driver(struct device_driver *drv)
error = kobject_init_and_add(&priv->kobj, &driver_ktype, NULL,
"%s", drv->name);
if (error)
- goto out_put_bus;
+ goto out_unregister;
if (drv->bus->p->drivers_autoprobe) {
error = driver_attach(drv);
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index ba75184c653c..bf31a0170a48 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -120,6 +120,9 @@ EXPORT_SYMBOL_GPL(driver_remove_file);
/**
* driver_add_kobj - add a kobject below the specified driver
+ * @drv: requesting device driver
+ * @kobj: kobject to add below this driver
+ * @fmt: format string that names the kobject
*
* You really don't want to do this, this is only here due to one looney
* iseries driver, go poke those developers if you are annoyed about
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c
index bdc03f7e8424..cea5ed3919cd 100644
--- a/drivers/base/power/main.c
+++ b/drivers/base/power/main.c
@@ -479,7 +479,6 @@ static int dpm_suspend(pm_message_t state)
mutex_lock(&dpm_list_mtx);
if (list_empty(&dev->power.entry))
list_add(&dev->power.entry, &dpm_locked);
- mutex_unlock(&dpm_list_mtx);
break;
}
mutex_lock(&dpm_list_mtx);
@@ -523,6 +522,7 @@ static void lock_all_devices(void)
/**
* device_suspend - Save state and stop all devices in system.
+ * @state: new power management state
*
* Prevent new devices from being registered, then lock all devices
* and suspend them.
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 64926aa990db..89a29cd93783 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -1006,14 +1006,6 @@ static int __cpufreq_remove_dev (struct sys_device * sys_dev)
}
#endif
-
- if (!kobject_get(&data->kobj)) {
- spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
- cpufreq_debug_enable_ratelimit();
- unlock_policy_rwsem_write(cpu);
- return -EFAULT;
- }
-
#ifdef CONFIG_SMP
#ifdef CONFIG_HOTPLUG_CPU
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c
index 4a8952a6c3da..477833f0daf5 100644
--- a/drivers/ide/ide.c
+++ b/drivers/ide/ide.c
@@ -1229,7 +1229,7 @@ static int __init ide_setup(char *s)
if (!strcmp(s, "ide=reverse")) {
ide_scan_direction = 1;
printk(" : Enabled support for IDE inverse scan order.\n");
- return 1;
+ goto obsolete_option;
}
#endif
diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
index 2a77e9d42c68..e8a01f264540 100644
--- a/drivers/uio/uio.c
+++ b/drivers/uio/uio.c
@@ -57,29 +57,29 @@ struct uio_map {
};
#define to_map(map) container_of(map, struct uio_map, kobj)
-
-static ssize_t map_attr_show(struct kobject *kobj, struct kobj_attribute *attr,
- char *buf)
+static ssize_t map_addr_show(struct uio_mem *mem, char *buf)
{
- struct uio_map *map = to_map(kobj);
- struct uio_mem *mem = map->mem;
-
- if (strncmp(attr->attr.name, "addr", 4) == 0)
- return sprintf(buf, "0x%lx\n", mem->addr);
-
- if (strncmp(attr->attr.name, "size", 4) == 0)
- return sprintf(buf, "0x%lx\n", mem->size);
+ return sprintf(buf, "0x%lx\n", mem->addr);
+}
- return -ENODEV;
+static ssize_t map_size_show(struct uio_mem *mem, char *buf)
+{
+ return sprintf(buf, "0x%lx\n", mem->size);
}
-static struct kobj_attribute attr_attribute =
- __ATTR(addr, S_IRUGO, map_attr_show, NULL);
-static struct kobj_attribute size_attribute =
- __ATTR(size, S_IRUGO, map_attr_show, NULL);
+struct uio_sysfs_entry {
+ struct attribute attr;
+ ssize_t (*show)(struct uio_mem *, char *);
+ ssize_t (*store)(struct uio_mem *, const char *, size_t);
+};
+
+static struct uio_sysfs_entry addr_attribute =
+ __ATTR(addr, S_IRUGO, map_addr_show, NULL);
+static struct uio_sysfs_entry size_attribute =
+ __ATTR(size, S_IRUGO, map_size_show, NULL);
static struct attribute *attrs[] = {
- &attr_attribute.attr,
+ &addr_attribute.attr,
&size_attribute.attr,
NULL, /* need to NULL terminate the list of attributes */
};
@@ -90,8 +90,28 @@ static void map_release(struct kobject *kobj)
kfree(map);
}
+static ssize_t map_type_show(struct kobject *kobj, struct attribute *attr,
+ char *buf)
+{
+ struct uio_map *map = to_map(kobj);
+ struct uio_mem *mem = map->mem;
+ struct uio_sysfs_entry *entry;
+
+ entry = container_of(attr, struct uio_sysfs_entry, attr);
+
+ if (!entry->show)
+ return -EIO;
+
+ return entry->show(mem, buf);
+}
+
+static struct sysfs_ops uio_sysfs_ops = {
+ .show = map_type_show,
+};
+
static struct kobj_type map_attr_type = {
.release = map_release,
+ .sysfs_ops = &uio_sysfs_ops,
.default_attrs = attrs,
};