svn commit: r322359 - head/sys/dev/ofw

Marcin Wojtas mw at FreeBSD.org
Thu Aug 10 13:45:58 UTC 2017


Author: mw
Date: Thu Aug 10 13:45:56 2017
New Revision: 322359
URL: https://svnweb.freebsd.org/changeset/base/322359

Log:
  Enable OF_setprop API function to add property in FDT
  
  This patch modifies function ofw_fdt_setprop (called by OF_setprop),
  so that it can add property, when replacing is not possible.
  Adding property is needed to fixup FDT's that have missing
  properties.
  
  Submitted by: Patryk Duda <pdk at semihalf.com>
  Reviewed by: nwhitehorn, cognet (mentor)
  Approved by: cognet (mentor)
  Obtained from: Semihalf
  Differential Revision: https://reviews.freebsd.org/D11879

Modified:
  head/sys/dev/ofw/ofw_fdt.c

Modified: head/sys/dev/ofw/ofw_fdt.c
==============================================================================
--- head/sys/dev/ofw/ofw_fdt.c	Thu Aug 10 13:32:04 2017	(r322358)
+++ head/sys/dev/ofw/ofw_fdt.c	Thu Aug 10 13:45:56 2017	(r322359)
@@ -381,7 +381,11 @@ ofw_fdt_setprop(ofw_t ofw, phandle_t package, const ch
 	if (offset < 0)
 		return (-1);
 
-	return (fdt_setprop_inplace(fdtp, offset, propname, buf, len));
+	if (fdt_setprop_inplace(fdtp, offset, propname, buf, len) != 0)
+		/* Try to add property, when setting value inplace failed */
+		return (fdt_setprop(fdtp, offset, propname, buf, len));
+
+	return (0);
 }
 
 /* Convert a device specifier to a fully qualified pathname. */


More information about the svn-src-head mailing list