15 Oct, 2020

1 commit

  • Pull driver core updates from Greg KH:
    "Here is the "big" set of driver core patches for 5.10-rc1

    They include a lot of different things, all related to the driver core
    and/or some driver logic:

    - sysfs common write functions to make it easier to audit sysfs
    attributes

    - device connection cleanups and fixes

    - devm helpers for a few functions

    - NOIO allocations for when devices are being removed

    - minor cleanups and fixes

    All have been in linux-next for a while with no reported issues"

    * tag 'driver-core-5.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (31 commits)
    regmap: debugfs: use semicolons rather than commas to separate statements
    platform/x86: intel_pmc_core: do not create a static struct device
    drivers core: node: Use a more typical macro definition style for ACCESS_ATTR
    drivers core: Use sysfs_emit for shared_cpu_map_show and shared_cpu_list_show
    mm: and drivers core: Convert hugetlb_report_node_meminfo to sysfs_emit
    drivers core: Miscellaneous changes for sysfs_emit
    drivers core: Reindent a couple uses around sysfs_emit
    drivers core: Remove strcat uses around sysfs_emit and neaten
    drivers core: Use sysfs_emit and sysfs_emit_at for show(device *...) functions
    sysfs: Add sysfs_emit and sysfs_emit_at to format sysfs output
    dyndbg: use keyword, arg varnames for query term pairs
    driver core: force NOIO allocations during unplug
    platform_device: switch to simpler IDA interface
    driver core: platform: Document return type of more functions
    Revert "driver core: Annotate dev_err_probe() with __must_check"
    Revert "test_firmware: Test platform fw loading on non-EFI systems"
    iio: adc: xilinx-xadc: use devm_krealloc()
    hwmon: pmbus: use more devres helpers
    devres: provide devm_krealloc()
    syscore: Use pm_pr_dbg() for syscore_{suspend,resume}()
    ...

    Linus Torvalds
     

14 Sep, 2020

1 commit


08 Sep, 2020

1 commit


19 Jul, 2020

1 commit

  • Drivers may need to test if a fwnode is a graph endpoint. To avoid
    hand-written solutions that wouldn't work for all fwnode types, add a
    new fwnode_graph_is_endpoint() function for this purpose. We don't need
    to wire it up to different backends for OF and ACPI for now, as the
    implementation can simply be based on checkout the presence of a
    remote-endpoint property.

    Signed-off-by: Laurent Pinchart
    Reviewed-by: Niklas Söderlund
    Reviewed-by: Lad Prabhakar
    Reviewed-by: Kieran Bingham
    Signed-off-by: Sakari Ailus
    Signed-off-by: Mauro Carvalho Chehab

    Laurent Pinchart
     

08 Jun, 2020

1 commit

  • Pull driver core updates from Greg KH:
    "Here is the set of driver core patches for 5.8-rc1.

    Not all that huge this release, just a number of small fixes and
    updates:

    - software node fixes

    - kobject now sends KOBJ_REMOVE when it is removed from sysfs, not
    when it is removed from memory (which could come much later)

    - device link additions and fixes based on testing on more devices

    - firmware core cleanups

    - other minor changes, full details in the shortlog

    All have been in linux-next for a while with no reported issues"

    * tag 'driver-core-5.8-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (23 commits)
    driver core: Update device link status correctly for SYNC_STATE_ONLY links
    firmware_loader: change enum fw_opt to u32
    software node: implement software_node_unregister()
    kobject: send KOBJ_REMOVE uevent when the object is removed from sysfs
    driver core: Remove unnecessary is_fwnode_dev variable in device_add()
    drivers property: When no children in primary, try secondary
    driver core: platform: Fix spelling errors in platform.c
    driver core: Remove check in driver_deferred_probe_force_trigger()
    of: platform: Batch fwnode parsing when adding all top level devices
    driver core: fw_devlink: Add support for batching fwnode parsing
    driver core: Look for waiting consumers only for a fwnode's primary device
    driver core: Move code to the right part of the file
    Revert "Revert "driver core: Set fw_devlink to "permissive" behavior by default""
    drivers: base: Fix NULL pointer exception in __platform_driver_probe() if a driver developer is foolish
    firmware_loader: move fw_fallback_config to a private kernel symbol namespace
    driver core: Add missing '\n' in log messages
    driver/base/soc: Use kobj_to_dev() API
    Add documentation on meaning of -EPROBE_DEFER
    driver core: platform: remove redundant assignment to variable ret
    debugfs: Use the correct style for SPDX License Identifier
    ...

    Linus Torvalds
     

