diff options
Diffstat (limited to 'drivers/base')
| -rw-r--r-- | drivers/base/base.h | 2 | ||||
| -rw-r--r-- | drivers/base/cpu.c | 2 | ||||
| -rw-r--r-- | drivers/base/dd.c | 17 | ||||
| -rw-r--r-- | drivers/base/power/main.c | 3 | ||||
| -rw-r--r-- | drivers/base/sys.c | 7 | ||||
| -rw-r--r-- | drivers/base/topology.c | 33 |
6 files changed, 36 insertions, 28 deletions
diff --git a/drivers/base/base.h b/drivers/base/base.h index 0a5f055dffba..9f50f1b545dc 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h | |||
| @@ -88,8 +88,6 @@ extern void driver_detach(struct device_driver *drv); | |||
| 88 | extern int driver_probe_device(struct device_driver *drv, struct device *dev); | 88 | extern int driver_probe_device(struct device_driver *drv, struct device *dev); |
| 89 | 89 | ||
| 90 | extern void sysdev_shutdown(void); | 90 | extern void sysdev_shutdown(void); |
| 91 | extern int sysdev_suspend(pm_message_t state); | ||
| 92 | extern int sysdev_resume(void); | ||
| 93 | 91 | ||
| 94 | extern char *make_class_name(const char *name, struct kobject *kobj); | 92 | extern char *make_class_name(const char *name, struct kobject *kobj); |
| 95 | 93 | ||
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 719ee5c1c8d9..5b257a57bc57 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
| @@ -107,7 +107,7 @@ static SYSDEV_ATTR(crash_notes, 0400, show_crash_notes, NULL); | |||
| 107 | /* | 107 | /* |
| 108 | * Print cpu online, possible, present, and system maps | 108 | * Print cpu online, possible, present, and system maps |
| 109 | */ | 109 | */ |
| 110 | static ssize_t print_cpus_map(char *buf, cpumask_t *map) | 110 | static ssize_t print_cpus_map(char *buf, const struct cpumask *map) |
| 111 | { | 111 | { |
| 112 | int n = cpulist_scnprintf(buf, PAGE_SIZE-2, map); | 112 | int n = cpulist_scnprintf(buf, PAGE_SIZE-2, map); |
| 113 | 113 | ||
diff --git a/drivers/base/dd.c b/drivers/base/dd.c index 315bed8d5e7f..135231239103 100644 --- a/drivers/base/dd.c +++ b/drivers/base/dd.c | |||
| @@ -18,9 +18,11 @@ | |||
| 18 | */ | 18 | */ |
| 19 | 19 | ||
| 20 | #include <linux/device.h> | 20 | #include <linux/device.h> |
| 21 | #include <linux/delay.h> | ||
| 21 | #include <linux/module.h> | 22 | #include <linux/module.h> |
| 22 | #include <linux/kthread.h> | 23 | #include <linux/kthread.h> |
| 23 | #include <linux/wait.h> | 24 | #include <linux/wait.h> |
| 25 | #include <linux/async.h> | ||
| 24 | 26 | ||
| 25 | #include "base.h" | 27 | #include "base.h" |
| 26 | #include "power/power.h" | 28 | #include "power/power.h" |
| @@ -168,6 +170,21 @@ int driver_probe_done(void) | |||
| 168 | } | 170 | } |
| 169 | 171 | ||
| 170 | /** | 172 | /** |
| 173 | * wait_for_device_probe | ||
| 174 | * Wait for device probing to be completed. | ||
| 175 | * | ||
| 176 | * Note: this function polls at 100 msec intervals. | ||
| 177 | */ | ||
| 178 | int wait_for_device_probe(void) | ||
| 179 | { | ||
| 180 | /* wait for the known devices to complete their probing */ | ||
| 181 | while (driver_probe_done() != 0) | ||
| 182 | msleep(100); | ||
| 183 | async_synchronize_full(); | ||
| 184 | return 0; | ||
| 185 | } | ||
| 186 | |||
| 187 | /** | ||
| 171 | * driver_probe_device - attempt to bind device & driver together | 188 | * driver_probe_device - attempt to bind device & driver together |
| 172 | * @drv: driver to bind a device to | 189 | * @drv: driver to bind a device to |
| 173 | * @dev: device to try to bind to the driver | 190 | * @dev: device to try to bind to the driver |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 670c9d6c1407..2d14f4ae6c01 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
| @@ -333,7 +333,6 @@ static void dpm_power_up(pm_message_t state) | |||
| 333 | */ | 333 | */ |
| 334 | void device_power_up(pm_message_t state) | 334 | void device_power_up(pm_message_t state) |
| 335 | { | 335 | { |
| 336 | sysdev_resume(); | ||
| 337 | dpm_power_up(state); | 336 | dpm_power_up(state); |
| 338 | } | 337 | } |
| 339 | EXPORT_SYMBOL_GPL(device_power_up); | 338 | EXPORT_SYMBOL_GPL(device_power_up); |
| @@ -577,8 +576,6 @@ int device_power_down(pm_message_t state) | |||
| 577 | } | 576 | } |
| 578 | dev->power.status = DPM_OFF_IRQ; | 577 | dev->power.status = DPM_OFF_IRQ; |
| 579 | } | 578 | } |
| 580 | if (!error) | ||
| 581 | error = sysdev_suspend(state); | ||
| 582 | if (error) | 579 | if (error) |
| 583 | dpm_power_up(resume_event(state)); | 580 | dpm_power_up(resume_event(state)); |
| 584 | return error; | 581 | return error; |
diff --git a/drivers/base/sys.c b/drivers/base/sys.c index c98c31ec2f75..b428c8c4bc64 100644 --- a/drivers/base/sys.c +++ b/drivers/base/sys.c | |||
| @@ -303,7 +303,6 @@ void sysdev_unregister(struct sys_device * sysdev) | |||
| 303 | * is guaranteed by virtue of the fact that child devices are registered | 303 | * is guaranteed by virtue of the fact that child devices are registered |
| 304 | * after their parents. | 304 | * after their parents. |
| 305 | */ | 305 | */ |
| 306 | |||
| 307 | void sysdev_shutdown(void) | 306 | void sysdev_shutdown(void) |
| 308 | { | 307 | { |
| 309 | struct sysdev_class * cls; | 308 | struct sysdev_class * cls; |
| @@ -363,7 +362,6 @@ static void __sysdev_resume(struct sys_device *dev) | |||
| 363 | * This is only called by the device PM core, so we let them handle | 362 | * This is only called by the device PM core, so we let them handle |
| 364 | * all synchronization. | 363 | * all synchronization. |
| 365 | */ | 364 | */ |
| 366 | |||
| 367 | int sysdev_suspend(pm_message_t state) | 365 | int sysdev_suspend(pm_message_t state) |
| 368 | { | 366 | { |
| 369 | struct sysdev_class * cls; | 367 | struct sysdev_class * cls; |
| @@ -432,7 +430,7 @@ aux_driver: | |||
| 432 | } | 430 | } |
| 433 | return ret; | 431 | return ret; |
| 434 | } | 432 | } |
| 435 | 433 | EXPORT_SYMBOL_GPL(sysdev_suspend); | |
| 436 | 434 | ||
| 437 | /** | 435 | /** |
| 438 | * sysdev_resume - Bring system devices back to life. | 436 | * sysdev_resume - Bring system devices back to life. |
| @@ -442,7 +440,6 @@ aux_driver: | |||
| 442 | * | 440 | * |
| 443 | * Note: Interrupts are disabled when called. | 441 | * Note: Interrupts are disabled when called. |
| 444 | */ | 442 | */ |
| 445 | |||
| 446 | int sysdev_resume(void) | 443 | int sysdev_resume(void) |
| 447 | { | 444 | { |
| 448 | struct sysdev_class * cls; | 445 | struct sysdev_class * cls; |
| @@ -463,7 +460,7 @@ int sysdev_resume(void) | |||
| 463 | } | 460 | } |
| 464 | return 0; | 461 | return 0; |
| 465 | } | 462 | } |
| 466 | 463 | EXPORT_SYMBOL_GPL(sysdev_resume); | |
| 467 | 464 | ||
| 468 | int __init system_bus_init(void) | 465 | int __init system_bus_init(void) |
| 469 | { | 466 | { |
diff --git a/drivers/base/topology.c b/drivers/base/topology.c index a778fb52b11f..bf6b13206d00 100644 --- a/drivers/base/topology.c +++ b/drivers/base/topology.c | |||
| @@ -31,7 +31,10 @@ | |||
| 31 | #include <linux/hardirq.h> | 31 | #include <linux/hardirq.h> |
| 32 | #include <linux/topology.h> | 32 | #include <linux/topology.h> |
| 33 | 33 | ||
| 34 | #define define_one_ro(_name) \ | 34 | #define define_one_ro_named(_name, _func) \ |
| 35 | static SYSDEV_ATTR(_name, 0444, _func, NULL) | ||
| 36 | |||
| 37 | #define define_one_ro(_name) \ | ||
| 35 | static SYSDEV_ATTR(_name, 0444, show_##_name, NULL) | 38 | static SYSDEV_ATTR(_name, 0444, show_##_name, NULL) |
| 36 | 39 | ||
| 37 | #define define_id_show_func(name) \ | 40 | #define define_id_show_func(name) \ |
| @@ -42,8 +45,8 @@ static ssize_t show_##name(struct sys_device *dev, \ | |||
| 42 | return sprintf(buf, "%d\n", topology_##name(cpu)); \ | 45 | return sprintf(buf, "%d\n", topology_##name(cpu)); \ |
| 43 | } | 46 | } |
| 44 | 47 | ||
| 45 | #if defined(topology_thread_siblings) || defined(topology_core_siblings) | 48 | #if defined(topology_thread_cpumask) || defined(topology_core_cpumask) |
| 46 | static ssize_t show_cpumap(int type, cpumask_t *mask, char *buf) | 49 | static ssize_t show_cpumap(int type, const struct cpumask *mask, char *buf) |
| 47 | { | 50 | { |
| 48 | ptrdiff_t len = PTR_ALIGN(buf + PAGE_SIZE - 1, PAGE_SIZE) - buf; | 51 | ptrdiff_t len = PTR_ALIGN(buf + PAGE_SIZE - 1, PAGE_SIZE) - buf; |
| 49 | int n = 0; | 52 | int n = 0; |
| @@ -65,7 +68,7 @@ static ssize_t show_##name(struct sys_device *dev, \ | |||
| 65 | struct sysdev_attribute *attr, char *buf) \ | 68 | struct sysdev_attribute *attr, char *buf) \ |
| 66 | { \ | 69 | { \ |
| 67 | unsigned int cpu = dev->id; \ | 70 | unsigned int cpu = dev->id; \ |
| 68 | return show_cpumap(0, &(topology_##name(cpu)), buf); \ | 71 | return show_cpumap(0, topology_##name(cpu), buf); \ |
| 69 | } | 72 | } |
| 70 | 73 | ||
| 71 | #define define_siblings_show_list(name) \ | 74 | #define define_siblings_show_list(name) \ |
| @@ -74,7 +77,7 @@ static ssize_t show_##name##_list(struct sys_device *dev, \ | |||
| 74 | char *buf) \ | 77 | char *buf) \ |
| 75 | { \ | 78 | { \ |
| 76 | unsigned int cpu = dev->id; \ | 79 | unsigned int cpu = dev->id; \ |
| 77 | return show_cpumap(1, &(topology_##name(cpu)), buf); \ | 80 | return show_cpumap(1, topology_##name(cpu), buf); \ |
| 78 | } | 81 | } |
| 79 | 82 | ||
| 80 | #else | 83 | #else |
| @@ -82,9 +85,7 @@ static ssize_t show_##name##_list(struct sys_device *dev, \ | |||
| 82 | static ssize_t show_##name(struct sys_device *dev, \ | 85 | static ssize_t show_##name(struct sys_device *dev, \ |
| 83 | struct sysdev_attribute *attr, char *buf) \ | 86 | struct sysdev_attribute *attr, char *buf) \ |
| 84 | { \ | 87 | { \ |
| 85 | unsigned int cpu = dev->id; \ | 88 | return show_cpumap(0, topology_##name(dev->id), buf); \ |
| 86 | cpumask_t mask = topology_##name(cpu); \ | ||
| 87 | return show_cpumap(0, &mask, buf); \ | ||
| 88 | } | 89 | } |
| 89 | 90 | ||
| 90 | #define define_siblings_show_list(name) \ | 91 | #define define_siblings_show_list(name) \ |
| @@ -92,9 +93,7 @@ static ssize_t show_##name##_list(struct sys_device *dev, \ | |||
| 92 | struct sysdev_attribute *attr, \ | 93 | struct sysdev_attribute *attr, \ |
| 93 | char *buf) \ | 94 | char *buf) \ |
| 94 | { \ | 95 | { \ |
| 95 | unsigned int cpu = dev->id; \ | 96 | return show_cpumap(1, topology_##name(dev->id), buf); \ |
| 96 | cpumask_t mask = topology_##name(cpu); \ | ||
| 97 | return show_cpumap(1, &mask, buf); \ | ||
| 98 | } | 97 | } |
| 99 | #endif | 98 | #endif |
| 100 | 99 | ||
| @@ -107,13 +106,13 @@ define_one_ro(physical_package_id); | |||
| 107 | define_id_show_func(core_id); | 106 | define_id_show_func(core_id); |
| 108 | define_one_ro(core_id); | 107 | define_one_ro(core_id); |
| 109 | 108 | ||
| 110 | define_siblings_show_func(thread_siblings); | 109 | define_siblings_show_func(thread_cpumask); |
| 111 | define_one_ro(thread_siblings); | 110 | define_one_ro_named(thread_siblings, show_thread_cpumask); |
| 112 | define_one_ro(thread_siblings_list); | 111 | define_one_ro_named(thread_siblings_list, show_thread_cpumask_list); |
| 113 | 112 | ||
| 114 | define_siblings_show_func(core_siblings); | 113 | define_siblings_show_func(core_cpumask); |
| 115 | define_one_ro(core_siblings); | 114 | define_one_ro_named(core_siblings, show_core_cpumask); |
| 116 | define_one_ro(core_siblings_list); | 115 | define_one_ro_named(core_siblings_list, show_core_cpumask_list); |
| 117 | 116 | ||
| 118 | static struct attribute *default_attrs[] = { | 117 | static struct attribute *default_attrs[] = { |
| 119 | &attr_physical_package_id.attr, | 118 | &attr_physical_package_id.attr, |
