Date: Thu, 10 Aug 2017 13:45:56 +0000 (UTC) From: Marcin Wojtas <mw@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322359 - head/sys/dev/ofw Message-ID: <201708101345.v7ADjuCl012424@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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@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. */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708101345.v7ADjuCl012424>