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. ...
This commit is contained in:
@@ -394,6 +394,53 @@ error:
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(platform_device_register_simple);
|
||||
|
||||
/**
|
||||
* platform_device_register_data
|
||||
* @parent: parent device for the device we're adding
|
||||
* @name: base name of the device we're adding
|
||||
* @id: instance id
|
||||
* @data: platform specific data for this platform device
|
||||
* @size: size of platform specific data
|
||||
*
|
||||
* This function creates a simple platform device that requires minimal
|
||||
* resource and memory management. Canned release function freeing memory
|
||||
* allocated for the device allows drivers using such devices to be
|
||||
* unloaded without waiting for the last reference to the device to be
|
||||
* dropped.
|
||||
*/
|
||||
struct platform_device *platform_device_register_data(
|
||||
struct device *parent,
|
||||
const char *name, int id,
|
||||
const void *data, size_t size)
|
||||
{
|
||||
struct platform_device *pdev;
|
||||
int retval;
|
||||
|
||||
pdev = platform_device_alloc(name, id);
|
||||
if (!pdev) {
|
||||
retval = -ENOMEM;
|
||||
goto error;
|
||||
}
|
||||
|
||||
pdev->dev.parent = parent;
|
||||
|
||||
if (size) {
|
||||
retval = platform_device_add_data(pdev, data, size);
|
||||
if (retval)
|
||||
goto error;
|
||||
}
|
||||
|
||||
retval = platform_device_add(pdev);
|
||||
if (retval)
|
||||
goto error;
|
||||
|
||||
return pdev;
|
||||
|
||||
error:
|
||||
platform_device_put(pdev);
|
||||
return ERR_PTR(retval);
|
||||
}
|
||||
|
||||
static int platform_drv_probe(struct device *_dev)
|
||||
{
|
||||
struct platform_driver *drv = to_platform_driver(_dev->driver);
|
||||
@@ -865,7 +912,7 @@ static int platform_pm_restore_noirq(struct device *dev)
|
||||
|
||||
#endif /* !CONFIG_HIBERNATION */
|
||||
|
||||
struct pm_ext_ops platform_pm_ops = {
|
||||
static struct pm_ext_ops platform_pm_ops = {
|
||||
.base = {
|
||||
.prepare = platform_pm_prepare,
|
||||
.complete = platform_pm_complete,
|
||||
|
Reference in New Issue
Block a user