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.87 #1 (Red Hat Linux)) id 1e6YvK-0004me-6D for barebox@lists.infradead.org; Mon, 23 Oct 2017 09:21:32 +0000 From: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Mon, 23 Oct 2017 11:21:01 +0200 Message-Id: <20171023092103.10023-2-uwe@kleine-koenig.org> In-Reply-To: <20171023092103.10023-1-uwe@kleine-koenig.org> References: <20171023092103.10023-1-uwe@kleine-koenig.org> 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 1/3] ARM: i.MX: bbu-internal: make filename for device to write to adaptable To: barebox@lists.infradead.org Cc: =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= RnJvbTogVXdlIEtsZWluZS1Lw7ZuaWcgPHUua2xlaW5lLWtvZW5pZ0BwZW5ndXRyb25peC5kZT4K ClRoaXMgaXMgYSBwcmVwYXJhdG9yeSBmb3IgdGhlIG5leHQgcGF0Y2ggdGhhdCBhdXRvZGV0ZWN0 cyB0aGUgZGV2aWNlIHRvCndyaXRlIHRvLiBUbyBub3QgaGF2ZSB0byBtb2RpZnkgdGhlIGNhbGxi YWNrIGRhdGEgZm9yIGVhY2ggY2FsbCwgc29tZQpzdGF0aWMgZnVuY3Rpb25zIGdldCBhbiBhZGRp dGlvbmFsIHBhcmFtZXRlciB0byBhbGxvdyB0aGF0LgoKVGhpcyBkb2Vzbid0IGFmZmVjdCBib2Fy ZHMgbWFraW5nIHVzZSBvZiB0aGUgZmlsZSdzIGZ1bmN0aW9uIGFuZCBkb2Vzbid0CmNoYW5nZSBi ZWhhdmlvdXIuCgpTaW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