27 May, 2020

1 commit

  • Sometimes it is better to unregister individual nodes instead of trying
    to do them all at once with software_node_unregister_nodes(), so create
    software_node_unregister() so that you can unregister them one at a
    time.

    This is especially important when creating nodes in a hierarchy, with
    parent -> children representations. Children always need to be removed
    before a parent is, as the swnode logic assumes this is going to be the
    case.

    Fix up the lib/test_printf.c fwnode_pointer() test which to use this new
    function as it had the problem of tearing things down in the backwards
    order.

    Fixes: f1ce39df508d ("lib/test_printf: Add tests for %pfw printk modifier")
    Cc: stable
    Cc: Andy Shevchenko
    Cc: Brendan Higgins
    Cc: Dmitry Torokhov
    Cc: Petr Mladek
    Cc: Rafael J. Wysocki
    Cc: Rasmus Villemoes
    Cc: Sakari Ailus
    Cc: Sergey Senozhatsky
    Cc: Steven Rostedt
    Reported-by: Naresh Kamboju
    Reported-by: kernel test robot
    Reported-by: Randy Dunlap
    Tested-by: Petr Mladek
    Tested-by: Randy Dunlap
    Tested-by: Guenter Roeck
    Reviewed-by: Heikki Krogerus
    Acked-by: Randy Dunlap
    Link: https://lore.kernel.org/r/20200524153041.2361-1-gregkh@linuxfoundation.org
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

20 Apr, 2020

1 commit


03 Dec, 2019

4 commits

  • Now that all users of references have moved to reference properties,
    we can remove separate handling of references.

    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Rafael J. Wysocki

    Dmitry Torokhov
     
  • It is possible to store references to software nodes in the same fashion as
    other static properties, so that users do not need to define separate
    structures:

    static const struct software_node gpio_bank_b_node = {
    .name = "B",
    };

    static const struct property_entry simone_key_enter_props[] = {
    PROPERTY_ENTRY_U32("linux,code", KEY_ENTER),
    PROPERTY_ENTRY_STRING("label", "enter"),
    PROPERTY_ENTRY_REF("gpios", &gpio_bank_b_node, 123, GPIO_ACTIVE_LOW),
    { }
    };

    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Rafael J. Wysocki

    Dmitry Torokhov
     
  • We should not conflate whether a property data is an array or a single
    value with where it is stored (embedded into property_entry structure or
    out-of-line). All single-value properties are in effect 1-element
    arrays, and we can figure the amount of data stored in a property by
    examining its length and the data type. And arrays can be as easily
    stored in property entry instances as single values are, provided that
    we have enough space (we have up to 8 bytes). We can embed:

    - up to 8 bytes from U8 arrays
    - up to 4 words
    - up to 2 double words
    - one U64 value
    - one (on 64 bit architectures) or 2 (on 32 bit) strings.

    This change also has an effect of switching properties with small amount
    of data to embed it instead of keeping it separate when copying such
    properties.

    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Rafael J. Wysocki

    Dmitry Torokhov
     
  • We do not need a special flag to know if we are dealing with an
    array, as we can get that data from ratio between element length and
    the data size, but we do need a flag to know whether or not the data
    is stored directly inside property_entry.

    Signed-off-by: Dmitry Torokhov
    [ rjw: Subject & changelog, struct property_entry kerneldoc ]
    Signed-off-by: Rafael J. Wysocki

    Dmitry Torokhov
     

