diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-16 19:51:04 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-05-16 19:51:04 -0700 |
commit | 16490980e396fac079248b23b1dd81e7d48bebf3 (patch) | |
tree | fa6a9162cfc8e71d7988fb3f5c400abf62253739 /drivers/base | |
parent | 46c13450624e36302547a2ac3695f2350fe7ffc3 (diff) | |
parent | dab2e29402f40431d2199e6faff48174204d2d06 (diff) |
Merge tag 'device-properties-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull device properties update from Rafael Wysocki:
"Generic device properties framework update.
Just one commit reworking the handling of built-in properties
initialization and updating a few drivers in accordance with the core
framework changes"
* tag 'device-properties-4.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
device property: don't bother the drivers with struct property_set
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/platform.c | 19 | ||||
-rw-r--r-- | drivers/base/property.c | 34 |
2 files changed, 31 insertions, 22 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index f437afa17f2b..6482d47deb50 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -322,16 +322,16 @@ EXPORT_SYMBOL_GPL(platform_device_add_data); /** * platform_device_add_properties - add built-in properties to a platform device * @pdev: platform device to add properties to - * @pset: properties to add + * @properties: null terminated array of properties to add * - * The function will take deep copy of the properties in @pset and attach - * the copy to the platform device. The memory associated with properties - * will be freed when the platform device is released. + * The function will take deep copy of @properties and attach the copy to the + * platform device. The memory associated with properties will be freed when the + * platform device is released. */ int platform_device_add_properties(struct platform_device *pdev, - const struct property_set *pset) + struct property_entry *properties) { - return device_add_property_set(&pdev->dev, pset); + return device_add_properties(&pdev->dev, properties); } EXPORT_SYMBOL_GPL(platform_device_add_properties); @@ -447,7 +447,7 @@ void platform_device_del(struct platform_device *pdev) release_resource(r); } - device_remove_property_set(&pdev->dev); + device_remove_properties(&pdev->dev); } } EXPORT_SYMBOL_GPL(platform_device_del); @@ -526,8 +526,9 @@ struct platform_device *platform_device_register_full( if (ret) goto err; - if (pdevinfo->pset) { - ret = platform_device_add_properties(pdev, pdevinfo->pset); + if (pdevinfo->properties) { + ret = platform_device_add_properties(pdev, + pdevinfo->properties); if (ret) goto err; } diff --git a/drivers/base/property.c b/drivers/base/property.c index 7f692accdc90..f38c21de29b7 100644 --- a/drivers/base/property.c +++ b/drivers/base/property.c @@ -19,6 +19,11 @@ #include <linux/etherdevice.h> #include <linux/phy.h> +struct property_set { + struct fwnode_handle fwnode; + struct property_entry *properties; +}; + static inline bool is_pset_node(struct fwnode_handle *fwnode) { return !IS_ERR_OR_NULL(fwnode) && fwnode->type == FWNODE_PDATA; @@ -801,14 +806,14 @@ static struct property_set *pset_copy_set(const struct property_set *pset) } /** - * device_remove_property_set - Remove properties from a device object. + * device_remove_properties - Remove properties from a device object. * @dev: Device whose properties to remove. * * The function removes properties previously associated to the device - * secondary firmware node with device_add_property_set(). Memory allocated + * secondary firmware node with device_add_properties(). Memory allocated * to the properties will also be released. */ -void device_remove_property_set(struct device *dev) +void device_remove_properties(struct device *dev) { struct fwnode_handle *fwnode; @@ -831,24 +836,27 @@ void device_remove_property_set(struct device *dev) } } } -EXPORT_SYMBOL_GPL(device_remove_property_set); +EXPORT_SYMBOL_GPL(device_remove_properties); /** - * device_add_property_set - Add a collection of properties to a device object. + * device_add_properties - Add a collection of properties to a device object. * @dev: Device to add properties to. - * @pset: Collection of properties to add. + * @properties: Collection of properties to add. * - * Associate a collection of device properties represented by @pset with @dev - * as its secondary firmware node. The function takes a copy of @pset. + * Associate a collection of device properties represented by @properties with + * @dev as its secondary firmware node. The function takes a copy of + * @properties. */ -int device_add_property_set(struct device *dev, const struct property_set *pset) +int device_add_properties(struct device *dev, struct property_entry *properties) { - struct property_set *p; + struct property_set *p, pset; - if (!pset) + if (!properties) return -EINVAL; - p = pset_copy_set(pset); + pset.properties = properties; + + p = pset_copy_set(&pset); if (IS_ERR(p)) return PTR_ERR(p); @@ -856,7 +864,7 @@ int device_add_property_set(struct device *dev, const struct property_set *pset) set_secondary_fwnode(dev, &p->fwnode); return 0; } -EXPORT_SYMBOL_GPL(device_add_property_set); +EXPORT_SYMBOL_GPL(device_add_properties); /** * device_get_next_child_node - Return the next child node handle for a device |