diff options
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/class.c | 2 | ||||
-rw-r--r-- | drivers/base/core.c | 6 | ||||
-rw-r--r-- | drivers/base/cpu.c | 16 | ||||
-rw-r--r-- | drivers/base/firmware_class.c | 2 | ||||
-rw-r--r-- | drivers/base/memory.c | 15 | ||||
-rw-r--r-- | drivers/base/node.c | 7 | ||||
-rw-r--r-- | drivers/base/platform.c | 33 |
7 files changed, 59 insertions, 22 deletions
diff --git a/drivers/base/class.c b/drivers/base/class.c index 0147f476b8a9..9c6a0d6408e7 100644 --- a/drivers/base/class.c +++ b/drivers/base/class.c | |||
@@ -219,6 +219,8 @@ static void class_create_release(struct class *cls) | |||
219 | * This is used to create a struct class pointer that can then be used | 219 | * This is used to create a struct class pointer that can then be used |
220 | * in calls to device_create(). | 220 | * in calls to device_create(). |
221 | * | 221 | * |
222 | * Returns &struct class pointer on success, or ERR_PTR() on error. | ||
223 | * | ||
222 | * Note, the pointer created here is to be destroyed when finished by | 224 | * Note, the pointer created here is to be destroyed when finished by |
223 | * making a call to class_destroy(). | 225 | * making a call to class_destroy(). |
224 | */ | 226 | */ |
diff --git a/drivers/base/core.c b/drivers/base/core.c index ef55df34ddd0..b56a0ba31d4a 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -1345,6 +1345,8 @@ static void root_device_release(struct device *dev) | |||
1345 | * 'module' symlink which points to the @owner directory | 1345 | * 'module' symlink which points to the @owner directory |
1346 | * in sysfs. | 1346 | * in sysfs. |
1347 | * | 1347 | * |
1348 | * Returns &struct device pointer on success, or ERR_PTR() on error. | ||
1349 | * | ||
1348 | * Note: You probably want to use root_device_register(). | 1350 | * Note: You probably want to use root_device_register(). |
1349 | */ | 1351 | */ |
1350 | struct device *__root_device_register(const char *name, struct module *owner) | 1352 | struct device *__root_device_register(const char *name, struct module *owner) |
@@ -1432,6 +1434,8 @@ static void device_create_release(struct device *dev) | |||
1432 | * Any further sysfs files that might be required can be created using this | 1434 | * Any further sysfs files that might be required can be created using this |
1433 | * pointer. | 1435 | * pointer. |
1434 | * | 1436 | * |
1437 | * Returns &struct device pointer on success, or ERR_PTR() on error. | ||
1438 | * | ||
1435 | * Note: the struct class passed to this function must have previously | 1439 | * Note: the struct class passed to this function must have previously |
1436 | * been created with a call to class_create(). | 1440 | * been created with a call to class_create(). |
1437 | */ | 1441 | */ |
@@ -1492,6 +1496,8 @@ EXPORT_SYMBOL_GPL(device_create_vargs); | |||
1492 | * Any further sysfs files that might be required can be created using this | 1496 | * Any further sysfs files that might be required can be created using this |
1493 | * pointer. | 1497 | * pointer. |
1494 | * | 1498 | * |
1499 | * Returns &struct device pointer on success, or ERR_PTR() on error. | ||
1500 | * | ||
1495 | * Note: the struct class passed to this function must have previously | 1501 | * Note: the struct class passed to this function must have previously |
1496 | * been created with a call to class_create(). | 1502 | * been created with a call to class_create(). |
1497 | */ | 1503 | */ |
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 7036e8e96ab8..b5242e1e8bc4 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
@@ -79,24 +79,24 @@ void unregister_cpu(struct cpu *cpu) | |||
79 | } | 79 | } |
80 | 80 | ||
81 | #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE | 81 | #ifdef CONFIG_ARCH_CPU_PROBE_RELEASE |
82 | static ssize_t cpu_probe_store(struct sys_device *dev, | 82 | static ssize_t cpu_probe_store(struct sysdev_class *class, |
83 | struct sysdev_attribute *attr, | 83 | struct sysdev_class_attribute *attr, |
84 | const char *buf, | 84 | const char *buf, |
85 | size_t count) | 85 | size_t count) |
86 | { | 86 | { |
87 | return arch_cpu_probe(buf, count); | 87 | return arch_cpu_probe(buf, count); |
88 | } | 88 | } |
89 | 89 | ||
90 | static ssize_t cpu_release_store(struct sys_device *dev, | 90 | static ssize_t cpu_release_store(struct sysdev_class *class, |
91 | struct sysdev_attribute *attr, | 91 | struct sysdev_class_attribute *attr, |
92 | const char *buf, | 92 | const char *buf, |
93 | size_t count) | 93 | size_t count) |
94 | { | 94 | { |
95 | return arch_cpu_release(buf, count); | 95 | return arch_cpu_release(buf, count); |
96 | } | 96 | } |
97 | 97 | ||
98 | static SYSDEV_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); | 98 | static SYSDEV_CLASS_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); |
99 | static SYSDEV_ATTR(release, S_IWUSR, NULL, cpu_release_store); | 99 | static SYSDEV_CLASS_ATTR(release, S_IWUSR, NULL, cpu_release_store); |
100 | #endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */ | 100 | #endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */ |
101 | 101 | ||
102 | #else /* ... !CONFIG_HOTPLUG_CPU */ | 102 | #else /* ... !CONFIG_HOTPLUG_CPU */ |
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c index d0dc26ad5387..18518ba13c81 100644 --- a/drivers/base/firmware_class.c +++ b/drivers/base/firmware_class.c | |||
@@ -78,6 +78,7 @@ firmware_timeout_show(struct class *class, | |||
78 | /** | 78 | /** |
79 | * firmware_timeout_store - set number of seconds to wait for firmware | 79 | * firmware_timeout_store - set number of seconds to wait for firmware |
80 | * @class: device class pointer | 80 | * @class: device class pointer |
81 | * @attr: device attribute pointer | ||
81 | * @buf: buffer to scan for timeout value | 82 | * @buf: buffer to scan for timeout value |
82 | * @count: number of bytes in @buf | 83 | * @count: number of bytes in @buf |
83 | * | 84 | * |
@@ -442,6 +443,7 @@ static int fw_setup_device(struct firmware *fw, struct device **dev_p, | |||
442 | fw_priv = dev_get_drvdata(f_dev); | 443 | fw_priv = dev_get_drvdata(f_dev); |
443 | 444 | ||
444 | fw_priv->fw = fw; | 445 | fw_priv->fw = fw; |
446 | sysfs_bin_attr_init(&fw_priv->attr_data); | ||
445 | retval = sysfs_create_bin_file(&f_dev->kobj, &fw_priv->attr_data); | 447 | retval = sysfs_create_bin_file(&f_dev->kobj, &fw_priv->attr_data); |
446 | if (retval) { | 448 | if (retval) { |
447 | dev_err(device, "%s: sysfs_create_bin_file failed\n", __func__); | 449 | dev_err(device, "%s: sysfs_create_bin_file failed\n", __func__); |
diff --git a/drivers/base/memory.c b/drivers/base/memory.c index 2f8691511190..db0848e54cc6 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c | |||
@@ -429,12 +429,16 @@ static inline int memory_fail_init(void) | |||
429 | * differentiation between which *physical* devices each | 429 | * differentiation between which *physical* devices each |
430 | * section belongs to... | 430 | * section belongs to... |
431 | */ | 431 | */ |
432 | int __weak arch_get_memory_phys_device(unsigned long start_pfn) | ||
433 | { | ||
434 | return 0; | ||
435 | } | ||
432 | 436 | ||
433 | static int add_memory_block(int nid, struct mem_section *section, | 437 | static int add_memory_block(int nid, struct mem_section *section, |
434 | unsigned long state, int phys_device, | 438 | unsigned long state, enum mem_add_context context) |
435 | enum mem_add_context context) | ||
436 | { | 439 | { |
437 | struct memory_block *mem = kzalloc(sizeof(*mem), GFP_KERNEL); | 440 | struct memory_block *mem = kzalloc(sizeof(*mem), GFP_KERNEL); |
441 | unsigned long start_pfn; | ||
438 | int ret = 0; | 442 | int ret = 0; |
439 | 443 | ||
440 | if (!mem) | 444 | if (!mem) |
@@ -443,7 +447,8 @@ static int add_memory_block(int nid, struct mem_section *section, | |||
443 | mem->phys_index = __section_nr(section); | 447 | mem->phys_index = __section_nr(section); |
444 | mem->state = state; | 448 | mem->state = state; |
445 | mutex_init(&mem->state_mutex); | 449 | mutex_init(&mem->state_mutex); |
446 | mem->phys_device = phys_device; | 450 | start_pfn = section_nr_to_pfn(mem->phys_index); |
451 | mem->phys_device = arch_get_memory_phys_device(start_pfn); | ||
447 | 452 | ||
448 | ret = register_memory(mem, section); | 453 | ret = register_memory(mem, section); |
449 | if (!ret) | 454 | if (!ret) |
@@ -515,7 +520,7 @@ int remove_memory_block(unsigned long node_id, struct mem_section *section, | |||
515 | */ | 520 | */ |
516 | int register_new_memory(int nid, struct mem_section *section) | 521 | int register_new_memory(int nid, struct mem_section *section) |
517 | { | 522 | { |
518 | return add_memory_block(nid, section, MEM_OFFLINE, 0, HOTPLUG); | 523 | return add_memory_block(nid, section, MEM_OFFLINE, HOTPLUG); |
519 | } | 524 | } |
520 | 525 | ||
521 | int unregister_memory_section(struct mem_section *section) | 526 | int unregister_memory_section(struct mem_section *section) |
@@ -548,7 +553,7 @@ int __init memory_dev_init(void) | |||
548 | if (!present_section_nr(i)) | 553 | if (!present_section_nr(i)) |
549 | continue; | 554 | continue; |
550 | err = add_memory_block(0, __nr_to_section(i), MEM_ONLINE, | 555 | err = add_memory_block(0, __nr_to_section(i), MEM_ONLINE, |
551 | 0, BOOT); | 556 | BOOT); |
552 | if (!ret) | 557 | if (!ret) |
553 | ret = err; | 558 | ret = err; |
554 | } | 559 | } |
diff --git a/drivers/base/node.c b/drivers/base/node.c index ad43185ec15a..93b3ac65c2d4 100644 --- a/drivers/base/node.c +++ b/drivers/base/node.c | |||
@@ -165,8 +165,11 @@ static ssize_t node_read_distance(struct sys_device * dev, | |||
165 | int len = 0; | 165 | int len = 0; |
166 | int i; | 166 | int i; |
167 | 167 | ||
168 | /* buf currently PAGE_SIZE, need ~4 chars per node */ | 168 | /* |
169 | BUILD_BUG_ON(MAX_NUMNODES*4 > PAGE_SIZE/2); | 169 | * buf is currently PAGE_SIZE in length and each node needs 4 chars |
170 | * at the most (distance + space or newline). | ||
171 | */ | ||
172 | BUILD_BUG_ON(MAX_NUMNODES * 4 > PAGE_SIZE); | ||
170 | 173 | ||
171 | for_each_online_node(i) | 174 | for_each_online_node(i) |
172 | len += sprintf(buf + len, "%s%d", i ? " " : "", node_distance(nid, i)); | 175 | len += sprintf(buf + len, "%s%d", i ? " " : "", node_distance(nid, i)); |
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 1ba9d617d241..4b4b565c835f 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -362,6 +362,8 @@ EXPORT_SYMBOL_GPL(platform_device_unregister); | |||
362 | * enumeration tasks, they don't fully conform to the Linux driver model. | 362 | * enumeration tasks, they don't fully conform to the Linux driver model. |
363 | * In particular, when such drivers are built as modules, they can't be | 363 | * In particular, when such drivers are built as modules, they can't be |
364 | * "hotplugged". | 364 | * "hotplugged". |
365 | * | ||
366 | * Returns &struct platform_device pointer on success, or ERR_PTR() on error. | ||
365 | */ | 367 | */ |
366 | struct platform_device *platform_device_register_simple(const char *name, | 368 | struct platform_device *platform_device_register_simple(const char *name, |
367 | int id, | 369 | int id, |
@@ -408,6 +410,8 @@ EXPORT_SYMBOL_GPL(platform_device_register_simple); | |||
408 | * allocated for the device allows drivers using such devices to be | 410 | * allocated for the device allows drivers using such devices to be |
409 | * unloaded without waiting for the last reference to the device to be | 411 | * unloaded without waiting for the last reference to the device to be |
410 | * dropped. | 412 | * dropped. |
413 | * | ||
414 | * Returns &struct platform_device pointer on success, or ERR_PTR() on error. | ||
411 | */ | 415 | */ |
412 | struct platform_device *platform_device_register_data( | 416 | struct platform_device *platform_device_register_data( |
413 | struct device *parent, | 417 | struct device *parent, |
@@ -559,6 +563,8 @@ EXPORT_SYMBOL_GPL(platform_driver_probe); | |||
559 | * | 563 | * |
560 | * Use this in legacy-style modules that probe hardware directly and | 564 | * Use this in legacy-style modules that probe hardware directly and |
561 | * register a single platform device and corresponding platform driver. | 565 | * register a single platform device and corresponding platform driver. |
566 | * | ||
567 | * Returns &struct platform_device pointer on success, or ERR_PTR() on error. | ||
562 | */ | 568 | */ |
563 | struct platform_device * __init_or_module platform_create_bundle( | 569 | struct platform_device * __init_or_module platform_create_bundle( |
564 | struct platform_driver *driver, | 570 | struct platform_driver *driver, |
@@ -1052,9 +1058,11 @@ static __initdata LIST_HEAD(early_platform_driver_list); | |||
1052 | static __initdata LIST_HEAD(early_platform_device_list); | 1058 | static __initdata LIST_HEAD(early_platform_device_list); |
1053 | 1059 | ||
1054 | /** | 1060 | /** |
1055 | * early_platform_driver_register | 1061 | * early_platform_driver_register - register early platform driver |
1056 | * @epdrv: early_platform driver structure | 1062 | * @epdrv: early_platform driver structure |
1057 | * @buf: string passed from early_param() | 1063 | * @buf: string passed from early_param() |
1064 | * | ||
1065 | * Helper function for early_platform_init() / early_platform_init_buffer() | ||
1058 | */ | 1066 | */ |
1059 | int __init early_platform_driver_register(struct early_platform_driver *epdrv, | 1067 | int __init early_platform_driver_register(struct early_platform_driver *epdrv, |
1060 | char *buf) | 1068 | char *buf) |
@@ -1106,9 +1114,12 @@ int __init early_platform_driver_register(struct early_platform_driver *epdrv, | |||
1106 | } | 1114 | } |
1107 | 1115 | ||
1108 | /** | 1116 | /** |
1109 | * early_platform_add_devices - add a numbers of early platform devices | 1117 | * early_platform_add_devices - adds a number of early platform devices |
1110 | * @devs: array of early platform devices to add | 1118 | * @devs: array of early platform devices to add |
1111 | * @num: number of early platform devices in array | 1119 | * @num: number of early platform devices in array |
1120 | * | ||
1121 | * Used by early architecture code to register early platform devices and | ||
1122 | * their platform data. | ||
1112 | */ | 1123 | */ |
1113 | void __init early_platform_add_devices(struct platform_device **devs, int num) | 1124 | void __init early_platform_add_devices(struct platform_device **devs, int num) |
1114 | { | 1125 | { |
@@ -1128,8 +1139,12 @@ void __init early_platform_add_devices(struct platform_device **devs, int num) | |||
1128 | } | 1139 | } |
1129 | 1140 | ||
1130 | /** | 1141 | /** |
1131 | * early_platform_driver_register_all | 1142 | * early_platform_driver_register_all - register early platform drivers |
1132 | * @class_str: string to identify early platform driver class | 1143 | * @class_str: string to identify early platform driver class |
1144 | * | ||
1145 | * Used by architecture code to register all early platform drivers | ||
1146 | * for a certain class. If omitted then only early platform drivers | ||
1147 | * with matching kernel command line class parameters will be registered. | ||
1133 | */ | 1148 | */ |
1134 | void __init early_platform_driver_register_all(char *class_str) | 1149 | void __init early_platform_driver_register_all(char *class_str) |
1135 | { | 1150 | { |
@@ -1151,7 +1166,7 @@ void __init early_platform_driver_register_all(char *class_str) | |||
1151 | } | 1166 | } |
1152 | 1167 | ||
1153 | /** | 1168 | /** |
1154 | * early_platform_match | 1169 | * early_platform_match - find early platform device matching driver |
1155 | * @epdrv: early platform driver structure | 1170 | * @epdrv: early platform driver structure |
1156 | * @id: id to match against | 1171 | * @id: id to match against |
1157 | */ | 1172 | */ |
@@ -1169,7 +1184,7 @@ early_platform_match(struct early_platform_driver *epdrv, int id) | |||
1169 | } | 1184 | } |
1170 | 1185 | ||
1171 | /** | 1186 | /** |
1172 | * early_platform_left | 1187 | * early_platform_left - check if early platform driver has matching devices |
1173 | * @epdrv: early platform driver structure | 1188 | * @epdrv: early platform driver structure |
1174 | * @id: return true if id or above exists | 1189 | * @id: return true if id or above exists |
1175 | */ | 1190 | */ |
@@ -1187,7 +1202,7 @@ static __init int early_platform_left(struct early_platform_driver *epdrv, | |||
1187 | } | 1202 | } |
1188 | 1203 | ||
1189 | /** | 1204 | /** |
1190 | * early_platform_driver_probe_id | 1205 | * early_platform_driver_probe_id - probe drivers matching class_str and id |
1191 | * @class_str: string to identify early platform driver class | 1206 | * @class_str: string to identify early platform driver class |
1192 | * @id: id to match against | 1207 | * @id: id to match against |
1193 | * @nr_probe: number of platform devices to successfully probe before exiting | 1208 | * @nr_probe: number of platform devices to successfully probe before exiting |
@@ -1257,10 +1272,14 @@ static int __init early_platform_driver_probe_id(char *class_str, | |||
1257 | } | 1272 | } |
1258 | 1273 | ||
1259 | /** | 1274 | /** |
1260 | * early_platform_driver_probe | 1275 | * early_platform_driver_probe - probe a class of registered drivers |
1261 | * @class_str: string to identify early platform driver class | 1276 | * @class_str: string to identify early platform driver class |
1262 | * @nr_probe: number of platform devices to successfully probe before exiting | 1277 | * @nr_probe: number of platform devices to successfully probe before exiting |
1263 | * @user_only: only probe user specified early platform devices | 1278 | * @user_only: only probe user specified early platform devices |
1279 | * | ||
1280 | * Used by architecture code to probe registered early platform drivers | ||
1281 | * within a certain class. For probe to happen a registered early platform | ||
1282 | * device matching a registered early platform driver is needed. | ||
1264 | */ | 1283 | */ |
1265 | int __init early_platform_driver_probe(char *class_str, | 1284 | int __init early_platform_driver_probe(char *class_str, |
1266 | int nr_probe, | 1285 | int nr_probe, |