From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-bn3nam01on0113.outbound.protection.outlook.com ([104.47.33.113] helo=NAM01-BN3-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fM9Bl-0001hY-Pq for barebox@lists.infradead.org; Fri, 25 May 2018 09:39:11 +0000 From: "Baeuerle, Florian" Date: Fri, 25 May 2018 09:38:56 +0000 Message-ID: <6e5f1325e3a931af10bf586e9a049692c8db1d63.camel@allegion.com> Content-Language: en-US Content-ID: MIME-Version: 1.0 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH v2] commands/of_property: add option to apply changes as fixup To: "barebox@lists.infradead.org" QWRkIGFuIC1mIG9wdGlvbiB0byB0aGUgb2ZfcHJvcGVydHkgY29tbWFuZCwgd2hpY2ggZGVmZXJz IHRoZSBkZXZpY2UNCnRyZWUgbW9kaWZpY2F0aW9uIHVudGlsIGJvb3QgdGltZSBhbmQgdGh1cyBh cHBsaWVzIHRoZSBtb2RpZmljYXRpb24gYXMgYQ0KZml4dXAgb24gdGhlIGxpbnV4IGRldmljZSB0 cmVlLg0KDQpTaWduZWQtb2ZmLWJ5OiBGbG9yaWFuIELDpHVlcmxlIDxmbG9yaWFuLmJhZXVlcmxl QGFsbGVnaW9uLmNvbT4NCi0tLQ0KIGNvbW1hbmRzL29mX3Byb3BlcnR5LmMgfCAxOTEgKysrKysr KysrKysrKysrKysrKysrKysrKysrKystLS0tLS0tLS0tLS0NCiAxIGZpbGUgY2hhbmdlZCwgMTM4 IGluc2VydGlvbnMoKyksIDUzIGRlbGV0aW9ucygtKQ0KDQpkaWZmIC0tZ2l0IGEvY29tbWFuZHMv b2ZfcHJvcGVydHkuYyBiL2NvbW1hbmRzL29mX3Byb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