06 Nov, 2019

5 commits

  • We can unify string properties initializer macros with integer
    initializers.

    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Rafael J. Wysocki

    Dmitry Torokhov
     
  • Instead of explicitly setting values of integer types when copying
    property entries lets just copy entire value union when processing
    non-array values.

    For value arrays we no longer use union of pointers, but rather a single
    void pointer, which allows us to remove property_set_pointer().

    In property_get_pointer() we do not need to handle each data type
    separately, we can simply return either the pointer or pointer to values
    union.

    We are not losing anything from removing typed pointer union because the
    upper layers do their accesses through void pointers anyway, and we
    trust the "type" of the property when interpret the data. We rely on
    users of property entries on using PROPERTY_ENTRY_XXX() macros to
    properly initialize entries instead of poking in the instances directly.

    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Rafael J. Wysocki

    Dmitry Torokhov
     
  • Let's mark PROPERTY_ENTRY_* macros that are internal with double leading
    underscores so users are not tempted to use them.

    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Rafael J. Wysocki

    Dmitry Torokhov
     
  • Sometimes we want to initialize property entry array from a regular
    pointer, when we can't determine length automatically via ARRAY_SIZE.
    Let's introduce PROPERTY_ENTRY_XXX_ARRAY_LEN macros that take explicit
    "len" argument.

    Reviewed-by: Andy Shevchenko
    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Rafael J. Wysocki

    Dmitry Torokhov
     
  • This definition is not used anywhere, let's remove it.

    Suggested-by: Andy Shevchenko
    Reviewed-by: Andy Shevchenko
    Signed-off-by: Dmitry Torokhov
    Signed-off-by: Rafael J. Wysocki

    Dmitry Torokhov
     

11 Oct, 2019

4 commits


26 Aug, 2019

1 commit


10 Jul, 2019

1 commit

  • Pull device properties framework updates from Rafael Wysocki:
    "These add helpers for counting items in a property array and extend
    the "software nodes" support to be more convenient for representing
    device properties supplied by drivers and make the intel_cht_int33fe
    driver use that.

    Specifics:

    - Add helpers to count items in a property array (Andy Shevchenko).

    - Extend "software nodes" support to be more convenient for
    representing device properties supplied by drivers (Heikki
    Krogerus).

    - Add device_find_child_by_name() helper to the driver core (Heikki
    Krogerus).

    - Extend device connection code to also look for references provided
    via fwnode pointers (Heikki Krogerus).

    - Start to register proper struct device objects for USB Type-C muxes
    and orientation switches (Heikki Krogerus).

    - Update the intel_cht_int33fe driver to describe devices in a more
    general way with the help of "software nodes" (Heikki Krogerus)"

    * tag 'devprop-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
    device property: Add helpers to count items in an array
    platform/x86: intel_cht_int33fe: Replacing the old connections with references
    platform/x86: intel_cht_int33fe: Supply fwnodes for the external dependencies
    platform/x86: intel_cht_int33fe: Provide fwnode for the USB connector
    platform/x86: intel_cht_int33fe: Provide software nodes for the devices
    platform/x86: intel_cht_int33fe: Remove unused fusb302 device property
    platform/x86: intel_cht_int33fe: Register max17047 in its own function
    usb: typec: Registering real device entries for the muxes
    device connection: Find connections also by checking the references
    device property: Introduce fwnode_find_reference()
    ACPI / property: Don't limit named child node matching to data nodes
    driver core: Add helper device_find_child_by_name()
    software node: Add software_node_get_reference_args()
    software node: Use kobject name when finding child nodes by name
    software node: Add support for static node descriptors
    software node: Simplify software_node_release() function
    software node: Allow node creation without properties

    Linus Torvalds
     

19 Jun, 2019

