diff options
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/platform.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 17b5ece8f82c..eb84d9d44645 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -160,6 +160,11 @@ static void platform_device_release(struct device *dev) | |||
160 | * | 160 | * |
161 | * Create a platform device object which can have other objects attached | 161 | * Create a platform device object which can have other objects attached |
162 | * to it, and which will have attached objects freed when it is released. | 162 | * to it, and which will have attached objects freed when it is released. |
163 | * | ||
164 | * This device will be marked as not supporting hotpluggable drivers; no | ||
165 | * device add/remove uevents will be generated. In the unusual case that | ||
166 | * the device isn't being dynamically allocated as a legacy "probe the | ||
167 | * hardware" driver, infrastructure code should reverse this marking. | ||
163 | */ | 168 | */ |
164 | struct platform_device *platform_device_alloc(const char *name, unsigned int id) | 169 | struct platform_device *platform_device_alloc(const char *name, unsigned int id) |
165 | { | 170 | { |
@@ -172,6 +177,12 @@ struct platform_device *platform_device_alloc(const char *name, unsigned int id) | |||
172 | pa->pdev.id = id; | 177 | pa->pdev.id = id; |
173 | device_initialize(&pa->pdev.dev); | 178 | device_initialize(&pa->pdev.dev); |
174 | pa->pdev.dev.release = platform_device_release; | 179 | pa->pdev.dev.release = platform_device_release; |
180 | |||
181 | /* prevent hotplug "modprobe $(MODALIAS)" from causing trouble in | ||
182 | * legacy probe-the-hardware drivers, which don't properly split | ||
183 | * out device enumeration logic from drivers. | ||
184 | */ | ||
185 | pa->pdev.dev.uevent_suppress = 1; | ||
175 | } | 186 | } |
176 | 187 | ||
177 | return pa ? &pa->pdev : NULL; | 188 | return pa ? &pa->pdev : NULL; |
@@ -351,6 +362,13 @@ EXPORT_SYMBOL_GPL(platform_device_unregister); | |||
351 | * memory allocated for the device allows drivers using such devices | 362 | * memory allocated for the device allows drivers using such devices |
352 | * to be unloaded iwithout waiting for the last reference to the device | 363 | * to be unloaded iwithout waiting for the last reference to the device |
353 | * to be dropped. | 364 | * to be dropped. |
365 | * | ||
366 | * This interface is primarily intended for use with legacy drivers | ||
367 | * which probe hardware directly. Because such drivers create sysfs | ||
368 | * device nodes themselves, rather than letting system infrastructure | ||
369 | * handle such device enumeration tasks, they don't fully conform to | ||
370 | * the Linux driver model. In particular, when such drivers are built | ||
371 | * as modules, they can't be "hotplugged". | ||
354 | */ | 372 | */ |
355 | struct platform_device *platform_device_register_simple(char *name, unsigned int id, | 373 | struct platform_device *platform_device_register_simple(char *name, unsigned int id, |
356 | struct resource *res, unsigned int num) | 374 | struct resource *res, unsigned int num) |