]> Git Repo - J-linux.git/commitdiff
Merge tag 'devprop-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
authorLinus Torvalds <[email protected]>
Tue, 9 Jul 2019 17:28:47 +0000 (10:28 -0700)
committerLinus Torvalds <[email protected]>
Tue, 9 Jul 2019 17:28:47 +0000 (10:28 -0700)
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

1  2 
drivers/acpi/property.c
include/linux/device.h
include/linux/property.h

diff --combined drivers/acpi/property.c
index da3ced297f19ad7493ab572a73007bd465b03285,39c64291098f9911daaa02932f7819ae933307a5..ea3d700da3ca6bdbe1defcf412ede93b16e6ac96
@@@ -1,4 -1,3 +1,4 @@@
 +// SPDX-License-Identifier: GPL-2.0-only
  /*
   * ACPI device specific properties support.
   *
@@@ -8,6 -7,10 +8,6 @@@
   * Authors: Mika Westerberg <[email protected]>
   *          Darren Hart <[email protected]>
   *          Rafael J. Wysocki <[email protected]>
 - *
 - * 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.
   */
  
  #include <linux/acpi.h>
@@@ -600,15 -603,29 +600,29 @@@ static struct fwnode_handle 
  acpi_fwnode_get_named_child_node(const struct fwnode_handle *fwnode,
                                 const char *childname)
  {
+       char name[ACPI_PATH_SEGMENT_LENGTH];
        struct fwnode_handle *child;
+       struct acpi_buffer path;
+       acpi_status status;
  
-       /*
-        * Find first matching named child node of this fwnode.
-        * For ACPI this will be a data only sub-node.
-        */
-       fwnode_for_each_child_node(fwnode, child)
-               if (acpi_data_node_match(child, childname))
+       path.length = sizeof(name);
+       path.pointer = name;
+       fwnode_for_each_child_node(fwnode, child) {
+               if (is_acpi_data_node(child)) {
+                       if (acpi_data_node_match(child, childname))
+                               return child;
+                       continue;
+               }
+               status = acpi_get_name(ACPI_HANDLE_FWNODE(child),
+                                      ACPI_SINGLE_NAME, &path);
+               if (ACPI_FAILURE(status))
+                       break;
+               if (!strncmp(name, childname, ACPI_NAMESEG_SIZE))
                        return child;
+       }
  
        return NULL;
  }
diff --combined include/linux/device.h
index b6ff25d9fff497fd0404138407f09d31b37414f9,5489a759e1c5aa7d6eee5cb5c823cb4f33109224..adfcabcba8a1e913b0160b27d6239846e78ac4d7
@@@ -42,7 -42,6 +42,7 @@@ struct iommu_ops
  struct iommu_group;
  struct iommu_fwspec;
  struct dev_pin_info;
 +struct iommu_param;
  
  struct bus_attribute {
        struct attribute        attr;
@@@ -705,8 -704,7 +705,8 @@@ extern unsigned long devm_get_free_page
                                         gfp_t gfp_mask, unsigned int order);
  extern void devm_free_pages(struct device *dev, unsigned long addr);
  
 -void __iomem *devm_ioremap_resource(struct device *dev, struct resource *res);
 +void __iomem *devm_ioremap_resource(struct device *dev,
 +                                  const struct resource *res);
  
  void __iomem *devm_of_iomap(struct device *dev,
                            struct device_node *node, int index,
  /* allows to add/remove a custom action to devres stack */
  int devm_add_action(struct device *dev, void (*action)(void *), void *data);
  void devm_remove_action(struct device *dev, void (*action)(void *), void *data);
 +void devm_release_action(struct device *dev, void (*action)(void *), void *data);
  
  static inline int devm_add_action_or_reset(struct device *dev,
                                           void (*action)(void *), void *data)
@@@ -962,7 -959,6 +962,7 @@@ struct dev_links_info 
   *            device (i.e. the bus driver that discovered the device).
   * @iommu_group: IOMMU group the device belongs to.
   * @iommu_fwspec: IOMMU-specific properties supplied by firmware.
 + * @iommu_param: Per device generic IOMMU runtime data
   *
   * @offline_disabled: If set, the device is permanently online.
   * @offline:  Set after successful invocation of bus type's .offline().
@@@ -1056,7 -1052,6 +1056,7 @@@ struct device 
        void    (*release)(struct device *dev);
        struct iommu_group      *iommu_group;
        struct iommu_fwspec     *iommu_fwspec;
 +      struct iommu_param      *iommu_param;
  
        bool                    offline_disabled:1;
        bool                    offline:1;
@@@ -1255,6 -1250,8 +1255,8 @@@ extern int device_for_each_child_revers
                     int (*fn)(struct device *dev, void *data));
  extern struct device *device_find_child(struct device *dev, void *data,
                                int (*match)(struct device *dev, void *data));
+ extern struct device *device_find_child_by_name(struct device *parent,
+                                               const char *name);
  extern int device_rename(struct device *dev, const char *new_name);
  extern int device_move(struct device *dev, struct device *new_parent,
                       enum dpm_order dpm_order);
diff --combined include/linux/property.h
index e9caa290cda528cbfbccab8e9077b27d872be69f,dbacf17fff2e807591e83ff80a412e56f2df66d0..5a910ad795910e01d4f0ae491809d5d4f9d71c5a
@@@ -1,10 -1,13 +1,10 @@@
 +/* SPDX-License-Identifier: GPL-2.0-only */
  /*
   * property.h - Unified device property interface.
   *
   * Copyright (C) 2014, Intel Corporation
   * Authors: Rafael J. Wysocki <[email protected]>
   *          Mika Westerberg <[email protected]>
 - *
 - * 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.
   */
  
  #ifndef _LINUX_PROPERTY_H_
@@@ -76,6 -79,10 +76,10 @@@ int fwnode_property_get_reference_args(
                                       unsigned int nargs, unsigned int index,
                                       struct fwnode_reference_args *args);
  
+ struct fwnode_handle *fwnode_find_reference(const struct fwnode_handle *fwnode,
+                                           const char *name,
+                                           unsigned int index);
  struct fwnode_handle *fwnode_get_parent(const struct fwnode_handle *fwnode);
  struct fwnode_handle *fwnode_get_next_parent(
        struct fwnode_handle *fwnode);
@@@ -141,6 -148,26 +145,26 @@@ static inline int device_property_read_
        return device_property_read_u64_array(dev, propname, val, 1);
  }
  
+ static inline int device_property_count_u8(struct device *dev, const char *propname)
+ {
+       return device_property_read_u8_array(dev, propname, NULL, 0);
+ }
+ static inline int device_property_count_u16(struct device *dev, const char *propname)
+ {
+       return device_property_read_u16_array(dev, propname, NULL, 0);
+ }
+ static inline int device_property_count_u32(struct device *dev, const char *propname)
+ {
+       return device_property_read_u32_array(dev, propname, NULL, 0);
+ }
+ static inline int device_property_count_u64(struct device *dev, const char *propname)
+ {
+       return device_property_read_u64_array(dev, propname, NULL, 0);
+ }
  static inline bool fwnode_property_read_bool(const struct fwnode_handle *fwnode,
                                             const char *propname)
  {
@@@ -171,6 -198,30 +195,30 @@@ static inline int fwnode_property_read_
        return fwnode_property_read_u64_array(fwnode, propname, val, 1);
  }
  
+ static inline int fwnode_property_count_u8(const struct fwnode_handle *fwnode,
+                                          const char *propname)
+ {
+       return fwnode_property_read_u8_array(fwnode, propname, NULL, 0);
+ }
+ static inline int fwnode_property_count_u16(const struct fwnode_handle *fwnode,
+                                           const char *propname)
+ {
+       return fwnode_property_read_u16_array(fwnode, propname, NULL, 0);
+ }
+ static inline int fwnode_property_count_u32(const struct fwnode_handle *fwnode,
+                                           const char *propname)
+ {
+       return fwnode_property_read_u32_array(fwnode, propname, NULL, 0);
+ }
+ static inline int fwnode_property_count_u64(const struct fwnode_handle *fwnode,
+                                           const char *propname)
+ {
+       return fwnode_property_read_u64_array(fwnode, propname, NULL, 0);
+ }
  /**
   * struct property_entry - "Built-in" device property representation.
   * @name: Name of the property.
@@@ -329,7 -380,54 +377,54 @@@ int fwnode_graph_parse_endpoint(const s
  /* -------------------------------------------------------------------------- */
  /* Software fwnode support - when HW description is incomplete or missing */
  
+ struct software_node;
+ /**
+  * struct software_node_ref_args - Reference with additional arguments
+  * @node: Reference to a software node
+  * @nargs: Number of elements in @args array
+  * @args: Integer arguments
+  */
+ struct software_node_ref_args {
+       const struct software_node *node;
+       unsigned int nargs;
+       u64 args[NR_FWNODE_REFERENCE_ARGS];
+ };
+ /**
+  * struct software_node_reference - Named software node reference property
+  * @name: Name of the property
+  * @nrefs: Number of elements in @refs array
+  * @refs: Array of references with optional arguments
+  */
+ struct software_node_reference {
+       const char *name;
+       unsigned int nrefs;
+       const struct software_node_ref_args *refs;
+ };
+ /**
+  * struct software_node - Software node description
+  * @name: Name of the software node
+  * @parent: Parent of the software node
+  * @properties: Array of device properties
+  * @references: Array of software node reference properties
+  */
+ struct software_node {
+       const char *name;
+       const struct software_node *parent;
+       const struct property_entry *properties;
+       const struct software_node_reference *references;
+ };
  bool is_software_node(const struct fwnode_handle *fwnode);
+ const struct software_node *to_software_node(struct fwnode_handle *fwnode);
+ struct fwnode_handle *software_node_fwnode(const struct software_node *node);
+ int software_node_register_nodes(const struct software_node *nodes);
+ void software_node_unregister_nodes(const struct software_node *nodes);
+ int software_node_register(const struct software_node *node);
  
  int software_node_notify(struct device *dev, unsigned long action);
  
This page took 0.075604 seconds and 4 git commands to generate.