1 commit

  • Based on 2 normalized pattern(s):

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation

    this program is free software you can redistribute it and or modify
    it under the terms of the gnu general public license version 2 as
    published by the free software foundation #

    extracted by the scancode license scanner the SPDX license identifier

    GPL-2.0-only

    has been chosen to replace the boilerplate/reference in 4122 file(s).

    Signed-off-by: Thomas Gleixner
    Reviewed-by: Enrico Weigelt
    Reviewed-by: Kate Stewart
    Reviewed-by: Allison Randal
    Cc: linux-spdx@vger.kernel.org
    Link: https://lkml.kernel.org/r/20190604081206.933168790@linutronix.de
    Signed-off-by: Greg Kroah-Hartman

    Thomas Gleixner
     

14 Jun, 2019

1 commit

  • The usual pattern to allocate the necessary space for an array of properties is
    to count them first by calling:

    count = device_property_read_uXX_array(dev, propname, NULL, 0);
    if (count < 0)
    return count;

    Introduce helpers device_property_count_uXX() to count items by supplying hard
    coded last two parameters to device_property_readXX_array().

    Signed-off-by: Andy Shevchenko
    Acked-by: Sakari Ailus
    Reviewed-by: Heikki Krogerus
    Signed-off-by: Rafael J. Wysocki

    Andy Shevchenko
     

03 Jun, 2019

3 commits

  • In most cases the references that the drivers look for don't
    have any arguments. This introduces a wrapper function for
    fwnode_property_get_reference_args() that looks for
    references by using only the name and index.

    Signed-off-by: Heikki Krogerus
    Tested-by: Hans de Goede
    Signed-off-by: Rafael J. Wysocki

    Heikki Krogerus
     
  • This makes it possible to support drivers that use
    fwnode_property_get_reference_args() function.

    Signed-off-by: Heikki Krogerus
    Tested-by: Hans de Goede
    Signed-off-by: Rafael J. Wysocki

    Heikki Krogerus
     
  • Until now the software nodes could only be created
    dynamically with fwnode_create_software_node() function.
    This introduces struct software_node data structure, which
    makes it possible to describe the software nodes also
    statically.

    The statically described software nodes can be registered
    with a new function fwnode_register_software_node(). This
    also adds a helper fwnode_register_software_nodes()
    which makes it possible to register an array of struct
    software_nodes, i.e. multiple nodes at the same time.

    There is no difference between statically described and
    dynamically allocated software nodes. Even the registration
    does not differ, except that during node creation the device
    properties are only copied if the node is created
    dynamically. With statically described nodes, the property
    entries in the descriptor (struct software_node) are
    assigned directly to the new software node that is being
    created without any copies.

    Signed-off-by: Heikki Krogerus
    Tested-by: Hans de Goede
    Signed-off-by: Rafael J. Wysocki

    Heikki Krogerus
     

18 Apr, 2019

1 commit

  • fwnode_graph_get_endpoint_by_id() is intended for obtaining local
    endpoints by a given local port.

    fwnode_graph_get_endpoint_by_id() is slightly different from its OF
    counterpart, of_graph_get_endpoint_by_regs(): instead of using -1 as
    a value to indicate that a port or an endpoint number does not matter,
    it uses flags to look for equal or greater endpoint. The port number
    is always fixed. It also returns only remote endpoints that belong
    to an available device, a behaviour that can be turned off with a flag.

    Signed-off-by: Sakari Ailus
    [ rjw: Changelog ]
    Signed-off-by: Rafael J. Wysocki

    Sakari Ailus
     

29 Jan, 2019

1 commit

  • With string type property entries we need to use
    sizeof(const char *) instead of the number of characters as
    the length of the entry.

    If the string was shorter then sizeof(const char *),
    attempts to read it would have failed with -EOVERFLOW. The
    problem has been hidden because all build-in string
    properties have had a string longer then 8 characters until
    now.

    Fixes: a85f42047533 ("device property: helper macros for property entry creation")
    Cc: 4.5+ # 4.5+
    Signed-off-by: Heikki Krogerus
    Reviewed-by: Andy Shevchenko
    Signed-off-by: Rafael J. Wysocki

    Heikki Krogerus
     

