Merge tag 'devprop-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull device properties framework updates from Rafael Wysocki:
 "Improve software node support (Heikki Krogerus) and clean up two
  assorted pieces of code (Andy Shevchenko, Geert Uytterhoeven)"

* tag 'devprop-5.4-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  software node: Initialize the return value in software_node_find_by_name()
  software node: Initialize the return value in software_node_to_swnode()
  ACPI / property: Fix acpi_graph_get_remote_endpoint() name in kerneldoc
  device property: Remove duplicate test for NULL
  platform/x86: intel_cht_int33fe: Use new API to gain access to the role switch
  usb: roles: intel_xhci: Supplying software node for the role mux
  software node: Add software_node_find_by_name()
Esse commit está contido em:
Linus Torvalds
2019-09-17 19:39:59 -07:00
6 arquivos alterados com 78 adições e 60 exclusões

Ver arquivo

@@ -51,7 +51,7 @@ EXPORT_SYMBOL_GPL(is_software_node);
static struct swnode *
software_node_to_swnode(const struct software_node *node)
{
struct swnode *swnode;
struct swnode *swnode = NULL;
struct kobject *k;
if (!node)
@@ -620,6 +620,43 @@ static const struct fwnode_operations software_node_ops = {
/* -------------------------------------------------------------------------- */
/**
* software_node_find_by_name - Find software node by name
* @parent: Parent of the software node
* @name: Name of the software node
*
* The function will find a node that is child of @parent and that is named
* @name. If no node is found, the function returns NULL.
*
* NOTE: you will need to drop the reference with fwnode_handle_put() after use.
*/
const struct software_node *
software_node_find_by_name(const struct software_node *parent, const char *name)
{
struct swnode *swnode = NULL;
struct kobject *k;
if (!name)
return NULL;
spin_lock(&swnode_kset->list_lock);
list_for_each_entry(k, &swnode_kset->list, entry) {
swnode = kobj_to_swnode(k);
if (parent == swnode->node->parent && swnode->node->name &&
!strcmp(name, swnode->node->name)) {
kobject_get(&swnode->kobj);
break;
}
swnode = NULL;
}
spin_unlock(&swnode_kset->list_lock);
return swnode ? swnode->node : NULL;
}
EXPORT_SYMBOL_GPL(software_node_find_by_name);
static int
software_node_register_properties(struct software_node *node,
const struct property_entry *properties)