1. 01 8月, 2019 1 次提交
  2. 30 7月, 2019 6 次提交
  3. 25 7月, 2019 1 次提交
    • R
      driver core: Remove device link creation limitation · 515db266
      Rafael J. Wysocki 提交于
      If device_link_add() is called for a consumer/supplier pair with an
      existing device link between them and the existing link's type is
      not in agreement with the flags passed to that function by its
      caller, NULL will be returned.  That is seriously inconvenient,
      because it forces the callers of device_link_add() to worry about
      what others may or may not do even if that is not relevant to them
      for any other reasons.
      
      It turns out, however, that this limitation can be made go away
      relatively easily.
      
      The underlying observation is that if DL_FLAG_STATELESS has been
      passed to device_link_add() in flags for the given consumer/supplier
      pair at least once, calling either device_link_del() or
      device_link_remove() to release the link returned by it should work,
      but there are no other requirements associated with that flag.  In
      turn, if at least one of the callers of device_link_add() for the
      given consumer/supplier pair has not passed DL_FLAG_STATELESS to it
      in flags, the driver core should track the status of the link and act
      on it as appropriate (ie. the link should be treated as "managed").
      This means that DL_FLAG_STATELESS needs to be set for managed device
      links and it should be valid to call device_link_del() or
      device_link_remove() to drop references to them in certain
      sutiations.
      
      To allow that to happen, introduce a new (internal) device link flag
      called DL_FLAG_MANAGED and make device_link_add() set it automatically
      whenever DL_FLAG_STATELESS is not passed to it.  Also make it take
      additional references to existing device links that were previously
      stateless (that is, with DL_FLAG_STATELESS set and DL_FLAG_MANAGED
      unset) and will need to be managed going forward and initialize
      their status (which has been DL_STATE_NONE so far).
      
      Accordingly, when a managed device link is dropped automatically
      by the driver core, make it clear DL_FLAG_MANAGED, reset the link's
      status back to DL_STATE_NONE and drop the reference to it associated
      with DL_FLAG_MANAGED instead of just deleting it right away (to
      allow it to stay around in case it still needs to be released
      explicitly by someone).
      
      With that, since setting DL_FLAG_STATELESS doesn't mean that the
      device link in question is not managed any more, replace all of the
      status-tracking checks against DL_FLAG_STATELESS with analogous
      checks against DL_FLAG_MANAGED and update the documentation to
      reflect these changes.
      
      While at it, make device_link_add() reject flags that it does not
      recognize, including DL_FLAG_MANAGED.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NSaravana Kannan <saravanak@google.com>
      Tested-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Review-by: NSaravana Kannan <saravanak@google.com>
      Link: https://lore.kernel.org/r/2305283.AStDPdUUnE@kreacherSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      515db266
  4. 15 7月, 2019 1 次提交
  5. 05 7月, 2019 1 次提交
  6. 04 7月, 2019 1 次提交
    • T
      driver: core: Allow subsystems to continue deferring probe · 62a6bc3a
      Thierry Reding 提交于
      Some subsystems, such as pinctrl, allow continuing to defer probe
      indefinitely. This is useful for devices that depend on resources
      provided by devices that are only probed after the init stage.
      
      One example of this can be seen on Tegra, where the DPAUX hardware
      contains pinmuxing controls for pins that it shares with an I2C
      controller. The I2C controller is typically used for communication
      with a monitor over HDMI (DDC). However, other instances of the I2C
      controller are used to access system critical components, such as a
      PMIC. The I2C controller driver will therefore usually be a builtin
      driver, whereas the DPAUX driver is part of the display driver that
      is loaded from a module to avoid bloating the kernel image with all
      of the DRM/KMS subsystem.
      
      In this particular case the pins used by this I2C/DDC controller
      become accessible very late in the boot process. However, since the
      controller is only used in conjunction with display, that's not an
      issue.
      
      Unfortunately the driver core currently outputs a warning message
      when a device fails to get the pinctrl before the end of the init
      stage. That can be confusing for the user because it may sound like
      an unwanted error occurred, whereas it's really an expected and
      harmless situation.
      
      In order to eliminate this warning, this patch allows callers of the
      driver_deferred_probe_check_state() helper to specify that they want
      to continue deferring probe, regardless of whether we're past the
      init stage or not. All of the callers of that function are updated
      for the new signature, but only the pinctrl subsystem passes a true
      value in the new persist parameter if appropriate.
      Signed-off-by: NThierry Reding <treding@nvidia.com>
      Reviewed-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Reviewed-by: NLinus Walleij <linus.walleij@linaro.org>
      Link: https://lore.kernel.org/r/20190621151725.20414-1-thierry.reding@gmail.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      62a6bc3a
  7. 03 7月, 2019 1 次提交
  8. 24 6月, 2019 3 次提交
    • S
      drivers: Add generic helper to match by of_node · 65b66682
      Suzuki K Poulose 提交于
      Add a helper to match device by the of_node. This will be later used
      to provide wrappers to the device iterators for {bus/class/driver}_find_device().
      Convert other users to reuse this new helper.
      
      Cc: Alan Tull <atull@kernel.org>
      Cc: Andrew Lunn <andrew@lunn.ch>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: David Airlie <airlied@linux.ie>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: devicetree@vger.kernel.org
      Cc: dri-devel@lists.freedesktop.org
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Frank Rowand <frowand.list@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Heiner Kallweit <hkallweit1@gmail.com>
      Cc: Jiri Slaby <jslaby@suse.com>
      Cc: Jonathan Hunter <jonathanh@nvidia.com>
      Cc: Lee Jones <lee.jones@linaro.org>
      Cc: Liam Girdwood <lgirdwood@gmail.com>
      Cc: linux-fpga@vger.kernel.org
      Cc: linux-i2c@vger.kernel.org
      Cc: linux-spi@vger.kernel.org
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Mark Brown <broonie@kernel.org>
      Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
      Cc: Maxime Ripard <maxime.ripard@bootlin.com>
      Cc: Moritz Fischer <mdf@kernel.org>
      Cc: Peter Rosin <peda@axentia.se>
      Cc: Rob Herring <robh+dt@kernel.org>
      Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Cc: Thor Thayer <thor.thayer@linux.intel.com>
      Cc: Wolfram Sang <wsa@the-dreams.de>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Ulf Hansson <ulf.hansson@linaro.org>
      Cc: Joe Perches <joe@perches.com>
      Signed-off-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      65b66682
    • S
      driver_find_device: Unify the match function with class_find_device() · 92ce7e83
      Suzuki K Poulose 提交于
      The driver_find_device() accepts a match function pointer to
      filter the devices for lookup, similar to bus/class_find_device().
      However, there is a minor difference in the prototype for the
      match parameter for driver_find_device() with the now unified
      version accepted by {bus/class}_find_device(), where it doesn't
      accept a "const" qualifier for the data argument. This prevents
      us from reusing the generic match functions for driver_find_device().
      
      For this reason, change the prototype of the driver_find_device() to
      make the "match" parameter in line with {bus/class}_find_device()
      and adjust its callers to use the const qualifier. Also, we could
      now promote the "data" parameter to const as we pass it down
      as a const parameter to the match functions.
      
      Cc: Corey Minyard <minyard@acm.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Joerg Roedel <joro@8bytes.org>
      Cc: Peter Oberparleiter <oberpar@linux.ibm.com>
      Cc: Sebastian Ott <sebott@linux.ibm.com>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: Nehal Shah <nehal-bakulchandra.shah@amd.com>
      Cc: Shyam Sundar S K <shyam-sundar.s-k@amd.com>
      Cc: Lee Jones <lee.jones@linaro.org>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      92ce7e83
    • S
      bus_find_device: Unify the match callback with class_find_device · 418e3ea1
      Suzuki K Poulose 提交于
      There is an arbitrary difference between the prototypes of
      bus_find_device() and class_find_device() preventing their callers
      from passing the same pair of data and match() arguments to both of
      them, which is the const qualifier used in the prototype of
      class_find_device().  If that qualifier is also used in the
      bus_find_device() prototype, it will be possible to pass the same
      match() callback function to both bus_find_device() and
      class_find_device(), which will allow some optimizations to be made in
      order to avoid code duplication going forward.  Also with that, constify
      the "data" parameter as it is passed as a const to the match function.
      
      For this reason, change the prototype of bus_find_device() to match
      the prototype of class_find_device() and adjust its callers to use the
      const qualifier in accordance with the new prototype of it.
      
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andrew Lunn <andrew@lunn.ch>
      Cc: Andreas Noever <andreas.noever@gmail.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Corey Minyard <minyard@acm.org>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: David Kershner <david.kershner@unisys.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Felipe Balbi <balbi@kernel.org>
      Cc: Frank Rowand <frowand.list@gmail.com>
      Cc: Grygorii Strashko <grygorii.strashko@ti.com>
      Cc: Harald Freudenberger <freude@linux.ibm.com>
      Cc: Hartmut Knaack <knaack.h@gmx.de>
      Cc: Heiko Stuebner <heiko@sntech.de>
      Cc: Jason Gunthorpe <jgg@ziepe.ca>
      Cc: Jonathan Cameron <jic23@kernel.org>
      Cc: "James E.J. Bottomley" <jejb@linux.ibm.com>
      Cc: Len Brown <lenb@kernel.org>
      Cc: Mark Brown <broonie@kernel.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Michael Jamet <michael.jamet@intel.com>
      Cc: "Martin K. Petersen" <martin.petersen@oracle.com>
      Cc: Peter Oberparleiter <oberpar@linux.ibm.com>
      Cc: Sebastian Ott <sebott@linux.ibm.com>
      Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Cc: Yehezkel Bernat <YehezkelShB@gmail.com>
      Cc: rafael@kernel.org
      Acked-by: NCorey Minyard <minyard@acm.org>
      Acked-by: NDavid Kershner <david.kershner@unisys.com>
      Acked-by: NMark Brown <broonie@kernel.org>
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
      Acked-by: Wolfram Sang <wsa@the-dreams.de> # for the I2C parts
      Acked-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NSuzuki K Poulose <suzuki.poulose@arm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      418e3ea1
  9. 14 6月, 2019 1 次提交
    • D
      drivers/base/devres: introduce devm_release_action() · 2374b682
      Dan Williams 提交于
      Patch series "mm/devm_memremap_pages: Fix page release race", v2.
      
      Logan audited the devm_memremap_pages() shutdown path and noticed that
      it was possible to proceed to arch_remove_memory() before all potential
      page references have been reaped.
      
      Introduce a new ->cleanup() callback to do the work of waiting for any
      straggling page references and then perform the percpu_ref_exit() in
      devm_memremap_pages_release() context.
      
      For p2pdma this involves some deeper reworks to reference count
      resources on a per-instance basis rather than a per pci-device basis.  A
      modified genalloc api is introduced to convey a driver-private pointer
      through gen_pool_{alloc,free}() interfaces.  Also, a
      devm_memunmap_pages() api is introduced since p2pdma does not
      auto-release resources on a setup failure.
      
      The dax and pmem changes pass the nvdimm unit tests, and the p2pdma
      changes should now pass testing with the pci_p2pdma_release() fix.
      Jrme, how does this look for HMM?
      
      This patch (of 6):
      
      The devm_add_action() facility allows a resource allocation routine to
      add custom devm semantics.  One such user is devm_memremap_pages().
      
      There is now a need to manually trigger
      devm_memremap_pages_release().  Introduce devm_release_action() so the
      release action can be triggered via a new devm_memunmap_pages() api in a
      follow-on change.
      
      Link: http://lkml.kernel.org/r/155727336530.292046.2926860263201336366.stgit@dwillia2-desk3.amr.corp.intel.comSigned-off-by: NDan Williams <dan.j.williams@intel.com>
      Reviewed-by: NIra Weiny <ira.weiny@intel.com>
      Reviewed-by: NLogan Gunthorpe <logang@deltatee.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Cc: "Jérôme Glisse" <jglisse@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2374b682
  10. 12 6月, 2019 1 次提交
  11. 03 6月, 2019 1 次提交
  12. 20 4月, 2019 1 次提交
  13. 01 4月, 2019 1 次提交
    • G
      device.h: reorganize struct device · 159ef31e
      Greg Kroah-Hartman 提交于
      struct device is big, around 760 bytes on x86_64.  It's not a critical
      structure, but it is embedded everywhere, so making it smaller is always
      a good thing.
      
      With a recent patch that moved a field from struct device to the private
      structure, some benchmarks showed a very odd regression, despite this
      structure having nothing to do with those benchmarks.  That caused me to
      look into the layout of the structure.  Using 'pahole', it showed a
      number of holes and ways that the structure could be reordered in order
      to align some cachelines better, as well as reduce the size of the
      overall structure.
      
      Move 'struct kobj' to the start of the structure, to keep that access
      in the first cacheline, and try to organize things a bit more compactly
      where possible
      
      By doing these few moves, the result removes at least 8 bytes from
      'struct device' on a 64bit system.  Given we know there are systems with
      at least 30k devices in memory at once, every little byte counts, and
      this change could be a savings of 240k of kernel memory for them.  On
      "normal" systems the overall memory savings would be much less.
      
      Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
      Cc: Johan Hovold <johan@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      159ef31e
  14. 18 3月, 2019 1 次提交
  15. 08 3月, 2019 1 次提交
    • R
      linux/device.h: use DYNAMIC_DEBUG_BRANCH in dev_dbg_ratelimited · e0b73d7b
      Rasmus Villemoes 提交于
      Patch series "various dynamic_debug patches", v4.
      
      This started as an experiment to see how hard it would be to change the
      four pointers in struct _ddebug into relative offsets, a la
      CONFIG_GENERIC_BUG_RELATIVE_POINTERS, thus saving 16 bytes per pr_debug
      site (and thus exactly making up for the extra space used by the
      introduction of jump labels in 9049fc74).  I stumbled on a few things
      that are probably worth fixing regardless of whether that goal is deemed
      worthwhile.
      
      Back at v3 (in November), I redid the implementation on top of the fancy
      new asm-macros stuff.  Luckily enough, v3 didn't get picked up, since
      the asm-macros were backed out again.  I still want to do the
      relative-pointers thing eventually, but we're close to the merge window
      opening, so here's just most of the "incidental" patches, some of which
      also serve as preparation for the relative pointers.
      
      This patch (of 4):
      
      dev_dbg_ratelimited tests the dynamic debug descriptor the old-fashioned
      way, and doesn't utilize the static key/jump label implementation when
      CONFIG_JUMP_LABEL is set.  Use the DYNAMIC_DEBUG_BRANCH which is defined
      appropriately.
      
      Link: http://lkml.kernel.org/r/20190212214150.4807-2-linux@rasmusvillemoes.dkSigned-off-by: NRasmus Villemoes <linux@rasmusvillemoes.dk>
      Reviewed-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Acked-by: NJason Baron <jbaron@akamai.com>
      Cc: David Sterba <dsterba@suse.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: "Rafael J . Wysocki" <rafael.j.wysocki@intel.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e0b73d7b
  16. 06 3月, 2019 1 次提交
    • A
      mm: replace all open encodings for NUMA_NO_NODE · 98fa15f3
      Anshuman Khandual 提交于
      Patch series "Replace all open encodings for NUMA_NO_NODE", v3.
      
      All these places for replacement were found by running the following
      grep patterns on the entire kernel code.  Please let me know if this
      might have missed some instances.  This might also have replaced some
      false positives.  I will appreciate suggestions, inputs and review.
      
      1. git grep "nid == -1"
      2. git grep "node == -1"
      3. git grep "nid = -1"
      4. git grep "node = -1"
      
      This patch (of 2):
      
      At present there are multiple places where invalid node number is
      encoded as -1.  Even though implicitly understood it is always better to
      have macros in there.  Replace these open encodings for an invalid node
      number with the global macro NUMA_NO_NODE.  This helps remove NUMA
      related assumptions like 'invalid node' from various places redirecting
      them to a common definition.
      
      Link: http://lkml.kernel.org/r/1545127933-10711-2-git-send-email-anshuman.khandual@arm.comSigned-off-by: NAnshuman Khandual <anshuman.khandual@arm.com>
      Reviewed-by: NDavid Hildenbrand <david@redhat.com>
      Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>	[ixgbe]
      Acked-by: Jens Axboe <axboe@kernel.dk>			[mtip32xx]
      Acked-by: Vinod Koul <vkoul@kernel.org>			[dmaengine.c]
      Acked-by: Michael Ellerman <mpe@ellerman.id.au>		[powerpc]
      Acked-by: Doug Ledford <dledford@redhat.com>		[drivers/infiniband]
      Cc: Joseph Qi <jiangqi903@gmail.com>
      Cc: Hans Verkuil <hverkuil@xs4all.nl>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      98fa15f3
  17. 21 2月, 2019 1 次提交
  18. 20 2月, 2019 2 次提交
  19. 19 2月, 2019 1 次提交
    • S
      PM / core: Add support to skip power management in device/driver model · 85945c28
      Sudeep Holla 提交于
      All device objects in the driver model contain fields that control the
      handling of various power management activities. However, it's not
      always useful. There are few instances where pseudo devices are added
      to the model just to take advantage of many other features like
      kobjects, udev events, and so on. One such example is cpu devices and
      their caches.
      
      The sysfs for the cpu caches are managed by adding devices with cpu
      as the parent in cpu_device_create() when secondary cpu is brought
      online. Generally when the secondary CPUs are hotplugged back in as part
      of resume from suspend-to-ram, we call cpu_device_create() from the cpu
      hotplug state machine while the cpu device associated with that CPU is
      not yet ready to be resumed as the device_resume() call happens bit
      later. It's not really needed to set the flag is_prepared for cpu
      devices as they are mostly pseudo device and hotplug framework deals
      with state machine and not managed through the cpu device.
      
      This often results in annoying warning when resuming:
      Enabling non-boot CPUs ...
      CPU1: Booted secondary processor
       cache: parent cpu1 should not be sleeping
      CPU1 is up
      CPU2: Booted secondary processor
       cache: parent cpu2 should not be sleeping
      CPU2 is up
      .... and so on.
      
      So in order to fix these kind of errors, we could just completely avoid
      doing any power management related initialisations and operations if
      they are not used by these devices.
      
      Add no_pm flags to indicate that the device doesn't require any sort of
      PM activities and all of them can be completely skipped. We can use the
      same flag to also avoid adding not used *power* sysfs entries for these
      devices. For now, lets use this for cpu cache devices.
      Reviewed-by: NUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: NSudeep Holla <sudeep.holla@arm.com>
      Tested-by: NEugeniu Rosca <erosca@de.adit-jv.com>
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      85945c28
  20. 14 2月, 2019 2 次提交
  21. 08 2月, 2019 1 次提交
  22. 03 2月, 2019 1 次提交
  23. 01 2月, 2019 2 次提交
    • R
      driver core: Add device link flag DL_FLAG_AUTOPROBE_CONSUMER · e7dd4010
      Rafael J. Wysocki 提交于
      Add a new device link flag, DL_FLAG_AUTOPROBE_CONSUMER, to request the
      driver core to probe for a consumer driver automatically after binding
      a driver to the supplier device on a persistent managed device link.
      
      As unbinding the supplier driver on a managed device link causes the
      consumer driver to be detached from its device automatically, this
      flag provides a complementary mechanism which is needed to address
      some "composite device" use cases.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e7dd4010
    • R
      driver core: Fix handling of runtime PM flags in device_link_add() · e2f3cd83
      Rafael J. Wysocki 提交于
      After commit ead18c23 ("driver core: Introduce device links
      reference counting"), if there is a link between the given supplier
      and the given consumer already, device_link_add() will refcount it
      and return it unconditionally without updating its flags.  It is
      possible, however, that the second (or any subsequent) caller of
      device_link_add() for the same consumer-supplier pair will pass
      DL_FLAG_PM_RUNTIME, possibly along with DL_FLAG_RPM_ACTIVE, in flags
      to it and the existing link may not behave as expected then.
      
      First, if DL_FLAG_PM_RUNTIME is not set in the existing link's flags
      at all, it needs to be set like during the original initialization of
      the link.
      
      Second, if DL_FLAG_RPM_ACTIVE is passed to device_link_add() in flags
      (in addition to DL_FLAG_PM_RUNTIME), the existing link should to be
      updated to reflect the "active" runtime PM configuration of the
      consumer-supplier pair and extra care must be taken here to avoid
      possible destructive races with runtime PM of the consumer.
      
      To that end, redefine the rpm_active field in struct device_link
      as a refcount, initialize it to 1 and make rpm_resume() (for the
      consumer) and device_link_add() increment it whenever they acquire
      a runtime PM reference on the supplier device.  Accordingly, make
      rpm_suspend() (for the consumer) and pm_runtime_clean_up_links()
      decrement it and drop runtime PM references to the supplier
      device in a loop until rpm_active becones 1 again.
      
      Fixes: ead18c23 ("driver core: Introduce device links reference counting")
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e2f3cd83
  24. 18 1月, 2019 1 次提交
  25. 17 12月, 2018 1 次提交
  26. 16 10月, 2018 3 次提交
  27. 20 9月, 2018 2 次提交