27 Nov, 2018

1 commit

  • Software node is a new struct fwnode_handle type that can be
    used to describe devices in kernel (software). It is meant
    to complement fwnodes representing real firmware nodes when
    they are incomplete (for example missing device properties)
    and to supply the primary fwnode when the firmware lacks
    hardware description for a device completely.

    The software node type is really meant to replace the
    currently used "property_set" struct fwnode_handle type. The
    handling of struct property_set is glued to the generic
    device property handling code, and it is not possible to
    create a struct property_set independently from the device
    that it is bind to. struct property_set is only created when
    device properties are added to already initialized struct
    device, and control of it is only possible from the generic
    property handling code.

    Software nodes are instead designed to be created
    independently from the device entries (struct device). It
    makes them much more flexible, as then the device meant to
    be bind to the node can be created at a later time, and from
    another location. It is also possible to bind multiple
    devices to a single software node if needed.

    The software node implementation also includes support for
    node hierarchy, which was the main motivation for this
    commit. The node hierarchy was something that was requested
    for the struct property_set, but it did not seem reasonable
    to try to extend the property_set support for that purpose.
    struct property_set was really meant only for device
    property handling like the name suggests.

    Support for struct property_set is not yet removed in this
    commit, but it will be in the following one.

    Signed-off-by: Heikki Krogerus
    Acked-by: Linus Walleij
    Reviewed-by: Andy Shevchenko
    Signed-off-by: Rafael J. Wysocki

    Heikki Krogerus
     

17 May, 2018

1 commit

  • Commit 318a19718261 (device property: refactor built-in properties
    support) went way too far and brought a union aliasing. Partially
    revert it here to get rid of union aliasing.

    Note, all Apple properties are considered as u8 arrays. To get a value
    of any of them the caller must use device_property_read_u8_array().

    What's union aliasing?
    ~~~~~~~~~~~~~~~~~~~~~~

    The C99 standard in section 6.2.5 paragraph 20 defines union type as
    "an overlapping nonempty set of member objects". It also states in
    section 6.7.2.1 paragraph 14 that "the value of at most one of the
    members can be stored in a union object at any time'.

    Union aliasing is a type punning mechanism using union members to store
    as one type and read back as another.

    Why it's not good?
    ~~~~~~~~~~~~~~~~~~

    Section 6.2.6.1 paragraph 6 says that a union object may not be a trap
    representation, although its member objects may be.

    Meanwhile annex J.1 says that "the value of a union member other than
    the last one stored into" is unspecified [removed in C11].

    In TC3, a footnote is added which specifies that accessing a member of a
    union other than the last one stored causes "the object representation"
    to be re-interpreted in the new type and specifically refers to this as
    "type punning". This conflicts to some degree with Annex J.1.

    While it's working in Linux with GCC, the use of union members to do
    type punning is not clear area in the C standard and might lead to
    unspecified behaviour.

    More information is available in this [1] blog post.

    [1]: https://davmac.wordpress.com/2010/02/26/c99-revisited/

    Signed-off-by: Andy Shevchenko
    Acked-by: Ard Biesheuvel
    Reviewed-by: Mika Westerberg
    Signed-off-by: Rafael J. Wysocki

    Andy Shevchenko
     

12 Feb, 2018

1 commit


02 Feb, 2018

