diff options
Diffstat (limited to 'drivers/base')
| -rw-r--r-- | drivers/base/Kconfig | 8 | ||||
| -rw-r--r-- | drivers/base/base.h | 2 | ||||
| -rw-r--r-- | drivers/base/bus.c | 116 | ||||
| -rw-r--r-- | drivers/base/class.c | 60 | ||||
| -rw-r--r-- | drivers/base/core.c | 108 | ||||
| -rw-r--r-- | drivers/base/firmware_class.c | 14 | ||||
| -rw-r--r-- | drivers/base/memory.c | 3 | ||||
| -rw-r--r-- | drivers/base/platform.c | 26 | ||||
| -rw-r--r-- | drivers/base/power/Makefile | 2 | ||||
| -rw-r--r-- | drivers/base/power/main.c | 344 | ||||
| -rw-r--r-- | drivers/base/power/power.h | 38 | ||||
| -rw-r--r-- | drivers/base/power/resume.c | 149 | ||||
| -rw-r--r-- | drivers/base/power/suspend.c | 210 | ||||
| -rw-r--r-- | drivers/base/sys.c | 73 |
14 files changed, 503 insertions, 650 deletions
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index 5d6312e33490..d7da109c24fd 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig | |||
| @@ -1,5 +1,13 @@ | |||
| 1 | menu "Generic Driver Options" | 1 | menu "Generic Driver Options" |
| 2 | 2 | ||
| 3 | config UEVENT_HELPER_PATH | ||
| 4 | string "path to uevent helper" | ||
| 5 | depends on HOTPLUG | ||
| 6 | default "/sbin/hotplug" | ||
| 7 | help | ||
| 8 | Path to uevent helper program forked by the kernel for | ||
| 9 | every uevent. | ||
| 10 | |||
| 3 | config STANDALONE | 11 | config STANDALONE |
| 4 | bool "Select only drivers that don't need compile-time external firmware" if EXPERIMENTAL | 12 | bool "Select only drivers that don't need compile-time external firmware" if EXPERIMENTAL |
| 5 | default y | 13 | default y |
diff --git a/drivers/base/base.h b/drivers/base/base.h index 47eb02d9f1af..10b2fb6c9ce6 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h | |||
| @@ -18,8 +18,6 @@ extern int attribute_container_init(void); | |||
| 18 | extern int bus_add_device(struct device * dev); | 18 | extern int bus_add_device(struct device * dev); |
| 19 | extern void bus_attach_device(struct device * dev); | 19 | extern void bus_attach_device(struct device * dev); |
| 20 | extern void bus_remove_device(struct device * dev); | 20 | extern void bus_remove_device(struct device * dev); |
| 21 | extern struct bus_type *get_bus(struct bus_type * bus); | ||
| 22 | extern void put_bus(struct bus_type * bus); | ||
| 23 | 21 | ||
| 24 | extern int bus_add_driver(struct device_driver *); | 22 | extern int bus_add_driver(struct device_driver *); |
| 25 | extern void bus_remove_driver(struct device_driver *); | 23 | extern void bus_remove_driver(struct device_driver *); |
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 61c67526a656..9a19b071c573 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
| @@ -30,6 +30,17 @@ | |||
| 30 | static int __must_check bus_rescan_devices_helper(struct device *dev, | 30 | static int __must_check bus_rescan_devices_helper(struct device *dev, |
| 31 | void *data); | 31 | void *data); |
| 32 | 32 | ||
| 33 | static struct bus_type *bus_get(struct bus_type *bus) | ||
| 34 | { | ||
| 35 | return bus ? container_of(kset_get(&bus->subsys), | ||
| 36 | struct bus_type, subsys) : NULL; | ||
| 37 | } | ||
| 38 | |||
| 39 | static void bus_put(struct bus_type *bus) | ||
| 40 | { | ||
| 41 | kset_put(&bus->subsys); | ||
| 42 | } | ||
| 43 | |||
| 33 | static ssize_t | 44 | static ssize_t |
| 34 | drv_attr_show(struct kobject * kobj, struct attribute * attr, char * buf) | 45 | drv_attr_show(struct kobject * kobj, struct attribute * attr, char * buf) |
| 35 | { | 46 | { |
| @@ -78,7 +89,7 @@ static void driver_release(struct kobject * kobj) | |||
| 78 | */ | 89 | */ |
| 79 | } | 90 | } |
| 80 | 91 | ||
| 81 | static struct kobj_type ktype_driver = { | 92 | static struct kobj_type driver_ktype = { |
| 82 | .sysfs_ops = &driver_sysfs_ops, | 93 | .sysfs_ops = &driver_sysfs_ops, |
| 83 | .release = driver_release, | 94 | .release = driver_release, |
| 84 | }; | 95 | }; |
| @@ -122,9 +133,9 @@ static struct sysfs_ops bus_sysfs_ops = { | |||
| 122 | int bus_create_file(struct bus_type * bus, struct bus_attribute * attr) | 133 | int bus_create_file(struct bus_type * bus, struct bus_attribute * attr) |
| 123 | { | 134 | { |
| 124 | int error; | 135 | int error; |
| 125 | if (get_bus(bus)) { | 136 | if (bus_get(bus)) { |
| 126 | error = sysfs_create_file(&bus->subsys.kobj, &attr->attr); | 137 | error = sysfs_create_file(&bus->subsys.kobj, &attr->attr); |
| 127 | put_bus(bus); | 138 | bus_put(bus); |
| 128 | } else | 139 | } else |
| 129 | error = -EINVAL; | 140 | error = -EINVAL; |
| 130 | return error; | 141 | return error; |
| @@ -132,9 +143,9 @@ int bus_create_file(struct bus_type * bus, struct bus_attribute * attr) | |||
| 132 | 143 | ||
| 133 | void bus_remove_file(struct bus_type * bus, struct bus_attribute * attr) | 144 | void bus_remove_file(struct bus_type * bus, struct bus_attribute * attr) |
| 134 | { | 145 | { |
| 135 | if (get_bus(bus)) { | 146 | if (bus_get(bus)) { |
| 136 | sysfs_remove_file(&bus->subsys.kobj, &attr->attr); | 147 | sysfs_remove_file(&bus->subsys.kobj, &attr->attr); |
| 137 | put_bus(bus); | 148 | bus_put(bus); |
| 138 | } | 149 | } |
| 139 | } | 150 | } |
| 140 | 151 | ||
| @@ -172,7 +183,7 @@ static int driver_helper(struct device *dev, void *data) | |||
| 172 | static ssize_t driver_unbind(struct device_driver *drv, | 183 | static ssize_t driver_unbind(struct device_driver *drv, |
| 173 | const char *buf, size_t count) | 184 | const char *buf, size_t count) |
| 174 | { | 185 | { |
| 175 | struct bus_type *bus = get_bus(drv->bus); | 186 | struct bus_type *bus = bus_get(drv->bus); |
| 176 | struct device *dev; | 187 | struct device *dev; |
| 177 | int err = -ENODEV; | 188 | int err = -ENODEV; |
| 178 | 189 | ||
| @@ -186,7 +197,7 @@ static ssize_t driver_unbind(struct device_driver *drv, | |||
| 186 | err = count; | 197 | err = count; |
| 187 | } | 198 | } |
| 188 | put_device(dev); | 199 | put_device(dev); |
| 189 | put_bus(bus); | 200 | bus_put(bus); |
| 190 | return err; | 201 | return err; |
| 191 | } | 202 | } |
| 192 | static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind); | 203 | static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind); |
| @@ -199,7 +210,7 @@ static DRIVER_ATTR(unbind, S_IWUSR, NULL, driver_unbind); | |||
| 199 | static ssize_t driver_bind(struct device_driver *drv, | 210 | static ssize_t driver_bind(struct device_driver *drv, |
| 200 | const char *buf, size_t count) | 211 | const char *buf, size_t count) |
| 201 | { | 212 | { |
| 202 | struct bus_type *bus = get_bus(drv->bus); | 213 | struct bus_type *bus = bus_get(drv->bus); |
| 203 | struct device *dev; | 214 | struct device *dev; |
| 204 | int err = -ENODEV; | 215 | int err = -ENODEV; |
| 205 | 216 | ||
| @@ -219,7 +230,7 @@ static ssize_t driver_bind(struct device_driver *drv, | |||
| 219 | err = -ENODEV; | 230 | err = -ENODEV; |
| 220 | } | 231 | } |
| 221 | put_device(dev); | 232 | put_device(dev); |
| 222 | put_bus(bus); | 233 | bus_put(bus); |
| 223 | return err; | 234 | return err; |
| 224 | } | 235 | } |
| 225 | static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind); | 236 | static DRIVER_ATTR(bind, S_IWUSR, NULL, driver_bind); |
| @@ -430,7 +441,7 @@ static inline void remove_deprecated_bus_links(struct device *dev) { } | |||
| 430 | */ | 441 | */ |
| 431 | int bus_add_device(struct device * dev) | 442 | int bus_add_device(struct device * dev) |
| 432 | { | 443 | { |
| 433 | struct bus_type * bus = get_bus(dev->bus); | 444 | struct bus_type * bus = bus_get(dev->bus); |
| 434 | int error = 0; | 445 | int error = 0; |
| 435 | 446 | ||
| 436 | if (bus) { | 447 | if (bus) { |
| @@ -459,7 +470,7 @@ out_subsys: | |||
| 459 | out_id: | 470 | out_id: |
| 460 | device_remove_attrs(bus, dev); | 471 | device_remove_attrs(bus, dev); |
| 461 | out_put: | 472 | out_put: |
| 462 | put_bus(dev->bus); | 473 | bus_put(dev->bus); |
| 463 | return error; | 474 | return error; |
| 464 | } | 475 | } |
| 465 | 476 | ||
| @@ -509,7 +520,7 @@ void bus_remove_device(struct device * dev) | |||
| 509 | } | 520 | } |
| 510 | pr_debug("bus %s: remove device %s\n", dev->bus->name, dev->bus_id); | 521 | pr_debug("bus %s: remove device %s\n", dev->bus->name, dev->bus_id); |
| 511 | device_release_driver(dev); | 522 | device_release_driver(dev); |
| 512 | put_bus(dev->bus); | 523 | bus_put(dev->bus); |
| 513 | } | 524 | } |
| 514 | } | 525 | } |
| 515 | 526 | ||
| @@ -568,32 +579,29 @@ static void remove_bind_files(struct device_driver *drv) | |||
| 568 | driver_remove_file(drv, &driver_attr_unbind); | 579 | driver_remove_file(drv, &driver_attr_unbind); |
| 569 | } | 580 | } |
| 570 | 581 | ||
| 582 | static BUS_ATTR(drivers_probe, S_IWUSR, NULL, store_drivers_probe); | ||
| 583 | static BUS_ATTR(drivers_autoprobe, S_IWUSR | S_IRUGO, | ||
| 584 | show_drivers_autoprobe, store_drivers_autoprobe); | ||
| 585 | |||
| 571 | static int add_probe_files(struct bus_type *bus) | 586 | static int add_probe_files(struct bus_type *bus) |
| 572 | { | 587 | { |
| 573 | int retval; | 588 | int retval; |
| 574 | 589 | ||
