From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fOoTC-0002K2-Vr for barebox@lists.infradead.org; Fri, 01 Jun 2018 18:08:16 +0000 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Fri, 1 Jun 2018 20:07:48 +0200 Message-Id: <20180601180750.5436-2-u.kleine-koenig@pengutronix.de> In-Reply-To: <20180601180750.5436-1-u.kleine-koenig@pengutronix.de> References: <20180601180750.5436-1-u.kleine-koenig@pengutronix.de> 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 2/4] libfile: implement new helper write_file_flash() To: barebox@lists.infradead.org Q29tcGFyZWQgdG8gd3JpdGVfZmlsZSgpIHRoaXMgbmV3IGZ1bmN0aW9uIGFsc28gY2FsbHMgZXJh c2UoKSB0byBiZQpzdWl0YWJsZSBmb3IgZmxhc2ggZGV2aWNlcy4KClNpZ25lZC1vZmYtYnk6IFV3 ZSBLbGVpbmUtS8O2bmlnIDx1LmtsZWluZS1rb2VuaWdAcGVuZ3V0cm9uaXguZGU+Ci0tLQogaW5j bHVkZS9saWJmaWxlLmggfCAgMSArCiBsaWIvbGliZmlsZS5jICAgICB8IDMzICsrKysrKysrKysr KysrKysrKysrKysrKysrKysrKysrKwogMiBmaWxlcyBjaGFuZ2VkLCAzNCBpbnNlcnRpb25zKCsp CgpkaWZmIC0tZ2l0IGEvaW5jbHVkZS9saWJmaWxlLmggYi9pbmNsdWRlL2xpYmZpbGUuaAppbmRl eCBmZDJmYWRlYWE4MWEuLjJjNWVlZjcxZjE2OSAxMDA2NDQKLS0tIGEvaW5jbHVkZS9saW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