]> git.baikalelectronics.ru Git - kernel.git/commit
software node: Fix device_add_software_node()
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>
Mon, 1 Mar 2021 14:30:12 +0000 (17:30 +0300)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 10 Mar 2021 14:25:02 +0000 (15:25 +0100)
commit3a2f2c4bc8f6fbebe6bb54ac9ee299f7d9694983
tree33e536927813e403369f2ffa9096276a19f1424c
parent193da523a099518a8adf113721fd3afd6042d835
software node: Fix device_add_software_node()

The function device_add_software_node() was meant to
register the node supplied to it, but only if that node
wasn't already registered. Right now the function attempts
to always register the node. That will cause a failure with
nodes that are already registered.

Fixing that by incrementing the reference count of the nodes
that have already been registered, and only registering the
new nodes. Also, clarifying the behaviour in the function
documentation.

Fixes: 259afcb49166 ("software node: Introduce device_add_software_node()")
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/base/swnode.c
include/linux/property.h