1. 03 7月, 2017 1 次提交
  2. 25 5月, 2017 1 次提交
  3. 23 3月, 2017 1 次提交
    • R
      of: Add function for generating a DT modalias with a newline · 0634c295
      Rob Herring 提交于
      The modalias sysfs attr is lacking a newline for DT aliases on platform
      devices. The macio and ibmebus correctly add the newline, but open code it.
      Introduce a new function, of_device_modalias(), that fills the buffer with
      the modalias including the newline and update users of the old
      of_device_get_modalias function.
      Signed-off-by: NRob Herring <robh@kernel.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Frank Rowand <frowand.list@gmail.com>
      Cc: linuxppc-dev@lists.ozlabs.org
      Acked-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0634c295
  4. 03 2月, 2017 1 次提交
  5. 11 1月, 2017 1 次提交
  6. 27 9月, 2016 1 次提交
  7. 31 8月, 2016 2 次提交
  8. 09 4月, 2016 1 次提交
  9. 16 2月, 2016 1 次提交
  10. 10 2月, 2016 1 次提交
  11. 27 1月, 2016 1 次提交
    • M
      base/platform: Fix platform drivers with no probe callback · 25cad69f
      Martin Wilck 提交于
      Since b8b2c7d8, platform_drv_probe() is called for all platform
      devices. If drv->probe is NULL, and dev_pm_domain_attach() fails,
      platform_drv_probe() will return the error code from dev_pm_domain_attach().
      
      This causes real_probe() to enter the "probe_failed" path and set
      dev->driver to NULL. Before b8b2c7d8, real_probe() would assume
      success if both dev->bus->probe and drv->probe were missing. As a result,
      a device and driver could be "bound" together just by matching their names;
      this doesn't work any more after b8b2c7d8.
      
      This may cause problems later for certain usage of platform_driver_register()
      and platform_device_register_simple(). I observed a panic while loading
      the tpm_tis driver with parameter "force=1" (i.e. registering tpm_tis as
      a platform driver), because tpm_tis_init's assumption that the device
      returned by platform_device_register_simple() was bound didn't hold any more
      (tpmm_chip_alloc() dereferences chip->pdev->driver, causing panic).
      
      This patch restores the previous (4.3.0 and earlier) behavior of
      platform_drv_probe() in the case when the associated platform driver has
      no "probe" function.
      
      Fixes: b8b2c7d8 ("base/platform: assert that dev_pm_domain callbacks are called unconditionally")
      Signed-off-by: NMartin Wilck <Martin.Wilck@ts.fujitsu.com>
      Cc: stable <stable@vger.kernel.org> # 4.4
      Cc: Martin Fuzzey <mfuzzey@parkeon.com>
      Acked-by: NJarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      25cad69f
  12. 12 1月, 2016 1 次提交
  13. 07 1月, 2016 1 次提交
    • S
      driver-core: platform: Add platform_irq_count() · 4b83555d
      Stephen Boyd 提交于
      A recent patch added calls to of_irq_count() in the qcom pinctrl
      drivers and that caused module build failures because
      of_irq_count() is not an exported symbol. We shouldn't export
      of_irq_count() to modules because it's an internal OF API that
      shouldn't be used by drivers. Platform drivers should use
      platform device APIs instead. Therefore, add a platform_irq_count()
      API that mirrors the of_irq_count() API so that platform drivers
      can stay DT agnostic.
      
      Cc: Andy Gross <andy.gross@linaro.org>
      Acked-by: NRob Herring <robh@kernel.org>
      Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org
      Signed-off-by: NStephen Boyd <sboyd@codeaurora.org>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      4b83555d
  14. 07 12月, 2015 1 次提交
  15. 05 10月, 2015 2 次提交
  16. 26 8月, 2015 1 次提交
    • G
      drivercore: Fix unregistration path of platform devices · 7f5dcaf1
      Grant Likely 提交于
      The unregister path of platform_device is broken. On registration, it
      will register all resources with either a parent already set, or
      type==IORESOURCE_{IO,MEM}. However, on unregister it will release
      everything with type==IORESOURCE_{IO,MEM}, but ignore the others. There
      are also cases where resources don't get registered in the first place,
      like with devices created by of_platform_populate()*.
      
      Fix the unregister path to be symmetrical with the register path by
      checking the parent pointer instead of the type field to decide which
      resources to unregister. This is safe because the upshot of the
      registration path algorithm is that registered resources have a parent
      pointer, and non-registered resources do not.
      
      * It can be argued that of_platform_populate() should be registering
        it's resources, and they argument has some merit. However, there are
        quite a few platforms that end up broken if we try to do that due to
        overlapping resources in the device tree. Until that is fixed, we need
        to solve the immediate problem.
      
      Cc: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
      Cc: Wolfram Sang <wsa@the-dreams.de>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      Tested-by: NRicardo Ribalda Delgado <ricardo.ribalda@gmail.com>
      Tested-by: NWolfram Sang <wsa+renesas@sang-engineering.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NRob Herring <robh@kernel.org>
      7f5dcaf1
  17. 10 6月, 2015 3 次提交
  18. 01 6月, 2015 3 次提交
  19. 20 5月, 2015 1 次提交
  20. 25 3月, 2015 1 次提交
    • L
      drivers: platform: parse IRQ flags from resources · 7085a740
      Linus Walleij 提交于
      This fixes a regression from the net subsystem:
      After commit d52fdbb7
      "smc91x: retrieve IRQ and trigger flags in a modern way"
      a regression would appear on some legacy platforms such
      as the ARM PXA Zylonite that specify IRQ resources like
      this:
      
      static struct resource r = {
             .start  = X,
             .end    = X,
             .flags  = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
      };
      
      The previous code would retrieve the resource and parse
      the high edge setting in the SMC91x driver, a use pattern
      that means every driver specifying an IRQ flag from a
      static resource need to parse resource flags and apply
      them at runtime.
      
      As we switched the code to use IRQ descriptors to retrieve
      the the trigger type like this:
      
        irqd_get_trigger_type(irq_get_irq_data(...));
      
      the code would work for new platforms using e.g. device
      tree as the backing irq descriptor would have its flags
      properly set, whereas this kind of oldstyle static
      resources at no point assign the trigger flags to the
      corresponding IRQ descriptor.
      
      To make the behaviour identical on modern device tree
      and legacy static platform data platforms, modify
      platform_get_irq() to assign the trigger flags to the
      irq descriptor when a client looks up an IRQ from static
      resources.
      
      Fixes: d52fdbb7 ("smc91x: retrieve IRQ and trigger flags in a modern way")
      Tested-by: NRobert Jarzmik <robert.jarzmik@free.fr>
      Signed-off-by: NLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7085a740
  21. 17 3月, 2015 1 次提交
  22. 25 11月, 2014 1 次提交
  23. 07 11月, 2014 2 次提交
  24. 30 9月, 2014 1 次提交
  25. 22 9月, 2014 1 次提交
  26. 26 7月, 2014 1 次提交
  27. 12 7月, 2014 1 次提交
    • G
      platform_get_irq: Revert to platform_get_resource if of_irq_get fails · aff008ad
      Guenter Roeck 提交于
      Commits 9ec36caf (of/irq: do irq resolution in platform_get_irq)
      and ad69674e (of/irq: do irq resolution in platform_get_irq_byname)
      change the semantics of platform_get_irq and platform_get_irq_byname
      to always rely on devicetree information if devicetree is enabled
      and if a devicetree node is attached to the device. The functions
      now return an error if the devicetree data does not include interrupt
      information, even if the information is available as platform resource
      data.
      
      This causes mfd client drivers to fail if the interrupt number is
      passed via platform resources. Therefore, if of_irq_get fails, try
      platform_get_resource as method of last resort. This restores the
      original functionality for drivers depending on platform resources
      to get irq information.
      
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Tony Lindgren <tony@atomide.com>
      Cc: Grant Likely <grant.likely@linaro.org>
      Cc: Grygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: NGuenter Roeck <linux@roeck-us.net>
      Acked-by: NRob Herring <robh@kernel.org>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      aff008ad
  28. 09 7月, 2014 2 次提交
    • K
      driver core: platform: add device binding path 'driver_override' · 3d713e0e
      Kim Phillips 提交于
      Needed by platform device drivers, such as the upcoming
      vfio-platform driver, in order to bypass the existing OF, ACPI,
      id_table and name string matches, and successfully be able to be
      bound to any device, like so:
      
      echo vfio-platform > /sys/bus/platform/devices/fff51000.ethernet/driver_override
      echo fff51000.ethernet > /sys/bus/platform/devices/fff51000.ethernet/driver/unbind
      echo fff51000.ethernet > /sys/bus/platform/drivers_probe
      
      This mimics "PCI: Introduce new device binding path using
      pci_dev.driver_override", which is an interface enhancement
      for more deterministic PCI device binding, e.g., when in the
      presence of hotplug.
      Reviewed-by: NAlex Williamson <alex.williamson@redhat.com>
      Reviewed-by: NAlexander Graf <agraf@suse.de>
      Reviewed-by: NStuart Yoder <stuart.yoder@freescale.com>
      Signed-off-by: NKim Phillips <kim.phillips@freescale.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3d713e0e
    • Y
      driver core/platform: remove unused implicit padding in platform_object · 1cec24c5
      Yann Droneaud 提交于
      Up to 7 bytes are wasted at the end of struct platform_object
      in the form of padding after name field: unfortunately this
      padding is not used when allocating the memory to hold the
      name.
      
      This patch converts name array from name[1] to C99 flexible
      array name[] (equivalent to name[0]) so that no padding is
      required by the presence of this field. Memory allocation
      is updated to take care of allocating an additional byte for
      the NUL terminating character.
      
      Built on Fedora 20, using GCC 4.8, for ARM, i386, SPARC64 and
      x86_64 architectures, the data structure layout can be reported
      with following command:
      
        $ pahole drivers/base/platform.o \
                 --recursive             \
                 --class_name device,pdev_archdata,platform_device,platform_object
      
      Please find below some comparisons of structure layout for arm,
      i386, sparc64 and x86_64 architecture before and after the patch.
      
        --- obj-arm/drivers/base/platform.o.pahole.v3.15-rc7-79-gfe45736f	2014-05-30 10:32:06.290960701 +0200
        +++ obj-arm/drivers/base/platform.o.pahole.v3.15-rc7-80-g2cdb06858d71	2014-05-30 11:26:20.851988347 +0200
        @@ -81,10 +81,9 @@
           /* XXX last struct has 4 bytes of padding */
      
        	/* --- cacheline 6 boundary (384 bytes) was 8 bytes ago --- */
        -	char                       name[1];              /*   392     1 */
        +	char                       name[0];              /*   392     0 */
      
        -	/* size: 400, cachelines: 7, members: 2 */
        -	/* padding: 7 */
        +	/* size: 392, cachelines: 7, members: 2 */
         	/* paddings: 1, sum paddings: 4 */
        -	/* last cacheline: 16 bytes */
        +	/* last cacheline: 8 bytes */
         };
      
        --- obj-i386/drivers/base/platform.o.pahole.v3.15-rc7-79-gfe45736f 2014-05-30 10:32:06.305960691 +0200
        +++ obj-i386/drivers/base/platform.o.pahole.v3.15-rc7-80-g2cdb06858d71 2014-05-30 11:26:20.875988332 +0200
        @@ -73,9 +73,8 @@
         struct platform_object {
         	struct platform_device     pdev;                 /*     0   396 */
         	/* --- cacheline 6 boundary (384 bytes) was 12 bytes ago --- */
        -	char                       name[1];              /*   396     1 */
        +	char                       name[0];              /*   396     0 */
      
        -	/* size: 400, cachelines: 7, members: 2 */
        -	/* padding: 3 */
        -	/* last cacheline: 16 bytes */
        +	/* size: 396, cachelines: 7, members: 2 */
        +	/* last cacheline: 12 bytes */
         };
      
        --- obj-sparc64/drivers/base/platform.o.pahole.v3.15-rc7-79-gfe45736f 2014-05-30 10:32:06.406960625 +0200
        +++ obj-sparc64/drivers/base/platform.o.pahole.v3.15-rc7-80-g2cdb06858d71 2014-05-30 11:26:20.971988269 +0200
        @@ -94,9 +94,8 @@
         struct platform_object {
         	struct platform_device     pdev;                 /*     0  2208 */
         	/* --- cacheline 34 boundary (2176 bytes) was 32 bytes ago --- */
        -	char                       name[1];              /*  2208     1 */
        +	char                       name[0];              /*  2208     0 */
      
        -	/* size: 2216, cachelines: 35, members: 2 */
        -	/* padding: 7 */
        -	/* last cacheline: 40 bytes */
        +	/* size: 2208, cachelines: 35, members: 2 */
        +	/* last cacheline: 32 bytes */
         };
      
        --- obj-x86_64/drivers/base/platform.o.pahole.v3.15-rc7-79-gfe45736f 2014-05-30 10:32:06.432960608 +0200
        +++ obj-x86_64/drivers/base/platform.o.pahole.v3.15-rc7-80-g2cdb06858d71 2014-05-30 11:26:21.000988250 +0200
        @@ -84,9 +84,8 @@
         struct platform_object {
         	struct platform_device     pdev;                 /*     0   720 */
         	/* --- cacheline 11 boundary (704 bytes) was 16 bytes ago --- */
        -	char                       name[1];              /*   720     1 */
        +	char                       name[0];              /*   720     0 */
      
        -	/* size: 728, cachelines: 12, members: 2 */
        -	/* padding: 7 */
        -	/* last cacheline: 24 bytes */
        +	/* size: 720, cachelines: 12, members: 2 */
        +	/* last cacheline: 16 bytes */
         };
      
      Changes from v5 [1]:
      - dropped dma_mask allocation changes and only kept padding
        removal changes (name array length set to 0).
      
      Changes from v4 [2]:
      [by Emil Goode <emilgoode@gmail.com>:]
      - Split v4 of the patch into two separate patches.
      - Generated new object file size and data structure layout info.
      - Updated the changelog message.
      
      Changes from v3 [3]:
      - fixed commit message so that git am doesn't fail.
      
      Changes from v2 [4]:
      - move 'dma_mask' to platform_object so that it's always
        allocated and won't leak on release; remove all previously
        added support functions.
      - use C99 flexible array member for 'name' to remove padding
        at the end of platform_object.
      
      Changes from v1 [5]:
      - remove unneeded kfree() from error path
      - add reference to author/commit adding allocation of dmamask
      
      Changes from v0 [6]:
      - small rewrite to squeeze the patch to a bare minimal
      
      [1] http://lkml.kernel.org/r/1401122483-31603-2-git-send-email-emilgoode@gmail.com
          http://lkml.kernel.org/r/1401122483-31603-1-git-send-email-emilgoode@gmail.com
          http://lkml.kernel.org/r/1401122483-31603-3-git-send-email-emilgoode@gmail.com
      
      [2] http://lkml.kernel.org/r/1390817152-30898-1-git-send-email-ydroneaud@opteya.com
          https://patchwork.kernel.org/patch/3541871/
      
      [3] http://lkml.kernel.org/r/1390771138-28348-1-git-send-email-ydroneaud@opteya.com
          https://patchwork.kernel.org/patch/3540081/
      
      [4] http://lkml.kernel.org/r/1389683909-17495-1-git-send-email-ydroneaud@opteya.com
          https://patchwork.kernel.org/patch/3484411/
      
      [5] http://lkml.kernel.org/r/1389649085-7365-1-git-send-email-ydroneaud@opteya.com
          https://patchwork.kernel.org/patch/3480961/
      
      [6] http://lkml.kernel.org/r/1386886207-2735-1-git-send-email-ydroneaud@opteya.com
      
      Cc: Emil Goode <emilgoode@gmail.com>
      Cc: Dan Carpenter <dan.carpenter@oracle.com>
      Cc: Shawn Guo <shawn.guo@freescale.com>
      Cc: Sascha Hauer <kernel@pengutronix.de>
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Olof Johansson <olof@lixom.net>
      Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: NYann Droneaud <ydroneaud@opteya.com>
      Acked-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1cec24c5
  29. 23 5月, 2014 1 次提交
    • G
      of/irq: do irq resolution in platform_get_irq_byname() · ad69674e
      Grygorii Strashko 提交于
      The commit 9ec36caf
      "of/irq: do irq resolution in platform_get_irq" from Rob Herring -
      moves resolving of the interrupt resources in platform_get_irq().
      But this solution isn't complete because platform_get_irq_byname()
      need to be modified the same way.
      
      Hence, fix it by adding interrupt resolution code at the
      platform_get_irq_byname() function too.
      
      Cc: Russell King <linux@arm.linux.org.uk>
      Cc: Rob Herring <robh@kernel.org>
      Cc: Tony Lindgren <tony@atomide.com>
      Cc: Grant Likely <grant.likely@linaro.org>
      Cc: Thierry Reding <thierry.reding@gmail.com>
      Signed-off-by: NGrygorii Strashko <grygorii.strashko@ti.com>
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      ad69674e
  30. 25 4月, 2014 1 次提交
    • R
      of/irq: do irq resolution in platform_get_irq · 9ec36caf
      Rob Herring 提交于
      Currently we get the following kind of errors if we try to use interrupt
      phandles to irqchips that have not yet initialized:
      
      irq: no irq domain found for /ocp/pinmux@48002030 !
      ------------[ cut here ]------------
      WARNING: CPU: 0 PID: 1 at drivers/of/platform.c:171 of_device_alloc+0x144/0x184()
      Modules linked in:
      CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.12.0-00038-g42a9708 #1012
      (show_stack+0x14/0x1c)
      (dump_stack+0x6c/0xa0)
      (warn_slowpath_common+0x64/0x84)
      (warn_slowpath_null+0x1c/0x24)
      (of_device_alloc+0x144/0x184)
      (of_platform_device_create_pdata+0x44/0x9c)
      (of_platform_bus_create+0xd0/0x170)
      (of_platform_bus_create+0x12c/0x170)
      (of_platform_populate+0x60/0x98)
      
      This is because we're wrongly trying to populate resources that are not
      yet available. It's perfectly valid to create irqchips dynamically, so
      let's fix up the issue by resolving the interrupt resources when
      platform_get_irq is called.
      
      And then we also need to accept the fact that some irqdomains do not
      exist that early on, and only get initialized later on. So we can
      make the current WARN_ON into just into a pr_debug().
      
      We still attempt to populate irq resources when we create the devices.
      This allows current drivers which don't use platform_get_irq to continue
      to function. Once all drivers are fixed, this code can be removed.
      Suggested-by: NRussell King <linux@arm.linux.org.uk>
      Signed-off-by: NRob Herring <robh@kernel.org>
      Signed-off-by: NTony Lindgren <tony@atomide.com>
      Tested-by: NTony Lindgren <tony@atomide.com>
      Cc: stable@vger.kernel.org # v3.10+
      Signed-off-by: NGrant Likely <grant.likely@linaro.org>
      9ec36caf
  31. 15 2月, 2014 1 次提交
  32. 17 1月, 2014 1 次提交