aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
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)
658 pr_debug("bus: '%s': add driver %s\n", bus->name, drv->name); 658 pr_debug("bus: '%s': add driver %s\n", bus->name, drv->name);
659 659
660 priv = kzalloc(sizeof(*priv), GFP_KERNEL); 660 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
661 if (!priv) 661 if (!priv) {
662 return -ENOMEM; 662 error = -ENOMEM;
663 663 goto out_put_bus;
664 }
664 klist_init(&priv->klist_devices, NULL, NULL); 665 klist_init(&priv->klist_devices, NULL, NULL);
665 priv->driver = drv; 666 priv->driver = drv;
666 drv->p = priv; 667 drv->p = priv;
@@ -668,7 +669,7 @@ int bus_add_driver(struct device_driver *drv)
668 error = kobject_init_and_add(&priv->kobj, &driver_ktype, NULL, 669 error = kobject_init_and_add(&priv->kobj, &driver_ktype, NULL,
669 "%s", drv->name); 670 "%s", drv->name);
670 if (error) 671 if (error)
671 goto out_put_bus; 672 goto out_unregister;
672 673
673 if (drv->bus->p->drivers_autoprobe) { 674 if (drv->bus->p->drivers_autoprobe) {
674 error = driver_attach(drv); 675 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);
120 120
121/** 121/**
122 * driver_add_kobj - add a kobject below the specified driver 122 * driver_add_kobj - add a kobject below the specified driver
123 * @drv: requesting device driver
124 * @kobj: kobject to add below this driver
125 * @fmt: format string that names the kobject
123 * 126 *
124 * You really don't want to do this, this is only here due to one looney 127 * You really don't want to do this, this is only here due to one looney
125 * iseries driver, go poke those developers if you are annoyed about 128 * 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)
479 mutex_lock(&dpm_list_mtx); 479 mutex_lock(&dpm_list_mtx);
480 if (list_empty(&dev->power.entry)) 480 if (list_empty(&dev->power.entry))
481 list_add(&dev->power.entry, &dpm_locked); 481 list_add(&dev->power.entry, &dpm_locked);
482 mutex_unlock(&dpm_list_mtx);
483 break; 482 break;
484 } 483 }
485 mutex_lock(&dpm_list_mtx); 484 mutex_lock(&dpm_list_mtx);
@@ -523,6 +522,7 @@ static void lock_all_devices(void)
523 522
524/** 523/**
525 * device_suspend - Save state and stop all devices in system. 524 * device_suspend - Save state and stop all devices in system.
525 * @state: new power management state
526 * 526 *
527 * Prevent new devices from being registered, then lock all devices 527 * Prevent new devices from being registered, then lock all devices
528 * and suspend them. 528 * 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)
1006 } 1006 }
1007#endif 1007#endif
1008 1008
1009
1010 if (!kobject_get(&data->kobj)) {
1011 spin_unlock_irqrestore(&cpufreq_driver_lock, flags);
1012 cpufreq_debug_enable_ratelimit();
1013 unlock_policy_rwsem_write(cpu);
1014 return -EFAULT;
1015 }
1016
1017#ifdef CONFIG_SMP 1009#ifdef CONFIG_SMP
1018 1010
1019#ifdef CONFIG_HOTPLUG_CPU 1011#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)
1229 if (!strcmp(s, "ide=reverse")) { 1229 if (!strcmp(s, "ide=reverse")) {
1230 ide_scan_direction = 1; 1230 ide_scan_direction = 1;
1231 printk(" : Enabled support for IDE inverse scan order.\n"); 1231 printk(" : Enabled support for IDE inverse scan order.\n");
1232 return 1; 1232 goto obsolete_option;
1233 } 1233 }
1234#endif 1234#endif
1235 1235
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 {
57}; 57};
58#define to_map(map) container_of(map, struct uio_map, kobj) 58#define to_map(map) container_of(map, struct uio_map, kobj)
59 59
60 60static ssize_t map_addr_show(struct uio_mem *mem, char *buf)
61static ssize_t map_attr_show(struct kobject *kobj, struct kobj_attribute *attr,
62 char *buf)
63{ 61{
64 struct uio_map *map = to_map(kobj); 62 return sprintf(buf, "0x%lx\n", mem->addr);
65 struct uio_mem *mem = map->mem; 63}
66
67 if (strncmp(attr->attr.name, "addr", 4) == 0)
68 return sprintf(buf, "0x%lx\n", mem->addr);
69
70 if (strncmp(attr->attr.name, "size", 4) == 0)
71 return sprintf(buf, "0x%lx\n", mem->size);
72 64
73 return -ENODEV; 65static ssize_t map_size_show(struct uio_mem *mem, char *buf)
66{
67 return sprintf(buf, "0x%lx\n", mem->size);
74} 68}
75 69
76static struct kobj_attribute attr_attribute = 70struct uio_sysfs_entry {
77 __ATTR(addr, S_IRUGO, map_attr_show, NULL); 71 struct attribute attr;
78static struct kobj_attribute size_attribute = 72 ssize_t (*show)(struct uio_mem *, char *);
79 __ATTR(size, S_IRUGO, map_attr_show, NULL); 73 ssize_t (*store)(struct uio_mem *, const char *, size_t);
74};
75
76static struct uio_sysfs_entry addr_attribute =
77 __ATTR(addr, S_IRUGO, map_addr_show, NULL);
78static struct uio_sysfs_entry size_attribute =
79 __ATTR(size, S_IRUGO, map_size_show, NULL);
80 80
81static struct attribute *attrs[] = { 81static struct attribute *attrs[] = {
82 &attr_attribute.attr, 82 &addr_attribute.attr,
83 &size_attribute.attr, 83 &size_attribute.attr,
84 NULL, /* need to NULL terminate the list of attributes */ 84 NULL, /* need to NULL terminate the list of attributes */
85}; 85};
@@ -90,8 +90,28 @@ static void map_release(struct kobject *kobj)
90 kfree(map); 90 kfree(map);
91} 91}
92 92
93static ssize_t map_type_show(struct kobject *kobj, struct attribute *attr,
94 char *buf)
95{
96 struct uio_map *map = to_map(kobj);
97 struct uio_mem *mem = map->mem;
98 struct uio_sysfs_entry *entry;
99
100 entry = container_of(attr, struct uio_sysfs_entry, attr);
101
102 if (!entry->show)
103 return -EIO;
104
105 return entry->show(mem, buf);
106}
107
108static struct sysfs_ops uio_sysfs_ops = {
109 .show = map_type_show,
110};
111
93static struct kobj_type map_attr_type = { 112static struct kobj_type map_attr_type = {
94 .release = map_release, 113 .release = map_release,
114 .sysfs_ops = &uio_sysfs_ops,
95 .default_attrs = attrs, 115 .default_attrs = attrs,
96}; 116};
97 117