1. 09 7月, 2018 2 次提交
  2. 06 6月, 2018 1 次提交
  3. 31 5月, 2018 1 次提交
    • M
      driver core: hold dev's parent lock when needed · 8c97a46a
      Martin Liu 提交于
      SoC have internal I/O buses that can't be proved for devices. The
      devices on the buses can be accessed directly without additinal
      configuration required. This type of bus is represented as
      "simple-bus". In some platforms, we name "soc" with "simple-bus"
      attribute and many devices are hooked under it described in DT
      (device tree).
      
      In commit bf74ad5b ("Hold the device's parent's lock during
      probe and remove") to solve USB subsystem lock sequence since
      USB device's characteristic. Thus "soc" needs to be locked
      whenever a device and driver's probing happen under "soc" bus.
      During this period, an async driver tries to probe a device which
      is under the "soc" bus would be blocked until previous driver
      finish the probing and release "soc" lock. And the next probing
      under the "soc" bus need to wait for async finish. Because of
      that, driver's async probe for init time improvement will be
      shadowed.
      
      Since many devices don't have USB devices' characteristic, they
      actually don't need parent's lock. Thus, we introduce a lock flag
      in bus_type struct and driver core would lock the parent lock base
      on the flag. For USB, we set this flag in usb_bus_type to keep
      original lock behavior in driver core.
      
      Async probe could have more benefit after this patch.
      Signed-off-by: NMartin Liu <liumartin@google.com>
      Acked-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8c97a46a
  4. 28 5月, 2018 1 次提交
  5. 03 5月, 2018 2 次提交
  6. 19 4月, 2018 1 次提交
  7. 22 3月, 2018 1 次提交
  8. 16 3月, 2018 1 次提交
  9. 28 2月, 2018 1 次提交
    • L
      driver core: Introduce device links reference counting · ead18c23
      Lukas Wunner 提交于
      If device_link_add() is invoked multiple times with the same supplier
      and consumer combo, it will create the link on first addition and
      return a pointer to the already existing link on all subsequent
      additions.
      
      The semantics for device_link_del() are quite different, it deletes
      the link unconditionally, so multiple invocations are not allowed.
      
      In other words, this snippet ...
      
          struct device *dev1, *dev2;
          struct device_link *link1, *link2;
      
          link1 = device_link_add(dev1, dev2, 0);
          link2 = device_link_add(dev1, dev2, 0);
      
          device_link_del(link1);
          device_link_del(link2);
      
      ... causes the following crash:
      
          WARNING: CPU: 4 PID: 2686 at drivers/base/power/runtime.c:1611 pm_runtime_drop_link+0x40/0x50
          [...]
          list_del corruption, 0000000039b800a4->prev is LIST_POISON2 (00000000ecf79852)
          kernel BUG at lib/list_debug.c:50!
      
      The issue isn't as arbitrary as it may seem:  Imagine a device link
      which is added in both the supplier's and the consumer's ->probe hook.
      The two drivers can't just call device_link_del() in their ->remove hook
      without coordination.
      
      Fix by counting multiple additions and dropping the device link only
      when the last addition is unwound.
      Signed-off-by: NLukas Wunner <lukas@wunner.de>
      [ rjw: Subject ]
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      ead18c23
  10. 04 2月, 2018 1 次提交
    • L
      pinctrl: remove include file from <linux/device.h> · 23c35f48
      Linus Torvalds 提交于
      When pulling the recent pinctrl merge, I was surprised by how a
      pinctrl-only pull request ended up rebuilding basically the whole
      kernel.
      
      The reason for that ended up being that <linux/device.h> included
      <linux/pinctrl/devinfo.h>, so any change to that file ended up causing
      pretty much every driver out there to be rebuilt.
      
      The reason for that was because 'struct device' has this in it:
      
          #ifdef CONFIG_PINCTRL
              struct dev_pin_info     *pins;
          #endif
      
      but we already avoid header includes for these kinds of things in that
      header file, preferring to just use a forward-declaration of the
      structure instead.  Exactly to avoid this kind of header dependency.
      
      Since some drivers seem to expect that <linux/pinctrl/devinfo.h> header
      to come in automatically, move the include to <linux/pinctrl/pinctrl.h>
      instead.  It might be better to just make the includes more targeted,
      but I'm not going to review every driver.
      
      It would definitely be good to have a tool for finding and minimizing
      header dependencies automatically - or at least help with them.  Right
      now we almost certainly end up having way too many of these things, and
      it's hard to test every single configuration.
      
      FWIW, you can get a sense of the "hotness" of a header file with something
      like this after doing a full build:
      
          find . -name '.*.o.cmd' -print0 |
              xargs -0 tail --lines=+2 |
              grep -v 'wildcard ' |
              tr ' \\' '\n' |
              sort | uniq -c | sort -n | less -S
      
      which isn't exact (there are other things in those '*.o.cmd' than just
      the dependencies, and the "--lines=+2" only removes the header), but
      might a useful approximation.
      
      With this patch, <linux/pinctrl/devinfo.h> drops to "only" having 833
      users in the current x86-64 allmodconfig.  In contrast, <linux/device.h>
      has 14857 build files including it directly or indirectly.
      
      Of course, the headers that absolutely _everybody_ includes (things like
      <linux/types.h> etc) get a score of 23000+.
      
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      23c35f48
  11. 23 1月, 2018 1 次提交
  12. 20 12月, 2017 1 次提交
    • C
      gpio: sysfs: change 'value' attribute to prealloc · 7fda9100
      Christophe Leroy 提交于
      The GPIO 'value' attribute is time critical. A small bench with
      'perf record' on the app below shows that 80% of the time spent in
      sysfs_kf_seq_show() is spent in memset() for zeroising the buffer.
      
      |--67.48%--sysfs_kf_seq_show
      |          |
      |          |--54.40%--memset
      |          |
      |          |--11.49%--dev_attr_show
      |          |          |
      |          |          |--10.06%--value_show
      |          |          |          |
      |          |          |          |--4.75%--sprintf
      |          |          |          |          |
      
      This patch changes the attribute type to prealloc, eliminating the
      need to zeroise the buffer at each read. 'perf record' gives the
      following result.
      
      |--42.41%--sysfs_kf_read
      |          |
      |          |--39.73%--dev_attr_show
      |          |          |
      |          |          |--38.23%--value_show
      |          |          |          |
      |          |          |          |--29.22%--sprintf
      |          |          |          |          |
      
      Test done with the following small app:
      
      int main(int argc, char **argv)
      {
      	int fd = open(argv[1], O_RDONLY);
      
      	for (;;) {
      		int buf[512];
      
      		read(fd, buf, 512);
      		lseek(fd, 0, SEEK_SET);
      	}
      	exit(0);
      }
      Signed-off-by: NChristophe Leroy <christophe.leroy@c-s.fr>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      7fda9100
  13. 08 12月, 2017 2 次提交
    • G
      driver core: Remove redundant license text · 32825709
      Greg Kroah-Hartman 提交于
      Now that the SPDX tag is in all driver core files, that identifies the
      license in a specific and legally-defined manner.  So the extra GPL text
      wording can be removed as it is no longer needed at all.
      
      This is done on a quest to remove the 700+ different ways that files in
      the kernel describe the GPL license text.  And there's unneeded stuff
      like the address (sometimes incorrect) for the FSF which is never
      needed.
      
      No copyright headers or other non-license-description text was removed.
      
      Cc: Johannes Berg <johannes@sipsolutions.net>
      Cc: "Luis R. Rodriguez" <mcgrof@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      32825709
    • G
      driver core: add SPDX identifiers to all driver core files · 989d42e8
      Greg Kroah-Hartman 提交于
      It's good to have SPDX identifiers in all files to make it easier to
      audit the kernel tree for correct licenses.
      
      Update the driver core files files with the correct SPDX license
      identifier based on the license text in the file itself.  The SPDX
      identifier is a legally binding shorthand, which can be used instead of
      the full boiler plate text.
      
      This work is based on a script and data from Thomas Gleixner, Philippe
      Ombredanne, and Kate Stewart.
      
      Cc: Johannes Berg <johannes@sipsolutions.net>
      Cc: "Luis R. Rodriguez" <mcgrof@kernel.org>
      Cc: William Breathitt Gray <vilhelm.gray@gmail.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Kate Stewart <kstewart@linuxfoundation.org>
      Cc: Philippe Ombredanne <pombredanne@nexb.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      989d42e8
  14. 06 11月, 2017 1 次提交
    • R
      PM / core: Add NEVER_SKIP and SMART_PREPARE driver flags · 08810a41
      Rafael J. Wysocki 提交于
      The motivation for this change is to provide a way to work around
      a problem with the direct-complete mechanism used for avoiding
      system suspend/resume handling for devices in runtime suspend.
      
      The problem is that some middle layer code (the PCI bus type and
      the ACPI PM domain in particular) returns positive values from its
      system suspend ->prepare callbacks regardless of whether the driver's
      ->prepare returns a positive value or 0, which effectively prevents
      drivers from being able to control the direct-complete feature.
      Some drivers need that control, however, and the PCI bus type has
      grown its own flag to deal with this issue, but since it is not
      limited to PCI, it is better to address it by adding driver flags at
      the core level.
      
      To that end, add a driver_flags field to struct dev_pm_info for flags
      that can be set by device drivers at the probe time to inform the PM
      core and/or bus types, PM domains and so on on the capabilities and/or
      preferences of device drivers.  Also add two static inline helpers
      for setting that field and testing it against a given set of flags
      and make the driver core clear it automatically on driver remove
      and probe failures.
      
      Define and document two PM driver flags related to the direct-
      complete feature: NEVER_SKIP and SMART_PREPARE that can be used,
      respectively, to indicate to the PM core that the direct-complete
      mechanism should never be used for the device and to inform the
      middle layer code (bus types, PM domains etc) that it can only
      request the PM core to use the direct-complete mechanism for
      the device (by returning a positive value from its ->prepare
      callback) if it also has been requested by the driver.
      
      While at it, make the core check pm_runtime_suspended() when
      setting power.direct_complete so that it doesn't need to be
      checked by ->prepare callbacks.
      Signed-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Acked-by: NBjorn Helgaas <bhelgaas@google.com>
      Reviewed-by: NUlf Hansson <ulf.hansson@linaro.org>
      08810a41
  15. 19 10月, 2017 1 次提交
    • R
      drivers: flag buses which demand DMA configuration · d89e2378
      Robin Murphy 提交于
      We do not want the common dma_configure() pathway to apply
      indiscriminately to all devices, since there are plenty of buses which
      do not have DMA capability, and if their child devices were used for
      DMA API calls it would only be indicative of a driver bug. However,
      there are a number of buses for which DMA is implicitly expected even
      when not described by firmware - those we whitelist with an automatic
      opt-in to dma_configure(), assuming that the DMA address space and the
      physical address space are equivalent if not otherwise specified.
      
      Commit 72328883 ("of: restrict DMA configuration") introduced a
      short-term fix by comparing explicit bus types, but this approach is far
      from pretty, doesn't scale well, and fails to cope at all with bus
      drivers which may be built as modules, like host1x. Let's refine things
      by making that opt-in a property of the bus type, which neatly addresses
      those problems and lets the decision of whether firmware description of
      DMA capability should be optional or mandatory stay internal to the bus
      drivers themselves.
      Signed-off-by: NRobin Murphy <robin.murphy@arm.com>
      Acked-by: NRob Herring <robh@kernel.org>
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Acked-by: NThierry Reding <treding@nvidia.com>
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      d89e2378
  16. 26 9月, 2017 1 次提交
  17. 19 9月, 2017 1 次提交
  18. 18 9月, 2017 1 次提交
  19. 29 8月, 2017 1 次提交
  20. 28 8月, 2017 1 次提交
  21. 07 8月, 2017 1 次提交
  22. 22 7月, 2017 3 次提交
  23. 07 7月, 2017 1 次提交
  24. 13 6月, 2017 1 次提交
    • J
      driver core: add helper to reuse a device-tree node · 4e75e1d7
      Johan Hovold 提交于
      Add a helper function to be used when reusing the device-tree node of
      another device.
      
      It is fairly common for drivers to reuse the device-tree node of a
      parent (or other ancestor) device when creating class or bus devices
      (e.g. gpio chips, i2c adapters, iio chips, spi masters, serdev, phys,
      usb root hubs). But reusing a device-tree node may cause problems if the
      new device is later probed as for example driver core would currently
      attempt to reinitialise an already active associated pinmux
      configuration.
      
      Other potential issues include the platform-bus code unconditionally
      dropping the device-tree node reference in its device destructor,
      reinitialisation of other bus-managed resources such as clocks, and the
      recently added DMA-setup in driver core.
      
      Note that for most examples above this is currently not an issue as the
      devices are never probed, but this is a problem for the USB bus which
      has recently gained device-tree support. This was discovered and
      worked-around in a rather ad-hoc fashion by commit dc5878ab ("usb:
      core: move root hub's device node assignment after it is added to bus")
      by not setting the of_node pointer until after the root-hub device has
      been registered.
      
      Instead we can allow devices to reuse a device-tree node by setting a
      flag in their struct device that can be used by core, bus and driver
      code to avoid resources from being over-allocated.
      
      Note that the helper also grabs an extra reference to the device node,
      which specifically balances the unconditional put in the platform-device
      destructor.
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4e75e1d7
  25. 12 6月, 2017 1 次提交
  26. 09 6月, 2017 1 次提交
  27. 07 6月, 2017 1 次提交
  28. 17 3月, 2017 1 次提交
  29. 25 2月, 2017 1 次提交
  30. 25 1月, 2017 1 次提交
  31. 21 1月, 2017 2 次提交
  32. 05 12月, 2016 1 次提交
  33. 30 11月, 2016 1 次提交
  34. 24 11月, 2016 1 次提交