sphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}(hhparenthuba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget*/translations/zh_CN/driver-api/device_linkmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}(hhhh2ubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget*/translations/zh_TW/driver-api/device_linkmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}(hhhhFubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget*/translations/it_IT/driver-api/device_linkmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}(hhhhZubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget*/translations/ja_JP/driver-api/device_linkmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}(hhhhnubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget*/translations/ko_KR/driver-api/device_linkmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}(hhhhubah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget*/translations/sp_SP/driver-api/device_linkmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhtarget)}(h.. _device_link:h]h}(h]h ]h"]h$]h&]refid device-linkuh1hhKhhhhhD/var/lib/git/docbuild/linux/Documentation/driver-api/device_link.rstubhsection)}(hhh](htitle)}(h Device linksh]h Device links}(hhhhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hXjBy default, the driver core only enforces dependencies between devices that are borne out of a parent/child relationship within the device hierarchy: When suspending, resuming or shutting down the system, devices are ordered based on this relationship, i.e. children are always suspended before their parent, and the parent is always resumed before its children.h]hXjBy default, the driver core only enforces dependencies between devices that are borne out of a parent/child relationship within the device hierarchy: When suspending, resuming or shutting down the system, devices are ordered based on this relationship, i.e. children are always suspended before their parent, and the parent is always resumed before its children.}(hhhhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hSometimes there is a need to represent device dependencies beyond the mere parent/child relationship, e.g. between siblings, and have the driver core automatically take care of them.h]hSometimes there is a need to represent device dependencies beyond the mere parent/child relationship, e.g. between siblings, and have the driver core automatically take care of them.}(hhhhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hSecondly, the driver core by default does not enforce any driver presence dependencies, i.e. that one device must be bound to a driver before another one can probe or function correctly.h]hSecondly, the driver core by default does not enforce any driver presence dependencies, i.e. that one device must be bound to a driver before another one can probe or function correctly.}(hhhhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hOften these two dependency types come together, so a device depends on another one both with regards to driver presence *and* with regards to suspend/resume and shutdown ordering.h](hxOften these two dependency types come together, so a device depends on another one both with regards to driver presence }(hxOften these two dependency types come together, so a device depends on another one both with regards to driver presence hhhhhNhNubhemphasis)}(h*and*h]hand}(hhhhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhubh6 with regards to suspend/resume and shutdown ordering.}(h6 with regards to suspend/resume and shutdown ordering.hhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hJDevice links allow representation of such dependencies in the driver core.h]hJDevice links allow representation of such dependencies in the driver core.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hX|In its standard or *managed* form, a device link combines *both* dependency types: It guarantees correct suspend/resume and shutdown ordering between a "supplier" device and its "consumer" devices, and it guarantees driver presence on the supplier. The consumer devices are not probed before the supplier is bound to a driver, and they're unbound before the supplier is unbound.h](hIn its standard or }(hIn its standard or hj#hhhNhNubh)}(h *managed*h]hmanaged}(hhhj,hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj#ubh form, a device link combines }(h form, a device link combines hj#hhhNhNubh)}(h*both*h]hboth}(hhhj?hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj#ubhXF dependency types: It guarantees correct suspend/resume and shutdown ordering between a “supplier” device and its “consumer” devices, and it guarantees driver presence on the supplier. The consumer devices are not probed before the supplier is bound to a driver, and they’re unbound before the supplier is unbound.}(hX< dependency types: It guarantees correct suspend/resume and shutdown ordering between a "supplier" device and its "consumer" devices, and it guarantees driver presence on the supplier. The consumer devices are not probed before the supplier is bound to a driver, and they're unbound before the supplier is unbound.hj#hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXWhen driver presence on the supplier is irrelevant and only correct suspend/resume and shutdown ordering is needed, the device link may simply be set up with the ``DL_FLAG_STATELESS`` flag. In other words, enforcing driver presence on the supplier is optional.h](hWhen driver presence on the supplier is irrelevant and only correct suspend/resume and shutdown ordering is needed, the device link may simply be set up with the }(hWhen driver presence on the supplier is irrelevant and only correct suspend/resume and shutdown ordering is needed, the device link may simply be set up with the hjXhhhNhNubhliteral)}(h``DL_FLAG_STATELESS``h]hDL_FLAG_STATELESS}(hhhjchhhNhNubah}(h]h ]h"]h$]h&]uh1jahjXubhN flag. In other words, enforcing driver presence on the supplier is optional.}(hN flag. In other words, enforcing driver presence on the supplier is optional.hjXhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK"hhhhubh)}(hXAnother optional feature is runtime PM integration: By setting the ``DL_FLAG_PM_RUNTIME`` flag on addition of the device link, the PM core is instructed to runtime resume the supplier and keep it active whenever and for as long as the consumer is runtime resumed.h](hDAnother optional feature is runtime PM integration: By setting the }(hDAnother optional feature is runtime PM integration: By setting the hj|hhhNhNubjb)}(h``DL_FLAG_PM_RUNTIME``h]hDL_FLAG_PM_RUNTIME}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jahj|ubh flag on addition of the device link, the PM core is instructed to runtime resume the supplier and keep it active whenever and for as long as the consumer is runtime resumed.}(h flag on addition of the device link, the PM core is instructed to runtime resume the supplier and keep it active whenever and for as long as the consumer is runtime resumed.hj|hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK'hhhhubh)}(hhh](h)}(hUsageh]hUsage}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK-ubh)}(hThe earliest point in time when device links can be added is after :c:func:`device_add()` has been called for the supplier and :c:func:`device_initialize()` has been called for the consumer.h](hCThe earliest point in time when device links can be added is after }(hCThe earliest point in time when device links can be added is after hjhhhNhNubh)}(h:c:func:`device_add()`h]jb)}(hjh]h device_add()}(hhhjhhhNhNubah}(h]h ](xrefcc-funceh"]h$]h&]uh1jahjubah}(h]h ]h"]h$]h&]refdocdriver-api/device_link refdomainjreftypefunc refexplicitrefwarn reftarget device_adduh1hhhhK/hjubh& has been called for the supplier and }(h& has been called for the supplier and hjhhhNhNubh)}(h:c:func:`device_initialize()`h]jb)}(hjh]hdevice_initialize()}(hhhjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjdevice_initializeuh1hhhhK/hjubh" has been called for the consumer.}(h" has been called for the consumer.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK/hjhhubh)}(hXIt is legal to add them later, but care must be taken that the system remains in a consistent state: E.g. a device link cannot be added in the midst of a suspend/resume transition, so either commencement of such a transition needs to be prevented with :c:func:`lock_system_sleep()`, or the device link needs to be added from a function which is guaranteed not to run in parallel to a suspend/resume transition, such as from a device ``->probe`` callback or a boot-time PCI quirk.h](hIt is legal to add them later, but care must be taken that the system remains in a consistent state: E.g. a device link cannot be added in the midst of a suspend/resume transition, so either commencement of such a transition needs to be prevented with }(hIt is legal to add them later, but care must be taken that the system remains in a consistent state: E.g. a device link cannot be added in the midst of a suspend/resume transition, so either commencement of such a transition needs to be prevented with hj hhhNhNubh)}(h:c:func:`lock_system_sleep()`h]jb)}(hjh]hlock_system_sleep()}(hhhjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjlock_system_sleepuh1hhhhK3hj ubh, or the device link needs to be added from a function which is guaranteed not to run in parallel to a suspend/resume transition, such as from a device }(h, or the device link needs to be added from a function which is guaranteed not to run in parallel to a suspend/resume transition, such as from a device hj hhhNhNubjb)}(h ``->probe``h]h->probe}(hhhj7hhhNhNubah}(h]h ]h"]h$]h&]uh1jahj ubh# callback or a boot-time PCI quirk.}(h# callback or a boot-time PCI quirk.hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK3hjhhubh)}(hX;Another example for an inconsistent state would be a device link that represents a driver presence dependency, yet is added from the consumer's ``->probe`` callback while the supplier hasn't started to probe yet: Had the driver core known about the device link earlier, it wouldn't have probed the consumer in the first place. The onus is thus on the consumer to check presence of the supplier after adding the link, and defer probing on non-presence. [Note that it is valid to create a link from the consumer's ``->probe`` callback while the supplier is still probing, but the consumer must know that the supplier is functional already at the link creation time (that is the case, for instance, if the consumer has just acquired some resources that would not have been available had the supplier not been functional then).]h](hAnother example for an inconsistent state would be a device link that represents a driver presence dependency, yet is added from the consumer’s }(hAnother example for an inconsistent state would be a device link that represents a driver presence dependency, yet is added from the consumer's hjPhhhNhNubjb)}(h ``->probe``h]h->probe}(hhhjYhhhNhNubah}(h]h ]h"]h$]h&]uh1jahjPubhXn callback while the supplier hasn’t started to probe yet: Had the driver core known about the device link earlier, it wouldn’t have probed the consumer in the first place. The onus is thus on the consumer to check presence of the supplier after adding the link, and defer probing on non-presence. [Note that it is valid to create a link from the consumer’s }(hXh callback while the supplier hasn't started to probe yet: Had the driver core known about the device link earlier, it wouldn't have probed the consumer in the first place. The onus is thus on the consumer to check presence of the supplier after adding the link, and defer probing on non-presence. [Note that it is valid to create a link from the consumer's hjPhhhNhNubjb)}(h ``->probe``h]h->probe}(hhhjlhhhNhNubah}(h]h ]h"]h$]h&]uh1jahjPubhX- callback while the supplier is still probing, but the consumer must know that the supplier is functional already at the link creation time (that is the case, for instance, if the consumer has just acquired some resources that would not have been available had the supplier not been functional then).]}(hX- callback while the supplier is still probing, but the consumer must know that the supplier is functional already at the link creation time (that is the case, for instance, if the consumer has just acquired some resources that would not have been available had the supplier not been functional then).]hjPhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK;hjhhubh)}(hX+If a device link with ``DL_FLAG_STATELESS`` set (i.e. a stateless device link) is added in the ``->probe`` callback of the supplier or consumer driver, it is typically deleted in its ``->remove`` callback for symmetry. That way, if the driver is compiled as a module, the device link is added on module load and orderly deleted on unload. The same restrictions that apply to device link addition (e.g. exclusion of a parallel suspend/resume transition) apply equally to deletion. Device links managed by the driver core are deleted automatically by it.h](hIf a device link with }(hIf a device link with hjhhhNhNubjb)}(h``DL_FLAG_STATELESS``h]hDL_FLAG_STATELESS}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jahjubh4 set (i.e. a stateless device link) is added in the }(h4 set (i.e. a stateless device link) is added in the hjhhhNhNubjb)}(h ``->probe``h]h->probe}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jahjubhM callback of the supplier or consumer driver, it is typically deleted in its }(hM callback of the supplier or consumer driver, it is typically deleted in its hjhhhNhNubjb)}(h ``->remove``h]h->remove}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jahjubhXh callback for symmetry. That way, if the driver is compiled as a module, the device link is added on module load and orderly deleted on unload. The same restrictions that apply to device link addition (e.g. exclusion of a parallel suspend/resume transition) apply equally to deletion. Device links managed by the driver core are deleted automatically by it.}(hXh callback for symmetry. That way, if the driver is compiled as a module, the device link is added on module load and orderly deleted on unload. The same restrictions that apply to device link addition (e.g. exclusion of a parallel suspend/resume transition) apply equally to deletion. Device links managed by the driver core are deleted automatically by it.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKGhjhhubh)}(hX<Several flags may be specified on device link addition, two of which have already been mentioned above: ``DL_FLAG_STATELESS`` to express that no driver presence dependency is needed (but only correct suspend/resume and shutdown ordering) and ``DL_FLAG_PM_RUNTIME`` to express that runtime PM integration is desired.h](hiSeveral flags may be specified on device link addition, two of which have already been mentioned above: }(hiSeveral flags may be specified on device link addition, two of which have already been mentioned above: hjhhhNhNubjb)}(h``DL_FLAG_STATELESS``h]hDL_FLAG_STATELESS}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jahjubhu to express that no driver presence dependency is needed (but only correct suspend/resume and shutdown ordering) and }(hu to express that no driver presence dependency is needed (but only correct suspend/resume and shutdown ordering) and hjhhhNhNubjb)}(h``DL_FLAG_PM_RUNTIME``h]hDL_FLAG_PM_RUNTIME}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jahjubh3 to express that runtime PM integration is desired.}(h3 to express that runtime PM integration is desired.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKPhjhhubh)}(hXTwo other flags are specifically targeted at use cases where the device link is added from the consumer's ``->probe`` callback: ``DL_FLAG_RPM_ACTIVE`` can be specified to runtime resume the supplier and prevent it from suspending before the consumer is runtime suspended. ``DL_FLAG_AUTOREMOVE_CONSUMER`` causes the device link to be automatically purged when the consumer fails to probe or later unbinds.h](hlTwo other flags are specifically targeted at use cases where the device link is added from the consumer’s }(hjTwo other flags are specifically targeted at use cases where the device link is added from the consumer's hjhhhNhNubjb)}(h ``->probe``h]h->probe}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]uh1jahjubh callback: }(h callback: hjhhhNhNubjb)}(h``DL_FLAG_RPM_ACTIVE``h]hDL_FLAG_RPM_ACTIVE}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jahjubh{ can be specified to runtime resume the supplier and prevent it from suspending before the consumer is runtime suspended. }(h{ can be specified to runtime resume the supplier and prevent it from suspending before the consumer is runtime suspended. hjhhhNhNubjb)}(h``DL_FLAG_AUTOREMOVE_CONSUMER``h]hDL_FLAG_AUTOREMOVE_CONSUMER}(hhhj1hhhNhNubah}(h]h ]h"]h$]h&]uh1jahjubhe causes the device link to be automatically purged when the consumer fails to probe or later unbinds.}(he causes the device link to be automatically purged when the consumer fails to probe or later unbinds.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKVhjhhubh)}(hSimilarly, when the device link is added from supplier's ``->probe`` callback, ``DL_FLAG_AUTOREMOVE_SUPPLIER`` causes the device link to be automatically purged when the supplier fails to probe or later unbinds.h](h;Similarly, when the device link is added from supplier’s }(h9Similarly, when the device link is added from supplier's hjJhhhNhNubjb)}(h ``->probe``h]h->probe}(hhhjShhhNhNubah}(h]h ]h"]h$]h&]uh1jahjJubh callback, }(h callback, hjJhhhNhNubjb)}(h``DL_FLAG_AUTOREMOVE_SUPPLIER``h]hDL_FLAG_AUTOREMOVE_SUPPLIER}(hhhjfhhhNhNubah}(h]h ]h"]h$]h&]uh1jahjJubhe causes the device link to be automatically purged when the supplier fails to probe or later unbinds.}(he causes the device link to be automatically purged when the supplier fails to probe or later unbinds.hjJhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK]hjhhubh)}(hXIf neither ``DL_FLAG_AUTOREMOVE_CONSUMER`` nor ``DL_FLAG_AUTOREMOVE_SUPPLIER`` is set, ``DL_FLAG_AUTOPROBE_CONSUMER`` can be used to request the driver core to probe for a driver for the consumer driver on the link automatically after a driver has been bound to the supplier device.h](h If neither }(h If neither hjhhhNhNubjb)}(h``DL_FLAG_AUTOREMOVE_CONSUMER``h]hDL_FLAG_AUTOREMOVE_CONSUMER}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jahjubh nor }(h nor hjhhhNhNubjb)}(h``DL_FLAG_AUTOREMOVE_SUPPLIER``h]hDL_FLAG_AUTOREMOVE_SUPPLIER}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jahjubh is set, }(h is set, hjhhhNhNubjb)}(h``DL_FLAG_AUTOPROBE_CONSUMER``h]hDL_FLAG_AUTOPROBE_CONSUMER}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jahjubh can be used to request the driver core to probe for a driver for the consumer driver on the link automatically after a driver has been bound to the supplier device.}(h can be used to request the driver core to probe for a driver for the consumer driver on the link automatically after a driver has been bound to the supplier device.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKahjhhubh)}(hNote, however, that any combinations of ``DL_FLAG_AUTOREMOVE_CONSUMER``, ``DL_FLAG_AUTOREMOVE_SUPPLIER`` or ``DL_FLAG_AUTOPROBE_CONSUMER`` with ``DL_FLAG_STATELESS`` are invalid and cannot be used.h](h(Note, however, that any combinations of }(h(Note, however, that any combinations of hjhhhNhNubjb)}(h``DL_FLAG_AUTOREMOVE_CONSUMER``h]hDL_FLAG_AUTOREMOVE_CONSUMER}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jahjubh, }(h, hjhhhNhNubjb)}(h``DL_FLAG_AUTOREMOVE_SUPPLIER``h]hDL_FLAG_AUTOREMOVE_SUPPLIER}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jahjubh or }(h or hjhhhNhNubjb)}(h``DL_FLAG_AUTOPROBE_CONSUMER``h]hDL_FLAG_AUTOPROBE_CONSUMER}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jahjubh with }(h with hjhhhNhNubjb)}(h``DL_FLAG_STATELESS``h]hDL_FLAG_STATELESS}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]uh1jahjubh are invalid and cannot be used.}(h are invalid and cannot be used.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKfhjhhubeh}(h]usageah ]h"]usageah$]h&]uh1hhhhhhhhK-ubh)}(hhh](h)}(h Limitationsh]h Limitations}(hj/hj-hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj*hhhhhKkubh)}(hXDriver authors should be aware that a driver presence dependency for managed device links (i.e. when ``DL_FLAG_STATELESS`` is not specified on link addition) may cause probing of the consumer to be deferred indefinitely. This can become a problem if the consumer is required to probe before a certain initcall level is reached. Worse, if the supplier driver is blacklisted or missing, the consumer will never be probed.h](heDriver authors should be aware that a driver presence dependency for managed device links (i.e. when }(heDriver authors should be aware that a driver presence dependency for managed device links (i.e. when hj;hhhNhNubjb)}(h``DL_FLAG_STATELESS``h]hDL_FLAG_STATELESS}(hhhjDhhhNhNubah}(h]h ]h"]h$]h&]uh1jahj;ubhX+ is not specified on link addition) may cause probing of the consumer to be deferred indefinitely. This can become a problem if the consumer is required to probe before a certain initcall level is reached. Worse, if the supplier driver is blacklisted or missing, the consumer will never be probed.}(hX+ is not specified on link addition) may cause probing of the consumer to be deferred indefinitely. This can become a problem if the consumer is required to probe before a certain initcall level is reached. Worse, if the supplier driver is blacklisted or missing, the consumer will never be probed.hj;hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKmhj*hhubh)}(hXMoreover, managed device links cannot be deleted directly. They are deleted by the driver core when they are not necessary any more in accordance with the ``DL_FLAG_AUTOREMOVE_CONSUMER`` and ``DL_FLAG_AUTOREMOVE_SUPPLIER`` flags. However, stateless device links (i.e. device links with ``DL_FLAG_STATELESS`` set) are expected to be removed by whoever called :c:func:`device_link_add()` to add them with the help of either :c:func:`device_link_del()` or :c:func:`device_link_remove()`.h](hMoreover, managed device links cannot be deleted directly. They are deleted by the driver core when they are not necessary any more in accordance with the }(hMoreover, managed device links cannot be deleted directly. They are deleted by the driver core when they are not necessary any more in accordance with the hj]hhhNhNubjb)}(h``DL_FLAG_AUTOREMOVE_CONSUMER``h]hDL_FLAG_AUTOREMOVE_CONSUMER}(hhhjfhhhNhNubah}(h]h ]h"]h$]h&]uh1jahj]ubh and }(h and hj]hhhNhNubjb)}(h``DL_FLAG_AUTOREMOVE_SUPPLIER``h]hDL_FLAG_AUTOREMOVE_SUPPLIER}(hhhjyhhhNhNubah}(h]h ]h"]h$]h&]uh1jahj]ubh@ flags. However, stateless device links (i.e. device links with }(h@ flags. However, stateless device links (i.e. device links with hj]hhhNhNubjb)}(h``DL_FLAG_STATELESS``h]hDL_FLAG_STATELESS}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jahj]ubh3 set) are expected to be removed by whoever called }(h3 set) are expected to be removed by whoever called hj]hhhNhNubh)}(h:c:func:`device_link_add()`h]jb)}(hjh]hdevice_link_add()}(hhhjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjdevice_link_adduh1hhhhKthj]ubh% to add them with the help of either }(h% to add them with the help of either hj]hhhNhNubh)}(h:c:func:`device_link_del()`h]jb)}(hjh]hdevice_link_del()}(hhhjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjdevice_link_deluh1hhhhKthj]ubh or }(h or hj]hhhNhNubh)}(h:c:func:`device_link_remove()`h]jb)}(hjh]hdevice_link_remove()}(hhhjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjdevice_link_removeuh1hhhhKthj]ubh.}(h.hj]hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKthj*hhubh)}(hXPassing ``DL_FLAG_RPM_ACTIVE`` along with ``DL_FLAG_STATELESS`` to :c:func:`device_link_add()` may cause the PM-runtime usage counter of the supplier device to remain nonzero after a subsequent invocation of either :c:func:`device_link_del()` or :c:func:`device_link_remove()` to remove the device link returned by it. This happens if :c:func:`device_link_add()` is called twice in a row for the same consumer-supplier pair without removing the link between these calls, in which case allowing the PM-runtime usage counter of the supplier to drop on an attempt to remove the link may cause it to be suspended while the consumer is still PM-runtime-active and that has to be avoided. [To work around this limitation it is sufficient to let the consumer runtime suspend at least once, or call :c:func:`pm_runtime_set_suspended()` for it with PM-runtime disabled, between the :c:func:`device_link_add()` and :c:func:`device_link_del()` or :c:func:`device_link_remove()` calls.]h](hPassing }(hPassing hjhhhNhNubjb)}(h``DL_FLAG_RPM_ACTIVE``h]hDL_FLAG_RPM_ACTIVE}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jahjubh along with }(h along with hjhhhNhNubjb)}(h``DL_FLAG_STATELESS``h]hDL_FLAG_STATELESS}(hhhj-hhhNhNubah}(h]h ]h"]h$]h&]uh1jahjubh to }(h to hjhhhNhNubh)}(h:c:func:`device_link_add()`h]jb)}(hjBh]hdevice_link_add()}(hhhjDhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahj@ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjdevice_link_adduh1hhhhK|hjubhy may cause the PM-runtime usage counter of the supplier device to remain nonzero after a subsequent invocation of either }(hy may cause the PM-runtime usage counter of the supplier device to remain nonzero after a subsequent invocation of either hjhhhNhNubh)}(h:c:func:`device_link_del()`h]jb)}(hjfh]hdevice_link_del()}(hhhjhhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjdubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjdevice_link_deluh1hhhhK|hjubh or }(h or hjhhhNhNubh)}(h:c:func:`device_link_remove()`h]jb)}(hjh]hdevice_link_remove()}(hhhjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjdevice_link_removeuh1hhhhK|hjubh< to remove the device link returned by it. This happens if }(h< to remove the device link returned by it. This happens if hjhhhNhNubh)}(h:c:func:`device_link_add()`h]jb)}(hjh]hdevice_link_add()}(hhhjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjdevice_link_adduh1hhhhK|hjubhX is called twice in a row for the same consumer-supplier pair without removing the link between these calls, in which case allowing the PM-runtime usage counter of the supplier to drop on an attempt to remove the link may cause it to be suspended while the consumer is still PM-runtime-active and that has to be avoided. [To work around this limitation it is sufficient to let the consumer runtime suspend at least once, or call }(hX is called twice in a row for the same consumer-supplier pair without removing the link between these calls, in which case allowing the PM-runtime usage counter of the supplier to drop on an attempt to remove the link may cause it to be suspended while the consumer is still PM-runtime-active and that has to be avoided. [To work around this limitation it is sufficient to let the consumer runtime suspend at least once, or call hjhhhNhNubh)}(h$:c:func:`pm_runtime_set_suspended()`h]jb)}(hjh]hpm_runtime_set_suspended()}(hhhjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjpm_runtime_set_suspendeduh1hhhhK|hjubh. for it with PM-runtime disabled, between the }(h. for it with PM-runtime disabled, between the hjhhhNhNubh)}(h:c:func:`device_link_add()`h]jb)}(hjh]hdevice_link_add()}(hhhjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjdevice_link_adduh1hhhhK|hjubh and }(h and hjhhhNhNubh)}(h:c:func:`device_link_del()`h]jb)}(hjh]hdevice_link_del()}(hhhjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjdevice_link_deluh1hhhhK|hjubh or }(hjhjubh)}(h:c:func:`device_link_remove()`h]jb)}(hj=h]hdevice_link_remove()}(hhhj?hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahj;ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjdevice_link_removeuh1hhhhK|hjubh calls.]}(h calls.]hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK|hj*hhubh)}(hXSometimes drivers depend on optional resources. They are able to operate in a degraded mode (reduced feature set or performance) when those resources are not present. An example is an SPI controller that can use a DMA engine or work in PIO mode. The controller can determine presence of the optional resources at probe time but on non-presence there is no way to know whether they will become available in the near future (due to a supplier driver probing) or never. Consequently it cannot be determined whether to defer probing or not. It would be possible to notify drivers when optional resources become available after probing, but it would come at a high cost for drivers as switching between modes of operation at runtime based on the availability of such resources would be much more complex than a mechanism based on probe deferral. In any case optional resources are beyond the scope of device links.h]hXSometimes drivers depend on optional resources. They are able to operate in a degraded mode (reduced feature set or performance) when those resources are not present. An example is an SPI controller that can use a DMA engine or work in PIO mode. The controller can determine presence of the optional resources at probe time but on non-presence there is no way to know whether they will become available in the near future (due to a supplier driver probing) or never. Consequently it cannot be determined whether to defer probing or not. It would be possible to notify drivers when optional resources become available after probing, but it would come at a high cost for drivers as switching between modes of operation at runtime based on the availability of such resources would be much more complex than a mechanism based on probe deferral. In any case optional resources are beyond the scope of device links.}(hjghjehhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj*hhubeh}(h] limitationsah ]h"] limitationsah$]h&]uh1hhhhhhhhKkubh)}(hhh](h)}(hExamplesh]hExamples}(hjhj~hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj{hhhhhKubh bullet_list)}(hhh](h list_item)}(hXAn MMU device exists alongside a busmaster device, both are in the same power domain. The MMU implements DMA address translation for the busmaster device and shall be runtime resumed and kept active whenever and as long as the busmaster device is active. The busmaster device's driver shall not bind before the MMU is bound. To achieve this, a device link with runtime PM integration is added from the busmaster device (consumer) to the MMU device (supplier). The effect with regards to runtime PM is the same as if the MMU was the parent of the master device. The fact that both devices share the same power domain would normally suggest usage of a struct dev_pm_domain or struct generic_pm_domain, however these are not independent devices that happen to share a power switch, but rather the MMU device serves the busmaster device and is useless without it. A device link creates a synthetic hierarchical relationship between the devices and is thus more apt. h](h)}(hX4An MMU device exists alongside a busmaster device, both are in the same power domain. The MMU implements DMA address translation for the busmaster device and shall be runtime resumed and kept active whenever and as long as the busmaster device is active. The busmaster device's driver shall not bind before the MMU is bound. To achieve this, a device link with runtime PM integration is added from the busmaster device (consumer) to the MMU device (supplier). The effect with regards to runtime PM is the same as if the MMU was the parent of the master device.h]hX6An MMU device exists alongside a busmaster device, both are in the same power domain. The MMU implements DMA address translation for the busmaster device and shall be runtime resumed and kept active whenever and as long as the busmaster device is active. The busmaster device’s driver shall not bind before the MMU is bound. To achieve this, a device link with runtime PM integration is added from the busmaster device (consumer) to the MMU device (supplier). The effect with regards to runtime PM is the same as if the MMU was the parent of the master device.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubh)}(hXThe fact that both devices share the same power domain would normally suggest usage of a struct dev_pm_domain or struct generic_pm_domain, however these are not independent devices that happen to share a power switch, but rather the MMU device serves the busmaster device and is useless without it. A device link creates a synthetic hierarchical relationship between the devices and is thus more apt.h]hXThe fact that both devices share the same power domain would normally suggest usage of a struct dev_pm_domain or struct generic_pm_domain, however these are not independent devices that happen to share a power switch, but rather the MMU device serves the busmaster device and is useless without it. A device link creates a synthetic hierarchical relationship between the devices and is thus more apt.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubeh}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hX7A Thunderbolt host controller comprises a number of PCIe hotplug ports and an NHI device to manage the PCIe switch. On resume from system sleep, the NHI device needs to re-establish PCI tunnels to attached devices before the hotplug ports can resume. If the hotplug ports were children of the NHI, this resume order would automatically be enforced by the PM core, but unfortunately they're aunts. The solution is to add device links from the hotplug ports (consumers) to the NHI device (supplier). A driver presence dependency is not necessary for this use case. h]h)}(hX6A Thunderbolt host controller comprises a number of PCIe hotplug ports and an NHI device to manage the PCIe switch. On resume from system sleep, the NHI device needs to re-establish PCI tunnels to attached devices before the hotplug ports can resume. If the hotplug ports were children of the NHI, this resume order would automatically be enforced by the PM core, but unfortunately they're aunts. The solution is to add device links from the hotplug ports (consumers) to the NHI device (supplier). A driver presence dependency is not necessary for this use case.h]hX8A Thunderbolt host controller comprises a number of PCIe hotplug ports and an NHI device to manage the PCIe switch. On resume from system sleep, the NHI device needs to re-establish PCI tunnels to attached devices before the hotplug ports can resume. If the hotplug ports were children of the NHI, this resume order would automatically be enforced by the PM core, but unfortunately they’re aunts. The solution is to add device links from the hotplug ports (consumers) to the NHI device (supplier). A driver presence dependency is not necessary for this use case.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hXDiscrete GPUs in hybrid graphics laptops often feature an HDA controller for HDMI/DP audio. In the device hierarchy the HDA controller is a sibling of the VGA device, yet both share the same power domain and the HDA controller is only ever needed when an HDMI/DP display is attached to the VGA device. A device link from the HDA controller (consumer) to the VGA device (supplier) aptly represents this relationship. h]h)}(hXDiscrete GPUs in hybrid graphics laptops often feature an HDA controller for HDMI/DP audio. In the device hierarchy the HDA controller is a sibling of the VGA device, yet both share the same power domain and the HDA controller is only ever needed when an HDMI/DP display is attached to the VGA device. A device link from the HDA controller (consumer) to the VGA device (supplier) aptly represents this relationship.h]hXDiscrete GPUs in hybrid graphics laptops often feature an HDA controller for HDMI/DP audio. In the device hierarchy the HDA controller is a sibling of the VGA device, yet both share the same power domain and the HDA controller is only ever needed when an HDMI/DP display is attached to the VGA device. A device link from the HDA controller (consumer) to the VGA device (supplier) aptly represents this relationship.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hXMACPI allows definition of a device start order by way of _DEP objects. A classical example is when ACPI power management methods on one device are implemented in terms of I\ :sup:`2`\ C accesses and require a specific I\ :sup:`2`\ C controller to be present and functional for the power management of the device in question to work. h]h)}(hXLACPI allows definition of a device start order by way of _DEP objects. A classical example is when ACPI power management methods on one device are implemented in terms of I\ :sup:`2`\ C accesses and require a specific I\ :sup:`2`\ C controller to be present and functional for the power management of the device in question to work.h](hACPI allows definition of a device start order by way of _DEP objects. A classical example is when ACPI power management methods on one device are implemented in terms of I }(hACPI allows definition of a device start order by way of _DEP objects. A classical example is when ACPI power management methods on one device are implemented in terms of I\ hjhhhNhNubh superscript)}(h:sup:`2`h]h2}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubh' C accesses and require a specific I }(h'\ C accesses and require a specific I\ hjhhhNhNubj)}(h:sup:`2`h]h2}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubhg C controller to be present and functional for the power management of the device in question to work.}(hg\ C controller to be present and functional for the power management of the device in question to work.hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubj)}(hIn some SoCs a functional dependency exists from display, video codec and video processing IP cores on transparent memory access IP cores that handle burst access and compression/decompression. h]h)}(hIn some SoCs a functional dependency exists from display, video codec and video processing IP cores on transparent memory access IP cores that handle burst access and compression/decompression.h]hIn some SoCs a functional dependency exists from display, video codec and video processing IP cores on transparent memory access IP cores that handle burst access and compression/decompression.}(hj0hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj*ubah}(h]h ]h"]h$]h&]uh1jhjhhhhhNubeh}(h]h ]h"]h$]h&]bullet*uh1jhhhKhj{hhubeh}(h]examplesah ]h"]examplesah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h Alternativesh]h Alternatives}(hjWhjUhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjRhhhhhKubj)}(hhh](j)}(hXA struct dev_pm_domain can be used to override the bus, class or device type callbacks. It is intended for devices sharing a single on/off switch, however it does not guarantee a specific suspend/resume ordering, this needs to be implemented separately. It also does not by itself track the runtime PM status of the involved devices and turn off the power switch only when all of them are runtime suspended. Furthermore it cannot be used to enforce a specific shutdown ordering or a driver presence dependency. h]h)}(hXA struct dev_pm_domain can be used to override the bus, class or device type callbacks. It is intended for devices sharing a single on/off switch, however it does not guarantee a specific suspend/resume ordering, this needs to be implemented separately. It also does not by itself track the runtime PM status of the involved devices and turn off the power switch only when all of them are runtime suspended. Furthermore it cannot be used to enforce a specific shutdown ordering or a driver presence dependency.h]hXA struct dev_pm_domain can be used to override the bus, class or device type callbacks. It is intended for devices sharing a single on/off switch, however it does not guarantee a specific suspend/resume ordering, this needs to be implemented separately. It also does not by itself track the runtime PM status of the involved devices and turn off the power switch only when all of them are runtime suspended. Furthermore it cannot be used to enforce a specific shutdown ordering or a driver presence dependency.}(hjlhjjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjfubah}(h]h ]h"]h$]h&]uh1jhjchhhhhNubj)}(hA struct generic_pm_domain is a lot more heavyweight than a device link and does not allow for shutdown ordering or driver presence dependencies. It also cannot be used on ACPI systems. h]h)}(hA struct generic_pm_domain is a lot more heavyweight than a device link and does not allow for shutdown ordering or driver presence dependencies. It also cannot be used on ACPI systems.h]hA struct generic_pm_domain is a lot more heavyweight than a device link and does not allow for shutdown ordering or driver presence dependencies. It also cannot be used on ACPI systems.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj~ubah}(h]h ]h"]h$]h&]uh1jhjchhhhhNubeh}(h]h ]h"]h$]h&]jHjIuh1jhhhKhjRhhubeh}(h] alternativesah ]h"] alternativesah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hImplementationh]hImplementation}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubh)}(h~The device hierarchy, which -- as the name implies -- is a tree, becomes a directed acyclic graph once device links are added.h]h~The device hierarchy, which -- as the name implies -- is a tree, becomes a directed acyclic graph once device links are added.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXOrdering of these devices during suspend/resume is determined by the dpm_list. During shutdown it is determined by the devices_kset. With no device links present, the two lists are a flattened, one-dimensional representations of the device tree such that a device is placed behind all its ancestors. That is achieved by traversing the ACPI namespace or OpenFirmware device tree top-down and appending devices to the lists as they are discovered.h]hXOrdering of these devices during suspend/resume is determined by the dpm_list. During shutdown it is determined by the devices_kset. With no device links present, the two lists are a flattened, one-dimensional representations of the device tree such that a device is placed behind all its ancestors. That is achieved by traversing the ACPI namespace or OpenFirmware device tree top-down and appending devices to the lists as they are discovered.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXOnce device links are added, the lists need to satisfy the additional constraint that a device is placed behind all its suppliers, recursively. To ensure this, upon addition of the device link the consumer and the entire sub-graph below it (all children and consumers of the consumer) are moved to the end of the list. (Call to :c:func:`device_reorder_to_tail()` from :c:func:`device_link_add()`.)h](hXIOnce device links are added, the lists need to satisfy the additional constraint that a device is placed behind all its suppliers, recursively. To ensure this, upon addition of the device link the consumer and the entire sub-graph below it (all children and consumers of the consumer) are moved to the end of the list. (Call to }(hXIOnce device links are added, the lists need to satisfy the additional constraint that a device is placed behind all its suppliers, recursively. To ensure this, upon addition of the device link the consumer and the entire sub-graph below it (all children and consumers of the consumer) are moved to the end of the list. (Call to hjhhhNhNubh)}(h":c:func:`device_reorder_to_tail()`h]jb)}(hjh]hdevice_reorder_to_tail()}(hhhjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjdevice_reorder_to_tailuh1hhhhKhjubh from }(h from hjhhhNhNubh)}(h:c:func:`device_link_add()`h]jb)}(hjh]hdevice_link_add()}(hhhjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjdevice_link_adduh1hhhhKhjubh.)}(h.)hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXTo prevent introduction of dependency loops into the graph, it is verified upon device link addition that the supplier is not dependent on the consumer or any children or consumers of the consumer. (Call to :c:func:`device_is_dependent()` from :c:func:`device_link_add()`.) If that constraint is violated, :c:func:`device_link_add()` will return ``NULL`` and a ``WARNING`` will be logged.h](hTo prevent introduction of dependency loops into the graph, it is verified upon device link addition that the supplier is not dependent on the consumer or any children or consumers of the consumer. (Call to }(hTo prevent introduction of dependency loops into the graph, it is verified upon device link addition that the supplier is not dependent on the consumer or any children or consumers of the consumer. (Call to hj(hhhNhNubh)}(h:c:func:`device_is_dependent()`h]jb)}(hj3h]hdevice_is_dependent()}(hhhj5hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahj1ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjdevice_is_dependentuh1hhhhKhj(ubh from }(h from hj(hhhNhNubh)}(h:c:func:`device_link_add()`h]jb)}(hjWh]hdevice_link_add()}(hhhjYhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjUubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjdevice_link_adduh1hhhhKhj(ubh#.) If that constraint is violated, }(h#.) If that constraint is violated, hj(hhhNhNubh)}(h:c:func:`device_link_add()`h]jb)}(hj{h]hdevice_link_add()}(hhhj}hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjyubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjdevice_link_adduh1hhhhKhj(ubh will return }(h will return hj(hhhNhNubjb)}(h``NULL``h]hNULL}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jahj(ubh and a }(h and a hj(hhhNhNubjb)}(h ``WARNING``h]hWARNING}(hhhjhhhNhNubah}(h]h ]h"]h$]h&]uh1jahj(ubh will be logged.}(h will be logged.hj(hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjhhubh)}(hXyNotably this also prevents the addition of a device link from a parent device to a child. However the converse is allowed, i.e. a device link from a child to a parent. Since the driver core already guarantees correct suspend/resume and shutdown ordering between parent and child, such a device link only makes sense if a driver presence dependency is needed on top of that. In this case driver authors should weigh carefully if a device link is at all the right tool for the purpose. A more suitable approach might be to simply use deferred probing or add a device flag causing the parent driver to be probed before the child one.h]hXyNotably this also prevents the addition of a device link from a parent device to a child. However the converse is allowed, i.e. a device link from a child to a parent. Since the driver core already guarantees correct suspend/resume and shutdown ordering between parent and child, such a device link only makes sense if a driver presence dependency is needed on top of that. In this case driver authors should weigh carefully if a device link is at all the right tool for the purpose. A more suitable approach might be to simply use deferred probing or add a device flag causing the parent driver to be probed before the child one.}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjhhubeh}(h]implementationah ]h"]implementationah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(h State machineh]h State machine}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhKubhindex)}(hhh]h}(h]h ]h"]h$]h&]entries](singledevice_link_state (C enum)c.device_link_statehNtauh1jhjhhhNhNubhdesc)}(hhh](hdesc_signature)}(hdevice_link_stateh]hdesc_signature_line)}(henum device_link_stateh](hdesc_sig_keyword)}(henumh]henum}(hhhj hhhNhNubah}(h]h ]kah"]h$]h&]uh1j hj hhh^/var/lib/git/docbuild/linux/Documentation/driver-api/device_link:256: ./include/linux/device.hhMubhdesc_sig_space)}(h h]h }(hhhj& hhhNhNubah}(h]h ]wah"]h$]h&]uh1j$ hj hhhj# hMubh desc_name)}(hdevice_link_stateh]h desc_sig_name)}(hj h]hdevice_link_state}(hhhj= hhhNhNubah}(h]h ]nah"]h$]h&]uh1j; hj7 ubah}(h]h ](sig-namedescnameeh"]h$]h&] xml:spacepreserveuh1j5 hj hhhj# hMubeh}(h]h ]h"]h$]h&]jS jT add_permalinkuh1j sphinx_line_type declaratorhj hhhj# hMubah}(h]jah ](sig sig-objecteh"]h$]h&] is_multilineuh1j h^/var/lib/git/docbuild/linux/Documentation/driver-api/device_link:256: ./include/linux/device.hhMhj hhubh desc_content)}(hhh]h)}(hDevice link states.h]hDevice link states.}(hjo hjm hhhNhNubah}(h]h ]h"]h$]h&]uh1hh^/var/lib/git/docbuild/linux/Documentation/driver-api/device_link:256: ./include/linux/device.hhMhjj hhubah}(h]h ]h"]h$]h&]uh1jh hj hhhj# hMubeh}(h]h ](jenumeh"]h$]h&]domainjobjtypej desctypej noindexuh1j hhhjhNhNubh container)}(hX**Constants** ``DL_STATE_NONE`` The presence of the drivers is not being tracked. ``DL_STATE_DORMANT`` None of the supplier/consumer drivers is present. ``DL_STATE_AVAILABLE`` The supplier driver is present, but the consumer is not. ``DL_STATE_CONSUMER_PROBE`` The consumer is probing (supplier driver present). ``DL_STATE_ACTIVE`` Both the supplier and consumer drivers are present. ``DL_STATE_SUPPLIER_UNBIND`` The supplier driver is unbinding.h](h)}(h **Constants**h]hstrong)}(hj h]h Constants}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]uh1j hj ubah}(h]h ]h"]h$]h&]uh1hh^/var/lib/git/docbuild/linux/Documentation/driver-api/device_link:256: ./include/linux/device.hhMhj ubhdefinition_list)}(hhh](hdefinition_list_item)}(hD``DL_STATE_NONE`` The presence of the drivers is not being tracked. h](hterm)}(h``DL_STATE_NONE``h]jb)}(hj h]h DL_STATE_NONE}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]uh1jahj ubah}(h]h ]h"]h$]h&]uh1j h^/var/lib/git/docbuild/linux/Documentation/driver-api/device_link:256: ./include/linux/device.hhMhj ubh definition)}(hhh]h)}(h1The presence of the drivers is not being tracked.h]h1The presence of the drivers is not being tracked.}(hj hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hMhj ubah}(h]h ]h"]h$]h&]uh1j hj ubeh}(h]h ]h"]h$]h&]uh1j hj hMhj ubj )}(hG``DL_STATE_DORMANT`` None of the supplier/consumer drivers is present. h](j )}(h``DL_STATE_DORMANT``h]jb)}(hj h]hDL_STATE_DORMANT}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]uh1jahj ubah}(h]h ]h"]h$]h&]uh1j h^/var/lib/git/docbuild/linux/Documentation/driver-api/device_link:256: ./include/linux/device.hhMhj ubj )}(hhh]h)}(h1None of the supplier/consumer drivers is present.h]h1None of the supplier/consumer drivers is present.}(hj hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hMhj ubah}(h]h ]h"]h$]h&]uh1j hj ubeh}(h]h ]h"]h$]h&]uh1j hj hMhj ubj )}(hP``DL_STATE_AVAILABLE`` The supplier driver is present, but the consumer is not. h](j )}(h``DL_STATE_AVAILABLE``h]jb)}(hj0 h]hDL_STATE_AVAILABLE}(hhhj2 hhhNhNubah}(h]h ]h"]h$]h&]uh1jahj. ubah}(h]h ]h"]h$]h&]uh1j h^/var/lib/git/docbuild/linux/Documentation/driver-api/device_link:256: ./include/linux/device.hhMhj* ubj )}(hhh]h)}(h8The supplier driver is present, but the consumer is not.h]h8The supplier driver is present, but the consumer is not.}(hjK hjI hhhNhNubah}(h]h ]h"]h$]h&]uh1hhjE hMhjF ubah}(h]h ]h"]h$]h&]uh1j hj* ubeh}(h]h ]h"]h$]h&]uh1j hjE hMhj ubj )}(hO``DL_STATE_CONSUMER_PROBE`` The consumer is probing (supplier driver present). h](j )}(h``DL_STATE_CONSUMER_PROBE``h]jb)}(hji h]hDL_STATE_CONSUMER_PROBE}(hhhjk hhhNhNubah}(h]h ]h"]h$]h&]uh1jahjg ubah}(h]h ]h"]h$]h&]uh1j h^/var/lib/git/docbuild/linux/Documentation/driver-api/device_link:256: ./include/linux/device.hhMhjc ubj )}(hhh]h)}(h2The consumer is probing (supplier driver present).h]h2The consumer is probing (supplier driver present).}(hj hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj~ hMhj ubah}(h]h ]h"]h$]h&]uh1j hjc ubeh}(h]h ]h"]h$]h&]uh1j hj~ hMhj ubj )}(hH``DL_STATE_ACTIVE`` Both the supplier and consumer drivers are present. h](j )}(h``DL_STATE_ACTIVE``h]jb)}(hj h]hDL_STATE_ACTIVE}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]uh1jahj ubah}(h]h ]h"]h$]h&]uh1j h^/var/lib/git/docbuild/linux/Documentation/driver-api/device_link:256: ./include/linux/device.hhMhj ubj )}(hhh]h)}(h3Both the supplier and consumer drivers are present.h]h3Both the supplier and consumer drivers are present.}(hj hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hMhj ubah}(h]h ]h"]h$]h&]uh1j hj ubeh}(h]h ]h"]h$]h&]uh1j hj hMhj ubj )}(h>``DL_STATE_SUPPLIER_UNBIND`` The supplier driver is unbinding.h](j )}(h``DL_STATE_SUPPLIER_UNBIND``h]jb)}(hj h]hDL_STATE_SUPPLIER_UNBIND}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]uh1jahj ubah}(h]h ]h"]h$]h&]uh1j h^/var/lib/git/docbuild/linux/Documentation/driver-api/device_link:256: ./include/linux/device.hhMhj ubj )}(hhh]h)}(h!The supplier driver is unbinding.h]h!The supplier driver is unbinding.}(hj hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hh^/var/lib/git/docbuild/linux/Documentation/driver-api/device_link:256: ./include/linux/device.hhMhj ubah}(h]h ]h"]h$]h&]uh1j hj ubeh}(h]h ]h"]h$]h&]uh1j hj hMhj ubeh}(h]h ]h"]h$]h&]uh1j hj ubeh}(h]h ] kernelindentah"]h$]h&]uh1j hjhhhNhNubh literal_block)}(hXR .=============================. | | v | DORMANT <=> AVAILABLE <=> CONSUMER_PROBE => ACTIVE ^ | | | '============ SUPPLIER_UNBIND <============'h]hXR .=============================. | | v | DORMANT <=> AVAILABLE <=> CONSUMER_PROBE => ACTIVE ^ | | | '============ SUPPLIER_UNBIND <============'}(hhhj ubah}(h]h ]h"]h$]h&]jS jT uh1j hhhMhjhhubj)}(hhh](j)}(hThe initial state of a device link is automatically determined by :c:func:`device_link_add()` based on the driver presence on the supplier and consumer. If the link is created before any devices are probed, it is set to ``DL_STATE_DORMANT``. h]h)}(hThe initial state of a device link is automatically determined by :c:func:`device_link_add()` based on the driver presence on the supplier and consumer. If the link is created before any devices are probed, it is set to ``DL_STATE_DORMANT``.h](hBThe initial state of a device link is automatically determined by }(hBThe initial state of a device link is automatically determined by hj3 hhhNhNubh)}(h:c:func:`device_link_add()`h]jb)}(hj> h]hdevice_link_add()}(hhhj@ hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahj< ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarn c:parent_keysphinx.domains.c LookupKey)}data]sbjdevice_link_adduh1hhhhM hj3 ubh based on the driver presence on the supplier and consumer. If the link is created before any devices are probed, it is set to }(h based on the driver presence on the supplier and consumer. If the link is created before any devices are probed, it is set to hj3 hhhNhNubjb)}(h``DL_STATE_DORMANT``h]hDL_STATE_DORMANT}(hhhjh hhhNhNubah}(h]h ]h"]h$]h&]uh1jahj3 ubh.}(hj hj3 hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM hj/ ubah}(h]h ]h"]h$]h&]uh1jhj, hhhhhNubj)}(hWhen a supplier device is bound to a driver, links to its consumers progress to ``DL_STATE_AVAILABLE``. (Call to :c:func:`device_links_driver_bound()` from :c:func:`driver_bound()`.) h]h)}(hWhen a supplier device is bound to a driver, links to its consumers progress to ``DL_STATE_AVAILABLE``. (Call to :c:func:`device_links_driver_bound()` from :c:func:`driver_bound()`.)h](hPWhen a supplier device is bound to a driver, links to its consumers progress to M}(hPWhen a supplier device is bound to a driver, links to its consumers progress to hj hhhNhNubjb)}(h``DL_STATE_AVAILABLE``h]hDL_STATE_AVAILABLE}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]uh1jahj ubh . (Call to }(h . (Call to hj hhhNhNubh)}(h%:c:func:`device_links_driver_bound()`h]jb)}(hj h]hdevice_links_driver_bound()}(hhhj hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahj ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjZ j^ jdevice_links_driver_bounduh1hhhhMhj ubh from }(h from hj hhhNhNubh)}(h:c:func:`driver_bound()`h]jb)}(hj h]hdriver_bound()}(hhhj hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahj ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjZ j^ j driver_bounduh1hhhhMhj ubh.)}(h.)hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jhj, hhhhhNubj)}(hXBefore a consumer device is probed, presence of supplier drivers is verified by checking the consumer device is not in the wait_for_suppliers list and by checking that links to suppliers are in ``DL_STATE_AVAILABLE`` state. The state of the links is updated to ``DL_STATE_CONSUMER_PROBE``. (Call to :c:func:`device_links_check_suppliers()` from :c:func:`really_probe()`.) This prevents the supplier from unbinding. (Call to :c:func:`wait_for_device_probe()` from :c:func:`device_links_unbind_consumers()`.) h]h)}(hXBefore a consumer device is probed, presence of supplier drivers is verified by checking the consumer device is not in the wait_for_suppliers list and by checking that links to suppliers are in ``DL_STATE_AVAILABLE`` state. The state of the links is updated to ``DL_STATE_CONSUMER_PROBE``. (Call to :c:func:`device_links_check_suppliers()` from :c:func:`really_probe()`.) This prevents the supplier from unbinding. (Call to :c:func:`wait_for_device_probe()` from :c:func:`device_links_unbind_consumers()`.)h](hBefore a consumer device is probed, presence of supplier drivers is verified by checking the consumer device is not in the wait_for_suppliers list and by checking that links to suppliers are in }(hBefore a consumer device is probed, presence of supplier drivers is verified by checking the consumer device is not in the wait_for_suppliers list and by checking that links to suppliers are in hj hhhNhNubjb)}(h``DL_STATE_AVAILABLE``h]hDL_STATE_AVAILABLE}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]uh1jahj ubh. state. The state of the links is updated to }(h. state. The state of the links is updated to hj hhhNhNubjb)}(h``DL_STATE_CONSUMER_PROBE``h]hDL_STATE_CONSUMER_PROBE}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]uh1jahj ubh . (Call to }(h . (Call to hj hhhNhNubh)}(h(:c:func:`device_links_check_suppliers()`h]jb)}(hj/ h]hdevice_links_check_suppliers()}(hhhj1 hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahj- ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjZ j^ jdevice_links_check_suppliersuh1hhhhMhj ubh from }(h from hj hhhNhNubh)}(h:c:func:`really_probe()`h]jb)}(hjS h]hreally_probe()}(hhhjU hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjQ ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjZ j^ j really_probeuh1hhhhMhj ubh7.) This prevents the supplier from unbinding. (Call to }(h7.) This prevents the supplier from unbinding. (Call to hj hhhNhNubh)}(h!:c:func:`wait_for_device_probe()`h]jb)}(hjw h]hwait_for_device_probe()}(hhhjy hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahju ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjZ j^ jwait_for_device_probeuh1hhhhMhj ubh from }(hjP hj ubh)}(h):c:func:`device_links_unbind_consumers()`h]jb)}(hj h]hdevice_links_unbind_consumers()}(hhhj hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahj ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjZ j^ jdevice_links_unbind_consumersuh1hhhhMhj ubh.)}(h.)hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj ubah}(h]h ]h"]h$]h&]uh1jhj, hhhhhNubj)}(hIf the probe fails, links to suppliers revert back to ``DL_STATE_AVAILABLE``. (Call to :c:func:`device_links_no_driver()` from :c:func:`really_probe()`.) h]h)}(hIf the probe fails, links to suppliers revert back to ``DL_STATE_AVAILABLE``. (Call to :c:func:`device_links_no_driver()` from :c:func:`really_probe()`.)h](h6If the probe fails, links to suppliers revert back to }(h6If the probe fails, links to suppliers revert back to hj hhhNhNubjb)}(h``DL_STATE_AVAILABLE``h]hDL_STATE_AVAILABLE}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]uh1jahj ubh . (Call to }(h . (Call to hj hhhNhNubh)}(h":c:func:`device_links_no_driver()`h]jb)}(hj h]hdevice_links_no_driver()}(hhhj hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahj ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjZ j^ jdevice_links_no_driveruh1hhhhM!hj ubh from }(h from hj hhhNhNubh)}(h:c:func:`really_probe()`h]jb)}(hj h]hreally_probe()}(hhhj hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahj ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjZ j^ j really_probeuh1hhhhM!hj ubh.)}(h.)hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM!hj ubah}(h]h ]h"]h$]h&]uh1jhj, hhhhhNubj)}(hIf the probe succeeds, links to suppliers progress to ``DL_STATE_ACTIVE``. (Call to :c:func:`device_links_driver_bound()` from :c:func:`driver_bound()`.) h]h)}(hIf the probe succeeds, links to suppliers progress to ``DL_STATE_ACTIVE``. (Call to :c:func:`device_links_driver_bound()` from :c:func:`driver_bound()`.)h](h6If the probe succeeds, links to suppliers progress to }(h6If the probe succeeds, links to suppliers progress to hj@ hhhNhNubjb)}(h``DL_STATE_ACTIVE``h]hDL_STATE_ACTIVE}(hhhjI hhhNhNubah}(h]h ]h"]h$]h&]uh1jahj@ ubh . (Call to }(h . (Call to hj@ hhhNhNubh)}(h%:c:func:`device_links_driver_bound()`h]jb)}(hj^ h]hdevice_links_driver_bound()}(hhhj` hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahj\ ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjZ j^ jdevice_links_driver_bounduh1hhhhM$hj@ ubh from }(h from hj@ hhhNhNubh)}(h:c:func:`driver_bound()`h]jb)}(hj h]hdriver_bound()}(hhhj hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahj ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjZ j^ j driver_bounduh1hhhhM$hj@ ubh.)}(h.)hj@ hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM$hj< ubah}(h]h ]h"]h$]h&]uh1jhj, hhhhhNubj)}(hX When the consumer's driver is later on removed, links to suppliers revert back to ``DL_STATE_AVAILABLE``. (Call to :c:func:`__device_links_no_driver()` from :c:func:`device_links_driver_cleanup()`, which in turn is called from :c:func:`__device_release_driver()`.) h]h)}(hXWhen the consumer's driver is later on removed, links to suppliers revert back to ``DL_STATE_AVAILABLE``. (Call to :c:func:`__device_links_no_driver()` from :c:func:`device_links_driver_cleanup()`, which in turn is called from :c:func:`__device_release_driver()`.)h](hTWhen the consumer’s driver is later on removed, links to suppliers revert back to }(hRWhen the consumer's driver is later on removed, links to suppliers revert back to hj hhhNhNubjb)}(h``DL_STATE_AVAILABLE``h]hDL_STATE_AVAILABLE}(hhhj hhhNhNubah}(h]h ]h"]h$]h&]uh1jahj ubh . (Call to }(h . (Call to hj hhhNhNubh)}(h$:c:func:`__device_links_no_driver()`h]jb)}(hj h]h__device_links_no_driver()}(hhhj hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahj ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjZ j^ j__device_links_no_driveruh1hhhhM'hj ubh from }(h from hj hhhNhNubh)}(h':c:func:`device_links_driver_cleanup()`h]jb)}(hj h]hdevice_links_driver_cleanup()}(hhhj hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahj ubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjZ j^ jdevice_links_driver_cleanupuh1hhhhM'hj ubh, which in turn is called from }(h, which in turn is called from hj hhhNhNubh)}(h#:c:func:`__device_release_driver()`h]jb)}(hjh]h__device_release_driver()}(hhhjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjZ j^ j__device_release_driveruh1hhhhM'hj ubh.)}(h.)hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM'hj ubah}(h]h ]h"]h$]h&]uh1jhj, hhhhhNubj)}(hXBefore a supplier's driver is removed, links to consumers that are not bound to a driver are updated to ``DL_STATE_SUPPLIER_UNBIND``. (Call to :c:func:`device_links_busy()` from :c:func:`__device_release_driver()`.) This prevents the consumers from binding. (Call to :c:func:`device_links_check_suppliers()` from :c:func:`really_probe()`.) Consumers that are bound are freed from their driver; consumers that are probing are waited for until they are done. (Call to :c:func:`device_links_unbind_consumers()` from :c:func:`__device_release_driver()`.) Once all links to consumers are in ``DL_STATE_SUPPLIER_UNBIND`` state, the supplier driver is released and the links revert to ``DL_STATE_DORMANT``. (Call to :c:func:`device_links_driver_cleanup()` from :c:func:`__device_release_driver()`.) h]h)}(hXBefore a supplier's driver is removed, links to consumers that are not bound to a driver are updated to ``DL_STATE_SUPPLIER_UNBIND``. (Call to :c:func:`device_links_busy()` from :c:func:`__device_release_driver()`.) This prevents the consumers from binding. (Call to :c:func:`device_links_check_suppliers()` from :c:func:`really_probe()`.) Consumers that are bound are freed from their driver; consumers that are probing are waited for until they are done. (Call to :c:func:`device_links_unbind_consumers()` from :c:func:`__device_release_driver()`.) Once all links to consumers are in ``DL_STATE_SUPPLIER_UNBIND`` state, the supplier driver is released and the links revert to ``DL_STATE_DORMANT``. (Call to :c:func:`device_links_driver_cleanup()` from :c:func:`__device_release_driver()`.)h](hjBefore a supplier’s driver is removed, links to consumers that are not bound to a driver are updated to }(hhBefore a supplier's driver is removed, links to consumers that are not bound to a driver are updated to hjLhhhNhNubjb)}(h``DL_STATE_SUPPLIER_UNBIND``h]hDL_STATE_SUPPLIER_UNBIND}(hhhjUhhhNhNubah}(h]h ]h"]h$]h&]uh1jahjLubh . (Call to }(h . (Call to hjLhhhNhNubh)}(h:c:func:`device_links_busy()`h]jb)}(hjjh]hdevice_links_busy()}(hhhjlhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjhubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjZ j^ jdevice_links_busyuh1hhhhM-hjLubh from }(h from hjLhhhNhNubh)}(h#:c:func:`__device_release_driver()`h]jb)}(hjh]h__device_release_driver()}(hhhjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjZ j^ j__device_release_driveruh1hhhhM-hjLubh6.) This prevents the consumers from binding. (Call to }(h6.) This prevents the consumers from binding. (Call to hjLhhhNhNubh)}(h(:c:func:`device_links_check_suppliers()`h]jb)}(hjh]hdevice_links_check_suppliers()}(hhhjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjZ j^ jdevice_links_check_suppliersuh1hhhhM-hjLubh from }(h from hjLubh)}(h:c:func:`really_probe()`h]jb)}(hjh]hreally_probe()}(hhhjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjZ j^ j really_probeuh1hhhhM-hjLubh.) Consumers that are bound are freed from their driver; consumers that are probing are waited for until they are done. (Call to }(h.) Consumers that are bound are freed from their driver; consumers that are probing are waited for until they are done. (Call to hjLhhhNhNubh)}(h):c:func:`device_links_unbind_consumers()`h]jb)}(hjh]hdevice_links_unbind_consumers()}(hhhjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjZ j^ jdevice_links_unbind_consumersuh1hhhhM-hjLubh from }(h from hjLubh)}(h#:c:func:`__device_release_driver()`h]jb)}(hjh]h__device_release_driver()}(hhhj hhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjZ j^ j__device_release_driveruh1hhhhM-hjLubh&.) Once all links to consumers are in }(h&.) Once all links to consumers are in hjLhhhNhNubjb)}(h``DL_STATE_SUPPLIER_UNBIND``h]hDL_STATE_SUPPLIER_UNBIND}(hhhj@hhhNhNubah}(h]h ]h"]h$]h&]uh1jahjLubh@ state, the supplier driver is released and the links revert to }(h@ state, the supplier driver is released and the links revert to hjLhhhNhNubjb)}(h``DL_STATE_DORMANT``h]hDL_STATE_DORMANT}(hhhjShhhNhNubah}(h]h ]h"]h$]h&]uh1jahjLubh . (Call to }(hjghjLubh)}(h':c:func:`device_links_driver_cleanup()`h]jb)}(hjgh]hdevice_links_driver_cleanup()}(hhhjihhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjeubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjZ j^ jdevice_links_driver_cleanupuh1hhhhM-hjLubh from }(hjhjLubh)}(h#:c:func:`__device_release_driver()`h]jb)}(hjh]h__device_release_driver()}(hhhjhhhNhNubah}(h]h ](jjc-funceh"]h$]h&]uh1jahjubah}(h]h ]h"]h$]h&]refdocj refdomainjreftypefunc refexplicitrefwarnjZ j^ j__device_release_driveruh1hhhhM-hjLubh.)}(h.)hjLhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM-hjHubah}(h]h ]h"]h$]h&]uh1jhj, hhhhhNubeh}(h]h ]h"]h$]h&]jHjIuh1jhhhM hjhhubeh}(h] state-machineah ]h"] state machineah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hAPIh]hAPI}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhM>ubh)}(hBSee device_link_add(), device_link_del() and device_link_remove().h]hBSee device_link_add(), device_link_del() and device_link_remove().}(hjhjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM@hjhhubeh}(h]apiah ]h"]apiah$]h&]uh1hhhhhhhhM>ubeh}(h]( device-linksheh ]h"]( device links device_linkeh$]h&]uh1hhhhhhhhKexpect_referenced_by_name}jhsexpect_referenced_by_id}hhsubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerjerror_encodingUTF-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourceh _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confapep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacefile_insertion_enabled raw_enabledKline_length_limitM'syntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_link embed_imagesenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}h]hasnameids}(jhjjj'j$jxjujOjLjjjjjjjju nametypes}(jjNj'NjxNjONjNjNjNjNuh}(hhjhj$jjuj*jLj{jjRjjjjjj jju footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages]hsystem_message)}(hhh]h)}(hhh]h1Hyperlink target "device-link" is not referenced.}(hhhjubah}(h]h ]h"]h$]h&]uh1hhjubah}(h]h ]h"]h$]h&]levelKtypeINFOsourcehlineKuh1juba transformerN include_log] decorationNhhub.