diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-16 15:40:26 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-16 15:40:26 -0400 |
commit | c813b4e16ead3c3df98ac84419d4df2adf33fe01 (patch) | |
tree | 2ca4a5b6966d833b6149e3dda7a4e85d1255779c /drivers/base/platform.c | |
parent | c8d8a2321f9c4ee18fbcc399fdc2a77e580a03b9 (diff) | |
parent | 02683ffdf655b4ae15245376ba6fea6d9e5829a6 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (46 commits)
UIO: Fix mapping of logical and virtual memory
UIO: add automata sercos3 pci card support
UIO: Change driver name of uio_pdrv
UIO: Add alignment warnings for uio-mem
Driver core: add bus_sort_breadthfirst() function
NET: convert the phy_device file to use bus_find_device_by_name
kobject: Cleanup kobject_rename and !CONFIG_SYSFS
kobject: Fix kobject_rename and !CONFIG_SYSFS
sysfs: Make dir and name args to sysfs_notify() const
platform: add new device registration helper
sysfs: use ilookup5() instead of ilookup5_nowait()
PNP: create device attributes via default device attributes
Driver core: make bus_find_device_by_name() more robust
usb: turn dev_warn+WARN_ON combos into dev_WARN
debug: use dev_WARN() rather than WARN_ON() in device_pm_add()
debug: Introduce a dev_WARN() function
sysfs: fix deadlock
device model: Do a quickcheck for driver binding before doing an expensive check
Driver core: Fix cleanup in device_create_vargs().
Driver core: Clarify device cleanup.
...
Diffstat (limited to 'drivers/base/platform.c')
-rw-r--r-- | drivers/base/platform.c | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 66b710c28812..dfcbfe504867 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c | |||
@@ -394,6 +394,53 @@ error: | |||
394 | } | 394 | } |
395 | EXPORT_SYMBOL_GPL(platform_device_register_simple); | 395 | EXPORT_SYMBOL_GPL(platform_device_register_simple); |
396 | 396 | ||
397 | /** | ||
398 | * platform_device_register_data | ||
399 | * @parent: parent device for the device we're adding | ||
400 | * @name: base name of the device we're adding | ||
401 | * @id: instance id | ||
402 | * @data: platform specific data for this platform device | ||
403 | * @size: size of platform specific data | ||
404 | * | ||
405 | * This function creates a simple platform device that requires minimal | ||
406 | * resource and memory management. Canned release function freeing memory | ||
407 | * allocated for the device allows drivers using such devices to be | ||
408 | * unloaded without waiting for the last reference to the device to be | ||
409 | * dropped. | ||
410 | */ | ||
411 | struct platform_device *platform_device_register_data( | ||
412 | struct device *parent, | ||
413 | const char *name, int id, | ||
414 | const void *data, size_t size) | ||
415 | { | ||
416 | struct platform_device *pdev; | ||
417 | int retval; | ||
418 | |||
419 | pdev = platform_device_alloc(name, id); | ||
420 | if (!pdev) { | ||
421 | retval = -ENOMEM; | ||
422 | goto error; | ||
423 | } | ||
424 | |||
425 | pdev->dev.parent = parent; | ||
426 | |||
427 | if (size) { | ||
428 | retval = platform_device_add_data(pdev, data, size); | ||
429 | if (retval) | ||
430 | goto error; | ||
431 | } | ||
432 | |||
433 | retval = platform_device_add(pdev); | ||
434 | if (retval) | ||
435 | goto error; | ||
436 | |||
437 | return pdev; | ||
438 | |||
439 | error: | ||
440 | platform_device_put(pdev); | ||
441 | return ERR_PTR(retval); | ||
442 | } | ||
443 | |||
397 | static int platform_drv_probe(struct device *_dev) | 444 | static int platform_drv_probe(struct device *_dev) |
398 | { | 445 | { |
399 | struct platform_driver *drv = to_platform_driver(_dev->driver); | 446 | struct platform_driver *drv = to_platform_driver(_dev->driver); |
@@ -865,7 +912,7 @@ static int platform_pm_restore_noirq(struct device *dev) | |||
865 | 912 | ||
866 | #endif /* !CONFIG_HIBERNATION */ | 913 | #endif /* !CONFIG_HIBERNATION */ |
867 | 914 | ||
868 | struct pm_ext_ops platform_pm_ops = { | 915 | static struct pm_ext_ops platform_pm_ops = { |
869 | .base = { | 916 | .base = { |
870 | .prepare = platform_pm_prepare, | 917 | .prepare = platform_pm_prepare, |
871 | .complete = platform_pm_complete, | 918 | .complete = platform_pm_complete, |