svn commit: r308524 - head/sys/dev/fdt

Andrew Turner andrew at FreeBSD.org
Fri Nov 11 14:19:14 UTC 2016


Author: andrew
Date: Fri Nov 11 14:19:12 2016
New Revision: 308524
URL: https://svnweb.freebsd.org/changeset/base/308524

Log:
  Replace OF_getprop ... fdt32_to_cpu with OF_getencprop. The latter
  correctly adjusts for the endian.
  
  MFC after:	1 week
  Sponsored by:	ABT Systems Ltd

Modified:
  head/sys/dev/fdt/fdt_common.c

Modified: head/sys/dev/fdt/fdt_common.c
==============================================================================
--- head/sys/dev/fdt/fdt_common.c	Fri Nov 11 09:03:13 2016	(r308523)
+++ head/sys/dev/fdt/fdt_common.c	Fri Nov 11 14:19:12 2016	(r308524)
@@ -419,13 +419,13 @@ fdt_addrsize_cells(phandle_t node, int *
 	 * Retrieve #{address,size}-cells.
 	 */
 	cell_size = sizeof(cell);
-	if (OF_getprop(node, "#address-cells", &cell, cell_size) < cell_size)
-		cell = 2;
-	*addr_cells = fdt32_to_cpu((int)cell);
+	if (OF_getencprop(node, "#address-cells", &cell, cell_size) < cell_size)
+		*addr_cells = 2;
+	*addr_cells = (int)cell;
 
-	if (OF_getprop(node, "#size-cells", &cell, cell_size) < cell_size)
+	if (OF_getencprop(node, "#size-cells", &cell, cell_size) < cell_size)
 		cell = 1;
-	*size_cells = fdt32_to_cpu((int)cell);
+	*size_cells = (int)cell;
 
 	if (*addr_cells > 3 || *size_cells > 2)
 		return (ERANGE);
@@ -540,11 +540,11 @@ fdt_get_phyaddr(phandle_t node, device_t
 
 	phy_node = OF_node_from_xref(phy_handle);
 
-	if (OF_getprop(phy_node, "reg", (void *)&phy_reg,
+	if (OF_getencprop(phy_node, "reg", (void *)&phy_reg,
 	    sizeof(phy_reg)) <= 0)
 		return (ENXIO);
 
-	*phy_addr = fdt32_to_cpu(phy_reg);
+	*phy_addr = phy_reg;
 
 	/*
 	 * Search for softc used to communicate with phy.


More information about the svn-src-head mailing list