Commit fe8152b3 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull device properties framework updates from Rafael Wysocki:
 "These update the handling of software nodes and graph properties, and
  the MAINTAINERS entry for the former.

  Specifics:

   - Remove device_add_properties() which does not work correctly if
     software nodes holding additional device properties are shared or
     reused (Heikki Krogerus).

   - Fix nargs_prop property handling for software nodes (Clément
     Léger).

   - Update documentation of ACPI device properties (Sakari Ailus).

   - Update the handling of graph properties in the generic framework to
     match the DT case (Sakari Ailus).

   - Update software nodes entry in MAINTAINERS (Andy Shevchenko)"

* tag 'devprop-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  software node: Update MAINTAINERS data base
  software node: fix wrong node passed to find nargs_prop
  device property: Drop fwnode_graph_get_remote_node()
  device property: Use fwnode_graph_for_each_endpoint() macro
  device property: Implement fwnode_graph_get_endpoint_count()
  Documentation: ACPI: Update references
  Documentation: ACPI: Fix data node reference documentation
  device property: Fix documentation for FWNODE_GRAPH_DEVICE_DISABLED
  device property: Fix fwnode_graph_devcon_match() fwnode leak
  device property: Remove device_add_properties() API
  driver core: Don't call device_remove_properties() from device_del()
  PCI: Convert to device_create_managed_software_node()
