27 Sep, 2016

1 commit


31 Aug, 2016

2 commits

  • of_irq_get[_byname]() return 0 iff irq_create_of_mapping() call fails.
    Returning both error code and 0 on failure is a sign of a misdesigned API,
    it makes the failure check unnecessarily complex and error prone. We should
    rely on the platform IRQ resource in this case, not return 0, especially
    as 0 can be a valid IRQ resource too...

    Fixes: aff008ad813c ("platform_get_irq: Revert to platform_get_resource if of_irq_get fails")
    Signed-off-by: Sergei Shtylyov
    CC: stable@vger.kernel.org
    Signed-off-by: Greg Kroah-Hartman

    Sergei Shtylyov
     
  • In platform_device_del(), the device is still used after a call to
    device_del(). At this point there is no guarantee that the device is
    still there and there could be a use-after-free access. Move the
    call to device_remove_properties() before device_del() to fix that.

    Signed-off-by: Jerome Marchand
    Signed-off-by: Greg Kroah-Hartman

    Jerome Marchand
     

09 Apr, 2016

1 commit

  • Since device_add_property_set() now always takes a copy of
    the property_set, and also since the fwnode type is always
    hard coded to be FWNODE_PDATA, there is no need for the
    drivers to deliver the entire struct property_set. The
    function can just create the instance of it on its own and
    bind the properties from the drivers to it on the spot.

    This renames device_add_property_set() to
    device_add_properties(). The function now takes struct
    property_entry as its parameter instead of struct
    property_set.

    Reviewed-by: Andy Shevchenko
    Reviewed-by: Mika Westerberg
    Acked-by: Thierry Reding
    Acked-by: Lee Jones
    Signed-off-by: Heikki Krogerus
    Signed-off-by: Rafael J. Wysocki

    Heikki Krogerus
     

27 Jan, 2016

1 commit

  • Since b8b2c7d845d5, 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 b8b2c7d845d5, 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 b8b2c7d845d5.

    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: b8b2c7d845d5 ("base/platform: assert that dev_pm_domain callbacks are called unconditionally")
    Signed-off-by: Martin Wilck
    Cc: stable # 4.4
    Cc: Martin Fuzzey
    Acked-by: Jarkko Sakkinen
    Signed-off-by: Greg Kroah-Hartman

    Martin Wilck
     

21 Jan, 2016

1 commit

  • * pm-core:
    driver core: Avoid NULL pointer dereferences in device_is_bound()
    platform: Do not detach from PM domains on shutdown
    USB / PM: Allow USB devices to remain runtime-suspended when sleeping
    PM / sleep: Go direct_complete if driver has no callbacks
    PM / Domains: add setter for dev.pm_domain
    device core: add device_is_bound()

    Rafael J. Wysocki
     

13 Jan, 2016

1 commit

  • Pull oower management and ACPI updates from Rafael Wysocki:
    "As far as the number of commits goes, ACPICA takes the lead this time,
    followed by cpufreq and the device properties framework changes.

    The most significant new feature is the debugfs-based interface to the
    ACPICA's AML debugger added in the previous cycle and a new user space
    tool for accessing it.

    On the cpufreq front, the core is updated to handle governors more
    efficiently, particularly on systems where a single cpufreq policy
    object is shared between multiple CPUs, and there are quite a few
    changes in drivers (intel_pstate, cpufreq-dt etc).

    The device properties framework is updated to handle built-in (ie
    included in the kernel itself) device properties better, among other
    things by adding a fallback mechanism that will allow drivers to
    provide default properties to be used in case the plaform firmware
    doesn't provide the properties expected by them.

    The Operating Performance Points (OPP) framework gets new DT bindings
    and debugfs support.

    A new cpufreq driver for ST platforms is added and the ACPI driver for
    AMD SoCs will now support the APM X-Gene ACPI I2C device.

    The rest is mostly fixes and cleanups all over.

    Specifics:

    - Add a debugfs-based interface for interacting with the ACPICA's AML
    debugger introduced in the previous cycle and a new user space tool
    for that, fix some bugs related to the AML debugger and clean up
    the code in question (Lv Zheng, Dan Carpenter, Colin Ian King,
    Markus Elfring).

    - Update ACPICA to upstream revision 20151218 including a number of
    fixes and cleanups in the ACPICA core (Bob Moore, Lv Zheng, Labbe
    Corentin, Prarit Bhargava, Colin Ian King, David E Box, Rafael
    Wysocki).

    In particular, the previously added erroneous support for the _SUB
    object is dropped, the concatenate operator will support all ACPI
    objects now, the Debug Object handling is improved, the SuperName
    handling of parameters being control methods is fixed, the
    ObjectType operator handling is updated to follow ACPI 5.0A and the
    handling of CondRefOf and RefOf is updated accordingly, module-
    level code will be executed after loading each ACPI table now
    (instead of being run once after all tables containing AML have
    been loaded), the Operation Region handlers management is updated
    to fix some reported problems and a the ACPICA code in the kernel
    is more in line with the upstream now.

    - Update the ACPI backlight driver to provide information on whether
    or not it will generate key-presses for brightness change hotkeys
    and update some platform drivers (dell-wmi, thinkpad_acpi) to use
    that information to avoid sending double key-events to users pace
    for these, add new ACPI backlight quirks (Hans de Goede, Aaron Lu,
    Adrien Schildknecht).

    - Improve the ACPI handling of interrupt GPIOs (Christophe Ricard).

    - Fix the handling of the list of device IDs of device objects found
    in the ACPI namespace and add a helper for checking if there is a
    device object for a given device ID (Lukas Wunner).

    - Change the logic in the ACPI namespace scanning code to create
    struct acpi_device objects for all ACPI device objects found in the
    namespace even if _STA fails for them which helps to avoid device
    enumeration problems on Microsoft Surface 3 (Aaron Lu).

    - Add support for the APM X-Gene ACPI I2C device to the ACPI driver
    for AMD SoCs (Loc Ho).

    - Fix the long-standing issue with the DMA controller on Intel SoCs
    where ACPI tables have no power management support for the DMA
    controller itself, but it can be powered off automatically when the
    last (other) device on the SoC is powered off via ACPI and clean up
    the ACPI driver for Intel SoCs (acpi-lpss) after previous attempts
    to fix that problem (Andy Shevchenko).

    - Assorted ACPI fixes and cleanups (Andy Lutomirski, Colin Ian King,
    Javier Martinez Canillas, Ken Xue, Mathias Krause, Rafael Wysocki,
    Sinan Kaya).

    - Update the device properties framework for better handling of
    built-in properties, add support for built-in properties to the
    platform bus type, update the MFD subsystem's handling of device
    properties and add support for passing default configuration data
    as device properties to the intel-lpss MFD drivers, convert the
    designware I2C driver to use the unified device properties API and
    add a fallback mechanism for using default built-in properties if
    the platform firmware fails to provide the properties as expected
    by drivers (Andy Shevchenko, Mika Westerberg, Heikki Krogerus,
    Andrew Morton).

    - Add new Device Tree bindings to the Operating Performance Points
    (OPP) framework and update the exynos4412 DT binding accordingly,
    introduce debugfs support for the OPP framework (Viresh Kumar,
    Bartlomiej Zolnierkiewicz).

    - Migrate the mt8173 cpufreq driver to the new OPP bindings (Pi-Cheng
    Chen).

    - Update the cpufreq core to make the handling of governors more
    efficient, especially on systems where policy objects are shared
    between multiple CPUs (Viresh Kumar, Rafael Wysocki).

    - Fix cpufreq governor handling on configurations with
    CONFIG_HZ_PERIODIC set (Chen Yu).

    - Clean up the cpufreq core code related to the boost sysfs knob
    support and update the ACPI cpufreq driver accordingly (Rafael
    Wysocki).

    - Add a new cpufreq driver for ST platforms and corresponding Device
    Tree bindings (Lee Jones).

    - Update the intel_pstate driver to allow the P-state selection
    algorithm used by it to depend on the CPU ID of the processor it is
    running on, make it use a special P-state selection algorithm (with
    an IO wait time compensation tweak) on Atom CPUs based on the
    Airmont and Silvermont cores so as to reduce their energy
    consumption and improve intel_pstate documentation (Philippe
    Longepe, Srinivas Pandruvada).

    - Update the cpufreq-dt driver to support registering cooling devices
    that use the (P * V^2 * f) dynamic power draw formula where V is
    the voltage, f is the frequency and P is a constant coefficient
    provided by Device Tree and update the arm_big_little cpufreq
    driver to use that support (Punit Agrawal).

    - Assorted cpufreq driver (cpufreq-dt, qoriq, pcc-cpufreq,
    blackfin-cpufreq) updates (Andrzej Hajda, Hongtao Jia, Jacob
    Tanenbaum, Markus Elfring).

    - cpuidle core tweaks related to polling and measured_us calculation
    (Rik van Riel).

    - Removal of modularity from a few cpuidle drivers (clps711x, ux500,
    exynos) that cannot be built as modules in practice (Paul
    Gortmaker).

    - PM core update to prevent devices from being probed during system
    suspend/resume which is generally problematic and may lead to
    inconsistent behavior (Grygorii Strashko).

    - Assorted updates of the PM core and related code (Julia Lawall,
    Manuel Pégourié-Gonnard, Maruthi Bayyavarapu, Rafael Wysocki, Ulf
    Hansson).

    - PNP bus type updates (Christophe Le Roy, Heiner Kallweit).

    - PCI PM code cleanups (Jarkko Nikula, Julia Lawall).

    - cpupower tool updates (Jacob Tanenbaum, Thomas Renninger)"

    * tag 'pm+acpi-4.5-rc1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (177 commits)
    PM / clk: don't leave clocks enabled when driver not bound
    i2c: dw: Add APM X-Gene ACPI I2C device support
    ACPI / APD: Add APM X-Gene ACPI I2C device support
    ACPI / LPSS: change 'does not have' to 'has' in comment
    Revert "dmaengine: dw: platform: provide platform data for Intel"
    dmaengine: dw: return immediately from IRQ when DMA isn't in use
    dmaengine: dw: platform: power on device on shutdown
    ACPI / LPSS: override power state for LPSS DMA device
    PM / OPP: Use snprintf() instead of sprintf()
    Documentation: cpufreq: intel_pstate: enhance documentation
    ACPI, PCI, irq: remove redundant check for null string pointer
    ACPI / video: driver must be registered before checking for keypresses
    cpufreq-dt: fix handling regulator_get_voltage() result
    cpufreq: governor: Fix negative idle_time when configured with CONFIG_HZ_PERIODIC
    PM / sleep: Add support for read-only sysfs attributes
    ACPI: Fix white space in a structure definition
    ACPI / SBS: fix inconsistent indenting inside if statement
    PNP: respect PNP_DRIVER_RES_DO_NOT_CHANGE when detaching
    ACPI / PNP: constify device IDs
    ACPI / PCI: Simplify acpi_penalize_isa_irq()
    ...

    Linus Torvalds
     

12 Jan, 2016

1 commit


07 Jan, 2016

1 commit

  • 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
    Acked-by: Rob Herring
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Linus Walleij

    Stephen Boyd
     

07 Dec, 2015

1 commit

  • Make it possible to pass built-in device properties to platform device
    drivers. This is useful if the system does not have any firmware interface
    like Device Tree or ACPI which provides these.

    Properties associated with the platform device will be automatically
    released when the corresponding device is removed.

    Suggested-by: Arnd Bergmann
    Signed-off-by: Mika Westerberg
    Signed-off-by: Andy Shevchenko
    Signed-off-by: Rafael J. Wysocki

    Mika Westerberg
     

05 Oct, 2015

2 commits


26 Aug, 2015

1 commit

  • 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
    Cc: Wolfram Sang
    Cc: Rob Herring
    Cc: Greg Kroah-Hartman
    Cc: Ricardo Ribalda Delgado
    Signed-off-by: Grant Likely
    Tested-by: Ricardo Ribalda Delgado
    Tested-by: Wolfram Sang
    Cc: stable@vger.kernel.org
    Signed-off-by: Rob Herring

    Grant Likely
     

10 Jun, 2015

3 commits


01 Jun, 2015

3 commits

  • Failure path of platform_device_add was almost the same as
    platform_device_del. Refactor same code in a function.

    Acked-by: Rob Herring
    Signed-off-by: Ricardo Ribalda Delgado
    Signed-off-by: Greg Kroah-Hartman

    Ricardo Ribalda Delgado
     
  • insert_resource() can fail when the resource added overlaps
    (partially or fully) with another.

    Device tree and AMBA devices may contain resources that overlap, so they
    could not call platform_device_add (see 02bbde7849e6 ('Revert "of:
    use platform_device_add"'))"

    On the other hand, device trees are released using
    platform_device_unregister(). This function calls platform_device_del(),
    which calls release_resource(), that crashes when the resource has not
    been added with with insert_resource. This was not an issue when the
    device tree could not be modified online, but this is not the case
    anymore.

    This patch let the flow continue when there is an insert error, after
    notifying the user with a dev_err(). r->parent is set to NULL, so
    platform_device_del() knows that the resource was not added, and
    therefore it should not be released.

    Acked-by: Rob Herring
    Signed-off-by: Ricardo Ribalda Delgado
    Signed-off-by: Greg Kroah-Hartman

    Ricardo Ribalda Delgado
     
  • platform_device_del only checks the type of the resource in order to
    call release_resource.

    On the other hand, platform_device_add calls insert_resource for any
    resource that has a parent.

    Make both code branches balanced.

    Signed-off-by: Ricardo Ribalda Delgado
    Signed-off-by: Greg Kroah-Hartman

    Ricardo Ribalda Delgado
     

20 May, 2015

1 commit


15 Apr, 2015

1 commit

  • Pull power management and ACPI updates from Rafael Wysocki:
    "These are mostly fixes and cleanups all over, although there are a few
    items that sort of fall into the new feature category.

    First off, we have new callbacks for PM domains that should help us to
    handle some issues related to device initialization in a better way.

    There also is some consolidation in the unified device properties API
    area allowing us to use that inferface for accessing data coming from
    platform initialization code in addition to firmware-provided data.

    We have some new device/CPU IDs in a few drivers, support for new
    chips and a new cpufreq driver too.

    Specifics:

    - Generic PM domains support update including new PM domain callbacks
    to handle device initialization better (Russell King, Rafael J
    Wysocki, Kevin Hilman)

    - Unified device properties API update including a new mechanism for
    accessing data provided by platform initialization code (Rafael J
    Wysocki, Adrian Hunter)

    - ARM cpuidle update including ARM32/ARM64 handling consolidation
    (Daniel Lezcano)

    - intel_idle update including support for the Silvermont Core in the
    Baytrail SOC and for the Airmont Core in the Cherrytrail and
    Braswell SOCs (Len Brown, Mathias Krause)

    - New cpufreq driver for Hisilicon ACPU (Leo Yan)

    - intel_pstate update including support for the Knights Landing chip
    (Dasaratharaman Chandramouli, Kristen Carlson Accardi)

    - QorIQ cpufreq driver update (Tang Yuantian, Arnd Bergmann)

    - powernv cpufreq driver update (Shilpasri G Bhat)

    - devfreq update including Tegra support changes (Tomeu Vizoso,
    MyungJoo Ham, Chanwoo Choi)

    - powercap RAPL (Running-Average Power Limit) driver update including
    support for Intel Broadwell server chips (Jacob Pan, Mathias Krause)

    - ACPI device enumeration update related to the handling of the
    special PRP0001 device ID allowing DT-style 'compatible' property
    to be used for ACPI device identification (Rafael J Wysocki)

    - ACPI EC driver update including limited _DEP support (Lan Tianyu,
    Lv Zheng)

    - ACPI backlight driver update including a new mechanism to allow
    native backlight handling to be forced on non-Windows 8 systems and
    a new quirk for Lenovo Ideapad Z570 (Aaron Lu, Hans de Goede)

    - New Windows Vista compatibility quirk for Sony VGN-SR19XN (Chen Yu)

    - Assorted ACPI fixes and cleanups (Aaron Lu, Martin Kepplinger,
    Masanari Iida, Mika Westerberg, Nan Li, Rafael J Wysocki)

    - Fixes related to suspend-to-idle for the iTCO watchdog driver and
    the ACPI core system suspend/resume code (Rafael J Wysocki, Chen Yu)

    - PM tracing support for the suspend phase of system suspend/resume
    transitions (Zhonghui Fu)

    - Configurable delay for the system suspend/resume testing facility
    (Brian Norris)

    - PNP subsystem cleanups (Peter Huewe, Rafael J Wysocki)"

    * tag 'pm+acpi-4.1-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (74 commits)
    ACPI / scan: Fix NULL pointer dereference in acpi_companion_match()
    ACPI / scan: Rework modalias creation when "compatible" is present
    intel_idle: mark cpu id array as __initconst
    powercap / RAPL: mark rapl_ids array as __initconst
    powercap / RAPL: add ID for Broadwell server
    intel_pstate: Knights Landing support
    intel_pstate: remove MSR test
    cpufreq: fix qoriq uniprocessor build
    ACPI / scan: Take the PRP0001 position in the list of IDs into account
    ACPI / scan: Simplify acpi_match_device()
    ACPI / scan: Generalize of_compatible matching
    device property: Introduce firmware node type for platform data
    device property: Make it possible to use secondary firmware nodes
    PM / watchdog: iTCO: stop watchdog during system suspend
    cpufreq: hisilicon: add acpu driver
    ACPI / EC: Call acpi_walk_dep_device_list() after installing EC opregion handler
    cpufreq: powernv: Report cpu frequency throttling
    intel_idle: Add support for the Airmont Core in the Cherrytrail and Braswell SOCs
    intel_idle: Update support for Silvermont Core in Baytrail SOC
    PM / devfreq: tegra: Register governor on module init
    ...

    Linus Torvalds
     

25 Mar, 2015

1 commit

  • This fixes a regression from the net subsystem:
    After commit d52fdbb735c36a209f36a628d40ca9185b349ba7
    "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: d52fdbb735c3 ("smc91x: retrieve IRQ and trigger flags in a modern way")
    Tested-by: Robert Jarzmik
    Signed-off-by: Linus Walleij
    Signed-off-by: Greg Kroah-Hartman

    Linus Walleij
     

17 Mar, 2015

1 commit

  • Now that we have struct fwnode_handle, we can use that to point to
    ACPI companions from struct device objects instead of pointing to
    struct acpi_device directly.

    There are two benefits from that. First, the somewhat ugly and
    hackish struct acpi_dev_node can be dropped and, second, the same
    struct fwnode_handle pointer can be used in the future to point
    to other (non-ACPI) firmware device node types.

    Signed-off-by: Rafael J. Wysocki
    Acked-by: Greg Kroah-Hartman
    Acked-by: Grant Likely

    Rafael J. Wysocki
     

15 Dec, 2014

1 commit

  • Pull driver core update from Greg KH:
    "Here's the set of driver core patches for 3.19-rc1.

    They are dominated by the removal of the .owner field in platform
    drivers. They touch a lot of files, but they are "simple" changes,
    just removing a line in a structure.

    Other than that, a few minor driver core and debugfs changes. There
    are some ath9k patches coming in through this tree that have been
    acked by the wireless maintainers as they relied on the debugfs
    changes.

    Everything has been in linux-next for a while"

    * tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (324 commits)
    Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries"
    fs: debugfs: add forward declaration for struct device type
    firmware class: Deletion of an unnecessary check before the function call "vunmap"
    firmware loader: fix hung task warning dump
    devcoredump: provide a one-way disable function
    device: Add dev__once variants
    ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries
    ath: use seq_file api for ath9k debugfs files
    debugfs: add helper function to create device related seq_file
    drivers/base: cacheinfo: remove noisy error boot message
    Revert "core: platform: add warning if driver has no owner"
    drivers: base: support cpu cache information interface to userspace via sysfs
    drivers: base: add cpu_device_create to support per-cpu devices
    topology: replace custom attribute macros with standard DEVICE_ATTR*
    cpumask: factor out show_cpumap into separate helper function
    driver core: Fix unbalanced device reference in drivers_probe
    driver core: fix race with userland in device_add()
    sysfs/kernfs: make read requests on pre-alloc files use the buffer.
    sysfs/kernfs: allow attributes to request write buffer be pre-allocated.
    fs: sysfs: return EGBIG on write if offset is larger than file size
    ...

    Linus Torvalds
     

25 Nov, 2014

1 commit


07 Nov, 2014

2 commits

  • Since commit 9447057eaff8 ("platform_device: use a macro instead of
    platform_driver_register"), platform_driver_register() always overwrites
    the .owner field of a platform_driver with THIS_MODULE. This breaks
    platform_create_bundle() which uses it via platform_driver_probe() from
    within the platform core instead of the module init. Fix it by using a
    similar #define construct to obtain THIS_MODULE and pass it on later.

    Reported-by: Russell King
    Signed-off-by: Wolfram Sang
    Signed-off-by: Greg Kroah-Hartman

    Wolfram Sang
     
  • Since commit 9447057eaff8 ("platform_device: use a macro instead of
    platform_driver_register"), platform_driver_register() always overwrites
    the .owner field of a platform_driver with THIS_MODULE. This breaks
    platform_driver_probe() which uses it from within the platform core
    instead of the module init. Fix it by using a similar #define construct
    to obtain THIS_MODULE and pass it on later.

    Reported-by: Russell King
    Signed-off-by: Wolfram Sang
    Signed-off-by: Greg Kroah-Hartman

    Wolfram Sang
     

30 Sep, 2014

1 commit

  • The commit 46420dd73b80 (PM / Domains: Add APIs to attach/detach a PM
    domain for a device) started using errno values in pm.h header file.
    It also failed to include the header for these, thus it caused
    compiler errors.

    Instead of including the errno header to pm.h, let's move the functions
    to pm_domain.h, since it's a better match.

    Fixes: 46420dd73b80 (PM / Domains: Add APIs to attach/detach a PM domain for a device)
    Signed-off-by: Ulf Hansson
    Acked-by: Geert Uytterhoeven
    Acked-by: Wolfram Sang
    Acked-by: Mark Brown
    Signed-off-by: Rafael J. Wysocki

    Ulf Hansson
     

22 Sep, 2014

1 commit

  • Previously only the ACPI PM domain was supported by the platform bus.

    Let's convert to the common attach/detach functions for PM domains,
    which currently means we are extending the support to include the
    generic PM domain as well.

    Signed-off-by: Ulf Hansson
    Tested-by: Philipp Zabel
    Reviewed-by: Kevin Hilman
    Reviewed-by: Dmitry Torokhov
    Signed-off-by: Rafael J. Wysocki

    Ulf Hansson
     

05 Aug, 2014

2 commits

  • Pull driver core updates from Greg KH:
    "Here's the big driver-core pull request for 3.17-rc1.

    Largest thing in here is the dma-buf rework and fence code, that
    touched many different subsystems so it was agreed it should go
    through this tree to handle merge issues. There's also some firmware
    loading updates, as well as tests added, and a few other tiny changes,
    the changelog has the details.

    All have been in linux-next for a long time"

    * tag 'driver-core-3.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (32 commits)
    ARM: imx: Remove references to platform_bus in mxc code
    firmware loader: Fix _request_firmware_load() return val for fw load abort
    platform: Remove most references to platform_bus device
    test: add firmware_class loader test
    doc: fix minor typos in firmware_class README
    staging: android: Cleanup style issues
    Documentation: devres: Sort managed interfaces
    Documentation: devres: Add devm_kmalloc() et al
    fs: debugfs: remove trailing whitespace
    kernfs: kernel-doc warning fix
    debugfs: Fix corrupted loop in debugfs_remove_recursive
    stable_kernel_rules: Add pointer to netdev-FAQ for network patches
    driver core: platform: add device binding path 'driver_override'
    driver core/platform: remove unused implicit padding in platform_object
    firmware loader: inform direct failure when udev loader is disabled
    firmware: replace ALIGN(PAGE_SIZE) by PAGE_ALIGN
    firmware: read firmware size using i_size_read()
    firmware loader: allow disabling of udev as firmware loader
    reservation: add suppport for read-only access using rcu
    reservation: update api and add some helpers
    ...

    Conflicts:
    drivers/base/platform.c

    Linus Torvalds
     
  • Pull clock framework updates from Mike Turquette:
    "The clock framework changes for 3.17 are mostly additions of new clock
    drivers and fixes/enhancements to existing clock drivers. There are
    also some non-critical fixes and improvements to the framework core.

    Changes to the clock framework core include:
    - improvements to printks on errors
    - flattening the previously hierarchal structure of per-clock entries
    in debugfs
    - allow per-clock debugfs entries that are specific to a particular
    clock driver
    - configure initial clock parent and/or initial clock rate from
    Device Tree
    - several feature enhancements to the composite clock type
    - misc fixes

    New clock drivers added include:
    - TI Palmas PMIC
    - Allwinner A23 SoC
    - Qualcomm APQ8084 and IPQ8064 SoCs
    - Rockchip rk3188, rk3066 and rk3288 SoCs
    - STMicroelectronics STiH407 SoC
    - Cirrus Logic CLPS711X SoC

    Many fixes, feature enhancements and further clock tree support for
    existing clock drivers also were merged, such as Samsung's "ARMCLK
    down" power saving feature for their Exynos4 & Exynos5 SoCs"

    * tag 'clk-for-linus-3.17' of git://git.linaro.org/people/mike.turquette/linux: (86 commits)
    clk: Add missing of_clk_set_defaults export
    clk: checking wrong variable in __set_clk_parents()
    clk: Propagate any error return from debug_init()
    clk: clps711x: Add DT bindings documentation
    clk: Add CLPS711X clk driver
    clk: st: Use round to closest divider flag
    clk: st: Update frequency tables for fs660c32 and fs432c65
    clk: st: STiH407: Support for clockgenA9
    clk: st: STiH407: Support for clockgenD0/D2/D3
    clk: st: STiH407: Support for clockgenC0
    clk: st: Add quadfs reset handling
    clk: st: Add polarity bit indication
    clk: st: STiH407: Support for clockgenA0
    clk: st: STiH407: Support for A9 MUX Clocks
    clk: st: STiH407: Support for Flexgen Clocks
    clk: st: Adds Flexgen clock binding
    clk: st: Remove uncessary (void *) cast
    clk: st: use static const for clkgen_pll_data tables
    clk: st: use static const for stm_fs tables
    clk: st: Update ST clock binding documentation
    ...

    Linus Torvalds
     

26 Jul, 2014

1 commit

  • This patch adds helper functions to configure clock parents and rates
    as specified through 'assigned-clock-parents', 'assigned-clock-rates'
    DT properties for a clock provider or clock consumer device.
    The helpers are now being called by the bus code for the platform, I2C
    and SPI busses, before the driver probing and also in the clock core
    after registration of a clock provider.

    Signed-off-by: Sylwester Nawrocki
    Acked-by: Kyungmin Park
    Signed-off-by: Mike Turquette

    Sylwester Nawrocki
     

22 Jul, 2014

1 commit


12 Jul, 2014

1 commit

  • Commits 9ec36ca (of/irq: do irq resolution in platform_get_irq)
    and ad69674 (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
    Cc: Tony Lindgren
    Cc: Grant Likely
    Cc: Grygorii Strashko
    Signed-off-by: Guenter Roeck
    Acked-by: Rob Herring
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Guenter Roeck
     

09 Jul, 2014

2 commits

  • 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: Alex Williamson
    Reviewed-by: Alexander Graf
    Reviewed-by: Stuart Yoder
    Signed-off-by: Kim Phillips
    Signed-off-by: Greg Kroah-Hartman

    Kim Phillips
     
  • 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-gfe45736f4134 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-gfe45736f4134 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-gfe45736f4134 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-gfe45736f4134 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 :]
    - 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
    Cc: Dan Carpenter
    Cc: Shawn Guo
    Cc: Sascha Hauer
    Cc: Russell King
    Cc: Olof Johansson
    Cc: Uwe Kleine-König
    Cc: Dmitry Torokhov
    Signed-off-by: Yann Droneaud
    Acked-by: Uwe Kleine-König
    Signed-off-by: Greg Kroah-Hartman

    Yann Droneaud
     

23 May, 2014

1 commit

  • The commit 9ec36cafe43bf835f8f29273597a5b0cbc8267ef
    "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
    Cc: Rob Herring
    Cc: Tony Lindgren
    Cc: Grant Likely
    Cc: Thierry Reding

    Signed-off-by: Grygorii Strashko
    Signed-off-by: Grant Likely

    Grygorii Strashko
     

25 Apr, 2014

1 commit

  • 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: Russell King
    Signed-off-by: Rob Herring
    Signed-off-by: Tony Lindgren
    Tested-by: Tony Lindgren
    Cc: stable@vger.kernel.org # v3.10+
    Signed-off-by: Grant Likely

    Rob Herring
     

15 Feb, 2014

1 commit

  • The acpi_dev_pm_attach/_detach functions perform their own checks to
    ensure the device has an ACPI companion. It is not necessary for the
    caller to do so.

    This mirrors what other busses with ACPI dev PM support do (i2c, spi,
    sdio).

    Cc: Len Brown
    Acked-by: Rafael J. Wysocki
    Signed-off-by: Josh Cartwright
    Signed-off-by: Greg Kroah-Hartman

    Josh Cartwright
     

17 Jan, 2014

1 commit