aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/base/Kconfig2
-rw-r--r--drivers/base/core.c16
-rw-r--r--drivers/base/cpu.c59
-rw-r--r--drivers/base/firmware_class.c132
-rw-r--r--drivers/base/memory.c143
-rw-r--r--drivers/base/platform.c8
-rw-r--r--drivers/char/pcmcia/Kconfig2
-rw-r--r--drivers/edac/Kconfig2
-rw-r--r--drivers/firmware/Kconfig1
-rw-r--r--drivers/misc/Kconfig2
-rw-r--r--drivers/pci/Kconfig2
-rw-r--r--drivers/pci/hotplug/Kconfig2
-rw-r--r--drivers/pcmcia/Kconfig1
-rw-r--r--drivers/ptp/Kconfig1
-rw-r--r--drivers/staging/media/go7007/go7007.txt1
-rw-r--r--drivers/video/geode/Kconfig2
16 files changed, 219 insertions, 157 deletions
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index 07abd9d76f7f..5daa2599ed48 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -2,7 +2,6 @@ menu "Generic Driver Options"
2 2
3config UEVENT_HELPER_PATH 3config UEVENT_HELPER_PATH
4 string "path to uevent helper" 4 string "path to uevent helper"
5 depends on HOTPLUG
6 default "" 5 default ""
7 help 6 help
8 Path to uevent helper program forked by the kernel for 7 Path to uevent helper program forked by the kernel for
@@ -23,7 +22,6 @@ config UEVENT_HELPER_PATH
23 22
24config DEVTMPFS 23config DEVTMPFS
25 bool "Maintain a devtmpfs filesystem to mount at /dev" 24 bool "Maintain a devtmpfs filesystem to mount at /dev"
26 depends on HOTPLUG
27 help 25 help
28 This creates a tmpfs/ramfs filesystem instance early at bootup. 26 This creates a tmpfs/ramfs filesystem instance early at bootup.
29 In this filesystem, the kernel driver core maintains device 27 In this filesystem, the kernel driver core maintains device
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 2499cefdcdf2..6fdc53d46fa0 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -193,12 +193,12 @@ ssize_t device_show_bool(struct device *dev, struct device_attribute *attr,
193EXPORT_SYMBOL_GPL(device_show_bool); 193EXPORT_SYMBOL_GPL(device_show_bool);
194 194
195/** 195/**
196 * device_release - free device structure. 196 * device_release - free device structure.
197 * @kobj: device's kobject. 197 * @kobj: device's kobject.
198 * 198 *
199 * This is called once the reference count for the object 199 * This is called once the reference count for the object
200 * reaches 0. We forward the call to the device's release 200 * reaches 0. We forward the call to the device's release
201 * method, which should handle actually freeing the structure. 201 * method, which should handle actually freeing the structure.
202 */ 202 */
203static void device_release(struct kobject *kobj) 203static void device_release(struct kobject *kobj)
204{ 204{
@@ -1334,8 +1334,8 @@ const char *device_get_devnode(struct device *dev,
1334/** 1334/**
1335 * device_for_each_child - device child iterator. 1335 * device_for_each_child - device child iterator.
1336 * @parent: parent struct device. 1336 * @parent: parent struct device.
1337 * @data: data for the callback.
1338 * @fn: function to be called for each device. 1337 * @fn: function to be called for each device.
1338 * @data: data for the callback.
1339 * 1339 *
1340 * Iterate over @parent's child devices, and call @fn for each, 1340 * Iterate over @parent's child devices, and call @fn for each,
1341 * passing it @data. 1341 * passing it @data.
@@ -1363,8 +1363,8 @@ int device_for_each_child(struct device *parent, void *data,
1363/** 1363/**
1364 * device_find_child - device iterator for locating a particular device. 1364 * device_find_child - device iterator for locating a particular device.
1365 * @parent: parent struct device 1365 * @parent: parent struct device
1366 * @data: Data to pass to match function
1367 * @match: Callback function to check device 1366 * @match: Callback function to check device
1367 * @data: Data to pass to match function
1368 * 1368 *
1369 * This is similar to the device_for_each_child() function above, but it 1369 * This is similar to the device_for_each_child() function above, but it
1370 * returns a reference to a device that is 'found' for later use, as 1370 * returns a reference to a device that is 'found' for later use, as
@@ -1374,6 +1374,8 @@ int device_for_each_child(struct device *parent, void *data,
1374 * if it does. If the callback returns non-zero and a reference to the 1374 * if it does. If the callback returns non-zero and a reference to the
1375 * current device can be obtained, this function will return to the caller 1375 * current device can be obtained, this function will return to the caller
1376 * and not iterate over any more devices. 1376 * and not iterate over any more devices.
1377 *
1378 * NOTE: you will need to drop the reference with put_device() after use.
1377 */ 1379 */
1378struct device *device_find_child(struct device *parent, void *data, 1380struct device *device_find_child(struct device *parent, void *data,
1379 int (*match)(struct device *dev, void *data)) 1381 int (*match)(struct device *dev, void *data))
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 3d48fc887ef4..c377673320ed 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -85,18 +85,21 @@ static ssize_t __ref store_online(struct device *dev,
85} 85}
86static DEVICE_ATTR(online, 0644, show_online, store_online); 86static DEVICE_ATTR(online, 0644, show_online, store_online);
87 87
88static void __cpuinit register_cpu_control(struct cpu *cpu) 88static struct attribute *hotplug_cpu_attrs[] = {
89{ 89 &dev_attr_online.attr,
90 device_create_file(&cpu->dev, &dev_attr_online); 90 NULL
91} 91};
92
93static struct attribute_group hotplug_cpu_attr_group = {
94 .attrs = hotplug_cpu_attrs,
95};
96
92void unregister_cpu(struct cpu *cpu) 97void unregister_cpu(struct cpu *cpu)
93{ 98{
94 int logical_cpu = cpu->dev.id; 99 int logical_cpu = cpu->dev.id;
95 100
96 unregister_cpu_under_node(logical_cpu, cpu_to_node(logical_cpu)); 101 unregister_cpu_under_node(logical_cpu, cpu_to_node(logical_cpu));
97 102
98 device_remove_file(&cpu->dev, &dev_attr_online);
99
100 device_unregister(&cpu->dev); 103 device_unregister(&cpu->dev);
101 per_cpu(cpu_sys_devices, logical_cpu) = NULL; 104 per_cpu(cpu_sys_devices, logical_cpu) = NULL;
102 return; 105 return;
@@ -122,11 +125,6 @@ static ssize_t cpu_release_store(struct device *dev,
122static DEVICE_ATTR(probe, S_IWUSR, NULL, cpu_probe_store); 125static DEVICE_ATTR(probe, S_IWUSR, NULL, cpu_probe_store);
123static DEVICE_ATTR(release, S_IWUSR, NULL, cpu_release_store); 126static DEVICE_ATTR(release, S_IWUSR, NULL, cpu_release_store);
124#endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */ 127#endif /* CONFIG_ARCH_CPU_PROBE_RELEASE */
125
126#else /* ... !CONFIG_HOTPLUG_CPU */
127static inline void register_cpu_control(struct cpu *cpu)
128{
129}
130#endif /* CONFIG_HOTPLUG_CPU */ 128#endif /* CONFIG_HOTPLUG_CPU */
131 129
132#ifdef CONFIG_KEXEC 130#ifdef CONFIG_KEXEC
@@ -164,8 +162,35 @@ static ssize_t show_crash_notes_size(struct device *dev,
164 return rc; 162 return rc;
165} 163}
166static DEVICE_ATTR(crash_notes_size, 0400, show_crash_notes_size, NULL); 164static DEVICE_ATTR(crash_notes_size, 0400, show_crash_notes_size, NULL);
165
166static struct attribute *crash_note_cpu_attrs[] = {
167 &dev_attr_crash_notes.attr,
168 &dev_attr_crash_notes_size.attr,
169 NULL
170};
171
172static struct attribute_group crash_note_cpu_attr_group = {
173 .attrs = crash_note_cpu_attrs,
174};
167#endif 175#endif
168 176
177static const struct attribute_group *common_cpu_attr_groups[] = {
178#ifdef CONFIG_KEXEC
179 &crash_note_cpu_attr_group,
180#endif
181 NULL
182};
183
184static const struct attribute_group *hotplugable_cpu_attr_groups[] = {
185#ifdef CONFIG_KEXEC
186 &crash_note_cpu_attr_group,
187#endif
188#ifdef CONFIG_HOTPLUG_CPU
189 &hotplug_cpu_attr_group,
190#endif
191 NULL
192};
193
169/* 194/*
170 * Print cpu online, possible, present, and system maps 195 * Print cpu online, possible, present, and system maps
171 */ 196 */
@@ -280,21 +305,15 @@ int __cpuinit register_cpu(struct cpu *cpu, int num)
280#ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE 305#ifdef CONFIG_ARCH_HAS_CPU_AUTOPROBE
281 cpu->dev.bus->uevent = arch_cpu_uevent; 306 cpu->dev.bus->uevent = arch_cpu_uevent;
282#endif 307#endif
308 cpu->dev.groups = common_cpu_attr_groups;
309 if (cpu->hotpluggable)
310 cpu->dev.groups = hotplugable_cpu_attr_groups;
283 error = device_register(&cpu->dev); 311 error = device_register(&cpu->dev);
284 if (!error && cpu->hotpluggable)
285 register_cpu_control(cpu);
286 if (!error) 312 if (!error)
287 per_cpu(cpu_sys_devices, num) = &cpu->dev; 313 per_cpu(cpu_sys_devices, num) = &cpu->dev;
288 if (!error) 314 if (!error)
289 register_cpu_under_node(num, cpu_to_node(num)); 315 register_cpu_under_node(num, cpu_to_node(num));
290 316
291#ifdef CONFIG_KEXEC
292 if (!error)
293 error = device_create_file(&cpu->dev, &dev_attr_crash_notes);
294 if (!error)
295 error = device_create_file(&cpu->dev,
296 &dev_attr_crash_notes_size);
297#endif
298 return error; 317 return error;
299} 318}
300 319
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 01e21037d8fe..a439602ea919 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -27,6 +27,7 @@
27#include <linux/pm.h> 27#include <linux/pm.h>
28#include <linux/suspend.h> 28#include <linux/suspend.h>
29#include <linux/syscore_ops.h> 29#include <linux/syscore_ops.h>
30#include <linux/reboot.h>
30 31
31#include <generated/utsrelease.h> 32#include <generated/utsrelease.h>
32 33
@@ -127,9 +128,11 @@ struct firmware_buf {
127 size_t size; 128 size_t size;
128#ifdef CONFIG_FW_LOADER_USER_HELPER 129#ifdef CONFIG_FW_LOADER_USER_HELPER
129 bool is_paged_buf; 130 bool is_paged_buf;
131 bool need_uevent;
130 struct page **pages; 132 struct page **pages;
131 int nr_pages; 133 int nr_pages;
132 int page_array_size; 134 int page_array_size;
135 struct list_head pending_list;
133#endif 136#endif
134 char fw_id[]; 137 char fw_id[];
135}; 138};
@@ -171,6 +174,9 @@ static struct firmware_buf *__allocate_fw_buf(const char *fw_name,
171 strcpy(buf->fw_id, fw_name); 174 strcpy(buf->fw_id, fw_name);
172 buf->fwc = fwc; 175 buf->fwc = fwc;
173 init_completion(&buf->completion); 176 init_completion(&buf->completion);
177#ifdef CONFIG_FW_LOADER_USER_HELPER
178 INIT_LIST_HEAD(&buf->pending_list);
179#endif
174 180
175 pr_debug("%s: fw-%s buf=%p\n", __func__, fw_name, buf); 181 pr_debug("%s: fw-%s buf=%p\n", __func__, fw_name, buf);
176 182
@@ -212,18 +218,6 @@ static int fw_lookup_and_allocate_buf(const char *fw_name,
212 return tmp ? 0 : -ENOMEM; 218 return tmp ? 0 : -ENOMEM;
213} 219}
214 220
215static struct firmware_buf *fw_lookup_buf(const char *fw_name)
216{
217 struct firmware_buf *tmp;
218 struct firmware_cache *fwc = &fw_cache;
219
220 spin_lock(&fwc->lock);
221 tmp = __fw_lookup_buf(fw_name);
222 spin_unlock(&fwc->lock);
223
224 return tmp;
225}
226
227static void __fw_free_buf(struct kref *ref) 221static void __fw_free_buf(struct kref *ref)
228{ 222{
229 struct firmware_buf *buf = to_fwbuf(ref); 223 struct firmware_buf *buf = to_fwbuf(ref);
@@ -446,10 +440,8 @@ static struct firmware_priv *to_firmware_priv(struct device *dev)
446 return container_of(dev, struct firmware_priv, dev); 440 return container_of(dev, struct firmware_priv, dev);
447} 441}
448 442
449static void fw_load_abort(struct firmware_priv *fw_priv) 443static void __fw_load_abort(struct firmware_buf *buf)
450{ 444{
451 struct firmware_buf *buf = fw_priv->buf;
452
453 /* 445 /*
454 * There is a small window in which user can write to 'loading' 446 * There is a small window in which user can write to 'loading'
455 * between loading done and disappearance of 'loading' 447 * between loading done and disappearance of 'loading'
@@ -457,8 +449,16 @@ static void fw_load_abort(struct firmware_priv *fw_priv)
457 if (test_bit(FW_STATUS_DONE, &buf->status)) 449 if (test_bit(FW_STATUS_DONE, &buf->status))
458 return; 450 return;
459 451
452 list_del_init(&buf->pending_list);
460 set_bit(FW_STATUS_ABORT, &buf->status); 453 set_bit(FW_STATUS_ABORT, &buf->status);
461 complete_all(&buf->completion); 454 complete_all(&buf->completion);
455}
456
457static void fw_load_abort(struct firmware_priv *fw_priv)
458{
459 struct firmware_buf *buf = fw_priv->buf;
460
461 __fw_load_abort(buf);
462 462
463 /* avoid user action after loading abort */ 463 /* avoid user action after loading abort */
464 fw_priv->buf = NULL; 464 fw_priv->buf = NULL;
@@ -467,6 +467,25 @@ static void fw_load_abort(struct firmware_priv *fw_priv)
467#define is_fw_load_aborted(buf) \ 467#define is_fw_load_aborted(buf) \
468 test_bit(FW_STATUS_ABORT, &(buf)->status) 468 test_bit(FW_STATUS_ABORT, &(buf)->status)
469 469
470static LIST_HEAD(pending_fw_head);
471
472/* reboot notifier for avoid deadlock with usermode_lock */
473static int fw_shutdown_notify(struct notifier_block *unused1,
474 unsigned long unused2, void *unused3)
475{
476 mutex_lock(&fw_lock);
477 while (!list_empty(&pending_fw_head))
478 __fw_load_abort(list_first_entry(&pending_fw_head,
479 struct firmware_buf,
480 pending_list));
481 mutex_unlock(&fw_lock);
482 return NOTIFY_DONE;
483}
484
485static struct notifier_block fw_shutdown_nb = {
486 .notifier_call = fw_shutdown_notify,
487};
488
470static ssize_t firmware_timeout_show(struct class *class, 489static ssize_t firmware_timeout_show(struct class *class,
471 struct class_attribute *attr, 490 struct class_attribute *attr,
472 char *buf) 491 char *buf)
@@ -509,8 +528,6 @@ static void fw_dev_release(struct device *dev)
509 struct firmware_priv *fw_priv = to_firmware_priv(dev); 528 struct firmware_priv *fw_priv = to_firmware_priv(dev);
510 529
511 kfree(fw_priv); 530 kfree(fw_priv);
512
513 module_put(THIS_MODULE);
514} 531}
515 532
516static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env) 533static int firmware_uevent(struct device *dev, struct kobj_uevent_env *env)
@@ -619,6 +636,7 @@ static ssize_t firmware_loading_store(struct device *dev,
619 * is completed. 636 * is completed.
620 * */ 637 * */
621 fw_map_pages_buf(fw_buf); 638 fw_map_pages_buf(fw_buf);
639 list_del_init(&fw_buf->pending_list);
622 complete_all(&fw_buf->completion); 640 complete_all(&fw_buf->completion);
623 break; 641 break;
624 } 642 }
@@ -838,9 +856,6 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent,
838 856
839 dev_set_uevent_suppress(f_dev, true); 857 dev_set_uevent_suppress(f_dev, true);
840 858
841 /* Need to pin this module until class device is destroyed */
842 __module_get(THIS_MODULE);
843
844 retval = device_add(f_dev); 859 retval = device_add(f_dev);
845 if (retval) { 860 if (retval) {
846 dev_err(f_dev, "%s: device_register failed\n", __func__); 861 dev_err(f_dev, "%s: device_register failed\n", __func__);
@@ -860,6 +875,7 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent,
860 } 875 }
861 876
862 if (uevent) { 877 if (uevent) {
878 buf->need_uevent = true;
863 dev_set_uevent_suppress(f_dev, false); 879 dev_set_uevent_suppress(f_dev, false);
864 dev_dbg(f_dev, "firmware: requesting %s\n", buf->fw_id); 880 dev_dbg(f_dev, "firmware: requesting %s\n", buf->fw_id);
865 if (timeout != MAX_SCHEDULE_TIMEOUT) 881 if (timeout != MAX_SCHEDULE_TIMEOUT)
@@ -868,6 +884,10 @@ static int _request_firmware_load(struct firmware_priv *fw_priv, bool uevent,
868 kobject_uevent(&fw_priv->dev.kobj, KOBJ_ADD); 884 kobject_uevent(&fw_priv->dev.kobj, KOBJ_ADD);
869 } 885 }
870 886
887 mutex_lock(&fw_lock);
888 list_add(&buf->pending_list, &pending_fw_head);
889 mutex_unlock(&fw_lock);
890
871 wait_for_completion(&buf->completion); 891 wait_for_completion(&buf->completion);
872 892
873 cancel_delayed_work_sync(&fw_priv->timeout_work); 893 cancel_delayed_work_sync(&fw_priv->timeout_work);
@@ -895,6 +915,23 @@ static int fw_load_from_user_helper(struct firmware *firmware,
895 fw_priv->buf = firmware->priv; 915 fw_priv->buf = firmware->priv;
896 return _request_firmware_load(fw_priv, uevent, timeout); 916 return _request_firmware_load(fw_priv, uevent, timeout);
897} 917}
918
919#ifdef CONFIG_PM_SLEEP
920/* kill pending requests without uevent to avoid blocking suspend */
921static void kill_requests_without_uevent(void)
922{
923 struct firmware_buf *buf;
924 struct firmware_buf *next;
925
926 mutex_lock(&fw_lock);
927 list_for_each_entry_safe(buf, next, &pending_fw_head, pending_list) {
928 if (!buf->need_uevent)
929 __fw_load_abort(buf);
930 }
931 mutex_unlock(&fw_lock);
932}
933#endif
934
898#else /* CONFIG_FW_LOADER_USER_HELPER */ 935#else /* CONFIG_FW_LOADER_USER_HELPER */
899static inline int 936static inline int
900fw_load_from_user_helper(struct firmware *firmware, const char *name, 937fw_load_from_user_helper(struct firmware *firmware, const char *name,
@@ -907,6 +944,10 @@ fw_load_from_user_helper(struct firmware *firmware, const char *name,
907/* No abort during direct loading */ 944/* No abort during direct loading */
908#define is_fw_load_aborted(buf) false 945#define is_fw_load_aborted(buf) false
909 946
947#ifdef CONFIG_PM_SLEEP
948static inline void kill_requests_without_uevent(void) { }
949#endif
950
910#endif /* CONFIG_FW_LOADER_USER_HELPER */ 951#endif /* CONFIG_FW_LOADER_USER_HELPER */
911 952
912 953
@@ -974,7 +1015,8 @@ _request_firmware_prepare(struct firmware **firmware_p, const char *name,
974 return 1; /* need to load */ 1015 return 1; /* need to load */
975} 1016}
976 1017
977static int assign_firmware_buf(struct firmware *fw, struct device *device) 1018static int assign_firmware_buf(struct firmware *fw, struct device *device,
1019 bool skip_cache)
978{ 1020{
979 struct firmware_buf *buf = fw->priv; 1021 struct firmware_buf *buf = fw->priv;
980 1022
@@ -991,7 +1033,7 @@ static int assign_firmware_buf(struct firmware *fw, struct device *device)
991 * device may has been deleted already, but the problem 1033 * device may has been deleted already, but the problem
992 * should be fixed in devres or driver core. 1034 * should be fixed in devres or driver core.
993 */ 1035 */
994 if (device) 1036 if (device && !skip_cache)
995 fw_add_devm_name(device, buf->fw_id); 1037 fw_add_devm_name(device, buf->fw_id);
996 1038
997 /* 1039 /*
@@ -1047,8 +1089,10 @@ _request_firmware(const struct firmware **firmware_p, const char *name,
1047 if (!fw_get_filesystem_firmware(device, fw->priv)) 1089 if (!fw_get_filesystem_firmware(device, fw->priv))
1048 ret = fw_load_from_user_helper(fw, name, device, 1090 ret = fw_load_from_user_helper(fw, name, device,
1049 uevent, nowait, timeout); 1091 uevent, nowait, timeout);
1092
1093 /* don't cache firmware handled without uevent */
1050 if (!ret) 1094 if (!ret)
1051 ret = assign_firmware_buf(fw, device); 1095 ret = assign_firmware_buf(fw, device, !uevent);
1052 1096
1053 usermodehelper_read_unlock(); 1097 usermodehelper_read_unlock();
1054 1098
@@ -1086,8 +1130,15 @@ int
1086request_firmware(const struct firmware **firmware_p, const char *name, 1130request_firmware(const struct firmware **firmware_p, const char *name,
1087 struct device *device) 1131 struct device *device)
1088{ 1132{
1089 return _request_firmware(firmware_p, name, device, true, false); 1133 int ret;
1134
1135 /* Need to pin this module until return */
1136 __module_get(THIS_MODULE);
1137 ret = _request_firmware(firmware_p, name, device, true, false);
1138 module_put(THIS_MODULE);
1139 return ret;
1090} 1140}
1141EXPORT_SYMBOL(request_firmware);
1091 1142
1092/** 1143/**
1093 * release_firmware: - release the resource associated with a firmware image 1144 * release_firmware: - release the resource associated with a firmware image
@@ -1101,6 +1152,7 @@ void release_firmware(const struct firmware *fw)
1101 kfree(fw); 1152 kfree(fw);
1102 } 1153 }
1103} 1154}
1155EXPORT_SYMBOL(release_firmware);
1104 1156
1105/* Async support */ 1157/* Async support */
1106struct firmware_work { 1158struct firmware_work {
@@ -1181,6 +1233,10 @@ request_firmware_nowait(
1181 schedule_work(&fw_work->work); 1233 schedule_work(&fw_work->work);
1182 return 0; 1234 return 0;
1183} 1235}
1236EXPORT_SYMBOL(request_firmware_nowait);
1237
1238#ifdef CONFIG_PM_SLEEP
1239static ASYNC_DOMAIN_EXCLUSIVE(fw_cache_domain);
1184 1240
1185/** 1241/**
1186 * cache_firmware - cache one firmware image in kernel memory space 1242 * cache_firmware - cache one firmware image in kernel memory space
@@ -1196,7 +1252,7 @@ request_firmware_nowait(
1196 * Return !0 otherwise 1252 * Return !0 otherwise
1197 * 1253 *
1198 */ 1254 */
1199int cache_firmware(const char *fw_name) 1255static int cache_firmware(const char *fw_name)
1200{ 1256{
1201 int ret; 1257 int ret;
1202 const struct firmware *fw; 1258 const struct firmware *fw;
@@ -1212,6 +1268,18 @@ int cache_firmware(const char *fw_name)
1212 return ret; 1268 return ret;
1213} 1269}
1214 1270
1271static struct firmware_buf *fw_lookup_buf(const char *fw_name)
1272{
1273 struct firmware_buf *tmp;
1274 struct firmware_cache *fwc = &fw_cache;
1275
1276 spin_lock(&fwc->lock);
1277 tmp = __fw_lookup_buf(fw_name);
1278 spin_unlock(&fwc->lock);
1279
1280 return tmp;
1281}
1282
1215/** 1283/**
1216 * uncache_firmware - remove one cached firmware image 1284 * uncache_firmware - remove one cached firmware image
1217 * @fw_name: the firmware image name 1285 * @fw_name: the firmware image name
@@ -1223,7 +1291,7 @@ int cache_firmware(const char *fw_name)
1223 * Return !0 otherwise 1291 * Return !0 otherwise
1224 * 1292 *
1225 */ 1293 */
1226int uncache_firmware(const char *fw_name) 1294static int uncache_firmware(const char *fw_name)
1227{ 1295{
1228 struct firmware_buf *buf; 1296 struct firmware_buf *buf;
1229 struct firmware fw; 1297 struct firmware fw;
@@ -1242,9 +1310,6 @@ int uncache_firmware(const char *fw_name)
1242 return -EINVAL; 1310 return -EINVAL;
1243} 1311}
1244 1312
1245#ifdef CONFIG_PM_SLEEP
1246static ASYNC_DOMAIN_EXCLUSIVE(fw_cache_domain);
1247
1248static struct fw_cache_entry *alloc_fw_cache_entry(const char *name) 1313static struct fw_cache_entry *alloc_fw_cache_entry(const char *name)
1249{ 1314{
1250 struct fw_cache_entry *fce; 1315 struct fw_cache_entry *fce;
@@ -1464,6 +1529,7 @@ static int fw_pm_notify(struct notifier_block *notify_block,
1464 switch (mode) { 1529 switch (mode) {
1465 case PM_HIBERNATION_PREPARE: 1530 case PM_HIBERNATION_PREPARE:
1466 case PM_SUSPEND_PREPARE: 1531 case PM_SUSPEND_PREPARE:
1532 kill_requests_without_uevent();
1467 device_cache_fw_images(); 1533 device_cache_fw_images();
1468 break; 1534 break;
1469 1535
@@ -1526,6 +1592,7 @@ static int __init firmware_class_init(void)
1526{ 1592{
1527 fw_cache_init(); 1593 fw_cache_init();
1528#ifdef CONFIG_FW_LOADER_USER_HELPER 1594#ifdef CONFIG_FW_LOADER_USER_HELPER
1595 register_reboot_notifier(&fw_shutdown_nb);
1529 return class_register(&firmware_class); 1596 return class_register(&firmware_class);
1530#else 1597#else
1531 return 0; 1598 return 0;
@@ -1539,15 +1606,10 @@ static void __exit firmware_class_exit(void)
1539 unregister_pm_notifier(&fw_cache.pm_notify); 1606 unregister_pm_notifier(&fw_cache.pm_notify);
1540#endif 1607#endif
1541#ifdef CONFIG_FW_LOADER_USER_HELPER 1608#ifdef CONFIG_FW_LOADER_USER_HELPER
1609 unregister_reboot_notifier(&fw_shutdown_nb);
1542 class_unregister(&firmware_class); 1610 class_unregister(&firmware_class);
1543#endif 1611#endif
1544} 1612}
1545 1613
1546fs_initcall(firmware_class_init); 1614fs_initcall(firmware_class_init);
1547module_exit(firmware_class_exit); 1615module_exit(firmware_class_exit);
1548
1549EXPORT_SYMBOL(release_firmware);
1550EXPORT_SYMBOL(request_firmware);
1551EXPORT_SYMBOL(request_firmware_nowait);
1552EXPORT_SYMBOL_GPL(cache_firmware);
1553EXPORT_SYMBOL_GPL(uncache_firmware);
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 14f8a6954da0..e315051cfeeb 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -77,22 +77,6 @@ static void memory_block_release(struct device *dev)
77 kfree(mem); 77 kfree(mem);
78} 78}
79 79
80/*
81 * register_memory - Setup a sysfs device for a memory block
82 */
83static
84int register_memory(struct memory_block *memory)
85{
86 int error;
87
88 memory->dev.bus = &memory_subsys;
89 memory->dev.id = memory->start_section_nr / sections_per_block;
90 memory->dev.release = memory_block_release;
91
92 error = device_register(&memory->dev);
93 return error;
94}
95
96unsigned long __weak memory_block_size_bytes(void) 80unsigned long __weak memory_block_size_bytes(void)
97{ 81{
98 return MIN_MEMORY_BLOCK_SIZE; 82 return MIN_MEMORY_BLOCK_SIZE;
@@ -371,11 +355,6 @@ static DEVICE_ATTR(state, 0644, show_mem_state, store_mem_state);
371static DEVICE_ATTR(phys_device, 0444, show_phys_device, NULL); 355static DEVICE_ATTR(phys_device, 0444, show_phys_device, NULL);
372static DEVICE_ATTR(removable, 0444, show_mem_removable, NULL); 356static DEVICE_ATTR(removable, 0444, show_mem_removable, NULL);
373 357
374#define mem_create_simple_file(mem, attr_name) \
375 device_create_file(&mem->dev, &dev_attr_##attr_name)
376#define mem_remove_simple_file(mem, attr_name) \
377 device_remove_file(&mem->dev, &dev_attr_##attr_name)
378
379/* 358/*
380 * Block size attribute stuff 359 * Block size attribute stuff
381 */ 360 */
@@ -388,12 +367,6 @@ print_block_size(struct device *dev, struct device_attribute *attr,
388 367
389static DEVICE_ATTR(block_size_bytes, 0444, print_block_size, NULL); 368static DEVICE_ATTR(block_size_bytes, 0444, print_block_size, NULL);
390 369
391static int block_size_init(void)
392{
393 return device_create_file(memory_subsys.dev_root,
394 &dev_attr_block_size_bytes);
395}
396
397/* 370/*
398 * Some architectures will have custom drivers to do this, and 371 * Some architectures will have custom drivers to do this, and
399 * will not need to do it from userspace. The fake hot-add code 372 * will not need to do it from userspace. The fake hot-add code
@@ -429,17 +402,8 @@ memory_probe_store(struct device *dev, struct device_attribute *attr,
429out: 402out:
430 return ret; 403 return ret;
431} 404}
432static DEVICE_ATTR(probe, S_IWUSR, NULL, memory_probe_store);
433 405
434static int memory_probe_init(void) 406static DEVICE_ATTR(probe, S_IWUSR, NULL, memory_probe_store);
435{
436 return device_create_file(memory_subsys.dev_root, &dev_attr_probe);
437}
438#else
439static inline int memory_probe_init(void)
440{
441 return 0;
442}
443#endif 407#endif
444 408
445#ifdef CONFIG_MEMORY_FAILURE 409#ifdef CONFIG_MEMORY_FAILURE
@@ -485,23 +449,6 @@ store_hard_offline_page(struct device *dev,
485 449
486static DEVICE_ATTR(soft_offline_page, S_IWUSR, NULL, store_soft_offline_page); 450static DEVICE_ATTR(soft_offline_page, S_IWUSR, NULL, store_soft_offline_page);
487static DEVICE_ATTR(hard_offline_page, S_IWUSR, NULL, store_hard_offline_page); 451static DEVICE_ATTR(hard_offline_page, S_IWUSR, NULL, store_hard_offline_page);
488
489static __init int memory_fail_init(void)
490{
491 int err;
492
493 err = device_create_file(memory_subsys.dev_root,
494 &dev_attr_soft_offline_page);
495 if (!err)
496 err = device_create_file(memory_subsys.dev_root,
497 &dev_attr_hard_offline_page);
498 return err;
499}
500#else
501static inline int memory_fail_init(void)
502{
503 return 0;
504}
505#endif 452#endif
506 453
507/* 454/*
@@ -546,6 +493,41 @@ struct memory_block *find_memory_block(struct mem_section *section)
546 return find_memory_block_hinted(section, NULL); 493 return find_memory_block_hinted(section, NULL);
547} 494}
548 495
496static struct attribute *memory_memblk_attrs[] = {
497 &dev_attr_phys_index.attr,
498 &dev_attr_end_phys_index.attr,
499 &dev_attr_state.attr,
500 &dev_attr_phys_device.attr,
501 &dev_attr_removable.attr,
502 NULL
503};
504
505static struct attribute_group memory_memblk_attr_group = {
506 .attrs = memory_memblk_attrs,
507};
508
509static const struct attribute_group *memory_memblk_attr_groups[] = {
510 &memory_memblk_attr_group,
511 NULL,
512};
513
514/*
515 * register_memory - Setup a sysfs device for a memory block
516 */
517static
518int register_memory(struct memory_block *memory)
519{
520 int error;
521
522 memory->dev.bus = &memory_subsys;
523 memory->dev.id = memory->start_section_nr / sections_per_block;
524 memory->dev.release = memory_block_release;
525 memory->dev.groups = memory_memblk_attr_groups;
526
527 error = device_register(&memory->dev);
528 return error;
529}
530
549static int init_memory_block(struct memory_block **memory, 531static int init_memory_block(struct memory_block **memory,
550 struct mem_section *section, unsigned long state) 532 struct mem_section *section, unsigned long state)
551{ 533{
@@ -569,16 +551,6 @@ static int init_memory_block(struct memory_block **memory,
569 mem->phys_device = arch_get_memory_phys_device(start_pfn); 551 mem->phys_device = arch_get_memory_phys_device(start_pfn);
570 552
571 ret = register_memory(mem); 553 ret = register_memory(mem);
572 if (!ret)
573 ret = mem_create_simple_file(mem, phys_index);
574 if (!ret)
575 ret = mem_create_simple_file(mem, end_phys_index);
576 if (!ret)
577 ret = mem_create_simple_file(mem, state);
578 if (!ret)
579 ret = mem_create_simple_file(mem, phys_device);
580 if (!ret)
581 ret = mem_create_simple_file(mem, removable);
582 554
583 *memory = mem; 555 *memory = mem;
584 return ret; 556 return ret;
@@ -656,14 +628,9 @@ static int remove_memory_block(unsigned long node_id,
656 unregister_mem_sect_under_nodes(mem, __section_nr(section)); 628 unregister_mem_sect_under_nodes(mem, __section_nr(section));
657 629
658 mem->section_count--; 630 mem->section_count--;
659 if (mem->section_count == 0) { 631 if (mem->section_count == 0)
660 mem_remove_simple_file(mem, phys_index);
661 mem_remove_simple_file(mem, end_phys_index);
662 mem_remove_simple_file(mem, state);
663 mem_remove_simple_file(mem, phys_device);
664 mem_remove_simple_file(mem, removable);
665 unregister_memory(mem); 632 unregister_memory(mem);
666 } else 633 else
667 kobject_put(&mem->dev.kobj); 634 kobject_put(&mem->dev.kobj);
668 635
669 mutex_unlock(&mem_sysfs_mutex); 636 mutex_unlock(&mem_sysfs_mutex);
@@ -700,6 +667,29 @@ bool is_memblock_offlined(struct memory_block *mem)
700 return mem->state == MEM_OFFLINE; 667 return mem->state == MEM_OFFLINE;
701} 668}
702 669
670static struct attribute *memory_root_attrs[] = {
671#ifdef CONFIG_ARCH_MEMORY_PROBE
672 &dev_attr_probe.attr,
673#endif
674
675#ifdef CONFIG_MEMORY_FAILURE
676 &dev_attr_soft_offline_page.attr,
677 &dev_attr_hard_offline_page.attr,
678#endif
679
680 &dev_attr_block_size_bytes.attr,
681 NULL
682};
683
684static struct attribute_group memory_root_attr_group = {
685 .attrs = memory_root_attrs,
686};
687
688static const struct attribute_group *memory_root_attr_groups[] = {
689 &memory_root_attr_group,
690 NULL,
691};
692
703/* 693/*
704 * Initialize the sysfs support for memory devices... 694 * Initialize the sysfs support for memory devices...
705 */ 695 */
@@ -711,7 +701,7 @@ int __init memory_dev_init(void)
711 unsigned long block_sz; 701 unsigned long block_sz;
712 struct memory_block *mem = NULL; 702 struct memory_block *mem = NULL;
713 703
714 ret = subsys_system_register(&memory_subsys, NULL); 704 ret = subsys_system_register(&memory_subsys, memory_root_attr_groups);
715 if (ret) 705 if (ret)
716 goto out; 706 goto out;
717 707
@@ -734,15 +724,6 @@ int __init memory_dev_init(void)
734 ret = err; 724 ret = err;
735 } 725 }
736 726
737 err = memory_probe_init();
738 if (!ret)
739 ret = err;
740 err = memory_fail_init();
741 if (!ret)
742 ret = err;
743 err = block_size_init();
744 if (!ret)
745 ret = err;
746out: 727out:
747 if (ret) 728 if (ret)
748 printk(KERN_ERR "%s() failed: %d\n", __func__, ret); 729 printk(KERN_ERR "%s() failed: %d\n", __func__, ret);
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 9eda84246ffd..ed75cf6ef9c9 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -523,11 +523,13 @@ static void platform_drv_shutdown(struct device *_dev)
523} 523}
524 524
525/** 525/**
526 * platform_driver_register - register a driver for platform-level devices 526 * __platform_driver_register - register a driver for platform-level devices
527 * @drv: platform driver structure 527 * @drv: platform driver structure
528 */ 528 */
529int platform_driver_register(struct platform_driver *drv) 529int __platform_driver_register(struct platform_driver *drv,
530 struct module *owner)
530{ 531{
532 drv->driver.owner = owner;
531 drv->driver.bus = &platform_bus_type; 533 drv->driver.bus = &platform_bus_type;
532 if (drv->probe) 534 if (drv->probe)
533 drv->driver.probe = platform_drv_probe; 535 drv->driver.probe = platform_drv_probe;
@@ -538,7 +540,7 @@ int platform_driver_register(struct platform_driver *drv)
538 540
539 return driver_register(&drv->driver); 541 return driver_register(&drv->driver);
540} 542}
541EXPORT_SYMBOL_GPL(platform_driver_register); 543EXPORT_SYMBOL_GPL(__platform_driver_register);
542 544
543/** 545/**
544 * platform_driver_unregister - unregister a driver for platform-level devices 546 * platform_driver_unregister - unregister a driver for platform-level devices
diff --git a/drivers/char/pcmcia/Kconfig b/drivers/char/pcmcia/Kconfig
index 2a166d56738a..b27f5342fe76 100644
--- a/drivers/char/pcmcia/Kconfig
+++ b/drivers/char/pcmcia/Kconfig
@@ -3,7 +3,7 @@
3# 3#
4 4
5menu "PCMCIA character devices" 5menu "PCMCIA character devices"
6 depends on HOTPLUG && PCMCIA!=n 6 depends on PCMCIA!=n
7 7
8config SYNCLINK_CS 8config SYNCLINK_CS
9 tristate "SyncLink PC Card support" 9 tristate "SyncLink PC Card support"
diff --git a/drivers/edac/Kconfig b/drivers/edac/Kconfig
index e443f2c1dfd1..a697a64d5383 100644
--- a/drivers/edac/Kconfig
+++ b/drivers/edac/Kconfig
@@ -145,7 +145,7 @@ config EDAC_E7XXX
145 145
146config EDAC_E752X 146config EDAC_E752X
147 tristate "Intel e752x (e7520, e7525, e7320) and 3100" 147 tristate "Intel e752x (e7520, e7525, e7320) and 3100"
148 depends on EDAC_MM_EDAC && PCI && X86 && HOTPLUG 148 depends on EDAC_MM_EDAC && PCI && X86
149 help 149 help
150 Support for error detection and correction on the Intel 150 Support for error detection and correction on the Intel
151 E7520, E7525, E7320 server chipsets. 151 E7520, E7525, E7320 server chipsets.
diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index 93876302fb2e..074787281c94 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -64,6 +64,7 @@ config DELL_RBU
64 tristate "BIOS update support for DELL systems via sysfs" 64 tristate "BIOS update support for DELL systems via sysfs"
65 depends on X86 65 depends on X86
66 select FW_LOADER 66 select FW_LOADER
67 select FW_LOADER_USER_HELPER
67 help 68 help
68 Say m if you want to have the option of updating the BIOS for your 69 Say m if you want to have the option of updating the BIOS for your
69 DELL system. Note you need a Dell OpenManage or Dell Update package (DUP) 70 DELL system. Note you need a Dell OpenManage or Dell Update package (DUP)
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 80889d5f95f5..8dacd4c9ee87 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -135,7 +135,7 @@ config PHANTOM
135 135
136config INTEL_MID_PTI 136config INTEL_MID_PTI
137 tristate "Parallel Trace Interface for MIPI P1149.7 cJTAG standard" 137 tristate "Parallel Trace Interface for MIPI P1149.7 cJTAG standard"
138 depends on PCI && TTY 138 depends on PCI && TTY && (X86_INTEL_MID || COMPILE_TEST)
139 default n 139 default n
140 help 140 help
141 The PTI (Parallel Trace Interface) driver directs 141 The PTI (Parallel Trace Interface) driver directs
diff --git a/drivers/pci/Kconfig b/drivers/pci/Kconfig
index 6d51aa68ec7a..77497f140d68 100644
--- a/drivers/pci/Kconfig
+++ b/drivers/pci/Kconfig
@@ -55,7 +55,6 @@ config PCI_STUB
55config XEN_PCIDEV_FRONTEND 55config XEN_PCIDEV_FRONTEND
56 tristate "Xen PCI Frontend" 56 tristate "Xen PCI Frontend"
57 depends on PCI && X86 && XEN 57 depends on PCI && X86 && XEN
58 select HOTPLUG
59 select PCI_XEN 58 select PCI_XEN
60 select XEN_XENBUS_FRONTEND 59 select XEN_XENBUS_FRONTEND
61 default y 60 default y
@@ -113,7 +112,6 @@ config PCI_IOAPIC
113 tristate "PCI IO-APIC hotplug support" if X86 112 tristate "PCI IO-APIC hotplug support" if X86
114 depends on PCI 113 depends on PCI
115 depends on ACPI 114 depends on ACPI
116 depends on HOTPLUG
117 default !X86 115 default !X86
118 116
119config PCI_LABEL 117config PCI_LABEL
diff --git a/drivers/pci/hotplug/Kconfig b/drivers/pci/hotplug/Kconfig
index 9fcb87f353d4..bb7ebb22db01 100644
--- a/drivers/pci/hotplug/Kconfig
+++ b/drivers/pci/hotplug/Kconfig
@@ -4,7 +4,7 @@
4 4
5menuconfig HOTPLUG_PCI 5menuconfig HOTPLUG_PCI
6 tristate "Support for PCI Hotplug" 6 tristate "Support for PCI Hotplug"
7 depends on PCI && HOTPLUG && SYSFS 7 depends on PCI && SYSFS
8 ---help--- 8 ---help---
9 Say Y here if you have a motherboard with a PCI Hotplug controller. 9 Say Y here if you have a motherboard with a PCI Hotplug controller.
10 This allows you to add and remove PCI cards while the machine is 10 This allows you to add and remove PCI cards while the machine is
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig
index 6f6193168281..0c657d6af03d 100644
--- a/drivers/pcmcia/Kconfig
+++ b/drivers/pcmcia/Kconfig
@@ -4,7 +4,6 @@
4 4
5menuconfig PCCARD 5menuconfig PCCARD
6 tristate "PCCard (PCMCIA/CardBus) support" 6 tristate "PCCard (PCMCIA/CardBus) support"
7 depends on HOTPLUG
8 ---help--- 7 ---help---
9 Say Y here if you want to attach PCMCIA- or PC-cards to your Linux 8 Say Y here if you want to attach PCMCIA- or PC-cards to your Linux
10 computer. These are credit-card size devices such as network cards, 9 computer. These are credit-card size devices such as network cards,
diff --git a/drivers/ptp/Kconfig b/drivers/ptp/Kconfig
index 1ea6f1dbbedd..5be73ba0519a 100644
--- a/drivers/ptp/Kconfig
+++ b/drivers/ptp/Kconfig
@@ -72,6 +72,7 @@ config DP83640_PHY
72 72
73config PTP_1588_CLOCK_PCH 73config PTP_1588_CLOCK_PCH
74 tristate "Intel PCH EG20T as PTP clock" 74 tristate "Intel PCH EG20T as PTP clock"
75 depends on X86 || COMPILE_TEST
75 select PTP_1588_CLOCK 76 select PTP_1588_CLOCK
76 help 77 help
77 This driver adds support for using the PCH EG20T as a PTP 78 This driver adds support for using the PCH EG20T as a PTP
diff --git a/drivers/staging/media/go7007/go7007.txt b/drivers/staging/media/go7007/go7007.txt
index fcb3e235abbf..dc0026cff9f6 100644
--- a/drivers/staging/media/go7007/go7007.txt
+++ b/drivers/staging/media/go7007/go7007.txt
@@ -78,7 +78,6 @@ All vendor-built kernels should already be configured properly. However,
78for custom-built kernels, the following options need to be enabled in the 78for custom-built kernels, the following options need to be enabled in the
79kernel as built-in or modules: 79kernel as built-in or modules:
80 80
81 CONFIG_HOTPLUG - Support for hot-pluggable devices
82 CONFIG_MODULES - Enable loadable module support 81 CONFIG_MODULES - Enable loadable module support
83 CONFIG_KMOD - Automatic kernel module loading 82 CONFIG_KMOD - Automatic kernel module loading
84 CONFIG_FW_LOADER - Hotplug firmware loading support 83 CONFIG_FW_LOADER - Hotplug firmware loading support
diff --git a/drivers/video/geode/Kconfig b/drivers/video/geode/Kconfig
index 21e351a14593..1e8555284786 100644
--- a/drivers/video/geode/Kconfig
+++ b/drivers/video/geode/Kconfig
@@ -3,7 +3,7 @@
3# 3#
4config FB_GEODE 4config FB_GEODE
5 bool "AMD Geode family framebuffer support" 5 bool "AMD Geode family framebuffer support"
6 depends on FB && PCI && X86 6 depends on FB && PCI && (X86_32 || (X86 && COMPILE_TEST))
7 ---help--- 7 ---help---
8 Say 'Y' here to allow you to select framebuffer drivers for 8 Say 'Y' here to allow you to select framebuffer drivers for
9 the AMD Geode family of processors. 9 the AMD Geode family of processors.