device property: Introducing software nodes
Subsystems (3)
Heikki Krogerus
reviewercover device property: Introducing software nodes
Hi,
This is the final version of my proposal for the "software nodes". I've dropped the property sysfs group as agreed (with Andy). We'll add it separately once we've agreed on the output format.
The original RFC can be checked from here:
https://lkml.org/lkml/2018/10/12/518
And this was the origin commit message:
To continue the discussion started by Dmitry [1], this is my proposal that I mentioned in my last mail. In short, the idea is that instead of trying to extend the support for the currently used struct property_set, I'm proposing that we introduce a completely new, independent type of fwnode, and replace the struct property_set with it. I'm calling the type "software node" here.
The reason for a complete separation of the software nodes from the generic property handling code is the need to be able to create the nodes independently from the devices that they are bind to.
The way this works is that every node that is created will have a kobject registered. That will take care the ref counting for us, and also allow us to for example display the properties in sysfs.
There are a few more details in patch 3/5 about the software nodes in the commit message.
[1] https://lkml.org/lkml/2018/9/17/1067
--
heikki
Heikki Krogerus (6):
driver core: platform: Remove duplicated device_remove_properties()
call
drivers core: Prepare support for multiple platform notifications ACPI / glue: Add acpi_platform_notify() function
drivers: base: Introducing software nodes to the firmware node
framework
device property: Move device_add_properties() to swnode.c device property: Remove struct property_set
.../ABI/testing/sysfs-devices-software_node | 10 + drivers/acpi/bus.c | 1 - drivers/acpi/glue.c | 21 +- drivers/acpi/internal.h | 1 - drivers/base/Makefile | 2 +- drivers/base/core.c | 34 +- drivers/base/platform.c | 1 - drivers/base/property.c | 525 +------------- drivers/base/swnode.c | 677 ++++++++++++++++++ include/linux/acpi.h | 10 + include/linux/property.h | 12 + 11 files changed, 774 insertions(+), 520 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-devices-software_node create mode 100644 drivers/base/swnode.c
Signature · 1 line
2.19.1
Heikki Krogerus
reviewerPATCH 1/6 driver core: platform: Remove duplicated device_remove_properties() call
device_remove_properties() is called for every device in device_del().
--- drivers/base/platform.c | 1 - 1 file changed, 1 deletion(-)
drivers/base/platform.c +0 -1
@@ -448,7 +448,6 @@ void platform_device_del(struct platform_device *pdev)int i;if (pdev) { -device_remove_properties (&pdev->dev);device_del (&pdev->dev);if (pdev->id_auto) {
Signature · 1 line
2.19.1
Heikki Krogerus
reviewerPATCH 2/6 drivers core: Prepare support for multiple platform notifications
In reply to Heikki KrogerusSince it should be possible to support several hardware description models at the same time (at least in theory), for example ACPI and devicetree on a running system, the platform notifications need to be handled differently.
For now a single "platform_notify" callback function was used to notify the underlying base system which is in charge of the hardware description when a new device entry was added to the system, but that callback is available to only a single base system at the time. This will add a function device_platform_notify() and replace all direct platform_notify() calls with it.
device_platform_notify() will first simply call the platform_notify() callback, so this commit has no functional affect, however, the idea is that individual base systems will put their direct notification calls there instead of using the platform_notify function pointer.
--- drivers/base/core.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/base/core.c +16 -7
@@ -728,6 +728,16 @@ static inline int device_is_not_partition(struct device *dev) }#endif +static int +device_platform_notify (struct device *dev,enum kobject_action action) +{ +if (platform_notify && action ==KOBJ_ADD ) +platform_notify (dev); +else if (platform_notify_remove && action ==KOBJ_REMOVE ) +platform_notify_remove (dev); +return 0 ; +} +/** * dev_driver_string - Return a device's driver name, if at all possible * @dev: struct device to get the name of
@@ -1883,8 +1893,9 @@ int device_add(struct device *dev) }/* notify platform of device entry */ -if (platform_notify) -platform_notify (dev); + error =device_platform_notify (dev,KOBJ_ADD ); +if (error) + goto platform_error; error =device_create_file (dev, &dev_attr_uevent);if (error)
@@ -1960,6 +1971,8 @@ int device_add(struct device *dev) SymlinkError:device_remove_file (dev, &dev_attr_uevent); attrError: +device_platform_notify (dev,KOBJ_REMOVE ); +platform_error:kobject_uevent (&dev->kobj,KOBJ_REMOVE ); glue_dir =get_glue_dir (dev);kobject_del (&dev->kobj);
@@ -2077,14 +2090,10 @@ void device_del(struct device *dev)bus_remove_device (dev);device_pm_remove (dev);driver_deferred_probe_del (dev); +device_platform_notify (dev,KOBJ_REMOVE );device_remove_properties (dev);device_links_purge (dev); -/* Notify the platform of the removal, in case they -* need to do anything... -*/ -if (platform_notify_remove) -platform_notify_remove (dev);if (dev->bus)blocking_notifier_call_chain (&dev->bus->p->bus_notifier,BUS_NOTIFY_REMOVED_DEVICE , dev);
Signature · 1 line
2.19.1
Heikki Krogerus
reviewerPATCH 3/6 ACPI / glue: Add acpi_platform_notify() function
In reply to Heikki KrogerusInstead of relying on the "platform_notify" callback hook, introducing separate notification function acpi_platform_notify() and calling that directly from drivers core when device entries are added and removed.
--- drivers/acpi/bus.c | 1 - drivers/acpi/glue.c | 21 +++++++++++++-------- drivers/acpi/internal.h | 1 - drivers/base/core.c | 7 +++++++ include/linux/acpi.h | 10 ++++++++++ 5 files changed, 30 insertions(+), 10 deletions(-)
drivers/acpi/bus.c +0 -1
@@ -1237,7 +1237,6 @@ static int __init acpi_init(void) acpi_kobj =NULL ; } -init_acpi_device_notify (); result =acpi_bus_init ();if (result) {disable_acpi ();
drivers/acpi/glue.c +13 -8
@@ -296,7 +296,7 @@ int acpi_unbind_one(struct device *dev) }EXPORT_SYMBOL_GPL (acpi_unbind_one); -static int acpi_platform_notify (struct device *dev) +static int acpi_device_notify (struct device *dev) {struct acpi_bus_type *type =acpi_get_bus_type (dev);struct acpi_device *adev;
@@ -343,7 +343,7 @@ static int acpi_platform_notify(struct device *dev)return ret; } -static int acpi_platform_notify_remove (struct device *dev) +static int acpi_device_notify_remove (struct device *dev) {struct acpi_device *adev =ACPI_COMPANION (dev);struct acpi_bus_type *type;
@@ -361,12 +361,17 @@ static int acpi_platform_notify_remove(struct device *dev)return 0 ; } -void __init init_acpi_device_notify (void ) +int acpi_platform_notify (struct device *dev,enum kobject_action action) { -if (platform_notify || platform_notify_remove) { - printk(KERN_ERR PREFIX "Can't use platform_notify\n"); -return ; +switch (action) { +case KOBJ_ADD : +acpi_device_notify (dev); +break ; +case KOBJ_REMOVE : +acpi_device_notify_remove (dev); +break ; +default : +break ; } - platform_notify = acpi_platform_notify; - platform_notify_remove = acpi_platform_notify_remove; +return 0 ; }
drivers/acpi/internal.h +0 -1
@@ -23,7 +23,6 @@int early_acpi_osi_init (void );int acpi_osi_init (void );acpi_status acpi_os_initialize1 (void ); -void init_acpi_device_notify (void );int acpi_scan_init (void );void acpi_pci_root_init (void );void acpi_pci_link_init (void );
drivers/base/core.c +7 -0
@@ -8,6 +8,7 @@* Copyright (c) 2006 Novell, Inc. */ +#include <linux/acpi.h> #include <linux/device.h> #include <linux/err.h> #include <linux/fwnode.h>
@@ -731,6 +732,12 @@ static inline int device_is_not_partition(struct device *dev)static int device_platform_notify (struct device *dev,enum kobject_action action) { +int ret; + + ret =acpi_platform_notify (dev, action); +if (ret) +return ret; +if (platform_notify && action ==KOBJ_ADD )platform_notify (dev);else if (platform_notify_remove && action ==KOBJ_REMOVE )
include/linux/acpi.h +10 -0
@@ -1313,4 +1313,14 @@ static inline int find_acpi_cpu_cache_topology(unsigned int cpu, int level) }#endif +#ifdef CONFIG_ACPI +extern int acpi_platform_notify (struct device *dev,enum kobject_action action); +#else +static inline int +acpi_platform_notify (struct device *dev,enum kobject_action action) +{ +return 0 ; +} +#endif +#endif /*_LINUX_ACPI_H*/
Signature · 1 line
2.19.1
Heikki Krogerus
reviewerPATCH 4/6 drivers: base: Introducing software nodes to the firmware node framework
In reply to Heikki KrogerusSoftware node is a new struct fwnode_handle type that can be used to describe devices in kernel (software). It is meant to complement fwnodes representing real firmware nodes when they are incomplete (for example missing device properties) and to supply the primary fwnode when the firmware lacks hardware description for a device completely.
The software node type is really meant to replace the currently used "property_set" struct fwnode_handle type. The handling of struct property_set is glued to the generic device property handling code, and it is not possible to create a struct property_set independently from the device that it is bind to. struct property_set is only created when device properties are added to already initialized struct device, and control of it is only possible from the generic property handling code.
Software nodes are instead designed to be created independently from the device entries (struct device). It makes them much more flexible, as then the device meant to be bind to the node can be created at a later time, and from another location. It is also possible to bind multiple devices to a single software node if needed.
The software node implementation also includes support for node hierarchy which was the main motivation for this commit. The node hierarchy was something that was requested for the struct property_set, but it did not seem reasonable to try to extend the property_set support for that purpose. struct property_set was really meant only for device property handling like the name suggests.
Support for struct property_set is not yet removed in this commit, but it will be in the following one.
--- .../ABI/testing/sysfs-devices-software_node | 10 + drivers/base/Makefile | 2 +- drivers/base/core.c | 4 + drivers/base/swnode.c | 493 ++++++++++++++++++ include/linux/property.h | 12 + 5 files changed, 520 insertions(+), 1 deletion(-) create mode 100644 Documentation/ABI/testing/sysfs-devices-software_node create mode 100644 drivers/base/swnode.c
Documentation/ABI/testing/sysfs-devices-software_node new file +10 -0
@@ -0,0 +1,10 @@ +What: /sys/devices/.../software_node/ +Date: January 2019 +Contact: Heikki Krogerus <[email protected]> +Description: + This directory contains the details about the device that are + assigned in kernel (i.e. software), as opposed to the + firmware_node directory which contains the details that are + assigned for the device in firmware. The main attributes in the + directory will show the properties the device has, and the + relationship it has to some of the other devices.
drivers/base/Makefile +1 -1
@@ -6,7 +6,7 @@ obj-y := component.o core.o bus.o dd.o syscore.o \ cpu.o firmware.o init.o map.o devres.o \ attribute_container.o transport_class.o \ topology.o container.o property.o cacheinfo.o \ - devcon.o + devcon.o swnode.o obj-$(CONFIG_DEVTMPFS) += devtmpfs.o obj-y += power/ obj-$(CONFIG_ISA_BUS_API) += isa.o
drivers/base/core.c +4 -0
@@ -738,6 +738,10 @@ device_platform_notify(struct device *dev, enum kobject_action action)if (ret)return ret; + ret =software_node_notify (dev, action); +if (ret) +return ret; +if (platform_notify && action ==KOBJ_ADD )platform_notify (dev);else if (platform_notify_remove && action ==KOBJ_REMOVE )
drivers/base/swnode.c new file +493 -0
493 lines not on this page · raw message
include/linux/property.h +12 -0
@@ -311,4 +311,16 @@ fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port,int fwnode_graph_parse_endpoint (const struct fwnode_handle *fwnode,struct fwnode_endpoint *endpoint); +/* -------------------------------------------------------------------------- */ +/* Software fwnode support - when HW description is incomplete or missing */ + +bool is_software_node (const struct fwnode_handle *fwnode); + +int software_node_notify (struct device *dev,unsigned long action); + +struct fwnode_handle * +fwnode_create_software_node (const struct property_entry *properties, +const struct fwnode_handle *parent); +void fwnode_remove_software_node (struct fwnode_handle *fwnode); +#endif /* _LINUX_PROPERTY_H_ */
Signature · 1 line
2.19.1
Heikki Krogerus
reviewerPATCH 5/6 device property: Move device_add_properties() to swnode.c
In reply to Heikki KrogerusConcentrating struct property_entry processing todrivers/base/swnode.c
--- drivers/base/property.c | 179 -------------------------------------- drivers/base/swnode.c | 184 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 184 insertions(+), 179 deletions(-)
drivers/base/property.c +0 -179
@@ -84,44 +84,6 @@ static const void *property_get_pointer(const struct property_entry *prop) } } -static void property_set_pointer (struct property_entry *prop,const void *pointer) -{ -switch (prop->type) { -case DEV_PROP_U8 : -if (prop->is_array) - prop->pointer.u8_data = pointer; -else - prop->value.u8_data = *((u8 *)pointer); -break ; -case DEV_PROP_U16 : -if (prop->is_array) - prop->pointer.u16_data = pointer; -else - prop->value.u16_data = *((u16 *)pointer); -break ; -case DEV_PROP_U32 : -if (prop->is_array) - prop->pointer.u32_data = pointer; -else - prop->value.u32_data = *((u32 *)pointer); -break ; -case DEV_PROP_U64 : -if (prop->is_array) - prop->pointer.u64_data = pointer; -else - prop->value.u64_data = *((u64 *)pointer); -break ; -case DEV_PROP_STRING : -if (prop->is_array) - prop->pointer.str = pointer; -else - prop->value.str = pointer; -break ; -default : -break ; - } -} -static const void *pset_prop_find (const struct property_set *pset,const char *propname,size_t length) {
@@ -759,147 +721,6 @@ int fwnode_property_get_reference_args(const struct fwnode_handle *fwnode, }EXPORT_SYMBOL_GPL (fwnode_property_get_reference_args); -static void property_entry_free_data (const struct property_entry *p) -{ -const void *pointer =property_get_pointer (p); -size_t i, nval; - -if (p->is_array) { -if (p->type ==DEV_PROP_STRING && p->pointer.str) { - nval = p->length /sizeof (const char *); -for (i =0 ; i < nval; i++) -kfree (p->pointer.str[i]); - } -kfree (pointer); - }else if (p->type ==DEV_PROP_STRING ) { -kfree (p->value.str); - } -kfree (p->name); -} - -static int property_copy_string_array (struct property_entry *dst, -const struct property_entry *src) -{ -const char **d; -size_t nval = src->length /sizeof (*d); -int i; - - d =kcalloc (nval,sizeof (*d),GFP_KERNEL ); -if (!d) -return -ENOMEM ; - -for (i =0 ; i < nval; i++) { - d[i] =kstrdup (src->pointer.str[i],GFP_KERNEL ); -if (!d[i] && src->pointer.str[i]) { -while (--i >=0 ) -kfree (d[i]); -kfree (d); -return -ENOMEM ; - } - } - - dst->pointer.str = d; -return 0 ; -} - -static int property_entry_copy_data (struct property_entry *dst, -const struct property_entry *src) -{ -const void *pointer =property_get_pointer (src); -const void *new; -int error; - -if (src->is_array) { -if (!src->length) -return -ENODATA ; - -if (src->type ==DEV_PROP_STRING ) { - error =property_copy_string_array (dst, src); -if (error) -return error; - new = dst->pointer.str; - }else { - new =kmemdup (pointer, src->length,GFP_KERNEL ); -if (!new) -return -ENOMEM ; - } - }else if (src->type ==DEV_PROP_STRING ) { - new =kstrdup (src->value.str,GFP_KERNEL ); -if (!new && src->value.str) -return -ENOMEM ; - }else { - new = pointer; - } - - dst->length = src->length; - dst->is_array = src->is_array; - dst->type = src->type; - -property_set_pointer (dst, new); - - dst->name =kstrdup (src->name,GFP_KERNEL ); -if (!dst->name) - goto out_free_data; - -return 0 ; - -out_free_data: -property_entry_free_data (dst); -return -ENOMEM ; -} - -/** -* property_entries_dup - duplicate array of properties -* @properties: array of properties to copy -* -* This function creates a deep copy of the given NULL-terminated array -* of property entries. -*/ -struct property_entry * -property_entries_dup (const struct property_entry *properties) -{ -struct property_entry *p; -int i, n =0 ; - -while (properties[n].name) - n++; - - p =kcalloc (n +1 ,sizeof (*p),GFP_KERNEL ); -if (!p) -return ERR_PTR (-ENOMEM ); - -for (i =0 ; i < n; i++) { -int ret =property_entry_copy_data (&p[i], &properties[i]); -if (ret) { -while (--i >=0 ) -property_entry_free_data (&p[i]); -kfree (p); -return ERR_PTR (ret); - } - } - -return p; -} -EXPORT_SYMBOL_GPL (property_entries_dup); - -/** -* property_entries_free - free previously allocated array of properties -* @properties: array of properties to destroy -* -* This function frees given NULL-terminated array of property entries, -* along with their data. -*/ -void property_entries_free (const struct property_entry *properties) -{ -const struct property_entry *p; - -for (p = properties; p->name; p++) -property_entry_free_data (p); - -kfree (properties); -} -EXPORT_SYMBOL_GPL (property_entries_free); -/** * pset_free_set - releases memory allocated for copied property set * @pset: Property set to release
drivers/base/swnode.c +184 -0
196 lines not on this page · raw message
Signature · 1 line
2.19.1
Heikki Krogerus
reviewerPATCH 6/6 device property: Remove struct property_set
In reply to Heikki KrogerusReplacing struct property_set with the software nodes that were just introduced.
The API and functionality for adding properties to devices remains the same, however, the goal is to convert the drivers to use the API for software nodes when the device has no real firmware node, and use the old API only when "extra" build-in properties are needed.
--- drivers/base/property.c | 346 +++------------------------------------- 1 file changed, 24 insertions(+), 322 deletions(-)
drivers/base/property.c +24 -322
@@ -18,198 +18,6 @@#include <linux/etherdevice.h> #include <linux/phy.h> -struct property_set { -struct device *dev; -struct fwnode_handle fwnode; -const struct property_entry *properties; -}; - -static const struct fwnode_operations pset_fwnode_ops; - -static inline bool is_pset_node (const struct fwnode_handle *fwnode) -{ -return !IS_ERR_OR_NULL (fwnode) && fwnode->ops == &pset_fwnode_ops; -} - -#define to_pset_node (__fwnode) \ - ({ \ - typeof(__fwnode) __to_pset_node_fwnode = __fwnode; \ - \ - is_pset_node(__to_pset_node_fwnode) ? \ - container_of(__to_pset_node_fwnode, \ - struct property_set, fwnode) : \ - NULL; \ - }) - -static const struct property_entry * -pset_prop_get (const struct property_set *pset,const char *name) -{ -const struct property_entry *prop; - -if (!pset || !pset->properties) -return NULL ; - -for (prop = pset->properties; prop->name; prop++) -if (!strcmp (name, prop->name)) -return prop; - -return NULL ; -} - -static const void *property_get_pointer (const struct property_entry *prop) -{ -switch (prop->type) { -case DEV_PROP_U8 : -if (prop->is_array) -return prop->pointer.u8_data; -return &prop->value.u8_data; -case DEV_PROP_U16 : -if (prop->is_array) -return prop->pointer.u16_data; -return &prop->value.u16_data; -case DEV_PROP_U32 : -if (prop->is_array) -return prop->pointer.u32_data; -return &prop->value.u32_data; -case DEV_PROP_U64 : -if (prop->is_array) -return prop->pointer.u64_data; -return &prop->value.u64_data; -case DEV_PROP_STRING : -if (prop->is_array) -return prop->pointer.str; -return &prop->value.str; -default : -return NULL ; - } -} - -static const void *pset_prop_find (const struct property_set *pset, -const char *propname,size_t length) -{ -const struct property_entry *prop; -const void *pointer; - - prop =pset_prop_get (pset, propname); -if (!prop) -return ERR_PTR (-EINVAL ); - pointer =property_get_pointer (prop); -if (!pointer) -return ERR_PTR (-ENODATA ); -if (length > prop->length) -return ERR_PTR (-EOVERFLOW ); -return pointer; -} - -static int pset_prop_read_u8_array (const struct property_set *pset, -const char *propname, -u8 *values,size_t nval) -{ -const void *pointer; -size_t length = nval *sizeof (*values); - - pointer =pset_prop_find (pset, propname, length); -if (IS_ERR (pointer)) -return PTR_ERR (pointer); - -memcpy (values, pointer, length); -return 0 ; -} - -static int pset_prop_read_u16_array (const struct property_set *pset, -const char *propname, -u16 *values,size_t nval) -{ -const void *pointer; -size_t length = nval *sizeof (*values); - - pointer =pset_prop_find (pset, propname, length); -if (IS_ERR (pointer)) -return PTR_ERR (pointer); - -memcpy (values, pointer, length); -return 0 ; -} - -static int pset_prop_read_u32_array (const struct property_set *pset, -const char *propname, -u32 *values,size_t nval) -{ -const void *pointer; -size_t length = nval *sizeof (*values); - - pointer =pset_prop_find (pset, propname, length); -if (IS_ERR (pointer)) -return PTR_ERR (pointer); - -memcpy (values, pointer, length); -return 0 ; -} - -static int pset_prop_read_u64_array (const struct property_set *pset, -const char *propname, -u64 *values,size_t nval) -{ -const void *pointer; -size_t length = nval *sizeof (*values); - - pointer =pset_prop_find (pset, propname, length); -if (IS_ERR (pointer)) -return PTR_ERR (pointer); - -memcpy (values, pointer, length); -return 0 ; -} - -static int pset_prop_count_elems_of_size (const struct property_set *pset, -const char *propname,size_t length) -{ -const struct property_entry *prop; - - prop =pset_prop_get (pset, propname); -if (!prop) -return -EINVAL ; - -return prop->length / length; -} - -static int pset_prop_read_string_array (const struct property_set *pset, -const char *propname, -const char **strings,size_t nval) -{ -const struct property_entry *prop; -const void *pointer; -size_t array_len, length; - -/* Find out the array length. */ - prop =pset_prop_get (pset, propname); -if (!prop) -return -EINVAL ; - -if (!prop->is_array) -/* The array length for a non-array string property is 1. */ - array_len =1 ; -else -/* Find the length of an array. */ - array_len =pset_prop_count_elems_of_size (pset, propname, -sizeof (const char *)); - -/* Return how many there are if strings is NULL. */ -if (!strings) -return array_len; - - array_len =min (nval, array_len); - length = array_len *sizeof (*strings); - - pointer =pset_prop_find (pset, propname, length); -if (IS_ERR (pointer)) -return PTR_ERR (pointer); - -memcpy (strings, pointer, length); - -return array_len; -} -struct fwnode_handle *dev_fwnode (struct device *dev) { return IS_ENABLED(CONFIG_OF) && dev->of_node ?
@@ -217,51 +25,6 @@ struct fwnode_handle *dev_fwnode(struct device *dev) }EXPORT_SYMBOL_GPL (dev_fwnode); -static bool pset_fwnode_property_present (const struct fwnode_handle *fwnode, -const char *propname) -{ -return !!pset_prop_get (to_pset_node (fwnode), propname); -} - -static int pset_fwnode_read_int_array (const struct fwnode_handle *fwnode, -const char *propname, -unsigned int elem_size,void *val, -size_t nval) -{ -const struct property_set *node =to_pset_node (fwnode); - -if (!val) -return pset_prop_count_elems_of_size (node, propname, elem_size); - -switch (elem_size) { -case sizeof (u8): -return pset_prop_read_u8_array (node, propname, val, nval); -case sizeof (u16): -return pset_prop_read_u16_array (node, propname, val, nval); -case sizeof (u32): -return pset_prop_read_u32_array (node, propname, val, nval); -case sizeof (u64): -return pset_prop_read_u64_array (node, propname, val, nval); - } - -return -ENXIO ; -} - -static int -pset_fwnode_property_read_string_array (const struct fwnode_handle *fwnode, -const char *propname, -const char **val,size_t nval) -{ -return pset_prop_read_string_array (to_pset_node (fwnode), propname, - val, nval); -} - -static const struct fwnode_operations pset_fwnode_ops = { - .property_present = pset_fwnode_property_present, - .property_read_int_array = pset_fwnode_read_int_array, - .property_read_string_array = pset_fwnode_property_read_string_array, -}; -/** * device_property_present - check if a property of a device is present * @dev: Device whose property is being checked
@@ -722,114 +485,53 @@ int fwnode_property_get_reference_args(const struct fwnode_handle *fwnode,EXPORT_SYMBOL_GPL (fwnode_property_get_reference_args);/** -* pset_free_set - releases memory allocated for copied property set -* @pset: Property set to release -* -* Function takes previously copied property set and releases all the -* memory allocated to it. -*/ -static void pset_free_set (struct property_set *pset) -{ -if (!pset) -return ; - -property_entries_free (pset->properties); -kfree (pset); -} - -/** -* pset_copy_set - copies property set -* @pset: Property set to copy +* device_add_properties - Add a collection of properties to a device object. +* @dev: Device to add properties to. +* @properties: Collection of properties to add. * -* This function takes a deep copy of the given property set and returns -* pointer to the copy. Call device_free_property_set() to free resources -* allocated in this function. +* Associate a collection of device properties represented by @properties with +* @dev. The function takes a copy of @properties. * -* Return: Pointer to the new property set or error pointer. +* WARNING: The callers should not use this function if it is known that there +* is no real firmware node associated with @dev! In that case the callers +* should create a software node and assign it to @dev directly. */ -static struct property_set *pset_copy_set (const struct property_set *pset) +int device_add_properties (struct device *dev, +const struct property_entry *properties) { -struct property_entry *properties; -struct property_set *p; +struct fwnode_handle *fwnode; - p =kzalloc (sizeof (*p),GFP_KERNEL ); -if (!p) -return ERR_PTR (-ENOMEM ); + fwnode =fwnode_create_software_node (properties,NULL ); +if (IS_ERR (fwnode)) +return PTR_ERR (fwnode); - properties =property_entries_dup (pset->properties); -if (IS_ERR (properties)) { -kfree (p); -return ERR_CAST (properties); - } - - p->properties = properties; -return p; +set_secondary_fwnode (dev, fwnode); +return 0 ; } +EXPORT_SYMBOL_GPL (device_add_properties);/** * 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_properties(). Memory allocated -* to the properties will also be released. +* firmware node with device_add_properties(). Memory allocated to the +* properties will also be released. */ void device_remove_properties (struct device *dev) { -struct fwnode_handle *fwnode; -struct property_set *pset; +struct fwnode_handle *fwnode =dev_fwnode (dev); - fwnode =dev_fwnode (dev);if (!fwnode)return ; -/* -* Pick either primary or secondary node depending which one holds -* the pset. If there is no real firmware node (ACPI/DT) primary -* will hold the pset. -*/ - pset =to_pset_node (fwnode); -if (pset) { -set_primary_fwnode (dev,NULL ); - }else { - pset =to_pset_node (fwnode->secondary); -if (pset && dev == pset->dev) -set_secondary_fwnode (dev,NULL ); + +if (is_software_node (fwnode->secondary)) { +fwnode_remove_software_node (fwnode->secondary); +set_secondary_fwnode (dev,NULL ); } -if (pset && dev == pset->dev) -pset_free_set (pset); }EXPORT_SYMBOL_GPL (device_remove_properties); -/** -* device_add_properties - Add a collection of properties to a device object. -* @dev: Device to add properties to. -* @properties: Collection of properties to add. -* -* 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_properties (struct device *dev, -const struct property_entry *properties) -{ -struct property_set *p, pset; - -if (!properties) -return -EINVAL ; - - pset.properties = properties; - - p =pset_copy_set (&pset); -if (IS_ERR (p)) -return PTR_ERR (p); - - p->fwnode.ops = &pset_fwnode_ops; -set_secondary_fwnode (dev, &p->fwnode); - p->dev = dev; -return 0 ; -} -EXPORT_SYMBOL_GPL (device_add_properties); -/** * fwnode_get_next_parent - Iterate to the node's parent * @fwnode: Firmware whose parent is retrieved
Signature · 1 line
2.19.1
Andy Shevchenko
reviewerRe: [PATCH 6/6] device property: Remove struct property_set
Quoted 8 lines · Heikki Krogerus
Replacing struct
property_setwith the software nodes that were just introduced.The API and functionality for adding properties to devices remains the same, however, the goal is to convert the drivers to use the API for software nodes when the device has no real firmware node, and use the old API only when "extra" build-in properties are needed.
It might be slightly easier to review if you preserve the ordering of functions, i.e. device_add_properties() and device_remove_properties().
Quoted 403 lines
Signed-off-by Heikki Krogerus <[email protected]>--- drivers/base/property.c | 346 +++------------------------------------- 1 file changed, 24 insertions(+), 322 deletions(-)drivers/base/property.c +24
-322@@ -18,198 +18,6 @@#include <linux/etherdevice.h> #include <linux/phy.h> -struct property_set { -struct device *dev; -struct fwnode_handle fwnode; -const struct property_entry *properties; -}; - -static const struct fwnode_operations pset_fwnode_ops; - -static inline bool is_pset_node (const struct fwnode_handle *fwnode) -{ -return !IS_ERR_OR_NULL (fwnode) && fwnode->ops == &pset_fwnode_ops; -} - -#define to_pset_node (__fwnode) \ - ({ \ - typeof(__fwnode) __to_pset_node_fwnode = __fwnode; \ - \ - is_pset_node(__to_pset_node_fwnode) ? \ - container_of(__to_pset_node_fwnode, \ - struct property_set, fwnode) : \ - NULL; \ - }) - -static const struct property_entry * -pset_prop_get (const struct property_set *pset,const char *name) -{ -const struct property_entry *prop; - -if (!pset || !pset->properties) -return NULL ; - -for (prop = pset->properties; prop->name; prop++) -if (!strcmp (name, prop->name)) -return prop; - -return NULL ; -} - -static const void *property_get_pointer (const struct property_entry *prop) -{ -switch (prop->type) { -case DEV_PROP_U8 : -if (prop->is_array) -return prop->pointer.u8_data; -return &prop->value.u8_data; -case DEV_PROP_U16 : -if (prop->is_array) -return prop->pointer.u16_data; -return &prop->value.u16_data; -case DEV_PROP_U32 : -if (prop->is_array) -return prop->pointer.u32_data; -return &prop->value.u32_data; -case DEV_PROP_U64 : -if (prop->is_array) -return prop->pointer.u64_data; -return &prop->value.u64_data; -case DEV_PROP_STRING : -if (prop->is_array) -return prop->pointer.str; -return &prop->value.str; -default : -return NULL ; - } -} - -static const void *pset_prop_find (const struct property_set *pset, -const char *propname,size_t length) -{ -const struct property_entry *prop; -const void *pointer; - - prop =pset_prop_get (pset, propname); -if (!prop) -return ERR_PTR (-EINVAL ); - pointer =property_get_pointer (prop); -if (!pointer) -return ERR_PTR (-ENODATA ); -if (length > prop->length) -return ERR_PTR (-EOVERFLOW ); -return pointer; -} - -static int pset_prop_read_u8_array (const struct property_set *pset, -const char *propname, -u8 *values,size_t nval) -{ -const void *pointer; -size_t length = nval *sizeof (*values); - - pointer =pset_prop_find (pset, propname, length); -if (IS_ERR (pointer)) -return PTR_ERR (pointer); - -memcpy (values, pointer, length); -return 0 ; -} - -static int pset_prop_read_u16_array (const struct property_set *pset, -const char *propname, -u16 *values,size_t nval) -{ -const void *pointer; -size_t length = nval *sizeof (*values); - - pointer =pset_prop_find (pset, propname, length); -if (IS_ERR (pointer)) -return PTR_ERR (pointer); - -memcpy (values, pointer, length); -return 0 ; -} - -static int pset_prop_read_u32_array (const struct property_set *pset, -const char *propname, -u32 *values,size_t nval) -{ -const void *pointer; -size_t length = nval *sizeof (*values); - - pointer =pset_prop_find (pset, propname, length); -if (IS_ERR (pointer)) -return PTR_ERR (pointer); - -memcpy (values, pointer, length); -return 0 ; -} - -static int pset_prop_read_u64_array (const struct property_set *pset, -const char *propname, -u64 *values,size_t nval) -{ -const void *pointer; -size_t length = nval *sizeof (*values); - - pointer =pset_prop_find (pset, propname, length); -if (IS_ERR (pointer)) -return PTR_ERR (pointer); - -memcpy (values, pointer, length); -return 0 ; -} - -static int pset_prop_count_elems_of_size (const struct property_set *pset, -const char *propname,size_t length) -{ -const struct property_entry *prop; - - prop =pset_prop_get (pset, propname); -if (!prop) -return -EINVAL ; - -return prop->length / length; -} - -static int pset_prop_read_string_array (const struct property_set *pset, -const char *propname, -const char **strings,size_t nval) -{ -const struct property_entry *prop; -const void *pointer; -size_t array_len, length; - -/* Find out the array length. */ - prop =pset_prop_get (pset, propname); -if (!prop) -return -EINVAL ; - -if (!prop->is_array) -/* The array length for a non-array string property is 1. */ - array_len =1 ; -else -/* Find the length of an array. */ - array_len =pset_prop_count_elems_of_size (pset, propname, -sizeof (const char *)); - -/* Return how many there are if strings is NULL. */ -if (!strings) -return array_len; - - array_len =min (nval, array_len); - length = array_len *sizeof (*strings); - - pointer =pset_prop_find (pset, propname, length); -if (IS_ERR (pointer)) -return PTR_ERR (pointer); - -memcpy (strings, pointer, length); - -return array_len; -} -struct fwnode_handle *dev_fwnode (struct device *dev) { return IS_ENABLED(CONFIG_OF) && dev->of_node ?@@ -217,51 +25,6 @@ struct fwnode_handle *dev_fwnode(struct device *dev) }EXPORT_SYMBOL_GPL (dev_fwnode); -static bool pset_fwnode_property_present (const struct fwnode_handle *fwnode, -const char *propname) -{ -return !!pset_prop_get (to_pset_node (fwnode), propname); -} - -static int pset_fwnode_read_int_array (const struct fwnode_handle *fwnode, -const char *propname, -unsigned int elem_size,void *val, -size_t nval) -{ -const struct property_set *node =to_pset_node (fwnode); - -if (!val) -return pset_prop_count_elems_of_size (node, propname, elem_size); - -switch (elem_size) { -case sizeof (u8): -return pset_prop_read_u8_array (node, propname, val, nval); -case sizeof (u16): -return pset_prop_read_u16_array (node, propname, val, nval); -case sizeof (u32): -return pset_prop_read_u32_array (node, propname, val, nval); -case sizeof (u64): -return pset_prop_read_u64_array (node, propname, val, nval); - } - -return -ENXIO ; -} - -static int -pset_fwnode_property_read_string_array (const struct fwnode_handle *fwnode, -const char *propname, -const char **val,size_t nval) -{ -return pset_prop_read_string_array (to_pset_node (fwnode), propname, - val, nval); -} - -static const struct fwnode_operations pset_fwnode_ops = { - .property_present = pset_fwnode_property_present, - .property_read_int_array = pset_fwnode_read_int_array, - .property_read_string_array = pset_fwnode_property_read_string_array, -}; -/** * device_property_present - check if a property of a device is present * @dev: Device whose property is being checked @@ -722,114 +485,53 @@ int fwnode_property_get_reference_args(const struct fwnode_handle *fwnode,EXPORT_SYMBOL_GPL (fwnode_property_get_reference_args);/** -* pset_free_set - releases memory allocated for copied property set -* @pset: Property set to release -* -* Function takes previously copied property set and releases all the -* memory allocated to it. -*/ -static void pset_free_set (struct property_set *pset) -{ -if (!pset) -return ; - -property_entries_free (pset->properties); -kfree (pset); -} - -/** -* pset_copy_set - copies property set -* @pset: Property set to copy +* device_add_properties - Add a collection of properties to a device object. +* @dev: Device to add properties to. +* @properties: Collection of properties to add. * -* This function takes a deep copy of the given property set and returns -* pointer to the copy. Call device_free_property_set() to free resources -* allocated in this function. +* Associate a collection of device properties represented by @properties with +* @dev. The function takes a copy of @properties. * -* Return: Pointer to the new property set or error pointer. +* WARNING: The callers should not use this function if it is known that there +* is no real firmware node associated with @dev! In that case the callers +* should create a software node and assign it to @dev directly. */ -static struct property_set *pset_copy_set (const struct property_set *pset) +int device_add_properties (struct device *dev, +const struct property_entry *properties) { -struct property_entry *properties; -struct property_set *p; +struct fwnode_handle *fwnode; - p =kzalloc (sizeof (*p),GFP_KERNEL ); -if (!p) -return ERR_PTR (-ENOMEM ); + fwnode =fwnode_create_software_node (properties,NULL ); +if (IS_ERR (fwnode)) +return PTR_ERR (fwnode); - properties =property_entries_dup (pset->properties); -if (IS_ERR (properties)) { -kfree (p); -return ERR_CAST (properties); - } - - p->properties = properties; -return p; +set_secondary_fwnode (dev, fwnode); +return 0 ; } +EXPORT_SYMBOL_GPL (device_add_properties);/** * 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_properties(). Memory allocated -* to the properties will also be released. +* firmware node with device_add_properties(). Memory allocated to the +* properties will also be released. */ void device_remove_properties (struct device *dev) { -struct fwnode_handle *fwnode; -struct property_set *pset; +struct fwnode_handle *fwnode =dev_fwnode (dev); - fwnode =dev_fwnode (dev);if (!fwnode)return ; -/* -* Pick either primary or secondary node depending which one holds -* the pset. If there is no real firmware node (ACPI/DT) primary -* will hold the pset. -*/ - pset =to_pset_node (fwnode); -if (pset) { -set_primary_fwnode (dev,NULL ); - }else { - pset =to_pset_node (fwnode->secondary); -if (pset && dev == pset->dev) -set_secondary_fwnode (dev,NULL ); + +if (is_software_node (fwnode->secondary)) { +fwnode_remove_software_node (fwnode->secondary); +set_secondary_fwnode (dev,NULL ); } -if (pset && dev == pset->dev) -pset_free_set (pset); }EXPORT_SYMBOL_GPL (device_remove_properties); -/** -* device_add_properties - Add a collection of properties to a device object. -* @dev: Device to add properties to. -* @properties: Collection of properties to add. -* -* 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_properties (struct device *dev, -const struct property_entry *properties) -{ -struct property_set *p, pset; - -if (!properties) -return -EINVAL ; - - pset.properties = properties; - - p =pset_copy_set (&pset); -if (IS_ERR (p)) -return PTR_ERR (p); - - p->fwnode.ops = &pset_fwnode_ops; -set_secondary_fwnode (dev, &p->fwnode); - p->dev = dev; -return 0 ; -} -EXPORT_SYMBOL_GPL (device_add_properties); -/** * fwnode_get_next_parent - Iterate to the node's parent * @fwnode: Firmware whose parent is retrieved Signature · 1 line
2.19.1
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH 4/6] drivers: base: Introducing software nodes to the firmware node framework
In reply to Heikki KrogerusHi Heikki,
smatch warnings:drivers/base/swnode.c:391 fwnode_create_software_node() error: dereferencing freed memory 'swnode'
# https://github.com/0day-ci/linux/commit/a8c9678ea46a0171baed68e4ec355a9b3f967458
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout a8c9678ea46a0171baed68e4ec355a9b3f967458
vim +/swnode +391 drivers/base/swnode.c
a8c9678e Heikki Krogerus 2018-11-05 365
a8c9678e Heikki Krogerus 2018-11-05 366 struct fwnode_handle *
a8c9678e Heikki Krogerus 2018-11-05 367 fwnode_create_software_node(const struct property_entry *properties,
a8c9678e Heikki Krogerus 2018-11-05 368 const struct fwnode_handle *parent)
a8c9678e Heikki Krogerus 2018-11-05 369 {
a8c9678e Heikki Krogerus 2018-11-05 370 struct software_node *p = NULL;
a8c9678e Heikki Krogerus 2018-11-05 371 struct software_node *swnode;
a8c9678e Heikki Krogerus 2018-11-05 372 char node_name[20];
a8c9678e Heikki Krogerus 2018-11-05 373 int ret;
a8c9678e Heikki Krogerus 2018-11-05 374
a8c9678e Heikki Krogerus 2018-11-05 375 if (parent) {
a8c9678e Heikki Krogerus 2018-11-05 376 if (IS_ERR(parent))
a8c9678e Heikki Krogerus 2018-11-05 377 return ERR_CAST(parent);
a8c9678e Heikki Krogerus 2018-11-05 378 if (!is_software_node(parent))
a8c9678e Heikki Krogerus 2018-11-05 379 return ERR_PTR(-EINVAL);
a8c9678e Heikki Krogerus 2018-11-05 380 p = to_software_node(parent);
a8c9678e Heikki Krogerus 2018-11-05 381 }
a8c9678e Heikki Krogerus 2018-11-05 382
a8c9678e Heikki Krogerus 2018-11-05 383 swnode = kzalloc(sizeof(*swnode), GFP_KERNEL);
a8c9678e Heikki Krogerus 2018-11-05 384 if (!swnode)
a8c9678e Heikki Krogerus 2018-11-05 385 return ERR_PTR(-ENOMEM);
a8c9678e Heikki Krogerus 2018-11-05 386
a8c9678e Heikki Krogerus 2018-11-05 387 swnode->id = ida_simple_get(p ? &p->child_ids : &swnode_root_ids, 0, 0,
a8c9678e Heikki Krogerus 2018-11-05 388 GFP_KERNEL);
a8c9678e Heikki Krogerus 2018-11-05 389 if (swnode->id < 0) {
a8c9678e Heikki Krogerus 2018-11-05 390 kfree(swnode);
^^^^^^
a8c9678e Heikki Krogerus 2018-11-05 @391 return ERR_PTR(swnode->id);
^^^^^^^^^^
a8c9678e Heikki Krogerus 2018-11-05 392 }
a8c9678e Heikki Krogerus 2018-11-05 393
a8c9678e Heikki Krogerus 2018-11-05 394 sprintf(node_name, "node%d", swnode->id);
a8c9678e Heikki Krogerus 2018-11-05 395
a8c9678e Heikki Krogerus 2018-11-05 396 swnode->kobj.kset = swnode_kset;
a8c9678e Heikki Krogerus 2018-11-05 397 swnode->fwnode.ops = &software_node_ops;
a8c9678e Heikki Krogerus 2018-11-05 398
a8c9678e Heikki Krogerus 2018-11-05 399 ida_init(&swnode->child_ids);
a8c9678e Heikki Krogerus 2018-11-05 400 INIT_LIST_HEAD(&swnode->entry);
a8c9678e Heikki Krogerus 2018-11-05 401 INIT_LIST_HEAD(&swnode->children);
a8c9678e Heikki Krogerus 2018-11-05 402 swnode->parent = p;
a8c9678e Heikki Krogerus 2018-11-05 403
a8c9678e Heikki Krogerus 2018-11-05 404 if (p)
a8c9678e Heikki Krogerus 2018-11-05 405 list_add_tail(&swnode->entry, &p->children);
a8c9678e Heikki Krogerus 2018-11-05 406
a8c9678e Heikki Krogerus 2018-11-05 407 ret = kobject_init_and_add(&swnode->kobj, &software_node_type,
a8c9678e Heikki Krogerus 2018-11-05 408 p ? &p->kobj : NULL, node_name);
a8c9678e Heikki Krogerus 2018-11-05 409 if (ret) {
a8c9678e Heikki Krogerus 2018-11-05 410 kobject_put(&swnode->kobj);
a8c9678e Heikki Krogerus 2018-11-05 411 return ERR_PTR(ret);
a8c9678e Heikki Krogerus 2018-11-05 412 }
a8c9678e Heikki Krogerus 2018-11-05 413
a8c9678e Heikki Krogerus 2018-11-05 414 ret = software_node_register_properties(swnode, properties);
a8c9678e Heikki Krogerus 2018-11-05 415 if (ret) {
a8c9678e Heikki Krogerus 2018-11-05 416 kobject_put(&swnode->kobj);
a8c9678e Heikki Krogerus 2018-11-05 417 return ERR_PTR(ret);
a8c9678e Heikki Krogerus 2018-11-05 418 }
a8c9678e Heikki Krogerus 2018-11-05 419
a8c9678e Heikki Krogerus 2018-11-05 420 kobject_uevent(&swnode->kobj, KOBJ_ADD);
a8c9678e Heikki Krogerus 2018-11-05 421 return &swnode->fwnode;
a8c9678e Heikki Krogerus 2018-11-05 422 }
a8c9678e Heikki Krogerus 2018-11-05 423 EXPORT_SYMBOL_GPL(fwnode_create_software_node);
a8c9678e Heikki Krogerus 2018-11-05 424 Heikki Krogerus
reviewerRe: [PATCH 4/6] drivers: base: Introducing software nodes to the firmware node framework
Quoted 42 lines · Dan Carpenter
Hi Heikki,
smatch warnings:
drivers/base/swnode.c:391fwnode_create_software_node()error: dereferencing freed memory 'swnode'# https://github.com/0day-ci/linux/commit/a8c9678ea46a0171baed68e4ec355a9b3f967458
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkouta8c9678ea46a0171baed68e4ec355a9b3f967458
vim +/swnode +391drivers/base/swnode.ca8c9678e Heikki Krogerus 2018-11-05 365 a8c9678e Heikki Krogerus 2018-11-05 366 struct fwnode_handle * a8c9678e Heikki Krogerus 2018-11-05 367 fwnode_create_software_node(const struct property_entry *properties, a8c9678e Heikki Krogerus 2018-11-05 368 const struct fwnode_handle *parent) a8c9678e Heikki Krogerus 2018-11-05 369 { a8c9678e Heikki Krogerus 2018-11-05 370 struct software_node *p = NULL; a8c9678e Heikki Krogerus 2018-11-05 371 struct software_node *swnode; a8c9678e Heikki Krogerus 2018-11-05 372 char node_name[20]; a8c9678e Heikki Krogerus 2018-11-05 373 int ret; a8c9678e Heikki Krogerus 2018-11-05 374 a8c9678e Heikki Krogerus 2018-11-05 375 if (parent) { a8c9678e Heikki Krogerus 2018-11-05 376 if (IS_ERR(parent)) a8c9678e Heikki Krogerus 2018-11-05 377 return ERR_CAST(parent); a8c9678e Heikki Krogerus 2018-11-05 378 if (!is_software_node(parent)) a8c9678e Heikki Krogerus 2018-11-05 379 return ERR_PTR(-EINVAL); a8c9678e Heikki Krogerus 2018-11-05 380 p = to_software_node(parent); a8c9678e Heikki Krogerus 2018-11-05 381 } a8c9678e Heikki Krogerus 2018-11-05 382 a8c9678e Heikki Krogerus 2018-11-05 383 swnode = kzalloc(sizeof(*swnode), GFP_KERNEL); a8c9678e Heikki Krogerus 2018-11-05 384 if (!swnode) a8c9678e Heikki Krogerus 2018-11-05 385 return ERR_PTR(-ENOMEM); a8c9678e Heikki Krogerus 2018-11-05 386 a8c9678e Heikki Krogerus 2018-11-05 387 swnode->id = ida_simple_get(p ? &p->child_ids : &swnode_root_ids, 0, 0, a8c9678e Heikki Krogerus 2018-11-05 388 GFP_KERNEL); a8c9678e Heikki Krogerus 2018-11-05 389 if (swnode->id < 0) { a8c9678e Heikki Krogerus 2018-11-05 390 kfree(swnode); ^^^^^^ a8c9678e Heikki Krogerus 2018-11-05 @391 return ERR_PTR(swnode->id); ^^^^^^^^^^
Quoted 1 line
a8c9678eHeikki Krogerus 2018-11-05 392 }
Thanks!
Signature · 1 line
heikki
Heikki Krogerus
reviewerRe: [PATCH 6/6] device property: Remove struct property_set
In reply to Andy ShevchenkoQuoted 4 lines · Andy Shevchenko
Quoted 3 lines · Heikki Krogerus
Replacing struct
property_setwith the software nodes that were just introduced.
Quoted 8 lines
Quoted 5 lines
The API and functionality for adding properties to devices remains the same, however, the goal is to convert the drivers to use the API for software nodes when the device has no real firmware node, and use the old API only when "extra" build-in properties are needed.
It might be slightly easier to review if you preserve the ordering of functions, i.e.
device_add_properties()anddevice_remove_properties().
True, that change does not belong to this series.
thanks,
Signature · 1 line
heikki