Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'devprop-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull device properties framework updates from Rafael Wysocki:
"These unify device properties access in some pieces of code and make
related changes.

Specifics:

- Handle device properties with software node API in the ACPI IORT
table parsing code (Heikki Krogerus).

- Unify of_node access in the common device properties code, constify
the acpi_dma_supported() argument pointer and fix up CONFIG_ACPI=n
stubs of some functions related to device properties (Andy
Shevchenko)"

* tag 'devprop-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
device property: Unify access to of_node
ACPI: scan: Constify acpi_dma_supported() helper function
ACPI: property: Constify stubs for CONFIG_ACPI=n case
ACPI: IORT: Handle device properties with software node API
device property: Retrieve fwnode from of_node via accessor

+22 -25
+1 -1
drivers/acpi/arm64/iort.c
··· 976 976 FIELD_GET(ACPI_IORT_NC_PASID_BITS, 977 977 nc->node_flags)); 978 978 979 - if (device_add_properties(dev, props)) 979 + if (device_create_managed_software_node(dev, props, NULL)) 980 980 dev_warn(dev, "Could not add device properties\n"); 981 981 } 982 982
+1 -1
drivers/acpi/scan.c
··· 1411 1411 * 1412 1412 * Return false if DMA is not supported. Otherwise, return true 1413 1413 */ 1414 - bool acpi_dma_supported(struct acpi_device *adev) 1414 + bool acpi_dma_supported(const struct acpi_device *adev) 1415 1415 { 1416 1416 if (!adev) 1417 1417 return false;
+14 -17
drivers/base/property.c
··· 21 21 struct fwnode_handle *dev_fwnode(struct device *dev) 22 22 { 23 23 return IS_ENABLED(CONFIG_OF) && dev->of_node ? 24 - &dev->of_node->fwnode : dev->fwnode; 24 + of_fwnode_handle(dev->of_node) : dev->fwnode; 25 25 } 26 26 EXPORT_SYMBOL_GPL(dev_fwnode); 27 27 ··· 759 759 struct fwnode_handle *device_get_next_child_node(struct device *dev, 760 760 struct fwnode_handle *child) 761 761 { 762 - struct acpi_device *adev = ACPI_COMPANION(dev); 763 - struct fwnode_handle *fwnode = NULL, *next; 764 - 765 - if (dev->of_node) 766 - fwnode = &dev->of_node->fwnode; 767 - else if (adev) 768 - fwnode = acpi_fwnode_handle(adev); 762 + const struct fwnode_handle *fwnode = dev_fwnode(dev); 763 + struct fwnode_handle *next; 769 764 770 765 /* Try to find a child in primary fwnode */ 771 766 next = fwnode_get_next_child_node(fwnode, child); ··· 863 868 864 869 bool device_dma_supported(struct device *dev) 865 870 { 871 + const struct fwnode_handle *fwnode = dev_fwnode(dev); 872 + 866 873 /* For DT, this is always supported. 867 874 * For ACPI, this depends on CCA, which 868 875 * is determined by the acpi_dma_supported(). 869 876 */ 870 - if (IS_ENABLED(CONFIG_OF) && dev->of_node) 877 + if (is_of_node(fwnode)) 871 878 return true; 872 879 873 - return acpi_dma_supported(ACPI_COMPANION(dev)); 880 + return acpi_dma_supported(to_acpi_device_node(fwnode)); 874 881 } 875 882 EXPORT_SYMBOL_GPL(device_dma_supported); 876 883 877 884 enum dev_dma_attr device_get_dma_attr(struct device *dev) 878 885 { 886 + const struct fwnode_handle *fwnode = dev_fwnode(dev); 879 887 enum dev_dma_attr attr = DEV_DMA_NOT_SUPPORTED; 880 888 881 - if (IS_ENABLED(CONFIG_OF) && dev->of_node) { 882 - if (of_dma_is_coherent(dev->of_node)) 889 + if (is_of_node(fwnode)) { 890 + if (of_dma_is_coherent(to_of_node(fwnode))) 883 891 attr = DEV_DMA_COHERENT; 884 892 else 885 893 attr = DEV_DMA_NON_COHERENT; 886 894 } else 887 - attr = acpi_get_dma_attr(ACPI_COMPANION(dev)); 895 + attr = acpi_get_dma_attr(to_acpi_device_node(fwnode)); 888 896 889 897 return attr; 890 898 } ··· 1005 1007 * Returns Linux IRQ number on success. Other values are determined 1006 1008 * accordingly to acpi_/of_ irq_get() operation. 1007 1009 */ 1008 - int fwnode_irq_get(struct fwnode_handle *fwnode, unsigned int index) 1010 + int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index) 1009 1011 { 1010 - struct device_node *of_node = to_of_node(fwnode); 1011 1012 struct resource res; 1012 1013 int ret; 1013 1014 1014 - if (IS_ENABLED(CONFIG_OF) && of_node) 1015 - return of_irq_get(of_node, index); 1015 + if (is_of_node(fwnode)) 1016 + return of_irq_get(to_of_node(fwnode), index); 1016 1017 1017 1018 ret = acpi_irq_get(ACPI_HANDLE_FWNODE(fwnode), index, &res); 1018 1019 if (ret)
+1 -1
include/acpi/acpi_bus.h
··· 590 590 591 591 /* helper */ 592 592 593 - bool acpi_dma_supported(struct acpi_device *adev); 593 + bool acpi_dma_supported(const struct acpi_device *adev); 594 594 enum dev_dma_attr acpi_get_dma_attr(struct acpi_device *adev); 595 595 int acpi_dma_get_range(struct device *dev, u64 *dma_addr, u64 *offset, 596 596 u64 *size);
+4 -4
include/linux/acpi.h
··· 766 766 return false; 767 767 } 768 768 769 - static inline struct acpi_device *to_acpi_device_node(struct fwnode_handle *fwnode) 769 + static inline struct acpi_device *to_acpi_device_node(const struct fwnode_handle *fwnode) 770 770 { 771 771 return NULL; 772 772 } ··· 776 776 return false; 777 777 } 778 778 779 - static inline struct acpi_data_node *to_acpi_data_node(struct fwnode_handle *fwnode) 779 + static inline struct acpi_data_node *to_acpi_data_node(const struct fwnode_handle *fwnode) 780 780 { 781 781 return NULL; 782 782 } 783 783 784 - static inline bool acpi_data_node_match(struct fwnode_handle *fwnode, 784 + static inline bool acpi_data_node_match(const struct fwnode_handle *fwnode, 785 785 const char *name) 786 786 { 787 787 return false; ··· 912 912 return NULL; 913 913 } 914 914 915 - static inline bool acpi_dma_supported(struct acpi_device *adev) 915 + static inline bool acpi_dma_supported(const struct acpi_device *adev) 916 916 { 917 917 return false; 918 918 }
+1 -1
include/linux/property.h
··· 119 119 struct fwnode_handle *fwnode_handle_get(struct fwnode_handle *fwnode); 120 120 void fwnode_handle_put(struct fwnode_handle *fwnode); 121 121 122 - int fwnode_irq_get(struct fwnode_handle *fwnode, unsigned int index); 122 + int fwnode_irq_get(const struct fwnode_handle *fwnode, unsigned int index); 123 123 124 124 unsigned int device_get_child_node_count(struct device *dev); 125 125