parents fe2437cc 3a571fc1
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
Referencing hierarchical data nodes Referencing hierarchical data nodes
=================================== ===================================
:Copyright: |copy| 2018 Intel Corporation :Copyright: |copy| 2018, 2021 Intel Corporation
:Author: Sakari Ailus <sakari.ailus@linux.intel.com> :Author: Sakari Ailus <sakari.ailus@linux.intel.com>
ACPI in general allows referring to device objects in the tree only. ACPI in general allows referring to device objects in the tree only.
...@@ -13,9 +13,9 @@ Hierarchical data extension nodes may not be referred to directly, hence this ...@@ -13,9 +13,9 @@ Hierarchical data extension nodes may not be referred to directly, hence this
document defines a scheme to implement such references. document defines a scheme to implement such references.
A reference consist of the device object name followed by one or more A reference consist of the device object name followed by one or more
hierarchical data extension [1] keys. Specifically, the hierarchical data hierarchical data extension [dsd-guide] keys. Specifically, the hierarchical
extension node which is referred to by the key shall lie directly under the data extension node which is referred to by the key shall lie directly under
parent object i.e. either the device object or another hierarchical data the parent object i.e. either the device object or another hierarchical data
extension node. extension node.
The keys in the hierarchical data nodes shall consist of the name of the node, The keys in the hierarchical data nodes shall consist of the name of the node,
...@@ -33,7 +33,7 @@ extension key. ...@@ -33,7 +33,7 @@ extension key.
Example Example
======= =======
In the ASL snippet below, the "reference" _DSD property [2] contains a In the ASL snippet below, the "reference" _DSD property contains a
device object reference to DEV0 and under that device object, a device object reference to DEV0 and under that device object, a
hierarchical data extension key "node@1" referring to the NOD1 object hierarchical data extension key "node@1" referring to the NOD1 object
and lastly, a hierarchical data extension key "anothernode" referring to and lastly, a hierarchical data extension key "anothernode" referring to
...@@ -52,12 +52,14 @@ the ANOD object which is also the final target node of the reference. ...@@ -52,12 +52,14 @@ the ANOD object which is also the final target node of the reference.
Name (NOD0, Package() { Name (NOD0, Package() {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () { Package () {
Package () { "reg", 0 },
Package () { "random-property", 3 }, Package () { "random-property", 3 },
} }
}) })
Name (NOD1, Package() { Name (NOD1, Package() {
ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
Package () { Package () {
Package () { "reg", 1 },
Package () { "anothernode", "ANOD" }, Package () { "anothernode", "ANOD" },
} }
}) })
...@@ -74,7 +76,11 @@ the ANOD object which is also the final target node of the reference. ...@@ -74,7 +76,11 @@ the ANOD object which is also the final target node of the reference.
Name (_DSD, Package () { Name (_DSD, Package () {
ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package () { Package () {
Package () { "reference", ^DEV0, "node@1", "anothernode" }, Package () {
"reference", Package () {
^DEV0, "node@1", "anothernode"
}
},
} }
}) })
} }
...@@ -85,10 +91,6 @@ Documentation/firmware-guide/acpi/dsd/graph.rst. ...@@ -85,10 +91,6 @@ Documentation/firmware-guide/acpi/dsd/graph.rst.
References References
========== ==========
[1] Hierarchical Data Extension UUID For _DSD. [dsd-guide] DSD Guide.
<https://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf>, https://github.com/UEFI/DSD-Guide/blob/main/dsd-guide.adoc, referenced
referenced 2018-07-17. 2021-11-30.
[2] Device Properties UUID For _DSD.
<https://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf>,
referenced 2016-10-04.
...@@ -7,11 +7,11 @@ Graphs ...@@ -7,11 +7,11 @@ Graphs
_DSD _DSD
==== ====
_DSD (Device Specific Data) [7] is a predefined ACPI device _DSD (Device Specific Data) [dsd-guide] is a predefined ACPI device
configuration object that can be used to convey information on configuration object that can be used to convey information on
hardware features which are not specifically covered by the ACPI hardware features which are not specifically covered by the ACPI
specification [1][6]. There are two _DSD extensions that are relevant specification [acpi]. There are two _DSD extensions that are relevant
for graphs: property [4] and hierarchical data extensions [5]. The for graphs: property [dsd-guide] and hierarchical data extensions. The
property extension provides generic key-value pairs whereas the property extension provides generic key-value pairs whereas the
hierarchical data extension supports nodes with references to other hierarchical data extension supports nodes with references to other
nodes, forming a tree. The nodes in the tree may contain properties as nodes, forming a tree. The nodes in the tree may contain properties as
...@@ -36,8 +36,9 @@ Ports and endpoints ...@@ -36,8 +36,9 @@ Ports and endpoints
=================== ===================
The port and endpoint concepts are very similar to those in Devicetree The port and endpoint concepts are very similar to those in Devicetree
[3]. A port represents an interface in a device, and an endpoint [devicetree, graph-bindings]. A port represents an interface in a device, and
represents a connection to that interface. an endpoint represents a connection to that interface. Also see [data-node-ref]
for generic data node references.
All port nodes are located under the device's "_DSD" node in the hierarchical All port nodes are located under the device's "_DSD" node in the hierarchical
data extension tree. The data extension related to each port node must begin data extension tree. The data extension related to each port node must begin
...@@ -153,25 +154,20 @@ the "ISP" device and vice versa. ...@@ -153,25 +154,20 @@ the "ISP" device and vice versa.
References References
========== ==========
[1] _DSD (Device Specific Data) Implementation Guide. [acpi] Advanced Configuration and Power Interface Specification.
https://www.uefi.org/sites/default/files/resources/_DSD-implementation-guide-toplevel-1_1.htm, https://uefi.org/specifications/ACPI/6.4/, referenced 2021-11-30.
referenced 2016-10-03.
[2] Devicetree. https://www.devicetree.org, referenced 2016-10-03. [data-node-ref] Documentation/firmware-guide/acpi/dsd/data-node-references.rst
[3] Documentation/devicetree/bindings/graph.txt [devicetree] Devicetree. https://www.devicetree.org, referenced 2016-10-03.
[4] Device Properties UUID For _DSD. [dsd-guide] DSD Guide.
https://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf, https://github.com/UEFI/DSD-Guide/blob/main/dsd-guide.adoc, referenced
referenced 2016-10-04. 2021-11-30.
[5] Hierarchical Data Extension UUID For _DSD. [dsd-rules] _DSD Device Properties Usage Rules.
https://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf,
referenced 2016-10-04.
[6] Advanced Configuration and Power Interface Specification.
https://www.uefi.org/sites/default/files/resources/ACPI_6_1.pdf,
referenced 2016-10-04.
[7] _DSD Device Properties Usage Rules.
Documentation/firmware-guide/acpi/DSD-properties-rules.rst Documentation/firmware-guide/acpi/DSD-properties-rules.rst
[graph-bindings] Common bindings for device graphs (Devicetree).
https://github.com/devicetree-org/dt-schema/blob/main/schemas/graph.yaml,
referenced 2021-11-30.
...@@ -5,19 +5,20 @@ ...@@ -5,19 +5,20 @@
Describing and referring to LEDs in ACPI Describing and referring to LEDs in ACPI
======================================== ========================================
Individual LEDs are described by hierarchical data extension [6] nodes under the Individual LEDs are described by hierarchical data extension [5] nodes under the
device node, the LED driver chip. The "reg" property in the LED specific nodes device node, the LED driver chip. The "reg" property in the LED specific nodes
tells the numerical ID of each individual LED output to which the LEDs are tells the numerical ID of each individual LED output to which the LEDs are
connected. [3] The hierarchical data nodes are named "led@X", where X is the connected. [leds] The hierarchical data nodes are named "led@X", where X is the
number of the LED output. number of the LED output.
Referring to LEDs in Device tree is documented in [4], in "flash-leds" property Referring to LEDs in Device tree is documented in [video-interfaces], in
documentation. In short, LEDs are directly referred to by using phandles. "flash-leds" property documentation. In short, LEDs are directly referred to by
using phandles.
While Device tree allows referring to any node in the tree[1], in ACPI While Device tree allows referring to any node in the tree [devicetree], in
references are limited to device nodes only [2]. For this reason using the same ACPI references are limited to device nodes only [acpi]. For this reason using
mechanism on ACPI is not possible. A mechanism to refer to non-device ACPI nodes the same mechanism on ACPI is not possible. A mechanism to refer to non-device
is documented in [7]. ACPI nodes is documented in [data-node-ref].
ACPI allows (as does DT) using integer arguments after the reference. A ACPI allows (as does DT) using integer arguments after the reference. A
combination of the LED driver device reference and an integer argument, combination of the LED driver device reference and an integer argument,
...@@ -90,22 +91,17 @@ where ...@@ -90,22 +91,17 @@ where
References References
========== ==========
[1] Device tree. https://www.devicetree.org, referenced 2019-02-21. [acpi] Advanced Configuration and Power Interface Specification.
https://uefi.org/specifications/ACPI/6.4/, referenced 2021-11-30.
[2] Advanced Configuration and Power Interface Specification. [data-node-ref] Documentation/firmware-guide/acpi/dsd/data-node-references.rst
https://uefi.org/sites/default/files/resources/ACPI_6_3_final_Jan30.pdf,
referenced 2019-02-21.
[3] Documentation/devicetree/bindings/leds/common.txt [devicetree] Devicetree. https://www.devicetree.org, referenced 2019-02-21.
[4] Documentation/devicetree/bindings/media/video-interfaces.txt [dsd-guide] DSD Guide.
https://github.com/UEFI/DSD-Guide/blob/main/dsd-guide.adoc, referenced
2021-11-30.
[5] Device Properties UUID For _DSD. [leds] Documentation/devicetree/bindings/leds/common.yaml
https://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf,
referenced 2019-02-21.
[6] Hierarchical Data Extension UUID For _DSD. [video-interfaces] Documentation/devicetree/bindings/media/video-interfaces.yaml
https://www.uefi.org/sites/default/files/resources/_DSD-hierarchical-data-extension-UUID-v1.1.pdf,
referenced 2019-02-21.
[7] Documentation/firmware-guide/acpi/dsd/data-node-references.rst
...@@ -4,17 +4,17 @@ ...@@ -4,17 +4,17 @@
MDIO bus and PHYs in ACPI MDIO bus and PHYs in ACPI
========================= =========================
The PHYs on an MDIO bus [1] are probed and registered using The PHYs on an MDIO bus [phy] are probed and registered using
fwnode_mdiobus_register_phy(). fwnode_mdiobus_register_phy().
Later, for connecting these PHYs to their respective MACs, the PHYs registered Later, for connecting these PHYs to their respective MACs, the PHYs registered
on the MDIO bus have to be referenced. on the MDIO bus have to be referenced.
This document introduces two _DSD properties that are to be used This document introduces two _DSD properties that are to be used
for connecting PHYs on the MDIO bus [3] to the MAC layer. for connecting PHYs on the MDIO bus [dsd-properties-rules] to the MAC layer.
These properties are defined in accordance with the "Device These properties are defined in accordance with the "Device
Properties UUID For _DSD" [2] document and the Properties UUID For _DSD" [dsd-guide] document and the
daffd814-6eba-4d8c-8a91-bc9bbf4aa301 UUID must be used in the Device daffd814-6eba-4d8c-8a91-bc9bbf4aa301 UUID must be used in the Device
Data Descriptors containing them. Data Descriptors containing them.
...@@ -48,22 +48,22 @@ as device object references (e.g. \_SB.MDI0.PHY1). ...@@ -48,22 +48,22 @@ as device object references (e.g. \_SB.MDI0.PHY1).
phy-mode phy-mode
-------- --------
The "phy-mode" _DSD property is used to describe the connection to The "phy-mode" _DSD property is used to describe the connection to
the PHY. The valid values for "phy-mode" are defined in [4]. the PHY. The valid values for "phy-mode" are defined in [ethernet-controller].
managed managed
------- -------
Optional property, which specifies the PHY management type. Optional property, which specifies the PHY management type.
The valid values for "managed" are defined in [4]. The valid values for "managed" are defined in [ethernet-controller].
fixed-link fixed-link
---------- ----------
The "fixed-link" is described by a data-only subnode of the The "fixed-link" is described by a data-only subnode of the
MAC port, which is linked in the _DSD package via MAC port, which is linked in the _DSD package via
hierarchical data extension (UUID dbb8e3e6-5886-4ba6-8795-1319f52a966b hierarchical data extension (UUID dbb8e3e6-5886-4ba6-8795-1319f52a966b
in accordance with [5] "_DSD Implementation Guide" document). in accordance with [dsd-guide] "_DSD Implementation Guide" document).
The subnode should comprise a required property ("speed") and The subnode should comprise a required property ("speed") and
possibly the optional ones - complete list of parameters and possibly the optional ones - complete list of parameters and
their values are specified in [4]. their values are specified in [ethernet-controller].
The following ASL example illustrates the usage of these properties. The following ASL example illustrates the usage of these properties.
...@@ -188,12 +188,14 @@ MAC node example with a "fixed-link" subnode. ...@@ -188,12 +188,14 @@ MAC node example with a "fixed-link" subnode.
References References
========== ==========
[1] Documentation/networking/phy.rst [phy] Documentation/networking/phy.rst
[2] https://www.uefi.org/sites/default/files/resources/_DSD-device-properties-UUID.pdf [dsd-properties-rules]
Documentation/firmware-guide/acpi/DSD-properties-rules.rst
[3] Documentation/firmware-guide/acpi/DSD-properties-rules.rst [ethernet-controller]
Documentation/devicetree/bindings/net/ethernet-controller.yaml
[4] Documentation/devicetree/bindings/net/ethernet-controller.yaml [dsd-guide] DSD Guide.
https://github.com/UEFI/DSD-Guide/blob/main/dsd-guide.adoc, referenced
[5] https://github.com/UEFI/DSD-Guide/blob/main/dsd-guide.pdf 2021-11-30.
...@@ -17734,12 +17734,17 @@ F: drivers/firmware/arm_sdei.c ...@@ -17734,12 +17734,17 @@ F: drivers/firmware/arm_sdei.c
F: include/linux/arm_sdei.h F: include/linux/arm_sdei.h
F: include/uapi/linux/arm_sdei.h F: include/uapi/linux/arm_sdei.h
SOFTWARE NODES SOFTWARE NODES AND DEVICE PROPERTIES
R: Andy Shevchenko <andriy.shevchenko@linux.intel.com> R: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
R: Daniel Scally <djrscally@gmail.com>
R: Heikki Krogerus <heikki.krogerus@linux.intel.com> R: Heikki Krogerus <heikki.krogerus@linux.intel.com>
R: Sakari Ailus <sakari.ailus@linux.intel.com>
L: linux-acpi@vger.kernel.org L: linux-acpi@vger.kernel.org
S: Maintained S: Maintained
F: drivers/base/property.c
F: drivers/base/swnode.c F: drivers/base/swnode.c
F: include/linux/fwnode.h
F: include/linux/property.h
SOFTWARE RAID (Multiple Disks) SUPPORT SOFTWARE RAID (Multiple Disks) SUPPORT
M: Song Liu <song@kernel.org> M: Song Liu <song@kernel.org>
......
...@@ -3581,7 +3581,6 @@ void device_del(struct device *dev) ...@@ -3581,7 +3581,6 @@ void device_del(struct device *dev)
device_pm_remove(dev); device_pm_remove(dev);
driver_deferred_probe_del(dev); driver_deferred_probe_del(dev);
device_platform_notify_remove(dev); device_platform_notify_remove(dev);
device_remove_properties(dev);
device_links_purge(dev); device_links_purge(dev);
if (dev->bus) if (dev->bus)
......
...@@ -507,54 +507,6 @@ struct fwnode_handle *fwnode_find_reference(const struct fwnode_handle *fwnode, ...@@ -507,54 +507,6 @@ struct fwnode_handle *fwnode_find_reference(const struct fwnode_handle *fwnode,
} }
EXPORT_SYMBOL_GPL(fwnode_find_reference); EXPORT_SYMBOL_GPL(fwnode_find_reference);
/**
* device_remove_properties - Remove properties from a device object.
* @dev: Device whose properties to remove.
*
* The function removes properties previously associated to the device
* 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 = dev_fwnode(dev);
if (!fwnode)
return;
if (is_software_node(fwnode->secondary)) {
fwnode_remove_software_node(fwnode->secondary);
set_secondary_fwnode(dev, NULL);
}
}
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. The function takes a copy of @properties.
*
* 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.
*/
int device_add_properties(struct device *dev,
const struct property_entry *properties)
{
struct fwnode_handle *fwnode;
fwnode = fwnode_create_software_node(properties, NULL);
if (IS_ERR(fwnode))
return PTR_ERR(fwnode);
set_secondary_fwnode(dev, fwnode);
return 0;
}
EXPORT_SYMBOL_GPL(device_add_properties);
/** /**
* fwnode_get_name - Return the name of a node * fwnode_get_name - Return the name of a node
* @fwnode: The firmware node * @fwnode: The firmware node
...@@ -1059,43 +1011,17 @@ fwnode_graph_get_remote_endpoint(const struct fwnode_handle *fwnode) ...@@ -1059,43 +1011,17 @@ fwnode_graph_get_remote_endpoint(const struct fwnode_handle *fwnode)
} }
EXPORT_SYMBOL_GPL(fwnode_graph_get_remote_endpoint); EXPORT_SYMBOL_GPL(fwnode_graph_get_remote_endpoint);
/** static bool fwnode_graph_remote_available(struct fwnode_handle *ep)
* fwnode_graph_get_remote_node - get remote parent node for given port/endpoint
* @fwnode: pointer to parent fwnode_handle containing graph port/endpoint
* @port_id: identifier of the parent port node
* @endpoint_id: identifier of the endpoint node
*
* Return: Remote fwnode handle associated with remote endpoint node linked
* to @node. Use fwnode_node_put() on it when done.
*/
struct fwnode_handle *
fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port_id,
u32 endpoint_id)
{ {
struct fwnode_handle *endpoint = NULL; struct fwnode_handle *dev_node;
bool available;
while ((endpoint = fwnode_graph_get_next_endpoint(fwnode, endpoint))) {
struct fwnode_endpoint fwnode_ep;
struct fwnode_handle *remote;
int ret;
ret = fwnode_graph_parse_endpoint(endpoint, &fwnode_ep); dev_node = fwnode_graph_get_remote_port_parent(ep);
if (ret < 0) available = fwnode_device_is_available(dev_node);
continue; fwnode_handle_put(dev_node);
if (fwnode_ep.port != port_id || fwnode_ep.id != endpoint_id) return available;
continue;
remote = fwnode_graph_get_remote_port_parent(endpoint);
if (!remote)
return NULL;
return fwnode_device_is_available(remote) ? remote : NULL;
}
return NULL;
} }
EXPORT_SYMBOL_GPL(fwnode_graph_get_remote_node);
/** /**
* fwnode_graph_get_endpoint_by_id - get endpoint by port and endpoint numbers * fwnode_graph_get_endpoint_by_id - get endpoint by port and endpoint numbers
...@@ -1111,8 +1037,8 @@ EXPORT_SYMBOL_GPL(fwnode_graph_get_remote_node); ...@@ -1111,8 +1037,8 @@ EXPORT_SYMBOL_GPL(fwnode_graph_get_remote_node);
* has not been found, look for the closest endpoint ID greater than the * has not been found, look for the closest endpoint ID greater than the
* specified one and return the endpoint that corresponds to it, if present. * specified one and return the endpoint that corresponds to it, if present.
* *
* Do not return endpoints that belong to disabled devices, unless * Does not return endpoints that belong to disabled devices or endpoints that
* FWNODE_GRAPH_DEVICE_DISABLED is passed in @flags. * are unconnected, unless FWNODE_GRAPH_DEVICE_DISABLED is passed in @flags.
* *
* The returned endpoint needs to be released by calling fwnode_handle_put() on * The returned endpoint needs to be released by calling fwnode_handle_put() on
* it when it is not needed any more. * it when it is not needed any more.
...@@ -1121,25 +1047,17 @@ struct fwnode_handle * ...@@ -1121,25 +1047,17 @@ struct fwnode_handle *
fwnode_graph_get_endpoint_by_id(const struct fwnode_handle *fwnode, fwnode_graph_get_endpoint_by_id(const struct fwnode_handle *fwnode,
u32 port, u32 endpoint, unsigned long flags) u32 port, u32 endpoint, unsigned long flags)
{ {
struct fwnode_handle *ep = NULL, *best_ep = NULL; struct fwnode_handle *ep, *best_ep = NULL;
unsigned int best_ep_id = 0; unsigned int best_ep_id = 0;
bool endpoint_next = flags & FWNODE_GRAPH_ENDPOINT_NEXT; bool endpoint_next = flags & FWNODE_GRAPH_ENDPOINT_NEXT;
bool enabled_only = !(flags & FWNODE_GRAPH_DEVICE_DISABLED); bool enabled_only = !(flags & FWNODE_GRAPH_DEVICE_DISABLED);
while ((ep = fwnode_graph_get_next_endpoint(fwnode, ep))) { fwnode_graph_for_each_endpoint(fwnode, ep) {
struct fwnode_endpoint fwnode_ep = { 0 }; struct fwnode_endpoint fwnode_ep = { 0 };
int ret; int ret;
if (enabled_only) { if (enabled_only && !fwnode_graph_remote_available(ep))
struct fwnode_handle *dev_node; continue;
bool available;
dev_node = fwnode_graph_get_remote_port_parent(ep);
available = fwnode_device_is_available(dev_node);
fwnode_handle_put(dev_node);
if (!available)
continue;
}
ret = fwnode_graph_parse_endpoint(ep, &fwnode_ep); ret = fwnode_graph_parse_endpoint(ep, &fwnode_ep);
if (ret < 0) if (ret < 0)
...@@ -1172,6 +1090,31 @@ fwnode_graph_get_endpoint_by_id(const struct fwnode_handle *fwnode, ...@@ -1172,6 +1090,31 @@ fwnode_graph_get_endpoint_by_id(const struct fwnode_handle *fwnode,
} }
EXPORT_SYMBOL_GPL(fwnode_graph_get_endpoint_by_id); EXPORT_SYMBOL_GPL(fwnode_graph_get_endpoint_by_id);
/**
* fwnode_graph_get_endpoint_count - Count endpoints on a device node
* @fwnode: The node related to a device
* @flags: fwnode lookup flags
* Count endpoints in a device node.
*
* If FWNODE_GRAPH_DEVICE_DISABLED flag is specified, also unconnected endpoints
* and endpoints connected to disabled devices are counted.
*/
unsigned int fwnode_graph_get_endpoint_count(struct fwnode_handle *fwnode,
unsigned long flags)
{
struct fwnode_handle *ep;
unsigned int count = 0;
fwnode_graph_for_each_endpoint(fwnode, ep) {
if (flags & FWNODE_GRAPH_DEVICE_DISABLED ||
fwnode_graph_remote_available(ep))
count++;
}
return count;
}
EXPORT_SYMBOL_GPL(fwnode_graph_get_endpoint_count);
/** /**
* fwnode_graph_parse_endpoint - parse common endpoint node properties * fwnode_graph_parse_endpoint - parse common endpoint node properties
* @fwnode: pointer to endpoint fwnode_handle * @fwnode: pointer to endpoint fwnode_handle
...@@ -1206,8 +1149,10 @@ fwnode_graph_devcon_match(struct fwnode_handle *fwnode, const char *con_id, ...@@ -1206,8 +1149,10 @@ fwnode_graph_devcon_match(struct fwnode_handle *fwnode, const char *con_id,
fwnode_graph_for_each_endpoint(fwnode, ep) { fwnode_graph_for_each_endpoint(fwnode, ep) {
node = fwnode_graph_get_remote_port_parent(ep); node = fwnode_graph_get_remote_port_parent(ep);
if (!fwnode_device_is_available(node)) if (!fwnode_device_is_available(node)) {
fwnode_handle_put(node);
continue; continue;
}
ret = match(node, con_id, data); ret = match(node, con_id, data);
fwnode_handle_put(node); fwnode_handle_put(node);
......
...@@ -529,7 +529,7 @@ software_node_get_reference_args(const struct fwnode_handle *fwnode, ...@@ -529,7 +529,7 @@ software_node_get_reference_args(const struct fwnode_handle *fwnode,
return -ENOENT; return -ENOENT;
if (nargs_prop) { if (nargs_prop) {
error = property_entry_read_int_array(swnode->node->properties, error = property_entry_read_int_array(ref->node->properties,
nargs_prop, sizeof(u32), nargs_prop, sizeof(u32),
&nargs_prop_val, 1); &nargs_prop_val, 1);
if (error) if (error)
......
...@@ -1850,7 +1850,7 @@ static void quirk_huawei_pcie_sva(struct pci_dev *pdev) ...@@ -1850,7 +1850,7 @@ static void quirk_huawei_pcie_sva(struct pci_dev *pdev)
* can set it directly. * can set it directly.
*/ */
if (!pdev->dev.of_node && if (!pdev->dev.of_node &&
device_add_properties(&pdev->dev, properties)) device_create_managed_software_node(&pdev->dev, properties, NULL))
pci_warn(pdev, "could not add stall property"); pci_warn(pdev, "could not add stall property");
} }
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_HUAWEI, 0xa250, quirk_huawei_pcie_sva); DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_HUAWEI, 0xa250, quirk_huawei_pcie_sva);
......
...@@ -1845,7 +1845,6 @@ static int tegra_vi_graph_init(struct tegra_vi *vi) ...@@ -1845,7 +1845,6 @@ static int tegra_vi_graph_init(struct tegra_vi *vi)
struct tegra_vi_channel *chan; struct tegra_vi_channel *chan;
struct fwnode_handle *fwnode = dev_fwnode(vi->dev); struct fwnode_handle *fwnode = dev_fwnode(vi->dev);
int ret; int ret;
struct fwnode_handle *remote = NULL;
/* /*
* Walk the links to parse the full graph. Each channel will have * Walk the links to parse the full graph. Each channel will have
...@@ -1857,11 +1856,16 @@ static int tegra_vi_graph_init(struct tegra_vi *vi) ...@@ -1857,11 +1856,16 @@ static int tegra_vi_graph_init(struct tegra_vi *vi)
* next channels. * next channels.
*/ */
list_for_each_entry(chan, &vi->vi_chans, list) { list_for_each_entry(chan, &vi->vi_chans, list) {
remote = fwnode_graph_get_remote_node(fwnode, chan->portnos[0], struct fwnode_handle *ep, *remote;
0);
if (!remote) ep = fwnode_graph_get_endpoint_by_id(fwnode,
chan->portnos[0], 0, 0);
if (!ep)
continue; continue;
remote = fwnode_graph_get_remote_port_parent(ep);
fwnode_handle_put(ep);
ret = tegra_vi_graph_parse_one(chan, remote); ret = tegra_vi_graph_parse_one(chan, remote);
fwnode_handle_put(remote); fwnode_handle_put(remote);
if (ret < 0 || list_empty(&chan->notifier.asd_list)) if (ret < 0 || list_empty(&chan->notifier.asd_list))
......
...@@ -378,10 +378,6 @@ property_entries_dup(const struct property_entry *properties); ...@@ -378,10 +378,6 @@ property_entries_dup(const struct property_entry *properties);
void property_entries_free(const struct property_entry *properties); void property_entries_free(const struct property_entry *properties);
int device_add_properties(struct device *dev,
const struct property_entry *properties);
void device_remove_properties(struct device *dev);
bool device_dma_supported(struct device *dev); bool device_dma_supported(struct device *dev);
enum dev_dma_attr device_get_dma_attr(struct device *dev); enum dev_dma_attr device_get_dma_attr(struct device *dev);
...@@ -401,9 +397,6 @@ struct fwnode_handle *fwnode_graph_get_remote_port( ...@@ -401,9 +397,6 @@ struct fwnode_handle *fwnode_graph_get_remote_port(
const struct fwnode_handle *fwnode); const struct fwnode_handle *fwnode);
struct fwnode_handle *fwnode_graph_get_remote_endpoint( struct fwnode_handle *fwnode_graph_get_remote_endpoint(
const struct fwnode_handle *fwnode); const struct fwnode_handle *fwnode);
struct fwnode_handle *
fwnode_graph_get_remote_node(const struct fwnode_handle *fwnode, u32 port,
u32 endpoint);
static inline bool fwnode_graph_is_endpoint(struct fwnode_handle *fwnode) static inline bool fwnode_graph_is_endpoint(struct fwnode_handle *fwnode)
{ {
...@@ -418,7 +411,8 @@ static inline bool fwnode_graph_is_endpoint(struct fwnode_handle *fwnode) ...@@ -418,7 +411,8 @@ static inline bool fwnode_graph_is_endpoint(struct fwnode_handle *fwnode)
* one. * one.
* @FWNODE_GRAPH_DEVICE_DISABLED: That the device to which the remote * @FWNODE_GRAPH_DEVICE_DISABLED: That the device to which the remote
* endpoint of the given endpoint belongs to, * endpoint of the given endpoint belongs to,
* may be disabled. * may be disabled, or that the endpoint is not
* connected.
*/ */
#define FWNODE_GRAPH_ENDPOINT_NEXT BIT(0) #define FWNODE_GRAPH_ENDPOINT_NEXT BIT(0)
#define FWNODE_GRAPH_DEVICE_DISABLED BIT(1) #define FWNODE_GRAPH_DEVICE_DISABLED BIT(1)
...@@ -426,6 +420,8 @@ static inline bool fwnode_graph_is_endpoint(struct fwnode_handle *fwnode) ...@@ -426,6 +420,8 @@ static inline bool fwnode_graph_is_endpoint(struct fwnode_handle *fwnode)
struct fwnode_handle * struct fwnode_handle *
fwnode_graph_get_endpoint_by_id(const struct fwnode_handle *fwnode, fwnode_graph_get_endpoint_by_id(const struct fwnode_handle *fwnode,
u32 port, u32 endpoint, unsigned long flags); u32 port, u32 endpoint, unsigned long flags);
unsigned int fwnode_graph_get_endpoint_count(struct fwnode_handle *fwnode,
unsigned long flags);
#define fwnode_graph_for_each_endpoint(fwnode, child) \ #define fwnode_graph_for_each_endpoint(fwnode, child) \
for (child = NULL; \ for (child = NULL; \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment