@@ -759,13 +759,8 @@ EXPORT_SYMBOL_GPL(fwnode_get_next_available_child_node);
759759struct fwnode_handle * device_get_next_child_node (struct device * dev ,
760760 struct fwnode_handle * child )
761761{
762- struct acpi_device * adev = ACPI_COMPANION (dev );
763- struct fwnode_handle * fwnode = NULL , * next ;
764-
765- if (dev -> of_node )
766- fwnode = of_fwnode_handle (dev -> of_node );
767- else if (adev )
768- fwnode = acpi_fwnode_handle (adev );
762+ const struct fwnode_handle * fwnode = dev_fwnode (dev );
763+ struct fwnode_handle * next ;
769764
770765 /* Try to find a child in primary fwnode */
771766 next = fwnode_get_next_child_node (fwnode , child );
@@ -868,28 +863,31 @@ EXPORT_SYMBOL_GPL(device_get_child_node_count);
868863
869864bool device_dma_supported (struct device * dev )
870865{
866+ const struct fwnode_handle * fwnode = dev_fwnode (dev );
867+
871868 /* For DT, this is always supported.
872869 * For ACPI, this depends on CCA, which
873870 * is determined by the acpi_dma_supported().
874871 */
875- if (IS_ENABLED ( CONFIG_OF ) && dev -> of_node )
872+ if (is_of_node ( fwnode ) )
876873 return true;
877874
878- return acpi_dma_supported (ACPI_COMPANION ( dev ));
875+ return acpi_dma_supported (to_acpi_device_node ( fwnode ));
879876}
880877EXPORT_SYMBOL_GPL (device_dma_supported );
881878
882879enum dev_dma_attr device_get_dma_attr (struct device * dev )
883880{
881+ const struct fwnode_handle * fwnode = dev_fwnode (dev );
884882 enum dev_dma_attr attr = DEV_DMA_NOT_SUPPORTED ;
885883
886- if (IS_ENABLED ( CONFIG_OF ) && dev -> of_node ) {
887- if (of_dma_is_coherent (dev -> of_node ))
884+ if (is_of_node ( fwnode ) ) {
885+ if (of_dma_is_coherent (to_of_node ( fwnode ) ))
888886 attr = DEV_DMA_COHERENT ;
889887 else
890888 attr = DEV_DMA_NON_COHERENT ;
891889 } else
892- attr = acpi_get_dma_attr (ACPI_COMPANION ( dev ));
890+ attr = acpi_get_dma_attr (to_acpi_device_node ( fwnode ));
893891
894892 return attr ;
895893}
@@ -1007,14 +1005,13 @@ EXPORT_SYMBOL(device_get_mac_address);
10071005 * Returns Linux IRQ number on success. Other values are determined
10081006 * accordingly to acpi_/of_ irq_get() operation.
10091007 */
1010- int fwnode_irq_get (struct fwnode_handle * fwnode , unsigned int index )
1008+ int fwnode_irq_get (const struct fwnode_handle * fwnode , unsigned int index )
10111009{
1012- struct device_node * of_node = to_of_node (fwnode );
10131010 struct resource res ;
10141011 int ret ;
10151012
1016- if (IS_ENABLED ( CONFIG_OF ) && of_node )
1017- return of_irq_get (of_node , index );
1013+ if (is_of_node ( fwnode ) )
1014+ return of_irq_get (to_of_node ( fwnode ) , index );
10181015
10191016 ret = acpi_irq_get (ACPI_HANDLE_FWNODE (fwnode ), index , & res );
10201017 if (ret )
0 commit comments