1 commit

  • Pull driver core updates from Greg KH:
    "Here is the set of "big" driver core patches for 4.16-rc1.

    The majority of the work here is in the firmware subsystem, with
    reworks to try to attempt to make the code easier to handle in the
    long run, but no functional change. There's also some tree-wide sysfs
    attribute fixups with lots of acks from the various subsystem
    maintainers, as well as a handful of other normal fixes and changes.

    And finally, some license cleanups for the driver core and sysfs code.

    All have been in linux-next for a while with no reported issues"

    * tag 'driver-core-4.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (48 commits)
    device property: Define type of PROPERTY_ENRTY_*() macros
    device property: Reuse property_entry_free_data()
    device property: Move property_entry_free_data() upper
    firmware: Fix up docs referring to FIRMWARE_IN_KERNEL
    firmware: Drop FIRMWARE_IN_KERNEL Kconfig option
    USB: serial: keyspan: Drop firmware Kconfig options
    sysfs: remove DEBUG defines
    sysfs: use SPDX identifiers
    drivers: base: add coredump driver ops
    sysfs: add attribute specification for /sysfs/devices/.../coredump
    test_firmware: fix missing unlock on error in config_num_requests_store()
    test_firmware: make local symbol test_fw_config static
    sysfs: turn WARN() into pr_warn()
    firmware: Fix a typo in fallback-mechanisms.rst
    treewide: Use DEVICE_ATTR_WO
    treewide: Use DEVICE_ATTR_RO
    treewide: Use DEVICE_ATTR_RW
    sysfs.h: Use octal permissions
    component: add debugfs support
    bus: simple-pm-bus: convert bool SIMPLE_PM_BUS to tristate
    ...

    Linus Torvalds
     

01 Feb, 2018

1 commit

  • Pull networking updates from David Miller:

    1) Significantly shrink the core networking routing structures. Result
    of http://vger.kernel.org/~davem/seoul2017_netdev_keynote.pdf

    2) Add netdevsim driver for testing various offloads, from Jakub
    Kicinski.

    3) Support cross-chip FDB operations in DSA, from Vivien Didelot.

    4) Add a 2nd listener hash table for TCP, similar to what was done for
    UDP. From Martin KaFai Lau.

    5) Add eBPF based queue selection to tun, from Jason Wang.

    6) Lockless qdisc support, from John Fastabend.

    7) SCTP stream interleave support, from Xin Long.

    8) Smoother TCP receive autotuning, from Eric Dumazet.

    9) Lots of erspan tunneling enhancements, from William Tu.

    10) Add true function call support to BPF, from Alexei Starovoitov.

    11) Add explicit support for GRO HW offloading, from Michael Chan.

    12) Support extack generation in more netlink subsystems. From Alexander
    Aring, Quentin Monnet, and Jakub Kicinski.

    13) Add 1000BaseX, flow control, and EEE support to mvneta driver. From
    Russell King.

    14) Add flow table abstraction to netfilter, from Pablo Neira Ayuso.

    15) Many improvements and simplifications to the NFP driver bpf JIT,
    from Jakub Kicinski.

    16) Support for ipv6 non-equal cost multipath routing, from Ido
    Schimmel.

    17) Add resource abstration to devlink, from Arkadi Sharshevsky.

    18) Packet scheduler classifier shared filter block support, from Jiri
    Pirko.

    19) Avoid locking in act_csum, from Davide Caratti.

    20) devinet_ioctl() simplifications from Al viro.

    21) More TCP bpf improvements from Lawrence Brakmo.

    22) Add support for onlink ipv6 route flag, similar to ipv4, from David
    Ahern.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1925 commits)
    tls: Add support for encryption using async offload accelerator
    ip6mr: fix stale iterator
    net/sched: kconfig: Remove blank help texts
    openvswitch: meter: Use 64-bit arithmetic instead of 32-bit
    tcp_nv: fix potential integer overflow in tcpnv_acked
    r8169: fix RTL8168EP take too long to complete driver initialization.
    qmi_wwan: Add support for Quectel EP06
    rtnetlink: enable IFLA_IF_NETNSID for RTM_NEWLINK
    ipmr: Fix ptrdiff_t print formatting
    ibmvnic: Wait for device response when changing MAC
    qlcnic: fix deadlock bug
    tcp: release sk_frag.page in tcp_disconnect
    ipv4: Get the address of interface correctly.
    net_sched: gen_estimator: fix lockdep splat
    net: macb: Handle HRESP error
    net/mlx5e: IPoIB, Fix copy-paste bug in flow steering refactoring
    ipv6: addrconf: break critical section in addrconf_verify_rtnl()
    ipv6: change route cache aging logic
    i40e/i40evf: Update DESC_NEEDED value to reflect larger value
    bnxt_en: cleanup DIM work on device shutdown
    ...

    Linus Torvalds
     

25 Jan, 2018

1 commit

  • Some of the drivers may use the macro at runtime flow, like

    struct property_entry p[10];
    ...
    p[index++] = PROPERTY_ENTRY_U8("u8 property", u8_data);

    In that case and absence of the data type compiler fails the build:

    drivers/char/ipmi/ipmi_dmi.c:79:29: error: Expected ; at end of statement
    drivers/char/ipmi/ipmi_dmi.c:79:29: error: got {

    Acked-by: Corey Minyard
    Cc: Corey Minyard
    Signed-off-by: Andy Shevchenko
    Signed-off-by: Greg Kroah-Hartman

    Andy Shevchenko
     

22 Jan, 2018

4 commits

  • Implement a new helper function fwnode_get_next_available_child_node(),
    which enables obtaining next enabled child fwnode, which
    works on a similar basis to OF's of_get_next_available_child().

    This commit also introduces a macro, thanks to which it is
    possible to iterate over the available fwnodes, using the
    new function described above.

    Signed-off-by: Marcin Wojtas
    Signed-off-by: David S. Miller

    Marcin Wojtas
     
  • Until now there were two very similar functions allowing
    to get Linux IRQ number from ACPI handle (acpi_irq_get())
    and OF node (of_irq_get()). The first one appeared to be used
    only as a subroutine of platform_irq_get(), which (in the generic
    code) limited IRQ obtaining from _CRS method only to nodes
    associated to kernel's struct platform_device.

    This patch introduces a new helper routine - fwnode_irq_get(),
    which allows to get the IRQ number directly from the fwnode
    to be used as common for OF/ACPI worlds. It is usable not
    only for the parents fwnodes, but also for the child nodes
    comprising their own _CRS methods with interrupts description.

    In order to be able o satisfy compilation with !CONFIG_ACPI
    and also simplify the new code, introduce a helper macro
    (ACPI_HANDLE_FWNODE), with which it is possible to reach
    an ACPI handle directly from its fwnode.

    Signed-off-by: Marcin Wojtas
    Signed-off-by: David S. Miller

    Marcin Wojtas
     
  • Until now there were two almost identical functions for
    obtaining network PHY mode - of_get_phy_mode() and,
    more generic, device_get_phy_mode(). However it is not uncommon,
    that the network interface is represented as a child
    of the actual controller, hence it is not associated
    directly to any struct device, required by the latter
    routine.

    This commit allows for getting the PHY mode for
    children nodes in the ACPI world by introducing a new function -
    fwnode_get_phy_mode(). This commit also changes
    device_get_phy_mode() routine to be its wrapper, in order
    to prevent unnecessary duplication.

    Signed-off-by: Marcin Wojtas
    Acked-by: Rafael J. Wysocki
    Signed-off-by: David S. Miller

    Marcin Wojtas
     
  • Until now there were two almost identical functions for
    obtaining MAC address - of_get_mac_address() and, more generic,
    device_get_mac_address(). However it is not uncommon,
    that the network interface is represented as a child
    of the actual controller, hence it is not associated
    directly to any struct device, required by the latter
    routine.

    This commit allows for getting the MAC address for
    children nodes in the ACPI world by introducing a new function -
    fwnode_get_mac_address(). This commit also changes
    device_get_mac_address() routine to be its wrapper, in order
    to prevent unnecessary duplication.

    Signed-off-by: Marcin Wojtas
    Acked-by: Rafael J. Wysocki
    Signed-off-by: David S. Miller

    Marcin Wojtas
     

13 Dec, 2017

1 commit